solace-agent-mesh 1.7.0__py3-none-any.whl → 1.7.2__py3-none-any.whl
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.
Potentially problematic release.
This version of solace-agent-mesh might be problematic. Click here for more details.
- solace_agent_mesh/agent/proxies/base/component.py +11 -8
- solace_agent_mesh/agent/utils/artifact_helpers.py +45 -0
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/15e40e79.434bb30f.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/60702c0e.f9a9923a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/66d4869e.5d2e116a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/82fbfb93.d98a6526.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/924ffdeb.cc09c4ff.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c93cbaa0.9232f4b5.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{e6f9706b.045d0fa1.js → e6f9706b.4488e34c.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.c7ffdd82.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/main.60cfcf1b.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/runtime~main.ec22999d.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/artifact-management/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/audio-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/data-analysis-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/embeds/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/cli/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +4 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/components/projects/index.html +4 -18
- solace_agent_mesh/assets/docs/docs/documentation/components/proxies/index.html +10 -5
- solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deploying/kubernetes-deployment/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deploying/logging/index.html +31 -29
- solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/create-agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/create-gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/creating-python-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/evaluations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/bedrock-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/custom-agent/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/event-mesh-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mongodb-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rag-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rest-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/sql-database/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/teams-integration/index.html +90 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/agent-builder/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/connectors/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/secure-user-delegated-access/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/wheel-installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/artifact-storage/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/configurations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/session-storage/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/user-feedback/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-technical-migration-map/index.html +3 -3
- solace_agent_mesh/assets/docs/lunr-index-1762293572268.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1762293572268.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/assets/docs/sitemap.xml +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/eval_cmd.py +1 -1
- solace_agent_mesh/cli/commands/init_cmd/env_step.py +1 -1
- solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +2 -2
- solace_agent_mesh/cli/commands/plugin_cmd/add_cmd.py +2 -1
- solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +1 -0
- solace_agent_mesh/cli/commands/plugin_cmd/create_cmd.py +3 -3
- solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-tcIFZLis.js → authCallback-CaZrPAYy.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-CRYdKo2Q.js → client-cVxTmrt6.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-BGZP_riA.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-CBFhYdbQ.js +349 -0
- solace_agent_mesh/client/webui/frontend/static/assets/{vendor-CINwxvwV.js → vendor-BzZcWrf0.js} +83 -88
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
- solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
- solace_agent_mesh/common/sac/sam_component_base.py +44 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{_index-ByU1X1HD.js → _index-Ch6HyL-d.js} +21 -16
- solace_agent_mesh/config_portal/frontend/static/client/assets/{manifest-61038fc6.js → manifest-27eb8c5f.js} +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-B17tZKK7.css +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/index.html +2 -2
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_soft_delete_and_search.py +2 -43
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_default_agent_to_projects.py +2 -2
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +8 -103
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/project_responses.py +1 -0
- solace_agent_mesh/gateway/http_sse/routers/projects.py +40 -16
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +1 -1
- solace_agent_mesh/gateway/http_sse/services/project_service.py +47 -1
- solace_agent_mesh/gateway/http_sse/services/session_service.py +3 -3
- solace_agent_mesh/llm_detail.txt +3 -3
- solace_agent_mesh/templates/logging_config_template.yaml +43 -0
- solace_agent_mesh/templates/main_orchestrator.yaml +12 -1
- solace_agent_mesh/templates/plugin_readme_template.md +3 -25
- solace_agent_mesh/templates/plugin_tool_config_template.yaml +109 -0
- {solace_agent_mesh-1.7.0.dist-info → solace_agent_mesh-1.7.2.dist-info}/METADATA +3 -2
- {solace_agent_mesh-1.7.0.dist-info → solace_agent_mesh-1.7.2.dist-info}/RECORD +115 -113
- solace_agent_mesh/assets/docs/assets/js/15e40e79.36003774.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/66d4869e.830d443f.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/82fbfb93.139a1a1f.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/924ffdeb.8095e148.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c93cbaa0.eaff365e.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.5099c51e.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/main.e6488e8b.js +0 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.d9606d6a.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1762189824009.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1762189824009.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-CojeY_1w.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-ILja9MCG.js +0 -353
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-DxRwaWiE.css +0 -1
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_fulltext_search_indexes.py +0 -92
- solace_agent_mesh/templates/logging_config_template.ini +0 -45
- /solace_agent_mesh/assets/docs/assets/js/{main.e6488e8b.js.LICENSE.txt → main.60cfcf1b.js.LICENSE.txt} +0 -0
- /solace_agent_mesh/config_portal/frontend/static/client/assets/{root-BWvk5-gF.js → root-V2BeTIUc.js} +0 -0
- {solace_agent_mesh-1.7.0.dist-info → solace_agent_mesh-1.7.2.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.7.0.dist-info → solace_agent_mesh-1.7.2.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.7.0.dist-info → solace_agent_mesh-1.7.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
var cv=Object.defineProperty;var dv=(e,t,n)=>t in e?cv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var id=(e,t,n)=>dv(e,typeof t!="symbol"?t+"":t,n);import{c as uv}from"./client-cVxTmrt6.js";import{r as d,j as s,c as ef,a as is,R as Ol,b as fv,N as Js,L as ja,X as ls,E as tf,F as Gi,d as pv,e as Yi,f as Gn,g as nf,h as Ki,i as qi,k as At,C as aa,l as $l,m as Xi,A as rf,n as cs,P as of,B as mv,S as hv,o as gv,p as xv,q as vv,s as sf,I as Aa,T as wv,t as af,u as lf,v as ld,w as cd,x as dd,y as ud,z as bv,D as bo,G as ka,H as Fl,J as fd,K as pd,M as yv,O as cf,Q as md,W as Cv,U as Ev,V as Sv,Y as Nv,Z as jv,_ as zl,$ as Av,a0 as Ta,a1 as kv,a2 as df,a3 as ia,a4 as Ul,a5 as Tv,a6 as hd,a7 as _v,a8 as Iv,a9 as uf,aa as Rv,ab as kt,ac as Tt,ad as Mv,ae as Pv,af as gd,ag as xd,ah as di,ai as Dv,aj as Lv,ak as Ov,al as $v,am as Fv,an as zv,ao as Uv,ap as Bv,aq as Hv,ar as Wv,as as Vv,at as ff,au as pf,av as Gv,aw as Yv,ax as Zi,ay as ui,az as Kv}from"./vendor-BzZcWrf0.js";/**
|
|
2
|
+
* react-router v7.9.5
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/var vd="popstate";function qv(e={}){function t(r,o){let{pathname:a,search:i,hash:l}=r.location;return Ji("",{pathname:a,search:i,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Yo(o)}return Zv(t,n,null,e)}function wt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function qn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Xv(){return Math.random().toString(36).substring(2,10)}function wd(e,t){return{usr:e.state,key:e.key,idx:t}}function Ji(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ds(t):t,state:n,key:t&&t.key||r||Xv()}}function Yo({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 ds(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Zv(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:a=!1}=r,i=o.history,l="POP",c=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function f(){l="POP";let w=p(),v=w==null?null:w-u;u=w,c&&c({action:l,location:g.location,delta:v})}function m(w,v){l="PUSH";let b=Ji(g.location,w,v);u=p()+1;let y=wd(b,u),C=g.createHref(b);try{i.pushState(y,"",C)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;o.location.assign(C)}a&&c&&c({action:l,location:g.location,delta:1})}function h(w,v){l="REPLACE";let b=Ji(g.location,w,v);u=p();let y=wd(b,u),C=g.createHref(b);i.replaceState(y,"",C),a&&c&&c({action:l,location:g.location,delta:0})}function x(w){return Jv(w)}let g={get action(){return l},get location(){return e(o,i)},listen(w){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(vd,f),c=w,()=>{o.removeEventListener(vd,f),c=null}},createHref(w){return t(o,w)},createURL:x,encodeLocation(w){let v=x(w);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(w){return i.go(w)}};return g}function Jv(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),wt(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Yo(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function mf(e,t,n="/"){return Qv(e,t,n,!1)}function Qv(e,t,n,r){let o=typeof t=="string"?ds(t):t,a=sr(o.pathname||"/",n);if(a==null)return null;let i=hf(e);ew(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=uw(a);l=cw(i[c],u,r)}return l}function hf(e,t=[],n=[],r="",o=!1){let a=(i,l,c=o,u)=>{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&c)return;wt(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let f=rr([r,p.relativePath]),m=n.concat(p);i.children&&i.children.length>0&&(wt(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),hf(i.children,t,m,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:iw(f,i.index),routesMeta:m})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,l);else for(let u of gf(i.path))a(i,l,!0,u)}),t}function gf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let i=gf(r.join("/")),l=[];return l.push(...i.map(c=>c===""?a:[a,c].join("/"))),o&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function ew(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:lw(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var tw=/^:[\w-]+$/,nw=3,rw=2,ow=1,sw=10,aw=-2,bd=e=>e==="*";function iw(e,t){let n=e.split("/"),r=n.length;return n.some(bd)&&(r+=aw),t&&(r+=rw),n.filter(o=>!bd(o)).reduce((o,a)=>o+(tw.test(a)?nw:a===""?ow:sw),r)}function lw(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function cw(e,t,n=!1){let{routesMeta:r}=e,o={},a="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,p=a==="/"?t:t.slice(a.length)||"/",f=la({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},p),m=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=la({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!f)return null;Object.assign(o,f.params),i.push({params:o,pathname:rr([a,f.pathname]),pathnameBase:hw(rr([a,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(a=rr([a,f.pathnameBase]))}return i}function la(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=dw(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((u,{paramName:p,isOptional:f},m)=>{if(p==="*"){let x=l[m]||"";i=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const h=l[m];return f&&!h?u[p]=void 0:u[p]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:i,pattern:e}}function dw(e,t=!1,n=!0){qn(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 r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function uw(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return qn(!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 sr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function fw(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?ds(e):e;return{pathname:n?n.startsWith("/")?n:pw(n,t):t,search:gw(r),hash:xw(o)}}function pw(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function fi(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. 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 mw(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function xf(e){let t=mw(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function vf(e,t,n,r=!1){let o;typeof e=="string"?o=ds(e):(o={...e},wt(!o.pathname||!o.pathname.includes("?"),fi("?","pathname","search",o)),wt(!o.pathname||!o.pathname.includes("#"),fi("#","pathname","hash",o)),wt(!o.search||!o.search.includes("#"),fi("#","search","hash",o)));let a=e===""||o.pathname==="",i=a?"/":o.pathname,l;if(i==null)l=n;else{let f=t.length-1;if(!r&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),f-=1;o.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=fw(o,l),u=i&&i!=="/"&&i.endsWith("/"),p=(a||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||p)&&(c.pathname+="/"),c}var rr=e=>e.join("/").replace(/\/\/+/g,"/"),hw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),gw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,xw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function vw(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var wf=["POST","PUT","PATCH","DELETE"];new Set(wf);var ww=["GET",...wf];new Set(ww);var yo=d.createContext(null);yo.displayName="DataRouter";var _a=d.createContext(null);_a.displayName="DataRouterState";d.createContext(!1);var bf=d.createContext({isTransitioning:!1});bf.displayName="ViewTransition";var bw=d.createContext(new Map);bw.displayName="Fetchers";var yw=d.createContext(null);yw.displayName="Await";var Zn=d.createContext(null);Zn.displayName="Navigation";var Ia=d.createContext(null);Ia.displayName="Location";var ur=d.createContext({outlet:null,matches:[],isDataRoute:!1});ur.displayName="Route";var Bl=d.createContext(null);Bl.displayName="RouteError";function Cw(e,{relative:t}={}){wt(us(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(Zn),{hash:o,pathname:a,search:i}=fs(e,{relative:t}),l=a;return n!=="/"&&(l=a==="/"?n:rr([n,a])),r.createHref({pathname:l,search:i,hash:o})}function us(){return d.useContext(Ia)!=null}function Wr(){return wt(us(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(Ia).location}var yf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Cf(e){d.useContext(Zn).static||d.useLayoutEffect(e)}function Ew(){let{isDataRoute:e}=d.useContext(ur);return e?Lw():Sw()}function Sw(){wt(us(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(yo),{basename:t,navigator:n}=d.useContext(Zn),{matches:r}=d.useContext(ur),{pathname:o}=Wr(),a=JSON.stringify(xf(r)),i=d.useRef(!1);return Cf(()=>{i.current=!0}),d.useCallback((c,u={})=>{if(qn(i.current,yf),!i.current)return;if(typeof c=="number"){n.go(c);return}let p=vf(c,JSON.parse(a),o,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:rr([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,a,o,e])}d.createContext(null);function fs(e,{relative:t}={}){let{matches:n}=d.useContext(ur),{pathname:r}=Wr(),o=JSON.stringify(xf(n));return d.useMemo(()=>vf(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function Nw(e,t,n,r,o){wt(us(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=d.useContext(Zn),{matches:i}=d.useContext(ur),l=i[i.length-1],c=l?l.params:{},u=l?l.pathname:"/",p=l?l.pathnameBase:"/",f=l&&l.route;{let b=f&&f.path||"";Ef(u,!f||b.endsWith("*")||b.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${b}">) 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.
|
|
11
|
+
|
|
12
|
+
Please change the parent <Route path="${b}"> to <Route path="${b==="/"?"*":`${b}/*`}">.`)}let m=Wr(),h;h=m;let x=h.pathname||"/",g=x;if(p!=="/"){let b=p.replace(/^\//,"").split("/");g="/"+x.replace(/^\//,"").split("/").slice(b.length).join("/")}let w=mf(e,{pathname:g});return qn(f||w!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),qn(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${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.`),_w(w&&w.map(b=>Object.assign({},b,{params:Object.assign({},c,b.params),pathname:rr([p,a.encodeLocation?a.encodeLocation(b.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?p:rr([p,a.encodeLocation?a.encodeLocation(b.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:b.pathnameBase])})),i,n,r,o)}function jw(){let e=Dw(),t=vw(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:a},"ErrorBoundary")," or"," ",d.createElement("code",{style:a},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:o},n):null,i)}var Aw=d.createElement(jw,null),kw=class extends d.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.unstable_onError?this.props.unstable_onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?d.createElement(ur.Provider,{value:this.props.routeContext},d.createElement(Bl.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Tw({routeContext:e,match:t,children:n}){let r=d.useContext(yo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(ur.Provider,{value:e},n)}function _w(e,t=[],n=null,r=null,o=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,i=n==null?void 0:n.errors;if(i!=null){let u=a.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);wt(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,c=-1;if(n)for(let u=0;u<a.length;u++){let p=a[u];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=u),p.route.id){let{loaderData:f,errors:m}=n,h=p.route.loader&&!f.hasOwnProperty(p.route.id)&&(!m||m[p.route.id]===void 0);if(p.route.lazy||h){l=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((u,p,f)=>{let m,h=!1,x=null,g=null;n&&(m=i&&p.route.id?i[p.route.id]:void 0,x=p.route.errorElement||Aw,l&&(c<0&&f===0?(Ef("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,g=null):c===f&&(h=!0,g=p.route.hydrateFallbackElement||null)));let w=t.concat(a.slice(0,f+1)),v=()=>{let b;return m?b=x:h?b=g:p.route.Component?b=d.createElement(p.route.Component,null):p.route.element?b=p.route.element:b=u,d.createElement(Tw,{match:p,routeContext:{outlet:u,matches:w,isDataRoute:n!=null},children:b})};return n&&(p.route.ErrorBoundary||p.route.errorElement||f===0)?d.createElement(kw,{location:n.location,revalidation:n.revalidation,component:x,error:m,children:v(),routeContext:{outlet:null,matches:w,isDataRoute:!0},unstable_onError:r}):v()},null)}function Hl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Iw(e){let t=d.useContext(yo);return wt(t,Hl(e)),t}function Rw(e){let t=d.useContext(_a);return wt(t,Hl(e)),t}function Mw(e){let t=d.useContext(ur);return wt(t,Hl(e)),t}function Wl(e){let t=Mw(e),n=t.matches[t.matches.length-1];return wt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Pw(){return Wl("useRouteId")}function Dw(){var r;let e=d.useContext(Bl),t=Rw("useRouteError"),n=Wl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Lw(){let{router:e}=Iw("useNavigate"),t=Wl("useNavigate"),n=d.useRef(!1);return Cf(()=>{n.current=!0}),d.useCallback(async(o,a={})=>{qn(n.current,yf),n.current&&(typeof o=="number"?e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var yd={};function Ef(e,t,n){!t&&!yd[e]&&(yd[e]=!0,qn(!1,n))}d.memo(Ow);function Ow({routes:e,future:t,state:n,unstable_onError:r}){return Nw(e,void 0,n,r,t)}function $w({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){wt(!us(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),l=d.useMemo(()=>({basename:i,navigator:o,static:a,future:{}}),[i,o,a]);typeof n=="string"&&(n=ds(n));let{pathname:c="/",search:u="",hash:p="",state:f=null,key:m="default"}=n,h=d.useMemo(()=>{let x=sr(c,i);return x==null?null:{location:{pathname:x,search:u,hash:p,state:f,key:m},navigationType:r}},[i,c,u,p,f,m,r]);return qn(h!=null,`<Router basename="${i}"> is not able to match the URL "${c}${u}${p}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:d.createElement(Zn.Provider,{value:l},d.createElement(Ia.Provider,{children:t,value:h}))}var Qs="get",ea="application/x-www-form-urlencoded";function Ra(e){return e!=null&&typeof e.tagName=="string"}function Fw(e){return Ra(e)&&e.tagName.toLowerCase()==="button"}function zw(e){return Ra(e)&&e.tagName.toLowerCase()==="form"}function Uw(e){return Ra(e)&&e.tagName.toLowerCase()==="input"}function Bw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Hw(e,t){return e.button===0&&(!t||t==="_self")&&!Bw(e)}var Ms=null;function Ww(){if(Ms===null)try{new FormData(document.createElement("form"),0),Ms=!1}catch{Ms=!0}return Ms}var Vw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pi(e){return e!=null&&!Vw.has(e)?(qn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ea}"`),null):e}function Gw(e,t){let n,r,o,a,i;if(zw(e)){let l=e.getAttribute("action");r=l?sr(l,t):null,n=e.getAttribute("method")||Qs,o=pi(e.getAttribute("enctype"))||ea,a=new FormData(e)}else if(Fw(e)||Uw(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?sr(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Qs,o=pi(e.getAttribute("formenctype"))||pi(l.getAttribute("enctype"))||ea,a=new FormData(l,e),!Ww()){let{name:u,type:p,value:f}=e;if(p==="image"){let m=u?`${u}.`:"";a.append(`${m}x`,"0"),a.append(`${m}y`,"0")}else u&&a.append(u,f)}}else{if(Ra(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Qs,r=null,o=ea,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Yw(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&sr(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function Kw(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 qw(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 Xw(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await Kw(a,n);return i.links?i.links():[]}return[]}));return e0(r.flat(1).filter(qw).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Cd(e,t,n,r,o,a){let i=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var p;return n[u].pathname!==c.pathname||((p=n[u].route.path)==null?void 0:p.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return a==="assets"?t.filter((c,u)=>i(c,u)||l(c,u)):a==="data"?t.filter((c,u)=>{var f;let p=r.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let m=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function Zw(e,t,{includeHydrateFallback:n}={}){return Jw(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function Jw(e){return[...new Set(e)]}function Qw(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function e0(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(Qw(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function Sf(){let e=d.useContext(yo);return Vl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function t0(){let e=d.useContext(_a);return Vl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Gl=d.createContext(void 0);Gl.displayName="FrameworkContext";function Nf(){let e=d.useContext(Gl);return Vl(e,"You must render this element inside a <HydratedRouter> element"),e}function n0(e,t){let n=d.useContext(Gl),[r,o]=d.useState(!1),[a,i]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:p,onTouchStart:f}=t,m=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let g=v=>{v.forEach(b=>{i(b.isIntersecting)})},w=new IntersectionObserver(g,{threshold:.5});return m.current&&w.observe(m.current),()=>{w.disconnect()}}},[e]),d.useEffect(()=>{if(r){let g=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(g)}}},[r]);let h=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,m,{}]:[a,m,{onFocus:Io(l,h),onBlur:Io(c,x),onMouseEnter:Io(u,h),onMouseLeave:Io(p,x),onTouchStart:Io(f,h)}]:[!1,m,{}]}function Io(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function r0({page:e,...t}){let{router:n}=Sf(),r=d.useMemo(()=>mf(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(s0,{page:e,matches:r,...t}):null}function o0(e){let{manifest:t,routeModules:n}=Nf(),[r,o]=d.useState([]);return d.useEffect(()=>{let a=!1;return Xw(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function s0({page:e,matches:t,...n}){let r=Wr(),{manifest:o,routeModules:a}=Nf(),{basename:i}=Sf(),{loaderData:l,matches:c}=t0(),u=d.useMemo(()=>Cd(e,t,c,o,r,"data"),[e,t,c,o,r]),p=d.useMemo(()=>Cd(e,t,c,o,r,"assets"),[e,t,c,o,r]),f=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,g=!1;if(t.forEach(v=>{var y;let b=o.routes[v.route.id];!b||!b.hasLoader||(!u.some(C=>C.route.id===v.route.id)&&v.route.id in l&&((y=a[v.route.id])!=null&&y.shouldRevalidate)||b.hasClientLoader?g=!0:x.add(v.route.id))}),x.size===0)return[];let w=Yw(e,i,"data");return g&&x.size>0&&w.searchParams.set("_routes",t.filter(v=>x.has(v.route.id)).map(v=>v.route.id).join(",")),[w.pathname+w.search]},[i,l,r,o,u,t,e,a]),m=d.useMemo(()=>Zw(p,o),[p,o]),h=o0(p);return d.createElement(d.Fragment,null,f.map(x=>d.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),m.map(x=>d.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),h.map(({key:x,link:g})=>d.createElement("link",{key:x,nonce:n.nonce,...g})))}function a0(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var jf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jf&&(window.__reactRouterVersion="7.9.5")}catch{}function i0({basename:e,children:t,window:n}){let r=d.useRef();r.current==null&&(r.current=qv({window:n,v5Compat:!0}));let o=r.current,[a,i]=d.useState({action:o.action,location:o.location}),l=d.useCallback(c=>{d.startTransition(()=>i(c))},[i]);return d.useLayoutEffect(()=>o.listen(l),[o,l]),d.createElement($w,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:o})}var Af=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kf=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,state:l,target:c,to:u,preventScrollReset:p,viewTransition:f,...m},h){let{basename:x}=d.useContext(Zn),g=typeof u=="string"&&Af.test(u),w,v=!1;if(typeof u=="string"&&g&&(w=u,jf))try{let L=new URL(window.location.href),$=u.startsWith("//")?new URL(L.protocol+u):new URL(u),D=sr($.pathname,x);$.origin===L.origin&&D!=null?u=D+$.search+$.hash:v=!0}catch{qn(!1,`<Link to="${u}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let b=Cw(u,{relative:o}),[y,C,k]=n0(r,m),E=u0(u,{replace:i,state:l,target:c,preventScrollReset:p,relative:o,viewTransition:f});function S(L){t&&t(L),L.defaultPrevented||E(L)}let N=d.createElement("a",{...m,...k,href:w||b,onClick:v||a?t:S,ref:a0(h,C),target:c,"data-discover":!g&&n==="render"?"true":void 0});return y&&!g?d.createElement(d.Fragment,null,N,d.createElement(r0,{page:b})):N});kf.displayName="Link";var l0=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:l,children:c,...u},p){let f=fs(i,{relative:u.relative}),m=Wr(),h=d.useContext(_a),{navigator:x,basename:g}=d.useContext(Zn),w=h!=null&&g0(f)&&l===!0,v=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,b=m.pathname,y=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(b=b.toLowerCase(),y=y?y.toLowerCase():null,v=v.toLowerCase()),y&&g&&(y=sr(y,g)||y);const C=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let k=b===v||!o&&b.startsWith(v)&&b.charAt(C)==="/",E=y!=null&&(y===v||!o&&y.startsWith(v)&&y.charAt(v.length)==="/"),S={isActive:k,isPending:E,isTransitioning:w},N=k?t:void 0,L;typeof r=="function"?L=r(S):L=[r,k?"active":null,E?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let $=typeof a=="function"?a(S):a;return d.createElement(kf,{...u,"aria-current":N,className:L,ref:p,style:$,to:i,viewTransition:l},typeof c=="function"?c(S):c)});l0.displayName="NavLink";var c0=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=Qs,action:l,onSubmit:c,relative:u,preventScrollReset:p,viewTransition:f,...m},h)=>{let x=m0(),g=h0(l,{relative:u}),w=i.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&Af.test(l),b=y=>{if(c&&c(y),y.defaultPrevented)return;y.preventDefault();let C=y.nativeEvent.submitter,k=(C==null?void 0:C.getAttribute("formmethod"))||i;x(C||y.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:o,state:a,relative:u,preventScrollReset:p,viewTransition:f})};return d.createElement("form",{ref:h,method:w,action:g,onSubmit:r?c:b,...m,"data-discover":!v&&e==="render"?"true":void 0})});c0.displayName="Form";function d0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Tf(e){let t=d.useContext(yo);return wt(t,d0(e)),t}function u0(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:i}={}){let l=Ew(),c=Wr(),u=fs(e,{relative:a});return d.useCallback(p=>{if(Hw(p,t)){p.preventDefault();let f=n!==void 0?n:Yo(c)===Yo(u);l(e,{replace:f,state:r,preventScrollReset:o,relative:a,viewTransition:i})}},[c,l,u,n,r,t,e,o,a,i])}var f0=0,p0=()=>`__${String(++f0)}__`;function m0(){let{router:e}=Tf("useSubmit"),{basename:t}=d.useContext(Zn),n=Pw();return d.useCallback(async(r,o={})=>{let{action:a,method:i,encType:l,formData:c,body:u}=Gw(r,t);if(o.navigate===!1){let p=o.fetcherKey||p0();await e.fetch(p,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:c,body:u,formMethod:o.method||i,formEncType:o.encType||l,flushSync:o.flushSync})}else await e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:c,body:u,formMethod:o.method||i,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[e,t,n])}function h0(e,{relative:t}={}){let{basename:n}=d.useContext(Zn),r=d.useContext(ur);wt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...fs(e||".",{relative:t})},i=Wr();if(e==null){a.search=i.search;let l=new URLSearchParams(a.search),c=l.getAll("index");if(c.some(p=>p==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let p=l.toString();a.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:rr([n,a.pathname])),Yo(a)}function g0(e,{relative:t}={}){let n=d.useContext(bf);wt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Tf("useViewTransitionState"),o=fs(e,{relative:t});if(!n.isTransitioning)return!1;let a=sr(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=sr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return la(o.pathname,i)!=null||la(o.pathname,a)!=null}function Ed(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ma(...e){return t=>{let n=!1;const r=e.map(o=>{const a=Ed(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():Ed(e[o],null)}}}}function Te(...e){return d.useCallback(Ma(...e),e)}function Cr(e){const t=x0(e),n=d.forwardRef((r,o)=>{const{children:a,...i}=r,l=d.Children.toArray(a),c=l.find(w0);if(c){const u=c.props.children,p=l.map(f=>f===c?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...i,ref:o,children:d.isValidElement(u)?d.cloneElement(u,void 0,p):null})}return s.jsx(t,{...i,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}var _f=Cr("Slot");function x0(e){const t=d.forwardRef((n,r)=>{const{children:o,...a}=n;if(d.isValidElement(o)){const i=y0(o),l=b0(a,o.props);return o.type!==d.Fragment&&(l.ref=r?Ma(r,i):i),d.cloneElement(o,l)}return d.Children.count(o)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var If=Symbol("radix.slottable");function v0(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=If,t}function w0(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===If}function b0(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const c=a(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function y0(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Sd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nd=ef,Ar=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Nd(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:a}=t,i=Object.keys(o).map(u=>{const p=n==null?void 0:n[u],f=a==null?void 0:a[u];if(p===null)return null;const m=Sd(p)||Sd(f);return o[u][m]}),l=n&&Object.entries(n).reduce((u,p)=>{let[f,m]=p;return m===void 0||(u[f]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,p)=>{let{class:f,className:m,...h}=p;return Object.entries(h).every(x=>{let[g,w]=x;return Array.isArray(w)?w.includes({...a,...l}[g]):{...a,...l}[g]===w})?[...u,f,m]:u},[]);return Nd(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Yl=()=>localStorage.getItem("access_token"),C0=()=>localStorage.getItem("refresh_token"),E0=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},S0=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},N0=async()=>{const e=C0();if(!e)return null;const t=await fetch("/api/v1/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})});if(t.ok){const n=await t.json();return E0(n.access_token,n.refresh_token),n.access_token}return S0(),window.location.href="/api/v1/auth/login",null},je=async(e,t={})=>{const n=Yl();if(!n)return fetch(e,t);const r=await fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${n}`}});if(r.status===401){const o=await N0();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},j0=async e=>{const t=await je("/api/v1/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({detail:"Failed to submit feedback"}));throw new Error(n.detail||"Failed to submit feedback")}return t.json()},Kl="-",A0=e=>{const t=T0(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Kl);return l[0]===""&&l.length!==1&&l.shift(),Rf(l,t)||k0(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},Rf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Rf(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(Kl);return(i=t.validators.find(({validator:l})=>l(a)))==null?void 0:i.classGroupId},jd=/^\[(.+)\]$/,k0=e=>{if(jd.test(e)){const t=jd.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},T0=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Qi(n[o],r,o,t);return r},Qi=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:Ad(t,o);a.classGroupId=n;return}if(typeof o=="function"){if(_0(o)){Qi(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,i])=>{Qi(i,Ad(t,a),n,r)})})},Ad=(e,t)=>{let n=e;return t.split(Kl).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},_0=e=>e.isThemeGetter,I0=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(a,i)=>{n.set(a,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(a){let i=n.get(a);if(i!==void 0)return i;if((i=r.get(a))!==void 0)return o(a,i),i},set(a,i){n.has(a)?n.set(a,i):o(a,i)}}},el="!",tl=":",R0=tl.length,M0=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const a=[];let i=0,l=0,c=0,u;for(let x=0;x<o.length;x++){let g=o[x];if(i===0&&l===0){if(g===tl){a.push(o.slice(c,x)),c=x+R0;continue}if(g==="/"){u=x;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const p=a.length===0?o:o.substring(c),f=P0(p),m=f!==p,h=u&&u>c?u-c:void 0;return{modifiers:a,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:h}};if(t){const o=t+tl,a=r;r=i=>i.startsWith(o)?a(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=a=>n({className:a,parseClassName:o})}return r},P0=e=>e.endsWith(el)?e.substring(0,e.length-1):e.startsWith(el)?e.substring(1):e,D0=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let a=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...a.sort(),i),a=[]):a.push(i)}),o.push(...a.sort()),o}},L0=e=>({cache:I0(e.cacheSize),parseClassName:M0(e),sortModifiers:D0(e),...A0(e)}),O0=/\s+/,$0=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:a}=t,i=[],l=e.trim().split(O0);let c="";for(let u=l.length-1;u>=0;u-=1){const p=l[u],{isExternal:f,modifiers:m,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:g}=n(p);if(f){c=p+(c.length>0?" "+c:c);continue}let w=!!g,v=r(w?x.substring(0,g):x);if(!v){if(!w){c=p+(c.length>0?" "+c:c);continue}if(v=r(x),!v){c=p+(c.length>0?" "+c:c);continue}w=!1}const b=a(m).join(":"),y=h?b+el:b,C=y+v;if(i.includes(C))continue;i.push(C);const k=o(v,w);for(let E=0;E<k.length;++E){const S=k[E];i.push(y+S)}c=p+(c.length>0?" "+c:c)}return c};function F0(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Mf(t))&&(r&&(r+=" "),r+=n);return r}const Mf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Mf(e[r]))&&(n&&(n+=" "),n+=t);return n};function z0(e,...t){let n,r,o,a=i;function i(c){const u=t.reduce((p,f)=>f(p),e());return n=L0(u),r=n.cache.get,o=n.cache.set,a=l,l(c)}function l(c){const u=r(c);if(u)return u;const p=$0(c,n);return o(c,p),p}return function(){return a(F0.apply(null,arguments))}}const xt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Pf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Df=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U0=/^\d+\/\d+$/,B0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,W0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,V0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zr=e=>U0.test(e),Ie=e=>!!e&&!Number.isNaN(Number(e)),gr=e=>!!e&&Number.isInteger(Number(e)),mi=e=>e.endsWith("%")&&Ie(e.slice(0,-1)),er=e=>B0.test(e),Y0=()=>!0,K0=e=>H0.test(e)&&!W0.test(e),Lf=()=>!1,q0=e=>V0.test(e),X0=e=>G0.test(e),Z0=e=>!ce(e)&&!de(e),J0=e=>Co(e,Ff,Lf),ce=e=>Pf.test(e),Rr=e=>Co(e,zf,K0),hi=e=>Co(e,rb,Ie),kd=e=>Co(e,Of,Lf),Q0=e=>Co(e,$f,X0),Ps=e=>Co(e,Uf,q0),de=e=>Df.test(e),Ro=e=>Eo(e,zf),eb=e=>Eo(e,ob),Td=e=>Eo(e,Of),tb=e=>Eo(e,Ff),nb=e=>Eo(e,$f),Ds=e=>Eo(e,Uf,!0),Co=(e,t,n)=>{const r=Pf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Eo=(e,t,n=!1)=>{const r=Df.exec(e);return r?r[1]?t(r[1]):n:!1},Of=e=>e==="position"||e==="percentage",$f=e=>e==="image"||e==="url",Ff=e=>e==="length"||e==="size"||e==="bg-size",zf=e=>e==="length",rb=e=>e==="number",ob=e=>e==="family-name",Uf=e=>e==="shadow",sb=()=>{const e=xt("color"),t=xt("font"),n=xt("text"),r=xt("font-weight"),o=xt("tracking"),a=xt("leading"),i=xt("breakpoint"),l=xt("container"),c=xt("spacing"),u=xt("radius"),p=xt("shadow"),f=xt("inset-shadow"),m=xt("text-shadow"),h=xt("drop-shadow"),x=xt("blur"),g=xt("perspective"),w=xt("aspect"),v=xt("ease"),b=xt("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...C(),de,ce],E=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],N=()=>[de,ce,c],L=()=>[Zr,"full","auto",...N()],$=()=>[gr,"none","subgrid",de,ce],D=()=>["auto",{span:["full",gr,de,ce]},gr,de,ce],M=()=>[gr,"auto",de,ce],R=()=>["auto","min","max","fr",de,ce],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...N()],G=()=>[Zr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],j=()=>[e,de,ce],_=()=>[...C(),Td,kd,{position:[de,ce]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",tb,J0,{size:[de,ce]}],Q=()=>[mi,Ro,Rr],W=()=>["","none","full",u,de,ce],U=()=>["",Ie,Ro,Rr],Y=()=>["solid","dashed","dotted","double"],P=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[Ie,mi,Td,kd],K=()=>["","none",x,de,ce],Z=()=>["none",Ie,de,ce],J=()=>["none",Ie,de,ce],oe=()=>[Ie,de,ce],re=()=>[Zr,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[er],breakpoint:[er],color:[Y0],container:[er],"drop-shadow":[er],ease:["in","out","in-out"],font:[Z0],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[er],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[er],shadow:[er],spacing:["px",Ie],text:[er],"text-shadow":[er],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zr,ce,de,w]}],container:["container"],columns:[{columns:[Ie,ce,de,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[gr,"auto",de,ce]}],basis:[{basis:[Zr,"full","auto",l,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,Zr,"auto","initial","none",ce]}],grow:[{grow:["",Ie,de,ce]}],shrink:[{shrink:["",Ie,de,ce]}],order:[{order:[gr,"first","last","none",de,ce]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],w:[{w:[l,"screen",...G()]}],"min-w":[{"min-w":[l,"screen","none",...G()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",n,Ro,Rr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,de,hi]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",mi,ce]}],"font-family":[{font:[eb,ce,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,de,ce]}],"line-clamp":[{"line-clamp":[Ie,"none",de,hi]}],leading:[{leading:[a,...N()]}],"list-image":[{"list-image":["none",de,ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",de,ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",de,Rr]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[Ie,"auto",de,ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de,ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",de,ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gr,de,ce],radial:["",de,ce],conic:[gr,de,ce]},nb,Q0]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,de,ce]}],"outline-w":[{outline:["",Ie,Ro,Rr]}],"outline-color":[{outline:j()}],shadow:[{shadow:["","none",p,Ds,Ps]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":["none",f,Ds,Ps]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[Ie,Rr]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":["none",m,Ds,Ps]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[Ie,de,ce]}],"mix-blend":[{"mix-blend":[...P(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":P()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[de,ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",de,ce]}],filter:[{filter:["","none",de,ce]}],blur:[{blur:K()}],brightness:[{brightness:[Ie,de,ce]}],contrast:[{contrast:[Ie,de,ce]}],"drop-shadow":[{"drop-shadow":["","none",h,Ds,Ps]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:["",Ie,de,ce]}],"hue-rotate":[{"hue-rotate":[Ie,de,ce]}],invert:[{invert:["",Ie,de,ce]}],saturate:[{saturate:[Ie,de,ce]}],sepia:[{sepia:["",Ie,de,ce]}],"backdrop-filter":[{"backdrop-filter":["","none",de,ce]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,de,ce]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,de,ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,de,ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,de,ce]}],"backdrop-invert":[{"backdrop-invert":["",Ie,de,ce]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,de,ce]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,de,ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,de,ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",de,ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",de,ce]}],ease:[{ease:["linear","initial",v,de,ce]}],delay:[{delay:[Ie,de,ce]}],animate:[{animate:["none",b,de,ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,de,ce]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:J()}],"scale-x":[{"scale-x":J()}],"scale-y":[{"scale-y":J()}],"scale-z":[{"scale-z":J()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[de,ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:j()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",de,ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",de,ce]}],fill:[{fill:["none",...j()]}],"stroke-w":[{stroke:[Ie,Ro,Rr,hi]}],stroke:[{stroke:["none",...j()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ab=z0(sb);function me(...e){return ab(ef(e))}const nl=e=>{try{const t=new URL(e);if(t.protocol!=="artifact:")return null;const n=t.pathname.split("/").filter(a=>a),r=n[n.length-1],o=t.searchParams.get("version");return{filename:r,version:o}}catch(t){return console.error("Invalid artifact URI:",t),null}},Bf=(e,t)=>{try{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t||"download",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch(n){console.error("Error downloading blob:",n)}},Hf=async(e,t,n)=>{try{let r,o=e.name;if(e.content){const a=atob(e.content),i=new Array(a.length);for(let c=0;c<a.length;c++)i[c]=a.charCodeAt(c);const l=new Uint8Array(i);r=new Blob([l],{type:e.mime_type||"application/octet-stream"})}else if(e.uri){const a=nl(e.uri);if(!a)throw new Error(`Invalid or unhandled URI format: ${e.uri}`);o=a.filename;const i=a.version||"latest";let l;t&&t.trim()&&t!=="null"&&t!=="undefined"?l=`/api/v1/artifacts/${encodeURIComponent(t)}/${encodeURIComponent(o)}/versions/${i}`:n?l=`/api/v1/artifacts/null/${encodeURIComponent(o)}/versions/${i}?project_id=${n}`:l=`/api/v1/artifacts/null/${encodeURIComponent(o)}/versions/${i}`;const c=await je(l,{credentials:"include"});if(!c.ok)throw new Error(`Failed to download file: ${c.statusText}`);r=await c.blob()}else throw new Error("File has no content or URI to download.");Bf(r,o)}catch(r){console.error("Error creating download link:",r)}},Pa=(e,t=2)=>{if(e===0)return"0 Bytes";if(e<0||!Number.isFinite(e))return"Invalid size";const n=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,a)).toFixed(r))+" "+o[a]},Ko=e=>{if(!e)return"N/A";try{const t=new Date(e);if(isNaN(t.getTime()))return"N/A";const r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.floor(r/60),a=Math.floor(o/60),i=Math.floor(a/24);return r<60?`${r}s ago`:o<60?`${o}m ago`:a<24?`${a}h ago`:i===1?"Yesterday":i<7?`${i}d ago`:t.toLocaleDateString()}catch(t){return console.error("Error formatting date:",t),"Invalid date"}},ql=e=>{if(!e)return"N/A";try{const t=new Date(e);return isNaN(t.getTime())?"N/A":t.toLocaleString()}catch{return"N/A"}},_d=(e="")=>`
|
|
13
|
+
break-words
|
|
14
|
+
leading-[24px]
|
|
15
|
+
|
|
16
|
+
/* Typography */
|
|
17
|
+
[&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:text-foreground
|
|
18
|
+
[&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-5 [&_h2]:text-foreground
|
|
19
|
+
[&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:text-foreground
|
|
20
|
+
[&_h4]:text-base [&_h4]:font-semibold [&_h4]:mb-2 [&_h4]:mt-3 [&_h4]:text-foreground
|
|
21
|
+
[&_h5]:text-sm [&_h5]:font-semibold [&_h5]:mb-1 [&_h5]:mt-2 [&_h5]:text-foreground
|
|
22
|
+
[&_h6]:text-xs [&_h6]:font-semibold [&_h6]:mb-1 [&_h6]:mt-2 [&_h6]:text-foreground
|
|
23
|
+
|
|
24
|
+
/* Paragraphs */
|
|
25
|
+
[&_p]:leading-[24px] [&_p]:text-foreground [&_p]:whitespace-pre-wrap
|
|
26
|
+
|
|
27
|
+
/* Text formatting */
|
|
28
|
+
[&_strong]:font-semibold [&_strong]:text-foreground
|
|
29
|
+
[&_em]:italic
|
|
30
|
+
[&_del]:line-through [&_del]:text-foreground
|
|
31
|
+
|
|
32
|
+
/* Links */
|
|
33
|
+
[&_a]:text-[var(--color-primary-wMain)] [&_a]:underline [&_a]:decoration-[var(--color-primary-wMain)] dark:[&_a]:text-[var(--color-primary-w20)] dark:[&_a]:decoration-[var(--color-primary-w20)]
|
|
34
|
+
[&_a:hover]:text-[var(--color-primary-w100)] [&_a:hover]:decoration-[var(--color-primary-w100)] dark:[&_a:hover]:text-[var(--color-primary-w10)] dark:[&_a:hover]:decoration-[var(--color-primary-w10)]
|
|
35
|
+
|
|
36
|
+
/* Lists */
|
|
37
|
+
[&_ul]:mb-4 [&_ul]:pl-6 [&_ul]:list-disc [&_ul]:space-y-1
|
|
38
|
+
[&_ol]:mb-4 [&_ol]:pl-6 [&_ol]:list-decimal [&_ol]:space-y-1
|
|
39
|
+
[&_li]:text-foreground [&_li]:leading-[24px]
|
|
40
|
+
[&_ul_ul]:mt-1 [&_ul_ul]:mb-1
|
|
41
|
+
[&_ol_ol]:mt-1 [&_ol_ol]:mb-1
|
|
42
|
+
|
|
43
|
+
/* Code */
|
|
44
|
+
[&_code]:bg-transparent [&_code]:py-0.5 [&_code]:rounded
|
|
45
|
+
[&_code]:text-sm [&_code]:font-mono [&_code]:font-semibold [&_code]:text-foreground [&_code]:break-words
|
|
46
|
+
[&_pre]:bg-transparent [&_pre]:p-4 [&_pre]:rounded-lg [&_pre]:overflow-x-auto [&_pre]:max-w-full
|
|
47
|
+
[&_pre]:mb-4 [&_pre]:border [&_pre]:border-border [&_pre]:whitespace-pre-wrap
|
|
48
|
+
[&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-sm [&_pre_code]:break-words
|
|
49
|
+
|
|
50
|
+
/* Blockquotes */
|
|
51
|
+
[&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4
|
|
52
|
+
[&_blockquote]:py-2 [&_blockquote]:mb-4 [&_blockquote]:italic
|
|
53
|
+
[&_blockquote]:text-foreground [&_blockquote]:bg-transparent
|
|
54
|
+
|
|
55
|
+
/* Tables */
|
|
56
|
+
[&_table]:w-full [&_table]:mb-4 [&_table]:border-collapse [&_table]:table-fixed [&_table]:max-w-full
|
|
57
|
+
[&_th]:border [&_th]:border-border [&_th]:px-3 [&_th]:py-2 [&_th]:break-words
|
|
58
|
+
[&_th]:bg-transparent [&_th]:font-semibold [&_th]:text-left
|
|
59
|
+
[&_td]:border [&_td]:border-border [&_td]:px-3 [&_td]:py-2 [&_td]:break-words
|
|
60
|
+
[&_tr:nth-child(even)]:bg-transparent
|
|
61
|
+
|
|
62
|
+
/* Horizontal rules */
|
|
63
|
+
[&_hr]:border-0 [&_hr]:border-t [&_hr]:border-border [&_hr]:my-6
|
|
64
|
+
|
|
65
|
+
/* Images */
|
|
66
|
+
[&_img]:max-w-full [&_img]:h-auto [&_img]:rounded [&_img]:my-2 [&_img]:object-contain
|
|
67
|
+
|
|
68
|
+
${e}
|
|
69
|
+
`.trim().replace(/\s+/g," "),ib=(e="")=>`
|
|
70
|
+
/* Buttons - "important" overrides for flow controls */
|
|
71
|
+
[&>button]:bg-[var(--color-background-w10)]
|
|
72
|
+
[&>button]:dark:!bg-[var(--color-background-w100)]
|
|
73
|
+
[&>button]:hover:bg-[var(--color-background-w20)]
|
|
74
|
+
[&>button]:dark:hover:!bg-[var(--color-primary-w60)]
|
|
75
|
+
[&>button]:text-[var(--color-primary-text-wMain)]
|
|
76
|
+
[&>button]:dark:text-[var(--color-primary-text-w10)]
|
|
77
|
+
[&>button]:!border
|
|
78
|
+
[&>button]:!border-[var(--color-secondary-w40)]
|
|
79
|
+
[&>button]:dark:!border-[var(--color-secondary-w70)]
|
|
80
|
+
|
|
81
|
+
${e}
|
|
82
|
+
`.trim().replace(/\s+/g," ");function Ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function lb(e,t){const n=d.createContext(t),r=a=>{const{children:i,...l}=a,c=d.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(a){const i=d.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,o]}function cn(e,t=[]){let n=[];function r(a,i){const l=d.createContext(i),c=n.length;n=[...n,i];const u=f=>{var v;const{scope:m,children:h,...x}=f,g=((v=m==null?void 0:m[e])==null?void 0:v[c])||l,w=d.useMemo(()=>x,Object.values(x));return s.jsx(g.Provider,{value:w,children:h})};u.displayName=a+"Provider";function p(f,m){var g;const h=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=d.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,p]}const o=()=>{const a=n.map(i=>d.createContext(i));return function(l){const c=(l==null?void 0:l[e])||a;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,cb(o,...t)]}function cb(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var db=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ve=db.reduce((e,t)=>{const n=Cr(`Primitive.${t}`),r=d.forwardRef((o,a)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Da(e,t){e&&is.flushSync(()=>e.dispatchEvent(t))}function It(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Xl(e,t=globalThis==null?void 0:globalThis.document){const n=It(e);d.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ub="DismissableLayer",rl="dismissableLayer.update",fb="dismissableLayer.pointerDownOutside",pb="dismissableLayer.focusOutside",Id,Wf=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),La=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:l,...c}=e,u=d.useContext(Wf),[p,f]=d.useState(null),m=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=d.useState({}),x=Te(t,S=>f(S)),g=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(w),b=p?g.indexOf(p):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,C=b>=v,k=gb(S=>{const N=S.target,L=[...u.branches].some($=>$.contains(N));!C||L||(o==null||o(S),i==null||i(S),S.defaultPrevented||l==null||l())},m),E=xb(S=>{const N=S.target;[...u.branches].some($=>$.contains(N))||(a==null||a(S),i==null||i(S),S.defaultPrevented||l==null||l())},m);return Xl(S=>{b===u.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},m),d.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Id=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),Rd(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Id)}},[p,m,n,u]),d.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),Rd())},[p,u]),d.useEffect(()=>{const S=()=>h({});return document.addEventListener(rl,S),()=>document.removeEventListener(rl,S)},[]),s.jsx(ve.div,{...c,ref:x,style:{pointerEvents:y?C?"auto":"none":void 0,...e.style},onFocusCapture:Ye(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Ye(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Ye(e.onPointerDownCapture,k.onPointerDownCapture)})});La.displayName=ub;var mb="DismissableLayerBranch",hb=d.forwardRef((e,t)=>{const n=d.useContext(Wf),r=d.useRef(null),o=Te(t,r);return d.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(ve.div,{...e,ref:o})});hb.displayName=mb;function gb(e,t=globalThis==null?void 0:globalThis.document){const n=It(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){Vf(fb,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xb(e,t=globalThis==null?void 0:globalThis.document){const n=It(e),r=d.useRef(!1);return d.useEffect(()=>{const o=a=>{a.target&&!r.current&&Vf(pb,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Rd(){const e=new CustomEvent(rl);document.dispatchEvent(e)}function Vf(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Da(o,a):o.dispatchEvent(a)}var st=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{},vb=Ol[" useId ".trim().toString()]||(()=>{}),wb=0;function an(e){const[t,n]=d.useState(vb());return st(()=>{n(r=>r??String(wb++))},[e]),t?`radix-${t}`:""}const bb=["top","right","bottom","left"],Er=Math.min,on=Math.max,ca=Math.round,Ls=Math.floor,Yn=e=>({x:e,y:e}),yb={left:"right",right:"left",bottom:"top",top:"bottom"},Cb={start:"end",end:"start"};function ol(e,t,n){return on(e,Er(t,n))}function ar(e,t){return typeof e=="function"?e(t):e}function ir(e){return e.split("-")[0]}function So(e){return e.split("-")[1]}function Zl(e){return e==="x"?"y":"x"}function Jl(e){return e==="y"?"height":"width"}const Eb=new Set(["top","bottom"]);function Wn(e){return Eb.has(ir(e))?"y":"x"}function Ql(e){return Zl(Wn(e))}function Sb(e,t,n){n===void 0&&(n=!1);const r=So(e),o=Ql(e),a=Jl(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=da(i)),[i,da(i)]}function Nb(e){const t=da(e);return[sl(e),t,sl(t)]}function sl(e){return e.replace(/start|end/g,t=>Cb[t])}const Md=["left","right"],Pd=["right","left"],jb=["top","bottom"],Ab=["bottom","top"];function kb(e,t,n){switch(e){case"top":case"bottom":return n?t?Pd:Md:t?Md:Pd;case"left":case"right":return t?jb:Ab;default:return[]}}function Tb(e,t,n,r){const o=So(e);let a=kb(ir(e),n==="start",r);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map(sl)))),a}function da(e){return e.replace(/left|right|bottom|top/g,t=>yb[t])}function _b(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gf(e){return typeof e!="number"?_b(e):{top:e,right:e,bottom:e,left:e}}function ua(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Dd(e,t,n){let{reference:r,floating:o}=e;const a=Wn(t),i=Ql(t),l=Jl(i),c=ir(t),u=a==="y",p=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let h;switch(c){case"top":h={x:p,y:r.y-o.height};break;case"bottom":h={x:p,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(So(t)){case"start":h[i]-=m*(n&&u?-1:1);break;case"end":h[i]+=m*(n&&u?-1:1);break}return h}const Ib=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,l=a.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:f}=Dd(u,r,c),m=r,h={},x=0;for(let g=0;g<l.length;g++){const{name:w,fn:v}=l[g],{x:b,y,data:C,reset:k}=await v({x:p,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:u,platform:i,elements:{reference:e,floating:t}});p=b??p,f=y??f,h={...h,[w]:{...h[w],...C}},k&&x<=50&&(x++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(u=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:p,y:f}=Dd(u,m,c)),g=-1)}return{x:p,y:f,placement:m,strategy:o,middlewareData:h}};async function qo(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:a,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:m=!1,padding:h=0}=ar(t,e),x=Gf(h),w=l[m?f==="floating"?"reference":"floating":f],v=ua(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(w)))==null||n?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:p,strategy:c})),b=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),C=await(a.isElement==null?void 0:a.isElement(y))?await(a.getScale==null?void 0:a.getScale(y))||{x:1,y:1}:{x:1,y:1},k=ua(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:c}):b);return{top:(v.top-k.top+x.top)/C.y,bottom:(k.bottom-v.bottom+x.bottom)/C.y,left:(v.left-k.left+x.left)/C.x,right:(k.right-v.right+x.right)/C.x}}const Rb=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:p=0}=ar(e,t)||{};if(u==null)return{};const f=Gf(p),m={x:n,y:r},h=Ql(o),x=Jl(h),g=await i.getDimensions(u),w=h==="y",v=w?"top":"left",b=w?"bottom":"right",y=w?"clientHeight":"clientWidth",C=a.reference[x]+a.reference[h]-m[h]-a.floating[x],k=m[h]-a.reference[h],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let S=E?E[y]:0;(!S||!await(i.isElement==null?void 0:i.isElement(E)))&&(S=l.floating[y]||a.floating[x]);const N=C/2-k/2,L=S/2-g[x]/2-1,$=Er(f[v],L),D=Er(f[b],L),M=$,R=S-g[x]-D,F=S/2-g[x]/2+N,z=ol(M,F,R),A=!c.arrow&&So(o)!=null&&F!==z&&a.reference[x]/2-(F<M?$:D)-g[x]/2<0,G=A?F<M?F-M:F-R:0;return{[h]:m[h]+G,data:{[h]:z,centerOffset:F-z-G,...A&&{alignmentOffset:G}},reset:A}}}),Mb=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:g=!0,...w}=ar(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const v=ir(o),b=Wn(l),y=ir(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),k=m||(y||!g?[da(l)]:Nb(l)),E=x!=="none";!m&&E&&k.push(...Tb(l,g,x,C));const S=[l,...k],N=await qo(t,w),L=[];let $=((r=a.flip)==null?void 0:r.overflows)||[];if(p&&L.push(N[v]),f){const F=Sb(o,i,C);L.push(N[F[0]],N[F[1]])}if($=[...$,{placement:o,overflows:L}],!L.every(F=>F<=0)){var D,M;const F=(((D=a.flip)==null?void 0:D.index)||0)+1,z=S[F];if(z&&(!(f==="alignment"?b!==Wn(z):!1)||$.every(j=>j.overflows[0]>0&&Wn(j.placement)===b)))return{data:{index:F,overflows:$},reset:{placement:z}};let A=(M=$.filter(G=>G.overflows[0]<=0).sort((G,j)=>G.overflows[1]-j.overflows[1])[0])==null?void 0:M.placement;if(!A)switch(h){case"bestFit":{var R;const G=(R=$.filter(j=>{if(E){const _=Wn(j.placement);return _===b||_==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(_=>_>0).reduce((_,O)=>_+O,0)]).sort((j,_)=>j[1]-_[1])[0])==null?void 0:R[0];G&&(A=G);break}case"initialPlacement":A=l;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function Ld(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Od(e){return bb.some(t=>e[t]>=0)}const Pb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ar(e,t);switch(r){case"referenceHidden":{const a=await qo(t,{...o,elementContext:"reference"}),i=Ld(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Od(i)}}}case"escaped":{const a=await qo(t,{...o,altBoundary:!0}),i=Ld(a,n.floating);return{data:{escapedOffsets:i,escaped:Od(i)}}}default:return{}}}}},Yf=new Set(["left","top"]);async function Db(e,t){const{placement:n,platform:r,elements:o}=e,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=ir(n),l=So(n),c=Wn(n)==="y",u=Yf.has(i)?-1:1,p=a&&c?-1:1,f=ar(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*p,y:m*u}:{x:m*u,y:h*p}}const Lb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:l}=t,c=await Db(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:a+c.y,data:{...c,placement:i}}}}},Ob=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x:v,y:b}=w;return{x:v,y:b}}},...c}=ar(e,t),u={x:n,y:r},p=await qo(t,c),f=Wn(ir(o)),m=Zl(f);let h=u[m],x=u[f];if(a){const w=m==="y"?"top":"left",v=m==="y"?"bottom":"right",b=h+p[w],y=h-p[v];h=ol(b,h,y)}if(i){const w=f==="y"?"top":"left",v=f==="y"?"bottom":"right",b=x+p[w],y=x-p[v];x=ol(b,x,y)}const g=l.fn({...t,[m]:h,[f]:x});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:a,[f]:i}}}}}},$b=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ar(e,t),p={x:n,y:r},f=Wn(o),m=Zl(f);let h=p[m],x=p[f];const g=ar(l,t),w=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const y=m==="y"?"height":"width",C=a.reference[m]-a.floating[y]+w.mainAxis,k=a.reference[m]+a.reference[y]-w.mainAxis;h<C?h=C:h>k&&(h=k)}if(u){var v,b;const y=m==="y"?"width":"height",C=Yf.has(ir(o)),k=a.reference[f]-a.floating[y]+(C&&((v=i.offset)==null?void 0:v[f])||0)+(C?0:w.crossAxis),E=a.reference[f]+a.reference[y]+(C?0:((b=i.offset)==null?void 0:b[f])||0)-(C?w.crossAxis:0);x<k?x=k:x>E&&(x=E)}return{[m]:h,[f]:x}}}},Fb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:i,elements:l}=t,{apply:c=()=>{},...u}=ar(e,t),p=await qo(t,u),f=ir(o),m=So(o),h=Wn(o)==="y",{width:x,height:g}=a.floating;let w,v;f==="top"||f==="bottom"?(w=f,v=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,w=m==="end"?"top":"bottom");const b=g-p.top-p.bottom,y=x-p.left-p.right,C=Er(g-p[w],b),k=Er(x-p[v],y),E=!t.middlewareData.shift;let S=C,N=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=b),E&&!m){const $=on(p.left,0),D=on(p.right,0),M=on(p.top,0),R=on(p.bottom,0);h?N=x-2*($!==0||D!==0?$+D:on(p.left,p.right)):S=g-2*(M!==0||R!==0?M+R:on(p.top,p.bottom))}await c({...t,availableWidth:N,availableHeight:S});const L=await i.getDimensions(l.floating);return x!==L.width||g!==L.height?{reset:{rects:!0}}:{}}}};function Oa(){return typeof window<"u"}function No(e){return Kf(e)?(e.nodeName||"").toLowerCase():"#document"}function ln(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Jn(e){var t;return(t=(Kf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Kf(e){return Oa()?e instanceof Node||e instanceof ln(e).Node:!1}function Dn(e){return Oa()?e instanceof Element||e instanceof ln(e).Element:!1}function Xn(e){return Oa()?e instanceof HTMLElement||e instanceof ln(e).HTMLElement:!1}function $d(e){return!Oa()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ln(e).ShadowRoot}const zb=new Set(["inline","contents"]);function ps(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ln(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zb.has(o)}const Ub=new Set(["table","td","th"]);function Bb(e){return Ub.has(No(e))}const Hb=[":popover-open",":modal"];function $a(e){return Hb.some(t=>{try{return e.matches(t)}catch{return!1}})}const Wb=["transform","translate","scale","rotate","perspective"],Vb=["transform","translate","scale","rotate","perspective","filter"],Gb=["paint","layout","strict","content"];function ec(e){const t=tc(),n=Dn(e)?Ln(e):e;return Wb.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Vb.some(r=>(n.willChange||"").includes(r))||Gb.some(r=>(n.contain||"").includes(r))}function Yb(e){let t=Sr(e);for(;Xn(t)&&!po(t);){if(ec(t))return t;if($a(t))return null;t=Sr(t)}return null}function tc(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Kb=new Set(["html","body","#document"]);function po(e){return Kb.has(No(e))}function Ln(e){return ln(e).getComputedStyle(e)}function Fa(e){return Dn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sr(e){if(No(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$d(e)&&e.host||Jn(e);return $d(t)?t.host:t}function qf(e){const t=Sr(e);return po(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xn(t)&&ps(t)?t:qf(t)}function Xo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=qf(e),a=o===((r=e.ownerDocument)==null?void 0:r.body),i=ln(o);if(a){const l=al(i);return t.concat(i,i.visualViewport||[],ps(o)?o:[],l&&n?Xo(l):[])}return t.concat(o,Xo(o,[],n))}function al(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xf(e){const t=Ln(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xn(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=ca(n)!==a||ca(r)!==i;return l&&(n=a,r=i),{width:n,height:r,$:l}}function nc(e){return Dn(e)?e:e.contextElement}function lo(e){const t=nc(e);if(!Xn(t))return Yn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=Xf(t);let i=(a?ca(n.width):n.width)/r,l=(a?ca(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const qb=Yn(0);function Zf(e){const t=ln(e);return!tc()||!t.visualViewport?qb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ln(e)?!1:t}function Lr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=nc(e);let i=Yn(1);t&&(r?Dn(r)&&(i=lo(r)):i=lo(e));const l=Xb(a,n,r)?Zf(a):Yn(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,p=o.width/i.x,f=o.height/i.y;if(a){const m=ln(a),h=r&&Dn(r)?ln(r):r;let x=m,g=al(x);for(;g&&r&&h!==x;){const w=lo(g),v=g.getBoundingClientRect(),b=Ln(g),y=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*w.x,C=v.top+(g.clientTop+parseFloat(b.paddingTop))*w.y;c*=w.x,u*=w.y,p*=w.x,f*=w.y,c+=y,u+=C,x=ln(g),g=al(x)}}return ua({width:p,height:f,x:c,y:u})}function rc(e,t){const n=Fa(e).scrollLeft;return t?t.left+n:Lr(Jn(e)).left+n}function Jf(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:rc(e,r)),a=r.top+t.scrollTop;return{x:o,y:a}}function Zb(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a=o==="fixed",i=Jn(r),l=t?$a(t.floating):!1;if(r===i||l&&a)return n;let c={scrollLeft:0,scrollTop:0},u=Yn(1);const p=Yn(0),f=Xn(r);if((f||!f&&!a)&&((No(r)!=="body"||ps(i))&&(c=Fa(r)),Xn(r))){const h=Lr(r);u=lo(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const m=i&&!f&&!a?Jf(i,c,!0):Yn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+p.x+m.x,y:n.y*u.y-c.scrollTop*u.y+p.y+m.y}}function Jb(e){return Array.from(e.getClientRects())}function Qb(e){const t=Jn(e),n=Fa(e),r=e.ownerDocument.body,o=on(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=on(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+rc(e);const l=-n.scrollTop;return Ln(r).direction==="rtl"&&(i+=on(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:l}}function ey(e,t){const n=ln(e),r=Jn(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){a=o.width,i=o.height;const u=tc();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:a,height:i,x:l,y:c}}const ty=new Set(["absolute","fixed"]);function ny(e,t){const n=Lr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=Xn(e)?lo(e):Yn(1),i=e.clientWidth*a.x,l=e.clientHeight*a.y,c=o*a.x,u=r*a.y;return{width:i,height:l,x:c,y:u}}function Fd(e,t,n){let r;if(t==="viewport")r=ey(e,n);else if(t==="document")r=Qb(Jn(e));else if(Dn(t))r=ny(t,n);else{const o=Zf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ua(r)}function Qf(e,t){const n=Sr(e);return n===t||!Dn(n)||po(n)?!1:Ln(n).position==="fixed"||Qf(n,t)}function ry(e,t){const n=t.get(e);if(n)return n;let r=Xo(e,[],!1).filter(l=>Dn(l)&&No(l)!=="body"),o=null;const a=Ln(e).position==="fixed";let i=a?Sr(e):e;for(;Dn(i)&&!po(i);){const l=Ln(i),c=ec(i);!c&&l.position==="fixed"&&(o=null),(a?!c&&!o:!c&&l.position==="static"&&!!o&&ty.has(o.position)||ps(i)&&!c&&Qf(e,i))?r=r.filter(p=>p!==i):o=l,i=Sr(i)}return t.set(e,r),r}function oy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?$a(t)?[]:ry(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,p)=>{const f=Fd(t,p,o);return u.top=on(f.top,u.top),u.right=Er(f.right,u.right),u.bottom=Er(f.bottom,u.bottom),u.left=on(f.left,u.left),u},Fd(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sy(e){const{width:t,height:n}=Xf(e);return{width:t,height:n}}function ay(e,t,n){const r=Xn(t),o=Jn(t),a=n==="fixed",i=Lr(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=Yn(0);function u(){c.x=rc(o)}if(r||!r&&!a)if((No(t)!=="body"||ps(o))&&(l=Fa(t)),r){const h=Lr(t,!0,a,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&u();a&&!r&&o&&u();const p=o&&!r&&!a?Jf(o,l):Yn(0),f=i.left+l.scrollLeft-c.x-p.x,m=i.top+l.scrollTop-c.y-p.y;return{x:f,y:m,width:i.width,height:i.height}}function gi(e){return Ln(e).position==="static"}function zd(e,t){if(!Xn(e)||Ln(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Jn(e)===n&&(n=n.ownerDocument.body),n}function ep(e,t){const n=ln(e);if($a(e))return n;if(!Xn(e)){let o=Sr(e);for(;o&&!po(o);){if(Dn(o)&&!gi(o))return o;o=Sr(o)}return n}let r=zd(e,t);for(;r&&Bb(r)&&gi(r);)r=zd(r,t);return r&&po(r)&&gi(r)&&!ec(r)?n:r||Yb(e)||n}const iy=async function(e){const t=this.getOffsetParent||ep,n=this.getDimensions,r=await n(e.floating);return{reference:ay(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ly(e){return Ln(e).direction==="rtl"}const cy={convertOffsetParentRelativeRectToViewportRelativeRect:Zb,getDocumentElement:Jn,getClippingRect:oy,getOffsetParent:ep,getElementRects:iy,getClientRects:Jb,getDimensions:sy,getScale:lo,isElement:Dn,isRTL:ly};function tp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dy(e,t){let n=null,r;const o=Jn(e);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const u=e.getBoundingClientRect(),{left:p,top:f,width:m,height:h}=u;if(l||t(),!m||!h)return;const x=Ls(f),g=Ls(o.clientWidth-(p+m)),w=Ls(o.clientHeight-(f+h)),v=Ls(p),y={rootMargin:-x+"px "+-g+"px "+-w+"px "+-v+"px",threshold:on(0,Er(1,c))||1};let C=!0;function k(E){const S=E[0].intersectionRatio;if(S!==c){if(!C)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!tp(u,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(k,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,y)}n.observe(e)}return i(!0),a}function oc(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=nc(e),p=o||a?[...u?Xo(u):[],...Xo(t)]:[];p.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),a&&v.addEventListener("resize",n)});const f=u&&l?dy(u,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(v=>{let[b]=v;b&&b.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let x,g=c?Lr(e):null;c&&w();function w(){const v=Lr(e);g&&!tp(g,v)&&n(),g=v,x=requestAnimationFrame(w)}return n(),()=>{var v;p.forEach(b=>{o&&b.removeEventListener("scroll",n),a&&b.removeEventListener("resize",n)}),f==null||f(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const uy=Lb,fy=Ob,py=Mb,my=Fb,hy=Pb,Ud=Rb,gy=$b,xy=(e,t,n)=>{const r=new Map,o={platform:cy,...n},a={...o.platform,_c:r};return Ib(e,t,{...o,platform:a})};var vy=typeof document<"u",wy=function(){},ta=vy?d.useLayoutEffect:wy;function fa(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!fa(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&e.$$typeof)&&!fa(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function np(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bd(e,t){const n=np(e);return Math.round(t*n)/n}function xi(e){const t=d.useRef(e);return ta(()=>{t.current=e}),t}function sc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[p,f]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=d.useState(r);fa(m,r)||h(r);const[x,g]=d.useState(null),[w,v]=d.useState(null),b=d.useCallback(j=>{j!==E.current&&(E.current=j,g(j))},[]),y=d.useCallback(j=>{j!==S.current&&(S.current=j,v(j))},[]),C=a||x,k=i||w,E=d.useRef(null),S=d.useRef(null),N=d.useRef(p),L=c!=null,$=xi(c),D=xi(o),M=xi(u),R=d.useCallback(()=>{if(!E.current||!S.current)return;const j={placement:t,strategy:n,middleware:m};D.current&&(j.platform=D.current),xy(E.current,S.current,j).then(_=>{const O={..._,isPositioned:M.current!==!1};F.current&&!fa(N.current,O)&&(N.current=O,is.flushSync(()=>{f(O)}))})},[m,t,n,D,M]);ta(()=>{u===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,f(j=>({...j,isPositioned:!1})))},[u]);const F=d.useRef(!1);ta(()=>(F.current=!0,()=>{F.current=!1}),[]),ta(()=>{if(C&&(E.current=C),k&&(S.current=k),C&&k){if($.current)return $.current(C,k,R);R()}},[C,k,R,$,L]);const z=d.useMemo(()=>({reference:E,floating:S,setReference:b,setFloating:y}),[b,y]),A=d.useMemo(()=>({reference:C,floating:k}),[C,k]),G=d.useMemo(()=>{const j={position:n,left:0,top:0};if(!A.floating)return j;const _=Bd(A.floating,p.x),O=Bd(A.floating,p.y);return l?{...j,transform:"translate("+_+"px, "+O+"px)",...np(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:O}},[n,l,A.floating,p.x,p.y]);return d.useMemo(()=>({...p,update:R,refs:z,elements:A,floatingStyles:G}),[p,R,z,A,G])}const by=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ud({element:r.current,padding:o}).fn(n):{}:r?Ud({element:r,padding:o}).fn(n):{}}}},ac=(e,t)=>({...uy(e),options:[e,t]}),ic=(e,t)=>({...fy(e),options:[e,t]}),lc=(e,t)=>({...gy(e),options:[e,t]}),cc=(e,t)=>({...py(e),options:[e,t]}),dc=(e,t)=>({...my(e),options:[e,t]}),uc=(e,t)=>({...hy(e),options:[e,t]}),fc=(e,t)=>({...by(e),options:[e,t]});var yy="Arrow",rp=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return s.jsx(ve.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});rp.displayName=yy;var pc=rp;function mc(e){const[t,n]=d.useState(void 0);return st(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let i,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var hc="Popper",[op,za]=cn(hc),[Cy,sp]=op(hc),ap=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return s.jsx(Cy,{scope:t,anchor:r,onAnchorChange:o,children:n})};ap.displayName=hc;var ip="PopperAnchor",lp=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=sp(ip,n),i=d.useRef(null),l=Te(t,i);return d.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:s.jsx(ve.div,{...o,ref:l})});lp.displayName=ip;var gc="PopperContent",[Ey,Sy]=op(gc),cp=d.forwardRef((e,t)=>{var I,K,Z,J,oe,re;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,w=sp(gc,n),[v,b]=d.useState(null),y=Te(t,ie=>b(ie)),[C,k]=d.useState(null),E=mc(C),S=(E==null?void 0:E.width)??0,N=(E==null?void 0:E.height)??0,L=r+(a!=="center"?"-"+a:""),$=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},D=Array.isArray(u)?u:[u],M=D.length>0,R={padding:$,boundary:D.filter(jy),altBoundary:M},{refs:F,floatingStyles:z,placement:A,isPositioned:G,middlewareData:j}=sc({strategy:"fixed",placement:L,whileElementsMounted:(...ie)=>oc(...ie,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[ac({mainAxis:o+N,alignmentAxis:i}),c&&ic({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?lc():void 0,...R}),c&&cc({...R}),dc({...R,apply:({elements:ie,rects:te,availableWidth:ue,availableHeight:De})=>{const{width:Re,height:Ae}=te.reference,Le=ie.floating.style;Le.setProperty("--radix-popper-available-width",`${ue}px`),Le.setProperty("--radix-popper-available-height",`${De}px`),Le.setProperty("--radix-popper-anchor-width",`${Re}px`),Le.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),C&&fc({element:C,padding:l}),Ay({arrowWidth:S,arrowHeight:N}),m&&uc({strategy:"referenceHidden",...R})]}),[_,O]=fp(A),H=It(x);st(()=>{G&&(H==null||H())},[G,H]);const Q=(I=j.arrow)==null?void 0:I.x,W=(K=j.arrow)==null?void 0:K.y,U=((Z=j.arrow)==null?void 0:Z.centerOffset)!==0,[Y,P]=d.useState();return st(()=>{v&&P(window.getComputedStyle(v).zIndex)},[v]),s.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:G?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(J=j.transformOrigin)==null?void 0:J.x,(oe=j.transformOrigin)==null?void 0:oe.y].join(" "),...((re=j.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Ey,{scope:n,placedSide:_,onArrowChange:k,arrowX:Q,arrowY:W,shouldHideArrow:U,children:s.jsx(ve.div,{"data-side":_,"data-align":O,...g,ref:y,style:{...g.style,animation:G?void 0:"none"}})})})});cp.displayName=gc;var dp="PopperArrow",Ny={top:"bottom",right:"left",bottom:"top",left:"right"},up=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,a=Sy(dp,r),i=Ny[a.placedSide];return s.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:s.jsx(pc,{...o,ref:n,style:{...o.style,display:"block"}})})});up.displayName=dp;function jy(e){return e!==null}var Ay=e=>({name:"transformOrigin",options:e,fn(t){var w,v,b;const{placement:n,rects:r,middlewareData:o}=t,i=((w=o.arrow)==null?void 0:w.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,p]=fp(n),f={start:"0%",center:"50%",end:"100%"}[p],m=(((v=o.arrow)==null?void 0:v.x)??0)+l/2,h=(((b=o.arrow)==null?void 0:b.y)??0)+c/2;let x="",g="";return u==="bottom"?(x=i?f:`${m}px`,g=`${-c}px`):u==="top"?(x=i?f:`${m}px`,g=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,g=i?f:`${h}px`):u==="left"&&(x=`${r.floating.width+c}px`,g=i?f:`${h}px`),{data:{x,y:g}}}});function fp(e){const[t,n="center"]=e.split("-");return[t,n]}var pp=ap,xc=lp,mp=cp,hp=up,ky="Portal",jo=d.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,a]=d.useState(!1);st(()=>a(!0),[]);const i=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?fv.createPortal(s.jsx(ve.div,{...r,ref:t}),i):null});jo.displayName=ky;function Ty(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var fr=e=>{const{present:t,children:n}=e,r=_y(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),a=Te(r.ref,Iy(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:a}):null};fr.displayName="Presence";function _y(e){const[t,n]=d.useState(),r=d.useRef(null),o=d.useRef(e),a=d.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Ty(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const u=Os(r.current);a.current=l==="mounted"?u:"none"},[l]),st(()=>{const u=r.current,p=o.current;if(p!==e){const m=a.current,h=Os(u);e?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(p&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),st(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,f=h=>{const g=Os(r.current).includes(h.animationName);if(h.target===t&&g&&(c("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=h=>{h.target===t&&(a.current=Os(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Os(e){return(e==null?void 0:e.animationName)||"none"}function Iy(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ry=Ol[" useInsertionEffect ".trim().toString()]||st;function lr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=My({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const p=d.useRef(e!==void 0);d.useEffect(()=>{const f=p.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,r])}const u=d.useCallback(p=>{var f;if(l){const m=Py(p)?p(e):p;m!==e&&((f=i.current)==null||f.call(i,m))}else a(p)},[l,e,a,i]);return[c,u]}function My({defaultProp:e,onChange:t}){const[n,r]=d.useState(e),o=d.useRef(n),a=d.useRef(t);return Ry(()=>{a.current=t},[t]),d.useEffect(()=>{var i;o.current!==n&&((i=a.current)==null||i.call(a,n),o.current=n)},[n,o]),[n,r,a]}function Py(e){return typeof e=="function"}var gp=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Dy="VisuallyHidden",xp=d.forwardRef((e,t)=>s.jsx(ve.span,{...e,ref:t,style:{...gp,...e.style}}));xp.displayName=Dy;var Ly=xp,[Ua,t3]=cn("Tooltip",[za]),Ba=za(),vp="TooltipProvider",Oy=700,il="tooltip.open",[$y,vc]=Ua(vp),wp=e=>{const{__scopeTooltip:t,delayDuration:n=Oy,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:a}=e,i=d.useRef(!0),l=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),s.jsx($y,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:d.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:d.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:a})};wp.displayName=vp;var Zo="Tooltip",[Fy,ms]=Ua(Zo),bp=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:a,disableHoverableContent:i,delayDuration:l}=e,c=vc(Zo,e.__scopeTooltip),u=Ba(t),[p,f]=d.useState(null),m=an(),h=d.useRef(0),x=i??c.disableHoverableContent,g=l??c.delayDuration,w=d.useRef(!1),[v,b]=lr({prop:r,defaultProp:o??!1,onChange:S=>{S?(c.onOpen(),document.dispatchEvent(new CustomEvent(il))):c.onClose(),a==null||a(S)},caller:Zo}),y=d.useMemo(()=>v?w.current?"delayed-open":"instant-open":"closed",[v]),C=d.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w.current=!1,b(!0)},[b]),k=d.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),E=d.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,b(!0),h.current=0},g)},[g,b]);return d.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),s.jsx(pp,{...u,children:s.jsx(Fy,{scope:t,contentId:m,open:v,stateAttribute:y,trigger:p,onTriggerChange:f,onTriggerEnter:d.useCallback(()=>{c.isOpenDelayedRef.current?E():C()},[c.isOpenDelayedRef,E,C]),onTriggerLeave:d.useCallback(()=>{x?k():(window.clearTimeout(h.current),h.current=0)},[k,x]),onOpen:C,onClose:k,disableHoverableContent:x,children:n})})};bp.displayName=Zo;var ll="TooltipTrigger",yp=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ms(ll,n),a=vc(ll,n),i=Ba(n),l=d.useRef(null),c=Te(t,l,o.onTriggerChange),u=d.useRef(!1),p=d.useRef(!1),f=d.useCallback(()=>u.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),s.jsx(xc,{asChild:!0,...i,children:s.jsx(ve.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:Ye(e.onPointerMove,m=>{m.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ye(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:Ye(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ye(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Ye(e.onBlur,o.onClose),onClick:Ye(e.onClick,o.onClose)})})});yp.displayName=ll;var wc="TooltipPortal",[zy,Uy]=Ua(wc,{forceMount:void 0}),Cp=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,a=ms(wc,t);return s.jsx(zy,{scope:t,forceMount:n,children:s.jsx(fr,{present:n||a.open,children:s.jsx(jo,{asChild:!0,container:o,children:r})})})};Cp.displayName=wc;var mo="TooltipContent",Ep=d.forwardRef((e,t)=>{const n=Uy(mo,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...a}=e,i=ms(mo,e.__scopeTooltip);return s.jsx(fr,{present:r||i.open,children:i.disableHoverableContent?s.jsx(Sp,{side:o,...a,ref:t}):s.jsx(By,{side:o,...a,ref:t})})}),By=d.forwardRef((e,t)=>{const n=ms(mo,e.__scopeTooltip),r=vc(mo,e.__scopeTooltip),o=d.useRef(null),a=Te(t,o),[i,l]=d.useState(null),{trigger:c,onClose:u}=n,p=o.current,{onPointerInTransitChange:f}=r,m=d.useCallback(()=>{l(null),f(!1)},[f]),h=d.useCallback((x,g)=>{const w=x.currentTarget,v={x:x.clientX,y:x.clientY},b=Gy(v,w.getBoundingClientRect()),y=Yy(v,b),C=Ky(g.getBoundingClientRect()),k=Xy([...y,...C]);l(k),f(!0)},[f]);return d.useEffect(()=>()=>m(),[m]),d.useEffect(()=>{if(c&&p){const x=w=>h(w,p),g=w=>h(w,c);return c.addEventListener("pointerleave",x),p.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),p.removeEventListener("pointerleave",g)}}},[c,p,h,m]),d.useEffect(()=>{if(i){const x=g=>{const w=g.target,v={x:g.clientX,y:g.clientY},b=(c==null?void 0:c.contains(w))||(p==null?void 0:p.contains(w)),y=!qy(v,i);b?m():y&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,p,i,u,m]),s.jsx(Sp,{...e,ref:a})}),[Hy,Wy]=Ua(Zo,{isInside:!1}),Vy=v0("TooltipContent"),Sp=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:i,...l}=e,c=ms(mo,n),u=Ba(n),{onClose:p}=c;return d.useEffect(()=>(document.addEventListener(il,p),()=>document.removeEventListener(il,p)),[p]),d.useEffect(()=>{if(c.trigger){const f=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&p()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,p]),s.jsx(La,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:p,children:s.jsxs(mp,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(Vy,{children:r}),s.jsx(Hy,{scope:n,isInside:!0,children:s.jsx(Ly,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Ep.displayName=mo;var Np="TooltipArrow",jp=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ba(n);return Wy(Np,n).isInside?null:s.jsx(hp,{...o,...r,ref:t})});jp.displayName=Np;function Gy(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,o,a)){case a:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Yy(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Ky(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function qy(e,t){const{x:n,y:r}=e;let o=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const l=t[a],c=t[i],u=l.x,p=l.y,f=c.x,m=c.y;p>r!=m>r&&n<(f-u)*(r-p)/(m-p)+u&&(o=!o)}return o}function Xy(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Zy(t)}function Zy(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(o.y-i.y)>=(a.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const a=n[n.length-1],i=n[n.length-2];if((a.x-i.x)*(o.y-i.y)>=(a.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Jy=wp,Qy=bp,e1=yp,t1=Cp,n1=Ep,r1=jp;function o1({delayDuration:e=0,...t}){return s.jsx(Jy,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function hs({...e}){return s.jsx(o1,{delayDuration:500,children:s.jsx(Qy,{"data-slot":"tooltip",...e})})}function gs({...e}){return s.jsx(e1,{"data-slot":"tooltip-trigger",...e})}function xs({className:e,sideOffset:t=0,children:n,...r}){return s.jsx(t1,{children:s.jsxs(n1,{"data-slot":"tooltip-content",sideOffset:t,className:me("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,s.jsx(r1,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Ap="text-[var(--color-primary-wMain)] enabled:hover:text-[var(--color-primary-text-w60)] dark:text-[var(--color-primary-w20)] dark:enabled:hover:text-[var(--color-primary-text-w10)]",vi=Ap+" enabled:hover:bg-[var(--color-primary-w10)] dark:enabled:hover:bg-[var(--color-primary-w60)]",s1=Ar("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm font-semibold transition-all disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 cursor-pointer disabled:cursor-not-allowed",{variants:{variant:{default:"text-[var(--color-primary-text-w10)] bg-[var(--color-primary-wMain)] enabled:hover:bg-[var(--color-primary-w100)] dark:enabled:hover:bg-[var(--color-primary-w60)] dark:text-[--color-primary-w10]",destructive:"text-[var(--color-primary-text-w10)] bg-[var(--color-error-wMain)] enabled:hover:bg-[var(--color-error-w70)]",outline:vi+" border border-1 border-[var(--color-primary-wMain)]",secondary:vi,ghost:vi,link:Ap+" underline-offset-4 enabled:hover:underline"},size:{default:"h-9 px-5 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ne({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",testid:a="",...i}){const l=r?_f:"button",c=o?{...i,"aria-label":o}:i,u=s.jsx(l,{"data-slot":"button","data-testid":a||o||i.title,className:me(s1({variant:t,size:n,className:e})),...c});return o?s.jsxs(hs,{children:[s.jsx(gs,{asChild:!0,children:u}),s.jsx(xs,{children:o})]}):u}const kp=({onClick:e,text:t="View Agent Workflow"})=>s.jsx(ne,{"data-testid":"viewAgentWorkflow",variant:"ghost",size:"sm",onClick:e,tooltip:t,children:s.jsx(Js,{className:"h-4 w-4"})}),Vr=d.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:me("flex min-h-[80px] w-full rounded-md border px-3 py-2 placeholder:opacity-75 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Vr.displayName="Textarea";function bc({className:e,type:t,...n}){return s.jsx("input",{type:t,"data-slot":"input",className:me("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","outline-none focus-visible:border-[var(--color-brand-wMain)] focus-visible:ring-[2px] focus-visible:ring-[var(--color-brand-wMain)]/50","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}function yc({className:e,noPadding:t,...n}){return s.jsx("div",{"data-slot":"card",className:me("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border shadow-sm",!t&&"py-6",e),...n})}function a1({className:e,...t}){return s.jsx("div",{"data-slot":"card-header",className:me("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function i1({className:e,...t}){return s.jsx("div",{"data-slot":"card-title",className:me("leading-none font-semibold",e),...t})}function l1({className:e,...t}){return s.jsx("div",{"data-slot":"card-description",className:me("text-muted-foreground text-sm",e),...t})}function Cc({className:e,noPadding:t,...n}){return s.jsx("div",{"data-slot":"card-content",className:me(!t&&"px-6",e),...n})}d.createContext({});d.createContext({});const c1=Ar("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),d1=Ar("animate-spin",{variants:{size:{small:"size-4",medium:"size-8",large:"size-12"},variant:{primary:"text-[var(--color-brand-wMain)]",secondary:"text-[var(--color-primary-wMain)]",muted:"text-[var(--color-secondary-text-wMain)] dark:text-[var(--color-secondary-text-w50)]",foreground:"text-foreground"}},defaultVariants:{size:"medium",variant:"primary"}});function cr({size:e,show:t,children:n,className:r,variant:o}){return s.jsxs("span",{className:c1({show:t}),children:[s.jsx(ja,{className:me(d1({size:e,variant:o}),r)}),n]})}var wi="focusScope.autoFocusOnMount",bi="focusScope.autoFocusOnUnmount",Hd={bubbles:!1,cancelable:!0},u1="FocusScope",vs=d.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[l,c]=d.useState(null),u=It(o),p=It(a),f=d.useRef(null),m=Te(t,g=>c(g)),h=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let g=function(y){if(h.paused||!l)return;const C=y.target;l.contains(C)?f.current=C:xr(f.current,{select:!0})},w=function(y){if(h.paused||!l)return;const C=y.relatedTarget;C!==null&&(l.contains(C)||xr(f.current,{select:!0}))},v=function(y){if(document.activeElement===document.body)for(const k of y)k.removedNodes.length>0&&xr(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",w);const b=new MutationObserver(v);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",w),b.disconnect()}}},[r,l,h.paused]),d.useEffect(()=>{if(l){Vd.add(h);const g=document.activeElement;if(!l.contains(g)){const v=new CustomEvent(wi,Hd);l.addEventListener(wi,u),l.dispatchEvent(v),v.defaultPrevented||(f1(x1(Tp(l)),{select:!0}),document.activeElement===g&&xr(l))}return()=>{l.removeEventListener(wi,u),setTimeout(()=>{const v=new CustomEvent(bi,Hd);l.addEventListener(bi,p),l.dispatchEvent(v),v.defaultPrevented||xr(g??document.body,{select:!0}),l.removeEventListener(bi,p),Vd.remove(h)},0)}}},[l,u,p,h]);const x=d.useCallback(g=>{if(!n&&!r||h.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(w&&v){const b=g.currentTarget,[y,C]=p1(b);y&&C?!g.shiftKey&&v===C?(g.preventDefault(),n&&xr(y,{select:!0})):g.shiftKey&&v===y&&(g.preventDefault(),n&&xr(C,{select:!0})):v===b&&g.preventDefault()}},[n,r,h.paused]);return s.jsx(ve.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});vs.displayName=u1;function f1(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(xr(r,{select:t}),document.activeElement!==n)return}function p1(e){const t=Tp(e),n=Wd(t,e),r=Wd(t.reverse(),e);return[n,r]}function Tp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Wd(e,t){for(const n of e)if(!m1(n,{upTo:t}))return n}function m1(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function h1(e){return e instanceof HTMLInputElement&&"select"in e}function xr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&h1(e)&&t&&e.select()}}var Vd=g1();function g1(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Gd(e,t),e.unshift(t)},remove(t){var n;e=Gd(e,t),(n=e[0])==null||n.resume()}}}function Gd(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function x1(e){return e.filter(t=>t.tagName!=="A")}var yi=0;function _p(){d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Yd()),document.body.insertAdjacentElement("beforeend",e[1]??Yd()),yi++,()=>{yi===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),yi--}},[])}function Yd(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hn=function(){return Hn=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Hn.apply(this,arguments)};function Ip(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function v1(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var na="right-scroll-bar-position",ra="width-before-scroll-bar",w1="with-scroll-bars-hidden",b1="--removed-body-scroll-bar-size";function Ci(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function y1(e,t){var n=d.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var C1=typeof window<"u"?d.useLayoutEffect:d.useEffect,Kd=new WeakMap;function E1(e,t){var n=y1(null,function(r){return e.forEach(function(o){return Ci(o,r)})});return C1(function(){var r=Kd.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(l){a.has(l)||Ci(l,null)}),a.forEach(function(l){o.has(l)||Ci(l,i)})}Kd.set(n,e)},[e]),n}function S1(e){return e}function N1(e,t){t===void 0&&(t=S1);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(a){for(r=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(l){return a(l)},filter:function(){return n}}},assignMedium:function(a){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(a),i=n}var c=function(){var p=i;i=[],p.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(p){i.push(p),u()},filter:function(p){return i=i.filter(p),n}}}};return o}function j1(e){e===void 0&&(e={});var t=N1(null);return t.options=Hn({async:!0,ssr:!1},e),t}var Rp=function(e){var t=e.sideCar,n=Ip(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return d.createElement(r,Hn({},n))};Rp.isSideCarExport=!0;function A1(e,t){return e.useMedium(t),Rp}var Mp=j1(),Ei=function(){},Ha=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:Ei,onWheelCapture:Ei,onTouchMoveCapture:Ei}),o=r[0],a=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,p=e.enabled,f=e.shards,m=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,w=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,y=e.gapMode,C=Ip(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=m,E=E1([n,t]),S=Hn(Hn({},C),o);return d.createElement(d.Fragment,null,p&&d.createElement(k,{sideCar:Mp,removeScrollBar:u,shards:f,noRelative:h,noIsolation:x,inert:g,setCallbacks:a,allowPinchZoom:!!w,lockRef:n,gapMode:y}),i?d.cloneElement(d.Children.only(l),Hn(Hn({},S),{ref:E})):d.createElement(b,Hn({},S,{className:c,ref:E}),l))});Ha.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ha.classNames={fullWidth:ra,zeroRight:na};var k1=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function T1(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=k1();return t&&e.setAttribute("nonce",t),e}function _1(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function I1(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var R1=function(){var e=0,t=null;return{add:function(n){e==0&&(t=T1())&&(_1(t,n),I1(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},M1=function(){var e=R1();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pp=function(){var e=M1(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},P1={left:0,top:0,right:0,gap:0},Si=function(e){return parseInt(e||"",10)||0},D1=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Si(n),Si(r),Si(o)]},L1=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return P1;var t=D1(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},O1=Pp(),co="data-scroll-locked",$1=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
83
|
+
.`.concat(w1,` {
|
|
84
|
+
overflow: hidden `).concat(r,`;
|
|
85
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
86
|
+
}
|
|
87
|
+
body[`).concat(co,`] {
|
|
88
|
+
overflow: hidden `).concat(r,`;
|
|
89
|
+
overscroll-behavior: contain;
|
|
90
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
91
|
+
padding-left: `.concat(o,`px;
|
|
92
|
+
padding-top: `).concat(a,`px;
|
|
93
|
+
padding-right: `).concat(i,`px;
|
|
94
|
+
margin-left:0;
|
|
95
|
+
margin-top:0;
|
|
96
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
97
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.`).concat(na,` {
|
|
101
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.`).concat(ra,` {
|
|
105
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.`).concat(na," .").concat(na,` {
|
|
109
|
+
right: 0 `).concat(r,`;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.`).concat(ra," .").concat(ra,` {
|
|
113
|
+
margin-right: 0 `).concat(r,`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
body[`).concat(co,`] {
|
|
117
|
+
`).concat(b1,": ").concat(l,`px;
|
|
118
|
+
}
|
|
119
|
+
`)},qd=function(){var e=parseInt(document.body.getAttribute(co)||"0",10);return isFinite(e)?e:0},F1=function(){d.useEffect(function(){return document.body.setAttribute(co,(qd()+1).toString()),function(){var e=qd()-1;e<=0?document.body.removeAttribute(co):document.body.setAttribute(co,e.toString())}},[])},z1=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;F1();var a=d.useMemo(function(){return L1(o)},[o]);return d.createElement(O1,{styles:$1(a,!t,o,n?"":"!important")})},cl=!1;if(typeof window<"u")try{var $s=Object.defineProperty({},"passive",{get:function(){return cl=!0,!0}});window.addEventListener("test",$s,$s),window.removeEventListener("test",$s,$s)}catch{cl=!1}var Jr=cl?{passive:!1}:!1,U1=function(e){return e.tagName==="TEXTAREA"},Dp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!U1(e)&&n[t]==="visible")},B1=function(e){return Dp(e,"overflowY")},H1=function(e){return Dp(e,"overflowX")},Xd=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Lp(e,r);if(o){var a=Op(e,r),i=a[1],l=a[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},W1=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},V1=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Lp=function(e,t){return e==="v"?B1(t):H1(t)},Op=function(e,t){return e==="v"?W1(t):V1(t)},G1=function(e,t){return e==="h"&&t==="rtl"?-1:1},Y1=function(e,t,n,r,o){var a=G1(e,window.getComputedStyle(t).direction),i=a*r,l=n.target,c=t.contains(l),u=!1,p=i>0,f=0,m=0;do{if(!l)break;var h=Op(e,l),x=h[0],g=h[1],w=h[2],v=g-w-a*x;(x||v)&&Lp(e,l)&&(f+=v,m+=x);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(p&&Math.abs(f)<1||!p&&Math.abs(m)<1)&&(u=!0),u},Fs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Zd=function(e){return[e.deltaX,e.deltaY]},Jd=function(e){return e&&"current"in e?e.current:e},K1=function(e,t){return e[0]===t[0]&&e[1]===t[1]},q1=function(e){return`
|
|
120
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
121
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
122
|
+
`)},X1=0,Qr=[];function Z1(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(X1++)[0],a=d.useState(Pp)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var g=v1([e.lockRef.current],(e.shards||[]).map(Jd),!0).filter(Boolean);return g.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(g,w){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var v=Fs(g),b=n.current,y="deltaX"in g?g.deltaX:b[0]-v[0],C="deltaY"in g?g.deltaY:b[1]-v[1],k,E=g.target,S=Math.abs(y)>Math.abs(C)?"h":"v";if("touches"in g&&S==="h"&&E.type==="range")return!1;var N=Xd(S,E);if(!N)return!0;if(N?k=S:(k=S==="v"?"h":"v",N=Xd(S,E)),!N)return!1;if(!r.current&&"changedTouches"in g&&(y||C)&&(r.current=k),!k)return!0;var L=r.current||k;return Y1(L,w,g,L==="h"?y:C)},[]),c=d.useCallback(function(g){var w=g;if(!(!Qr.length||Qr[Qr.length-1]!==a)){var v="deltaY"in w?Zd(w):Fs(w),b=t.current.filter(function(k){return k.name===w.type&&(k.target===w.target||w.target===k.shadowParent)&&K1(k.delta,v)})[0];if(b&&b.should){w.cancelable&&w.preventDefault();return}if(!b){var y=(i.current.shards||[]).map(Jd).filter(Boolean).filter(function(k){return k.contains(w.target)}),C=y.length>0?l(w,y[0]):!i.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),u=d.useCallback(function(g,w,v,b){var y={name:g,delta:w,target:v,should:b,shadowParent:J1(v)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(C){return C!==y})},1)},[]),p=d.useCallback(function(g){n.current=Fs(g),r.current=void 0},[]),f=d.useCallback(function(g){u(g.type,Zd(g),g.target,l(g,e.lockRef.current))},[]),m=d.useCallback(function(g){u(g.type,Fs(g),g.target,l(g,e.lockRef.current))},[]);d.useEffect(function(){return Qr.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Jr),document.addEventListener("touchmove",c,Jr),document.addEventListener("touchstart",p,Jr),function(){Qr=Qr.filter(function(g){return g!==a}),document.removeEventListener("wheel",c,Jr),document.removeEventListener("touchmove",c,Jr),document.removeEventListener("touchstart",p,Jr)}},[]);var h=e.removeScrollBar,x=e.inert;return d.createElement(d.Fragment,null,x?d.createElement(a,{styles:q1(o)}):null,h?d.createElement(z1,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function J1(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Q1=A1(Mp,Z1);var ws=d.forwardRef(function(e,t){return d.createElement(Ha,Hn({},e,{ref:t,sideCar:Q1}))});ws.classNames=Ha.classNames;var eC=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},eo=new WeakMap,zs=new WeakMap,Us={},Ni=0,$p=function(e){return e&&(e.host||$p(e.parentNode))},tC=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=$p(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},nC=function(e,t,n,r){var o=tC(t,Array.isArray(e)?e:[e]);Us[n]||(Us[n]=new WeakMap);var a=Us[n],i=[],l=new Set,c=new Set(o),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};o.forEach(u);var p=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))p(m);else try{var h=m.getAttribute(r),x=h!==null&&h!=="false",g=(eo.get(m)||0)+1,w=(a.get(m)||0)+1;eo.set(m,g),a.set(m,w),i.push(m),g===1&&x&&zs.set(m,!0),w===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",m,v)}})};return p(t),l.clear(),Ni++,function(){i.forEach(function(f){var m=eo.get(f)-1,h=a.get(f)-1;eo.set(f,m),a.set(f,h),m||(zs.has(f)||f.removeAttribute(r),zs.delete(f)),h||f.removeAttribute(n)}),Ni--,Ni||(eo=new WeakMap,eo=new WeakMap,zs=new WeakMap,Us={})}},Wa=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=eC(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),nC(r,o,n,"aria-hidden")):function(){return null}},Va="Dialog",[Fp,n3]=cn(Va),[rC,On]=Fp(Va),zp=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,l=d.useRef(null),c=d.useRef(null),[u,p]=lr({prop:r,defaultProp:o??!1,onChange:a,caller:Va});return s.jsx(rC,{scope:t,triggerRef:l,contentRef:c,contentId:an(),titleId:an(),descriptionId:an(),open:u,onOpenChange:p,onOpenToggle:d.useCallback(()=>p(f=>!f),[p]),modal:i,children:n})};zp.displayName=Va;var Up="DialogTrigger",Bp=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(Up,n),a=Te(t,o.triggerRef);return s.jsx(ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Nc(o.open),...r,ref:a,onClick:Ye(e.onClick,o.onOpenToggle)})});Bp.displayName=Up;var Ec="DialogPortal",[oC,Hp]=Fp(Ec,{forceMount:void 0}),Wp=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=On(Ec,t);return s.jsx(oC,{scope:t,forceMount:n,children:d.Children.map(r,i=>s.jsx(fr,{present:n||a.open,children:s.jsx(jo,{asChild:!0,container:o,children:i})}))})};Wp.displayName=Ec;var pa="DialogOverlay",Vp=d.forwardRef((e,t)=>{const n=Hp(pa,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=On(pa,e.__scopeDialog);return a.modal?s.jsx(fr,{present:r||a.open,children:s.jsx(aC,{...o,ref:t})}):null});Vp.displayName=pa;var sC=Cr("DialogOverlay.RemoveScroll"),aC=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(pa,n);return s.jsx(ws,{as:sC,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(ve.div,{"data-state":Nc(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Or="DialogContent",Gp=d.forwardRef((e,t)=>{const n=Hp(Or,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=On(Or,e.__scopeDialog);return s.jsx(fr,{present:r||a.open,children:a.modal?s.jsx(iC,{...o,ref:t}):s.jsx(lC,{...o,ref:t})})});Gp.displayName=Or;var iC=d.forwardRef((e,t)=>{const n=On(Or,e.__scopeDialog),r=d.useRef(null),o=Te(t,n.contentRef,r);return d.useEffect(()=>{const a=r.current;if(a)return Wa(a)},[]),s.jsx(Yp,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Ye(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&a.preventDefault()}),onFocusOutside:Ye(e.onFocusOutside,a=>a.preventDefault())})}),lC=d.forwardRef((e,t)=>{const n=On(Or,e.__scopeDialog),r=d.useRef(!1),o=d.useRef(!1);return s.jsx(Yp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Yp=d.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,l=On(Or,n),c=d.useRef(null),u=Te(t,c);return _p(),s.jsxs(s.Fragment,{children:[s.jsx(vs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:s.jsx(La,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Nc(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(cC,{titleId:l.titleId}),s.jsx(uC,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Sc="DialogTitle",Kp=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(Sc,n);return s.jsx(ve.h2,{id:o.titleId,...r,ref:t})});Kp.displayName=Sc;var qp="DialogDescription",Xp=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(qp,n);return s.jsx(ve.p,{id:o.descriptionId,...r,ref:t})});Xp.displayName=qp;var Zp="DialogClose",Jp=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(Zp,n);return s.jsx(ve.button,{type:"button",...r,ref:t,onClick:Ye(e.onClick,()=>o.onOpenChange(!1))})});Jp.displayName=Zp;function Nc(e){return e?"open":"closed"}var Qp="DialogTitleWarning",[r3,em]=lb(Qp,{contentName:Or,titleName:Sc,docsSlug:"dialog"}),cC=({titleId:e})=>{const t=em(Qp),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
123
|
+
|
|
124
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
125
|
+
|
|
126
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},dC="DialogDescriptionWarning",uC=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${em(dC).contentName}}.`;return d.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},fC=zp,pC=Bp,mC=Wp,hC=Vp,gC=Gp,xC=Kp,vC=Xp,tm=Jp;function dn({...e}){return s.jsx(fC,{"data-slot":"dialog",...e})}function nm({...e}){return s.jsx(pC,{"data-slot":"dialog-trigger",...e})}function wC({...e}){return s.jsx(mC,{"data-slot":"dialog-portal",...e})}function dl({...e}){return s.jsx(tm,{"data-slot":"dialog-close",...e})}function bC({className:e,...t}){return s.jsx(hC,{"data-slot":"dialog-overlay",className:me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function un({className:e,children:t,showCloseButton:n=!1,...r}){return s.jsxs(wC,{"data-slot":"dialog-portal",children:[s.jsx(bC,{}),s.jsxs(gC,{"data-slot":"dialog-content",className:me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,n&&s.jsxs(tm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[s.jsx(ls,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:me("flex flex-col gap-2 text-center sm:text-left",e),...t})}function $n({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:me("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function pn({className:e,...t}){return s.jsx(xC,{"data-slot":"dialog-title",className:me("text-lg leading-none font-semibold",e),...t})}function mn({className:e,...t}){return s.jsx(vC,{"data-slot":"dialog-description",className:me("py-4 text-sm",e),...t})}const Ga=d.createContext(null);Ga.displayName="PanelGroupContext";const ot={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},jc=10,Pr=d.useLayoutEffect,Qd=Ol.useId,yC=typeof Qd=="function"?Qd:()=>null;let CC=0;function Ac(e=null){const t=yC(),n=d.useRef(e||t||null);return n.current===null&&(n.current=""+CC++),e??n.current}function rm({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:a,id:i,maxSize:l,minSize:c,onCollapse:u,onExpand:p,onResize:f,order:m,style:h,tagName:x="div",...g}){const w=d.useContext(Ga);if(w===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:b,getPanelSize:y,getPanelStyle:C,groupId:k,isPanelCollapsed:E,reevaluatePanelConstraints:S,registerPanel:N,resizePanel:L,unregisterPanel:$}=w,D=Ac(i),M=d.useRef({callbacks:{onCollapse:u,onExpand:p,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:D,idIsFromProps:i!==void 0,order:m});d.useRef({didLogMissingDefaultSizeWarning:!1}),Pr(()=>{const{callbacks:F,constraints:z}=M.current,A={...z};M.current.id=D,M.current.idIsFromProps=i!==void 0,M.current.order=m,F.onCollapse=u,F.onExpand=p,F.onResize=f,z.collapsedSize=n,z.collapsible=r,z.defaultSize=o,z.maxSize=l,z.minSize=c,(A.collapsedSize!==z.collapsedSize||A.collapsible!==z.collapsible||A.maxSize!==z.maxSize||A.minSize!==z.minSize)&&S(M.current,A)}),Pr(()=>{const F=M.current;return N(F),()=>{$(F)}},[m,D,N,$]),d.useImperativeHandle(a,()=>({collapse:()=>{v(M.current)},expand:F=>{b(M.current,F)},getId(){return D},getSize(){return y(M.current)},isCollapsed(){return E(M.current)},isExpanded(){return!E(M.current)},resize:F=>{L(M.current,F)}}),[v,b,y,E,D,L]);const R=C(M.current,o);return d.createElement(x,{...g,children:e,className:t,id:D,style:{...R,...h},[ot.groupId]:k,[ot.panel]:"",[ot.panelCollapsible]:r||void 0,[ot.panelId]:D,[ot.panelSize]:parseFloat(""+R.flexGrow).toFixed(1)})}const om=d.forwardRef((e,t)=>d.createElement(rm,{...e,forwardedRef:t}));rm.displayName="Panel";om.displayName="forwardRef(Panel)";let ul=null,oa=-1,vr=null;function EC(e,t){if(t){const n=(t&cm)!==0,r=(t&dm)!==0,o=(t&um)!==0,a=(t&fm)!==0;if(n)return o?"se-resize":a?"ne-resize":"e-resize";if(r)return o?"sw-resize":a?"nw-resize":"w-resize";if(o)return"s-resize";if(a)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function SC(){vr!==null&&(document.head.removeChild(vr),ul=null,vr=null,oa=-1)}function ji(e,t){var n,r;const o=EC(e,t);if(ul!==o){if(ul=o,vr===null&&(vr=document.createElement("style"),document.head.appendChild(vr)),oa>=0){var a;(a=vr.sheet)===null||a===void 0||a.removeRule(oa)}oa=(n=(r=vr.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${o} !important;}`))!==null&&n!==void 0?n:-1}}function sm(e){return e.type==="keydown"}function am(e){return e.type.startsWith("pointer")}function im(e){return e.type.startsWith("mouse")}function Ya(e){if(am(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(im(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function NC(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function jC(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function AC(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:nu(e),b:nu(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;_e(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:tu(eu(n.a)),b:tu(eu(n.b))};if(o.a===o.b){const a=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let l=a.length;for(;l--;){const c=a[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(o.a-o.b)}const kC=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function TC(e){var t;const n=getComputedStyle((t=lm(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function _C(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||TC(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||kC.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function eu(e){let t=e.length;for(;t--;){const n=e[t];if(_e(n,"Missing node"),_C(n))return n}return null}function tu(e){return e&&Number(getComputedStyle(e).zIndex)||0}function nu(e){const t=[];for(;e;)t.push(e),e=lm(e);return t}function lm(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const cm=1,dm=2,um=4,fm=8,IC=NC()==="coarse";let Pn=[],uo=!1,wr=new Map,Ka=new Map;const Jo=new Set;function RC(e,t,n,r,o){var a;const{ownerDocument:i}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(a=wr.get(i))!==null&&a!==void 0?a:0;return wr.set(i,c+1),Jo.add(l),ma(),function(){var p;Ka.delete(e),Jo.delete(l);const f=(p=wr.get(i))!==null&&p!==void 0?p:1;if(wr.set(i,f-1),ma(),f===1&&wr.delete(i),Pn.includes(l)){const m=Pn.indexOf(l);m>=0&&Pn.splice(m,1),Tc(),o("up",!0,null)}}}function MC(e){const{target:t}=e,{x:n,y:r}=Ya(e);uo=!0,kc({target:t,x:n,y:r}),ma(),Pn.length>0&&(ha("down",e),e.preventDefault(),pm(t)||e.stopImmediatePropagation())}function Ai(e){const{x:t,y:n}=Ya(e);if(uo&&e.buttons===0&&(uo=!1,ha("up",e)),!uo){const{target:r}=e;kc({target:r,x:t,y:n})}ha("move",e),Tc(),Pn.length>0&&e.preventDefault()}function ki(e){const{target:t}=e,{x:n,y:r}=Ya(e);Ka.clear(),uo=!1,Pn.length>0&&(e.preventDefault(),pm(t)||e.stopImmediatePropagation()),ha("up",e),kc({target:t,x:n,y:r}),Tc(),ma()}function pm(e){let t=e;for(;t;){if(t.hasAttribute(ot.resizeHandle))return!0;t=t.parentElement}return!1}function kc({target:e,x:t,y:n}){Pn.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Jo.forEach(o=>{const{element:a,hitAreaMargins:i}=o,l=a.getBoundingClientRect(),{bottom:c,left:u,right:p,top:f}=l,m=IC?i.coarse:i.fine;if(t>=u-m&&t<=p+m&&n>=f-m&&n<=c+m){if(r!==null&&document.contains(r)&&a!==r&&!a.contains(r)&&!r.contains(a)&&AC(r,a)>0){let x=r,g=!1;for(;x&&!x.contains(a);){if(jC(x.getBoundingClientRect(),l)){g=!0;break}x=x.parentElement}if(g)return}Pn.push(o)}})}function Ti(e,t){Ka.set(e,t)}function Tc(){let e=!1,t=!1;Pn.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;Ka.forEach(r=>{n|=r}),e&&t?ji("intersection",n):e?ji("horizontal",n):t?ji("vertical",n):SC()}let _i;function ma(){var e;(e=_i)===null||e===void 0||e.abort(),_i=new AbortController;const t={capture:!0,signal:_i.signal};Jo.size&&(uo?(Pn.length>0&&wr.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",ki,t),o.addEventListener("pointerleave",Ai,t),o.addEventListener("pointermove",Ai,t))}),wr.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",ki,t),o.addEventListener("pointercancel",ki,t)})):wr.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",MC,t),o.addEventListener("pointermove",Ai,t))}))}function ha(e,t){Jo.forEach(n=>{const{setResizeHandlerState:r}=n,o=Pn.includes(n);r(e,o,t)})}function PC(){const[e,t]=d.useState(0);return d.useCallback(()=>t(n=>n+1),[])}function _e(e,t){if(!e)throw console.error(t),Error(t)}function $r(e,t,n=jc){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function nr(e,t,n=jc){return $r(e,t,n)===0}function rn(e,t,n){return $r(e,t,n)===0}function DC(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],a=t[r];if(!rn(o,a,n))return!1}return!0}function so({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];_e(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:a,maxSize:i=100,minSize:l=0}=r;if($r(n,l)<0)if(a){const c=(o+l)/2;$r(n,c)<0?n=o:n=l}else n=l;return n=Math.min(i,n),n=parseFloat(n.toFixed(jc)),n}function zo({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:a}){if(rn(e,0))return t;const i=[...t],[l,c]=r;_e(l!=null,"Invalid first pivot index"),_e(c!=null,"Invalid second pivot index");let u=0;if(a==="keyboard"){{const f=e<0?c:l,m=n[f];_e(m,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const w=t[f];if(_e(w!=null,`Previous layout not found for panel index ${f}`),rn(w,h)){const v=g-w;$r(v,Math.abs(e))>0&&(e=e<0?0-v:v)}}}{const f=e<0?l:c,m=n[f];_e(m,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const w=t[f];if(_e(w!=null,`Previous layout not found for panel index ${f}`),rn(w,g)){const v=w-h;$r(v,Math.abs(e))>0&&(e=e<0?0-v:v)}}}}{const f=e<0?1:-1;let m=e<0?c:l,h=0;for(;;){const g=t[m];_e(g!=null,`Previous layout not found for panel index ${m}`);const v=so({panelConstraints:n,panelIndex:m,size:100})-g;if(h+=v,m+=f,m<0||m>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-x:x}{let m=e<0?l:c;for(;m>=0&&m<n.length;){const h=Math.abs(e)-Math.abs(u),x=t[m];_e(x!=null,`Previous layout not found for panel index ${m}`);const g=x-h,w=so({panelConstraints:n,panelIndex:m,size:g});if(!rn(x,w)&&(u+=x-w,i[m]=w,u.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(DC(o,i))return o;{const f=e<0?c:l,m=t[f];_e(m!=null,`Previous layout not found for panel index ${f}`);const h=m+u,x=so({panelConstraints:n,panelIndex:f,size:h});if(i[f]=x,!rn(x,h)){let g=h-x,v=e<0?c:l;for(;v>=0&&v<n.length;){const b=i[v];_e(b!=null,`Previous layout not found for panel index ${v}`);const y=b+g,C=so({panelConstraints:n,panelIndex:v,size:y});if(rn(b,C)||(g-=C-b,i[v]=C),rn(g,0))break;e>0?v--:v++}}}const p=i.reduce((f,m)=>m+f,0);return rn(p,100)?i:o}function LC({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,a=0,i=0;const l=n[0];_e(l!=null,"No pivot index found"),t.forEach((f,m)=>{const{constraints:h}=f,{maxSize:x=100,minSize:g=0}=h;m===l?(r=g,o=x):(a+=g,i+=x)});const c=Math.min(o,100-a),u=Math.max(r,100-i),p=e[l];return{valueMax:c,valueMin:u,valueNow:p}}function Qo(e,t=document){return Array.from(t.querySelectorAll(`[${ot.resizeHandleId}][data-panel-group-id="${e}"]`))}function mm(e,t,n=document){const o=Qo(e,n).findIndex(a=>a.getAttribute(ot.resizeHandleId)===t);return o??null}function hm(e,t,n){const r=mm(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function OC(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function gm(e,t=document){if(OC(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function qa(e,t=document){const n=t.querySelector(`[${ot.resizeHandleId}="${e}"]`);return n||null}function $C(e,t,n,r=document){var o,a,i,l;const c=qa(t,r),u=Qo(e,r),p=c?u.indexOf(c):-1,f=(o=(a=n[p])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null,m=(i=(l=n[p+1])===null||l===void 0?void 0:l.id)!==null&&i!==void 0?i:null;return[f,m]}function FC({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:a,setLayout:i}){d.useRef({didWarnAboutMissingResizeHandle:!1}),Pr(()=>{if(!a)return;const l=Qo(n,a);for(let c=0;c<o.length-1;c++){const{valueMax:u,valueMin:p,valueNow:f}=LC({layout:r,panelsArray:o,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const h=o[c];_e(h,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",h.id),m.setAttribute("aria-valuemax",""+Math.round(u)),m.setAttribute("aria-valuemin",""+Math.round(p)),m.setAttribute("aria-valuenow",f!=null?""+Math.round(f):"")}}return()=>{l.forEach((c,u)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,a]),d.useEffect(()=>{if(!a)return;const l=t.current;_e(l,"Eager values not found");const{panelDataArray:c}=l,u=gm(n,a);_e(u!=null,`No group found for id "${n}"`);const p=Qo(n,a);_e(p,`No resize handles found for group id "${n}"`);const f=p.map(m=>{const h=m.getAttribute(ot.resizeHandleId);_e(h,"Resize handle element has no handle id attribute");const[x,g]=$C(n,h,c,a);if(x==null||g==null)return()=>{};const w=v=>{if(!v.defaultPrevented)switch(v.key){case"Enter":{v.preventDefault();const b=c.findIndex(y=>y.id===x);if(b>=0){const y=c[b];_e(y,`No panel data found for index ${b}`);const C=r[b],{collapsedSize:k=0,collapsible:E,minSize:S=0}=y.constraints;if(C!=null&&E){const N=zo({delta:rn(C,k)?S-k:k-C,initialLayout:r,panelConstraints:c.map(L=>L.constraints),pivotIndices:hm(n,h,a),prevLayout:r,trigger:"keyboard"});r!==N&&i(N)}}break}}};return m.addEventListener("keydown",w),()=>{m.removeEventListener("keydown",w)}});return()=>{f.forEach(m=>m())}},[a,e,t,n,r,o,i])}function ru(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xm(e,t){const n=e==="horizontal",{x:r,y:o}=Ya(t);return n?r:o}function zC(e,t,n,r,o){const a=n==="horizontal",i=qa(t,o);_e(i,`No resize handle element found for id "${t}"`);const l=i.getAttribute(ot.groupId);_e(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const u=xm(n,e),p=gm(l,o);_e(p,`No group element found for id "${l}"`);const f=p.getBoundingClientRect(),m=a?f.width:f.height;return(u-c)/m*100}function UC(e,t,n,r,o,a){if(sm(e)){const i=n==="horizontal";let l=0;e.shiftKey?l=100:o!=null?l=o:l=10;let c=0;switch(e.key){case"ArrowDown":c=i?0:l;break;case"ArrowLeft":c=i?-l:0;break;case"ArrowRight":c=i?l:0;break;case"ArrowUp":c=i?0:-l;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return r==null?0:zC(e,t,n,r,a)}function BC({panelDataArray:e}){const t=Array(e.length),n=e.map(a=>a.constraints);let r=0,o=100;for(let a=0;a<e.length;a++){const i=n[a];_e(i,`Panel constraints not found for index ${a}`);const{defaultSize:l}=i;l!=null&&(r++,t[a]=l,o-=l)}for(let a=0;a<e.length;a++){const i=n[a];_e(i,`Panel constraints not found for index ${a}`);const{defaultSize:l}=i;if(l!=null)continue;const c=e.length-r,u=o/c;r++,t[a]=u,o-=u}return t}function to(e,t,n){t.forEach((r,o)=>{const a=e[o];_e(a,`Panel data not found for index ${o}`);const{callbacks:i,constraints:l,id:c}=a,{collapsedSize:u=0,collapsible:p}=l,f=n[c];if(f==null||r!==f){n[c]=r;const{onCollapse:m,onExpand:h,onResize:x}=i;x&&x(r,f),p&&(m||h)&&(h&&(f==null||nr(f,u))&&!nr(r,u)&&h(),m&&(f==null||!nr(f,u))&&nr(r,u)&&m())}})}function Bs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function HC({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:a=3}){const i=n[o];let l;return i==null?l=e!=null?e.toPrecision(a):"1":r.length===1?l="1":l=i.toPrecision(a),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function WC(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function ou(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function vm(e){return`react-resizable-panels:${e}`}function wm(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:a}=t;return o?r:a?`${a}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function bm(e,t){try{const n=vm(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function VC(e,t,n){var r,o;const a=(r=bm(e,n))!==null&&r!==void 0?r:{},i=wm(t);return(o=a[i])!==null&&o!==void 0?o:null}function GC(e,t,n,r,o){var a;const i=vm(e),l=wm(t),c=(a=bm(e,o))!==null&&a!==void 0?a:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(i,JSON.stringify(c))}catch(u){console.error(u)}}function su({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((a,i)=>a+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!rn(r,100)&&n.length>0)for(let a=0;a<t.length;a++){const i=n[a];_e(i!=null,`No layout data found for index ${a}`);const l=100/r*i;n[a]=l}let o=0;for(let a=0;a<t.length;a++){const i=n[a];_e(i!=null,`No layout data found for index ${a}`);const l=so({panelConstraints:t,panelIndex:a,size:i});i!=l&&(o+=i-l,n[a]=l)}if(!rn(o,0))for(let a=0;a<t.length;a++){const i=n[a];_e(i!=null,`No layout data found for index ${a}`);const l=i+o,c=so({panelConstraints:t,panelIndex:a,size:l});if(i!==c&&(o-=c-i,n[a]=c,rn(o,0)))break}return n}const YC=100,Uo={getItem:e=>(ou(Uo),Uo.getItem(e)),setItem:(e,t)=>{ou(Uo),Uo.setItem(e,t)}},au={};function ym({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:a=null,onLayout:i=null,keyboardResizeBy:l=null,storage:c=Uo,style:u,tagName:p="div",...f}){const m=Ac(a),h=d.useRef(null),[x,g]=d.useState(null),[w,v]=d.useState([]),b=PC(),y=d.useRef({}),C=d.useRef(new Map),k=d.useRef(0),E=d.useRef({autoSaveId:e,direction:r,dragState:x,id:m,keyboardResizeBy:l,onLayout:i,storage:c}),S=d.useRef({layout:w,panelDataArray:[],panelDataArrayChanged:!1});d.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),d.useImperativeHandle(o,()=>({getId:()=>E.current.id,getLayout:()=>{const{layout:W}=S.current;return W},setLayout:W=>{const{onLayout:U}=E.current,{layout:Y,panelDataArray:P}=S.current,I=su({layout:W,panelConstraints:P.map(K=>K.constraints)});ru(Y,I)||(v(I),S.current.layout=I,U&&U(I),to(P,I,y.current))}}),[]),Pr(()=>{E.current.autoSaveId=e,E.current.direction=r,E.current.dragState=x,E.current.id=m,E.current.onLayout=i,E.current.storage=c}),FC({committedValuesRef:E,eagerValuesRef:S,groupId:m,layout:w,panelDataArray:S.current.panelDataArray,setLayout:v,panelGroupElement:h.current}),d.useEffect(()=>{const{panelDataArray:W}=S.current;if(e){if(w.length===0||w.length!==W.length)return;let U=au[e];U==null&&(U=WC(GC,YC),au[e]=U);const Y=[...W],P=new Map(C.current);U(e,Y,P,w,c)}},[e,w,c]),d.useEffect(()=>{});const N=d.useCallback(W=>{const{onLayout:U}=E.current,{layout:Y,panelDataArray:P}=S.current;if(W.constraints.collapsible){const I=P.map(oe=>oe.constraints),{collapsedSize:K=0,panelSize:Z,pivotIndices:J}=Mr(P,W,Y);if(_e(Z!=null,`Panel size not found for panel "${W.id}"`),!nr(Z,K)){C.current.set(W.id,Z);const re=ro(P,W)===P.length-1?Z-K:K-Z,ie=zo({delta:re,initialLayout:Y,panelConstraints:I,pivotIndices:J,prevLayout:Y,trigger:"imperative-api"});Bs(Y,ie)||(v(ie),S.current.layout=ie,U&&U(ie),to(P,ie,y.current))}}},[]),L=d.useCallback((W,U)=>{const{onLayout:Y}=E.current,{layout:P,panelDataArray:I}=S.current;if(W.constraints.collapsible){const K=I.map(te=>te.constraints),{collapsedSize:Z=0,panelSize:J=0,minSize:oe=0,pivotIndices:re}=Mr(I,W,P),ie=U??oe;if(nr(J,Z)){const te=C.current.get(W.id),ue=te!=null&&te>=ie?te:ie,Re=ro(I,W)===I.length-1?J-ue:ue-J,Ae=zo({delta:Re,initialLayout:P,panelConstraints:K,pivotIndices:re,prevLayout:P,trigger:"imperative-api"});Bs(P,Ae)||(v(Ae),S.current.layout=Ae,Y&&Y(Ae),to(I,Ae,y.current))}}},[]),$=d.useCallback(W=>{const{layout:U,panelDataArray:Y}=S.current,{panelSize:P}=Mr(Y,W,U);return _e(P!=null,`Panel size not found for panel "${W.id}"`),P},[]),D=d.useCallback((W,U)=>{const{panelDataArray:Y}=S.current,P=ro(Y,W);return HC({defaultSize:U,dragState:x,layout:w,panelData:Y,panelIndex:P})},[x,w]),M=d.useCallback(W=>{const{layout:U,panelDataArray:Y}=S.current,{collapsedSize:P=0,collapsible:I,panelSize:K}=Mr(Y,W,U);return _e(K!=null,`Panel size not found for panel "${W.id}"`),I===!0&&nr(K,P)},[]),R=d.useCallback(W=>{const{layout:U,panelDataArray:Y}=S.current,{collapsedSize:P=0,collapsible:I,panelSize:K}=Mr(Y,W,U);return _e(K!=null,`Panel size not found for panel "${W.id}"`),!I||$r(K,P)>0},[]),F=d.useCallback(W=>{const{panelDataArray:U}=S.current;U.push(W),U.sort((Y,P)=>{const I=Y.order,K=P.order;return I==null&&K==null?0:I==null?-1:K==null?1:I-K}),S.current.panelDataArrayChanged=!0,b()},[b]);Pr(()=>{if(S.current.panelDataArrayChanged){S.current.panelDataArrayChanged=!1;const{autoSaveId:W,onLayout:U,storage:Y}=E.current,{layout:P,panelDataArray:I}=S.current;let K=null;if(W){const J=VC(W,I,Y);J&&(C.current=new Map(Object.entries(J.expandToSizes)),K=J.layout)}K==null&&(K=BC({panelDataArray:I}));const Z=su({layout:K,panelConstraints:I.map(J=>J.constraints)});ru(P,Z)||(v(Z),S.current.layout=Z,U&&U(Z),to(I,Z,y.current))}}),Pr(()=>{const W=S.current;return()=>{W.layout=[]}},[]);const z=d.useCallback(W=>{let U=!1;const Y=h.current;return Y&&window.getComputedStyle(Y,null).getPropertyValue("direction")==="rtl"&&(U=!0),function(I){I.preventDefault();const K=h.current;if(!K)return()=>null;const{direction:Z,dragState:J,id:oe,keyboardResizeBy:re,onLayout:ie}=E.current,{layout:te,panelDataArray:ue}=S.current,{initialLayout:De}=J??{},Re=hm(oe,W,K);let Ae=UC(I,W,Z,J,re,K);const Le=Z==="horizontal";Le&&U&&(Ae=-Ae);const Nt=ue.map(Lt=>Lt.constraints),tt=zo({delta:Ae,initialLayout:De??te,panelConstraints:Nt,pivotIndices:Re,prevLayout:te,trigger:sm(I)?"keyboard":"mouse-or-touch"}),bt=!Bs(te,tt);(am(I)||im(I))&&k.current!=Ae&&(k.current=Ae,!bt&&Ae!==0?Le?Ti(W,Ae<0?cm:dm):Ti(W,Ae<0?um:fm):Ti(W,0)),bt&&(v(tt),S.current.layout=tt,ie&&ie(tt),to(ue,tt,y.current))}},[]),A=d.useCallback((W,U)=>{const{onLayout:Y}=E.current,{layout:P,panelDataArray:I}=S.current,K=I.map(te=>te.constraints),{panelSize:Z,pivotIndices:J}=Mr(I,W,P);_e(Z!=null,`Panel size not found for panel "${W.id}"`);const re=ro(I,W)===I.length-1?Z-U:U-Z,ie=zo({delta:re,initialLayout:P,panelConstraints:K,pivotIndices:J,prevLayout:P,trigger:"imperative-api"});Bs(P,ie)||(v(ie),S.current.layout=ie,Y&&Y(ie),to(I,ie,y.current))},[]),G=d.useCallback((W,U)=>{const{layout:Y,panelDataArray:P}=S.current,{collapsedSize:I=0,collapsible:K}=U,{collapsedSize:Z=0,collapsible:J,maxSize:oe=100,minSize:re=0}=W.constraints,{panelSize:ie}=Mr(P,W,Y);ie!=null&&(K&&J&&nr(ie,I)?nr(I,Z)||A(W,Z):ie<re?A(W,re):ie>oe&&A(W,oe))},[A]),j=d.useCallback((W,U)=>{const{direction:Y}=E.current,{layout:P}=S.current;if(!h.current)return;const I=qa(W,h.current);_e(I,`Drag handle element not found for id "${W}"`);const K=xm(Y,U);g({dragHandleId:W,dragHandleRect:I.getBoundingClientRect(),initialCursorPosition:K,initialLayout:P})},[]),_=d.useCallback(()=>{g(null)},[]),O=d.useCallback(W=>{const{panelDataArray:U}=S.current,Y=ro(U,W);Y>=0&&(U.splice(Y,1),delete y.current[W.id],S.current.panelDataArrayChanged=!0,b())},[b]),H=d.useMemo(()=>({collapsePanel:N,direction:r,dragState:x,expandPanel:L,getPanelSize:$,getPanelStyle:D,groupId:m,isPanelCollapsed:M,isPanelExpanded:R,reevaluatePanelConstraints:G,registerPanel:F,registerResizeHandle:z,resizePanel:A,startDragging:j,stopDragging:_,unregisterPanel:O,panelGroupElement:h.current}),[N,x,r,L,$,D,m,M,R,G,F,z,A,j,_,O]),Q={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return d.createElement(Ga.Provider,{value:H},d.createElement(p,{...f,children:t,className:n,id:a,ref:h,style:{...Q,...u},[ot.group]:"",[ot.groupDirection]:r,[ot.groupId]:m}))}const Cm=d.forwardRef((e,t)=>d.createElement(ym,{...e,forwardedRef:t}));ym.displayName="PanelGroup";Cm.displayName="forwardRef(PanelGroup)";function ro(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Mr(e,t,n){const r=ro(e,t),a=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:a}}function KC({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){d.useEffect(()=>{if(e||n==null||r==null)return;const o=qa(t,r);if(o==null)return;const a=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const l=o.getAttribute(ot.groupId);_e(l,`No group element found for id "${l}"`);const c=Qo(l,r),u=mm(l,t,r);_e(u!==null,`No resize element found for id "${t}"`);const p=i.shiftKey?u>0?u-1:c.length-1:u+1<c.length?u+1:0;c[p].focus();break}}};return o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a)}},[r,e,t,n])}function Em({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:a,onClick:i,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:p,style:f={},tabIndex:m=0,tagName:h="div",...x}){var g,w;const v=d.useRef(null),b=d.useRef({onClick:i,onDragging:l,onPointerDown:u,onPointerUp:p});d.useEffect(()=>{b.current.onClick=i,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=p});const y=d.useContext(Ga);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:k,registerResizeHandle:E,startDragging:S,stopDragging:N,panelGroupElement:L}=y,$=Ac(o),[D,M]=d.useState("inactive"),[R,F]=d.useState(!1),[z,A]=d.useState(null),G=d.useRef({state:D});Pr(()=>{G.current.state=D}),d.useEffect(()=>{if(n)A(null);else{const H=E($);A(()=>H)}},[n,$,E]);const j=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,_=(w=r==null?void 0:r.fine)!==null&&w!==void 0?w:5;d.useEffect(()=>{if(n||z==null)return;const H=v.current;_e(H,"Element ref not attached");let Q=!1;return RC($,H,C,{coarse:j,fine:_},(U,Y,P)=>{if(!Y){M("inactive");return}switch(U){case"down":{M("drag"),Q=!1,_e(P,'Expected event to be defined for "down" action'),S($,P);const{onDragging:I,onPointerDown:K}=b.current;I==null||I(!0),K==null||K();break}case"move":{const{state:I}=G.current;Q=!0,I!=="drag"&&M("hover"),_e(P,'Expected event to be defined for "move" action'),z(P);break}case"up":{M("hover"),N();const{onClick:I,onDragging:K,onPointerUp:Z}=b.current;K==null||K(!1),Z==null||Z(),Q||I==null||I();break}}})},[j,C,n,_,E,$,z,S,N]),KC({disabled:n,handleId:$,resizeHandler:z,panelGroupElement:L});const O={touchAction:"none",userSelect:"none"};return d.createElement(h,{...x,children:e,className:t,id:o,onBlur:()=>{F(!1),a==null||a()},onFocus:()=>{F(!0),c==null||c()},ref:v,role:"separator",style:{...O,...f},tabIndex:m,[ot.groupDirection]:C,[ot.groupId]:k,[ot.resizeHandle]:"",[ot.resizeHandleActive]:D==="drag"?"pointer":R?"keyboard":void 0,[ot.resizeHandleEnabled]:!n,[ot.resizeHandleId]:$,[ot.resizeHandleState]:D})}Em.displayName="PanelResizeHandle";function qC({className:e,...t}){return s.jsx(Cm,{"data-slot":"resizable-panel-group",className:me("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function iu({...e}){return s.jsx(om,{"data-slot":"resizable-panel",...e})}function XC({withHandle:e,className:t,...n}){return s.jsx(Em,{"data-slot":"resizable-handle",className:me("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&s.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:s.jsx(tf,{className:"size-2.5"})})})}const ZC=d.forwardRef(({className:e,...t},n)=>s.jsx("ul",{ref:n,className:me("flex flex-row items-center gap-1",e),...t}));ZC.displayName="PaginationContent";const JC=d.forwardRef(({className:e,...t},n)=>s.jsx("li",{ref:n,className:me("",e),...t}));JC.displayName="PaginationItem";function QC({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){d.useEffect(()=>{if(!r)return;const o=a=>{const i=a.target,l=e.current&&!e.current.contains(i),c=t!=null&&t.current?!t.current.contains(i):!0;l&&c&&n()};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[e,t,n,r])}function eE({onEscape:e,enabled:t=!0}){d.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const tE={x:0,y:0},yn=16,nE=["top-start","bottom-end","top-end"];function rE({anchorRef:e,placement:t="top-start",offset:n=tE,fallbackPlacements:r=nE}){const o=d.useCallback((c,u,p)=>{let f=0,m=0;switch(p){case"top":f=c.top-u.height-n.y,m=c.left+(c.width-u.width)/2+n.x;break;case"top-start":f=c.top-u.height-n.y,m=c.left+n.x;break;case"top-end":f=c.top-u.height-n.y,m=c.right-u.width-n.x;break;case"bottom":f=c.bottom+n.y,m=c.left+(c.width-u.width)/2+n.x;break;case"bottom-start":f=c.bottom+n.y,m=c.left+n.x;break;case"bottom-end":f=c.bottom+n.y,m=c.right-u.width-n.x;break;case"left":f=c.top+(c.height-u.height)/2+n.y,m=c.left-u.width-n.x;break;case"left-start":f=c.top+n.y,m=c.left-u.width-n.x;break;case"left-end":f=c.bottom-u.height-n.y,m=c.left-u.width-n.x;break;case"right":f=c.top+(c.height-u.height)/2+n.y,m=c.right+n.x;break;case"right-start":f=c.top+n.y,m=c.right+n.x;break;case"right-end":f=c.bottom-u.height-n.y,m=c.right+n.x;break}return console.log(`Calculated position for ${p}:`,{top:f,left:m}),{top:f,left:m,placement:p}},[n.x,n.y]),a=d.useCallback((c,u)=>{const p={width:window.innerWidth,height:window.innerHeight};return c.left<yn||c.top<yn||c.left+u.width>p.width-yn||c.top+u.height>p.height-yn},[]),i=d.useCallback(c=>{if(!e.current){const x={width:window.innerWidth,height:window.innerHeight};return{top:x.height/2-100,left:x.width/2-100,placement:t}}const u=e.current.getBoundingClientRect(),p=c.getBoundingClientRect(),f=o(u,p,t);if(!a(f,p))return f;for(const x of r){const g=o(u,p,x);if(!a(g,p))return g}const m={width:window.innerWidth,height:window.innerHeight},h={...f};return h.left<yn?h.left=yn:h.left+p.width>m.width-yn&&(h.left=m.width-p.width-yn),h.top<yn?h.top=yn:h.top+p.height>m.height-yn&&(h.top=m.height-p.height-yn),h},[e,t,r,o,a]);return{getPositionStyle:d.useCallback(c=>{const u=i(c);return{position:"fixed",top:u.top,left:u.left,zIndex:1e3}},[i]),getOptimalPosition:i}}function oE({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[a,i]=d.useState(e),[l,c]=d.useState(!1),u=d.useRef(0),p=d.useRef(e),f=d.useCallback(v=>{v.preventDefault(),c(!0),u.current=v.clientX,p.current=a},[a]),m=d.useCallback(v=>{if(!l)return;const b=v.clientX-u.current,y=r==="right"?-b:b,C=Math.min(Math.max(p.current+y,t),n);i(C),o==null||o(C)},[l,t,n,r,o]),h=d.useCallback(()=>{c(!1)},[]),x=d.useCallback(v=>{v.preventDefault(),c(!0),u.current=v.touches[0].clientX,p.current=a},[a]),g=d.useCallback(v=>{if(!l)return;const b=v.touches[0].clientX-u.current,y=r==="right"?-b:b,C=Math.min(Math.max(p.current+y,t),n);i(C),o==null||o(C)},[l,t,n,r,o]),w=d.useCallback(()=>{c(!1)},[]);return d.useEffect(()=>{if(l)return document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.addEventListener("touchmove",g),document.addEventListener("touchend",w),document.body.style.userSelect="none",document.body.style.cursor="col-resize",()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",w),document.body.style.userSelect="",document.body.style.cursor=""}},[l,m,h,g,w]),{width:a,isResizing:l,handleMouseDown:f,handleTouchStart:x,setWidth:i}}const sE=d.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:a=!0,className:i,onWidthChange:l,...c},u)=>{const{width:p,isResizing:f,handleMouseDown:m,handleTouchStart:h}=oE({defaultWidth:t,minWidth:n,maxWidth:r,position:o,onWidthChange:l}),x={width:`${p}px`},g=o==="left"?"right-0":"left-0";return s.jsxs("div",{ref:u,className:me("relative h-full flex-shrink-0 cursor-pointer",o==="left"?"border-r":"border-l",i),style:x,...c,children:[s.jsx("div",{className:me("h-full overflow-x-hidden overflow-y-auto"),children:e}),a&&s.jsx("div",{className:me("group absolute top-0 bottom-0 w-2",g,"cursor-col-resize","hover:bg-[var(--color-primary-wMain)]","transition-all duration-200",f&&"bg-[var(--color-primary-wMain)]"),onMouseDown:m,onTouchStart:h,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} panel`,tabIndex:0,onKeyDown:v=>{if(v.key==="ArrowLeft"||v.key==="ArrowRight"){v.preventDefault();const b=v.key==="ArrowRight"?10:-10,y=o==="right"?-b:b,C=Math.min(Math.max(p+y,n),r);l==null||l(C)}},children:s.jsx("div",{className:me("absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 transform","bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]","group-hover:bg-[var(--color-primary-wMain)]","transition-colors duration-200",f&&"bg-[var(--color-primary-wMain)]")})})]})});sE.displayName="SidePanel";const Sm=d.createContext(null),Nm=d.createContext(void 0),jm=d.createContext(null),Am=d.createContext(null),km=d.createContext(void 0),Tm=d.createContext(null);function Rt(){const e=d.useContext(jm);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const aE="https://solace.com/a2a/extensions/display-name",iE="https://solace.com/a2a/extensions/peer-agent-topology",lE="https://solace.com/a2a/extensions/sam/tools",cE=e=>{var o,a,i,l;let t,n,r;if((o=e.capabilities)!=null&&o.extensions){const c=e.capabilities.extensions.find(f=>f.uri===aE);(a=c==null?void 0:c.params)!=null&&a.display_name&&(t=c.params.display_name);const u=e.capabilities.extensions.find(f=>f.uri===iE);(i=u==null?void 0:u.params)!=null&&i.peer_agent_names&&(n=u.params.peer_agent_names);const p=e.capabilities.extensions.find(f=>f.uri===lE);(l=p==null?void 0:p.params)!=null&&l.tools&&(r=p.params.tools)}return{...e,display_name:t,peer_agents:n||[],tools:r||[],displayName:t,peerAgents:n||[]}},_c=()=>{const{configServerUrl:e}=Rt(),[t,n]=d.useState([]),[r,o]=d.useState({}),[a,i]=d.useState(!0),[l,c]=d.useState(null),u=d.useCallback(async()=>{i(!0),c(null);try{const p=`${e}/api/v1`,f=await je(`${p}/agentCards`,{credentials:"include"});if(!f.ok){const g=await f.json().catch(()=>({message:`Failed to fetch agents: ${f.statusText}`}));throw new Error(g.message||`Failed to fetch agents: ${f.statusText}`)}const h=(await f.json()).map(cE);n(h);const x={};h.forEach(g=>{g.name&&(x[g.name]=g.displayName||g.name)}),o(x)}catch(p){console.error("Error fetching agents:",p),c(p instanceof Error?p.message:"Could not load agent information."),n([])}finally{i(!1)}},[e]);return d.useEffect(()=>{u()},[u]),d.useMemo(()=>({agents:t,agentNameMap:r,isLoading:a,error:l,refetch:u}),[t,r,a,l,u])};function dE(e,t){if(t&&t.toLowerCase().startsWith("text/"))return!0;if(!e)return!1;const n=e.toLowerCase();return!!(n.endsWith(".txt")||n.endsWith(".text")||n.endsWith(".sql")||n.endsWith(".xml")||n.endsWith(".toml")||n.endsWith(".ini")||n.endsWith(".conf")||n.endsWith(".config")||n.endsWith(".properties")||n.endsWith(".py")||n.endsWith(".js")||n.endsWith(".ts")||n.endsWith(".jsx")||n.endsWith(".tsx")||n.endsWith(".java")||n.endsWith(".c")||n.endsWith(".cpp")||n.endsWith(".h")||n.endsWith(".hpp")||n.endsWith(".cs")||n.endsWith(".go")||n.endsWith(".rs")||n.endsWith(".rb")||n.endsWith(".php")||n.endsWith(".swift")||n.endsWith(".kt")||n.endsWith(".scala")||n.endsWith(".sh")||n.endsWith(".bash")||n.endsWith(".zsh")||n.endsWith(".bat")||n.endsWith(".cmd")||n.endsWith(".ps1")||n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less")||n.endsWith(".log")||n.endsWith(".env")||n.endsWith(".gitignore")||n.endsWith(".dockerignore")||n.endsWith(".editorconfig"))}function uE(e,t){if(t){const n=t.toLowerCase();if(n==="text/html"||n==="application/xhtml+xml")return!0}return e?e.toLowerCase().endsWith(".html")||e.toLowerCase().endsWith(".htm"):!1}function fE(e,t){if(t){const n=t.toLowerCase();if(n==="text/x-mermaid"||n==="application/x-mermaid")return!0}return e?e.toLowerCase().endsWith(".mermaid")||e.toLowerCase().endsWith(".mmd"):!1}function pE(e,t){if(t){const n=t.toLowerCase();if(n==="text/csv"||n==="application/csv")return!0}return e?e.toLowerCase().endsWith(".csv"):!1}function mE(e,t){if(t&&t.toLowerCase().startsWith("image/"))return!0;if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".png")||n.endsWith(".jpg")||n.endsWith(".jpeg")||n.endsWith(".gif")||n.endsWith(".bmp")||n.endsWith(".webp")||n.endsWith(".svg")}function hE(e,t){if(t){const n=t.toLowerCase();if(n==="application/json"||n==="text/json")return!0}return e?e.toLowerCase().endsWith(".json"):!1}function gE(e,t){if(t){const r=t.toLowerCase();if(r==="application/yaml"||r==="text/yaml"||r==="application/x-yaml"||r==="text/x-yaml")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".yaml")||n.endsWith(".yml")}function xE(e,t){if(t){const r=t.toLowerCase();if(r==="text/markdown"||r==="application/markdown"||r==="text/x-markdown")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function vE(e,t){if(t&&t.toLowerCase().startsWith("audio/"))return!0;if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".mp3")||n.endsWith(".wav")||n.endsWith(".ogg")||n.endsWith(".aac")||n.endsWith(".flac")||n.endsWith(".m4a")}function Mn(e,t){return uE(e,t)?"html":fE(e,t)?"mermaid":mE(e,t)?"image":xE(e,t)?"markdown":vE(e,t)?"audio":hE(e,t)?"json":gE(e,t)?"yaml":pE(e,t)?"csv":dE(e,t)?"text":null}function _m(e){try{const t=Uint8Array.from(atob(e),n=>n.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!1}).decode(t)}catch(t){console.warn("TextDecoder failed (potentially non-UTF8 data), falling back to simple atob:",t);try{return atob(e)}catch(n){return console.error("Failed to decode base64 content with atob fallback:",n),e}}}const Im=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],wE=["image","audio"],Rm=e=>{if(!e||!e.content)return"";const t=Mn(e.name,e.mime_type);if(!t||!Im.includes(t))return"";if(wE.includes(t))return e.content;if(e.isPlainText)return console.log("Content is plain text from streaming, returning as-is"),e.content;try{return _m(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},Mm=5*1024*1024,bE=Pa(Mm);function yE(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=Mn(e.filename,e.mime_type);return!t||!Im.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>Mm?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${bE}.`}:{canPreview:!0}}const Pm=(e,t="h-4 w-4")=>{if(!e)return s.jsx(Gi,{className:t});switch(Mn(e.filename,e.mime_type)){case"image":case"mermaid":return s.jsx(qi,{className:t});case"audio":return s.jsx(Ki,{className:t});case"html":return s.jsx(nf,{className:t});case"text":return s.jsx(Gn,{className:t});case"csv":return s.jsx(Yi,{className:t});case"json":return s.jsx(pv,{className:t});default:return s.jsx(Gi,{className:t})}},CE=(e,t)=>{const n=Mn(e,t);return n==="image"||n==="audio"},EE=(e,t)=>{const n=Mn(e,t);return n?["text","markdown","json","yaml","csv","html","image","audio"].includes(n):!1},SE=({filename:e,mimeType:t,shouldAutoExpand:n})=>{const r=d.useMemo(()=>CE(e,t),[e,t]),[o,a]=d.useState(()=>n??r),i=d.useMemo(()=>EE(e,t),[e,t]),l=d.useMemo(()=>i?o:!1,[i,o]),c=d.useMemo(()=>i,[i]),u=d.useCallback(()=>{if(!e||!c){console.log(`[useArtifactRendering] Toggle blocked - filename: ${e}, isExpandable: ${c}`);return}a(p=>{const f=!p;return console.log(`[useArtifactRendering] ${f?"Expanding":"Collapsing"} ${e}`),f})},[e,c]);return{shouldRender:l,isExpandable:c,isExpanded:o,toggleExpanded:u}},Ii="lastViewedProjectId",Dm=d.createContext(void 0);let fl=null;const NE=e=>{fl=e},jE=({children:e})=>{const{configServerUrl:t,projectsEnabled:n}=Rt(),[r,o]=d.useState([]),[a,i]=d.useState(!0),[l,c]=d.useState(null),[u,p]=d.useState(null),[f,m]=d.useState(null),[h,x]=d.useState(null),[g,w]=d.useState(""),v=`${t}/api/v1`,b=d.useMemo(()=>{if(!g.trim())return r;const D=g.toLowerCase();return r.filter(M=>{var R;return M.name.toLowerCase().includes(D)||(((R=M.description)==null?void 0:R.toLowerCase().includes(D))??!1)})},[r,g]),y=d.useCallback(async()=>{if(!n){i(!1),o([]);return}i(!0),c(null);try{const D=await je(`${v}/projects?include_artifact_count=true`,{credentials:"include"});if(!D.ok){const F=await D.json().catch(()=>({detail:`Failed to fetch projects: ${D.statusText}`}));throw new Error(F.detail||`Failed to fetch projects: ${D.statusText}`)}const R=[...(await D.json()).projects].sort((F,z)=>F.name.toLowerCase().localeCompare(z.name.toLowerCase()));o(R)}catch(D){console.error("Error fetching projects:",D),c(D instanceof Error?D.message:"Could not load projects."),o([])}finally{i(!1)}},[v,n]),C=d.useCallback(async D=>{if(!n)throw new Error("Projects feature is disabled");try{const M=await je(`${v}/projects`,{method:"POST",body:D,credentials:"include"});if(!M.ok){const F=await M.text();let z=`Failed to create project: ${M.statusText}`;try{const A=JSON.parse(F);z=A.detail||A.message||z}catch{F&&F.length<200&&(z=F)}throw new Error(z)}const R=await M.json();return o(F=>[R,...F].sort((A,G)=>A.name.toLowerCase().localeCompare(G.name.toLowerCase()))),R}catch(M){const R=M instanceof Error?M.message:"Could not create project.";throw new Error(R)}},[v,n]),k=d.useCallback(async(D,M)=>{if(!n)throw new Error("Projects feature is disabled");try{const R=await je(`${v}/projects/${D}/artifacts`,{method:"POST",body:M,credentials:"include"});if(!R.ok){const F=await R.json().catch(()=>({detail:`Failed to add files: ${R.statusText}`}));throw new Error(F.detail||`Failed to add files: ${R.statusText}`)}c(null),await y()}catch(R){console.error("Error adding files to project:",R);const F=R instanceof Error?R.message:"Could not add files to project.";throw new Error(F)}},[v,n,y]),E=d.useCallback(async(D,M)=>{if(!n)throw new Error("Projects feature is disabled");try{const R=await je(`${v}/projects/${D}/artifacts/${encodeURIComponent(M)}`,{method:"DELETE",credentials:"include"});if(!R.ok&&R.status!==204){const F=await R.json().catch(()=>({detail:`Failed to remove file: ${R.statusText}`}));throw new Error(F.detail||`Failed to remove file: ${R.statusText}`)}c(null),await y()}catch(R){console.error("Error removing file from project:",R);const F=R instanceof Error?R.message:"Could not remove file from project.";throw new Error(F)}},[v,n,y]),S=d.useCallback(async(D,M)=>{if(!n)throw new Error("Projects feature is disabled");try{const R=await je(`${v}/projects/${D}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(M),credentials:"include"});if(!R.ok){let z=`Failed to update project: ${R.statusText}`;try{const A=await R.json();R.status===422?A.detail&&(Array.isArray(A.detail)?z=`Validation error: ${A.detail.map(j=>{var O;return`${((O=j.loc)==null?void 0:O.join("."))||"field"}: ${j.msg}`}).join(", ")}`:typeof A.detail=="string"&&(z=A.detail)):z=A.detail||A.message||z}catch{}throw new Error(z)}const F=await R.json();return o(z=>z.map(G=>G.id===F.id?F:G).sort((G,j)=>G.name.toLowerCase().localeCompare(j.name.toLowerCase()))),p(z=>(z==null?void 0:z.id)===F.id?F:z),m(z=>(z==null?void 0:z.id)===F.id?F:z),x(z=>(z==null?void 0:z.id)===F.id?F:z),c(null),F}catch(R){console.error("Error updating project:",R);const F=R instanceof Error?R.message:"Could not update project.";throw new Error(F)}},[v,n]),N=d.useCallback(async D=>{if(!n)throw new Error("Projects feature is disabled");try{const M=await je(`${v}/projects/${D}`,{method:"DELETE",credentials:"include"});if(!M.ok&&M.status!==204){const R=await M.json().catch(()=>({detail:`Failed to delete project: ${M.statusText}`}));throw new Error(R.detail||`Failed to delete project: ${M.statusText}`)}o(R=>R.filter(F=>F.id!==D)),p(R=>(R==null?void 0:R.id)===D?null:R),m(R=>(R==null?void 0:R.id)===D?null:R),x(R=>(R==null?void 0:R.id)===D?null:R),c(null),fl&&fl(D)}catch(M){console.error("Error deleting project:",M);const R=M instanceof Error?M.message:"Could not delete project.";throw new Error(R)}},[v,n]);d.useEffect(()=>{y()},[y]),d.useEffect(()=>{if(r.length>0&&!f){const D=localStorage.getItem(Ii);if(D){const M=r.find(R=>R.id===D);M&&m(M)}}},[r,f]);const L=d.useCallback(D=>{m(D),D?localStorage.setItem(Ii,D.id):localStorage.removeItem(Ii)},[]),$={projects:r,isLoading:a,error:l,createProject:C,refetch:y,currentProject:u,setCurrentProject:p,selectedProject:f,setSelectedProject:L,activeProject:h,setActiveProject:x,addFilesToProject:k,removeFileFromProject:E,updateProject:S,deleteProject:N,searchQuery:g,setSearchQuery:w,filteredProjects:b};return s.jsx(Dm.Provider,{value:$,children:e})},pr=()=>{const e=d.useContext(Dm);if(e===void 0)throw new Error("useProjectContext must be used within a ProjectProvider");return e},AE=e=>{const{configServerUrl:t}=Rt(),{activeProject:n}=pr(),[r,o]=d.useState([]),[a,i]=d.useState(!0),[l,c]=d.useState(null),u=`${t}/api/v1`,p=d.useCallback(async()=>{i(!0),c(null);try{let f;if(e&&e.trim()&&e!=="null"&&e!=="undefined")f=`${u}/artifacts/${e}`;else if(n!=null&&n.id)f=`${u}/artifacts/null?project_id=${n.id}`;else{o([]),i(!1);return}const m=await je(f,{credentials:"include"});if(!m.ok){const g=await m.json().catch(()=>({message:`Failed to fetch artifacts. ${m.statusText}`}));throw new Error(g.message||`Failed to fetch artifacts. ${m.statusText}`)}const x=(await m.json()).map(g=>({...g,uri:g.uri||`artifact://${e}/${g.filename}`}));o(x)}catch(f){const m=f instanceof Error?f.message:"Failed to fetch artifacts.";c(m),o([])}finally{i(!1)}},[u,e,n==null?void 0:n.id]);return d.useEffect(()=>{p()},[p]),{artifacts:r,isLoading:a,error:l,refetch:p,setArtifacts:o}},kE=()=>{const e=d.useContext(Sm);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},qe=()=>{const e=d.useContext(Nm);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function TE(){const{messages:e}=qe(),t=Rt(),n=d.useCallback(r=>{if((t==null?void 0:t.persistenceEnabled)===!1&&!(e.length<=1))return r.preventDefault(),"Are you sure you want to leave? Your chat history will be lost."},[e.length,t==null?void 0:t.persistenceEnabled]);d.useEffect(()=>(window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}),[n])}function Lm(){const e=d.useContext(Am);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}function _E(e,t){const[n,r]=d.useState(e);return d.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}const IE=async(e,t,n,r)=>{let o;if(t&&t.trim()&&t!=="null"&&t!=="undefined")o=`${e}/api/v1/artifacts/${t}/${encodeURIComponent(r.filename)}`;else if(n)o=`${e}/api/v1/artifacts/null/${encodeURIComponent(r.filename)}?project_id=${n}`;else throw new Error("No valid context for artifact download");const a=await je(o,{credentials:"include"});if(!a.ok)throw new Error(`Failed to download artifact: ${r.filename}. Status: ${a.status}`);const i=await a.blob();Bf(i,r.filename)},Ic=e=>{const{configServerUrl:t}=Rt(),{addNotification:n,sessionId:r}=qe(),{activeProject:o}=pr();return{onDownload:async i=>{const l=r&&r.trim()&&r!=="null"&&r!=="undefined",c=e||(o==null?void 0:o.id);if(!l&&!!!c){n("Cannot download artifact: No active session or project.","error");return}try{await IE(t,r,c||null,i),n(`Downloaded artifact: ${i.filename}.`)}catch{n(`Failed to download artifact: ${i.filename}.`,"error")}}}},RE=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=d.useState(!1),a=d.useRef(0),i=d.useCallback(p=>{n||(p.preventDefault(),p.stopPropagation(),a.current=(a.current||0)+1,p.dataTransfer.types.includes("Files")&&o(!0))},[n,a]),l=d.useCallback(p=>{n||(p.preventDefault(),p.stopPropagation(),p.dataTransfer.types.includes("Files")&&(p.dataTransfer.dropEffect="copy"))},[n]),c=d.useCallback(p=>{n||(p.preventDefault(),p.stopPropagation(),a.current=(a.current||0)-1,a.current===0&&o(!1))},[n,a]),u=d.useCallback(p=>{if(n||(p.preventDefault(),p.stopPropagation(),o(!1),a.current=0,!p.dataTransfer.files||p.dataTransfer.files.length===0))return;const f=Array.from(p.dataTransfer.files),m=t?f.filter(t):f;m.length!==0&&e(m)},[n,a,t,e]);return{isDragging:r,handleDragEnter:i,handleDragOver:l,handleDragLeave:c,handleDrop:u}},Rc=()=>{const e=d.useContext(km);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function Xa(){const e=d.useContext(Tm);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}const ME=e=>{const{configServerUrl:t}=Rt(),[n,r]=d.useState([]),[o,a]=d.useState(!0),[i,l]=d.useState(null),c=`${t}/api/v1`,u=d.useCallback(async()=>{if(!e){r([]),a(!1);return}a(!0),l(null);try{const p=`${c}/sessions?project_id=${e}&pageNumber=1&pageSize=100`,f=await je(p,{credentials:"include"});if(!f.ok){const h=await f.json().catch(()=>({detail:`Failed to fetch sessions. ${f.statusText}`}));throw new Error(h.detail||`Failed to fetch sessions. ${f.statusText}`)}const m=await f.json();r(m.data||[])}catch(p){const f=p instanceof Error?p.message:"Failed to fetch sessions.";l(f),r([])}finally{a(!1)}},[c,e]);return d.useEffect(()=>{u();const p=()=>{u()},f=()=>{u()};return window.addEventListener("session-moved",p),window.addEventListener("new-chat-session",f),()=>{window.removeEventListener("session-moved",p),window.removeEventListener("new-chat-session",f)}},[u]),{sessions:n,isLoading:o,error:i,refetch:u}},PE=()=>{const{agents:e,sessionId:t,setMessages:n,setSelectedAgentName:r}=qe();return{handleAgentSelection:d.useCallback(a=>{if(a){const i=e.find(l=>l.name===a);if(i){r(a);const l=`Hi! I'm the ${i.displayName}. How can I help?`;n(c=>[...c,{parts:[{kind:"text",text:l}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:t||"",lastProcessedEventSequence:0}}])}else console.warn(`Selected agent not found: ${a}`)}},[e,t,n,r])}};d.createContext(null);function Za(e){const t=e+"CollectionProvider",[n,r]=cn(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:w,children:v}=g,b=At.useRef(null),y=At.useRef(new Map).current;return s.jsx(o,{scope:w,itemMap:y,collectionRef:b,children:v})};i.displayName=t;const l=e+"CollectionSlot",c=Cr(l),u=At.forwardRef((g,w)=>{const{scope:v,children:b}=g,y=a(l,v),C=Te(w,y.collectionRef);return s.jsx(c,{ref:C,children:b})});u.displayName=l;const p=e+"CollectionItemSlot",f="data-radix-collection-item",m=Cr(p),h=At.forwardRef((g,w)=>{const{scope:v,children:b,...y}=g,C=At.useRef(null),k=Te(w,C),E=a(p,v);return At.useEffect(()=>(E.itemMap.set(C,{ref:C,...y}),()=>void E.itemMap.delete(C))),s.jsx(m,{[f]:"",ref:k,children:b})});h.displayName=p;function x(g){const w=a(e+"CollectionConsumer",g);return At.useCallback(()=>{const b=w.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((E,S)=>y.indexOf(E.ref.current)-y.indexOf(S.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},x,r]}var DE=d.createContext(void 0);function bs(e){const t=d.useContext(DE);return e||t||"ltr"}const Ja=d.forwardRef(({actions:e,className:t,...n},r)=>{const o=(i,l)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),l.onClick())},a=(i,l)=>{var u,p,f,m,h;const c=(u=i.currentTarget.parentElement)==null?void 0:u.querySelectorAll('[role="menuitem"]');if(c)switch(i.key){case"ArrowDown":{i.preventDefault();const x=(l+1)%c.length;(p=c[x])==null||p.focus();break}case"ArrowUp":{i.preventDefault();const x=(l-1+c.length)%c.length;(f=c[x])==null||f.focus();break}case"Home":i.preventDefault(),(m=c[0])==null||m.focus();break;case"End":i.preventDefault(),(h=c[c.length-1])==null||h.focus();break;case"Escape":i.preventDefault(),i.currentTarget.blur();break}};return s.jsx("div",{ref:r,role:"menu",className:me("min-w-[8rem] overflow-hidden",t),...n,children:e.map((i,l)=>s.jsxs(d.Fragment,{children:[i.divider&&l>0&&s.jsx("div",{className:"my-1 h-px bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]"}),s.jsxs("div",{role:"menuitem",tabIndex:0,"data-disabled":i.disabled,className:me("relative my-1.5 flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm transition-colors select-none","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","hover:bg-[var(--color-primary-w10)] hover:text-[var(--color-primary-text-w60)] dark:hover:bg-[var(--color-primary-w60)] dark:hover:text-[var(--color-primary-text-w10)]"),onClick:i.onClick,onKeyDown:c=>{o(c,i),a(c,l)},children:[i.icon&&i.iconPosition!=="right"&&s.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon}),s.jsx("span",{className:"flex-1",children:i.label}),i.icon&&i.iconPosition==="right"&&s.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon})]})]},i.id))})});Ja.displayName="Menu";var Qa="Popover",[Om,o3]=cn(Qa,[za]),ys=za(),[LE,kr]=Om(Qa),$m=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!1}=e,l=ys(t),c=d.useRef(null),[u,p]=d.useState(!1),[f,m]=lr({prop:r,defaultProp:o??!1,onChange:a,caller:Qa});return s.jsx(pp,{...l,children:s.jsx(LE,{scope:t,contentId:an(),triggerRef:c,open:f,onOpenChange:m,onOpenToggle:d.useCallback(()=>m(h=>!h),[m]),hasCustomAnchor:u,onCustomAnchorAdd:d.useCallback(()=>p(!0),[]),onCustomAnchorRemove:d.useCallback(()=>p(!1),[]),modal:i,children:n})})};$m.displayName=Qa;var Fm="PopoverAnchor",OE=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=kr(Fm,n),a=ys(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return d.useEffect(()=>(i(),()=>l()),[i,l]),s.jsx(xc,{...a,...r,ref:t})});OE.displayName=Fm;var zm="PopoverTrigger",Um=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=kr(zm,n),a=ys(n),i=Te(t,o.triggerRef),l=s.jsx(ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Gm(o.open),...r,ref:i,onClick:Ye(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:s.jsx(xc,{asChild:!0,...a,children:l})});Um.displayName=zm;var Mc="PopoverPortal",[$E,FE]=Om(Mc,{forceMount:void 0}),Bm=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,a=kr(Mc,t);return s.jsx($E,{scope:t,forceMount:n,children:s.jsx(fr,{present:n||a.open,children:s.jsx(jo,{asChild:!0,container:o,children:r})})})};Bm.displayName=Mc;var ho="PopoverContent",Hm=d.forwardRef((e,t)=>{const n=FE(ho,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,a=kr(ho,e.__scopePopover);return s.jsx(fr,{present:r||a.open,children:a.modal?s.jsx(UE,{...o,ref:t}):s.jsx(BE,{...o,ref:t})})});Hm.displayName=ho;var zE=Cr("PopoverContent.RemoveScroll"),UE=d.forwardRef((e,t)=>{const n=kr(ho,e.__scopePopover),r=d.useRef(null),o=Te(t,r),a=d.useRef(!1);return d.useEffect(()=>{const i=r.current;if(i)return Wa(i)},[]),s.jsx(ws,{as:zE,allowPinchZoom:!0,children:s.jsx(Wm,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ye(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),a.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Ye(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Ye(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),BE=d.forwardRef((e,t)=>{const n=kr(ho,e.__scopePopover),r=d.useRef(!1),o=d.useRef(!1);return s.jsx(Wm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),Wm=d.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:p,...f}=e,m=kr(ho,n),h=ys(n);return _p(),s.jsx(vs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:s.jsx(La,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:p,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:s.jsx(mp,{"data-state":Gm(m.open),role:"dialog",id:m.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Vm="PopoverClose",HE=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=kr(Vm,n);return s.jsx(ve.button,{type:"button",...r,ref:t,onClick:Ye(e.onClick,()=>o.onOpenChange(!1))})});HE.displayName=Vm;var WE="PopoverArrow",VE=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ys(n);return s.jsx(hp,{...o,...r,ref:t})});VE.displayName=WE;function Gm(e){return e?"open":"closed"}var GE=$m,YE=Um,KE=Bm,qE=Hm;function Pc({...e}){return s.jsx(GE,{"data-slot":"popover",...e})}function Dc({...e}){return s.jsx(YE,{"data-slot":"popover-trigger",...e})}function Lc({className:e,align:t="center",sideOffset:n=4,...r}){return s.jsx(KE,{children:s.jsx(qE,{"data-slot":"popover-content",align:t,sideOffset:n,className:me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-background z-50 w-auto origin-(--radix-popover-content-transform-origin) rounded-sm border px-0 py-1 shadow-sm outline-hidden",e),...r})})}function XE({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:a,className:i,closeOnClickOutside:l=!0,closeOnEscape:c=!0,portal:u=!0,animationDuration:p=150,fallbackPlacements:f}){const m=d.useRef(null),[h,x]=d.useState({}),[g,w]=d.useState(!1);QC({ref:m,anchorRef:n,onClickOutside:t,enabled:e&&l}),eE({onEscape:t,enabled:e&&c});const{getPositionStyle:v}=rE({anchorRef:n,placement:o,offset:a,fallbackPlacements:f});if(d.useEffect(()=>{e&&m.current?(w(!1),requestAnimationFrame(()=>{if(m.current){const y=v(m.current);x(y),w(!0)}})):w(!1)},[e,v]),!e)return null;const b=s.jsx("div",{ref:m,role:"dialog","aria-modal":"false",className:me("bg-background min-w-[8rem] overflow-hidden border shadow-md",i),style:{...h,opacity:e&&g?1:0,transform:`scale(${e&&g?1:.95})`,transition:`opacity ${p}ms ease-in-out, transform ${p}ms ease-in-out`,pointerEvents:e&&g?"auto":"none",visibility:g?"visible":"hidden"},children:r});return u?is.createPortal(b,document.body):b}function lu(e,[t,n]){return Math.min(n,Math.max(t,e))}function dt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var ZE="DismissableLayer",pl="dismissableLayer.update",JE="dismissableLayer.pointerDownOutside",QE="dismissableLayer.focusOutside",cu,Ym=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Km=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:l,...c}=e,u=d.useContext(Ym),[p,f]=d.useState(null),m=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=d.useState({}),x=Te(t,S=>f(S)),g=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(w),b=p?g.indexOf(p):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,C=b>=v,k=nS(S=>{const N=S.target,L=[...u.branches].some($=>$.contains(N));!C||L||(o==null||o(S),i==null||i(S),S.defaultPrevented||l==null||l())},m),E=rS(S=>{const N=S.target;[...u.branches].some($=>$.contains(N))||(a==null||a(S),i==null||i(S),S.defaultPrevented||l==null||l())},m);return Xl(S=>{b===u.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},m),d.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(cu=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),du(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=cu)}},[p,m,n,u]),d.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),du())},[p,u]),d.useEffect(()=>{const S=()=>h({});return document.addEventListener(pl,S),()=>document.removeEventListener(pl,S)},[]),s.jsx(ve.div,{...c,ref:x,style:{pointerEvents:y?C?"auto":"none":void 0,...e.style},onFocusCapture:dt(e.onFocusCapture,E.onFocusCapture),onBlurCapture:dt(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:dt(e.onPointerDownCapture,k.onPointerDownCapture)})});Km.displayName=ZE;var eS="DismissableLayerBranch",tS=d.forwardRef((e,t)=>{const n=d.useContext(Ym),r=d.useRef(null),o=Te(t,r);return d.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(ve.div,{...e,ref:o})});tS.displayName=eS;function nS(e,t=globalThis==null?void 0:globalThis.document){const n=It(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){qm(JE,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function rS(e,t=globalThis==null?void 0:globalThis.document){const n=It(e),r=d.useRef(!1);return d.useEffect(()=>{const o=a=>{a.target&&!r.current&&qm(QE,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function du(){const e=new CustomEvent(pl);document.dispatchEvent(e)}function qm(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Da(o,a):o.dispatchEvent(a)}var Ri=0;function oS(){d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??uu()),document.body.insertAdjacentElement("beforeend",e[1]??uu()),Ri++,()=>{Ri===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ri--}},[])}function uu(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Oc="Popper",[Xm,Zm]=cn(Oc),[sS,Jm]=Xm(Oc),Qm=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return s.jsx(sS,{scope:t,anchor:r,onAnchorChange:o,children:n})};Qm.displayName=Oc;var eh="PopperAnchor",th=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=Jm(eh,n),i=d.useRef(null),l=Te(t,i),c=d.useRef(null);return d.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&a.onAnchorChange(c.current)}),r?null:s.jsx(ve.div,{...o,ref:l})});th.displayName=eh;var $c="PopperContent",[aS,iS]=Xm($c),nh=d.forwardRef((e,t)=>{var I,K,Z,J,oe,re;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,w=Jm($c,n),[v,b]=d.useState(null),y=Te(t,ie=>b(ie)),[C,k]=d.useState(null),E=mc(C),S=(E==null?void 0:E.width)??0,N=(E==null?void 0:E.height)??0,L=r+(a!=="center"?"-"+a:""),$=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},D=Array.isArray(u)?u:[u],M=D.length>0,R={padding:$,boundary:D.filter(cS),altBoundary:M},{refs:F,floatingStyles:z,placement:A,isPositioned:G,middlewareData:j}=sc({strategy:"fixed",placement:L,whileElementsMounted:(...ie)=>oc(...ie,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[ac({mainAxis:o+N,alignmentAxis:i}),c&&ic({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?lc():void 0,...R}),c&&cc({...R}),dc({...R,apply:({elements:ie,rects:te,availableWidth:ue,availableHeight:De})=>{const{width:Re,height:Ae}=te.reference,Le=ie.floating.style;Le.setProperty("--radix-popper-available-width",`${ue}px`),Le.setProperty("--radix-popper-available-height",`${De}px`),Le.setProperty("--radix-popper-anchor-width",`${Re}px`),Le.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),C&&fc({element:C,padding:l}),dS({arrowWidth:S,arrowHeight:N}),m&&uc({strategy:"referenceHidden",...R})]}),[_,O]=sh(A),H=It(x);st(()=>{G&&(H==null||H())},[G,H]);const Q=(I=j.arrow)==null?void 0:I.x,W=(K=j.arrow)==null?void 0:K.y,U=((Z=j.arrow)==null?void 0:Z.centerOffset)!==0,[Y,P]=d.useState();return st(()=>{v&&P(window.getComputedStyle(v).zIndex)},[v]),s.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:G?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(J=j.transformOrigin)==null?void 0:J.x,(oe=j.transformOrigin)==null?void 0:oe.y].join(" "),...((re=j.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(aS,{scope:n,placedSide:_,onArrowChange:k,arrowX:Q,arrowY:W,shouldHideArrow:U,children:s.jsx(ve.div,{"data-side":_,"data-align":O,...g,ref:y,style:{...g.style,animation:G?void 0:"none"}})})})});nh.displayName=$c;var rh="PopperArrow",lS={top:"bottom",right:"left",bottom:"top",left:"right"},oh=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,a=iS(rh,r),i=lS[a.placedSide];return s.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:s.jsx(pc,{...o,ref:n,style:{...o.style,display:"block"}})})});oh.displayName=rh;function cS(e){return e!==null}var dS=e=>({name:"transformOrigin",options:e,fn(t){var w,v,b;const{placement:n,rects:r,middlewareData:o}=t,i=((w=o.arrow)==null?void 0:w.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,p]=sh(n),f={start:"0%",center:"50%",end:"100%"}[p],m=(((v=o.arrow)==null?void 0:v.x)??0)+l/2,h=(((b=o.arrow)==null?void 0:b.y)??0)+c/2;let x="",g="";return u==="bottom"?(x=i?f:`${m}px`,g=`${-c}px`):u==="top"?(x=i?f:`${m}px`,g=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,g=i?f:`${h}px`):u==="left"&&(x=`${r.floating.width+c}px`,g=i?f:`${h}px`),{data:{x,y:g}}}});function sh(e){const[t,n="center"]=e.split("-");return[t,n]}var uS=Qm,fS=th,pS=nh,mS=oh;function hS(e){const t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var gS=[" ","Enter","ArrowUp","ArrowDown"],xS=[" ","Enter"],Fr="Select",[ei,ti,vS]=Za(Fr),[Ao,s3]=cn(Fr,[vS,Zm]),ni=Zm(),[wS,Tr]=Ao(Fr),[bS,yS]=Ao(Fr),ah=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:i,defaultValue:l,onValueChange:c,dir:u,name:p,autoComplete:f,disabled:m,required:h,form:x}=e,g=ni(t),[w,v]=d.useState(null),[b,y]=d.useState(null),[C,k]=d.useState(!1),E=bs(u),[S,N]=lr({prop:r,defaultProp:o??!1,onChange:a,caller:Fr}),[L,$]=lr({prop:i,defaultProp:l,onChange:c,caller:Fr}),D=d.useRef(null),M=w?x||!!w.closest("form"):!0,[R,F]=d.useState(new Set),z=Array.from(R).map(A=>A.props.value).join(";");return s.jsx(uS,{...g,children:s.jsxs(wS,{required:h,scope:t,trigger:w,onTriggerChange:v,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:an(),value:L,onValueChange:$,open:S,onOpenChange:N,dir:E,triggerPointerDownPosRef:D,disabled:m,children:[s.jsx(ei.Provider,{scope:t,children:s.jsx(bS,{scope:e.__scopeSelect,onNativeOptionAdd:d.useCallback(A=>{F(G=>new Set(G).add(A))},[]),onNativeOptionRemove:d.useCallback(A=>{F(G=>{const j=new Set(G);return j.delete(A),j})},[]),children:n})}),M?s.jsxs(kh,{"aria-hidden":!0,required:h,tabIndex:-1,name:p,autoComplete:f,value:L,onChange:A=>$(A.target.value),disabled:m,form:x,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(R)]},z):null]})})};ah.displayName=Fr;var ih="SelectTrigger",lh=d.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=ni(n),i=Tr(ih,n),l=i.disabled||r,c=Te(t,i.onTriggerChange),u=ti(n),p=d.useRef("touch"),[f,m,h]=_h(g=>{const w=u().filter(y=>!y.disabled),v=w.find(y=>y.value===i.value),b=Ih(w,g,v);b!==void 0&&i.onValueChange(b.value)}),x=g=>{l||(i.onOpenChange(!0),h()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return s.jsx(fS,{asChild:!0,...a,children:s.jsx(ve.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Th(i.value)?"":void 0,...o,ref:c,onClick:dt(o.onClick,g=>{g.currentTarget.focus(),p.current!=="mouse"&&x(g)}),onPointerDown:dt(o.onPointerDown,g=>{p.current=g.pointerType;const w=g.target;w.hasPointerCapture(g.pointerId)&&w.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(x(g),g.preventDefault())}),onKeyDown:dt(o.onKeyDown,g=>{const w=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(w&&g.key===" ")&&gS.includes(g.key)&&(x(),g.preventDefault())})})})});lh.displayName=ih;var ch="SelectValue",dh=d.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:i="",...l}=e,c=Tr(ch,n),{onValueNodeHasChildrenChange:u}=c,p=a!==void 0,f=Te(t,c.onValueNodeChange);return st(()=>{u(p)},[u,p]),s.jsx(ve.span,{...l,ref:f,style:{pointerEvents:"none"},children:Th(c.value)?s.jsx(s.Fragment,{children:i}):a})});dh.displayName=ch;var CS="SelectIcon",uh=d.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return s.jsx(ve.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});uh.displayName=CS;var ES="SelectPortal",fh=e=>s.jsx(jo,{asChild:!0,...e});fh.displayName=ES;var zr="SelectContent",ph=d.forwardRef((e,t)=>{const n=Tr(zr,e.__scopeSelect),[r,o]=d.useState();if(st(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?is.createPortal(s.jsx(mh,{scope:e.__scopeSelect,children:s.jsx(ei.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),a):null}return s.jsx(hh,{...e,ref:t})});ph.displayName=zr;var In=10,[mh,_r]=Ao(zr),SS="SelectContentImpl",NS=Cr("SelectContent.RemoveScroll"),hh=d.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:p,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:w,...v}=e,b=Tr(zr,n),[y,C]=d.useState(null),[k,E]=d.useState(null),S=Te(t,I=>C(I)),[N,L]=d.useState(null),[$,D]=d.useState(null),M=ti(n),[R,F]=d.useState(!1),z=d.useRef(!1);d.useEffect(()=>{if(y)return Wa(y)},[y]),oS();const A=d.useCallback(I=>{const[K,...Z]=M().map(re=>re.ref.current),[J]=Z.slice(-1),oe=document.activeElement;for(const re of I)if(re===oe||(re==null||re.scrollIntoView({block:"nearest"}),re===K&&k&&(k.scrollTop=0),re===J&&k&&(k.scrollTop=k.scrollHeight),re==null||re.focus(),document.activeElement!==oe))return},[M,k]),G=d.useCallback(()=>A([N,y]),[A,N,y]);d.useEffect(()=>{R&&G()},[R,G]);const{onOpenChange:j,triggerPointerDownPosRef:_}=b;d.useEffect(()=>{if(y){let I={x:0,y:0};const K=J=>{var oe,re;I={x:Math.abs(Math.round(J.pageX)-(((oe=_.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(J.pageY)-(((re=_.current)==null?void 0:re.y)??0))}},Z=J=>{I.x<=10&&I.y<=10?J.preventDefault():y.contains(J.target)||j(!1),document.removeEventListener("pointermove",K),_.current=null};return _.current!==null&&(document.addEventListener("pointermove",K),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",Z,{capture:!0})}}},[y,j,_]),d.useEffect(()=>{const I=()=>j(!1);return window.addEventListener("blur",I),window.addEventListener("resize",I),()=>{window.removeEventListener("blur",I),window.removeEventListener("resize",I)}},[j]);const[O,H]=_h(I=>{const K=M().filter(oe=>!oe.disabled),Z=K.find(oe=>oe.ref.current===document.activeElement),J=Ih(K,I,Z);J&&setTimeout(()=>J.ref.current.focus())}),Q=d.useCallback((I,K,Z)=>{const J=!z.current&&!Z;(b.value!==void 0&&b.value===K||J)&&(L(I),J&&(z.current=!0))},[b.value]),W=d.useCallback(()=>y==null?void 0:y.focus(),[y]),U=d.useCallback((I,K,Z)=>{const J=!z.current&&!Z;(b.value!==void 0&&b.value===K||J)&&D(I)},[b.value]),Y=r==="popper"?ml:gh,P=Y===ml?{side:l,sideOffset:c,align:u,alignOffset:p,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:w}:{};return s.jsx(mh,{scope:n,content:y,viewport:k,onViewportChange:E,itemRefCallback:Q,selectedItem:N,onItemLeave:W,itemTextRefCallback:U,focusSelectedItem:G,selectedItemText:$,position:r,isPositioned:R,searchRef:O,children:s.jsx(ws,{as:NS,allowPinchZoom:!0,children:s.jsx(vs,{asChild:!0,trapped:b.open,onMountAutoFocus:I=>{I.preventDefault()},onUnmountAutoFocus:dt(o,I=>{var K;(K=b.trigger)==null||K.focus({preventScroll:!0}),I.preventDefault()}),children:s.jsx(Km,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:I=>I.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:s.jsx(Y,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:I=>I.preventDefault(),...v,...P,onPlaced:()=>F(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:dt(v.onKeyDown,I=>{const K=I.ctrlKey||I.altKey||I.metaKey;if(I.key==="Tab"&&I.preventDefault(),!K&&I.key.length===1&&H(I.key),["ArrowUp","ArrowDown","Home","End"].includes(I.key)){let J=M().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(I.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(I.key)){const oe=I.target,re=J.indexOf(oe);J=J.slice(re+1)}setTimeout(()=>A(J)),I.preventDefault()}})})})})})})});hh.displayName=SS;var jS="SelectItemAlignedPosition",gh=d.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=Tr(zr,n),i=_r(zr,n),[l,c]=d.useState(null),[u,p]=d.useState(null),f=Te(t,S=>p(S)),m=ti(n),h=d.useRef(!1),x=d.useRef(!0),{viewport:g,selectedItem:w,selectedItemText:v,focusSelectedItem:b}=i,y=d.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&g&&w&&v){const S=a.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),L=a.valueNode.getBoundingClientRect(),$=v.getBoundingClientRect();if(a.dir!=="rtl"){const oe=$.left-N.left,re=L.left-oe,ie=S.left-re,te=S.width+ie,ue=Math.max(te,N.width),De=window.innerWidth-In,Re=lu(re,[In,Math.max(In,De-ue)]);l.style.minWidth=te+"px",l.style.left=Re+"px"}else{const oe=N.right-$.right,re=window.innerWidth-L.right-oe,ie=window.innerWidth-S.right-re,te=S.width+ie,ue=Math.max(te,N.width),De=window.innerWidth-In,Re=lu(re,[In,Math.max(In,De-ue)]);l.style.minWidth=te+"px",l.style.right=Re+"px"}const D=m(),M=window.innerHeight-In*2,R=g.scrollHeight,F=window.getComputedStyle(u),z=parseInt(F.borderTopWidth,10),A=parseInt(F.paddingTop,10),G=parseInt(F.borderBottomWidth,10),j=parseInt(F.paddingBottom,10),_=z+A+R+j+G,O=Math.min(w.offsetHeight*5,_),H=window.getComputedStyle(g),Q=parseInt(H.paddingTop,10),W=parseInt(H.paddingBottom,10),U=S.top+S.height/2-In,Y=M-U,P=w.offsetHeight/2,I=w.offsetTop+P,K=z+A+I,Z=_-K;if(K<=U){const oe=D.length>0&&w===D[D.length-1].ref.current;l.style.bottom="0px";const re=u.clientHeight-g.offsetTop-g.offsetHeight,ie=Math.max(Y,P+(oe?W:0)+re+G),te=K+ie;l.style.height=te+"px"}else{const oe=D.length>0&&w===D[0].ref.current;l.style.top="0px";const ie=Math.max(U,z+g.offsetTop+(oe?Q:0)+P)+Z;l.style.height=ie+"px",g.scrollTop=K-U+g.offsetTop}l.style.margin=`${In}px 0`,l.style.minHeight=O+"px",l.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,l,u,g,w,v,a.dir,r]);st(()=>y(),[y]);const[C,k]=d.useState();st(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const E=d.useCallback(S=>{S&&x.current===!0&&(y(),b==null||b(),x.current=!1)},[y,b]);return s.jsx(kS,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:E,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:s.jsx(ve.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});gh.displayName=jS;var AS="SelectPopperPosition",ml=d.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=In,...a}=e,i=ni(n);return s.jsx(pS,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ml.displayName=AS;var[kS,Fc]=Ao(zr,{}),hl="SelectViewport",xh=d.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=_r(hl,n),i=Fc(hl,n),l=Te(t,a.onViewportChange),c=d.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(ei.Slot,{scope:n,children:s.jsx(ve.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:dt(o.onScroll,u=>{const p=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const h=Math.abs(c.current-p.scrollTop);if(h>0){const x=window.innerHeight-In*2,g=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),v=Math.max(g,w);if(v<x){const b=v+h,y=Math.min(x,b),C=b-y;f.style.height=y+"px",f.style.bottom==="0px"&&(p.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}c.current=p.scrollTop})})})]})});xh.displayName=hl;var vh="SelectGroup",[TS,_S]=Ao(vh),IS=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=an();return s.jsx(TS,{scope:n,id:o,children:s.jsx(ve.div,{role:"group","aria-labelledby":o,...r,ref:t})})});IS.displayName=vh;var wh="SelectLabel",RS=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=_S(wh,n);return s.jsx(ve.div,{id:o.id,...r,ref:t})});RS.displayName=wh;var ga="SelectItem",[MS,bh]=Ao(ga),yh=d.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...i}=e,l=Tr(ga,n),c=_r(ga,n),u=l.value===r,[p,f]=d.useState(a??""),[m,h]=d.useState(!1),x=Te(t,b=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,b,r,o)}),g=an(),w=d.useRef("touch"),v=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(MS,{scope:n,value:r,disabled:o,textId:g,isSelected:u,onItemTextChange:d.useCallback(b=>{f(y=>y||((b==null?void 0:b.textContent)??"").trim())},[]),children:s.jsx(ei.ItemSlot,{scope:n,value:r,disabled:o,textValue:p,children:s.jsx(ve.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:x,onFocus:dt(i.onFocus,()=>h(!0)),onBlur:dt(i.onBlur,()=>h(!1)),onClick:dt(i.onClick,()=>{w.current!=="mouse"&&v()}),onPointerUp:dt(i.onPointerUp,()=>{w.current==="mouse"&&v()}),onPointerDown:dt(i.onPointerDown,b=>{w.current=b.pointerType}),onPointerMove:dt(i.onPointerMove,b=>{var y;w.current=b.pointerType,o?(y=c.onItemLeave)==null||y.call(c):w.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:dt(i.onPointerLeave,b=>{var y;b.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:dt(i.onKeyDown,b=>{var C;((C=c.searchRef)==null?void 0:C.current)!==""&&b.key===" "||(xS.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});yh.displayName=ga;var Bo="SelectItemText",Ch=d.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,i=Tr(Bo,n),l=_r(Bo,n),c=bh(Bo,n),u=yS(Bo,n),[p,f]=d.useState(null),m=Te(t,v=>f(v),c.onItemTextChange,v=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,v,c.value,c.disabled)}),h=p==null?void 0:p.textContent,x=d.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:w}=u;return st(()=>(g(x),()=>w(x)),[g,w,x]),s.jsxs(s.Fragment,{children:[s.jsx(ve.span,{id:c.textId,...a,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?is.createPortal(a.children,i.valueNode):null]})});Ch.displayName=Bo;var Eh="SelectItemIndicator",Sh=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return bh(Eh,n).isSelected?s.jsx(ve.span,{"aria-hidden":!0,...r,ref:t}):null});Sh.displayName=Eh;var gl="SelectScrollUpButton",Nh=d.forwardRef((e,t)=>{const n=_r(gl,e.__scopeSelect),r=Fc(gl,e.__scopeSelect),[o,a]=d.useState(!1),i=Te(t,r.onScrollButtonChange);return st(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?s.jsx(Ah,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Nh.displayName=gl;var xl="SelectScrollDownButton",jh=d.forwardRef((e,t)=>{const n=_r(xl,e.__scopeSelect),r=Fc(xl,e.__scopeSelect),[o,a]=d.useState(!1),i=Te(t,r.onScrollButtonChange);return st(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,p=Math.ceil(c.scrollTop)<u;a(p)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?s.jsx(Ah,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});jh.displayName=xl;var Ah=d.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=_r("SelectScrollButton",n),i=d.useRef(null),l=ti(n),c=d.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),st(()=>{var p;const u=l().find(f=>f.ref.current===document.activeElement);(p=u==null?void 0:u.ref.current)==null||p.scrollIntoView({block:"nearest"})},[l]),s.jsx(ve.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:dt(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:dt(o.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:dt(o.onPointerLeave,()=>{c()})})}),PS="SelectSeparator",DS=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(ve.div,{"aria-hidden":!0,...r,ref:t})});DS.displayName=PS;var vl="SelectArrow",LS=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ni(n),a=Tr(vl,n),i=_r(vl,n);return a.open&&i.position==="popper"?s.jsx(mS,{...o,...r,ref:t}):null});LS.displayName=vl;var OS="SelectBubbleInput",kh=d.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=d.useRef(null),a=Te(r,o),i=hS(t);return d.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&p){const f=new Event("change",{bubbles:!0});p.call(l,t),l.dispatchEvent(f)}},[i,t]),s.jsx(ve.select,{...n,style:{...gp,...n.style},ref:a,defaultValue:t})});kh.displayName=OS;function Th(e){return e===""||e===void 0}function _h(e){const t=It(e),n=d.useRef(""),r=d.useRef(0),o=d.useCallback(i=>{const l=n.current+i;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),a=d.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function Ih(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=$S(e,Math.max(a,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function $S(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var FS=ah,zS=lh,US=dh,BS=uh,HS=fh,WS=ph,VS=xh,GS=yh,YS=Ch,KS=Sh,qS=Nh,XS=jh;function Cs({...e}){return s.jsx(FS,{"data-slot":"select",...e})}function Es({...e}){return s.jsx(US,{"data-slot":"select-value",...e})}function Ss({className:e,size:t="default",children:n,...r}){return s.jsxs(zS,{"data-slot":"select-trigger","data-size":t,className:me("flex w-fit items-center justify-between gap-2 border px-3 py-2 text-sm whitespace-nowrap shadow-xs disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,s.jsx(BS,{asChild:!0,children:s.jsx(aa,{className:"size-4 opacity-50"})})]})}function Ns({className:e,children:t,position:n="popper",...r}){return s.jsx(HS,{children:s.jsxs(WS,{"data-slot":"select-content",className:me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-background relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(ZS,{}),s.jsx(VS,{className:me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),s.jsx(JS,{})]})})}function Nr({className:e,children:t,...n}){return s.jsxs(GS,{"data-slot":"select-item",className:me("[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm select-none hover:bg-[var(--color-primary-w10)] hover:text-[var(--color-primary-text-w60)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:hover:bg-[var(--color-primary-w60)] dark:hover:text-[var(--color-primary-text-w10)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:s.jsx(KS,{children:s.jsx($l,{className:"size-4"})})}),s.jsx(YS,{children:t})]})}function ZS({className:e,...t}){return s.jsx(qS,{"data-slot":"select-scroll-up-button",className:me("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Xi,{className:"size-4"})})}function JS({className:e,...t}){return s.jsx(XS,{"data-slot":"select-scroll-down-button",className:me("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(aa,{className:"size-4"})})}var Mi="rovingFocusGroup.onEntryFocus",QS={bubbles:!1,cancelable:!0},js="RovingFocusGroup",[wl,Rh,e2]=Za(js),[t2,Mh]=cn(js,[e2]),[n2,r2]=t2(js),Ph=d.forwardRef((e,t)=>s.jsx(wl.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(wl.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(o2,{...e,ref:t})})}));Ph.displayName=js;var o2=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:p=!1,...f}=e,m=d.useRef(null),h=Te(t,m),x=bs(a),[g,w]=lr({prop:i,defaultProp:l??null,onChange:c,caller:js}),[v,b]=d.useState(!1),y=It(u),C=Rh(n),k=d.useRef(!1),[E,S]=d.useState(0);return d.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(Mi,y),()=>N.removeEventListener(Mi,y)},[y]),s.jsx(n2,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:g,onItemFocus:d.useCallback(N=>w(N),[w]),onItemShiftTab:d.useCallback(()=>b(!0),[]),onFocusableItemAdd:d.useCallback(()=>S(N=>N+1),[]),onFocusableItemRemove:d.useCallback(()=>S(N=>N-1),[]),children:s.jsx(ve.div,{tabIndex:v||E===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:Ye(e.onMouseDown,()=>{k.current=!0}),onFocus:Ye(e.onFocus,N=>{const L=!k.current;if(N.target===N.currentTarget&&L&&!v){const $=new CustomEvent(Mi,QS);if(N.currentTarget.dispatchEvent($),!$.defaultPrevented){const D=C().filter(A=>A.focusable),M=D.find(A=>A.active),R=D.find(A=>A.id===g),z=[M,R,...D].filter(Boolean).map(A=>A.ref.current);Oh(z,p)}}k.current=!1}),onBlur:Ye(e.onBlur,()=>b(!1))})})}),Dh="RovingFocusGroupItem",Lh=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,children:i,...l}=e,c=an(),u=a||c,p=r2(Dh,n),f=p.currentTabStopId===u,m=Rh(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:g}=p;return d.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),s.jsx(wl.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:s.jsx(ve.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:Ye(e.onMouseDown,w=>{r?p.onItemFocus(u):w.preventDefault()}),onFocus:Ye(e.onFocus,()=>p.onItemFocus(u)),onKeyDown:Ye(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){p.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const v=i2(w,p.orientation,p.dir);if(v!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let y=m().filter(C=>C.focusable).map(C=>C.ref.current);if(v==="last")y.reverse();else if(v==="prev"||v==="next"){v==="prev"&&y.reverse();const C=y.indexOf(w.currentTarget);y=p.loop?l2(y,C+1):y.slice(C+1)}setTimeout(()=>Oh(y))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:g!=null}):i})})});Lh.displayName=Dh;var s2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function a2(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function i2(e,t,n){const r=a2(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return s2[r]}function Oh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function l2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var c2=Ph,d2=Lh,ri="Tabs",[u2,a3]=cn(ri,[Mh]),$h=Mh(),[f2,zc]=u2(ri),Fh=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,p=bs(l),[f,m]=lr({prop:r,onChange:o,defaultProp:a??"",caller:ri});return s.jsx(f2,{scope:n,baseId:an(),value:f,onValueChange:m,orientation:i,dir:p,activationMode:c,children:s.jsx(ve.div,{dir:p,"data-orientation":i,...u,ref:t})})});Fh.displayName=ri;var zh="TabsList",Uh=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,a=zc(zh,n),i=$h(n);return s.jsx(c2,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:s.jsx(ve.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});Uh.displayName=zh;var Bh="TabsTrigger",Hh=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=e,i=zc(Bh,n),l=$h(n),c=Gh(i.baseId,r),u=Yh(i.baseId,r),p=r===i.value;return s.jsx(d2,{asChild:!0,...l,focusable:!o,active:p,children:s.jsx(ve.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":u,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...a,ref:t,onMouseDown:Ye(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:Ye(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:Ye(e.onFocus,()=>{const f=i.activationMode!=="manual";!p&&!o&&f&&i.onValueChange(r)})})})});Hh.displayName=Bh;var Wh="TabsContent",Vh=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...i}=e,l=zc(Wh,n),c=Gh(l.baseId,r),u=Yh(l.baseId,r),p=r===l.value,f=d.useRef(p);return d.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),s.jsx(fr,{present:o||p,children:({present:m})=>s.jsx(ve.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&a})})});Vh.displayName=Wh;function Gh(e,t){return`${e}-trigger-${t}`}function Yh(e,t){return`${e}-content-${t}`}var p2=Fh,m2=Uh,h2=Hh,g2=Vh;function x2({className:e,...t}){return s.jsx(p2,{"data-slot":"tabs",className:me("flex flex-col gap-2",e),...t})}function v2({className:e,...t}){return s.jsx(m2,{"data-slot":"tabs-list",className:me("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function fu({className:e,...t}){return s.jsx(h2,{"data-slot":"tabs-trigger","data-testid":t.value,"aria-label":t.value,title:t.title,className:me("data-[state=active]:bg-background dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow,background-color] hover:bg-[var(--color-brand-w10)] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-[var(--color-brand-wMain)] data-[state=active]:shadow-sm dark:hover:bg-[var(--color-brand-wMain30)] dark:data-[state=active]:text-[var(--color-brand-wMain)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function pu({className:e,...t}){return s.jsx(g2,{"data-slot":"tabs-content",className:me("flex-1 outline-none",e),...t})}function xa(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function He(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var w2="DismissableLayer",bl="dismissableLayer.update",b2="dismissableLayer.pointerDownOutside",y2="dismissableLayer.focusOutside",mu,Kh=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qh=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:l,...c}=e,u=d.useContext(Kh),[p,f]=d.useState(null),m=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=d.useState({}),x=Te(t,S=>f(S)),g=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(w),b=p?g.indexOf(p):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,C=b>=v,k=S2(S=>{const N=S.target,L=[...u.branches].some($=>$.contains(N));!C||L||(o==null||o(S),i==null||i(S),S.defaultPrevented||l==null||l())},m),E=N2(S=>{const N=S.target;[...u.branches].some($=>$.contains(N))||(a==null||a(S),i==null||i(S),S.defaultPrevented||l==null||l())},m);return Xl(S=>{b===u.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},m),d.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(mu=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),hu(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=mu)}},[p,m,n,u]),d.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),hu())},[p,u]),d.useEffect(()=>{const S=()=>h({});return document.addEventListener(bl,S),()=>document.removeEventListener(bl,S)},[]),s.jsx(ve.div,{...c,ref:x,style:{pointerEvents:y?C?"auto":"none":void 0,...e.style},onFocusCapture:He(e.onFocusCapture,E.onFocusCapture),onBlurCapture:He(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:He(e.onPointerDownCapture,k.onPointerDownCapture)})});qh.displayName=w2;var C2="DismissableLayerBranch",E2=d.forwardRef((e,t)=>{const n=d.useContext(Kh),r=d.useRef(null),o=Te(t,r);return d.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(ve.div,{...e,ref:o})});E2.displayName=C2;function S2(e,t=globalThis==null?void 0:globalThis.document){const n=It(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){Xh(b2,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function N2(e,t=globalThis==null?void 0:globalThis.document){const n=It(e),r=d.useRef(!1);return d.useEffect(()=>{const o=a=>{a.target&&!r.current&&Xh(y2,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hu(){const e=new CustomEvent(bl);document.dispatchEvent(e)}function Xh(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Da(o,a):o.dispatchEvent(a)}var Pi=0;function j2(){d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gu()),document.body.insertAdjacentElement("beforeend",e[1]??gu()),Pi++,()=>{Pi===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Pi--}},[])}function gu(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Uc="Popper",[Zh,Jh]=cn(Uc),[A2,Qh]=Zh(Uc),eg=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return s.jsx(A2,{scope:t,anchor:r,onAnchorChange:o,children:n})};eg.displayName=Uc;var tg="PopperAnchor",ng=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=Qh(tg,n),i=d.useRef(null),l=Te(t,i),c=d.useRef(null);return d.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&a.onAnchorChange(c.current)}),r?null:s.jsx(ve.div,{...o,ref:l})});ng.displayName=tg;var Bc="PopperContent",[k2,T2]=Zh(Bc),rg=d.forwardRef((e,t)=>{var I,K,Z,J,oe,re;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,w=Qh(Bc,n),[v,b]=d.useState(null),y=Te(t,ie=>b(ie)),[C,k]=d.useState(null),E=mc(C),S=(E==null?void 0:E.width)??0,N=(E==null?void 0:E.height)??0,L=r+(a!=="center"?"-"+a:""),$=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},D=Array.isArray(u)?u:[u],M=D.length>0,R={padding:$,boundary:D.filter(I2),altBoundary:M},{refs:F,floatingStyles:z,placement:A,isPositioned:G,middlewareData:j}=sc({strategy:"fixed",placement:L,whileElementsMounted:(...ie)=>oc(...ie,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[ac({mainAxis:o+N,alignmentAxis:i}),c&&ic({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?lc():void 0,...R}),c&&cc({...R}),dc({...R,apply:({elements:ie,rects:te,availableWidth:ue,availableHeight:De})=>{const{width:Re,height:Ae}=te.reference,Le=ie.floating.style;Le.setProperty("--radix-popper-available-width",`${ue}px`),Le.setProperty("--radix-popper-available-height",`${De}px`),Le.setProperty("--radix-popper-anchor-width",`${Re}px`),Le.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),C&&fc({element:C,padding:l}),R2({arrowWidth:S,arrowHeight:N}),m&&uc({strategy:"referenceHidden",...R})]}),[_,O]=ag(A),H=It(x);st(()=>{G&&(H==null||H())},[G,H]);const Q=(I=j.arrow)==null?void 0:I.x,W=(K=j.arrow)==null?void 0:K.y,U=((Z=j.arrow)==null?void 0:Z.centerOffset)!==0,[Y,P]=d.useState();return st(()=>{v&&P(window.getComputedStyle(v).zIndex)},[v]),s.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:G?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(J=j.transformOrigin)==null?void 0:J.x,(oe=j.transformOrigin)==null?void 0:oe.y].join(" "),...((re=j.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(k2,{scope:n,placedSide:_,onArrowChange:k,arrowX:Q,arrowY:W,shouldHideArrow:U,children:s.jsx(ve.div,{"data-side":_,"data-align":O,...g,ref:y,style:{...g.style,animation:G?void 0:"none"}})})})});rg.displayName=Bc;var og="PopperArrow",_2={top:"bottom",right:"left",bottom:"top",left:"right"},sg=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,a=T2(og,r),i=_2[a.placedSide];return s.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:s.jsx(pc,{...o,ref:n,style:{...o.style,display:"block"}})})});sg.displayName=og;function I2(e){return e!==null}var R2=e=>({name:"transformOrigin",options:e,fn(t){var w,v,b;const{placement:n,rects:r,middlewareData:o}=t,i=((w=o.arrow)==null?void 0:w.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,p]=ag(n),f={start:"0%",center:"50%",end:"100%"}[p],m=(((v=o.arrow)==null?void 0:v.x)??0)+l/2,h=(((b=o.arrow)==null?void 0:b.y)??0)+c/2;let x="",g="";return u==="bottom"?(x=i?f:`${m}px`,g=`${-c}px`):u==="top"?(x=i?f:`${m}px`,g=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,g=i?f:`${h}px`):u==="left"&&(x=`${r.floating.width+c}px`,g=i?f:`${h}px`),{data:{x,y:g}}}});function ag(e){const[t,n="center"]=e.split("-");return[t,n]}var M2=eg,P2=ng,D2=rg,L2=sg;function O2(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var As=e=>{const{present:t,children:n}=e,r=$2(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),a=Te(r.ref,F2(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:a}):null};As.displayName="Presence";function $2(e){const[t,n]=d.useState(),r=d.useRef(null),o=d.useRef(e),a=d.useRef("none"),i=e?"mounted":"unmounted",[l,c]=O2(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const u=Hs(r.current);a.current=l==="mounted"?u:"none"},[l]),st(()=>{const u=r.current,p=o.current;if(p!==e){const m=a.current,h=Hs(u);e?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(p&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),st(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,f=h=>{const g=Hs(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},m=h=>{h.target===t&&(a.current=Hs(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Hs(e){return(e==null?void 0:e.animationName)||"none"}function F2(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Di="rovingFocusGroup.onEntryFocus",z2={bubbles:!1,cancelable:!0},ks="RovingFocusGroup",[yl,ig,U2]=Za(ks),[B2,lg]=cn(ks,[U2]),[H2,W2]=B2(ks),cg=d.forwardRef((e,t)=>s.jsx(yl.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(yl.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(V2,{...e,ref:t})})}));cg.displayName=ks;var V2=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:p=!1,...f}=e,m=d.useRef(null),h=Te(t,m),x=bs(a),[g,w]=lr({prop:i,defaultProp:l??null,onChange:c,caller:ks}),[v,b]=d.useState(!1),y=It(u),C=ig(n),k=d.useRef(!1),[E,S]=d.useState(0);return d.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(Di,y),()=>N.removeEventListener(Di,y)},[y]),s.jsx(H2,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:g,onItemFocus:d.useCallback(N=>w(N),[w]),onItemShiftTab:d.useCallback(()=>b(!0),[]),onFocusableItemAdd:d.useCallback(()=>S(N=>N+1),[]),onFocusableItemRemove:d.useCallback(()=>S(N=>N-1),[]),children:s.jsx(ve.div,{tabIndex:v||E===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:He(e.onMouseDown,()=>{k.current=!0}),onFocus:He(e.onFocus,N=>{const L=!k.current;if(N.target===N.currentTarget&&L&&!v){const $=new CustomEvent(Di,z2);if(N.currentTarget.dispatchEvent($),!$.defaultPrevented){const D=C().filter(A=>A.focusable),M=D.find(A=>A.active),R=D.find(A=>A.id===g),z=[M,R,...D].filter(Boolean).map(A=>A.ref.current);fg(z,p)}}k.current=!1}),onBlur:He(e.onBlur,()=>b(!1))})})}),dg="RovingFocusGroupItem",ug=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,children:i,...l}=e,c=an(),u=a||c,p=W2(dg,n),f=p.currentTabStopId===u,m=ig(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:g}=p;return d.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),s.jsx(yl.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:s.jsx(ve.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:He(e.onMouseDown,w=>{r?p.onItemFocus(u):w.preventDefault()}),onFocus:He(e.onFocus,()=>p.onItemFocus(u)),onKeyDown:He(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){p.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const v=K2(w,p.orientation,p.dir);if(v!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let y=m().filter(C=>C.focusable).map(C=>C.ref.current);if(v==="last")y.reverse();else if(v==="prev"||v==="next"){v==="prev"&&y.reverse();const C=y.indexOf(w.currentTarget);y=p.loop?q2(y,C+1):y.slice(C+1)}setTimeout(()=>fg(y))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:g!=null}):i})})});ug.displayName=dg;var G2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Y2(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function K2(e,t,n){const r=Y2(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return G2[r]}function fg(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function q2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var X2=cg,Z2=ug,Cl=["Enter"," "],J2=["ArrowDown","PageUp","Home"],pg=["ArrowUp","PageDown","End"],Q2=[...J2,...pg],eN={ltr:[...Cl,"ArrowRight"],rtl:[...Cl,"ArrowLeft"]},tN={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ts="Menu",[es,nN,rN]=Za(Ts),[Gr,mg]=cn(Ts,[rN,Jh,lg]),oi=Jh(),hg=lg(),[oN,Yr]=Gr(Ts),[sN,_s]=Gr(Ts),gg=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:a,modal:i=!0}=e,l=oi(t),[c,u]=d.useState(null),p=d.useRef(!1),f=It(a),m=bs(o);return d.useEffect(()=>{const h=()=>{p.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>p.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),s.jsx(M2,{...l,children:s.jsx(oN,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:s.jsx(sN,{scope:t,onClose:d.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:p,dir:m,modal:i,children:r})})})};gg.displayName=Ts;var aN="MenuAnchor",Hc=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=oi(n);return s.jsx(P2,{...o,...r,ref:t})});Hc.displayName=aN;var Wc="MenuPortal",[iN,xg]=Gr(Wc,{forceMount:void 0}),vg=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,a=Yr(Wc,t);return s.jsx(iN,{scope:t,forceMount:n,children:s.jsx(As,{present:n||a.open,children:s.jsx(jo,{asChild:!0,container:o,children:r})})})};vg.displayName=Wc;var Cn="MenuContent",[lN,Vc]=Gr(Cn),wg=d.forwardRef((e,t)=>{const n=xg(Cn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,a=Yr(Cn,e.__scopeMenu),i=_s(Cn,e.__scopeMenu);return s.jsx(es.Provider,{scope:e.__scopeMenu,children:s.jsx(As,{present:r||a.open,children:s.jsx(es.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(cN,{...o,ref:t}):s.jsx(dN,{...o,ref:t})})})})}),cN=d.forwardRef((e,t)=>{const n=Yr(Cn,e.__scopeMenu),r=d.useRef(null),o=Te(t,r);return d.useEffect(()=>{const a=r.current;if(a)return Wa(a)},[]),s.jsx(Gc,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:He(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dN=d.forwardRef((e,t)=>{const n=Yr(Cn,e.__scopeMenu);return s.jsx(Gc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),uN=Cr("MenuContent.ScrollLock"),Gc=d.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:m,onDismiss:h,disableOutsideScroll:x,...g}=e,w=Yr(Cn,n),v=_s(Cn,n),b=oi(n),y=hg(n),C=nN(n),[k,E]=d.useState(null),S=d.useRef(null),N=Te(t,S,w.onContentChange),L=d.useRef(0),$=d.useRef(""),D=d.useRef(0),M=d.useRef(null),R=d.useRef("right"),F=d.useRef(0),z=x?ws:d.Fragment,A=x?{as:uN,allowPinchZoom:!0}:void 0,G=_=>{var I,K;const O=$.current+_,H=C().filter(Z=>!Z.disabled),Q=document.activeElement,W=(I=H.find(Z=>Z.ref.current===Q))==null?void 0:I.textValue,U=H.map(Z=>Z.textValue),Y=EN(U,O,W),P=(K=H.find(Z=>Z.textValue===Y))==null?void 0:K.ref.current;(function Z(J){$.current=J,window.clearTimeout(L.current),J!==""&&(L.current=window.setTimeout(()=>Z(""),1e3))})(O),P&&setTimeout(()=>P.focus())};d.useEffect(()=>()=>window.clearTimeout(L.current),[]),j2();const j=d.useCallback(_=>{var H,Q;return R.current===((H=M.current)==null?void 0:H.side)&&NN(_,(Q=M.current)==null?void 0:Q.area)},[]);return s.jsx(lN,{scope:n,searchRef:$,onItemEnter:d.useCallback(_=>{j(_)&&_.preventDefault()},[j]),onItemLeave:d.useCallback(_=>{var O;j(_)||((O=S.current)==null||O.focus(),E(null))},[j]),onTriggerLeave:d.useCallback(_=>{j(_)&&_.preventDefault()},[j]),pointerGraceTimerRef:D,onPointerGraceIntentChange:d.useCallback(_=>{M.current=_},[]),children:s.jsx(z,{...A,children:s.jsx(vs,{asChild:!0,trapped:o,onMountAutoFocus:He(a,_=>{var O;_.preventDefault(),(O=S.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(qh,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:m,onDismiss:h,children:s.jsx(X2,{asChild:!0,...y,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:E,onEntryFocus:He(c,_=>{v.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(D2,{role:"menu","aria-orientation":"vertical","data-state":Dg(w.open),"data-radix-menu-content":"",dir:v.dir,...b,...g,ref:N,style:{outline:"none",...g.style},onKeyDown:He(g.onKeyDown,_=>{const H=_.target.closest("[data-radix-menu-content]")===_.currentTarget,Q=_.ctrlKey||_.altKey||_.metaKey,W=_.key.length===1;H&&(_.key==="Tab"&&_.preventDefault(),!Q&&W&&G(_.key));const U=S.current;if(_.target!==U||!Q2.includes(_.key))return;_.preventDefault();const P=C().filter(I=>!I.disabled).map(I=>I.ref.current);pg.includes(_.key)&&P.reverse(),yN(P)}),onBlur:He(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout(L.current),$.current="")}),onPointerMove:He(e.onPointerMove,ts(_=>{const O=_.target,H=F.current!==_.clientX;if(_.currentTarget.contains(O)&&H){const Q=_.clientX>F.current?"right":"left";R.current=Q,F.current=_.clientX}}))})})})})})})});wg.displayName=Cn;var fN="MenuGroup",Yc=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ve.div,{role:"group",...r,ref:t})});Yc.displayName=fN;var pN="MenuLabel",bg=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ve.div,{...r,ref:t})});bg.displayName=pN;var va="MenuItem",xu="menu.itemSelect",si=d.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,a=d.useRef(null),i=_s(va,e.__scopeMenu),l=Vc(va,e.__scopeMenu),c=Te(t,a),u=d.useRef(!1),p=()=>{const f=a.current;if(!n&&f){const m=new CustomEvent(xu,{bubbles:!0,cancelable:!0});f.addEventListener(xu,h=>r==null?void 0:r(h),{once:!0}),Da(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return s.jsx(yg,{...o,ref:c,disabled:n,onClick:He(e.onClick,p),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:He(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:He(e.onKeyDown,f=>{const m=l.searchRef.current!=="";n||m&&f.key===" "||Cl.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});si.displayName=va;var yg=d.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...a}=e,i=Vc(va,n),l=hg(n),c=d.useRef(null),u=Te(t,c),[p,f]=d.useState(!1),[m,h]=d.useState("");return d.useEffect(()=>{const x=c.current;x&&h((x.textContent??"").trim())},[a.children]),s.jsx(es.ItemSlot,{scope:n,disabled:r,textValue:o??m,children:s.jsx(Z2,{asChild:!0,...l,focusable:!r,children:s.jsx(ve.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:u,onPointerMove:He(e.onPointerMove,ts(x=>{r?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:He(e.onPointerLeave,ts(x=>i.onItemLeave(x))),onFocus:He(e.onFocus,()=>f(!0)),onBlur:He(e.onBlur,()=>f(!1))})})})}),mN="MenuCheckboxItem",Cg=d.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return s.jsx(Ag,{scope:e.__scopeMenu,checked:n,children:s.jsx(si,{role:"menuitemcheckbox","aria-checked":wa(n)?"mixed":n,...o,ref:t,"data-state":qc(n),onSelect:He(o.onSelect,()=>r==null?void 0:r(wa(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Cg.displayName=mN;var Eg="MenuRadioGroup",[hN,gN]=Gr(Eg,{value:void 0,onValueChange:()=>{}}),Sg=d.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,a=It(r);return s.jsx(hN,{scope:e.__scopeMenu,value:n,onValueChange:a,children:s.jsx(Yc,{...o,ref:t})})});Sg.displayName=Eg;var Ng="MenuRadioItem",jg=d.forwardRef((e,t)=>{const{value:n,...r}=e,o=gN(Ng,e.__scopeMenu),a=n===o.value;return s.jsx(Ag,{scope:e.__scopeMenu,checked:a,children:s.jsx(si,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":qc(a),onSelect:He(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});jg.displayName=Ng;var Kc="MenuItemIndicator",[Ag,xN]=Gr(Kc,{checked:!1}),kg=d.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,a=xN(Kc,n);return s.jsx(As,{present:r||wa(a.checked)||a.checked===!0,children:s.jsx(ve.span,{...o,ref:t,"data-state":qc(a.checked)})})});kg.displayName=Kc;var vN="MenuSeparator",Tg=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ve.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Tg.displayName=vN;var wN="MenuArrow",_g=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=oi(n);return s.jsx(L2,{...o,...r,ref:t})});_g.displayName=wN;var bN="MenuSub",[i3,Ig]=Gr(bN),Ho="MenuSubTrigger",Rg=d.forwardRef((e,t)=>{const n=Yr(Ho,e.__scopeMenu),r=_s(Ho,e.__scopeMenu),o=Ig(Ho,e.__scopeMenu),a=Vc(Ho,e.__scopeMenu),i=d.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},p=d.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return d.useEffect(()=>p,[p]),d.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),s.jsx(Hc,{asChild:!0,...u,children:s.jsx(yg,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Dg(n.open),...e,ref:Ma(t,o.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:He(e.onPointerMove,ts(f=>{a.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(a.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:He(e.onPointerLeave,ts(f=>{var h,x;p();const m=(h=n.content)==null?void 0:h.getBoundingClientRect();if(m){const g=(x=n.content)==null?void 0:x.dataset.side,w=g==="right",v=w?-5:5,b=m[w?"left":"right"],y=m[w?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:b,y:m.top},{x:y,y:m.top},{x:y,y:m.bottom},{x:b,y:m.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:He(e.onKeyDown,f=>{var h;const m=a.searchRef.current!=="";e.disabled||m&&f.key===" "||eN[r.dir].includes(f.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),f.preventDefault())})})})});Rg.displayName=Ho;var Mg="MenuSubContent",Pg=d.forwardRef((e,t)=>{const n=xg(Cn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,a=Yr(Cn,e.__scopeMenu),i=_s(Cn,e.__scopeMenu),l=Ig(Mg,e.__scopeMenu),c=d.useRef(null),u=Te(t,c);return s.jsx(es.Provider,{scope:e.__scopeMenu,children:s.jsx(As,{present:r||a.open,children:s.jsx(es.Slot,{scope:e.__scopeMenu,children:s.jsx(Gc,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:He(e.onFocusOutside,p=>{p.target!==l.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:He(e.onEscapeKeyDown,p=>{i.onClose(),p.preventDefault()}),onKeyDown:He(e.onKeyDown,p=>{var h;const f=p.currentTarget.contains(p.target),m=tN[i.dir].includes(p.key);f&&m&&(a.onOpenChange(!1),(h=l.trigger)==null||h.focus(),p.preventDefault())})})})})})});Pg.displayName=Mg;function Dg(e){return e?"open":"closed"}function wa(e){return e==="indeterminate"}function qc(e){return wa(e)?"indeterminate":e?"checked":"unchecked"}function yN(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function CN(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function EN(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let i=CN(e,Math.max(a,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function SN(e,t){const{x:n,y:r}=e;let o=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const l=t[a],c=t[i],u=l.x,p=l.y,f=c.x,m=c.y;p>r!=m>r&&n<(f-u)*(r-p)/(m-p)+u&&(o=!o)}return o}function NN(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return SN(n,t)}function ts(e){return t=>t.pointerType==="mouse"?e(t):void 0}var jN=gg,AN=Hc,kN=vg,TN=wg,_N=Yc,IN=bg,RN=si,MN=Cg,PN=Sg,DN=jg,LN=kg,ON=Tg,$N=_g,FN=Rg,zN=Pg,ai="DropdownMenu",[UN,l3]=cn(ai,[mg]),Wt=mg(),[BN,Lg]=UN(ai),Og=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:a,onOpenChange:i,modal:l=!0}=e,c=Wt(t),u=d.useRef(null),[p,f]=lr({prop:o,defaultProp:a??!1,onChange:i,caller:ai});return s.jsx(BN,{scope:t,triggerId:an(),triggerRef:u,contentId:an(),open:p,onOpenChange:f,onOpenToggle:d.useCallback(()=>f(m=>!m),[f]),modal:l,children:s.jsx(jN,{...c,open:p,onOpenChange:f,dir:r,modal:l,children:n})})};Og.displayName=ai;var $g="DropdownMenuTrigger",Fg=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,a=Lg($g,n),i=Wt(n);return s.jsx(AN,{asChild:!0,...i,children:s.jsx(ve.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Ma(t,a.triggerRef),onPointerDown:xa(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(a.onOpenToggle(),a.open||l.preventDefault())}),onKeyDown:xa(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&a.onOpenToggle(),l.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Fg.displayName=$g;var HN="DropdownMenuPortal",zg=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Wt(t);return s.jsx(kN,{...r,...n})};zg.displayName=HN;var Ug="DropdownMenuContent",Bg=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Lg(Ug,n),a=Wt(n),i=d.useRef(!1);return s.jsx(TN,{id:o.contentId,"aria-labelledby":o.triggerId,...a,...r,ref:t,onCloseAutoFocus:xa(e.onCloseAutoFocus,l=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:xa(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,p=c.button===2||u;(!o.modal||p)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Bg.displayName=Ug;var WN="DropdownMenuGroup",VN=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(_N,{...o,...r,ref:t})});VN.displayName=WN;var GN="DropdownMenuLabel",YN=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(IN,{...o,...r,ref:t})});YN.displayName=GN;var KN="DropdownMenuItem",Hg=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(RN,{...o,...r,ref:t})});Hg.displayName=KN;var qN="DropdownMenuCheckboxItem",XN=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(MN,{...o,...r,ref:t})});XN.displayName=qN;var ZN="DropdownMenuRadioGroup",JN=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(PN,{...o,...r,ref:t})});JN.displayName=ZN;var QN="DropdownMenuRadioItem",ej=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(DN,{...o,...r,ref:t})});ej.displayName=QN;var tj="DropdownMenuItemIndicator",nj=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(LN,{...o,...r,ref:t})});nj.displayName=tj;var rj="DropdownMenuSeparator",Wg=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(ON,{...o,...r,ref:t})});Wg.displayName=rj;var oj="DropdownMenuArrow",sj=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx($N,{...o,...r,ref:t})});sj.displayName=oj;var aj="DropdownMenuSubTrigger",ij=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(FN,{...o,...r,ref:t})});ij.displayName=aj;var lj="DropdownMenuSubContent",cj=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Wt(n);return s.jsx(zN,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cj.displayName=lj;var dj=Og,uj=Fg,fj=zg,pj=Bg,mj=Hg,hj=Wg;function Vg({...e}){return s.jsx(dj,{"data-slot":"dropdown-menu",...e})}function Gg({...e}){return s.jsx(uj,{"data-slot":"dropdown-menu-trigger",...e})}function Yg({className:e,sideOffset:t=4,...n}){return s.jsx(fj,{children:s.jsx(pj,{"data-slot":"dropdown-menu-content",sideOffset:t,className:me("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Wo({className:e,inset:t,variant:n="default",...r}){return s.jsx(mj,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:me("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function vu({className:e,...t}){return s.jsx(hj,{"data-slot":"dropdown-menu-separator",className:me("bg-border -mx-1 my-1 h-px",e),...t})}const Kg=d.forwardRef(({className:e,...t},n)=>s.jsx(Vr,{autoComplete:"off",ref:n,name:"message","data-testid":"chat-input",className:me("flex w-full items-center rounded-md px-4 py-3 placeholder:text-[var(--color-secondary-wMain)] disabled:cursor-not-allowed disabled:opacity-50",e),...t}));Kg.displayName="ChatInput";const gj=Ar("flex gap-2 max-w-full items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),qg=d.forwardRef(({className:e,variant:t,layout:n,children:r,...o},a)=>s.jsx("div",{className:me(gj({variant:t,layout:n,className:e}),"group relative"),ref:a,...o,children:d.Children.map(r,i=>d.isValidElement(i)&&typeof i.type!="string"?d.cloneElement(i,{variant:t,layout:n}):i)}));qg.displayName="ChatBubble";const xj=Ar("p-4",{variants:{variant:{received:"rounded-r-lg rounded-tl-lg",sent:"rounded-l-lg rounded-tr-lg justify-end bg-[var(--message-background)]"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),Xg=d.forwardRef(({className:e,variant:t,layout:n,children:r,...o},a)=>s.jsx("div",{className:me(xj({variant:t,layout:n,className:e}),"relative max-w-full break-words"),ref:a,...o,children:s.jsx(s.Fragment,{children:r})}));Xg.displayName="ChatBubbleMessage";const vj=d.forwardRef(({variant:e,className:t,children:n,...r},o)=>s.jsx("div",{ref:o,className:me("absolute top-1/2 flex -translate-y-1/2 opacity-0 transition-opacity duration-200 group-hover:opacity-100",e==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...r,children:n}));vj.displayName="ChatBubbleActionWrapper";const Zg={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},Jg=At.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:a,disableAutoScroll:i,scrollToBottom:l,userHasScrolled:c}=jj({smooth:!0,content:t});return d.useImperativeHandle(r,()=>({scrollToBottom:l})),s.jsxs("div",{className:`fade-both-mask relative h-full min-h-0 w-full flex-1 py-3 ${e}`,children:[s.jsx("div",{className:"flex h-full w-full flex-col overflow-y-auto p-4",ref:o,onWheel:i,onTouchMove:i,...n,style:{scrollBehavior:"smooth"},children:s.jsx("div",{className:"flex flex-col gap-6",style:Zg,children:t})}),!a&&c&&s.jsx(ne,{onClick:()=>{l()},size:"icon",variant:"outline",className:"bg-background absolute bottom-2 left-1/2 z-20 inline-flex -translate-x-1/2 transform rounded-full shadow-md","aria-label":"Scroll to bottom",children:s.jsx(rf,{className:"h-4 w-4"})})]})});Jg.displayName="ChatMessageList";function wj({className:e=""}){return s.jsx(cr,{size:"small",variant:"primary",className:e})}const Ws={error:"bg-[var(--color-error-w10)] text-[var(--color-error-wMain)] border-[var(--color-error-wMain)] dark:bg-[var(--color-error-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-error-w10)]",warning:"bg-[var(--color-warning-w10)] text-[var(--color-warning-wMain)] border-[var(--color-warning-wMain)] dark:bg-[var(--color-warning-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-warning-w10)]",info:"bg-[var(--color-info-w10)] text-[var(--color-info-wMain)] border-[var(--color-info-w10)] dark:bg-[var(--color-info-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-info-w10)]",success:"bg-[var(--color-success-w10)] text-[var(--color-success-wMain)] border-[var(--color-success-w10)] dark:bg-[var(--color-success-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-success-wMain)]"},bj=Ar("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent [a&]:hover:bg-primary/90",secondary:"border-transparent [a&]:hover:bg-secondary/90",destructive:"border-transparent [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"},type:{error:Ws.error,warning:Ws.warning,info:Ws.info,success:Ws.success}},defaultVariants:{variant:"default"}});function Kr({className:e,variant:t,type:n,asChild:r=!1,...o}){const a=r?_f:"span";return s.jsx(a,{"data-slot":"badge",className:me(bj({variant:t,type:n}),e),...o})}const yj=Ar("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Cj({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:me(yj({variant:t}),e),...n})}function Ej({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:me("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Sj({message:e,type:t}){return s.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:s.jsx(Cj,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:s.jsxs(Ej,{className:"flex items-center text-sm",children:[t==="error"&&s.jsx(cs,{className:"mr-2 text-[var(--color-error-wMain)]"}),s.jsx("div",{className:"truncate",children:e})]})})})}function Nj(){const{notifications:e}=qe();return e.length===0?null:s.jsx("div",{className:"pointer-events-none fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 transform flex-col-reverse gap-2",children:e.map(t=>s.jsx("div",{className:"pointer-events-auto",children:s.jsx(Sj,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function jj(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,a=d.useRef(null),i=d.useRef(0),l=d.useRef(!1),[c,u]=d.useState({isAtBottom:!0,autoScrollEnabled:!0}),p=d.useCallback(x=>{const{scrollTop:g,scrollHeight:w,clientHeight:v}=x;return Math.abs(w-g-v)<=t},[t]),f=d.useCallback(x=>{if(!a.current)return;const g=a.current.scrollHeight-a.current.clientHeight;x?a.current.scrollTop=g:a.current.scrollTo({top:g,behavior:n?"smooth":"auto"}),u({isAtBottom:!0,autoScrollEnabled:!0}),l.current=!1},[n]),m=d.useCallback(()=>{if(!a.current)return;const x=p(a.current);u(g=>({isAtBottom:x,autoScrollEnabled:x?!0:g.autoScrollEnabled}))},[p]);d.useEffect(()=>{const x=a.current;if(x)return x.addEventListener("scroll",m,{passive:!0}),()=>x.removeEventListener("scroll",m)},[m]),d.useEffect(()=>{const x=a.current;if(!x)return;const g=x.scrollHeight;g!==i.current&&((c.autoScrollEnabled||o)&&requestAnimationFrame(()=>{f(i.current===0)}),i.current=g)},[r,c.autoScrollEnabled,f,o]),d.useEffect(()=>{const x=a.current;if(!x)return;const g=new ResizeObserver(()=>{c.autoScrollEnabled&&f(!0)});return g.observe(x),()=>g.disconnect()},[c.autoScrollEnabled,f]);const h=d.useCallback(()=>{(a.current?p(a.current):!1)||(l.current=!0,u(g=>({...g,autoScrollEnabled:!1})))},[p]);return{scrollRef:a,isAtBottom:c.isAtBottom,autoScrollEnabled:c.autoScrollEnabled,scrollToBottom:()=>f(),disableAutoScroll:h,userHasScrolled:l.current}}const Aj=({fileName:e,onRemove:t})=>s.jsxs(Kr,{className:"bg-muted max-w-50 gap-1.5 rounded-full pr-1",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-xs md:text-sm",title:e,children:e}),t&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:t,className:"h-2 min-h-0 w-2 min-w-0 p-2",title:"Remove file",children:s.jsx(ls,{})})]}),kj=({agents:e=[],scrollToBottom:t})=>{const{isResponding:n,isCancelling:r,selectedAgentName:o,sessionId:a,handleSubmit:i,handleCancel:l}=qe(),{handleAgentSelection:c}=PE(),u=d.useRef(null),[p,f]=d.useState([]),m=d.useRef(null),h=d.useRef(n),[x,g]=d.useState("");d.useEffect(()=>{g("")},[a]),d.useEffect(()=>{h.current&&!n&&setTimeout(()=>{var M;(M=m.current)==null||M.focus()},100),h.current=n},[n]),d.useEffect(()=>{const M=()=>{setTimeout(()=>{var R;(R=m.current)==null||R.focus()},100)};return window.addEventListener("focus-chat-input",M),()=>{window.removeEventListener("focus-chat-input",M)}},[]);const w=()=>{var M;n||(M=u.current)==null||M.click()},v=M=>{const R=M.target.files;if(R){const F=Array.from(R).filter(z=>!p.some(A=>A.name===z.name&&A.size===z.size&&A.lastModified===z.lastModified));F.length>0&&f(z=>[...z,...F])}M.target&&(M.target.value=""),setTimeout(()=>{var F;(F=m.current)==null||F.focus()},100)},b=M=>{if(n)return;const R=M.clipboardData;if(!R||!R.files||R.files.length===0)return;R.files.length>0&&M.preventDefault();const F=Array.from(R.files).filter(z=>!p.some(A=>A.name===z.name&&A.size===z.size&&A.lastModified===z.lastModified));F.length>0&&f(z=>[...z,...F])},y=M=>{f(R=>R.filter((F,z)=>z!==M))},C=d.useMemo(()=>!n&&((x==null?void 0:x.trim())||p.length!==0),[n,x,p]),k=async M=>{M.preventDefault(),C&&(await i(M,p,x.trim()),f([]),g(""),t==null||t())},E=M=>{if(n)return;const R=M.filter(F=>!p.some(z=>z.name===F.name&&z.size===F.size&&z.lastModified===F.lastModified));R.length>0&&f(F=>[...F,...R])},{isDragging:S,handleDragEnter:N,handleDragOver:L,handleDragLeave:$,handleDrop:D}=RE({onFilesDropped:E,disabled:n});return s.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${S?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:N,onDragOver:L,onDragLeave:$,onDrop:D,children:[s.jsx("input",{type:"file",ref:u,className:"hidden",multiple:!0,onChange:v,accept:"*/*",disabled:n}),p.length>0&&s.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:p.map((M,R)=>s.jsx(Aj,{fileName:M.name,onRemove:()=>y(R)},`${M.name}-${M.lastModified}-${R}`))}),s.jsx(Kg,{ref:m,value:x,onChange:M=>g(M.target.value),placeholder:"How can I help you today?",className:"field-sizing-content max-h-50 min-h-0 resize-none rounded-2xl border-none p-3 text-base/normal shadow-none transition-[height] duration-500 ease-in-out focus-visible:outline-none",rows:1,onPaste:b,onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&C&&k(M)}}),s.jsxs("div",{className:"m-2 flex items-center gap-2",children:[s.jsx(ne,{variant:"ghost",onClick:w,disabled:n,tooltip:"Attach file",children:s.jsx(of,{className:"size-4"})}),s.jsx("div",{children:"Agent: "}),s.jsxs(Cs,{value:o,onValueChange:c,disabled:n||e.length===0,children:[s.jsx(Ss,{className:"w-[250px]",children:s.jsx(Es,{placeholder:"Select an agent..."})}),s.jsx(Ns,{children:e.map(M=>s.jsx(Nr,{value:M.name,children:M.displayName||M.name},M.name))})]}),n&&!r?s.jsxs(ne,{"data-testid":"cancel",className:"ml-auto gap-1.5",onClick:l,variant:"outline",disabled:r,tooltip:"Cancel",children:[s.jsx(mv,{className:"size-4"}),"Stop"]}):s.jsx(ne,{"data-testid":"sendMessage",variant:"ghost",className:"ml-auto gap-1.5",onClick:k,disabled:!C,tooltip:"Send message",children:s.jsx(hv,{className:"size-4"})})]})]})};let Vs=null,Gs=null;function Tj({children:e}){const{fetchCsrfToken:t}=Lm(),[n,r]=d.useState(Vs),[o,a]=d.useState(!Vs&&!Gs),[i,l]=d.useState(Gs);return d.useEffect(()=>{if(Vs||Gs)return;let c=!0;return(async()=>{var p;a(!0),l(null);try{let f=await je("/api/v1/config",{credentials:"include",headers:{Accept:"application/json"}}),m;if(f.ok)m=await f.json();else{const w=await f.text();if(console.error("Initial config fetch failed:",f.status,w),f.status===403){console.log("Config fetch failed with 403, attempting to get CSRF token first...");const v=await t();if(!v)throw new Error("Failed to obtain CSRF token after config fetch failed.");if(console.log("Retrying config fetch with CSRF token..."),f=await je("/api/v1/config",{credentials:"include",headers:{"X-CSRF-TOKEN":v,Accept:"application/json"}}),!f.ok){const b=await f.text();throw console.error("Config fetch retry failed:",f.status,b),new Error(`Failed to fetch config on retry: ${f.status} ${b}`)}m=await f.json()}else throw new Error(`Failed to fetch config: ${f.status} ${w}`)}const h=m.frontend_use_authorization??!1;h&&(console.log("Fetching CSRF token for config-related requests..."),await t());const x=((p=m.frontend_feature_enablement)==null?void 0:p.projects)??!1,g={configServerUrl:m.frontend_server_url,configAuthLoginUrl:m.frontend_auth_login_url,configUseAuthorization:h,configWelcomeMessage:m.frontend_welcome_message,configRedirectUrl:m.frontend_redirect_url,configCollectFeedback:m.frontend_collect_feedback,configBotName:m.frontend_bot_name,configFeatureEnablement:m.frontend_feature_enablement??{},frontend_use_authorization:m.frontend_use_authorization,persistenceEnabled:m.persistence_enabled??!1,projectsEnabled:x,validationLimits:m.validation_limits};c&&(Vs=g,r(g)),console.log("App config processed and set:",g)}catch(f){if(console.error("Error initializing app:",f),c){const m=f.message||"Failed to load application configuration.";Gs=m,l(m)}}finally{c&&a(!1)}})(),()=>{c=!1}},[t]),n?s.jsx(jm.Provider,{value:n,children:e}):o?s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),s.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Loading Configuration..."})]})}):i?s.jsx(ns,{className:"h-screen w-screen",variant:"error",title:"Configuration Error",subtitle:"Please check the backend server and network connection, then refresh the page."}):s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),s.jsx("h1",{className:"text-2xl",children:"Initializing Application..."})]})})}const _j=({children:e})=>{const{configServerUrl:t}=Rt(),n=`${t}/api/v1`,[r,o]=d.useState(null),[a,i]=d.useState(!1),[l,c]=d.useState(!1),[u,p]=d.useState(null),[f,m]=d.useState({}),[h,x]=d.useState([]),[g,w]=d.useState(null),[v,b]=d.useState(0),[y,C]=d.useState(!1),k=10,E=d.useRef(null),S=d.useRef(null),N=d.useRef(null);d.useEffect(()=>{S.current=r},[r]);const L=d.useCallback(j=>{m(_=>{var W,U,Y;const O=j.task_id;if(!O)return j.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",j),_;const H=_[O],Q=new Date(j.timestamp);if(H){const P=[...H.events,j].sort((I,K)=>new Date(I.timestamp).getTime()-new Date(K.timestamp).getTime());return{..._,[O]:{...H,events:P,lastUpdated:Q}}}else{let P="Task started...";if(j.direction==="request"&&((U=(W=j.full_payload)==null?void 0:W.method)!=null&&U.startsWith("message/"))){const K=j.full_payload.params;if((Y=K==null?void 0:K.message)!=null&&Y.parts){const Z=K.message.parts.filter(J=>J.kind==="text"&&J.text);Z.length>0&&(P=Z[Z.length-1].text)}}const I={taskId:O,initialRequestText:P,events:[j],firstSeen:Q,lastUpdated:Q};return x(K=>[O,...K.filter(Z=>Z!==O)]),{..._,[O]:I}}})},[]),$=d.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),i(!1),c(!0),p(null),b(0),C(!1),N.current&&(clearTimeout(N.current),N.current=null)},[]),D=d.useCallback(j=>{try{const _=JSON.parse(j.data);L(_)}catch(_){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",_,"Raw data:",j.data),p("Received unparseable 'a2a_message' event from server.")}},[L]),M=d.useCallback(j=>{console.error("TaskMonitorContext: SSE connection error:",j),i(!1),c(!1),E.current&&E.current.readyState===EventSource.CLOSED?p("Task Monitor SSE connection closed by server or network issue."):p("Task Monitor SSE connection error occurred."),E.current&&(E.current.close(),E.current=null),N.current&&(clearTimeout(N.current),N.current=null)},[]),R=d.useCallback(async()=>{if(l||a){console.warn("TaskMonitorContext: Stream is already active or connecting.");return}console.log("TaskMonitorContext: Attempting to connect stream..."),i(!0);try{const j={subscription_targets:[{type:"my_a2a_messages"}]},_=await je(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),credentials:"include"});if(!_.ok){const Y=await _.json().catch(()=>({detail:"Failed to subscribe"}));if(Y.error_type==="authorization_failure"){const P=Y.message||"Access denied: insufficient permissions",I=Y.suggested_action?` ${Y.suggested_action}`:"";throw new Error(`${P}${I}`)}else if(Y.error_type==="subscription_failure"){const P=Y.message||"Subscription failed",I=Y.suggested_action?` ${Y.suggested_action}`:"";throw new Error(`${P}${I}`)}else throw new Error(Y.detail||Y.message||`Subscription failed: ${_.statusText}`)}const O=await _.json();o(O.stream_id);const H=O.sse_endpoint_url.startsWith("/")?`${t||""}${O.sse_endpoint_url}`:O.sse_endpoint_url;E.current&&E.current.close();const Q=Yl(),W=`${H}${Q?`?token=${Q}`:""}`,U=new EventSource(W,{withCredentials:!0});E.current=U,U.onopen=$,U.addEventListener("a2a_message",D),U.onerror=M}catch(j){console.error("TaskMonitorContext: Error connecting stream:",j),p(j instanceof Error?j.message:String(j)),i(!1),c(!1),o(null),E.current&&(E.current.close(),E.current=null),N.current&&(clearTimeout(N.current),N.current=null)}},[n,t,l,a,$,D,M]),F=d.useCallback(()=>{if(N.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(v>=k){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),C(!1),p(`Connection lost. Max reconnection attempts (${k}) reached.`);return}const j=2e3;console.log(`TaskMonitorContext: Attempting reconnection ${v+1}/${k} in ${j}ms...`),C(!0),b(_=>_+1),N.current=setTimeout(()=>{R()},j)},[v,R]),z=d.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),N.current&&(clearTimeout(N.current),N.current=null),E.current&&(E.current.close(),E.current=null);const j=S.current;if(j)try{await je(`${n}/visualization/${j}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(_){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${j}`,_)}o(null),i(!1),c(!1),p(null),m({}),x([]),w(null),b(0),C(!1)},[n]);d.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),E.current&&(E.current.close(),E.current=null);const j=S.current;if(j)if(navigator.sendBeacon){const _=new FormData;navigator.sendBeacon(`${n}/visualization/${j}/unsubscribe`,_)}else je(`${n}/visualization/${j}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(_=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",_))},[n]),d.useEffect(()=>{!l&&!a&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),R())},[]),d.useEffect(()=>{!l&&!a&&u&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),F())},[l,a,u,F]),d.useEffect(()=>()=>{N.current&&(clearTimeout(N.current),N.current=null)},[]);const A=d.useCallback(j=>{w(j)},[]),G={isTaskMonitorConnecting:a,isTaskMonitorConnected:l,taskMonitorSseError:u,monitoredTasks:f,monitoredTaskOrder:h,highlightedStepId:g,isReconnecting:y,reconnectionAttempts:v,connectTaskMonitorStream:R,disconnectTaskMonitorStream:z,setHighlightedStepId:A};return s.jsx(km.Provider,{value:G,children:e})},jt=[];for(let e=0;e<256;++e)jt.push((e+256).toString(16).slice(1));function Ij(e,t=0){return(jt[e[t+0]]+jt[e[t+1]]+jt[e[t+2]]+jt[e[t+3]]+"-"+jt[e[t+4]]+jt[e[t+5]]+"-"+jt[e[t+6]]+jt[e[t+7]]+"-"+jt[e[t+8]]+jt[e[t+9]]+"-"+jt[e[t+10]]+jt[e[t+11]]+jt[e[t+12]]+jt[e[t+13]]+jt[e[t+14]]+jt[e[t+15]]).toLowerCase()}let Li;const Rj=new Uint8Array(16);function Mj(){if(!Li){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Li=crypto.getRandomValues.bind(crypto)}return Li(Rj)}const Pj=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wu={randomUUID:Pj};function Dj(e,t,n){var o;e=e||{};const r=e.random??((o=e.rng)==null?void 0:o.call(e))??Mj();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ij(r)}function Lj(e,t,n){return wu.randomUUID&&!e?wu.randomUUID():Dj(e)}const Ys=1,Oj=e=>({...e,taskMetadata:{...e.taskMetadata,schema_version:1}}),$j={0:Oj},Fj=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n,persistenceEnabled:r,configCollectFeedback:o}=Rt(),a=d.useMemo(()=>`${n}/api/v1`,[n]),{activeProject:i,setActiveProject:l,projects:c}=pr(),u=1*1024*1024,p=B=>new Promise((V,X)=>{const ee=new FileReader;ee.readAsDataURL(B),ee.onload=()=>V(ee.result.split(",")[1]),ee.onerror=fe=>X(fe)}),[f,m]=d.useState(""),[h,x]=d.useState([]),[g,w]=d.useState(!1),[v,b]=d.useState([]),[y,C]=d.useState(null),k=d.useRef(null),[E,S]=d.useState(""),[N,L]=d.useState(!1),$=d.useRef(N),D=d.useRef(new Set),M=d.useRef(new Set),R=d.useRef(new Set);d.useEffect(()=>{$.current=N},[N]);const[F,z]=d.useState(null),A=d.useRef(null),G=d.useRef(!1),j=d.useRef(null),_=d.useRef(0),{agents:O,error:H,isLoading:Q,refetch:W}=_c(),{artifacts:U,isLoading:Y,refetch:P,setArtifacts:I}=AE(f),[K,Z]=d.useState(!0),[J,oe]=d.useState("files"),[re,ie]=d.useState(!1),[te,ue]=d.useState(null),[De,Re]=d.useState(!1),[Ae,Le]=d.useState(new Set),[Nt,tt]=d.useState(!1),[bt,Lt]=d.useState(null),[ft,pt]=d.useState(null),[at,Jt]=d.useState(null),[Fn,Gt]=d.useState(null),Ot=d.useMemo(()=>bt&&U.find(B=>B.filename===bt)||null,[U,bt]),[hn,Qt]=d.useState({expandedArtifacts:new Set}),[gn,yt]=d.useState({}),le=d.useCallback((B,V)=>{b(X=>{if(X.find(be=>be.message===B))return X;const fe=Date.now().toString(),xe={id:fe,message:B,type:V||"info"};return setTimeout(()=>{b(be=>be.filter(Ze=>Ze.id!==fe))},3e3),[...X,xe]})},[]),Yt=d.useCallback(B=>{var ee,fe,xe;const V=(ee=B.parts)==null?void 0:ee.filter(be=>be.kind==="text"),X=(V==null?void 0:V.map(be=>be.text).join(""))||"";return{id:((fe=B.metadata)==null?void 0:fe.messageId)||`msg-${crypto.randomUUID()}`,type:B.isUser?"user":"agent",text:X,parts:B.parts,uploadedFiles:(xe=B.uploadedFiles)==null?void 0:xe.map(be=>({name:be.name,type:be.type})),isError:B.isError}},[]),Kt=d.useCallback(async B=>{if(!(!r||!f)&&!D.current.has(B.task_id)){D.current.add(B.task_id);try{const V=await je(`${a}/sessions/${f}/chat-tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:B.task_id,userMessage:B.user_message,messageBubbles:JSON.stringify(B.message_bubbles),taskMetadata:B.task_metadata?JSON.stringify(B.task_metadata):null})});if(!V.ok){const X=await V.json().catch(()=>({detail:"Failed to save task"}));throw new Error(X.detail||`HTTP error ${V.status}`)}}catch(V){console.error(`Error saving task ${B.task_id}:`,V)}finally{setTimeout(()=>{D.current.delete(B.task_id)},100)}}},[a,f,r]),zn=d.useCallback(B=>B.messageBubbles.map(V=>({taskId:B.taskId,role:V.type==="user"?"user":"agent",parts:V.parts||[{kind:"text",text:V.text||""}],isUser:V.type==="user",isComplete:!0,files:V.files,uploadedFiles:V.uploadedFiles,artifactNotification:V.artifactNotification,isError:V.isError,metadata:{messageId:V.id,sessionId:f,lastProcessedEventSequence:0}})),[f]),en=d.useCallback(B=>{var ee;const V=((ee=B.taskMetadata)==null?void 0:ee.schema_version)||0;if(V>=Ys)return B;let X=B;for(let fe=V;fe<Ys;fe++){const xe=$j[fe];xe?(X=xe(X),console.log(`Migrated task ${B.taskId} from v${fe} to v${fe+1}`)):console.warn(`No migration function found for version ${fe}`)}return X},[]),tn=d.useCallback(async B=>{var V,X;try{const ee=await je(`${a}/sessions/${B}/chat-tasks`);if(!ee.ok){const ke=await ee.json().catch(()=>({detail:"Failed to load session tasks"}));throw new Error(ke.detail||`HTTP error ${ee.status}`)}const Ze=((await ee.json()).tasks||[]).map(ke=>({...ke,messageBubbles:JSON.parse(ke.messageBubbles),taskMetadata:ke.taskMetadata?JSON.parse(ke.taskMetadata):null})).map(en),ct=[];for(const ke of Ze){const Ue=zn(ke);ct.push(...Ue)}const nt={};for(const ke of Ze)(V=ke.taskMetadata)!=null&&V.feedback&&(nt[ke.taskId]={type:ke.taskMetadata.feedback.type,text:ke.taskMetadata.feedback.text||""});let rt=null;for(let ke=Ze.length-1;ke>=0;ke--)if((X=Ze[ke].taskMetadata)!=null&&X.agent_name){rt=Ze[ke].taskMetadata.agent_name;break}x(ct),yt(nt),rt&&S(rt)}catch(ee){throw console.error("Error loading session tasks:",ee),le("Error loading session history. Please try again.","error"),ee}},[a,zn,le,en]),Nn=d.useCallback(async(B,V)=>{const X=V||f,ee=new FormData;ee.append("file",B);try{const fe=await je(`${a}/artifacts/${X}/${encodeURIComponent(B.name)}`,{method:"POST",body:ee,credentials:"include"});if(!fe.ok){const be=await fe.json().catch(()=>({detail:`Failed to upload ${B.name}`}));throw new Error(be.detail||`HTTP error ${fe.status}`)}const xe=await fe.json();return le(`Artifact "${B.name}" uploaded successfully.`),await P(),xe.uri?{uri:xe.uri,sessionId:X}:null}catch(fe){return le(`Error uploading artifact "${B.name}": ${fe instanceof Error?fe.message:"Unknown error"}`),null}},[a,f,le,P]),[nn,xn]=d.useState(null),[vn,Ve]=d.useState(null),[Mt,Un]=d.useState(!1),jn=d.useCallback(async B=>{try{const V=await je(`${a}/artifacts/${f}/${encodeURIComponent(B)}`,{method:"DELETE",credentials:"include"});if(!V.ok&&V.status!==204){const X=await V.json().catch(()=>({detail:`Failed to delete ${B}`}));throw new Error(X.detail||`HTTP error ${V.status}`)}le(`File "${B}" deleted successfully.`),P()}catch(V){le(`Error deleting file "${B}": ${V instanceof Error?V.message:"Unknown error"}`)}},[a,f,le,P]),An=d.useCallback(B=>{ue(B),ie(!0)},[]),wn=d.useCallback(()=>{ue(null),ie(!1)},[]),Pt=d.useCallback(B=>{Lt((B==null?void 0:B.filename)||null)},[]),Qn=d.useCallback(async()=>{if(te){const B=(Ot==null?void 0:Ot.filename)===te.filename;await jn(te.filename),B&&Pt(null)}wn()},[te,jn,wn,Ot,Pt]),we=d.useCallback(()=>{if(Ae.size===0){le("No files selected for deletion.");return}tt(!0)},[Ae,le]),Oe=d.useCallback(async()=>{tt(!1);const B=Array.from(Ae);let V=0,X=0;for(const ee of B)try{const fe=await je(`${a}/artifacts/${f}/${encodeURIComponent(ee)}`,{method:"DELETE",credentials:"include"});if(!fe.ok&&fe.status!==204)throw new Error(`Failed to delete ${ee}`);V++}catch(fe){console.error(fe),X++}V>0&&le(`${V} files(s) deleted successfully.`),X>0&&le(`Failed to delete ${X} files(s).`),P(),Le(new Set),Re(!1)},[Ae,le,P,a,f]),Be=d.useCallback(async B=>{if(M.current.has(B))return null;M.current.add(B),bt!==B&&(pt(null),Jt(null),Gt(null));try{let V;if(f&&f.trim()&&f!=="null"&&f!=="undefined")V=`${a}/artifacts/${f}/${encodeURIComponent(B)}/versions`;else if(i!=null&&i.id)V=`${a}/artifacts/null/${encodeURIComponent(B)}/versions?project_id=${i.id}`;else throw new Error("No valid context for artifact preview");const X=await je(V,{credentials:"include"});if(!X.ok)throw new Error("Error fetching version list");const ee=await X.json();if(!ee||ee.length===0)throw new Error("No versions available");pt(ee.sort((ke,Ue)=>ke-Ue));const fe=Math.max(...ee);Jt(fe);let xe;if(f&&f.trim()&&f!=="null"&&f!=="undefined")xe=`${a}/artifacts/${f}/${encodeURIComponent(B)}/versions/${fe}`;else if(i!=null&&i.id)xe=`${a}/artifacts/null/${encodeURIComponent(B)}/versions/${fe}?project_id=${i.id}`;else throw new Error("No valid context for artifact content");const be=await je(xe,{credentials:"include"});if(!be.ok)throw new Error("Error fetching latest version content");const Ze=await be.blob(),ct=await new Promise((ke,Ue)=>{const Ce=new FileReader;Ce.onloadend=()=>{var ye;return ke(((ye=Ce.result)==null?void 0:ye.toString().split(",")[1])||"")},Ce.onerror=Ue,Ce.readAsDataURL(Ze)}),nt=U.find(ke=>ke.filename===B),rt={name:B,mime_type:(nt==null?void 0:nt.mime_type)||"application/octet-stream",content:ct,last_modified:(nt==null?void 0:nt.last_modified)||new Date().toISOString()};return Gt(rt),rt}catch(V){return le(`Error loading preview for ${B}: ${V instanceof Error?V.message:"Unknown error"}`),null}finally{M.current.delete(B)}},[a,f,i==null?void 0:i.id,U,le,bt]),Me=d.useCallback(async(B,V)=>{if(!ft||ft.length===0)return null;if(!ft.includes(V))return le(`Version ${V} is not available for ${B}.`),null;Gt(null);try{let X;if(f&&f.trim()&&f!=="null"&&f!=="undefined")X=`${a}/artifacts/${f}/${encodeURIComponent(B)}/versions/${V}`;else if(i!=null&&i.id)X=`${a}/artifacts/null/${encodeURIComponent(B)}/versions/${V}?project_id=${i.id}`;else throw new Error("No valid context for artifact navigation");const ee=await je(X,{credentials:"include"});if(!ee.ok)throw new Error(`Error fetching version ${V}`);const fe=await ee.blob(),xe=await new Promise((ct,nt)=>{const rt=new FileReader;rt.onloadend=()=>{var ke;return ct(((ke=rt.result)==null?void 0:ke.toString().split(",")[1])||"")},rt.onerror=nt,rt.readAsDataURL(fe)}),be=U.find(ct=>ct.filename===B),Ze={name:B,mime_type:(be==null?void 0:be.mime_type)||"application/octet-stream",content:xe,last_modified:(be==null?void 0:be.last_modified)||new Date().toISOString()};return Jt(V),Gt(Ze),Ze}catch(X){return le(`Error loading version ${V}: ${X instanceof Error?X.message:"Unknown error"}`),null}},[a,le,U,ft,f,i==null?void 0:i.id]),mt=d.useCallback(B=>{le(`Loading preview for attached file: ${B.name}`),Gt(B),pt(null),Jt(null)},[le]),Ct=d.useCallback(B=>{Z(!1),oe(B),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:B}}))},[]),Ne=d.useCallback(()=>{A.current&&(clearTimeout(A.current),A.current=null),k.current&&(k.current.close(),k.current=null),G.current=!1},[]),ht=d.useCallback(async B=>{if(R.current.has(B))return console.log(`[ChatProvider] Skipping duplicate download for ${B} - already in progress`),null;R.current.add(B);try{const V=U.find(nt=>nt.filename===B);if(!V)return console.error(`Artifact ${B} not found in state`),null;const X=await je(`${a}/artifacts/${f}/${encodeURIComponent(B)}/versions`,{credentials:"include"});if(!X.ok)throw new Error("Error fetching version list");const ee=await X.json();if(!ee||ee.length===0)throw new Error("No versions available");const fe=Math.max(...ee),xe=await je(`${a}/artifacts/${f}/${encodeURIComponent(B)}/versions/${fe}`,{credentials:"include"});if(!xe.ok)throw new Error("Error fetching artifact content");const be=await xe.blob(),Ze=await new Promise((nt,rt)=>{const ke=new FileReader;ke.onloadend=()=>{var Ue;return nt(((Ue=ke.result)==null?void 0:Ue.toString().split(",")[1])||"")},ke.onerror=rt,ke.readAsDataURL(be)}),ct={name:B,mime_type:V.mime_type||"application/octet-stream",content:Ze,last_modified:V.last_modified||new Date().toISOString()};return I(nt=>nt.map(rt=>rt.filename===B?{...rt,accumulatedContent:void 0,needsEmbedResolution:!1}:rt)),ct}catch(V){return console.error(`Error downloading artifact ${B}:`,V),le(`Error downloading artifact: ${V instanceof Error?V.message:"Unknown error"}`,"error"),null}finally{R.current.delete(B)}},[a,f,U,le,I]),Ke=d.useCallback(B=>{var nt,rt,ke;_.current+=1;const V=_.current;let X;try{X=JSON.parse(B.data)}catch(Ue){console.error("Failed to parse SSE message:",Ue),le("Received unparseable agent update.","error");return}if("error"in X&&X.error){const Ce=`Error: ${X.error.message}`;x(ye=>{const he=ye.filter(ge=>!ge.isStatusBubble);return he.push({role:"agent",parts:[{kind:"text",text:Ce}],isUser:!1,isError:!0,isComplete:!0,metadata:{messageId:`msg-${crypto.randomUUID()}`,lastProcessedEventSequence:V}}),he}),w(!1),Ne(),C(null);return}if(!("result"in X)||!X.result){console.warn("Received SSE message without a result or error field.",X);return}const ee=X.result;let fe=!1,xe,be;switch(ee.kind){case"task":fe=!0,xe=void 0,be=ee.id;break;case"status-update":fe=ee.final,xe=(nt=ee.status)==null?void 0:nt.message,be=ee.taskId;break;case"artifact-update":P();return;default:console.warn("Received unknown result kind in SSE message:",ee);return}if(xe!=null&&xe.parts){const Ue=xe.parts.filter(Ce=>Ce.kind==="data");if(Ue.length>0)for(const Ce of Ue){const ye=Ce.data;if(ye&&typeof ye=="object"&&"type"in ye)switch(ye.type){case"agent_progress_update":{if(j.current=String((ye==null?void 0:ye.status_text)??"Processing..."),xe.parts.filter(ge=>ge.kind!=="data").length===0)return;break}case"artifact_creation_progress":{const{filename:he,status:ge,bytes_transferred:Se,mime_type:Fe,description:We,artifact_chunk:et,version:sd}=ye;let ad=!1;I(hr=>{const kn=hr.findIndex(Tn=>Tn.filename===he);if(kn>=0){const Tn=[...hr],Je=Tn[kn],bn=Je.isDisplayed||!1;return ge==="completed"&&bn&&(ad=!0),Tn[kn]={...Je,description:We!==void 0?We:Je.description,size:Se||Je.size,last_modified:new Date().toISOString(),uri:Je.uri||`artifact://${f}/${he}`,accumulatedContent:ge==="in-progress"&&et?(Je.accumulatedContent||"")+et:ge==="completed"&&!bn?void 0:Je.accumulatedContent,isAccumulatedContentPlainText:ge==="in-progress"&&et?!0:Je.isAccumulatedContentPlainText,mime_type:ge==="completed"&&Fe?Fe:Je.mime_type,needsEmbedResolution:ge==="completed"?!0:Je.needsEmbedResolution},Tn}else if(We!==void 0||ge==="in-progress")return[...hr,{filename:he,description:We||null,mime_type:Fe||"application/octet-stream",size:Se||0,last_modified:new Date().toISOString(),uri:`artifact://${f}/${he}`,accumulatedContent:ge==="in-progress"&&et?et:void 0,isAccumulatedContentPlainText:!!(ge==="in-progress"&&et),needsEmbedResolution:ge==="completed"}];return hr}),ad&&setTimeout(()=>{ht(he).catch(hr=>{console.error(`Auto-download failed for ${he}:`,hr)})},100),x(hr=>{const kn=[...hr];let Tn=kn.findLastIndex(gt=>!gt.isUser&>.taskId===be);if(Tn===-1){const gt={role:"agent",parts:[],taskId:be,isUser:!1,isComplete:!1,isStatusBubble:!1,metadata:{lastProcessedEventSequence:V}};kn.push(gt),Tn=kn.length-1}const Je={...kn[Tn],parts:[...kn[Tn].parts]};Je.isStatusBubble=!1;const bn=Je.parts.findIndex(gt=>gt.kind==="artifact"&>.name===he);if(ge==="in-progress")if(bn>-1){const Xr={...Je.parts[bn],bytesTransferred:Se,status:"in-progress"};Je.parts[bn]=Xr}else{const gt={kind:"artifact",status:"in-progress",name:he,bytesTransferred:Se};Je.parts.push(gt)}else if(ge==="completed"){const gt={name:he,mime_type:Fe,uri:sd!==void 0?`artifact://${f}/${he}?version=${sd}`:`artifact://${f}/${he}`};if(bn>-1){const _o={...Je.parts[bn],status:"completed",file:gt};delete _o.bytesTransferred,Je.parts[bn]=_o}else Je.parts.push({kind:"artifact",status:"completed",name:he,file:gt});P()}else{const gt=`Failed to create artifact: ${he}`;if(bn>-1){const _o={...Je.parts[bn],status:"failed",error:gt};delete _o.bytesTransferred,Je.parts[bn]=_o}else Je.parts.push({kind:"artifact",status:"failed",name:he,error:gt});Je.isError=!0}return kn[Tn]=Je,kn.filter(gt=>!gt.isStatusBubble||gt.parts.some(Xr=>Xr.kind==="artifact"||Xr.kind==="file"))});return}case"tool_invocation_start":break;case"authentication_required":{const he=ye==null?void 0:ye.auth_uri,ge=typeof(ye==null?void 0:ye.target_agent)=="string"?ye.target_agent:"Agent",Se=typeof(ye==null?void 0:ye.gateway_task_id)=="string"?ye.gateway_task_id:void 0;if(typeof he=="string"&&he.startsWith("http")){const Fe={role:"agent",parts:[{kind:"text",text:""}],authenticationLink:{url:he,text:"Click to Authenticate",targetAgent:ge,gatewayTaskId:Se},isUser:!1,isComplete:!0,metadata:{messageId:`auth-${Lj()}`}};x(We=>[...We,Fe])}break}default:console.warn("Received unknown data part type:",ye.type)}else if(((rt=Ce.metadata)==null?void 0:rt.tool_name)==="_notify_artifact_save"){const he=ye;he.status==="success"&&x(ge=>ge.map(Se=>Se.isUser||!Se.parts.some(Fe=>Fe.kind==="artifact"&&Fe.name===he.filename)?Se:{...Se,parts:Se.parts.map(Fe=>{if(Fe.kind==="artifact"&&Fe.name===he.filename){const We={name:he.filename,uri:`artifact://${f}/${he.filename}`};return{kind:"artifact",status:"completed",name:he.filename,file:We}}return Fe})}))}}}const Ze=((ke=xe==null?void 0:xe.parts)==null?void 0:ke.filter(Ue=>Ue.kind!=="data"))||[],ct=Ze.some(Ue=>Ue.kind==="file");x(Ue=>{var he;const Ce=[...Ue];let ye=Ce[Ce.length-1];if(ye!=null&&ye.isStatusBubble&&(Ce.pop(),ye=Ce[Ce.length-1]),ye&&!ye.isUser&&ye.taskId===ee.taskId&&Ze.length>0){const ge={...ye,parts:[...ye.parts,...Ze],isComplete:fe||ct,metadata:{...ye.metadata,lastProcessedEventSequence:V}};Ce[Ce.length-1]=ge}else if(Ze.some(Se=>Se.kind==="text"&&Se.text.trim()||Se.kind==="file")){const Se={role:"agent",parts:Ze,taskId:ee.taskId,isUser:!1,isComplete:fe||ct,metadata:{messageId:((he=X.id)==null?void 0:he.toString())||`msg-${crypto.randomUUID()}`,sessionId:ee.contextId,lastProcessedEventSequence:V}};Ce.push(Se)}if(fe){j.current=null;for(let Se=Ce.length-1;Se>=0;Se--){const Fe=Ce[Se];if(Fe.taskId===be&&Fe.parts.some(We=>We.kind==="artifact"&&We.status==="in-progress")){const We=Fe.parts.map(et=>et.kind==="artifact"&&et.status==="in-progress"?{...et,status:"failed",error:`Artifact creation for "${et.name}" did not complete.`}:et);Ce[Se]={...Fe,parts:We,isError:!0,isComplete:!0}}}const ge=Ce.findLastIndex(Se=>!Se.isUser&&Se.taskId===be);ge!==-1&&(Ce[ge]={...Ce[ge],isComplete:!0,metadata:{...Ce[ge].metadata,lastProcessedEventSequence:V}})}return Ce}),fe&&($.current&&(le("Task successfully cancelled."),A.current&&clearTimeout(A.current),L(!1)),be&&f&&x(Ue=>{var ye;const Ce=Ue.filter(he=>he.taskId===be&&!he.isStatusBubble);if(Ce.length>0){const he=Ce.map(Yt),ge=Ce.find(et=>et.isUser),Se=((ye=ge==null?void 0:ge.parts)==null?void 0:ye.filter(et=>et.kind==="text").map(et=>et.text).join(""))||"",We=Ce.some(et=>et.isError)?"error":"completed";Kt({task_id:be,user_message:Se,message_bubbles:he,task_metadata:{schema_version:Ys,status:We,agent_name:E}})}return Ue}),x(Ue=>Ue.map(Ce=>Ce.isUser||!Ce.parts.some(he=>he.kind==="artifact"&&he.status==="in-progress")?Ce:{...Ce,parts:Ce.parts.map(he=>{var ge;if(he.kind==="artifact"&&he.status==="in-progress"){const Se=he,Fe={name:Se.name,mime_type:(ge=Se.file)==null?void 0:ge.mime_type,uri:`artifact://${f}/${Se.name}`};return{kind:"artifact",status:"completed",name:Se.name,file:Fe}}return he})})),w(!1),Ne(),C(null),G.current=!0,P(),setTimeout(()=>{G.current=!1},100))},[le,Ne,P,f,E,Kt,Yt,ht,I]),lt=d.useCallback(async(B=!1)=>{const V="ChatProvider.handleNewSession:";if(Ne(),g&&y&&E&&!N)try{const X={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:y}};je(`${a}/tasks/${y}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X),credentials:"include"})}catch(X){console.warn(`${V} Failed to cancel current task:`,X)}A.current&&(clearTimeout(A.current),A.current=null),L(!1),console.log(`${V} Resetting session state - new session will be created when first message is sent`),m(""),xn(null),i&&!B?l(null):i&&B&&console.log(`${V} Preserving project context: ${i.name}`),S(""),x([]),w(!1),C(null),z(null),Pt(null),G.current=!1,j.current=null,_.current=0,le("New session started successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("focus-chat-input"))},[a,g,y,E,N,le,Ne,i,l,Pt]),Ee=d.useCallback(async B=>{const V="ChatProvider.handleSwitchSession:";if(console.log(`${V} Switching to session ${B}...`),Un(!0),x([]),Ne(),g&&y&&E&&!N){console.log(`${V} Cancelling current task ${y}`);try{const X={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:y}};await je(`${a}/tasks/${y}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X),credentials:"include"})}catch(X){console.warn(`${V} Failed to cancel current task:`,X)}}A.current&&(clearTimeout(A.current),A.current=null),L(!1);try{const X=await je(`${a}/sessions/${B}`);let ee=null;if(X.ok){const fe=await X.json();if(ee=fe==null?void 0:fe.data,xn((ee==null?void 0:ee.name)??"N/A"),Ir.current=!0,ee!=null&&ee.projectId)if(console.log(`${V} Session belongs to project ${ee.projectId}`),(i==null?void 0:i.id)!==ee.projectId){const xe=c.find(be=>be.id===(ee==null?void 0:ee.projectId));xe?(console.log(`${V} Activating project context: ${xe.name}`),l(xe)):console.warn(`${V} Project ${ee.projectId} not found in projects array`)}else console.log(`${V} Already in correct project context`);else i!==null&&(console.log(`${V} Session has no project, deactivating project context`),l(null))}m(B),w(!1),C(null),z(null),Pt(null),G.current=!1,j.current=null,_.current=0,await tn(B)}catch(X){console.error(`${V} Failed to fetch session history:`,X),le("Error switching session. Please try again.","error")}finally{Un(!1)}},[Ne,g,y,E,N,a,le,tn,i,c,l,Pt]),ze=d.useCallback(async(B,V)=>{try{const X=await je(`${a}/sessions/${B}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:V})});if(!X.ok){const ee=await X.json().catch(()=>({detail:"Failed to update session name"}));throw new Error(ee.detail||`HTTP error ${X.status}`)}le("Session name updated successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(X){le(`Error updating session name: ${X instanceof Error?X.message:"Unknown error"}`)}},[a,le]),se=d.useCallback(async B=>{try{const V=await je(`${a}/sessions/${B}`,{method:"DELETE"});if(!V.ok){const X=await V.json().catch(()=>({detail:"Failed to delete session"}));throw new Error(X.detail||`HTTP error ${V.status}`)}le("Session deleted successfully."),B===f&<(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(V){le(`Error deleting session: ${V instanceof Error?V.message:"Unknown error"}`)}},[a,le,lt,f]),T=d.useCallback(B=>{Qt(V=>{const X=new Set(V.expandedArtifacts);return X.has(B)?X.delete(B):X.add(B),{...V,expandedArtifacts:X}})},[]),q=d.useCallback(B=>hn.expandedArtifacts.has(B),[hn.expandedArtifacts]),ae=d.useCallback((B,V)=>{I(X=>X.map(ee=>ee.filename===B?{...ee,isDisplayed:V}:ee))},[]),$e=d.useCallback(B=>{Ve(B)},[]),it=d.useCallback(()=>{Ve(null)},[]),Xe=d.useCallback(async()=>{vn&&(await se(vn.id),Ve(null))},[vn,se]),Et=d.useCallback(async()=>{if(!g&&!N||!y){le("No active task to cancel.");return}if(N){le("Cancellation already in progress.");return}le(`Requesting cancellation for task ${y}...`),L(!0);try{const B={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:y}},V=await je(`${a}/tasks/${y}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(V.status===202)A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{le(`Cancellation for task ${y} timed out. Allowing new input.`),L(!1),w(!1),Ne(),C(null),A.current=null,x(X=>X.filter(ee=>!ee.isStatusBubble))},15e3);else{const X=await V.json().catch(()=>({detail:"Unknown cancellation error"}));le(`Failed to request cancellation: ${X.detail||V.statusText}`),L(!1)}}catch(B){le(`Error sending cancellation request: ${B instanceof Error?B.message:"Network error"}`),L(!1)}},[g,N,y,a,le,Ne]),qt=d.useCallback(async(B,V,X)=>{if(!f){console.error("Cannot submit feedback without a session ID.");return}try{await j0({taskId:B,sessionId:f,feedbackType:V,feedbackText:X}),yt(ee=>({...ee,[B]:{type:V,text:X}}))}catch(ee){throw console.error("Failed to submit feedback:",ee),le("Failed to submit feedback. Please try again.","error"),ee}},[f,le]),Ge=d.useCallback(()=>{},[]),Xt=d.useCallback(()=>{g&&!G.current&&!$.current&&le("Connection error with agent updates."),G.current||(w(!1),$.current||(Ne(),C(null)),j.current=null),x(B=>B.filter(V=>!V.isStatusBubble).map((V,X,ee)=>X===ee.length-1&&!V.isUser?{...V,isComplete:!0}:V))},[le,Ne,g]),Qe=d.useCallback(async(B,V,X)=>{B.preventDefault();const ee=(X==null?void 0:X.trim())||"",fe=V||[];if(!ee&&fe.length===0||g||N||!E){E||le("Please select an agent first."),N&&le("Cannot send new message while a task is being cancelled.");return}Ne(),G.current=!1,w(!0),C(null),j.current=null,_.current=0;const xe={role:"user",parts:[{kind:"text",text:ee}],isUser:!0,uploadedFiles:fe.length>0?fe:void 0,metadata:{messageId:`msg-${crypto.randomUUID()}`,sessionId:f,lastProcessedEventSequence:0}};j.current="Thinking",x(be=>[...be,xe]);try{const be=fe.map(async ge=>{if(ge.size<u)return{kind:"file",file:{bytes:await p(ge),name:ge.name,mimeType:ge.type}};{const Se=await Nn(ge);return Se?{kind:"file",file:{uri:Se.uri,name:ge.name,mimeType:ge.type}}:(le(`Failed to upload large file: ${ge.name}`,"error"),null)}}),Ze=(await Promise.all(be)).filter(ge=>ge!==null),ct=[];if(ee&&ct.push({kind:"text",text:ee}),ct.push(...Ze),ct.length===0)throw new Error("Cannot send an empty message.");console.log(`ChatProvider handleSubmit: Using sessionId for contextId: ${f}`);const nt={role:"user",parts:ct,messageId:`msg-${crypto.randomUUID()}`,kind:"message",contextId:f,metadata:{agent_name:E,project_id:(i==null?void 0:i.id)||null}},rt={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"message/stream",params:{message:nt}};console.log("ChatProvider handleSubmit: Sending POST to /message:stream");const ke=await je(`${a}/message:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(rt)});if(!ke.ok){const ge=await ke.json().catch(()=>({detail:"Unknown error"}));throw console.error("ChatProvider handleSubmit: Error from /message:stream",ke.status,ge),new Error(ge.detail||`HTTP error ${ke.status}`)}const Ue=await ke.json(),Ce=Ue==null?void 0:Ue.result,ye=Ce==null?void 0:Ce.id,he=Ce==null?void 0:Ce.contextId;if(console.log(`ChatProvider handleSubmit: Extracted responseSessionId: ${he}, current sessionId: ${f}`),console.log("ChatProvider handleSubmit: Full result object:",Ue),!ye)throw console.error("ChatProvider handleSubmit: Backend did not return a valid taskId. Result:",Ue),new Error("Backend did not return a valid taskId.");if(console.log(`ChatProvider handleSubmit: Checking session update condition - responseSessionId: ${he}, sessionId: ${f}, different: ${he!==f}`),he&&he!==f){console.log(`ChatProvider handleSubmit: Updating sessionId from ${f} to ${he}`);const ge=!f||f==="";if(m(he),x(Se=>Se.map(Fe=>{var We,et;return((We=Fe.metadata)==null?void 0:We.messageId)===((et=xe.metadata)==null?void 0:et.messageId)?{...Fe,metadata:{...Fe.metadata,sessionId:he}}:Fe})),await Kt({task_id:ye,user_message:ee,message_bubbles:[Yt(xe)],task_metadata:{schema_version:Ys,status:"pending",agent_name:E}}),ge){const Fe=xe.parts.filter(We=>We.kind==="text").map(We=>We.text).join(" ").trim();if(Fe){const We=Fe.length>100?`${Fe.substring(0,100)}...`:Fe;xn(We),await ze(he,We)}}ge&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}console.log(`ChatProvider handleSubmit: Received taskId ${ye}. Setting currentTaskId and taskIdInSidePanel.`),C(ye),z(ye),x(ge=>ge.map(Se=>{var Fe,We;return((Fe=Se.metadata)==null?void 0:Fe.messageId)===((We=xe.metadata)==null?void 0:We.messageId)?{...Se,taskId:ye}:Se}))}catch(be){console.error("ChatProvider handleSubmit: Catch block error",be),le(`Error: ${be instanceof Error?be.message:"Unknown error"}`),w(!1),x(Ze=>Ze.filter(ct=>!ct.isStatusBubble)),C(null),G.current=!1,j.current=null}},[f,g,N,E,Ne,le,a,Nn,ze,Kt,Yt,u,i]),$t=d.useRef(""),Ir=d.useRef(!1),qr=d.useRef(!1);d.useEffect(()=>{NE(V=>{(i==null?void 0:i.id)===V&&(console.log(`Project ${V} was deleted, clearing session context`),lt(!1))})},[i,lt]),d.useEffect(()=>{const B=async V=>{const X=V,{sessionId:ee,projectId:fe}=X.detail;if(ee===f)if(qr.current=!0,fe){const xe=c.find(be=>be.id===fe);xe&&l(xe)}else l(null)};return window.addEventListener("session-moved",B),()=>{window.removeEventListener("session-moved",B)}},[f,c,l]),d.useEffect(()=>{const B=$t.current,V=i==null?void 0:i.id;V!==void 0&&B!==V&&!Ir.current&&!qr.current&&(console.log("Active project changed explicitly, resetting chat view and preserving project context."),lt(!0)),$t.current=V,Ir.current=!1,qr.current=!1},[i,lt]),d.useEffect(()=>{if(!E&&O.length>0&&h.length===0&&!Mt){let B=O[0];if(i!=null&&i.defaultAgentId){const X=O.find(ee=>ee.name===i.defaultAgentId);X?(B=X,console.log(`Using project default agent: ${B.name}`)):(console.warn(`Project default agent "${i.defaultAgentId}" not found, falling back to OrchestratorAgent`),B=O.find(ee=>ee.name==="OrchestratorAgent")??O[0])}else B=O.find(X=>X.name==="OrchestratorAgent")??O[0];S(B.name);const V=t||`Hi! I'm the ${B==null?void 0:B.displayName}. How can I help?`;x([{parts:[{kind:"text",text:V}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:"",lastProcessedEventSequence:0}}])}},[O,t,h.length,E,f,Mt,i]);const mr=d.useRef(Ke),ko=d.useRef(Ge),To=d.useRef(Xt);d.useEffect(()=>{mr.current=Ke,ko.current=Ge,To.current=Xt},[Ke,Ge,Xt]),d.useEffect(()=>{if(y&&a){const B=Yl(),V=`${a}/sse/subscribe/${y}${B?`?token=${B}`:""}`,X=new EventSource(V,{withCredentials:!0});k.current=X;const ee=()=>{ko.current()},fe=()=>{To.current()},xe=be=>{mr.current(be)};return X.onopen=ee,X.onerror=fe,X.addEventListener("status_update",xe),X.addEventListener("artifact_update",xe),X.addEventListener("final_response",xe),X.addEventListener("error",xe),()=>{X.removeEventListener("status_update",xe),X.removeEventListener("artifact_update",xe),X.removeEventListener("final_response",xe),X.removeEventListener("error",xe),X.close()}}else Ne()},[y,a,Ne]);const Rs={configCollectFeedback:o,submittedFeedback:gn,handleFeedbackSubmit:qt,sessionId:f,setSessionId:m,sessionName:nn,setSessionName:xn,messages:h,setMessages:x,isResponding:g,currentTaskId:y,isCancelling:N,latestStatusText:j,isLoadingSession:Mt,agents:O,agentsLoading:Q,agentsError:H,agentsRefetch:W,handleNewSession:lt,handleSwitchSession:Ee,handleSubmit:Qe,handleCancel:Et,notifications:v,addNotification:le,selectedAgentName:E,setSelectedAgentName:S,artifacts:U,artifactsLoading:Y,artifactsRefetch:P,setArtifacts:I,uploadArtifactFile:Nn,isSidePanelCollapsed:K,activeSidePanelTab:J,setIsSidePanelCollapsed:Z,setActiveSidePanelTab:oe,openSidePanelTab:Ct,taskIdInSidePanel:F,setTaskIdInSidePanel:z,isDeleteModalOpen:re,artifactToDelete:te,openDeleteModal:An,closeDeleteModal:wn,confirmDelete:Qn,openSessionDeleteModal:$e,closeSessionDeleteModal:it,confirmSessionDelete:Xe,sessionToDelete:vn,isArtifactEditMode:De,setIsArtifactEditMode:Re,selectedArtifactFilenames:Ae,setSelectedArtifactFilenames:Le,handleDeleteSelectedArtifacts:we,confirmBatchDeleteArtifacts:Oe,isBatchDeleteModalOpen:Nt,setIsBatchDeleteModalOpen:tt,previewedArtifactAvailableVersions:ft,currentPreviewedVersionNumber:at,previewFileContent:Fn,openArtifactForPreview:Be,navigateArtifactVersion:Me,openMessageAttachmentForPreview:mt,previewArtifact:Ot,setPreviewArtifact:Pt,updateSessionName:ze,deleteSession:se,toggleArtifactExpanded:T,isArtifactExpanded:q,setArtifactRenderingState:Qt,artifactRenderingState:hn,markArtifactAsDisplayed:ae,downloadAndResolveArtifact:ht};return s.jsx(Nm.Provider,{value:Rs,children:e})},zj=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=Rt(),{fetchCsrfToken:r,clearCsrfToken:o}=Lm(),[a,i]=d.useState(!1),[l,c]=d.useState(!0),[u,p]=d.useState(null);d.useEffect(()=>{let h=!0;const x=async()=>{if(!t){h&&(i(!0),c(!1));return}try{const w=await je("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(w.ok){const v=await w.json();console.log("User is authenticated:",v),h&&(p(v),i(!0)),console.log("Fetching CSRF token for authenticated requests..."),await r()}else w.status===401?(console.log("User is not authenticated"),h&&i(!1)):(console.error("Unexpected response from /users/me:",w.status),h&&i(!1))}catch(w){console.error("Error checking authentication:",w),h&&i(!1)}finally{h&&c(!1)}};x();const g=w=>{w.key==="access_token"&&x()};return window.addEventListener("storage",g),()=>{h=!1,window.removeEventListener("storage",g)}},[t,n,r]);const f=()=>{window.location.href=n},m=()=>{i(!1),p(null),o()};return l?s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),s.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Checking Authentication..."})]})}):s.jsx(Sm.Provider,{value:{isAuthenticated:a,useAuthorization:t,login:f,logout:m,userInfo:u},children:e})};function Uj(e){var r;if(typeof document>"u")return null;const n=`; ${document.cookie}`.split(`; ${e}=`);return n.length===2&&((r=n.pop())==null?void 0:r.split(";").shift())||null}const Bj=e=>new Promise(t=>setTimeout(t,e)),Hj=async(e=5,t=50)=>{try{const n=await je("/api/v1/csrf-token",{credentials:"include"});if(!n.ok)throw new Error(`CSRF endpoint returned status ${n.status}`);const r=await n.json();if(r.csrf_token)return console.log("CSRF token found in response body:",r.csrf_token),r.csrf_token;for(let o=0;o<e;o++){const a=Uj("csrf_token");if(a)return console.log(`CSRF token found in cookie after ${o} retries:`,a),a;console.log(`CSRF token not found in cookie, attempt ${o+1}/${e}. Waiting ${t}ms...`),await Bj(t)}throw new Error("CSRF token not available in response or cookie after retries")}catch(n){return console.error("Error fetching/reading CSRF token:",n),null}};function Wj({children:e}){const[t,n]=d.useState(null),r=d.useCallback(async()=>{if(t)return t;const i=await Hj();if(i)n(i);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return i},[t]),o=d.useCallback(()=>{n(null)},[]),a={fetchCsrfToken:r,clearCsrfToken:o};return s.jsx(Am.Provider,{value:a,children:e})}const Vj={brand:{wMain:"#00C895",w30:"#B3EFDF",wMain30:"#00C8954d",w10:"#E6FAF4",w60:"#66DEBF",w100:"#00AD93"},primary:{w100:"#01374E",w90:"#014968",wMain:"#015B82",w60:"#679DB4",w40:"#99BDCD",w20:"#CCDEE6",w10:"#E6EFF2",text:{wMain:"#273749",w100:"#000000",w10:"#CCCCCC"}},secondary:{w70:"#536574",w80:"#354E62",w8040:"#354E6240",w100:"#000000",wMain:"#8790A0",w40:"#CFD3D9",w20:"#E7E9EC",w10:"#F3F4F6",text:{wMain:"#647481",w50:"#B1B9C0"}},background:{w100:"#021B2F",wMain:"#03223B",w20:"#F7F8F9",w10:"#FFFFFF"},info:{w100:"#2B71B1",wMain:"#0591D3",w70:"#7CD3F6",w30:"#B4DEF2",w20:"#CDE9F6",w10:"#E6F4FB"},error:{w100:"#C33135",wMain:"#E94C4E",w70:"#ED9B9D",w30:"#F8C9CA",w20:"#FBDBDC",w10:"#FDEDED"},warning:{w100:"#E1681F",wMain:"#FF8E2B",w70:"#F8C785",w30:"#FFDDBF",w20:"#FFE8D5",w10:"#FFF4EA"},success:{w100:"#006B53",wMain:"#009A80",w70:"#6FCCBC",w30:"#B3E1D9",w20:"#CCEBE6",w10:"#E6F5F2"},stateLayer:{w10:"#03223B1a",w20:"#03223B33"},accent:{n0:{w100:"#2F51AD",wMain:"#3C69E1",w30:"#C5D2F6",w10:"#ECF0FC"},n1:{w100:"#1F284C",wMain:"#3A4880",w30:"#C4C8D9",w60:"#8991B3",w20:"#D8DAE6",w10:"#EBEDF2"},n2:{w100:"#165E64",wMain:"#009193",w30:"#B3DEDF",w20:"#CCE9E9",w10:"#E6F4F4"},n3:{w100:"#542D75",wMain:"#7841A8",w30:"#D7C6E5",w10:"#F2ECF6"},n4:{w100:"#951379",wMain:"#CB1AA5",w30:"#F2C4E8"},n5:{w100:"#D03C1B",wMain:"#F66651",w30:"#FCCEC7",w60:"#FAA397"},n6:{w100:"#DE7E00",wMain:"#FCA829",w30:"#FEE5BF"},n7:{w100:"#2DADE1",wMain:"#7CD3F6",w30:"#CBEDFB"},n8:{w100:"#4F5A63",wMain:"#86939E",w30:"#DBDFE2"},n9:{wMain:"#DA162D"}},learning:{wMain:"#033A6F",w90:"#022E59",w100:"#022343",w20:"#CDD8E2",w10:"#E6EBF1"}},Gj={light:{background:"background.w10",foreground:"primary.text.wMain",card:"background.w10","card-foreground":"primary.text.wMain",popover:"background.w10","popover-foreground":"primary.text.wMain",primary:"primary.wMain","primary-foreground":"primary.text.w10",secondary:"secondary.w10","secondary-foreground":"secondary.text.wMain",muted:"secondary.w10","muted-foreground":"secondary.text.wMain",accent:"secondary.w40","accent-foreground":"secondary.text.wMain",destructive:"error.wMain",border:"secondary.w40",input:"secondary.w40",ring:"brand.wMain","ring-offset":"brand.wMain","accent-background":"background.w20","message-background":"secondary.w20","chart-1":"brand.w60","chart-2":"primary.wMain","chart-3":"accent.n3.wMain","chart-4":"accent.n6.wMain","chart-5":"accent.n5.wMain",sidebar:"background.w20","sidebar-foreground":"primary.text.wMain","sidebar-primary":"primary.wMain","sidebar-primary-foreground":"primary.text.w10","sidebar-accent":"secondary.w10","sidebar-accent-foreground":"secondary.text.wMain","sidebar-border":"secondary.w40","sidebar-ring":"brand.wMain"},dark:{background:"background.w100",foreground:"primary.text.w10",card:"background.wMain","card-foreground":"primary.text.w10",popover:"background.wMain","popover-foreground":"primary.text.w10",primary:"primary.w60","primary-foreground":"primary.text.wMain",secondary:"secondary.w80","secondary-foreground":"secondary.text.w50",muted:"secondary.w80","muted-foreground":"secondary.text.w50",accent:"secondary.w80","accent-foreground":"secondary.text.w50",destructive:"error.w70",border:"secondary.w70",input:"secondary.w70",ring:"brand.w60","ring-offset":"brand.w60","accent-background":"primary.w90","message-background":"secondary.w70","chart-1":"brand.w100","chart-2":"primary.wMain","chart-3":"accent.n3.w100","chart-4":"accent.n6.w30","chart-5":"accent.n5.w60",sidebar:"background.wMain","sidebar-foreground":"primary.text.w10","sidebar-primary":"primary.w60","sidebar-primary-foreground":"primary.text.wMain","sidebar-accent":"secondary.w80","sidebar-accent-foreground":"secondary.text.w50","sidebar-border":"secondary.w70","sidebar-ring":"brand.w60"}},Yj={"error-text-wMain":"error.wMain","error-text-w50":"error.w70","warning-text-wMain":"warning.wMain","warning-text-w50":"warning.w70","success-text-wMain":"success.wMain","success-text-w50":"success.w70","info-text-wMain":"info.wMain","info-text-w50":"info.w70"};function bu(e,t){const n=t.split(".");let r=e;for(const o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return console.warn(`Color path not found: ${t}`),"#000000";return typeof r=="string"?r:"#000000"}function Kj(e,t){const n={},r=Gj[t];for(const[o,a]of Object.entries(r)){const i=bu(e,a);n[`--${o}`]=i}for(const[o,a]of Object.entries(Yj)){const i=bu(e,a);n[`--color-${o}`]=i}return n}const ba="sam-theme";function qj(e){var n,r,o,a,i,l,c,u,p,f,m,h,x,g,w,v,b,y,C,k,E,S,N,L,$,D,M,R,F,z,A,G,j,_,O,H,Q,W,U,Y,P,I,K,Z,J,oe,re,ie,te,ue,De,Re,Ae,Le,Nt,tt,bt,Lt,ft,pt,at,Jt,Fn,Gt,Ot,hn,Qt,gn,yt,le,Yt,Kt,zn,en,tn,Nn,nn,xn,vn,Ve,Mt,Un,jn,An,wn,Pt,Qn,we,Oe,Be,Me,mt,Ct,Ne,ht,Ke,lt,Ee,ze,se,T,q,ae;const t={};return e.brand.wMain&&(t["--color-brand-wMain"]=e.brand.wMain),e.brand.wMain30&&(t["--color-brand-wMain30"]=e.brand.wMain30),e.brand.w100&&(t["--color-brand-w100"]=e.brand.w100),e.brand.w60&&(t["--color-brand-w60"]=e.brand.w60),e.brand.w30&&(t["--color-brand-w30"]=e.brand.w30),e.brand.w10&&(t["--color-brand-w10"]=e.brand.w10),e.primary.wMain&&(t["--color-primary-wMain"]=e.primary.wMain),e.primary.w100&&(t["--color-primary-w100"]=e.primary.w100),e.primary.w90&&(t["--color-primary-w90"]=e.primary.w90),e.primary.w60&&(t["--color-primary-w60"]=e.primary.w60),e.primary.w40&&(t["--color-primary-w40"]=e.primary.w40),e.primary.w20&&(t["--color-primary-w20"]=e.primary.w20),e.primary.w10&&(t["--color-primary-w10"]=e.primary.w10),e.primary.text.wMain&&(t["--color-primary-text-wMain"]=e.primary.text.wMain),e.primary.text.w100&&(t["--color-primary-text-w100"]=e.primary.text.w100),e.primary.text.w10&&(t["--color-primary-text-w10"]=e.primary.text.w10),e.secondary.wMain&&(t["--color-secondary-wMain"]=e.secondary.wMain),e.secondary.w100&&(t["--color-secondary-w100"]=e.secondary.w100),e.secondary.w80&&(t["--color-secondary-w80"]=e.secondary.w80),e.secondary.w8040&&(t["--color-secondary-w8040"]=e.secondary.w8040),e.secondary.w70&&(t["--color-secondary-w70"]=e.secondary.w70),e.secondary.w40&&(t["--color-secondary-w40"]=e.secondary.w40),e.secondary.w20&&(t["--color-secondary-w20"]=e.secondary.w20),e.secondary.w10&&(t["--color-secondary-w10"]=e.secondary.w10),e.secondary.text.wMain&&(t["--color-secondary-text-wMain"]=e.secondary.text.wMain),e.secondary.text.w50&&(t["--color-secondary-text-w50"]=e.secondary.text.w50),e.background.wMain&&(t["--color-background-wMain"]=e.background.wMain),e.background.w100&&(t["--color-background-w100"]=e.background.w100),e.background.w20&&(t["--color-background-w20"]=e.background.w20),e.background.w10&&(t["--color-background-w10"]=e.background.w10),(n=e.info)!=null&&n.wMain&&(t["--color-info-wMain"]=e.info.wMain),(r=e.info)!=null&&r.w100&&(t["--color-info-w100"]=e.info.w100),(o=e.info)!=null&&o.w70&&(t["--color-info-w70"]=e.info.w70),(a=e.info)!=null&&a.w30&&(t["--color-info-w30"]=e.info.w30),(i=e.info)!=null&&i.w20&&(t["--color-info-w20"]=e.info.w20),(l=e.info)!=null&&l.w10&&(t["--color-info-w10"]=e.info.w10),(c=e.error)!=null&&c.wMain&&(t["--color-error-wMain"]=e.error.wMain),(u=e.error)!=null&&u.w100&&(t["--color-error-w100"]=e.error.w100),(p=e.error)!=null&&p.w70&&(t["--color-error-w70"]=e.error.w70),(f=e.error)!=null&&f.w30&&(t["--color-error-w30"]=e.error.w30),(m=e.error)!=null&&m.w20&&(t["--color-error-w20"]=e.error.w20),(h=e.error)!=null&&h.w10&&(t["--color-error-w10"]=e.error.w10),(x=e.warning)!=null&&x.wMain&&(t["--color-warning-wMain"]=e.warning.wMain),(g=e.warning)!=null&&g.w100&&(t["--color-warning-w100"]=e.warning.w100),(w=e.warning)!=null&&w.w70&&(t["--color-warning-w70"]=e.warning.w70),(v=e.warning)!=null&&v.w30&&(t["--color-warning-w30"]=e.warning.w30),(b=e.warning)!=null&&b.w20&&(t["--color-warning-w20"]=e.warning.w20),(y=e.warning)!=null&&y.w10&&(t["--color-warning-w10"]=e.warning.w10),(C=e.success)!=null&&C.wMain&&(t["--color-success-wMain"]=e.success.wMain),(k=e.success)!=null&&k.w100&&(t["--color-success-w100"]=e.success.w100),(E=e.success)!=null&&E.w70&&(t["--color-success-w70"]=e.success.w70),(S=e.success)!=null&&S.w30&&(t["--color-success-w30"]=e.success.w30),(N=e.success)!=null&&N.w20&&(t["--color-success-w20"]=e.success.w20),(L=e.success)!=null&&L.w10&&(t["--color-success-w10"]=e.success.w10),($=e.stateLayer)!=null&&$.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(D=e.stateLayer)!=null&&D.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(R=(M=e.accent)==null?void 0:M.n0)!=null&&R.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(z=(F=e.accent)==null?void 0:F.n0)!=null&&z.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(G=(A=e.accent)==null?void 0:A.n0)!=null&&G.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(_=(j=e.accent)==null?void 0:j.n0)!=null&&_.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(H=(O=e.accent)==null?void 0:O.n1)!=null&&H.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(W=(Q=e.accent)==null?void 0:Q.n1)!=null&&W.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(Y=(U=e.accent)==null?void 0:U.n1)!=null&&Y.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(I=(P=e.accent)==null?void 0:P.n1)!=null&&I.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(Z=(K=e.accent)==null?void 0:K.n1)!=null&&Z.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(oe=(J=e.accent)==null?void 0:J.n1)!=null&&oe.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(ie=(re=e.accent)==null?void 0:re.n2)!=null&&ie.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(ue=(te=e.accent)==null?void 0:te.n2)!=null&&ue.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),(Re=(De=e.accent)==null?void 0:De.n2)!=null&&Re.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(Le=(Ae=e.accent)==null?void 0:Ae.n2)!=null&&Le.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(tt=(Nt=e.accent)==null?void 0:Nt.n2)!=null&&tt.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(Lt=(bt=e.accent)==null?void 0:bt.n3)!=null&&Lt.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(pt=(ft=e.accent)==null?void 0:ft.n3)!=null&&pt.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(Jt=(at=e.accent)==null?void 0:at.n3)!=null&&Jt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(Gt=(Fn=e.accent)==null?void 0:Fn.n3)!=null&&Gt.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(hn=(Ot=e.accent)==null?void 0:Ot.n4)!=null&&hn.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(gn=(Qt=e.accent)==null?void 0:Qt.n4)!=null&&gn.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(le=(yt=e.accent)==null?void 0:yt.n4)!=null&&le.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Kt=(Yt=e.accent)==null?void 0:Yt.n5)!=null&&Kt.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(en=(zn=e.accent)==null?void 0:zn.n5)!=null&&en.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(Nn=(tn=e.accent)==null?void 0:tn.n5)!=null&&Nn.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(xn=(nn=e.accent)==null?void 0:nn.n5)!=null&&xn.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(Ve=(vn=e.accent)==null?void 0:vn.n6)!=null&&Ve.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(Un=(Mt=e.accent)==null?void 0:Mt.n6)!=null&&Un.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),(An=(jn=e.accent)==null?void 0:jn.n6)!=null&&An.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(Pt=(wn=e.accent)==null?void 0:wn.n7)!=null&&Pt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(we=(Qn=e.accent)==null?void 0:Qn.n7)!=null&&we.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),(Be=(Oe=e.accent)==null?void 0:Oe.n7)!=null&&Be.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(mt=(Me=e.accent)==null?void 0:Me.n8)!=null&&mt.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(Ne=(Ct=e.accent)==null?void 0:Ct.n8)!=null&&Ne.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(Ke=(ht=e.accent)==null?void 0:ht.n8)!=null&&Ke.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(Ee=(lt=e.accent)==null?void 0:lt.n9)!=null&&Ee.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(ze=e.learning)!=null&&ze.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(se=e.learning)!=null&&se.w100&&(t["--color-learning-w100"]=e.learning.w100),(T=e.learning)!=null&&T.w90&&(t["--color-learning-w90"]=e.learning.w90),(q=e.learning)!=null&&q.w20&&(t["--color-learning-w20"]=e.learning.w20),(ae=e.learning)!=null&&ae.w10&&(t["--color-learning-w10"]=e.learning.w10),t}function Xj(e,t="light"){const n={};if(e){const o=qj(e);Object.assign(n,o)}const r=Kj(e,t);return Object.assign(n,r),n}function Zj(){const e=localStorage.getItem(ba);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Jj(e,t){const n=Xj(e,t),r=document.documentElement;for(const[o,a]of Object.entries(n))r.style.setProperty(o,a);requestAnimationFrame(()=>{console.log(`Applying ${t} theme with palette`),r.classList.remove("light","dark"),r.classList.add(t),localStorage.setItem(ba,t)})}const Qj=({children:e})=>{const t=d.useMemo(()=>Vj,[]),[n,r]=d.useState(()=>Zj()),o=d.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const a=n==="light"?"dark":"light";r(a),localStorage.setItem(ba,a)}}),[n]);return d.useEffect(()=>{if(!(localStorage.getItem(ba)!==null)){const i=window.matchMedia("(prefers-color-scheme: dark)"),l=c=>{r(c.matches?"dark":"light")};return i.addEventListener?i.addEventListener("change",l):i.addListener(l),()=>{i.removeEventListener?i.removeEventListener("change",l):i.removeListener(l)}}},[]),d.useEffect(()=>{document.documentElement.classList.remove("light","dark"),Jj(t,n)},[n,t]),s.jsx(Tm.Provider,{value:o,children:e})};/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Qg,setPrototypeOf:yu,isFrozen:eA,getPrototypeOf:tA,getOwnPropertyDescriptor:nA}=Object;let{freeze:Bt,seal:Sn,create:ex}=Object,{apply:El,construct:Sl}=typeof Reflect<"u"&&Reflect;Bt||(Bt=function(t){return t});Sn||(Sn=function(t){return t});El||(El=function(t,n,r){return t.apply(n,r)});Sl||(Sl=function(t,n){return new t(...n)});const Ks=Ht(Array.prototype.forEach),rA=Ht(Array.prototype.lastIndexOf),Cu=Ht(Array.prototype.pop),Mo=Ht(Array.prototype.push),oA=Ht(Array.prototype.splice),sa=Ht(String.prototype.toLowerCase),Oi=Ht(String.prototype.toString),Eu=Ht(String.prototype.match),Po=Ht(String.prototype.replace),sA=Ht(String.prototype.indexOf),aA=Ht(String.prototype.trim),Rn=Ht(Object.prototype.hasOwnProperty),Ft=Ht(RegExp.prototype.test),Do=iA(TypeError);function Ht(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return El(e,t,r)}}function iA(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Sl(e,n)}}function Pe(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sa;yu&&yu(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const a=n(o);a!==o&&(eA(t)||(t[r]=a),o=a)}e[o]=!0}return e}function lA(e){for(let t=0;t<e.length;t++)Rn(e,t)||(e[t]=null);return e}function tr(e){const t=ex(null);for(const[n,r]of Qg(e))Rn(e,n)&&(Array.isArray(r)?t[n]=lA(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=tr(r):t[n]=r);return t}function Lo(e,t){for(;e!==null;){const r=nA(e,t);if(r){if(r.get)return Ht(r.get);if(typeof r.value=="function")return Ht(r.value)}e=tA(e)}function n(){return null}return n}const Su=Bt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$i=Bt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Fi=Bt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),cA=Bt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),zi=Bt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),dA=Bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Nu=Bt(["#text"]),ju=Bt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ui=Bt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Au=Bt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qs=Bt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),uA=Sn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),fA=Sn(/<%[\w\W]*|[\w\W]*%>/gm),pA=Sn(/\$\{[\w\W]*/gm),mA=Sn(/^data-[\-\w.\u00B7-\uFFFF]+$/),hA=Sn(/^aria-[\-\w]+$/),tx=Sn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gA=Sn(/^(?:\w+script|data):/i),xA=Sn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nx=Sn(/^html$/i),vA=Sn(/^[a-z][.\w]*(-[.\w]+)+$/i);var ku=Object.freeze({__proto__:null,ARIA_ATTR:hA,ATTR_WHITESPACE:xA,CUSTOM_ELEMENT:vA,DATA_ATTR:mA,DOCTYPE_NAME:nx,ERB_EXPR:fA,IS_ALLOWED_URI:tx,IS_SCRIPT_OR_DATA:gA,MUSTACHE_EXPR:uA,TMPLIT_EXPR:pA});const Oo={element:1,text:3,progressingInstruction:7,comment:8,document:9},wA=function(){return typeof window>"u"?null:window},bA=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const a="dompurify"+(r?"#"+r:"");try{return t.createPolicy(a,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Tu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rx(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wA();const t=se=>rx(se);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==Oo.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:u,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:h}=e,x=c.prototype,g=Lo(x,"cloneNode"),w=Lo(x,"remove"),v=Lo(x,"nextSibling"),b=Lo(x,"childNodes"),y=Lo(x,"parentNode");if(typeof i=="function"){const se=n.createElement("template");se.content&&se.content.ownerDocument&&(n=se.content.ownerDocument)}let C,k="";const{implementation:E,createNodeIterator:S,createDocumentFragment:N,getElementsByTagName:L}=n,{importNode:$}=r;let D=Tu();t.isSupported=typeof Qg=="function"&&typeof y=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:R,TMPLIT_EXPR:F,DATA_ATTR:z,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:_}=ku;let{IS_ALLOWED_URI:O}=ku,H=null;const Q=Pe({},[...Su,...$i,...Fi,...zi,...Nu]);let W=null;const U=Pe({},[...ju,...Ui,...Au,...qs]);let Y=Object.seal(ex(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),P=null,I=null,K=!0,Z=!0,J=!1,oe=!0,re=!1,ie=!0,te=!1,ue=!1,De=!1,Re=!1,Ae=!1,Le=!1,Nt=!0,tt=!1;const bt="user-content-";let Lt=!0,ft=!1,pt={},at=null;const Jt=Pe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Fn=null;const Gt=Pe({},["audio","video","img","source","image","track"]);let Ot=null;const hn=Pe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qt="http://www.w3.org/1998/Math/MathML",gn="http://www.w3.org/2000/svg",yt="http://www.w3.org/1999/xhtml";let le=yt,Yt=!1,Kt=null;const zn=Pe({},[Qt,gn,yt],Oi);let en=Pe({},["mi","mo","mn","ms","mtext"]),tn=Pe({},["annotation-xml"]);const Nn=Pe({},["title","style","font","a","script"]);let nn=null;const xn=["application/xhtml+xml","text/html"],vn="text/html";let Ve=null,Mt=null;const Un=n.createElement("form"),jn=function(T){return T instanceof RegExp||T instanceof Function},An=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Mt&&Mt===T)){if((!T||typeof T!="object")&&(T={}),T=tr(T),nn=xn.indexOf(T.PARSER_MEDIA_TYPE)===-1?vn:T.PARSER_MEDIA_TYPE,Ve=nn==="application/xhtml+xml"?Oi:sa,H=Rn(T,"ALLOWED_TAGS")?Pe({},T.ALLOWED_TAGS,Ve):Q,W=Rn(T,"ALLOWED_ATTR")?Pe({},T.ALLOWED_ATTR,Ve):U,Kt=Rn(T,"ALLOWED_NAMESPACES")?Pe({},T.ALLOWED_NAMESPACES,Oi):zn,Ot=Rn(T,"ADD_URI_SAFE_ATTR")?Pe(tr(hn),T.ADD_URI_SAFE_ATTR,Ve):hn,Fn=Rn(T,"ADD_DATA_URI_TAGS")?Pe(tr(Gt),T.ADD_DATA_URI_TAGS,Ve):Gt,at=Rn(T,"FORBID_CONTENTS")?Pe({},T.FORBID_CONTENTS,Ve):Jt,P=Rn(T,"FORBID_TAGS")?Pe({},T.FORBID_TAGS,Ve):tr({}),I=Rn(T,"FORBID_ATTR")?Pe({},T.FORBID_ATTR,Ve):tr({}),pt=Rn(T,"USE_PROFILES")?T.USE_PROFILES:!1,K=T.ALLOW_ARIA_ATTR!==!1,Z=T.ALLOW_DATA_ATTR!==!1,J=T.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=T.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=T.SAFE_FOR_TEMPLATES||!1,ie=T.SAFE_FOR_XML!==!1,te=T.WHOLE_DOCUMENT||!1,Re=T.RETURN_DOM||!1,Ae=T.RETURN_DOM_FRAGMENT||!1,Le=T.RETURN_TRUSTED_TYPE||!1,De=T.FORCE_BODY||!1,Nt=T.SANITIZE_DOM!==!1,tt=T.SANITIZE_NAMED_PROPS||!1,Lt=T.KEEP_CONTENT!==!1,ft=T.IN_PLACE||!1,O=T.ALLOWED_URI_REGEXP||tx,le=T.NAMESPACE||yt,en=T.MATHML_TEXT_INTEGRATION_POINTS||en,tn=T.HTML_INTEGRATION_POINTS||tn,Y=T.CUSTOM_ELEMENT_HANDLING||{},T.CUSTOM_ELEMENT_HANDLING&&jn(T.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=T.CUSTOM_ELEMENT_HANDLING.tagNameCheck),T.CUSTOM_ELEMENT_HANDLING&&jn(T.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=T.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),T.CUSTOM_ELEMENT_HANDLING&&typeof T.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=T.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),re&&(Z=!1),Ae&&(Re=!0),pt&&(H=Pe({},Nu),W=[],pt.html===!0&&(Pe(H,Su),Pe(W,ju)),pt.svg===!0&&(Pe(H,$i),Pe(W,Ui),Pe(W,qs)),pt.svgFilters===!0&&(Pe(H,Fi),Pe(W,Ui),Pe(W,qs)),pt.mathMl===!0&&(Pe(H,zi),Pe(W,Au),Pe(W,qs))),T.ADD_TAGS&&(H===Q&&(H=tr(H)),Pe(H,T.ADD_TAGS,Ve)),T.ADD_ATTR&&(W===U&&(W=tr(W)),Pe(W,T.ADD_ATTR,Ve)),T.ADD_URI_SAFE_ATTR&&Pe(Ot,T.ADD_URI_SAFE_ATTR,Ve),T.FORBID_CONTENTS&&(at===Jt&&(at=tr(at)),Pe(at,T.FORBID_CONTENTS,Ve)),Lt&&(H["#text"]=!0),te&&Pe(H,["html","head","body"]),H.table&&(Pe(H,["tbody"]),delete P.tbody),T.TRUSTED_TYPES_POLICY){if(typeof T.TRUSTED_TYPES_POLICY.createHTML!="function")throw Do('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof T.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Do('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=T.TRUSTED_TYPES_POLICY,k=C.createHTML("")}else C===void 0&&(C=bA(h,o)),C!==null&&typeof k=="string"&&(k=C.createHTML(""));Bt&&Bt(T),Mt=T}},wn=Pe({},[...$i,...Fi,...cA]),Pt=Pe({},[...zi,...dA]),Qn=function(T){let q=y(T);(!q||!q.tagName)&&(q={namespaceURI:le,tagName:"template"});const ae=sa(T.tagName),$e=sa(q.tagName);return Kt[T.namespaceURI]?T.namespaceURI===gn?q.namespaceURI===yt?ae==="svg":q.namespaceURI===Qt?ae==="svg"&&($e==="annotation-xml"||en[$e]):!!wn[ae]:T.namespaceURI===Qt?q.namespaceURI===yt?ae==="math":q.namespaceURI===gn?ae==="math"&&tn[$e]:!!Pt[ae]:T.namespaceURI===yt?q.namespaceURI===gn&&!tn[$e]||q.namespaceURI===Qt&&!en[$e]?!1:!Pt[ae]&&(Nn[ae]||!wn[ae]):!!(nn==="application/xhtml+xml"&&Kt[T.namespaceURI]):!1},we=function(T){Mo(t.removed,{element:T});try{y(T).removeChild(T)}catch{w(T)}},Oe=function(T,q){try{Mo(t.removed,{attribute:q.getAttributeNode(T),from:q})}catch{Mo(t.removed,{attribute:null,from:q})}if(q.removeAttribute(T),T==="is")if(Re||Ae)try{we(q)}catch{}else try{q.setAttribute(T,"")}catch{}},Be=function(T){let q=null,ae=null;if(De)T="<remove></remove>"+T;else{const Xe=Eu(T,/^[\r\n\t ]+/);ae=Xe&&Xe[0]}nn==="application/xhtml+xml"&&le===yt&&(T='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+T+"</body></html>");const $e=C?C.createHTML(T):T;if(le===yt)try{q=new m().parseFromString($e,nn)}catch{}if(!q||!q.documentElement){q=E.createDocument(le,"template",null);try{q.documentElement.innerHTML=Yt?k:$e}catch{}}const it=q.body||q.documentElement;return T&&ae&&it.insertBefore(n.createTextNode(ae),it.childNodes[0]||null),le===yt?L.call(q,te?"html":"body")[0]:te?q.documentElement:it},Me=function(T){return S.call(T.ownerDocument||T,T,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},mt=function(T){return T instanceof f&&(typeof T.nodeName!="string"||typeof T.textContent!="string"||typeof T.removeChild!="function"||!(T.attributes instanceof p)||typeof T.removeAttribute!="function"||typeof T.setAttribute!="function"||typeof T.namespaceURI!="string"||typeof T.insertBefore!="function"||typeof T.hasChildNodes!="function")},Ct=function(T){return typeof l=="function"&&T instanceof l};function Ne(se,T,q){Ks(se,ae=>{ae.call(t,T,q,Mt)})}const ht=function(T){let q=null;if(Ne(D.beforeSanitizeElements,T,null),mt(T))return we(T),!0;const ae=Ve(T.nodeName);if(Ne(D.uponSanitizeElement,T,{tagName:ae,allowedTags:H}),ie&&T.hasChildNodes()&&!Ct(T.firstElementChild)&&Ft(/<[/\w!]/g,T.innerHTML)&&Ft(/<[/\w!]/g,T.textContent)||T.nodeType===Oo.progressingInstruction||ie&&T.nodeType===Oo.comment&&Ft(/<[/\w]/g,T.data))return we(T),!0;if(!H[ae]||P[ae]){if(!P[ae]&<(ae)&&(Y.tagNameCheck instanceof RegExp&&Ft(Y.tagNameCheck,ae)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ae)))return!1;if(Lt&&!at[ae]){const $e=y(T)||T.parentNode,it=b(T)||T.childNodes;if(it&&$e){const Xe=it.length;for(let Et=Xe-1;Et>=0;--Et){const qt=g(it[Et],!0);qt.__removalCount=(T.__removalCount||0)+1,$e.insertBefore(qt,v(T))}}}return we(T),!0}return T instanceof c&&!Qn(T)||(ae==="noscript"||ae==="noembed"||ae==="noframes")&&Ft(/<\/no(script|embed|frames)/i,T.innerHTML)?(we(T),!0):(re&&T.nodeType===Oo.text&&(q=T.textContent,Ks([M,R,F],$e=>{q=Po(q,$e," ")}),T.textContent!==q&&(Mo(t.removed,{element:T.cloneNode()}),T.textContent=q)),Ne(D.afterSanitizeElements,T,null),!1)},Ke=function(T,q,ae){if(Nt&&(q==="id"||q==="name")&&(ae in n||ae in Un))return!1;if(!(Z&&!I[q]&&Ft(z,q))){if(!(K&&Ft(A,q))){if(!W[q]||I[q]){if(!(lt(T)&&(Y.tagNameCheck instanceof RegExp&&Ft(Y.tagNameCheck,T)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(T))&&(Y.attributeNameCheck instanceof RegExp&&Ft(Y.attributeNameCheck,q)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(q))||q==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&Ft(Y.tagNameCheck,ae)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ae))))return!1}else if(!Ot[q]){if(!Ft(O,Po(ae,j,""))){if(!((q==="src"||q==="xlink:href"||q==="href")&&T!=="script"&&sA(ae,"data:")===0&&Fn[T])){if(!(J&&!Ft(G,Po(ae,j,"")))){if(ae)return!1}}}}}}return!0},lt=function(T){return T!=="annotation-xml"&&Eu(T,_)},Ee=function(T){Ne(D.beforeSanitizeAttributes,T,null);const{attributes:q}=T;if(!q||mt(T))return;const ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let $e=q.length;for(;$e--;){const it=q[$e],{name:Xe,namespaceURI:Et,value:qt}=it,Ge=Ve(Xe),Xt=qt;let Qe=Xe==="value"?Xt:aA(Xt);if(ae.attrName=Ge,ae.attrValue=Qe,ae.keepAttr=!0,ae.forceKeepAttr=void 0,Ne(D.uponSanitizeAttribute,T,ae),Qe=ae.attrValue,tt&&(Ge==="id"||Ge==="name")&&(Oe(Xe,T),Qe=bt+Qe),ie&&Ft(/((--!?|])>)|<\/(style|title)/i,Qe)){Oe(Xe,T);continue}if(ae.forceKeepAttr)continue;if(!ae.keepAttr){Oe(Xe,T);continue}if(!oe&&Ft(/\/>/i,Qe)){Oe(Xe,T);continue}re&&Ks([M,R,F],Ir=>{Qe=Po(Qe,Ir," ")});const $t=Ve(T.nodeName);if(!Ke($t,Ge,Qe)){Oe(Xe,T);continue}if(C&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Et)switch(h.getAttributeType($t,Ge)){case"TrustedHTML":{Qe=C.createHTML(Qe);break}case"TrustedScriptURL":{Qe=C.createScriptURL(Qe);break}}if(Qe!==Xt)try{Et?T.setAttributeNS(Et,Xe,Qe):T.setAttribute(Xe,Qe),mt(T)?we(T):Cu(t.removed)}catch{Oe(Xe,T)}}Ne(D.afterSanitizeAttributes,T,null)},ze=function se(T){let q=null;const ae=Me(T);for(Ne(D.beforeSanitizeShadowDOM,T,null);q=ae.nextNode();)Ne(D.uponSanitizeShadowNode,q,null),ht(q),Ee(q),q.content instanceof a&&se(q.content);Ne(D.afterSanitizeShadowDOM,T,null)};return t.sanitize=function(se){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=null,ae=null,$e=null,it=null;if(Yt=!se,Yt&&(se="<!-->"),typeof se!="string"&&!Ct(se))if(typeof se.toString=="function"){if(se=se.toString(),typeof se!="string")throw Do("dirty is not a string, aborting")}else throw Do("toString is not a function");if(!t.isSupported)return se;if(ue||An(T),t.removed=[],typeof se=="string"&&(ft=!1),ft){if(se.nodeName){const qt=Ve(se.nodeName);if(!H[qt]||P[qt])throw Do("root node is forbidden and cannot be sanitized in-place")}}else if(se instanceof l)q=Be("<!---->"),ae=q.ownerDocument.importNode(se,!0),ae.nodeType===Oo.element&&ae.nodeName==="BODY"||ae.nodeName==="HTML"?q=ae:q.appendChild(ae);else{if(!Re&&!re&&!te&&se.indexOf("<")===-1)return C&&Le?C.createHTML(se):se;if(q=Be(se),!q)return Re?null:Le?k:""}q&&De&&we(q.firstChild);const Xe=Me(ft?se:q);for(;$e=Xe.nextNode();)ht($e),Ee($e),$e.content instanceof a&&ze($e.content);if(ft)return se;if(Re){if(Ae)for(it=N.call(q.ownerDocument);q.firstChild;)it.appendChild(q.firstChild);else it=q;return(W.shadowroot||W.shadowrootmode)&&(it=$.call(r,it,!0)),it}let Et=te?q.outerHTML:q.innerHTML;return te&&H["!doctype"]&&q.ownerDocument&&q.ownerDocument.doctype&&q.ownerDocument.doctype.name&&Ft(nx,q.ownerDocument.doctype.name)&&(Et="<!DOCTYPE "+q.ownerDocument.doctype.name+`>
|
|
127
|
+
`+Et),re&&Ks([M,R,F],qt=>{Et=Po(Et,qt," ")}),C&&Le?C.createHTML(Et):Et},t.setConfig=function(){let se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};An(se),ue=!0},t.clearConfig=function(){Mt=null,ue=!1},t.isValidAttribute=function(se,T,q){Mt||An({});const ae=Ve(se),$e=Ve(T);return Ke(ae,$e,q)},t.addHook=function(se,T){typeof T=="function"&&Mo(D[se],T)},t.removeHook=function(se,T){if(T!==void 0){const q=rA(D[se],T);return q===-1?void 0:oA(D[se],q,1)[0]}return Cu(D[se])},t.removeHooks=function(se){D[se]=[]},t.removeAllHooks=function(){D=Tu()},t}var ox=rx();const yA={replace:e=>{e instanceof vv.Element&&e.attribs&&e.name==="a"&&(e.attribs.target="_blank",e.attribs.rel="noopener noreferrer")}};function fo({children:e,className:t}){if(!e)return null;try{const n=gv.parse(e,{gfm:!0}),r=ox.sanitize(n,{USE_PROFILES:{html:!0}}),o=xv(r,yA);return s.jsx("div",{className:_d(t),children:o})}catch{return s.jsx("div",{className:_d(t),children:e})}}const CA={error:"bg-[var(--color-error-w20)] text-[var(--color-error-wMain)] border-[var(--color-error-wMain)] dark:bg-[var(--color-error-w100)]/60 dark:text-[var(--color-white)] dark:border-[var(--color-error-wMain)]",warning:"bg-[var(--color-warning-w10)] text-[var(--color-warning-wMain)] border-[var(--color-warning-wMain)] dark:bg-[var(--color-warning-w100)]/60 dark:text-[var(--color-white)] dark:border-[var(--color-warning-wMain)]",info:"bg-[var(--color-info-w20)] text-[var(--color-info-wMain)] border-[var(--color-info-wMain)] dark:bg-[var(--color-info-w100)]/60 dark:text-[var(--color-white)] dark:border-[var(--color-info-wMain)]",success:"bg-[var(--color-success-w20)] text-[var(--color-success-wMain)] border-[var(--color-success-w40)] dark:bg-[var(--color-success-w100)]/60 dark:text-[var(--color-white)] dark:border-l-[var(--color-success-w70)]"},EA=Ar("flex items-center gap-3 px-4 py-3 text-sm font-medium transition-all border-l-4 border-solid ",{variants:{variant:CA},defaultVariants:{variant:"error"}}),SA={error:cs,warning:wv,info:Aa,success:sf};function br({className:e,variant:t="error",message:n,action:r,buttonText:o,dismissible:a=!1,onDismiss:i,...l}){const c=SA[t||"error"];return s.jsxs("div",{className:me(EA({variant:t,className:e}),"items-start"),role:"alert","aria-live":"polite",...l,children:[s.jsx(c,{className:"size-5 shrink-0"}),s.jsx("span",{children:n}),s.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r&&o&&s.jsx(ne,{variant:"link",className:"h-min p-0 font-normal text-current underline hover:text-current/60 dark:hover:text-white",onClick:r,children:o}),a&&i&&s.jsx(ne,{variant:"link",className:"h-min self-center p-0",onClick:i,"aria-label":"Dismiss",children:s.jsx(ls,{className:"size-3"})})]})]})}function NA({width:e=24,height:t=24}){const{currentTheme:n}=Xa(),r=n==="dark"?"var(--color-background-wMain)":"var(--color-background-w10)",o=n==="dark"?"var(--color-error-w100)":"var(--color-error-w10)";return s.jsxs("svg",{width:e,height:t,focusable:"false","aria-hidden":"true",viewBox:"0 0 131 131",fill:"none",children:[s.jsx("path",{d:"M119.681 63.9952C119.681 94.0948 95.2807 118.495 65.1812 118.495C35.0816 118.495 10.6812 94.0948 10.6812 63.9952C10.6812 33.8957 35.0816 9.49524 65.1812 9.49524C95.2807 9.49524 119.681 33.8957 119.681 63.9952Z",fill:o}),s.jsx("path",{d:"M2.68115 119.495H128.681V120.495H2.68115V119.495Z",fill:"var(--color-secondary-wMain)"}),s.jsx("rect",{x:14,y:34,width:104.054,height:70.6982,rx:1,fill:r,stroke:"var(--color-secondary-wMain)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M59.4929 105.314C59.6018 104.866 60.0032 104.55 60.4646 104.55H72.4448C72.9061 104.55 73.3076 104.866 73.4165 105.314L75.1457 112.433C75.2986 113.062 74.8218 113.669 74.174 113.669H58.7354C58.0876 113.669 57.6107 113.062 57.7637 112.433L59.4929 105.314Z",fill:r,stroke:"var(--color-secondary-wMain)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M47.7852 114.103C47.7852 113.55 48.2329 113.103 48.7852 113.103H83.2724C83.8247 113.103 84.2724 113.55 84.2724 114.103V118.656C84.2724 119.208 83.8247 119.656 83.2724 119.656H48.7852C48.2329 119.656 47.7852 119.208 47.7852 118.656V114.103Z",fill:r,stroke:"var(--color-secondary-wMain)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M15.1406 95.0068H117.773",stroke:"var(--color-secondary-wMain)",strokeWidth:2}),s.jsxs("g",{clipPath:"url(#clip0_1688:196070)",children:[s.jsx("rect",{opacity:.2,x:54.1126,y:45.1681,width:24.1,height:24.1,stroke:"var(--color-secondary-wMain)",strokeWidth:.1}),s.jsx("path",{d:"M65.6426 60.1142C65.5359 60.1142 65.4453 60.0769 65.3706 60.0022C65.2959 59.9275 65.2586 59.8369 65.2586 59.7302V52.4022C65.2586 52.2955 65.2959 52.2049 65.3706 52.1302C65.4453 52.0555 65.5359 52.0182 65.6426 52.0182H66.9386C67.0559 52.0182 67.1466 52.0555 67.2106 52.1302C67.2853 52.1942 67.3226 52.2849 67.3226 52.4022V59.7302C67.3226 59.8369 67.2853 59.9275 67.2106 60.0022C67.1466 60.0769 67.0559 60.1142 66.9386 60.1142H65.6426ZM65.5466 63.2182C65.4399 63.2182 65.3493 63.1809 65.2746 63.1062C65.1999 63.0315 65.1626 62.9409 65.1626 62.8342V61.3462C65.1626 61.2289 65.1999 61.1329 65.2746 61.0582C65.3493 60.9835 65.4399 60.9462 65.5466 60.9462H67.0346C67.1519 60.9462 67.2479 60.9835 67.3226 61.0582C67.3973 61.1329 67.4346 61.2289 67.4346 61.3462V62.8342C67.4346 62.9409 67.3973 63.0315 67.3226 63.1062C67.2479 63.1809 67.1519 63.2182 67.0346 63.2182H65.5466Z",fill:"var(--color-secondary-wMain)"})]}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3433 73.2659C51.3433 72.9897 51.5671 72.7659 51.8433 72.7659H80.2102C80.4864 72.7659 80.7102 72.9897 80.7102 73.2659C80.7102 73.542 80.4864 73.7659 80.2102 73.7659H51.8433C51.5671 73.7659 51.3433 73.542 51.3433 73.2659Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M55.1851 83.2659C55.1851 82.9897 55.3503 82.7659 55.5542 82.7659H76.4995C76.7034 82.7659 76.8687 82.9897 76.8687 83.2659C76.8687 83.542 76.7034 83.7659 76.4995 83.7659H55.5542C55.3503 83.7659 55.1851 83.542 55.1851 83.2659Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3433 78.2659C51.3433 77.9897 51.5671 77.7659 51.8433 77.7659H80.2102C80.4864 77.7659 80.7102 77.9897 80.7102 78.2659C80.7102 78.542 80.4864 78.7659 80.2102 78.7659H51.8433C51.5671 78.7659 51.3433 78.542 51.3433 78.2659Z",fill:"var(--color-secondary-wMain)"}),s.jsx("defs",{children:s.jsx("clipPath",{id:"clip0_1688:196070",children:s.jsx("rect",{width:24,height:24,fill:r,transform:"translate(54.1626 45.2181)"})})})]})}function jA({width:e=24,height:t=24}){const{currentTheme:n}=Xa(),r=n==="dark"?"var(--color-background-wMain)":"var(--color-background-w10)";return s.jsxs("svg",{width:e,height:t,viewBox:"0 0 130 130",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsxs("g",{clipPath:"url(#clip0_483_284)",children:[s.jsx("path",{opacity:.1,d:"M130 61.4874C130 95.4459 102.471 122.975 68.5125 122.975C34.554 122.975 7.02515 95.4459 7.02515 61.4874C7.02515 27.5288 34.554 0 68.5125 0C102.471 0 130 27.5288 130 61.4874Z",fill:"var(--color-info-wMain)"}),s.jsx("path",{d:"M0 25.9979C0 24.1286 1.51535 22.6133 3.38463 22.6133H41.082C49.1822 22.6133 55.7487 29.1798 55.7487 37.28V116.273C55.7487 118.142 54.2333 119.657 52.3641 119.657H3.38463C1.51535 119.657 0 118.142 0 116.273V25.9979Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M41.082 24.8697H3.38463C2.76154 24.8697 2.25642 25.3748 2.25642 25.9979V116.273C2.25642 116.896 2.76153 117.401 3.38463 117.401H52.3641C52.9871 117.401 53.4923 116.896 53.4923 116.273V37.28C53.4923 30.426 47.936 24.8697 41.082 24.8697ZM3.38463 22.6133C1.51535 22.6133 0 24.1286 0 25.9979V116.273C0 118.142 1.51535 119.657 3.38463 119.657H52.3641C54.2333 119.657 55.7487 118.142 55.7487 116.273V37.28C55.7487 29.1798 49.1822 22.6133 41.082 22.6133H3.38463Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M53.0258 112.821H2.25642V116.206C2.25642 116.829 2.76153 117.334 3.38462 117.334H51.8976C52.5207 117.334 53.0258 116.829 53.0258 116.206V112.821ZM0 110.565V116.206C0 118.075 1.51535 119.59 3.38462 119.59H51.8976C53.7669 119.59 55.2822 118.075 55.2822 116.206V110.565H0Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M51.8977 38.3591C51.8977 29.6358 58.9693 22.5642 67.6926 22.5642H107.18C109.049 22.5642 110.564 24.0796 110.564 25.9488V116.206C110.564 118.075 109.049 119.59 107.18 119.59H55.2823C53.413 119.59 51.8977 118.075 51.8977 116.206V38.3591Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M107.18 24.8206H67.6926C60.2155 24.8206 54.1541 30.882 54.1541 38.3591V116.206C54.1541 116.829 54.6592 117.334 55.2823 117.334H107.18C107.803 117.334 108.308 116.829 108.308 116.206V25.9488C108.308 25.3257 107.803 24.8206 107.18 24.8206ZM67.6926 22.5642C58.9693 22.5642 51.8977 29.6358 51.8977 38.3591V116.206C51.8977 118.075 53.413 119.59 55.2823 119.59H107.18C109.049 119.59 110.564 118.075 110.564 116.206V25.9488C110.564 24.0796 109.049 22.5642 107.18 22.5642H67.6926Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M108.308 112.821H54.1541V116.206C54.1541 116.829 54.6592 117.334 55.2823 117.334H107.18C107.803 117.334 108.308 116.829 108.308 116.206V112.821ZM51.8977 110.565V116.206C51.8977 118.075 53.413 119.59 55.2823 119.59H107.18C109.049 119.59 110.564 118.075 110.564 116.206V110.565H51.8977Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.0351 36.0336C29.0351 35.722 29.2876 35.4695 29.5992 35.4695H43.0726C43.3842 35.4695 43.6367 35.722 43.6367 36.0336C43.6367 36.3451 43.3842 36.5977 43.0726 36.5977H29.5992C29.2876 36.5977 29.0351 36.3451 29.0351 36.0336ZM29.0351 42.7441C29.0351 42.4325 29.2876 42.1799 29.5992 42.1799H43.0726C43.3842 42.1799 43.6367 42.4325 43.6367 42.7441C43.6367 43.0556 43.3842 43.3082 43.0726 43.3082H29.5992C29.2876 43.3082 29.0351 43.0556 29.0351 42.7441ZM29.0351 49.4545C29.0351 49.143 29.2876 48.8904 29.5992 48.8904H43.0726C43.3842 48.8904 43.6367 49.143 43.6367 49.4545C43.6367 49.7661 43.3842 50.0186 43.0726 50.0186H29.5992C29.2876 50.0186 29.0351 49.7661 29.0351 49.4545ZM9.75977 60.2946C9.75977 59.983 10.0123 59.7305 10.3239 59.7305H23.7973C24.1089 59.7305 24.3614 59.983 24.3614 60.2946C24.3614 60.6061 24.1089 60.8587 23.7973 60.8587H10.3239C10.0123 60.8587 9.75977 60.6061 9.75977 60.2946ZM9.75977 67.0051C9.75977 66.6935 10.0123 66.4409 10.3239 66.4409H23.7973C24.1089 66.4409 24.3614 66.6935 24.3614 67.0051C24.3614 67.3166 24.1089 67.5692 23.7973 67.5692H10.3239C10.0123 67.5692 9.75977 67.3166 9.75977 67.0051ZM9.75977 73.7155C9.75977 73.404 10.0123 73.1514 10.3239 73.1514H23.7973C24.1089 73.1514 24.3614 73.404 24.3614 73.7155C24.3614 74.0271 24.1089 74.2796 23.7973 74.2796H10.3239C10.0123 74.2796 9.75977 74.0271 9.75977 73.7155Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 83.5231C9.75977 83.2116 10.0123 82.959 10.3239 82.959H42.3277C42.6393 82.959 42.8918 83.2116 42.8918 83.5231C42.8918 83.8347 42.6393 84.0872 42.3277 84.0872H10.3239C10.0123 84.0872 9.75977 83.8347 9.75977 83.5231Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 93.8473C9.75977 93.5357 10.0123 93.2832 10.3239 93.2832H42.3277C42.6393 93.2832 42.8918 93.5357 42.8918 93.8473C42.8918 94.1588 42.6393 94.4114 42.3277 94.4114H10.3239C10.0123 94.4114 9.75977 94.1588 9.75977 93.8473Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 88.6852C9.75977 88.3737 10.0123 88.1211 10.3239 88.1211H42.3277C42.6393 88.1211 42.8918 88.3737 42.8918 88.6852C42.8918 88.9967 42.6393 89.2493 42.3277 89.2493H10.3239C10.0123 89.2493 9.75977 88.9967 9.75977 88.6852Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 99.0089C9.75977 98.6974 10.0123 98.4448 10.3239 98.4448H42.3277C42.6393 98.4448 42.8918 98.6974 42.8918 99.0089C42.8918 99.3205 42.6393 99.573 42.3277 99.573H10.3239C10.0123 99.573 9.75977 99.3205 9.75977 99.0089Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M22.9252 42.8986C22.9252 46.6372 19.8945 49.6679 16.156 49.6679C12.4174 49.6679 9.38672 46.6372 9.38672 42.8986C9.38672 39.1601 12.4174 36.1294 16.156 36.1294C19.8945 36.1294 22.9252 39.1601 22.9252 42.8986Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.156 47.4115C18.6483 47.4115 20.6688 45.391 20.6688 42.8986C20.6688 40.4063 18.6483 38.3858 16.156 38.3858C13.6636 38.3858 11.6431 40.4063 11.6431 42.8986C11.6431 45.391 13.6636 47.4115 16.156 47.4115ZM16.156 49.6679C19.8945 49.6679 22.9252 46.6372 22.9252 42.8986C22.9252 39.1601 19.8945 36.1294 16.156 36.1294C12.4174 36.1294 9.38672 39.1601 9.38672 42.8986C9.38672 46.6372 12.4174 49.6679 16.156 49.6679Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M31.5107 63.1795C31.5107 61.9333 32.521 60.9231 33.7672 60.9231H40.5364C41.7826 60.9231 42.7928 61.9334 42.7928 63.1795V68.9231C42.7928 70.1693 41.7826 71.1796 40.5364 71.1796H33.7672C32.521 71.1796 31.5107 70.1693 31.5107 68.9231V63.1795Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40.5364 63.1795H33.7672V68.9231H40.5364V63.1795ZM33.7672 60.9231C32.521 60.9231 31.5107 61.9333 31.5107 63.1795V68.9231C31.5107 70.1693 32.521 71.1796 33.7672 71.1796H40.5364C41.7826 71.1796 42.7928 70.1693 42.7928 68.9231V63.1795C42.7928 61.9334 41.7826 60.9231 40.5364 60.9231H33.7672Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M102.325 102.029C101.702 100.949 102.072 99.5694 103.151 98.9463L107.108 96.6618C108.188 96.0387 109.568 96.4084 110.191 97.4877L123.409 120.382C124.032 121.461 123.662 122.841 122.583 123.464L118.626 125.749C117.547 126.372 116.167 126.002 115.543 124.923L102.325 102.029Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M108.237 98.6159L104.28 100.9L117.498 123.795L121.455 121.51L108.237 98.6159ZM103.151 98.9463C102.072 99.5694 101.702 100.949 102.325 102.029L115.543 124.923C116.167 126.002 117.547 126.372 118.626 125.749L122.583 123.464C123.662 122.841 124.032 121.461 123.409 120.382L110.191 97.4877C109.568 96.4084 108.188 96.0387 107.108 96.6618L103.151 98.9463Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M115.803 66.4824C115.803 82.3642 102.928 95.239 87.0466 95.239C71.1648 95.239 58.29 82.3642 58.29 66.4824C58.29 50.6006 71.1648 37.7258 87.0466 37.7258C102.928 37.7258 115.803 50.6006 115.803 66.4824Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M87.0466 92.9825C101.682 92.9825 113.547 81.118 113.547 66.4824C113.547 51.8468 101.682 39.9822 87.0466 39.9822C72.411 39.9822 60.5465 51.8468 60.5465 66.4824C60.5465 81.118 72.411 92.9825 87.0466 92.9825ZM87.0466 95.239C102.928 95.239 115.803 82.3642 115.803 66.4824C115.803 50.6006 102.928 37.7258 87.0466 37.7258C71.1648 37.7258 58.29 50.6006 58.29 66.4824C58.29 82.3642 71.1648 95.239 87.0466 95.239Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M109.771 66.4825C109.771 79.0329 99.5964 89.2071 87.0459 89.2071C74.4954 89.2071 64.3213 79.0329 64.3213 66.4825C64.3213 53.932 74.4954 43.7578 87.0459 43.7578C99.5964 43.7578 109.771 53.932 109.771 66.4825Z",fill:r}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M87.0459 86.9507C98.3502 86.9507 107.514 77.7868 107.514 66.4825C107.514 55.1782 98.3502 46.0142 87.0459 46.0142C75.7416 46.0142 66.5777 55.1782 66.5777 66.4825C66.5777 77.7868 75.7416 86.9507 87.0459 86.9507ZM87.0459 89.2071C99.5964 89.2071 109.771 79.0329 109.771 66.4825C109.771 53.932 99.5964 43.7578 87.0459 43.7578C74.4954 43.7578 64.3213 53.932 64.3213 66.4825C64.3213 79.0329 74.4954 89.2071 87.0459 89.2071Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M86.4824 49.2829C86.4824 48.9713 86.735 48.7188 87.0465 48.7188C96.8572 48.7188 104.81 56.6717 104.81 66.4823C104.81 66.7939 104.558 67.0465 104.246 67.0465C103.935 67.0465 103.682 66.7939 103.682 66.4823C103.682 57.2948 96.2341 49.847 87.0465 49.847C86.735 49.847 86.4824 49.5944 86.4824 49.2829ZM72.0594 74.9461C72.3254 74.7838 72.6725 74.868 72.8348 75.134C73.8285 76.7627 75.0945 78.2075 76.5695 79.4049C77.4599 80.1277 78.4264 80.7603 79.4549 81.2888C81.7303 82.4579 84.3105 83.1178 87.0465 83.1178C87.3581 83.1178 87.6106 83.3704 87.6106 83.6819C87.6106 83.9935 87.3581 84.2461 87.0465 84.2461C84.127 84.2461 81.3705 83.5413 78.9393 82.2922C77.8408 81.7278 76.8089 81.0524 75.8584 80.2808C74.2841 79.0028 72.9327 77.4606 71.8717 75.7216C71.7094 75.4556 71.7935 75.1084 72.0594 74.9461Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M104.511 99.0423L100.011 91.2478L101.965 90.1196L106.465 97.9141L104.511 99.0423Z",fill:"var(--color-secondary-wMain)"}),s.jsx("path",{d:"M86.2924 72.1957C86.1299 72.1957 85.9945 72.1505 85.8862 72.0603C85.7779 71.952 85.7238 71.8076 85.7238 71.6271C85.7238 71.4465 85.7238 71.266 85.7238 71.0855C85.7238 70.905 85.7238 70.7245 85.7238 70.544C85.7599 69.7678 85.9314 69.0818 86.2382 68.4861C86.5451 67.8904 86.9152 67.3489 87.3484 66.8615C87.7997 66.3741 88.251 65.9138 88.7023 65.4806C89.1535 65.0293 89.5326 64.578 89.8395 64.1267C90.1644 63.6754 90.363 63.1971 90.4352 62.6916C90.5074 62.0418 90.381 61.5003 90.0561 61.067C89.7312 60.6157 89.2889 60.2728 88.7293 60.0381C88.1697 59.8034 87.5921 59.6861 86.9964 59.6861C86.0397 59.6861 85.2183 59.9388 84.5324 60.4442C83.8645 60.9316 83.4222 61.762 83.2056 62.9353C83.1515 63.1519 83.0612 63.3054 82.9348 63.3956C82.8085 63.4859 82.6641 63.531 82.5016 63.531H81.2019C81.0395 63.531 80.895 63.4769 80.7687 63.3686C80.6604 63.2603 80.6062 63.1158 80.6062 62.9353C80.6243 62.1952 80.7867 61.4912 81.0936 60.8233C81.4005 60.1554 81.8337 59.5688 82.3933 59.0633C82.9709 58.5579 83.6479 58.1608 84.4241 57.8719C85.2183 57.5651 86.1029 57.4116 87.0776 57.4116C88.1788 57.4116 89.1174 57.5651 89.8936 57.8719C90.6879 58.1608 91.3197 58.5579 91.789 59.0633C92.2764 59.5507 92.6284 60.0922 92.845 60.6879C93.0616 61.2836 93.1519 61.8793 93.1158 62.475C93.0617 63.1971 92.8811 63.8469 92.5743 64.4246C92.2674 64.9842 91.8973 65.5076 91.4641 65.995C91.0309 66.4644 90.5886 66.9337 90.1373 67.403C89.7041 67.8543 89.325 68.3327 89.0001 68.8381C88.6932 69.3255 88.5217 69.858 88.4856 70.4357C88.4676 70.6342 88.4495 70.8328 88.4315 71.0314C88.4315 71.2119 88.4315 71.3924 88.4315 71.5729C88.3954 71.7715 88.3232 71.9249 88.2149 72.0332C88.1066 72.1415 87.9531 72.1957 87.7546 72.1957H86.2924ZM86.0758 76.6363C85.8953 76.6363 85.7418 76.5821 85.6155 76.4738C85.5072 76.3475 85.453 76.194 85.453 76.0135V74.3618C85.453 74.1813 85.5072 74.0369 85.6155 73.9286C85.7418 73.8022 85.8953 73.7391 86.0758 73.7391H87.8358C88.0344 73.7391 88.1878 73.8022 88.2961 73.9286C88.4225 74.0369 88.4856 74.1813 88.4856 74.3618V76.0135C88.4856 76.194 88.4225 76.3475 88.2961 76.4738C88.1878 76.5821 88.0344 76.6363 87.8358 76.6363H86.0758Z",fill:"var(--color-secondary-wMain)"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"clip0_483_284",children:s.jsx("rect",{width:130,height:130,fill:r})})})]})}function ns({title:e,subtitle:t,image:n,variant:r="error",buttons:o,className:a}){const i={error:s.jsx(NA,{width:150,height:150}),notFound:s.jsx(jA,{width:150,height:150}),loading:s.jsx(cr,{size:"large"}),noImage:null};return s.jsxs("div",{className:me("flex h-full w-full flex-col items-center justify-center gap-3",a),children:[n||i[r]||null,s.jsx("p",{className:"mt-4 text-lg",children:e}),t?s.jsx("p",{className:"text-sm",children:t}):null,s.jsx("div",{className:"flex gap-2",children:o&&o.map(({text:l,variant:c,onClick:u},p)=>s.jsx(ne,{testid:l,title:l,variant:c,onClick:u,children:l},`button-${l}-${p}`))})]})}const AA=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"audio/mpeg"};base64,${e}`;return s.jsx("div",{className:"flex h-auto max-w-[100vw] items-center justify-center p-4",children:s.jsxs("audio",{controls:!0,className:"w-full",onLoad:()=>n(null),onError:()=>n("Failed to load audio content."),children:[s.jsx("source",{src:r,type:t||"audio/mpeg"}),"Your browser does not support the audio element."]})})},kA=e=>{if(!e)return[];const t=[];let n=[],r="",o=!1;for(let a=0;a<e.length;a++){const i=e[a],l=a<e.length-1?e[a+1]:"";i==='"'?l==='"'?(r+='"',a++):o=!o:i===","&&!o?(n.push(r.trim()),r=""):(i===`
|
|
128
|
+
`||i==="\r"&&l===`
|
|
129
|
+
`)&&!o?(i==="\r"&&l===`
|
|
130
|
+
`&&a++,n.push(r.trim()),r="",n.some(c=>c.trim())?(t.push(n),n=[]):n=[]):r+=i}return(r||n.length>0)&&(n.push(r.trim()),n.some(a=>a.trim())&&t.push(n)),t},TA=({content:e,setRenderError:t})=>{d.useEffect(()=>{t(null)},[e,t]);const n=d.useMemo(()=>{try{return kA(e)}catch(r){return console.error("Error parsing CSV:",r),t("Failed to parse CSV content."),[]}},[e,t]);return n.length?s.jsx("div",{className:"block w-full overflow-x-scroll p-4",children:s.jsx("div",{style:{minWidth:"min(100%, max-content)"},children:s.jsxs("table",{className:"w-full border text-sm",children:[s.jsx("thead",{className:"sticky top-0 z-10 shadow-sm",children:n.length>0&&s.jsx("tr",{children:n[0].map((r,o)=>s.jsx("th",{className:"border-b p-2 text-left font-medium whitespace-nowrap",title:r,children:(r==null?void 0:r.trim())||""},`header-${o}`))})}),s.jsx("tbody",{children:n.slice(1).map((r,o)=>s.jsx("tr",{className:o%2===0?"bg-muted dark:bg-gray-700":"",children:r.map((a,i)=>s.jsx("td",{className:"min-w-0 border-b p-2 align-top break-words",title:a,children:(a==null?void 0:a.trim())||""},`cell-${o}-${i}`))},`row-${o}`))})]})})}):s.jsx("div",{children:"No valid CSV content found or failed to parse."})},_A=({content:e,setRenderError:t})=>{const n=d.useMemo(()=>e.replace(/<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi,(a,i)=>{const l=a.match(/<script(\s[^>]*)?>/i);return`<script${l&&l[1]?l[1]:""}>(function() {
|
|
131
|
+
try {
|
|
132
|
+
${i}
|
|
133
|
+
} catch (e) { console.error('Error in sandboxed script:', e); }
|
|
134
|
+
})();<\/script>`}),[e]);return s.jsx("div",{className:"h-full w-full overflow-hidden border dark:bg-gray-400",children:s.jsx("iframe",{srcDoc:n,title:"HTML Preview",sandbox:"allow-scripts allow-same-origin allow-downloads allow-forms allow-popups",allow:"autoplay",className:"h-full w-full border-none",onError:()=>t("Failed to load HTML content."),onLoad:()=>t(null)})})},IA=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"image/png"};base64,${e}`;return s.jsx("div",{className:"flex h-auto w-auto max-w-[100vw] items-center justify-center p-4",children:s.jsx("img",{src:r,onError:()=>n("Failed to load image"),onLoad:()=>n(null),alt:"Preview",className:"h-full w-full object-contain"})})};function sx(){const e=d.useRef(null),t=()=>{if(e.current){const r=document.createRange();r.selectNodeContents(e.current);const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}};return{ref:e,handleKeyDown:r=>{(r.metaKey||r.ctrlKey)&&r.key==="a"&&(r.preventDefault(),t())},selectAllContent:t}}const RA=({content:e})=>{const{ref:t,handleKeyDown:n}=sx();return s.jsx("div",{className:"w-full p-4",children:s.jsx("div",{ref:t,className:"max-w-full overflow-hidden select-text focus-visible:outline-none",tabIndex:0,onKeyDown:n,children:s.jsx(fo,{className:"max-w-full break-words",children:e})})})},MA=({content:e,setRenderError:t})=>{const[n,r]=d.useState(""),o=d.useMemo(()=>ox.sanitize(e,{USE_PROFILES:{html:!1},ALLOWED_TAGS:["br","em","strong","b","i"],ALLOWED_ATTR:[]}),[e]);return d.useEffect(()=>{r(`<!DOCTYPE html>
|
|
135
|
+
<html>
|
|
136
|
+
<head>
|
|
137
|
+
<meta charset="utf-8">
|
|
138
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
139
|
+
<title>Mermaid Preview</title>
|
|
140
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"><\/script>
|
|
141
|
+
<script src="https://cdn.jsdelivr.net/npm/panzoom@9.4.0/dist/panzoom.min.js"><\/script>
|
|
142
|
+
<script>
|
|
143
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
144
|
+
try {
|
|
145
|
+
mermaid.initialize({
|
|
146
|
+
startOnLoad: true,
|
|
147
|
+
theme: 'default',
|
|
148
|
+
fontFamily: 'arial, sans-serif',
|
|
149
|
+
logLevel: 'error',
|
|
150
|
+
securityLevel: 'strict'
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Initialize panzoom after Mermaid rendering
|
|
154
|
+
mermaid.run().then(() => {
|
|
155
|
+
const diagramContainer = document.getElementById('diagram-container');
|
|
156
|
+
if (diagramContainer) {
|
|
157
|
+
const pz = panzoom(diagramContainer, {
|
|
158
|
+
maxZoom: 10,
|
|
159
|
+
minZoom: 0.1,
|
|
160
|
+
smoothScroll: true,
|
|
161
|
+
bounds: true,
|
|
162
|
+
boundsPadding: 0.1
|
|
163
|
+
});
|
|
164
|
+
// Add zoom controls (old version had only reset)
|
|
165
|
+
const resetButton = document.getElementById('reset');
|
|
166
|
+
if (resetButton) {
|
|
167
|
+
resetButton.addEventListener('click', () => {
|
|
168
|
+
pz.moveTo(0, 0);
|
|
169
|
+
pz.zoomAbs(0, 0, 1);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}).catch(err => {
|
|
174
|
+
console.error("Mermaid rendering failed inside iframe:", err);
|
|
175
|
+
const mermaidDiv = document.querySelector('.mermaid');
|
|
176
|
+
if (mermaidDiv) mermaidDiv.innerText = "Error rendering diagram: " + err.message;
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
window.addEventListener('message', function(event) {
|
|
180
|
+
if (event.data && event.data.action === 'getMermaidSvg') {
|
|
181
|
+
const svgElement = document.querySelector('.mermaid svg');
|
|
182
|
+
if (svgElement) {
|
|
183
|
+
if (!svgElement.getAttribute('xmlns')) { // Ensure xmlns for standalone SVG
|
|
184
|
+
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
185
|
+
}
|
|
186
|
+
const svgData = new XMLSerializer().serializeToString(svgElement);
|
|
187
|
+
window.parent.postMessage({
|
|
188
|
+
action: 'downloadSvg',
|
|
189
|
+
svgData: svgData,
|
|
190
|
+
filename: event.data.filename || 'mermaid-diagram.svg'
|
|
191
|
+
}, '*');
|
|
192
|
+
} else {
|
|
193
|
+
console.error('SVG element not found for download inside iframe.');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
} catch (e) {
|
|
198
|
+
console.error("Error initializing Mermaid or Panzoom inside iframe:", e);
|
|
199
|
+
const mermaidDiv = document.querySelector('.mermaid');
|
|
200
|
+
if (mermaidDiv) mermaidDiv.innerText = "Failed to initialize diagram viewer: " + e.message;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
<\/script>
|
|
204
|
+
<style>
|
|
205
|
+
/* Styles from old code */
|
|
206
|
+
html, body {
|
|
207
|
+
height: 100%;
|
|
208
|
+
margin: 0;
|
|
209
|
+
padding: 0;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
font-family: Arial, sans-serif; /* Old font */
|
|
212
|
+
}
|
|
213
|
+
.container {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
height: 100vh;
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
}
|
|
219
|
+
.diagram-wrapper {
|
|
220
|
+
flex: 1;
|
|
221
|
+
overflow: hidden;
|
|
222
|
+
position: relative;
|
|
223
|
+
display: flex;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
align-items: center;
|
|
226
|
+
background-color: #f9f9f9;
|
|
227
|
+
}
|
|
228
|
+
#diagram-container {
|
|
229
|
+
transform-origin: 0 0;
|
|
230
|
+
cursor: grab;
|
|
231
|
+
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
|
232
|
+
background-color: white;
|
|
233
|
+
padding: 20px;
|
|
234
|
+
border-radius: 5px;
|
|
235
|
+
/* Ensure diagram container can hold the content */
|
|
236
|
+
width: auto; /* Adjust as needed, or let content define it */
|
|
237
|
+
height: auto;
|
|
238
|
+
max-width: 100%;
|
|
239
|
+
max-height: 100%;
|
|
240
|
+
}
|
|
241
|
+
#diagram-container:active {
|
|
242
|
+
cursor: grabbing;
|
|
243
|
+
}
|
|
244
|
+
.mermaid {
|
|
245
|
+
display: flex; /* Helps in centering if SVG is smaller */
|
|
246
|
+
justify-content: center;
|
|
247
|
+
align-items: center;
|
|
248
|
+
/* width: 100%; Ensures mermaid div takes space, SVG might scale within it */
|
|
249
|
+
/* height: 100%; */
|
|
250
|
+
}
|
|
251
|
+
.mermaid svg {
|
|
252
|
+
max-width: 100%; /* Ensure SVG scales down if too large */
|
|
253
|
+
max-height: 100%;
|
|
254
|
+
}
|
|
255
|
+
.controls{
|
|
256
|
+
position: fixed;
|
|
257
|
+
bottom: 20px;
|
|
258
|
+
right: 20px;
|
|
259
|
+
z-index: 1000;
|
|
260
|
+
display: flex;
|
|
261
|
+
gap: 5px;
|
|
262
|
+
}
|
|
263
|
+
.control-btn {
|
|
264
|
+
width: 40px;
|
|
265
|
+
height: 40px;
|
|
266
|
+
border-radius: 50%;
|
|
267
|
+
border: none;
|
|
268
|
+
background-color: white;
|
|
269
|
+
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
|
270
|
+
cursor: pointer;
|
|
271
|
+
font-size: 18px;
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
justify-content: center;
|
|
275
|
+
}
|
|
276
|
+
.control-btn:hover {
|
|
277
|
+
background-color: #f0f0f0;
|
|
278
|
+
}
|
|
279
|
+
.instructions {
|
|
280
|
+
position: fixed;
|
|
281
|
+
top: 10px;
|
|
282
|
+
left: 10px;
|
|
283
|
+
background-color: rgba(255,255,255,0.8);
|
|
284
|
+
padding: 5px 10px;
|
|
285
|
+
border-radius: 4px;
|
|
286
|
+
font-size: 12px;
|
|
287
|
+
color: #666;
|
|
288
|
+
}
|
|
289
|
+
</style>
|
|
290
|
+
</head>
|
|
291
|
+
<body>
|
|
292
|
+
<div class="container">
|
|
293
|
+
<div class="diagram-wrapper">
|
|
294
|
+
<div id="diagram-container">
|
|
295
|
+
<div class="mermaid">
|
|
296
|
+
${o}
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
<div class="instructions">
|
|
301
|
+
Drag to pan and scroll to zoom
|
|
302
|
+
</div>
|
|
303
|
+
<div class="controls">
|
|
304
|
+
<button id="reset" class="control-btn" title="Reset View">↺</button>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</body>
|
|
308
|
+
</html>`)},[o]),s.jsx("div",{className:"bg-background h-full p-4",children:s.jsx("iframe",{srcDoc:n,title:"Mermaid Diagram Preview",sandbox:"allow-scripts allow-same-origin allow-downloads",className:"h-96 w-full resize border-none",onError:()=>t("Failed to load Mermaid content."),onLoad:()=>t(null)})})};/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function ax(e){return typeof e>"u"||e===null}function PA(e){return typeof e=="object"&&e!==null}function DA(e){return Array.isArray(e)?e:ax(e)?[]:[e]}function LA(e,t){var n,r,o,a;if(t)for(a=Object.keys(t),n=0,r=a.length;n<r;n+=1)o=a[n],e[o]=t[o];return e}function OA(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function $A(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var FA=ax,zA=PA,UA=DA,BA=OA,HA=$A,WA=LA,vt={isNothing:FA,isObject:zA,toArray:UA,repeat:BA,isNegativeZero:HA,extend:WA};function ix(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
309
|
+
|
|
310
|
+
`+e.mark.snippet),r+" "+n):r}function rs(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=ix(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}rs.prototype=Object.create(Error.prototype);rs.prototype.constructor=rs;rs.prototype.toString=function(t){return this.name+": "+ix(this,t)};var Ut=rs;function Bi(e,t,n,r,o){var a="",i="",l=Math.floor(o/2)-1;return r-t>l&&(a=" ... ",t=r-l+a.length),n-r>l&&(i=" ...",n=r+l-i.length),{str:a+e.slice(t,n).replace(/\t/g,"→")+i,pos:r-t+a.length}}function Hi(e,t){return vt.repeat(" ",t-e.length)+e}function VA(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],o=[],a,i=-1;a=n.exec(e.buffer);)o.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&i<0&&(i=r.length-2);i<0&&(i=r.length-1);var l="",c,u,p=Math.min(e.line+t.linesAfter,o.length).toString().length,f=t.maxLength-(t.indent+p+3);for(c=1;c<=t.linesBefore&&!(i-c<0);c++)u=Bi(e.buffer,r[i-c],o[i-c],e.position-(r[i]-r[i-c]),f),l=vt.repeat(" ",t.indent)+Hi((e.line-c+1).toString(),p)+" | "+u.str+`
|
|
311
|
+
`+l;for(u=Bi(e.buffer,r[i],o[i],e.position,f),l+=vt.repeat(" ",t.indent)+Hi((e.line+1).toString(),p)+" | "+u.str+`
|
|
312
|
+
`,l+=vt.repeat("-",t.indent+p+3+u.pos)+`^
|
|
313
|
+
`,c=1;c<=t.linesAfter&&!(i+c>=o.length);c++)u=Bi(e.buffer,r[i+c],o[i+c],e.position-(r[i]-r[i+c]),f),l+=vt.repeat(" ",t.indent)+Hi((e.line+c+1).toString(),p)+" | "+u.str+`
|
|
314
|
+
`;return l.replace(/\n$/,"")}var GA=VA,YA=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],KA=["scalar","sequence","mapping"];function qA(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function XA(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(YA.indexOf(n)===-1)throw new Ut('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=qA(t.styleAliases||null),KA.indexOf(this.kind)===-1)throw new Ut('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var _t=XA;function _u(e,t){var n=[];return e[t].forEach(function(r){var o=n.length;n.forEach(function(a,i){a.tag===r.tag&&a.kind===r.kind&&a.multi===r.multi&&(o=i)}),n[o]=r}),n}function ZA(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function Nl(e){return this.extend(e)}Nl.prototype.extend=function(t){var n=[],r=[];if(t instanceof _t)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new Ut("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(a){if(!(a instanceof _t))throw new Ut("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Ut("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Ut("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(a){if(!(a instanceof _t))throw new Ut("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(Nl.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=_u(o,"implicit"),o.compiledExplicit=_u(o,"explicit"),o.compiledTypeMap=ZA(o.compiledImplicit,o.compiledExplicit),o};var lx=Nl,cx=new _t("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),dx=new _t("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),ux=new _t("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),fx=new lx({explicit:[cx,dx,ux]});function JA(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function QA(){return null}function ek(e){return e===null}var px=new _t("tag:yaml.org,2002:null",{kind:"scalar",resolve:JA,construct:QA,predicate:ek,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function tk(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function nk(e){return e==="true"||e==="True"||e==="TRUE"}function rk(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var mx=new _t("tag:yaml.org,2002:bool",{kind:"scalar",resolve:tk,construct:nk,predicate:rk,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function ok(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function sk(e){return 48<=e&&e<=55}function ak(e){return 48<=e&&e<=57}function ik(e){if(e===null)return!1;var t=e.length,n=0,r=!1,o;if(!t)return!1;if(o=e[n],(o==="-"||o==="+")&&(o=e[++n]),o==="0"){if(n+1===t)return!0;if(o=e[++n],o==="b"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(o!=="0"&&o!=="1")return!1;r=!0}return r&&o!=="_"}if(o==="x"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!ok(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!sk(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!ak(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function lk(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function ck(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!vt.isNegativeZero(e)}var hx=new _t("tag:yaml.org,2002:int",{kind:"scalar",resolve:ik,construct:lk,predicate:ck,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),dk=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function uk(e){return!(e===null||!dk.test(e)||e[e.length-1]==="_")}function fk(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var pk=/^[-+]?[0-9]+e/;function mk(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(vt.isNegativeZero(e))return"-0.0";return n=e.toString(10),pk.test(n)?n.replace("e",".e"):n}function hk(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||vt.isNegativeZero(e))}var gx=new _t("tag:yaml.org,2002:float",{kind:"scalar",resolve:uk,construct:fk,predicate:hk,represent:mk,defaultStyle:"lowercase"}),xx=fx.extend({implicit:[px,mx,hx,gx]}),vx=xx,wx=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),bx=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function gk(e){return e===null?!1:wx.exec(e)!==null||bx.exec(e)!==null}function xk(e){var t,n,r,o,a,i,l,c=0,u=null,p,f,m;if(t=wx.exec(e),t===null&&(t=bx.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,r,o));if(a=+t[4],i=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(p=+t[10],f=+(t[11]||0),u=(p*60+f)*6e4,t[9]==="-"&&(u=-u)),m=new Date(Date.UTC(n,r,o,a,i,l,c)),u&&m.setTime(m.getTime()-u),m}function vk(e){return e.toISOString()}var yx=new _t("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:gk,construct:xk,instanceOf:Date,represent:vk});function wk(e){return e==="<<"||e===null}var Cx=new _t("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wk}),Xc=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
315
|
+
\r`;function bk(e){if(e===null)return!1;var t,n,r=0,o=e.length,a=Xc;for(n=0;n<o;n++)if(t=a.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function yk(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,a=Xc,i=0,l=[];for(t=0;t<o;t++)t%4===0&&t&&(l.push(i>>16&255),l.push(i>>8&255),l.push(i&255)),i=i<<6|a.indexOf(r.charAt(t));return n=o%4*6,n===0?(l.push(i>>16&255),l.push(i>>8&255),l.push(i&255)):n===18?(l.push(i>>10&255),l.push(i>>2&255)):n===12&&l.push(i>>4&255),new Uint8Array(l)}function Ck(e){var t="",n=0,r,o,a=e.length,i=Xc;for(r=0;r<a;r++)r%3===0&&r&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[r];return o=a%3,o===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):o===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):o===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function Ek(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Ex=new _t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bk,construct:yk,predicate:Ek,represent:Ck}),Sk=Object.prototype.hasOwnProperty,Nk=Object.prototype.toString;function jk(e){if(e===null)return!0;var t=[],n,r,o,a,i,l=e;for(n=0,r=l.length;n<r;n+=1){if(o=l[n],i=!1,Nk.call(o)!=="[object Object]")return!1;for(a in o)if(Sk.call(o,a))if(!i)i=!0;else return!1;if(!i)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function Ak(e){return e!==null?e:[]}var Sx=new _t("tag:yaml.org,2002:omap",{kind:"sequence",resolve:jk,construct:Ak}),kk=Object.prototype.toString;function Tk(e){if(e===null)return!0;var t,n,r,o,a,i=e;for(a=new Array(i.length),t=0,n=i.length;t<n;t+=1){if(r=i[t],kk.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;a[t]=[o[0],r[o[0]]]}return!0}function _k(e){if(e===null)return[];var t,n,r,o,a,i=e;for(a=new Array(i.length),t=0,n=i.length;t<n;t+=1)r=i[t],o=Object.keys(r),a[t]=[o[0],r[o[0]]];return a}var Nx=new _t("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Tk,construct:_k}),Ik=Object.prototype.hasOwnProperty;function Rk(e){if(e===null)return!0;var t,n=e;for(t in n)if(Ik.call(n,t)&&n[t]!==null)return!1;return!0}function Mk(e){return e!==null?e:{}}var jx=new _t("tag:yaml.org,2002:set",{kind:"mapping",resolve:Rk,construct:Mk}),Zc=vx.extend({implicit:[yx,Cx],explicit:[Ex,Sx,Nx,jx]}),jr=Object.prototype.hasOwnProperty,ya=1,Ax=2,kx=3,Ca=4,Wi=1,Pk=2,Iu=3,Dk=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Lk=/[\x85\u2028\u2029]/,Ok=/[,\[\]\{\}]/,Tx=/^(?:!|!!|![a-z\-]+!)$/i,_x=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ru(e){return Object.prototype.toString.call(e)}function Kn(e){return e===10||e===13}function Dr(e){return e===9||e===32}function Zt(e){return e===9||e===32||e===10||e===13}function ao(e){return e===44||e===91||e===93||e===123||e===125}function $k(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function Fk(e){return e===120?2:e===117?4:e===85?8:0}function zk(e){return 48<=e&&e<=57?e-48:-1}function Mu(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
316
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function Uk(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Ix=new Array(256),Rx=new Array(256);for(var no=0;no<256;no++)Ix[no]=Mu(no)?1:0,Rx[no]=Mu(no);function Bk(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Zc,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Mx(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=GA(n),new Ut(t,n)}function pe(e,t){throw Mx(e,t)}function Ea(e,t){e.onWarning&&e.onWarning.call(null,Mx(e,t))}var Pu={YAML:function(t,n,r){var o,a,i;t.version!==null&&pe(t,"duplication of %YAML directive"),r.length!==1&&pe(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&pe(t,"ill-formed argument of the YAML directive"),a=parseInt(o[1],10),i=parseInt(o[2],10),a!==1&&pe(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,i!==1&&i!==2&&Ea(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,a;r.length!==2&&pe(t,"TAG directive accepts exactly two arguments"),o=r[0],a=r[1],Tx.test(o)||pe(t,"ill-formed tag handle (first argument) of the TAG directive"),jr.call(t.tagMap,o)&&pe(t,'there is a previously declared suffix for "'+o+'" tag handle'),_x.test(a)||pe(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{pe(t,"tag prefix is malformed: "+a)}t.tagMap[o]=a}};function yr(e,t,n,r){var o,a,i,l;if(t<n){if(l=e.input.slice(t,n),r)for(o=0,a=l.length;o<a;o+=1)i=l.charCodeAt(o),i===9||32<=i&&i<=1114111||pe(e,"expected valid JSON character");else Dk.test(l)&&pe(e,"the stream contains non-printable characters");e.result+=l}}function Du(e,t,n,r){var o,a,i,l;for(vt.isObject(n)||pe(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),i=0,l=o.length;i<l;i+=1)a=o[i],jr.call(t,a)||(t[a]=n[a],r[a]=!0)}function io(e,t,n,r,o,a,i,l,c){var u,p;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),u=0,p=o.length;u<p;u+=1)Array.isArray(o[u])&&pe(e,"nested arrays are not supported inside keys"),typeof o=="object"&&Ru(o[u])==="[object Object]"&&(o[u]="[object Object]");if(typeof o=="object"&&Ru(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(u=0,p=a.length;u<p;u+=1)Du(e,t,a[u],n);else Du(e,t,a,n);else!e.json&&!jr.call(n,o)&&jr.call(t,o)&&(e.line=i||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,pe(e,"duplicated mapping key")),o==="__proto__"?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:a}):t[o]=a,delete n[o];return t}function Jc(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):pe(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ut(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Dr(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(Kn(o))for(Jc(e),o=e.input.charCodeAt(e.position),r++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&Ea(e,"deficient indentation"),r}function ii(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||Zt(n)))}function Qc(e,t){t===1?e.result+=" ":t>1&&(e.result+=vt.repeat(`
|
|
317
|
+
`,t-1))}function Hk(e,t,n){var r,o,a,i,l,c,u,p,f=e.kind,m=e.result,h;if(h=e.input.charCodeAt(e.position),Zt(h)||ao(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(o=e.input.charCodeAt(e.position+1),Zt(o)||n&&ao(o)))return!1;for(e.kind="scalar",e.result="",a=i=e.position,l=!1;h!==0;){if(h===58){if(o=e.input.charCodeAt(e.position+1),Zt(o)||n&&ao(o))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),Zt(r))break}else{if(e.position===e.lineStart&&ii(e)||n&&ao(h))break;if(Kn(h))if(c=e.line,u=e.lineStart,p=e.lineIndent,ut(e,!1,-1),e.lineIndent>=t){l=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=i,e.line=c,e.lineStart=u,e.lineIndent=p;break}}l&&(yr(e,a,i,!1),Qc(e,e.line-c),a=i=e.position,l=!1),Dr(h)||(i=e.position+1),h=e.input.charCodeAt(++e.position)}return yr(e,a,i,!1),e.result?!0:(e.kind=f,e.result=m,!1)}function Wk(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(yr(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,o=e.position;else return!0;else Kn(n)?(yr(e,r,o,!0),Qc(e,ut(e,!1,t)),r=o=e.position):e.position===e.lineStart&&ii(e)?pe(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);pe(e,"unexpected end of the stream within a single quoted scalar")}function Vk(e,t){var n,r,o,a,i,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return yr(e,n,e.position,!0),e.position++,!0;if(l===92){if(yr(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Kn(l))ut(e,!1,t);else if(l<256&&Ix[l])e.result+=Rx[l],e.position++;else if((i=Fk(l))>0){for(o=i,a=0;o>0;o--)l=e.input.charCodeAt(++e.position),(i=$k(l))>=0?a=(a<<4)+i:pe(e,"expected hexadecimal character");e.result+=Uk(a),e.position++}else pe(e,"unknown escape sequence");n=r=e.position}else Kn(l)?(yr(e,n,r,!0),Qc(e,ut(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ii(e)?pe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}pe(e,"unexpected end of the stream within a double quoted scalar")}function Gk(e,t){var n=!0,r,o,a,i=e.tag,l,c=e.anchor,u,p,f,m,h,x=Object.create(null),g,w,v,b;if(b=e.input.charCodeAt(e.position),b===91)p=93,h=!1,l=[];else if(b===123)p=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),b=e.input.charCodeAt(++e.position);b!==0;){if(ut(e,!0,t),b=e.input.charCodeAt(e.position),b===p)return e.position++,e.tag=i,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=l,!0;n?b===44&&pe(e,"expected the node content, but found ','"):pe(e,"missed comma between flow collection entries"),w=g=v=null,f=m=!1,b===63&&(u=e.input.charCodeAt(e.position+1),Zt(u)&&(f=m=!0,e.position++,ut(e,!0,t))),r=e.line,o=e.lineStart,a=e.position,go(e,t,ya,!1,!0),w=e.tag,g=e.result,ut(e,!0,t),b=e.input.charCodeAt(e.position),(m||e.line===r)&&b===58&&(f=!0,b=e.input.charCodeAt(++e.position),ut(e,!0,t),go(e,t,ya,!1,!0),v=e.result),h?io(e,l,x,w,g,v,r,o,a):f?l.push(io(e,null,x,w,g,v,r,o,a)):l.push(g),ut(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}pe(e,"unexpected end of the stream within a flow collection")}function Yk(e,t){var n,r,o=Wi,a=!1,i=!1,l=t,c=0,u=!1,p,f;if(f=e.input.charCodeAt(e.position),f===124)r=!1;else if(f===62)r=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Wi===o?o=f===43?Iu:Pk:pe(e,"repeat of a chomping mode identifier");else if((p=zk(f))>=0)p===0?pe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):i?pe(e,"repeat of an indentation width identifier"):(l=t+p-1,i=!0);else break;if(Dr(f)){do f=e.input.charCodeAt(++e.position);while(Dr(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Kn(f)&&f!==0)}for(;f!==0;){for(Jc(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!i||e.lineIndent<l)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!i&&e.lineIndent>l&&(l=e.lineIndent),Kn(f)){c++;continue}if(e.lineIndent<l){o===Iu?e.result+=vt.repeat(`
|
|
318
|
+
`,a?1+c:c):o===Wi&&a&&(e.result+=`
|
|
319
|
+
`);break}for(r?Dr(f)?(u=!0,e.result+=vt.repeat(`
|
|
320
|
+
`,a?1+c:c)):u?(u=!1,e.result+=vt.repeat(`
|
|
321
|
+
`,c+1)):c===0?a&&(e.result+=" "):e.result+=vt.repeat(`
|
|
322
|
+
`,c):e.result+=vt.repeat(`
|
|
323
|
+
`,a?1+c:c),a=!0,i=!0,c=0,n=e.position;!Kn(f)&&f!==0;)f=e.input.charCodeAt(++e.position);yr(e,n,e.position,!1)}return!0}function Lu(e,t){var n,r=e.tag,o=e.anchor,a=[],i,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,pe(e,"tab characters must not be used in indentation")),!(c!==45||(i=e.input.charCodeAt(e.position+1),!Zt(i))));){if(l=!0,e.position++,ut(e,!0,-1)&&e.lineIndent<=t){a.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,go(e,t,kx,!1,!0),a.push(e.result),ut(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)pe(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0):!1}function Kk(e,t,n){var r,o,a,i,l,c,u=e.tag,p=e.anchor,f={},m=Object.create(null),h=null,x=null,g=null,w=!1,v=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),b=e.input.charCodeAt(e.position);b!==0;){if(!w&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,pe(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),a=e.line,(b===63||b===58)&&Zt(r))b===63?(w&&(io(e,f,m,h,x,null,i,l,c),h=x=g=null),v=!0,w=!0,o=!0):w?(w=!1,o=!0):pe(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=r;else{if(i=e.line,l=e.lineStart,c=e.position,!go(e,n,Ax,!1,!0))break;if(e.line===a){for(b=e.input.charCodeAt(e.position);Dr(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),Zt(b)||pe(e,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(io(e,f,m,h,x,null,i,l,c),h=x=g=null),v=!0,w=!1,o=!1,h=e.tag,x=e.result;else if(v)pe(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=p,!0}else if(v)pe(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=p,!0}if((e.line===a||e.lineIndent>t)&&(w&&(i=e.line,l=e.lineStart,c=e.position),go(e,t,Ca,!0,o)&&(w?x=e.result:g=e.result),w||(io(e,f,m,h,x,g,i,l,c),h=x=g=null),ut(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&b!==0)pe(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return w&&io(e,f,m,h,x,null,i,l,c),v&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),v}function qk(e){var t,n=!1,r=!1,o,a,i;if(i=e.input.charCodeAt(e.position),i!==33)return!1;if(e.tag!==null&&pe(e,"duplication of a tag property"),i=e.input.charCodeAt(++e.position),i===60?(n=!0,i=e.input.charCodeAt(++e.position)):i===33?(r=!0,o="!!",i=e.input.charCodeAt(++e.position)):o="!",t=e.position,n){do i=e.input.charCodeAt(++e.position);while(i!==0&&i!==62);e.position<e.length?(a=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):pe(e,"unexpected end of the stream within a verbatim tag")}else{for(;i!==0&&!Zt(i);)i===33&&(r?pe(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),Tx.test(o)||pe(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),Ok.test(a)&&pe(e,"tag suffix cannot contain flow indicator characters")}a&&!_x.test(a)&&pe(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{pe(e,"tag name is malformed: "+a)}return n?e.tag=a:jr.call(e.tagMap,o)?e.tag=e.tagMap[o]+a:o==="!"?e.tag="!"+a:o==="!!"?e.tag="tag:yaml.org,2002:"+a:pe(e,'undeclared tag handle "'+o+'"'),!0}function Xk(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&pe(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Zt(n)&&!ao(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&pe(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Zk(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Zt(r)&&!ao(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&pe(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),jr.call(e.anchorMap,n)||pe(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ut(e,!0,-1),!0}function go(e,t,n,r,o){var a,i,l,c=1,u=!1,p=!1,f,m,h,x,g,w;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=i=l=Ca===n||kx===n,r&&ut(e,!0,-1)&&(u=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;qk(e)||Xk(e);)ut(e,!0,-1)?(u=!0,l=a,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=u||o),(c===1||Ca===n)&&(ya===n||Ax===n?g=t:g=t+1,w=e.position-e.lineStart,c===1?l&&(Lu(e,w)||Kk(e,w,g))||Gk(e,g)?p=!0:(i&&Yk(e,g)||Wk(e,g)||Vk(e,g)?p=!0:Zk(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&pe(e,"alias node should not have any properties")):Hk(e,g,ya===n)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(p=l&&Lu(e,w))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&pe(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,m=e.implicitTypes.length;f<m;f+=1)if(x=e.implicitTypes[f],x.resolve(e.result)){e.result=x.construct(e.result),e.tag=x.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(jr.call(e.typeMap[e.kind||"fallback"],e.tag))x=e.typeMap[e.kind||"fallback"][e.tag];else for(x=null,h=e.typeMap.multi[e.kind||"fallback"],f=0,m=h.length;f<m;f+=1)if(e.tag.slice(0,h[f].tag.length)===h[f].tag){x=h[f];break}x||pe(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&pe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+x.kind+'", not "'+e.kind+'"'),x.resolve(e.result,e.tag)?(e.result=x.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):pe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function Jk(e){var t=e.position,n,r,o,a=!1,i;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(i=e.input.charCodeAt(e.position))!==0&&(ut(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||i!==37));){for(a=!0,i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!Zt(i);)i=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&pe(e,"directive name must not be less than one character in length");i!==0;){for(;Dr(i);)i=e.input.charCodeAt(++e.position);if(i===35){do i=e.input.charCodeAt(++e.position);while(i!==0&&!Kn(i));break}if(Kn(i))break;for(n=e.position;i!==0&&!Zt(i);)i=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}i!==0&&Jc(e),jr.call(Pu,r)?Pu[r](e,r,o):Ea(e,'unknown document directive "'+r+'"')}if(ut(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,ut(e,!0,-1)):a&&pe(e,"directives end mark is expected"),go(e,e.lineIndent-1,Ca,!1,!0),ut(e,!0,-1),e.checkLineBreaks&&Lk.test(e.input.slice(t,e.position))&&Ea(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ii(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,ut(e,!0,-1));return}if(e.position<e.length-1)pe(e,"end of the stream or a document separator is expected");else return}function Px(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
324
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Bk(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,pe(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Jk(n);return n.documents}function Qk(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=Px(e,n);if(typeof t!="function")return r;for(var o=0,a=r.length;o<a;o+=1)t(r[o])}function eT(e,t){var n=Px(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Ut("expected a single document in the stream, but found more")}}var tT=Qk,nT=eT,Dx={loadAll:tT,load:nT},Lx=Object.prototype.toString,Ox=Object.prototype.hasOwnProperty,ed=65279,rT=9,os=10,oT=13,sT=32,aT=33,iT=34,jl=35,lT=37,cT=38,dT=39,uT=42,$x=44,fT=45,Sa=58,pT=61,mT=62,hT=63,gT=64,Fx=91,zx=93,xT=96,Ux=123,vT=124,Bx=125,Dt={};Dt[0]="\\0";Dt[7]="\\a";Dt[8]="\\b";Dt[9]="\\t";Dt[10]="\\n";Dt[11]="\\v";Dt[12]="\\f";Dt[13]="\\r";Dt[27]="\\e";Dt[34]='\\"';Dt[92]="\\\\";Dt[133]="\\N";Dt[160]="\\_";Dt[8232]="\\L";Dt[8233]="\\P";var wT=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],bT=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function yT(e,t){var n,r,o,a,i,l,c;if(t===null)return{};for(n={},r=Object.keys(t),o=0,a=r.length;o<a;o+=1)i=r[o],l=String(t[i]),i.slice(0,2)==="!!"&&(i="tag:yaml.org,2002:"+i.slice(2)),c=e.compiledTypeMap.fallback[i],c&&Ox.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[i]=l;return n}function CT(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new Ut("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+vt.repeat("0",r-t.length)+t}var ET=1,ss=2;function ST(e){this.schema=e.schema||Zc,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=vt.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=yT(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?ss:ET,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ou(e,t){for(var n=vt.repeat(" ",t),r=0,o=-1,a="",i,l=e.length;r<l;)o=e.indexOf(`
|
|
325
|
+
`,r),o===-1?(i=e.slice(r),r=l):(i=e.slice(r,o+1),r=o+1),i.length&&i!==`
|
|
326
|
+
`&&(a+=n),a+=i;return a}function Al(e,t){return`
|
|
327
|
+
`+vt.repeat(" ",e.indent*t)}function NT(e,t){var n,r,o;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(o=e.implicitTypes[n],o.resolve(t))return!0;return!1}function Na(e){return e===sT||e===rT}function as(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ed||65536<=e&&e<=1114111}function $u(e){return as(e)&&e!==ed&&e!==oT&&e!==os}function Fu(e,t,n){var r=$u(e),o=r&&!Na(e);return(n?r:r&&e!==$x&&e!==Fx&&e!==zx&&e!==Ux&&e!==Bx)&&e!==jl&&!(t===Sa&&!o)||$u(t)&&!Na(t)&&e===jl||t===Sa&&o}function jT(e){return as(e)&&e!==ed&&!Na(e)&&e!==fT&&e!==hT&&e!==Sa&&e!==$x&&e!==Fx&&e!==zx&&e!==Ux&&e!==Bx&&e!==jl&&e!==cT&&e!==uT&&e!==aT&&e!==vT&&e!==pT&&e!==mT&&e!==dT&&e!==iT&&e!==lT&&e!==gT&&e!==xT}function AT(e){return!Na(e)&&e!==Sa}function Vo(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function Hx(e){var t=/^\n* /;return t.test(e)}var Wx=1,kl=2,Vx=3,Gx=4,oo=5;function kT(e,t,n,r,o,a,i,l){var c,u=0,p=null,f=!1,m=!1,h=r!==-1,x=-1,g=jT(Vo(e,0))&&AT(Vo(e,e.length-1));if(t||i)for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=Vo(e,c),!as(u))return oo;g=g&&Fu(u,p,l),p=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=Vo(e,c),u===os)f=!0,h&&(m=m||c-x-1>r&&e[x+1]!==" ",x=c);else if(!as(u))return oo;g=g&&Fu(u,p,l),p=u}m=m||h&&c-x-1>r&&e[x+1]!==" "}return!f&&!m?g&&!i&&!o(e)?Wx:a===ss?oo:kl:n>9&&Hx(e)?oo:i?a===ss?oo:kl:m?Gx:Vx}function TT(e,t,n,r,o){e.dump=function(){if(t.length===0)return e.quotingType===ss?'""':"''";if(!e.noCompatMode&&(wT.indexOf(t)!==-1||bT.test(t)))return e.quotingType===ss?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),i=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(u){return NT(e,u)}switch(kT(t,l,e.indent,i,c,e.quotingType,e.forceQuotes&&!r,o)){case Wx:return t;case kl:return"'"+t.replace(/'/g,"''")+"'";case Vx:return"|"+zu(t,e.indent)+Uu(Ou(t,a));case Gx:return">"+zu(t,e.indent)+Uu(Ou(_T(t,i),a));case oo:return'"'+IT(t)+'"';default:throw new Ut("impossible error: invalid scalar style")}}()}function zu(e,t){var n=Hx(e)?String(t):"",r=e[e.length-1]===`
|
|
328
|
+
`,o=r&&(e[e.length-2]===`
|
|
329
|
+
`||e===`
|
|
330
|
+
`),a=o?"+":r?"":"-";return n+a+`
|
|
331
|
+
`}function Uu(e){return e[e.length-1]===`
|
|
332
|
+
`?e.slice(0,-1):e}function _T(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var u=e.indexOf(`
|
|
333
|
+
`);return u=u!==-1?u:e.length,n.lastIndex=u,Bu(e.slice(0,u),t)}(),o=e[0]===`
|
|
334
|
+
`||e[0]===" ",a,i;i=n.exec(e);){var l=i[1],c=i[2];a=c[0]===" ",r+=l+(!o&&!a&&c!==""?`
|
|
335
|
+
`:"")+Bu(c,t),o=a}return r}function Bu(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,o=0,a,i=0,l=0,c="";r=n.exec(e);)l=r.index,l-o>t&&(a=i>o?i:l,c+=`
|
|
336
|
+
`+e.slice(o,a),o=a+1),i=l;return c+=`
|
|
337
|
+
`,e.length-o>t&&i>o?c+=e.slice(o,i)+`
|
|
338
|
+
`+e.slice(i+1):c+=e.slice(o),c.slice(1)}function IT(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=Vo(e,o),r=Dt[n],!r&&as(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||CT(n);return t}function RT(e,t,n){var r="",o=e.tag,a,i,l;for(a=0,i=n.length;a<i;a+=1)l=n[a],e.replacer&&(l=e.replacer.call(n,String(a),l)),(dr(e,t,l,!1,!1)||typeof l>"u"&&dr(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function Hu(e,t,n,r){var o="",a=e.tag,i,l,c;for(i=0,l=n.length;i<l;i+=1)c=n[i],e.replacer&&(c=e.replacer.call(n,String(i),c)),(dr(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&dr(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=Al(e,t)),e.dump&&os===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=a,e.dump=o||"[]"}function MT(e,t,n){var r="",o=e.tag,a=Object.keys(n),i,l,c,u,p;for(i=0,l=a.length;i<l;i+=1)p="",r!==""&&(p+=", "),e.condenseFlow&&(p+='"'),c=a[i],u=n[c],e.replacer&&(u=e.replacer.call(n,c,u)),dr(e,t,c,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),dr(e,t,u,!1,!1)&&(p+=e.dump,r+=p));e.tag=o,e.dump="{"+r+"}"}function PT(e,t,n,r){var o="",a=e.tag,i=Object.keys(n),l,c,u,p,f,m;if(e.sortKeys===!0)i.sort();else if(typeof e.sortKeys=="function")i.sort(e.sortKeys);else if(e.sortKeys)throw new Ut("sortKeys must be a boolean or a function");for(l=0,c=i.length;l<c;l+=1)m="",(!r||o!=="")&&(m+=Al(e,t)),u=i[l],p=n[u],e.replacer&&(p=e.replacer.call(n,u,p)),dr(e,t+1,u,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&os===e.dump.charCodeAt(0)?m+="?":m+="? "),m+=e.dump,f&&(m+=Al(e,t)),dr(e,t+1,p,!0,f)&&(e.dump&&os===e.dump.charCodeAt(0)?m+=":":m+=": ",m+=e.dump,o+=m));e.tag=a,e.dump=o||"{}"}function Wu(e,t,n){var r,o,a,i,l,c;for(o=n?e.explicitTypes:e.implicitTypes,a=0,i=o.length;a<i;a+=1)if(l=o[a],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(c=e.styleMap[l.tag]||l.defaultStyle,Lx.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(Ox.call(l.represent,c))r=l.represent[c](t,c);else throw new Ut("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function dr(e,t,n,r,o,a,i){e.tag=null,e.dump=n,Wu(e,n,!1)||Wu(e,n,!0);var l=Lx.call(e.dump),c=r,u;r&&(r=e.flowLevel<0||e.flowLevel>t);var p=l==="[object Object]"||l==="[object Array]",f,m;if(p&&(f=e.duplicates.indexOf(n),m=f!==-1),(e.tag!==null&&e.tag!=="?"||m||e.indent!==2&&t>0)&&(o=!1),m&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(p&&m&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(PT(e,t,e.dump,o),m&&(e.dump="&ref_"+f+e.dump)):(MT(e,t,e.dump),m&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!i&&t>0?Hu(e,t-1,e.dump,o):Hu(e,t,e.dump,o),m&&(e.dump="&ref_"+f+e.dump)):(RT(e,t,e.dump),m&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&TT(e,e.dump,t,a,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Ut("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function DT(e,t){var n=[],r=[],o,a;for(Tl(e,n,r),o=0,a=r.length;o<a;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(a)}function Tl(e,t,n){var r,o,a;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)n.indexOf(o)===-1&&n.push(o);else if(t.push(e),Array.isArray(e))for(o=0,a=e.length;o<a;o+=1)Tl(e[o],t,n);else for(r=Object.keys(e),o=0,a=r.length;o<a;o+=1)Tl(e[r[o]],t,n)}function LT(e,t){t=t||{};var n=new ST(t);n.noRefs||DT(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),dr(n,0,r,!0,!0)?n.dump+`
|
|
339
|
+
`:""}var OT=LT,$T={dump:OT};function td(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var FT=_t,zT=lx,UT=fx,BT=xx,HT=vx,WT=Zc,VT=Dx.load,GT=Dx.loadAll,YT=$T.dump,KT=Ut,qT={binary:Ex,float:gx,map:ux,null:px,pairs:Nx,set:jx,timestamp:yx,bool:mx,int:hx,merge:Cx,omap:Sx,seq:dx,str:cx},XT=td("safeLoad","load"),ZT=td("safeLoadAll","loadAll"),JT=td("safeDump","dump"),QT={Type:FT,Schema:zT,FAILSAFE_SCHEMA:UT,JSON_SCHEMA:BT,CORE_SCHEMA:HT,DEFAULT_SCHEMA:WT,load:VT,loadAll:GT,dump:YT,YAMLException:KT,types:qT,safeLoad:XT,safeLoadAll:ZT,safeDump:JT};const e_=({content:e,rendererType:t,setRenderError:n})=>{const[r,o]=d.useState(!1);d.useEffect(()=>{n(null)},[e,n]);const[a,i]=d.useMemo(()=>{try{if(t==="yaml"){const l=QT.load(e);return[e,l]}else if(t==="json"){const l=JSON.parse(e);return[JSON.stringify(l,null,2),l]}throw new Error(`Unsupported renderer type: ${t}`)}catch(l){const c=t==="yaml"?"YAML":"JSON";console.error(`Error parsing ${c} for panel:`,l);const u={[`${c}_Parsing_Error`]:`The provided content is not valid ${c}.`,Details:l.message,Content_Snippet:e.substring(0,500)+(e.length>500?"...":"")};return n(`${c} parsing failed: ${l.message}`),[e,u]}},[e,t,n]);return s.jsxs("div",{className:"bg-background relative flex h-full flex-col overflow-hidden",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(ne,{onClick:()=>o(!r),title:r?"Show Structured View":"Show Raw Text",children:r?s.jsxs(s.Fragment,{children:[s.jsx(af,{})," Structured"]}):s.jsxs(s.Fragment,{children:[s.jsx(lf,{})," Raw Text"]})})}),s.jsx("div",{className:"flex min-h-0 flex-col",children:s.jsx("div",{className:"flex-1 overflow-auto",children:r?s.jsx(Yx,{content:a,setRenderError:n}):s.jsx(Ll,{data:i,maxDepth:4,className:"min-h-16 border-none p-2"})})})]})},Yx=({content:e,className:t=""})=>{const{ref:n,handleKeyDown:r}=sx();return s.jsx("div",{className:`overflow-auto p-4 ${t}`,children:s.jsx("pre",{ref:n,className:"whitespace-pre-wrap select-text focus-visible:outline-none",style:{overflowWrap:"anywhere"},tabIndex:0,onKeyDown:r,children:e})})},nd=({content:e,rendererType:t,mime_type:n,setRenderError:r})=>{switch(t){case"csv":return s.jsx(TA,{content:e,setRenderError:r});case"mermaid":return s.jsx(MA,{content:e,setRenderError:r});case"html":return s.jsx(_A,{content:e,setRenderError:r});case"json":case"yaml":return s.jsx(e_,{content:e,rendererType:t,setRenderError:r});case"image":return s.jsx(IA,{content:e,mime_type:n,setRenderError:r});case"markdown":return s.jsx(RA,{content:e,setRenderError:r});case"audio":return s.jsx(AA,{content:e,mime_type:n,setRenderError:r});default:return s.jsx(Yx,{content:e,setRenderError:r})}},rd=e=>{const t=e.split(".");return t.length>1?t[t.length-1].toUpperCase():"FILE"},_n=e=>{switch(e){case"html":return"bg-[#e34c26]";case"json":return"bg-[#fbc02d] text-[#333]";case"yaml":return"bg-[#cb171e]";case"markdown":return"bg-[#6c757d]";case"text":return"bg-[#5c6bc0]";default:return"bg-gray-500"}},t_=(e,t)=>{const n={className:"text-secondary-foreground/60"};if(e){if(e.startsWith("image/"))return s.jsx(qi,{...n});if(e.startsWith("video/"))return s.jsx(ld,{...n});if(e.startsWith("audio/"))return s.jsx(Ki,{...n});if(e==="application/pdf")return s.jsx(Gn,{...n});if(e==="application/zip"||e==="application/x-zip-compressed"||e==="application/x-rar-compressed"||e==="application/x-tar"||e==="application/gzip")return s.jsx(cd,{...n});if(e.includes("word")||e.includes("document"))return s.jsx(Gn,{...n});if(e.includes("excel")||e.includes("spreadsheet"))return s.jsx(Yi,{...n});if(e.includes("powerpoint")||e.includes("presentation"))return s.jsx(dd,{...n});if(e==="application/x-executable"||e==="application/x-msdownload")return s.jsx(ud,{...n})}switch(t?rd(t).toLowerCase():""){case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":case"svg":case"ico":return s.jsx(qi,{...n});case"mp4":case"avi":case"mov":case"wmv":case"flv":case"webm":case"mkv":return s.jsx(ld,{...n});case"mp3":case"wav":case"flac":case"aac":case"ogg":case"m4a":return s.jsx(Ki,{...n});case"pdf":case"doc":case"docx":return s.jsx(Gn,{...n});case"xls":case"xlsx":case"csv":return s.jsx(Yi,{...n});case"ppt":case"pptx":return s.jsx(dd,{...n});case"zip":case"rar":case"7z":case"tar":case"gz":return s.jsx(cd,{...n});case"exe":case"msi":case"dmg":case"pkg":case"deb":case"rpm":return s.jsx(ud,{...n});case"ttf":case"otf":case"woff":case"woff2":return s.jsx(bv,{...n});case"htm":case"html":return s.jsx(nf,{...n});default:return null}},n_=(e,t)=>{if(e){if(e.startsWith("text/html")||e==="application/xhtml+xml")return _n("html");if(e==="application/json"||e==="text/json")return _n("json");if(e==="application/yaml"||e==="text/yaml"||e==="application/x-yaml"||e==="text/x-yaml")return _n("yaml");if(e.startsWith("text/"))return _n("text");if(e.startsWith("text/markdown")||e==="application/markdown")return _n("markdown")}switch(t?rd(t).toLowerCase():""){case"html":case"htm":return _n("html");case"json":return _n("json");case"yaml":case"yml":return _n("yaml");case"md":case"markdown":return _n("markdown");case"txt":return _n("text");default:return _n("default")}},r_=({filename:e,mimeType:t,className:n})=>{if(!e||typeof e!="string")return console.warn("FileIcon: filename is required and must be a string"),null;const r=rd(e),o=n_(t,e),a=t_(t,e);return s.jsx("div",{className:me("relative flex-shrink-0",n),children:s.jsxs("div",{className:"bg-muted/50 relative h-[75px] w-[60px] border",children:[s.jsx("div",{className:"absolute top-[4px] right-[4px] bottom-[24px] left-[4px] overflow-hidden font-mono text-[3.5px] leading-[1.4]",children:a?s.jsx("div",{className:"flex h-full items-center justify-center",children:a}):s.jsx("div",{className:"text-secondary-foreground flex h-full text-[8px] select-none",children:s.jsx("div",{className:"flex h-full w-full items-center justify-center",children:s.jsx(Gi,{className:"text-secondary-foreground/60"})})})}),s.jsx("div",{className:me("absolute right-[4px] bottom-[4px] z-[4] px-[4px] py-[2px] text-[10px] font-bold text-[var(--color-primary-text-w10)] select-none",o),children:r.length>4?r.substring(0,4):r})]})})},Vu=({message:e})=>s.jsx("div",{className:"w-full rounded-lg border border-[var(--color-error-w100)] bg-[var(--color-error-wMain-50)] p-3",children:s.jsxs("div",{className:"text-sm text-[var(--color-error-wMain)]",children:["Error: ",e]})}),o_=({filename:e,description:t,mimeType:n,size:r,status:o,expandable:a=!1,expanded:i=!1,onToggleExpand:l,actions:c,bytesTransferred:u,error:p,expandedContent:f,context:m="chat",isDeleted:h=!1,version:x,source:g})=>{const[w,v]=d.useState(f);if(d.useEffect(()=>{if(f)v(f);else{const N=setTimeout(()=>{v(void 0)},300);return()=>clearTimeout(N)}},[f]),!e||typeof e!="string")return console.error("ArtifactBar: filename is required and must be a string"),s.jsx(Vu,{message:"Invalid artifact filename"});if(!o||!["in-progress","completed","failed"].includes(o))return console.error("ArtifactBar: status must be one of: in-progress, completed, failed"),s.jsx(Vu,{message:"Invalid artifact status"});const y=(()=>{if(h)return{text:"Deleted",className:"text-[var(--color-secondary-foreground)]"};switch(o){case"in-progress":return{text:u?`Creating... ${(u/1024).toFixed(1)}KB`:"Creating...",className:"text-[var(--color-info-wMain)]"};case"failed":return{text:p||"Failed to create",className:"text-[var(--color-error-wMain)]"};case"completed":return{text:r?`${(r/1024).toFixed(1)}KB`:""};default:return{text:"Unknown",className:"text-[var(--color-secondary-foreground)]"}}})(),k=((N,L=100)=>{if(!N||typeof N!="string")return"";const $=N.replace(/\s+/g," ").trim();if($.length<=L)return $;const D=$.substring(0,L),M=D.lastIndexOf(" ");return M>L*.7?D.substring(0,M)+"...":D+"..."})(t),E=t&&t.trim(),S=()=>{if(o==="completed"&&(c!=null&&c.onPreview))try{c.onPreview()}catch(N){console.error("Preview failed:",N)}};return s.jsxs("div",{className:`dark:bg-muted/30 w-full ${o==="completed"&&(c!=null&&c.onPreview)&&!h?"cursor-pointer transition-all duration-200 ease-in-out hover:shadow-md":""} ${m==="list"?"border-b":"border-border rounded-md border"} ${h?"opacity-60":""}`,onClick:h?void 0:S,children:[s.jsxs("div",{className:"flex min-h-[60px] items-center gap-3 p-3",children:[s.jsx(r_,{filename:e,mimeType:n,size:r,className:"flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1 py-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"truncate text-sm leading-tight font-semibold",title:E?t:e,children:E?k:e.length>50?`${e.substring(0,47)}...`:e}),g==="project"&&s.jsx(Kr,{variant:"outline",className:"text-xs bg-primary/10 border-primary/30 text-primary font-semibold px-2 py-0.5 shadow-sm",children:"Project"})]}),s.jsx("div",{className:"text-secondary-foreground mt-1 flex items-center gap-2 text-xs leading-tight",title:E?e:y.text,children:E?s.jsxs("div",{className:"truncate",children:[e.length>60?`${e.substring(0,57)}...`:e,x!==void 0&&m==="chat"&&s.jsxs("span",{className:"ml-1.5",children:["(v",x,")"]})]}):s.jsxs(s.Fragment,{children:[o==="in-progress"&&s.jsx(cr,{size:"small",variant:"primary"}),s.jsx("span",{className:y.className,children:y.text})]})}),E&&s.jsxs("div",{className:me("mt-0.5 flex items-center gap-2 text-xs leading-tight",y.className),children:[o==="in-progress"&&s.jsx(cr,{size:"small",variant:"primary"}),s.jsx("span",{children:y.text})]})]}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[o==="completed"&&(c==null?void 0:c.onInfo)&&!h&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:N=>{var L;N.stopPropagation();try{(L=c.onInfo)==null||L.call(c)}catch($){console.error("Info failed:",$)}},tooltip:"Info",children:s.jsx(Aa,{className:"h-4 w-4"})}),o==="completed"&&(c==null?void 0:c.onDownload)&&!h&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:N=>{var L;N.stopPropagation();try{(L=c.onDownload)==null||L.call(c)}catch($){console.error("Download failed:",$)}},tooltip:"Download",children:s.jsx(bo,{className:"h-4 w-4"})}),o==="completed"&&(c==null?void 0:c.onExpand)&&!h&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:N=>{var L;N.stopPropagation();try{(L=c.onExpand)==null||L.call(c)}catch($){console.error("Expand failed:",$)}},tooltip:i?"Collapse":"Expand",children:i?s.jsx(Xi,{className:"h-4 w-4"}):s.jsx(aa,{className:"h-4 w-4"})}),o==="completed"&&(c==null?void 0:c.onDelete)&&!h&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:N=>{var L;N.stopPropagation();try{(L=c.onDelete)==null||L.call(c)}catch($){console.error("Delete failed:",$)}},tooltip:"Delete",children:s.jsx(ka,{className:"h-4 w-4"})}),o==="failed"&&s.jsx("div",{className:"pr-4",title:"Artifact action failed",children:s.jsx(cs,{className:"h-4 w-4 text-[var(--color-error-wMain)]"})})]}),a&&l&&!h&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:N=>{N.stopPropagation();try{l()}catch(L){console.error("Toggle expand failed:",L)}},tooltip:i?"Collapse":"Expand",children:i?s.jsx(Xi,{className:"h-4 w-4 transition-transform duration-200"}):s.jsx(aa,{className:"h-4 w-4 transition-transform duration-200"})})]}),s.jsx("div",{className:me("grid grid-rows-[0fr] transition-[grid-template-rows] duration-300 ease-in-out",i&&f&&"grid-rows-[1fr]"),children:s.jsx("div",{className:"overflow-hidden",children:w&&s.jsxs(s.Fragment,{children:[s.jsx("hr",{className:"border-t"}),s.jsx("div",{className:"p-3",children:w})]})})})]})},Kx=({isVisible:e,message:t="Resolving embeds..."})=>e?s.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",style:{opacity:e?1:0,pointerEvents:e?"auto":"none"},children:s.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg bg-card p-6 shadow-lg",children:[s.jsx(ja,{className:"h-6 w-6 animate-spin text-primary"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})}):null,Go=e=>{const{artifacts:t,setPreviewArtifact:n,openSidePanelTab:r,sessionId:o,openDeleteModal:a,markArtifactAsDisplayed:i,downloadAndResolveArtifact:l,navigateArtifactVersion:c}=qe(),{activeProject:u}=pr(),[p,f]=d.useState(!1),[m,h]=d.useState(null),[x,g]=d.useState(null),[w,v]=d.useState(null),[b,y]=d.useState(!1),[C,k]=d.useState(!1),E=d.useMemo(()=>t.find(te=>te.filename===e.name),[t,e.name]),S=e.context||"chat",N=(E==null?void 0:E.source)==="project",L=d.useMemo(()=>{const te=e.status==="completed"?e.fileAttachment:void 0;if(te!=null&&te.uri){const ue=nl(te.uri);return(ue==null?void 0:ue.version)!==null&&(ue==null?void 0:ue.version)!==void 0?parseInt(ue.version):void 0}},[e]),$=e.status==="completed"?e.fileAttachment:void 0,D=($==null?void 0:$.name)||e.name,M=$==null?void 0:$.mime_type,R=d.useMemo(()=>e.status==="completed"&&!E,[e.status,E]),F=d.useMemo(()=>{const te=Mn(D,M);return(te==="image"||te==="audio")&&S==="chat"},[D,M,S]),{shouldRender:z,isExpandable:A,isExpanded:G,toggleExpanded:j}=SE({filename:D,mimeType:M,shouldAutoExpand:F}),_=d.useCallback(async()=>{E&&(r("files"),n(E),L!==void 0&&setTimeout(async()=>{await c(E.filename,L)},100))},[E,r,n,L,c]),O=d.useCallback(()=>{let te=null;E?(te={name:E.filename,mime_type:E.mime_type,uri:E.uri,size:E.size,last_modified:E.last_modified},!te.uri&&($!=null&&$.content)&&(te.content=$.content)):$&&(te=$),te?Hf(te,o,u==null?void 0:u.id):console.error(`No file to download for artifact: ${e.name}`)},[E,$,o,u==null?void 0:u.id,e.name]),H=d.useCallback(()=>{E&&a(E)},[E,a]),Q=d.useCallback(()=>{y(!b)},[b]);d.useEffect(()=>{const te=E==null?void 0:E.filename;return z&&te&&i(te,!0),()=>{te&&i(te,!1)}},[z,E==null?void 0:E.filename,i]);const W=d.useMemo(()=>{const te=Mn(D,M);return te==="image"||te==="audio"},[D,M]),U=d.useMemo(()=>Mn(D,M)==="image",[D,M]);d.useEffect(()=>{e.status==="in-progress"&&(E!=null&&E.accumulatedContent)&&z&&g(E.accumulatedContent)},[E==null?void 0:E.accumulatedContent,e.status,D,z,G]),d.useEffect(()=>{(async()=>{if(E!=null&&E.needsEmbedResolution&&e.status==="completed"&&z&&!C){k(!0);try{const ue=await l(E.filename);ue!=null&&ue.content&&g(ue.content)}catch(ue){console.error(`Error downloading ${D}:`,ue)}finally{k(!1)}}})()},[E==null?void 0:E.needsEmbedResolution,e.status,z,D,E==null?void 0:E.filename,l,C]),d.useEffect(()=>{(async()=>{if(p||!z)return;if(e.status==="in-progress"){E!=null&&E.accumulatedContent&&g(E.accumulatedContent);return}if(e.status!=="completed")return;if(E!=null&&E.accumulatedContent){g(E.accumulatedContent);return}const ue=$==null?void 0:$.content;if(x||ue){ue&&!x&&g(ue);return}const De=$==null?void 0:$.uri;if(De){f(!0),h(null);try{const Re=nl(De);if(!Re)throw new Error("Invalid artifact URI.");const{filename:Ae,version:Le}=Re;let Nt;o&&o.trim()&&o!=="null"&&o!=="undefined"?Nt=`/api/v1/artifacts/${o}/${encodeURIComponent(Ae)}/versions/${Le||"latest"}`:u!=null&&u.id?Nt=`/api/v1/artifacts/null/${encodeURIComponent(Ae)}/versions/${Le||"latest"}?project_id=${u.id}`:Nt=`/api/v1/artifacts/null/${encodeURIComponent(Ae)}/versions/${Le||"latest"}`;const tt=await je(Nt);if(!tt.ok)throw new Error(`Failed to fetch artifact content: ${tt.statusText}`);const bt=await tt.blob(),Lt=await new Promise((ft,pt)=>{const at=new FileReader;at.onloadend=()=>{typeof at.result=="string"?ft(at.result.split(",")[1]):pt(new Error("Failed to read artifact content as a data URL."))},at.onerror=()=>{pt(at.error||new Error("An unknown error occurred while reading the file."))},at.readAsDataURL(bt)});g(Lt)}catch(Re){console.error("Error fetching inline content:",Re),h(Re instanceof Error?Re.message:"Unknown error fetching content.")}finally{f(!1)}}})()},[e.status,z,$,o,u==null?void 0:u.id,p,x,E==null?void 0:E.accumulatedContent,D,G,E]);const Y=d.useMemo(()=>{if(e.status!=="failed")return S==="list"?{onInfo:Q,onDownload:e.status==="completed"?O:void 0,onDelete:E&&e.status==="completed"&&!N?H:void 0}:{onPreview:e.status==="completed"?_:void 0,onDownload:e.status==="completed"?O:void 0,onInfo:Q}},[e.status,S,O,E,H,Q,_,N]),P=d.useMemo(()=>t.find(te=>te.filename===e.name),[t,e.name]),I=P==null?void 0:P.description,K=x||($==null?void 0:$.content),Z=Mn(D,M);let J=null;if(p)J=s.jsx("div",{className:"bg-muted flex h-25 items-center justify-center",children:s.jsx(cr,{})});else if(m)J=s.jsx(br,{variant:"error",message:m});else if(K&&Z)try{const ue=Rm({...$||{name:D,mime_type:M},content:K,isPlainText:(E==null?void 0:E.isAccumulatedContentPlainText)&&x===(E==null?void 0:E.accumulatedContent)||e.status==="in-progress"&&!!x});ue&&(J=s.jsxs("div",{className:"group relative max-w-full overflow-hidden",children:[w&&s.jsx(br,{variant:"error",message:w}),s.jsx("div",{style:{maxHeight:W&&!U?"300px":U?"none":"400px",overflowY:U?"visible":"auto"},className:U?"drop-shadow-md":"",children:s.jsx(nd,{content:ue,rendererType:Z,mime_type:$==null?void 0:$.mime_type,setRenderError:v})}),s.jsx(Kx,{isVisible:C,message:"Resolving embeds..."})]}))}catch(te){console.error("Failed to process file content:",te),J=s.jsx(br,{variant:"error",message:"Failed to process file content for rendering"})}const oe=z&&G,re=d.useMemo(()=>!b||!E?null:s.jsxs("div",{className:"space-y-2 text-sm",children:[E.description&&s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Description:"}),s.jsx("div",{className:"mt-1",children:E.description})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Size:"}),s.jsx("div",{children:Pa(E.size)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Modified:"}),s.jsx("div",{children:Ko(E.last_modified)})]})]}),E.mime_type&&s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Type:"}),s.jsx("div",{children:E.mime_type})]})]}),[b,E]),ie=d.useMemo(()=>{const te=b&&re,ue=oe&&J;if(te&&ue)return s.jsxs("div",{className:"space-y-4",children:[re,s.jsx("hr",{className:"border-t"}),J]});if(te)return re;if(ue)return J},[b,re,oe,J]);return s.jsx(o_,{filename:D,description:I||"",mimeType:M,size:$==null?void 0:$.size,status:e.status,expandable:A&&S==="chat",expanded:G||b,onToggleExpand:A&&S==="chat"?j:void 0,actions:Y,bytesTransferred:e.status==="in-progress"?e.bytesTransferred:void 0,error:e.status==="failed"?e.error:void 0,expandedContent:ie,context:S,isDeleted:R,version:L,source:E==null?void 0:E.source})},qx=({filename:e,mimeType:t,className:n,onDownload:r,isEmbedded:o=!1})=>{const{artifacts:a,setPreviewArtifact:i,openSidePanelTab:l}=qe(),c=d.useMemo(()=>a.find(m=>m.filename===e),[a,e]),u=d.useMemo(()=>Pm(c||{filename:e,mime_type:t||""}),[c,e,t]),p=d.useCallback(m=>{m.stopPropagation(),c&&(l("files"),i(c))},[c,l,i]),f=d.useCallback(()=>{r&&r()},[r]);return s.jsxs("div",{className:`flex h-11 max-w-xs flex-shrink items-center gap-2 rounded-lg bg-[var(--accent-background)] px-2 py-1 ${n||""}`,children:[u,s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm leading-9",title:e,children:s.jsx("strong",{children:s.jsx("code",{children:e})})}),c&&!o&&s.jsx(ne,{variant:"ghost",onClick:p,tooltip:"Preview",children:s.jsx(af,{className:"h-4 w-4"})}),r&&s.jsx(ne,{variant:"ghost",onClick:f,tooltip:"Download file",children:s.jsx(bo,{className:"h-4 w-4"})})]})},s_=At.memo(({isOpen:e,onClose:t,feedbackType:n,onSubmit:r})=>{const[o,a]=d.useState(""),[i,l]=d.useState(!1),c=d.useRef(null);d.useEffect(()=>{e&&(a(""),l(!1),setTimeout(()=>{var m;(m=c.current)==null||m.focus()},100))},[e]);const u=async()=>{l(!0);try{await r(o),t()}catch{l(!1)}},p=()=>{i||t()},f=n==="up"?"What did you like about the response?":"What did you dislike about the response?";return s.jsx(dn,{open:e,onOpenChange:p,children:s.jsxs(un,{className:"sm:max-w-[750px]",showCloseButton:!1,children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Provide Feedback"}),s.jsxs(mn,{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"font-medium",children:f}),s.jsx("span",{children:"Providing more details will help improve AI responses over time."})]})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Vr,{ref:c,value:o,onChange:m=>a(m.target.value),className:"min-h-[120px] text-sm",disabled:i}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Along with your feedback, details of the task will be recorded."})]}),s.jsxs($n,{children:[s.jsx(ne,{variant:"ghost",onClick:p,disabled:i,children:"Cancel"}),s.jsx(ne,{variant:"default",onClick:u,disabled:i,children:i?"Submitting...":"Submit"})]})]})})}),a_={"application/pdf":"pdf","application/zip":"zip","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","text/plain":"txt","text/csv":"csv","text/html":"html","text/markdown":"md","text/x-markdown":"md","application/json":"json","application/yaml":"yaml","text/yaml":"yaml","application/xml":"xml","text/xml":"xml","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff","audio/mpeg":"mp3","audio/wav":"wav","audio/ogg":"ogg","audio/aac":"aac","audio/flac":"flac","audio/x-m4a":"m4a","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","application/javascript":"js","application/gzip":"gz","application/x-tar":"tar","application/rtf":"rtf"};function i_(e,t){const n=a_[e]||"bin";return`embedded_file_${t+1}.${n}`}function l_(e){if(!e||typeof e!="string")return[];const t=[],n=/data:([a-zA-Z0-9/.-]+);base64,([A-Za-z0-9+/=]+)/g;let r,o=0;for(;(r=n.exec(e))!==null;){const[a,i,l]=r,c=e[r.index-1],u=e[r.index+a.length];if(!(c==='"'&&u==='"'||c==="'"&&u==="'")&&l&&l.length>10){const p=Mn(void 0,i);p?t.push({type:p,content:l,mimeType:i,originalMatch:a}):t.push({type:"file",content:l,mimeType:i,originalMatch:a,filename:i_(i,o++)})}}return t}function c_(e){if(!e||typeof e!="string")return[];const t=[],n=/<html[\s\S]*?<\/html>/gi;let r;for(;(r=n.exec(e))!==null;)t.push({type:"html",content:r[0].trim(),originalMatch:r[0]});return t}function d_(e){if(!e||typeof e!="string")return[];const t=[],n=/```mermaid\s*\n([\s\S]*?)```/gi;let r;for(;(r=n.exec(e))!==null;){const[o,a]=r;t.push({type:"mermaid",content:a.trim(),originalMatch:o})}return t}function u_(e){return!e||typeof e!="string"?[]:[...l_(e),...c_(e),...d_(e)]}const Xx={LAYOUT:"layout"},zt=({label:e,value:t,icon:n,fullWidthValue:r=!1})=>t==null||typeof t=="string"&&!t.trim()?null:s.jsxs("div",{className:`mb-1.5 flex text-sm ${r?"flex-col items-start":"items-center"}`,children:[s.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center text-sm font-semibold text-nowrap",children:[n&&s.jsx("span",{className:"mr-2",children:n}),e,":"]}),s.jsx("div",{className:`text-accent-foreground text-sm ${r?"mt-1 w-full":"truncate"}`,title:typeof t=="string"?t:void 0,children:t})]}),f_=({agent:e,isExpanded:t,onToggleExpand:n})=>{const r=l=>!l||Object.keys(l).length===0?s.jsx("span",{className:"text-sm",children:"N/A"}):s.jsx("ul",{className:"list-inside list-disc pl-1",children:Object.entries(l).map(([c,u])=>s.jsxs("li",{className:"text-sm",children:[s.jsxs("span",{className:"capitalize",children:[c.replace(/_/g," "),":"]})," ",u?"Yes":"No"]},c))}),o=(l,c="None")=>!l||l.length===0?s.jsx("span",{children:c}):l.map(u=>s.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:u},u)),a=l=>!l||l.length===0?s.jsx("span",{children:"No skills listed"}):s.jsx("div",{className:"space-y-1",children:l.map(c=>s.jsxs("div",{className:"rounded p-1.5 text-xs",children:[s.jsx("p",{className:"font-semibold",children:c.name}),s.jsx("p",{children:c.description})]},c.id||c.name))}),i=l=>!l||l.length===0?s.jsx("span",{children:"No tools listed"}):s.jsx("div",{className:"space-y-1",children:l.map(c=>s.jsxs("div",{className:"rounded p-1.5 text-xs",children:[s.jsx("p",{className:"text-foreground font-semibold",children:c.name}),s.jsx("p",{className:"mb-1",children:c.description})]},c.name))});return s.jsx("div",{className:"bg-card h-[400px] w-full flex-shrink-0 cursor-pointer rounded-lg sm:w-[380px]",onClick:n,role:"button",tabIndex:0,"aria-expanded":t,children:s.jsxs("div",{className:`transform-style-preserve-3d relative h-full w-full transition-transform duration-700 ${t?"rotate-y-180":""}`,style:{transformStyle:"preserve-3d"},children:[s.jsxs("div",{className:"absolute flex h-full w-full flex-col overflow-hidden rounded-lg border shadow-xl",style:{backfaceVisibility:"hidden",transform:"rotateY(0deg)"},children:[s.jsx("div",{className:"flex items-center p-4",children:s.jsxs("div",{className:"flex min-w-0 items-center",children:[s.jsx(Fl,{className:"mr-3 h-8 w-8 flex-shrink-0 text-[var(--color-brand-wMain)]"}),s.jsx("div",{className:"min-w-0",children:s.jsx("h2",{className:"truncate text-xl font-semibold",title:e.name,children:e.displayName||e.name})})]})}),s.jsxs("div",{className:"scrollbar-themed flex-grow space-y-3 overflow-y-auto p-4",children:[s.jsx("div",{className:"mb-2 line-clamp-4 text-base",children:e.description||"No description provided."}),s.jsx(zt,{label:"Version",value:e.version,icon:s.jsx(fd,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&s.jsx(zt,{label:"Key Capabilities",value:r(e.capabilities),icon:s.jsx(pd,{size:14}),fullWidthValue:!0})]}),s.jsx("div",{"data-testid":"clickForDetails",className:"text-accent-foreground border-t p-2 text-center text-sm",children:"Click for details"})]}),s.jsxs("div",{className:"absolute flex h-full w-full flex-col overflow-hidden rounded-lg border shadow-xl",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:[s.jsx("div",{className:"flex items-center p-3",children:s.jsxs("h3",{className:"text-md truncate font-semibold",title:e.name,children:["Details: ",e.displayName||e.name]})}),s.jsxs("div",{className:"scrollbar-themed flex-grow space-y-1.5 overflow-y-auto p-3 text-xs",children:[s.jsx(zt,{label:"Name",value:e.name,icon:s.jsx(Aa,{size:14})}),s.jsx(zt,{label:"Description",value:e.description,icon:s.jsx(yv,{size:14}),fullWidthValue:!0}),s.jsx(zt,{label:"Version",value:e.version,icon:s.jsx(fd,{size:14})}),s.jsx(zt,{label:"Endpoint",value:e.url||"N/A",icon:s.jsx(cf,{size:14})}),s.jsx(zt,{label:"Docs",value:e.documentationUrl?s.jsx("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"break-all",children:"View Docs"}):"N/A",icon:s.jsx(of,{size:14})}),e.provider&&s.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[s.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Provider"}),s.jsx(zt,{label:"Name",value:e.provider.organization}),s.jsx(zt,{label:"URL",value:e.provider.url||"N/A"})]}),s.jsx(zt,{label:"Capabilities",value:r(e.capabilities),icon:s.jsx(pd,{size:14}),fullWidthValue:!0}),s.jsx(zt,{label:"Input Modes",value:o(e.defaultInputModes),icon:s.jsx(md,{size:14}),fullWidthValue:!0}),s.jsx(zt,{label:"Output Modes",value:o(e.defaultOutputModes),icon:s.jsx(md,{size:14}),fullWidthValue:!0}),s.jsx(zt,{label:"Skills",value:a(e.skills),icon:s.jsx(Cv,{size:14}),fullWidthValue:!0}),s.jsx(zt,{label:"Tools Info",value:i(e.tools),icon:s.jsx(lf,{size:14}),fullWidthValue:!0}),s.jsx("div",{className:"text-2xs mt-1.5 pt-1.5",children:s.jsx(zt,{label:"A2A Protocol",value:e.protocolVersion})})]}),s.jsx("div",{className:"text-accent-foreground border-t p-2 text-center text-sm",children:"Click for summary"})]})]})})},_l=({agents:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(""),a=l=>{n(c=>c===l?null:l)},i=e.filter(l=>{var c;return(c=l.displayName||l.name)==null?void 0:c.toLowerCase().includes(r.toLowerCase())});return s.jsx(s.Fragment,{children:e.length===0?s.jsx(ns,{variant:"noImage",title:"No agents found",subtitle:"No agents discovered in the current namespace."}):s.jsxs("div",{className:"h-full w-full pt-12 pl-12",children:[s.jsx("input",{type:"text","data-testid":"agentSearchInput",placeholder:"Search...",value:r,onChange:l=>o(l.target.value),className:"bg-background mb-4 rounded-md border px-3 py-2"}),i.length===0&&r?s.jsx(ns,{title:"No agents match your search",variant:"noImage",buttons:[{text:"Clear Search",variant:"default",onClick:()=>o("")}]}):s.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:s.jsx("div",{className:"flex flex-wrap gap-10",children:i.map(l=>s.jsx(f_,{agent:l,isExpanded:t===l.name,onToggleExpand:()=>a(l.name)},l.name))})})]})})},p_=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=Zx.getPluginsByType(Xx.LAYOUT);return r&&r.length>1?s.jsxs("div",{className:`flex items-center space-x-1 ${n}`,children:[s.jsx("span",{className:"text-sm font-semibold",children:"Layout:"}),s.jsx("div",{className:"flex gap-1 rounded-sm p-1",children:r.map(o=>{const a=o.icon,i=e===o.id;return s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>t(o.id),title:o.label,className:i?"bg-[var(--color-secondary-w20)] dark:bg-[var(--color-secondary-w80)]":"",children:[a&&s.jsx(a,{size:14}),s.jsx("span",{children:o.label})]},o.id)})})]}):null};class m_{constructor(){id(this,"_plugins",{});this.registerDefaultPlugins()}get plugins(){return Object.values(this._plugins)}registerPlugin(t){this._plugins[t.id]&&console.warn(`Plugin with ID ${t.id} already exists. Overwriting.`),this._plugins[t.id]=t}getPluginById(t){return this._plugins[t]}getPluginsByType(t){return Object.values(this._plugins).filter(n=>n.type===t)}registerDefaultPlugins(){this.registerPlugin({type:Xx.LAYOUT,id:"cards",label:"Cards",icon:Ev,priority:100,render:t=>s.jsx(_l,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const Zx=new m_,Gu={CARDS:"cards"},h_=({message:e})=>{const{handleCancel:t,setMessages:n,isResponding:r,isCancelling:o}=qe();if(e.authenticationLink){const a=e.authenticationLink.authenticationAttempted||!1,i=e.authenticationLink.rejected||!1,l=()=>{if(a||i)return;n(f=>f.map(m=>{var h,x;return((h=m.metadata)==null?void 0:h.messageId)===((x=e.metadata)==null?void 0:x.messageId)&&m.authenticationLink?{...m,authenticationLink:{...m.authenticationLink,authenticationAttempted:!0}}:m}));const p=window.open(e.authenticationLink.url,"_blank","width=800,height=700,scrollbars=yes,resizable=yes");p&&p.focus()},c=async()=>{a||i||(n(p=>p.map(f=>{var m,h;return((m=f.metadata)==null?void 0:m.messageId)===((h=e.metadata)==null?void 0:h.messageId)&&f.authenticationLink?{...f,authenticationLink:{...f.authenticationLink,rejected:!0}}:f})),t())},u=e.authenticationLink.targetAgent||"Agent";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"w-max rounded-lg border p-4",children:[s.jsx("div",{className:"font-semibold",children:"Action Needed"}),s.jsxs("div",{className:"py-4",children:['The "',u,'" agent requires authentication.']}),s.jsxs("div",{className:"flex flex-row flex-wrap justify-end gap-2",children:[s.jsx(ne,{variant:"ghost",onClick:c,disabled:a||i||!r||o,children:"Reject"}),s.jsx(ne,{onClick:l,disabled:a||i||!r||o,children:e.authenticationLink.text})]}),s.jsx("div",{className:"text-muted-foreground text-center text-xs",children:a&&s.jsx("div",{className:"mt-4",children:"Authentication window has been opened. Complete the process in the new window."})})]}),i&&s.jsx(br,{message:"Authentication request was rejected"})]})}return null},g_=["image","audio"],Yu=({message:e,showWorkflowButton:t,showFeedbackActions:n,handleViewWorkflowClick:r})=>{var b;const{configCollectFeedback:o,submittedFeedback:a,handleFeedbackSubmit:i,addNotification:l}=qe(),[c,u]=d.useState(!1),[p,f]=d.useState(null),m=e.taskId,h=m?(b=a[m])==null?void 0:b.type:void 0,x=y=>{f(y),u(!0)},g=()=>{u(!1),f(null)},w=async y=>{if(!(!p||!m))try{await i(m,p,y),l("Feedback submitted successfully","success")}catch(C){throw l("Failed to submit feedback. Please try again.","error"),C}},v=n&&o;return!t&&!v?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mt-3 space-y-2",children:s.jsxs("div",{className:"flex items-center justify-start gap-2",children:[t&&s.jsx(kp,{onClick:r}),v&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ne,{variant:"ghost",size:"icon",className:`h-6 w-6 ${h?"!opacity-100":""}`,onClick:()=>x("up"),disabled:!!h,children:s.jsx(Sv,{className:`h-4 w-4 ${h==="up"?"fill-[var(--color-brand-wMain)] text-[var(--color-brand-wMain)] !opacity-100":""}`})}),s.jsx(ne,{variant:"ghost",size:"icon",className:`h-6 w-6 ${h?"!opacity-100":""}`,onClick:()=>x("down"),disabled:!!h,children:s.jsx(Nv,{className:`h-4 w-4 ${h==="down"?"fill-[var(--color-brand-wMain)] text-[var(--color-brand-wMain)] opacity-100":""}`})})]})]})}),p&&s.jsx(s_,{isOpen:c,onClose:g,feedbackType:p,onSubmit:w})]})},x_=At.memo(({message:e})=>{var u;const[t,n]=d.useState(null),{sessionId:r}=qe(),o=((u=e.parts)==null?void 0:u.filter(p=>p.kind==="text").map(p=>p.text).join(""))||"",a=e.isUser?o.trim():o;if(e.isError)return s.jsxs("div",{className:"flex items-center",children:[s.jsx(cs,{className:"mr-2 self-start text-[var(--color-error-wMain)]"}),s.jsx(fo,{children:a})]});const i=u_(a);if(i.length===0)return s.jsx(fo,{children:a});let l=a;const c=[];return i.forEach((p,f)=>{if(l=l.replace(p.originalMatch,""),p.type==="file"){const m={name:p.filename||"downloaded_file",content:p.content,mime_type:p.mimeType};c.push(s.jsx("div",{className:"my-2",children:s.jsx(qx,{filename:m.name,mimeType:m.mime_type,onDownload:()=>Hf(m,r),isEmbedded:!0})},`embedded-file-${f}`))}else if(!g_.includes(p.type)){const m=_m(p.content);m&&c.push(s.jsx("div",{className:"my-2 h-auto w-md max-w-md",children:s.jsx(nd,{content:m,rendererType:p.type,mime_type:p.mimeType,setRenderError:n})},`embedded-${f}`))}}),s.jsxs("div",{children:[t&&s.jsx(br,{variant:"error",message:"Error rendering preview"}),s.jsx(fo,{children:l}),c]})}),v_=At.memo(({message:e,children:t,className:n})=>s.jsx("div",{className:`mt-1 space-y-1 ${e.isUser?"ml-auto":"mr-auto"} ${n}`,children:t})),w_=e=>e.uploadedFiles&&e.uploadedFiles.length>0?s.jsx(v_,{message:e,className:"flex flex-wrap justify-end gap-2",children:e.uploadedFiles.map((t,n)=>{var r;return s.jsx(qx,{filename:t.name,mimeType:t.type},`uploaded-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,b_=(e,t,n)=>{var g,w,v;const{openSidePanelTab:r,setTaskIdInSidePanel:o}=t;if(e.isStatusBubble)return null;if(e.authenticationLink)return s.jsx(h_,{message:e});const a=[];let i="";if((g=e.parts)==null||g.forEach(b=>{b.kind==="text"?i+=b.text:(b.kind==="file"||b.kind==="artifact")&&(i&&(a.push({kind:"text",text:i}),i=""),a.push(b))}),i&&a.push({kind:"text",text:i}),!a.some(b=>b.kind==="text"&&b.text.trim()||b.kind==="file"||b.kind==="artifact"))return null;const c=e.isUser?"sent":"received",u=!e.isUser&&e.isComplete&&!!e.taskId&&!!n,p=!e.isUser&&e.isComplete&&!!e.taskId&&!!n,f=()=>{e.taskId&&(o(e.taskId),r("workflow"))},m=(b,y)=>{var k;const C=e.taskId?`${e.taskId}-${b.kind==="file"?b.file.name:b.name}`:(k=e.metadata)!=null&&k.messageId?`${e.metadata.messageId}-${b.kind==="file"?b.file.name:b.name}`:void 0;if(b.kind==="file"){const S=b.file,N={name:S.name||"untitled_file",mime_type:S.mimeType};return"bytes"in S&&S.bytes?N.content=S.bytes:"uri"in S&&S.uri&&(N.uri=S.uri),s.jsx(Go,{status:"completed",name:N.name,fileAttachment:N,uniqueKey:C},`part-file-${y}`)}if(b.kind==="artifact"){const E=b;switch(E.status){case"completed":return s.jsx(Go,{status:"completed",name:E.name,fileAttachment:E.file,uniqueKey:C},`part-artifact-${y}`);case"in-progress":return s.jsx(Go,{status:"in-progress",name:E.name,bytesTransferred:E.bytesTransferred,uniqueKey:C},`part-artifact-${y}`);case"failed":return s.jsx(Go,{status:"failed",name:E.name,error:E.error,uniqueKey:C},`part-artifact-${y}`);default:return null}}return null},h=a.length-1,x=(w=a[h])==null?void 0:w.kind;return s.jsxs("div",{className:"space-y-2",children:[a.map((b,y)=>{const C=y===h;return b.kind==="text"?s.jsx(qg,{variant:c,children:s.jsxs(Xg,{variant:c,children:[s.jsx(x_,{message:{...e,parts:[{kind:"text",text:b.text}]}}),C&&s.jsx(Yu,{message:e,showWorkflowButton:!!u,showFeedbackActions:!!p,handleViewWorkflowClick:f})]})},`part-${y}`):b.kind==="artifact"||b.kind==="file"?m(b,y):null}),x==="artifact"||x==="file"?s.jsx("div",{className:`flex ${e.isUser?"justify-end pr-4":"justify-start pl-4"}`,children:s.jsx(Yu,{message:e,showWorkflowButton:!!u,showFeedbackActions:!!p,handleViewWorkflowClick:f})}):null]},(v=e.metadata)==null?void 0:v.messageId)},y_=({message:e,isLastWithTaskId:t})=>{const n=qe();return e?s.jsxs(s.Fragment,{children:[b_(e,n,t),w_(e)]}):null};var Il=new Map,Xs=new WeakMap,Ku=0,C_=void 0;function E_(e){return e?(Xs.has(e)||(Ku+=1,Xs.set(e,Ku.toString())),Xs.get(e)):"0"}function S_(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?E_(e.root):e[t]}`).toString()}function N_(e){const t=S_(e);let n=Il.get(t);if(!n){const r=new Map;let o;const a=new IntersectionObserver(i=>{i.forEach(l=>{var c;const u=l.isIntersecting&&o.some(p=>l.intersectionRatio>=p);e.trackVisibility&&typeof l.isVisible>"u"&&(l.isVisible=u),(c=r.get(l.target))==null||c.forEach(p=>{p(u,l)})})},e);o=a.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:a,elements:r},Il.set(t,n)}return n}function j_(e,t,n={},r=C_){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const c=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:typeof n.threshold=="number"?n.threshold:0,time:0,boundingClientRect:c,intersectionRect:c,rootBounds:c}),()=>{}}const{id:o,observer:a,elements:i}=N_(n),l=i.get(e)||[];return i.has(e)||i.set(e,l),l.push(t),a.observe(e),function(){l.splice(l.indexOf(t),1),l.length===0&&(i.delete(e),a.unobserve(e)),i.size===0&&(a.disconnect(),Il.delete(o))}}function A_({threshold:e,delay:t,trackVisibility:n,rootMargin:r,root:o,triggerOnce:a,skip:i,initialInView:l,fallbackInView:c,onChange:u}={}){var p;const[f,m]=d.useState(null),h=d.useRef(u),[x,g]=d.useState({inView:!!l,entry:void 0});h.current=u,d.useEffect(()=>{if(i||!f)return;let y;return y=j_(f,(C,k)=>{g({inView:C,entry:k}),h.current&&h.current(C,k),k.isIntersecting&&a&&y&&(y(),y=void 0)},{root:o,rootMargin:r,threshold:e,trackVisibility:n,delay:t},c),()=>{y&&y()}},[Array.isArray(e)?e.toString():e,f,o,r,a,i,n,c,t]);const w=(p=x.entry)==null?void 0:p.target,v=d.useRef(void 0);!f&&w&&!a&&!i&&v.current!==w&&(v.current=w,g({inView:!!l,entry:void 0}));const b=[m,x.inView,x.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}const k_=({isOpen:e,onClose:t,onConfirm:n,session:r,projects:o,currentProjectId:a})=>{const[i,l]=d.useState(null),[c,u]=d.useState(!1);if(d.useEffect(()=>{e&&l("")},[e]),!e||!r)return null;const p=async()=>{u(!0);try{await n(i),t()}catch(v){console.error("Failed to move session:",v)}finally{u(!1)}},f=o.filter(v=>v.id!==a),m=()=>a?`Move "${r.name||"Untitled Session"}" to a different project or remove it from the current project.`:`Move "${r.name||"Untitled Session"}" to a project.`,h=()=>a?"No Project (Remove from current)":"No Project",x=()=>a?"Select a project":"Select a project to move to",g=c||i===""||i===null&&!a,w=()=>{c||t()};return s.jsx(dn,{open:e,onOpenChange:v=>!v&&w(),children:s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Move Chat Session"}),s.jsx(mn,{children:m()})]}),s.jsx("div",{className:"py-4",children:s.jsxs(Cs,{value:i===null?"none":i||"",onValueChange:v=>l(v==="none"?null:v),children:[s.jsx(Ss,{className:"w-full rounded-md",children:s.jsx(Es,{placeholder:x()})}),s.jsxs(Ns,{children:[a&&s.jsx(Nr,{value:"none",children:h()}),f.map(v=>s.jsx(Nr,{value:v.id,children:v.name},v.id))]})]})}),s.jsxs($n,{children:[s.jsx(ne,{variant:"ghost",onClick:w,disabled:c,children:"Cancel"}),s.jsx(ne,{onClick:p,disabled:g,children:c?"Moving...":"Move"})]})]})})},T_=({onSessionSelect:e,projectId:t})=>{const{configServerUrl:n}=Rt(),[r,o]=d.useState(""),[a,i]=d.useState([]),[l,c]=d.useState(!1),[u,p]=d.useState(!1),f=_E(r,300),m=`${n}/api/v1`,h=d.useCallback(async(v,b)=>{if(!v.trim()){i([]),p(!1);return}c(!0);try{const y=new URLSearchParams({query:v.trim(),pageNumber:"1",pageSize:"20"});b&&y.append("projectId",b);const C=await je(`${m}/sessions/search?${y.toString()}`,{credentials:"include"});if(!C.ok)throw new Error("Search failed");const k=await C.json();i(k.data||[]),p(!0)}catch(y){console.error("Search error:",y),i([])}finally{c(!1)}},[m]);d.useEffect(()=>{h(f,t)},[f,t,h]);const x=()=>{o(""),i([]),p(!1)},g=v=>{e(v),x()};return s.jsxs("div",{className:"relative w-full",children:[s.jsxs("div",{className:"relative",children:[s.jsx(jv,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx(bc,{type:"text",placeholder:"Search chats by title",value:r,onChange:v=>o(v.target.value),className:"pl-9 pr-9"}),r&&s.jsx(ne,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 p-0",onClick:x,children:s.jsx(ls,{className:"h-4 w-4"})})]}),u&&s.jsx("div",{className:"absolute z-50 mt-2 w-full rounded-md border bg-popover p-2 shadow-md",children:l?s.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Searching..."}):a.length>0?s.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:a.map(v=>s.jsxs("button",{onClick:()=>g(v.id),className:"w-full rounded-sm px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("div",{className:"font-medium truncate flex-1",children:v.name||"Untitled Session"}),v.projectName&&s.jsx(Kr,{variant:"outline",className:"text-xs bg-primary/10 border-primary/30 text-primary font-semibold px-2 py-0.5 shadow-sm flex-shrink-0",children:v.projectName})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(v.updatedTime).toLocaleDateString()})]},v.id))}):s.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No results found"})})]})},__=({projects:e=[]})=>{const{sessionId:t,handleSwitchSession:n,updateSessionName:r,openSessionDeleteModal:o,addNotification:a}=qe(),{configServerUrl:i,persistenceEnabled:l}=Rt(),c=d.useRef(null),[u,p]=d.useState([]),[f,m]=d.useState(null),[h,x]=d.useState(""),[g,w]=d.useState(1),[v,b]=d.useState(!0),[y,C]=d.useState(!1),[k,E]=d.useState("all"),[S,N]=d.useState(!1),[L,$]=d.useState(null),{ref:D,inView:M}=A_({threshold:0,triggerOnce:!1}),R=d.useCallback(async(P=1,I=!1)=>{C(!0);const Z=`${i}/api/v1/sessions?pageNumber=${P}&pageSize=20`;try{const J=await je(Z);if(J.ok){const oe=await J.json();p(I?re=>[...re,...oe.data]:oe.data),b(oe.meta.pagination.nextPage!==null),w(P)}else console.error(`Failed to fetch sessions: ${J.status} ${J.statusText}`)}catch(J){console.error("An error occurred while fetching sessions:",J)}finally{C(!1)}},[i]);d.useEffect(()=>{R(1,!1);const P=()=>{R(1,!1)},I=K=>{const{sessionId:Z}=K.detail;p(J=>{const oe=J.find(re=>re.id===Z);if(oe){const re=J.filter(ie=>ie.id!==Z);return[oe,...re]}return J})};return window.addEventListener("new-chat-session",P),window.addEventListener("session-updated",I),()=>{window.removeEventListener("new-chat-session",P),window.removeEventListener("session-updated",I)}},[R]),d.useEffect(()=>{M&&v&&!y&&R(g+1,!0)},[M,v,y,g,R]),d.useEffect(()=>{f&&c.current&&c.current.focus()},[f]);const F=async P=>{f!==P&&await n(P)},z=P=>{m(P.id),x(P.name||"")},A=async()=>{if(f){const P=f,I=h;p(K=>K.map(Z=>Z.id===P?{...Z,name:I}:Z)),m(null),await r(P,I)}},G=P=>{o(P)},j=P=>{$(P),N(!0)},_=P=>{P.projectId&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("navigate-to-project",{detail:{projectId:P.projectId}}))},O=async P=>{if(L)try{if(!(await je(`${i}/api/v1/sessions/${L.id}/project`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:P}),credentials:"include"})).ok)throw new Error("Failed to move session");p(K=>K.map(Z=>{var J;return Z.id===L.id?{...Z,projectId:P,projectName:P&&((J=e.find(oe=>oe.id===P))==null?void 0:J.name)||null}:Z})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("session-moved",{detail:{sessionId:L.id,projectId:P}})),a==null||a("Session moved successfully","success"),N(!1),$(null)}catch(I){console.error("Failed to move session:",I),a==null||a("Failed to move session","error")}},H=P=>ql(P),Q=P=>{if(P.name&&P.name.trim())return P.name;const I=P.id;return I.startsWith("web-session-")?`Chat ${I.replace("web-session-","").substring(0,8)}`:`Session ${I.substring(0,8)}`},W=d.useMemo(()=>{const P=new Set;let I=!1;u.forEach(Z=>{Z.projectName?P.add(Z.projectName):I=!0});const K=Array.from(P).sort((Z,J)=>Z.localeCompare(J));return I&&K.unshift("(No Project)"),K},[u]),U=d.useMemo(()=>k==="all"?u:k==="(No Project)"?u.filter(P=>!P.projectName):u.filter(P=>P.projectName===k),[u,k]),Y=d.useMemo(()=>{if(k==="all")return null;const P=e.find(I=>I.name===k);return(P==null?void 0:P.id)||null},[k,e]);return s.jsxs("div",{className:"flex h-full flex-col gap-4 py-6 pl-6",children:[s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("div",{className:"pr-4",children:s.jsx(T_,{onSessionSelect:n,projectId:Y})}),s.jsx("div",{className:"text-lg",children:"Chat Session History"}),l&&W.length>0&&s.jsxs("div",{className:"flex items-center gap-2 pr-4",children:[s.jsx("label",{className:"text-sm font-medium",children:"Project:"}),s.jsxs(Cs,{value:k,onValueChange:E,children:[s.jsx(Ss,{className:"w-[200px] rounded-md",children:s.jsx(Es,{})}),s.jsxs(Ns,{children:[s.jsx(Nr,{value:"all",children:"All Chats"}),W.map(P=>s.jsx(Nr,{value:P,children:P},P))]})]})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[U.length>0&&s.jsx("ul",{children:U.map(P=>s.jsx("li",{className:"group my-2 pr-4",children:s.jsxs("div",{className:`flex items-center gap-2 rounded px-4 py-2 ${P.id===t?"bg-muted":""}`,children:[f===P.id?s.jsx("input",{ref:c,type:"text",value:h,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),A())},className:"flex-1 min-w-0 bg-transparent focus:outline-none"}):s.jsx("button",{onClick:()=>F(P.id),className:"flex-1 min-w-0 cursor-pointer text-left",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[s.jsx("span",{className:"truncate font-semibold",children:Q(P)}),s.jsx("span",{className:"text-muted-foreground text-xs truncate",children:H(P.updatedTime)})]}),P.projectName&&s.jsxs(hs,{children:[s.jsx(gs,{asChild:!0,children:s.jsx(Kr,{variant:"outline",className:"max-w-[120px] text-xs bg-primary/10 border-primary/30 text-primary font-semibold px-2 py-0.5 shadow-sm justify-start flex-shrink-0",children:s.jsx("span",{className:"truncate block",children:P.projectName})})}),s.jsx(xs,{children:P.projectName})]})]})}),s.jsx("div",{className:"flex items-center flex-shrink-0",children:f===P.id?s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:A,className:"h-8 w-8 p-0",children:s.jsx($l,{size:16})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(null),className:"h-8 w-8 p-0",children:s.jsx(ls,{size:16})})]}):s.jsxs(Vg,{children:[s.jsx(Gg,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:I=>I.stopPropagation(),children:s.jsx(zl,{size:16})})}),s.jsxs(Yg,{align:"end",className:"w-48",children:[P.projectId&&s.jsxs(s.Fragment,{children:[s.jsxs(Wo,{onClick:I=>{I.stopPropagation(),_(P)},children:[s.jsx(Av,{size:16,className:"mr-2"}),"Go to Project"]}),s.jsx(vu,{})]}),s.jsxs(Wo,{onClick:I=>{I.stopPropagation(),z(P)},children:[s.jsx(Ta,{size:16,className:"mr-2"}),"Rename"]}),s.jsxs(Wo,{onClick:I=>{I.stopPropagation(),j(P)},children:[s.jsx(kv,{size:16,className:"mr-2"}),"Move to Project"]}),s.jsx(vu,{}),s.jsxs(Wo,{onClick:I=>{I.stopPropagation(),G(P)},children:[s.jsx(df,{size:16,className:"mr-2"}),"Delete"]})]})]})})]})},P.id))}),U.length===0&&u.length>0&&!y&&s.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center text-sm",children:[s.jsx(ia,{className:"mx-auto mb-4 h-12 w-12"}),"No sessions found for this project"]}),u.length===0&&!y&&s.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center text-sm",children:[s.jsx(ia,{className:"mx-auto mb-4 h-12 w-12"}),"No chat sessions available"]}),v&&s.jsx("div",{ref:D,className:"flex justify-center py-4",children:y&&s.jsx(cr,{size:"small",variant:"muted"})})]}),s.jsx(k_,{isOpen:S,onClose:()=>{N(!1),$(null)},onConfirm:O,session:L,projects:e,currentProjectId:L==null?void 0:L.projectId})]})},I_=()=>{const{persistenceEnabled:e}=Rt(),{sessionName:t}=qe(),{projects:n}=pr();return e?s.jsx(__,{projects:n}):s.jsx("div",{className:"flex h-full flex-col",children:s.jsxs("div",{className:"flex-1 overflow-y-auto px-4",children:[s.jsxs("div",{className:"bg-accent/50 hover:bg-accent mb-3 cursor-pointer rounded-md p-3",children:[s.jsx("div",{className:"text-foreground truncate text-sm font-medium text-nowrap",children:t||"New Chat"}),s.jsx("div",{className:"text-muted-foreground mt-1 text-xs",children:"Current session"})]}),s.jsx("div",{className:"text-muted-foreground mt-4 text-center text-xs",children:"Persistence is not enabled."})]})})},R_=({artifact:e,isPreview:t})=>{const{setPreviewArtifact:n}=qe(),r={name:e.filename,mime_type:e.mime_type,size:e.size,uri:e.uri},o=a=>{t||(a.stopPropagation(),n(e))};return s.jsx("div",{className:`${t?"":"cursor-pointer transition-all duration-150 hover:bg-[var(--accent-background)]"}`,onClick:o,children:s.jsx(Go,{status:"completed",name:e.filename,fileAttachment:r,context:"list"})})},M_=()=>{const{isDeleteModalOpen:e,artifactToDelete:t,closeDeleteModal:n,confirmDelete:r}=qe();return!e||!t?null:s.jsx(dn,{open:e,onOpenChange:n,children:s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsxs(pn,{className:"flex max-w-[400px] flex-row gap-1",children:["Delete",s.jsx("span",{className:"inline-block truncate",title:t.filename,children:s.jsx("code",{children:t.filename})}),"?"]}),s.jsx(mn,{className:"flex flex-col gap-2",children:s.jsx("div",{children:t.source==="project"?"This will remove the file from this chat session. The file will remain in the project.":"This file will be permanently deleted."})})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{variant:"ghost",onClick:n,children:"Cancel"}),s.jsx(ne,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})})},P_=({artifact:e,message:t})=>{const{onDownload:n}=Ic();return s.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-4",children:[s.jsx("div",{className:"mb-1 font-semibold",children:"Preview Coming Soon"}),s.jsx("div",{children:t}),s.jsx("div",{className:"mb-4",children:"Download file to view."}),s.jsxs(ne,{onClick:()=>n(e),children:[s.jsx(bo,{className:"h-4 w-4"}),"Download"]})]})},Vi=({children:e})=>s.jsx("div",{className:"text-muted-foreground flex h-[50vh] items-center justify-center",children:e||"No preview available"}),D_=({artifact:e})=>{const{openArtifactForPreview:t,previewFileContent:n,markArtifactAsDisplayed:r,downloadAndResolveArtifact:o}=qe(),a=d.useMemo(()=>yE(e),[e]),[i,l]=d.useState(!1),[c,u]=d.useState(null),[p,f]=d.useState(null),[m,h]=d.useState(!1),x=d.useRef(!1),g=d.useRef(null),w=d.useRef(!1);if(d.useEffect(()=>(r(e.filename,!0),()=>{r(e.filename,!1)}),[e.filename,r]),d.useEffect(()=>{l(!1),u(null),f(null),x.current=!1,g.current=null},[e.filename]),d.useEffect(()=>{if(e.accumulatedContent){const C={name:e.filename,mime_type:e.mime_type,content:e.accumulatedContent,last_modified:e.last_modified,isPlainText:e.isAccumulatedContentPlainText};f(C)}},[e.accumulatedContent,e.filename,e.mime_type,e.last_modified,e.isAccumulatedContentPlainText]),d.useEffect(()=>{async function C(){if(!(x.current&&g.current===e.filename)){x.current=!0,g.current=e.filename;try{l(!0),u(null),e.accumulatedContent?l(!1):await t(e.filename)}catch(k){console.error("Error fetching artifact content:",k),u(k instanceof Error?k.message:"Failed to load artifact content")}finally{l(!1)}}}a!=null&&a.canPreview&&C()},[e.filename,t,a,e.accumulatedContent]),d.useEffect(()=>{async function C(){if(e.needsEmbedResolution&&!m&&!w.current){w.current=!0,h(!0);try{const k=await o(e.filename);k&&f({...k,isPlainText:!1})}catch(k){console.error(`[ArtifactPreviewContent] Error downloading ${e.filename}:`,k)}finally{h(!1),w.current=!1}}}C()},[e.needsEmbedResolution,e.filename,o,m]),c)return s.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsx(br,{variant:"error",message:"Error rendering preview"}),s.jsx(Vi,{children:"No preview available"})]});if(i)return s.jsx(Vi,{children:s.jsx(ja,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(!a.canPreview)return s.jsx(P_,{artifact:e,message:a.reason??""});const v=p||n,b=Mn(e.filename,e.mime_type),y=Rm(v);return!b||!y?s.jsx(Vi,{children:"No preview available"}):s.jsxs("div",{className:"relative h-full w-full",children:[s.jsx(nd,{content:y,rendererType:b,mime_type:v==null?void 0:v.mime_type,setRenderError:u}),s.jsx(Kx,{isVisible:m,message:"Resolving embeds..."})]})},Vn={NameAsc:"name_asc",NameDesc:"name_desc",DateAsc:"date_asc",DateDesc:"date_desc"},L_=e=>{switch(e){case Vn.NameAsc:return"Name (A-Z)";case Vn.NameDesc:return"Name (Z-A)";case Vn.DateAsc:return"Date (oldest first)";case Vn.DateDesc:return"Date (newest first)"}},O_=({currentSortOption:e,onSortChange:t,children:n})=>{const r=Object.values(Vn).map(o=>({id:o,label:L_(o),onClick:()=>t(o),icon:e===o?s.jsx($l,{}):void 0,iconPosition:"right"}));return s.jsxs(Pc,{children:[s.jsx(Dc,{asChild:!0,children:n}),s.jsx(Lc,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:s.jsx(Ja,{actions:r})})]})},$_=({children:e,hideDeleteAll:t=!1})=>{const{artifactsRefetch:n,setIsBatchDeleteModalOpen:r}=qe(),o=[{id:"refreshAll",label:"Refresh",onClick:()=>{n()},icon:s.jsx(Ul,{}),iconPosition:"left"}];return t||o.push({id:"deleteAll",label:"Delete All",onClick:()=>{r(!0)},icon:s.jsx(ka,{}),iconPosition:"left",divider:!0}),s.jsxs(Pc,{children:[s.jsx(Dc,{asChild:!0,children:e}),s.jsx(Lc,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:s.jsx(Ja,{actions:o})})]})},F_=()=>{const{artifacts:e,isBatchDeleteModalOpen:t,setIsBatchDeleteModalOpen:n,confirmBatchDeleteArtifacts:r,setSelectedArtifactFilenames:o}=qe();if(d.useEffect(()=>{t&&o(new Set(e.map(u=>u.filename)))},[e,t,o]),!t)return null;const a=e.some(u=>u.source==="project"),i=e.filter(u=>u.source==="project").length,l=e.length-i,c=()=>a&&l===0?`${e.length===1?"This file":`All ${e.length} files`} will be removed from this chat session. ${e.length===1?"The file":"These files"} will remain in ${e.length===1?"the":"their"} project${e.length===1?"":"s"}.`:a&&l>0?`${l} ${l===1?"file":"files"} will be permanently deleted. ${i} project ${i===1?"file":"files"} will be removed from this chat but will remain in ${i===1?"the":"their"} project${i===1?"":"s"}.`:`${e.length===1?"One file":`All ${e.length} files`} will be permanently deleted.`;return s.jsx(dn,{open:t,onOpenChange:n,children:s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Delete All?"}),s.jsx(mn,{children:c()})]}),s.jsxs("div",{className:"flex justify-end space-x-2",children:[s.jsx(ne,{variant:"ghost",onClick:()=>n(!1),children:"Cancel"}),s.jsx(ne,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})})},z_=({artifactInfo:e,isPreview:t=!1,isExpanded:n=!1,onDelete:r,onDownload:o,setIsExpanded:a,badge:i})=>{const{previewedArtifactAvailableVersions:l,currentPreviewedVersionNumber:c,navigateArtifactVersion:u}=qe(),p=d.useMemo(()=>l??[],[l]);return s.jsxs("div",{className:"flex flex-row justify-between gap-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"truncate text-sm",title:e.filename,children:e.filename}),i&&i.badgeComponent]}),s.jsx("div",{className:"truncate text-xs",title:Ko(e.last_modified),children:Ko(e.last_modified)})]}),t&&p.length>1&&s.jsx("div",{className:"align-right",children:s.jsxs(Cs,{value:c==null?void 0:c.toString(),onValueChange:f=>{u(e.filename,parseInt(f))},children:[s.jsx(Ss,{className:"h-[16px] py-0 text-xs shadow-none",children:s.jsx(Es,{placeholder:"Version"})}),s.jsx(Ns,{children:p.map(f=>s.jsxs(Nr,{value:f.toString(),children:["Version ",f]},f))})]})})]}),s.jsxs("div",{className:`whitespace-nowrap ${t?"opacity-100":"opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100"}`,children:[a&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),f.preventDefault(),a(!n)},tooltip:n?"Collapse Details":"Expand Details",children:s.jsx(Aa,{})}),o&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:async f=>{f.stopPropagation(),f.preventDefault(),await o(e)},tooltip:"Download",children:s.jsx(bo,{})}),r&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:f=>{f.preventDefault(),f.stopPropagation(),r()},tooltip:"Delete",children:s.jsx(ka,{})})]})]})},U_={[Vn.NameAsc]:(e,t)=>e.filename.localeCompare(t.filename),[Vn.NameDesc]:(e,t)=>t.filename.localeCompare(e.filename),[Vn.DateAsc]:(e,t)=>e.last_modified>t.last_modified?1:-1,[Vn.DateDesc]:(e,t)=>e.last_modified<t.last_modified?1:-1},B_=()=>{const{artifacts:e,artifactsLoading:t,previewArtifact:n,setPreviewArtifact:r,artifactsRefetch:o,openDeleteModal:a}=qe(),{onDownload:i}=Ic(),[l,c]=d.useState(Vn.DateDesc),[u,p]=d.useState(!1),f=d.useMemo(()=>t?[]:e?[...e].sort(U_[l]):[],[e,t,l]),m=d.useMemo(()=>f.some(x=>x.source!=="project"),[f]),h=d.useMemo(()=>n?s.jsxs("div",{className:"flex items-center gap-2 border-b p-2",children:[s.jsx(ne,{variant:"ghost",onClick:()=>r(null),children:s.jsx(Tv,{})}),s.jsx("div",{className:"text-md font-semibold",children:"Preview"})]}):f.length>0&&s.jsxs("div",{className:"flex items-center justify-end border-b p-2",children:[s.jsx(O_,{currentSortOption:l,onSortChange:c,children:s.jsxs(ne,{variant:"ghost",title:"Sort By",children:[s.jsx(rf,{className:"h-5 w-5"}),s.jsx("div",{children:"Sort By"})]})},"sort-popover"),s.jsx($_,{hideDeleteAll:!m,children:s.jsx(ne,{variant:"ghost",tooltip:"More",children:s.jsx(zl,{className:"h-5 w-5"})})},"more-popover")]}),[n,f.length,l,r,m]);return s.jsxs("div",{className:"flex h-full flex-col",children:[h,s.jsxs("div",{className:"flex min-h-0 flex-1",children:[!n&&s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[f.map(x=>s.jsx(R_,{artifact:x},x.filename)),f.length===0&&s.jsx("div",{className:"flex h-full items-center justify-center p-4",children:s.jsxs("div",{className:"text-muted-foreground text-center",children:[t&&s.jsx(ja,{className:"size-6 animate-spin"}),!t&&s.jsxs(s.Fragment,{children:[s.jsx(Gn,{className:"mx-auto mb-4 h-12 w-12"}),s.jsx("div",{className:"text-lg font-medium",children:"Files"}),s.jsx("div",{className:"mt-2 text-sm",children:"No files available"}),s.jsx(ne,{className:"mt-4",variant:"default",onClick:o,"data-testid":"refreshFiles",title:"Refresh Files",children:"Refresh"})]})]})})]}),n&&s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-2",children:[s.jsx("div",{className:"border-b px-4 py-3",children:s.jsx(z_,{artifactInfo:n,isPreview:!0,isExpanded:u,setIsExpanded:p,onDelete:n.source==="project"?void 0:()=>a(n),onDownload:()=>i(n)})}),u&&s.jsx("div",{className:"border-b px-4 py-3",children:s.jsxs("div",{className:"space-y-2 text-sm",children:[n.description&&s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Description:"}),s.jsx("div",{className:"mt-1",children:n.description})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Size:"}),s.jsx("div",{children:Pa(n.size)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-secondary-foreground",children:"Type:"}),s.jsx("div",{children:n.mime_type||"Unknown"})]})]})]})}),s.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto",children:s.jsx(D_,{artifact:n})})]})]}),s.jsx(M_,{}),s.jsx(F_,{})]})},H_=({onCollapsedToggle:e,isSidePanelCollapsed:t,setIsSidePanelCollapsed:n,isSidePanelTransitioning:r})=>{const{activeSidePanelTab:o,setActiveSidePanelTab:a,setPreviewArtifact:i,taskIdInSidePanel:l}=qe(),{isReconnecting:c,isTaskMonitorConnecting:u,isTaskMonitorConnected:p,monitoredTasks:f,connectTaskMonitorStream:m}=Rc(),[h,x]=d.useState(null);d.useEffect(()=>{if(l&&f[l]){const y=f[l],C=SI(y.events||[],f,y);x(C)}else x(null)},[l,f]);const g=()=>c||u?{message:"Connecting to task monitor ...",showButton:!1}:p?l?h?null:{message:"No workflow data available for the selected task",showButton:!1}:{message:"No task selected to display",showButton:!1}:{message:"No connection to task monitor",showButton:!0,buttonText:"Reconnect",buttonIcon:_v,buttonAction:m},w=()=>{const y=!t;n(y),e(y)},v=y=>{y==="files"&&i(null),a(y)},b=y=>{t&&(n(!1),e==null||e(!1)),v(y)};return t?s.jsxs("div",{className:"bg-background flex h-full w-full flex-col items-center border-l py-4",children:[s.jsx(ne,{"data-testid":"expandPanel",variant:"ghost",size:"sm",onClick:w,className:"h-10 w-10 p-0",tooltip:"Expand Panel",children:s.jsx(hd,{className:"size-5"})}),s.jsx("div",{className:"bg-border my-4 h-px w-8"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>b("files"),className:"mb-2 h-10 w-10 p-0",tooltip:"Files",children:s.jsx(Gn,{className:"size-5"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>b("workflow"),className:"h-10 w-10 p-0",tooltip:"Workflow",children:s.jsx(Js,{className:"size-5"})})]}):s.jsx("div",{className:"bg-background flex h-full flex-col border-l",children:s.jsx("div",{className:"m-1 min-h-0 flex-1",children:s.jsxs(x2,{value:o,onValueChange:y=>v(y),className:"flex h-full flex-col",children:[s.jsxs("div",{className:"flex gap-2 p-2",children:[s.jsx(ne,{"data-testid":"collapsePanel",variant:"ghost",onClick:w,className:"p-1",tooltip:"Collapse Panel",children:s.jsx(hd,{className:"size-5"})}),s.jsxs(v2,{className:"grid w-full grid-cols-2 bg-transparent p-0",children:[s.jsxs(fu,{value:"files",title:"Files",className:"border-border bg-muted data-[state=active]:bg-background relative cursor-pointer rounded-none rounded-l-md border border-r-0 data-[state=active]:z-10 data-[state=active]:border-r-0",children:[s.jsx(Gn,{className:"mr-2 h-4 w-4"}),"Files"]}),s.jsxs(fu,{value:"workflow",title:"Workflow",className:"border-border bg-muted data-[state=active]:bg-background relative cursor-pointer rounded-none rounded-r-md border border-l-0 data-[state=active]:z-10 data-[state=active]:border-l-0",children:[s.jsx(Js,{className:"mr-2 h-4 w-4"}),"Workflow"]})]})]}),s.jsxs("div",{className:"min-h-0 flex-1",children:[s.jsx(pu,{value:"files",className:"m-0 h-full",children:s.jsx("div",{className:"h-full",children:s.jsx(B_,{})})}),s.jsx(pu,{value:"workflow",className:"m-0 h-full",children:s.jsx("div",{className:"h-full",children:(()=>{const y=g();return!y&&h?s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx(G_,{task:h}),s.jsx(EI,{processedSteps:h.steps||[],isRightPanelVisible:!1,isSidePanelTransitioning:r})]}):s.jsx("div",{className:"flex h-full items-center justify-center p-4",children:s.jsxs("div",{className:"text-muted-foreground text-center",children:[s.jsx(Js,{className:"mx-auto mb-4 h-12 w-12"}),s.jsx("div",{className:"text-lg font-medium",children:"Workflow"}),s.jsx("div",{className:"mt-2 text-sm",children:y==null?void 0:y.message}),(y==null?void 0:y.showButton)&&s.jsx("div",{className:"mt-4",children:s.jsxs(ne,{onClick:y.buttonAction,children:[y.buttonIcon&&(()=>{const C=y.buttonIcon;return s.jsx(C,{className:"h-4 w-4"})})(),y.buttonText]})})]})})})()})})]})]})})})},Rl=At.memo(({statusText:e,onViewWorkflow:t})=>s.jsxs("div",{className:"flex h-8 items-center space-x-3 py-1",children:[t?s.jsx(kp,{onClick:t}):s.jsx(wj,{className:"mr-3 ml-2"}),s.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:e&&s.jsx("span",{className:"text-muted-foreground animate-pulse truncate text-sm",title:e,children:e})})]})),qu=({text:e,onClick:t})=>s.jsxs(ne,{"data-testid":"startNewChat",variant:"ghost",onClick:t,tooltip:"Start New Chat Session",children:[s.jsx(Iv,{className:"size-5"}),e]}),Jx=({buttonText:e})=>{const{handleNewSession:t}=qe(),{persistenceEnabled:n}=Rt();return n?s.jsx(qu,{text:e,onClick:()=>t()}):s.jsxs(dn,{children:[s.jsx(nm,{asChild:!0,children:s.jsx(qu,{text:e})}),s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsx(pn,{className:"flex max-w-[400px] flex-row gap-1",children:"New Chat Session?"}),s.jsx(mn,{className:"flex flex-col gap-2",children:"Starting a new chat session will clear the current chat history and files. Are you sure you want to proceed?"})]}),s.jsxs($n,{children:[s.jsx(dl,{asChild:!0,children:s.jsx(ne,{variant:"ghost",children:"Cancel"})}),s.jsx(dl,{asChild:!0,children:s.jsx(ne,{variant:"default",onClick:()=>t(),children:"Start New Chat"})})]})]})]})},W_=({onToggle:e})=>s.jsxs("div",{className:"bg-background flex h-full w-100 flex-col border-r",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 pt-[35px] pb-3",children:[s.jsx(ne,{variant:"ghost",onClick:e,className:"p-2","data-testid":"hideChatSessions",tooltip:"Hide Chat Sessions",children:s.jsx(uf,{className:"size-5"})}),s.jsx(Jx,{buttonText:"New Chat"})]}),s.jsx("div",{className:"mt-1 min-h-0 flex-1",children:s.jsx(I_,{})})]}),$o=(e,t)=>s.jsx(Kr,{type:t,className:"rounded-full border-none",children:s.jsx("span",{className:"text-xs font-semibold",title:e,children:e})}),V_=(e,t)=>{var r;if(e.currentStatusText)return s.jsx("div",{title:e.currentStatusText,children:s.jsx(Rl,{statusText:e.currentStatusText})});const n=(r=t==null?void 0:t.parts)==null?void 0:r.filter(o=>o.kind==="text").map(o=>o.text).join("");switch(e.status){case"submitted":case"working":return s.jsx("div",{title:n||e.status,children:s.jsx(Rl,{statusText:n||e.status})});case"input-required":return $o("Input Required","info");case"completed":return $o("Completed","success");case"canceled":return $o("Canceled","info");case"failed":return $o("Failed","error");default:return $o("Unknown","info")}},G_=({task:e})=>{const{messages:t,addNotification:n}=qe(),{configServerUrl:r,configFeatureEnablement:o}=Rt(),a=d.useMemo(()=>`${r}/api/v1`,[r]),i=(o==null?void 0:o.taskLogging)??!1,l=d.useMemo(()=>{const u=t.find(p=>p.isStatusBubble);return e?V_(e,u):null},[t,e]),c=async()=>{if(!e.taskId){n("Task ID is missing, cannot download.","error");return}try{const u=await je(`${a}/tasks/${e.taskId}`);if(!u.ok){const h=await u.json().catch(()=>({detail:`Failed to download: ${u.statusText}`}));throw new Error(h.detail||`HTTP error ${u.status}`)}const p=await u.blob(),f=window.URL.createObjectURL(p),m=document.createElement("a");m.href=f,m.download=`${e.taskId}.stim`,document.body.appendChild(m),m.click(),m.remove(),window.URL.revokeObjectURL(f),n("Task log download started.","success")}catch(u){console.error("Failed to download .stim file:",u),n(`Failed to download task log: ${u instanceof Error?u.message:"Unknown error"}`,"error")}};return e?s.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto] grid-rows-[32px_32px] items-center gap-x-8 border-b p-4",children:[s.jsx("div",{className:"text-muted-foreground",children:"User"}),s.jsx("div",{className:"truncate",title:e.initialRequestText,children:e.initialRequestText}),s.jsx("div",{}),s.jsx("div",{className:"text-muted-foreground",children:"Status"}),s.jsx("div",{className:"truncate",children:l}),s.jsx("div",{children:i&&s.jsx(ne,{variant:"ghost",size:"icon",onClick:c,tooltip:"Download Task Log (.stim)",children:s.jsx(bo,{className:"size-4"})})})]}):null};class Qx{getEdgeAnimationState(t,n,r){const o=r.find(l=>l.id===t);if(!o)return{isAnimated:!1,animationType:"static"};if(!this.isAgentToToolRequest(o))return{isAnimated:!1,animationType:"static"};const a=r.slice(0,n+1);return this.hasMatchingResponse(o,a)?{isAnimated:!1,animationType:"static"}:{isAnimated:!0,animationType:"request"}}isAgentToToolRequest(t){var n,r;switch(t.type){case"AGENT_LLM_CALL":return!0;case"AGENT_TOOL_INVOCATION_START":return!(((n=t.data.toolDecision)==null?void 0:n.isPeerDelegation)||((r=t.data.toolInvocationStart)==null?void 0:r.isPeerInvocation)||t.target&&t.target.startsWith("peer_"));default:return!1}}hasMatchingResponse(t,n){switch(t.type){case"AGENT_LLM_CALL":return this.hasLLMResponse(t,n);case"AGENT_TOOL_INVOCATION_START":return this.hasToolResponse(t,n);default:return!1}}hasLLMResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.source;return n.some(a=>{var p;if(new Date(a.timestamp).getTime()<r)return!1;const l=(a.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||a.type==="AGENT_LLM_RESPONSE_TO_AGENT")&&a.target===o,c=a.source===o&&(a.type==="AGENT_TOOL_INVOCATION_START"||a.type==="TASK_COMPLETED"),u=a.type==="AGENT_TOOL_EXECUTION_RESULT"&&((p=a.data.toolResult)==null?void 0:p.isPeerResponse);return l||c||u})}hasToolResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.target,a=t.source;return n.some(i=>new Date(i.timestamp).getTime()<r?!1:i.type==="AGENT_TOOL_EXECUTION_RESULT"&&i.source===o&&i.target===a)}isRequestStep(t){return this.isAgentToToolRequest(t)}isResponseStep(t){return["AGENT_TOOL_EXECUTION_RESULT","AGENT_LLM_RESPONSE_TOOL_DECISION","AGENT_LLM_RESPONSE_TO_AGENT"].includes(t.type)}}function ev(e,t){return(t==null?void 0:t[e])||e}const or={USER:50,MAIN_FLOW:300,TOOLS:600},Y_=50,St=50,En=330,Ur=50,Bn=20,xo=10,Xu=St+20,K_=90;function Br(e,t,n){return e.push(n),t.add(n.id),n}function q_(e,t){return e.push(t),t}function Hr(e,t){return e.nodeIdCounter++,`${t.replace(/[^a-zA-Z0-9_]/g,"_")}_${e.nodeIdCounter}`}function Vt(e){return e.currentPhaseIndex===-1||e.currentPhaseIndex>=e.phases.length?null:e.phases[e.currentPhaseIndex]}function Is(e){const t=Vt(e);return!t||e.currentSubflowIndex===-1||e.currentSubflowIndex>=t.subflows.length?null:t.subflows[e.currentSubflowIndex]}function X_(e,t,n){var r;for(let o=e.length-1;o>=0;o--){const a=e[o],i=n.find(l=>l.id===a.id);if(((r=i==null?void 0:i.data)==null?void 0:r.toolName)===t)return a}return null}function Z_(e,t){if(!t)return null;const n=Vt(e);return n&&n.subflows.findLast(r=>r.functionCallId===t)||null}function J_(e,t){if(!t)return null;const n=Vt(e);return n&&n.subflows.findLast(r=>r.id===t)||null}function li(e,t){var o;const n=Vt(e);if(!n)return null;if(t.functionCallId){const a=Z_(e,t.functionCallId);if(a)return a}if(t.owningTaskId&&t.isSubTaskStep){const a=J_(e,t.owningTaskId);if(a){const i=n.subflows||[];if(!(new Set(i.map(c=>c.id)).size!==i.length))return a}}const r=Is(e);if(r&&t.source){const a=t.source.replace(/[^a-zA-Z0-9_]/g,"_"),i=(o=t.target)==null?void 0:o.replace(/[^a-zA-Z0-9_]/g,"_"),l=r.peerAgent.id;if(l.includes(a)||i&&l.includes(i))return r}return r||null}function tv(e,t){var r,o,a;if(((r=e.data.toolDecision)==null?void 0:r.isParallel)===!0)return!0;const n=(a=(o=e.data)==null?void 0:o.toolInvocationStart)==null?void 0:a.functionCallId;return n?Array.from(t.parallelFlows.values()).some(i=>i.subflowFunctionCallIds.includes(n)):!1}function nv(e,t,n,r){var o;if(r)for(let a=e.length-1;a>=0;a--){const i=e[a];if(i.functionCallId===r){const l=n.find(c=>c.id===i.id);if(((o=l==null?void 0:l.data)==null?void 0:o.toolName)===t||t==="LLM")return i}}return X_(e,t,n)}function Q_(e,t,n){const r=Vt(e);if(!r)return null;const o=t.replace(/[^a-zA-Z0-9_]/g,"_"),a=n==null?void 0:n.replace(/[^a-zA-Z0-9_]/g,"_");let i=null;for(const l of r.subflows)if(l.peerAgent.id.includes(o)||a&&l.peerAgent.id.includes(a)){i=l;break}if(!i)return null;if(i.isParallel)return i;if(i.parentSubflowId){const l=r.subflows.find(c=>c.id===i.parentSubflowId);if(l&&l.isParallel)return l;if(l)return rv(r,l)}return null}function rv(e,t){if(t.isParallel)return t;if(t.parentSubflowId){const n=e.subflows.find(r=>r.id===t.parentSubflowId);if(n)return rv(e,n)}return null}function vo(e,t,n,r){const o=`phase_${e.phases.length}`,a=Hr(e,`${t}_${o}`),i=e.nextAvailableGlobalY,l=ev(t,e.agentNameMap),c={id:a,type:"orchestratorNode",position:{x:or.MAIN_FLOW,y:i},data:{label:l,visualizerStepId:n.id}};Br(r,e.allCreatedNodeIds,c),e.nodePositions.set(a,c.position);const u={id:a,yPosition:i,height:St,width:En},p={id:a,name:t,type:"orchestrator",phaseId:o,context:"main",nodeInstance:u};e.agentRegistry.registerAgent(p);const f={id:o,orchestratorAgent:u,userNodes:[],subflows:[],toolInstances:[],currentToolYOffset:0,maxY:i+St};return e.phases.push(f),e.currentPhaseIndex=e.phases.length-1,e.currentSubflowIndex=-1,e.nextAvailableGlobalY=f.maxY+Ur,f}function Ml(e,t,n,r,o){var $,D,M,R,F;const a=Vt(e);if(!a)return null;const i=n.type==="AGENT_TOOL_EXECUTION_RESULT"&&(($=n.data.toolResult)==null?void 0:$.isPeerResponse)===!0,l=n.source||"",c=n.target||"",u=wo(l);!i&&!u&&!o&&e.indentationLevel++;const p=((M=(D=n.delegationInfo)==null?void 0:D[0])==null?void 0:M.subTaskId)||n.owningTaskId,f=Hr(e,`${t}_${p}`),m=Hr(e,`group_${t}_${p}`),h=((F=(R=n.data)==null?void 0:R.toolInvocationStart)==null?void 0:F.functionCallId)||n.functionCallId||"";let x,g,w;const v=Array.from(e.parallelFlows.values()).find(z=>z.subflowFunctionCallIds.includes(h)),b=Is(e),y=Q_(e,l,c);o&&v?(x=v.startX+v.currentXOffset,g=v.startY,w=g+Bn,v.currentXOffset+=(En+xo)*2.2):y?(w=e.nextAvailableGlobalY,x=(y.groupNode.xPosition||or.MAIN_FLOW-50)+e.indentationLevel*e.indentationStep,g=w-Bn):(w=e.nextAvailableGlobalY,x=or.MAIN_FLOW-50+e.indentationLevel*e.indentationStep,g=w-Bn);const C=ev(t,e.agentNameMap),k={id:f,type:"genericAgentNode",position:{x:50,y:Bn},data:{label:C,visualizerStepId:n.id},parentId:m},E={id:m,type:"group",position:{x,y:g},data:{label:`${C} Sub-flow`},style:{backgroundColor:"rgba(220, 220, 255, 0.1)",border:"1px solid #aac",borderRadius:"8px",minHeight:`${St+2*Bn}px`}};Br(r,e.allCreatedNodeIds,E),Br(r,e.allCreatedNodeIds,k),e.nodePositions.set(f,k.position),e.nodePositions.set(m,E.position);const S={id:f,xPosition:or.MAIN_FLOW,yPosition:w,height:St,width:En},N={id:f,name:t,type:"peer",phaseId:a.id,subflowId:p,context:"subflow",nodeInstance:S};e.agentRegistry.registerAgent(N);const L={id:p,functionCallId:h,isParallel:o,peerAgent:S,groupNode:{id:m,xPosition:x,yPosition:g,height:St+2*Bn,width:0},toolInstances:[],currentToolYOffset:0,maxY:w+St,maxContentXRelative:k.position.x+En,callingPhaseId:a.id,parentSubflowId:b==null?void 0:b.id,inheritedXOffset:y==null?void 0:y.groupNode.xPosition};return a.subflows.push(L),y&&(y.lastSubflow=L),e.currentSubflowIndex=a.subflows.length-1,o&&v?(v.maxHeight=Math.max(v.maxHeight,L.groupNode.height),e.nextAvailableGlobalY=v.startY+v.maxHeight+Ur):e.nextAvailableGlobalY=L.groupNode.yPosition+L.groupNode.height+Ur,L}function ov(e,t,n,r,o,a,i=!1){const l=Vt(e);if(!l)return null;const c=a?a.toolInstances:l.toolInstances,u=i?"LLM":`Tool: ${t}`,p=i?"LLM":t,f=a?a.groupNode.id:void 0;let m,h,x,g;if(a){if(m=a.peerAgent.yPosition+a.currentToolYOffset,a.currentToolYOffset+=Xu,x=50+300,a.groupNode.xPosition===void 0||a.groupNode.yPosition===void 0)return null;h=a.groupNode.xPosition+x,g=m-a.groupNode.yPosition}else h=or.TOOLS,m=l.orchestratorAgent.yPosition+l.currentToolYOffset,l.currentToolYOffset+=Xu,x=h,g=m;const w=Hr(e,`${p}_${r.id}`),v={id:w,type:n,position:{x,y:g},data:{label:u,visualizerStepId:r.id,toolName:t},parentId:f};Br(o,e.allCreatedNodeIds,v),e.nodePositions.set(w,{x,y:g});const b={id:w,xPosition:h,yPosition:m,height:St,width:En,functionCallId:r.functionCallId};c.push(b);const y=m+St;if(a){a.maxY=Math.max(a.maxY,y),a.maxContentXRelative=Math.max(a.maxContentXRelative,x+En);const C=a.maxY-a.groupNode.yPosition+Bn;a.groupNode.height=Math.max(a.groupNode.height,C);const k=a.maxContentXRelative+xo;a.groupNode.width=Math.max(a.groupNode.width||0,k);const E=o.find(S=>S.id===a.groupNode.id);E&&(E.style={...E.style,height:`${a.groupNode.height}px`,width:`${a.groupNode.width}px`}),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,a.groupNode.yPosition+a.groupNode.height+Ur)}else l.maxY=Math.max(l.maxY,y),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,l.maxY+Ur);return b}function od(e,t,n,r){e.userNodeCounter++;const o=Hr(e,`User_response_${e.userNodeCounter}`),a=e.nextAvailableGlobalY+20,i={id:o,type:"userNode",position:{x:or.USER,y:a},data:{label:"User",visualizerStepId:n.id,isBottomNode:!0}};Br(r,e.allCreatedNodeIds,i),e.nodePositions.set(o,i.position);const l={id:o,yPosition:a,height:St,width:En};t.userNodes.push(l),e.allUserNodes.push(l);const c=a+St;return t.maxY=Math.max(t.maxY,c),l}function sn(e,t,n,r,o,a,i,l,c){if(!e||!t||e===t)return;const u=o.allCreatedNodeIds.has(e),p=o.allCreatedNodeIds.has(t);if(!u||!p)return;const f=`edge-${e}${l||""}-to-${t}${c||""}-${n.id}`;if(!r.some(h=>h.id===f)){const h=n.title&&n.title.length>30?n.type.replace(/_/g," ").toLowerCase():n.title||"",x=a.isRequestStep(n),g={id:f,source:e,target:t,label:h,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:x,animationType:x?"request":"static",duration:1}};l&&(g.sourceHandle=l),c&&(g.targetHandle=c),q_(r,g)}}function eI(){const e=new Map;return{agents:e,findAgentByName(t){const n=t.startsWith("peer_")?t.substring(5):t,r=[];for(const[,o]of e)(o.name===n||o.name===t)&&r.push(o);return r.length===0?null:r.reduce((o,a)=>{const i=parseInt(o.id.split("_").pop()||"0");return parseInt(a.id.split("_").pop()||"0")>i?a:o})},findAgentById(t){for(const[,n]of e)if(n.id===t)return n;return null},registerAgent(t){e.set(t.id,t)}}}function Pl(e,t,n){return e==="orchestrator"?t==="output"?n==="bottom"?"orch-bottom-output":"orch-right-output-tools":n==="top"?"orch-top-input":"orch-right-input-tools":t==="output"?n==="bottom"?"peer-bottom-output":"peer-right-output-tools":n==="top"?"peer-top-input":"peer-right-input-tools"}function wo(e){return e==="OrchestratorAgent"||e.toLowerCase().includes("orchestrator")}const tI=["USER_REQUEST","AGENT_LLM_CALL","AGENT_LLM_RESPONSE_TO_AGENT","AGENT_LLM_RESPONSE_TOOL_DECISION","AGENT_TOOL_INVOCATION_START","AGENT_TOOL_EXECUTION_RESULT","AGENT_RESPONSE_TEXT","TASK_COMPLETED","TASK_FAILED"];function nI(e,t,n,r,o,a){const i=e.target,l=i.replace(/[^a-zA-Z0-9_]/g,"_"),c=Vt(t),u=Is(t);let p,f=!1;if(u?(p=u.peerAgent,p.id.startsWith(l+"_")&&(f=!0)):c&&(p=c.orchestratorAgent,p.id.startsWith(l+"_")&&(f=!0)),f&&p&&c){t.userNodeCounter++;const m=Hr(t,`User_continue_${t.userNodeCounter}`),h=t.nextAvailableGlobalY,x={id:m,type:"userNode",position:{x:or.USER,y:h},data:{label:"User",visualizerStepId:e.id}};Br(n,t.allCreatedNodeIds,x),t.nodePositions.set(m,x.position);const g={id:m,yPosition:h,height:St,width:En};c.userNodes.push(g),t.allUserNodes.push(g);const w=h+St;p.yPosition=Math.max(p.yPosition,h),c.maxY=Math.max(c.maxY,w,p.yPosition+St),t.nextAvailableGlobalY=c.maxY+Ur;const v=wo(i)?"orch-left-input":"peer-left-input";sn(g.id,p.id,e,r,t,o,a,"user-right-output",v)}else{const m=vo(t,i,e,n),h=Hr(t,`User_${m.id}`),x={id:h,type:"userNode",position:{x:or.USER,y:m.orchestratorAgent.yPosition-K_},data:{label:"User",visualizerStepId:e.id,isTopNode:!0}};Br(n,t.allCreatedNodeIds,x),t.nodePositions.set(h,x.position);const g={id:h,yPosition:x.position.y,height:St,width:En};m.userNodes.push(g),t.allUserNodes.push(g),t.userNodeCounter++,m.maxY=Math.max(m.maxY,x.position.y+St),t.nextAvailableGlobalY=m.maxY+Ur,sn(h,m.orchestratorAgent.id,e,r,t,o,a,"user-bottom-output","orch-top-input")}}function rI(e,t,n,r,o,a){const i=Vt(t);if(!i)return;const l=li(t,e),c=l?l.peerAgent.id:i.orchestratorAgent.id,u=ov(t,"LLM","llmNode",e,n,l,!0);u&&sn(c,u.id,e,r,t,o,a,l?"peer-right-output-tools":"orch-right-output-tools","llm-left-input")}function oI(e,t,n,r,o,a){var x;if(e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"&&((x=e.data.toolDecision)!=null&&x.isParallel)){const g=`parallel-${e.id}`;e.data.toolDecision.decisions.filter(w=>w.isPeerDelegation).length>1&&t.parallelFlows.set(g,{subflowFunctionCallIds:e.data.toolDecision.decisions.filter(w=>w.isPeerDelegation).map(w=>w.functionCallId),completedSubflows:new Set,startX:or.MAIN_FLOW-50,startY:t.nextAvailableGlobalY,currentXOffset:0,maxHeight:0})}const i=Vt(t);if(!i)return;const l=li(t,e);let c;const p=nv((l||i).toolInstances,"LLM",n,e.functionCallId);if(p)c=p.id;else{console.error(`[Timeline] LLM node not found for step type ${e.type}: ${e.id}. Cannot create edge.`);return}const f=e.target||"UnknownAgent";let m,h;l?(m=l.peerAgent.id,h="peer-right-input-tools"):i.orchestratorAgent.id.startsWith(f.replace(/[^a-zA-Z0-9_]/g,"_")+"_")&&(m=i.orchestratorAgent.id,h="orch-right-input-tools"),c&&m&&h?sn(c,m,e,r,t,o,a,"llm-bottom-output",h):console.error(`[Timeline] Could not determine target agent node ID or handle for step type ${e.type}: ${e.id}. Target agent name: ${f}. Edge will be missing.`)}function sI(e,t,n,r,o,a){var p;const i=Vt(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"UnknownTool";if(((p=e.data.toolInvocationStart)==null?void 0:p.isPeerInvocation)||c.startsWith("peer_")){const f=c.startsWith("peer_")?c.substring(5):c,m=t.agentRegistry.findAgentByName(l);if(!m){console.error(`[Timeline] Could not find source agent in registry: ${l} for step ${e.id}`);return}const h=m.nodeInstance,x=Pl(m.type,"output","bottom"),g=tv(e,t),w=Ml(t,f,e,n,g);w&&sn(h.id,w.peerAgent.id,e,r,t,o,a,x,"peer-top-input")}else{const f=li(t,e);let m,h;if(f)m=f.peerAgent.id,h="peer-right-output-tools";else{const g=t.agentRegistry.findAgentByName(l);g?(m=g.id,h=Pl(g.type,"output","right")):(m=i.orchestratorAgent.id,h="orch-right-output-tools")}const x=ov(t,c,"genericToolNode",e,n,f);x&&sn(m,x.id,e,r,t,o,a,h,`${x.id}-tool-left-input`)}}function aI(e,t,n,r,o,a){var u,p;const i=Vt(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"OrchestratorAgent";if((u=e.data.toolResult)!=null&&u.isPeerResponse){const f=(p=e.data.toolResult)==null?void 0:p.functionCallId,m=Array.from(t.parallelFlows.entries()).find(([x,g])=>g.subflowFunctionCallIds.includes(f||""));if(m){const[x,g]=m;if(g.completedSubflows.add(f||""),g.completedSubflows.size<g.subflowFunctionCallIds.length)return;const w=i.subflows.filter(C=>g.subflowFunctionCallIds.includes(C.functionCallId)),v=e.target||"OrchestratorAgent";let b,y;if(wo(v))t.indentationLevel=0,b=vo(t,v,e,n).orchestratorAgent,y="orch-top-input",t.currentSubflowIndex=-1;else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const C=Ml(t,v,e,n,!1);if(!C)return;b=C.peerAgent,y="peer-top-input"}w.forEach(C=>{var k;sn(((k=C.lastSubflow)==null?void 0:k.peerAgent.id)??C.peerAgent.id,b.id,e,r,t,o,a,"peer-bottom-output",y)}),t.parallelFlows.delete(x);return}const h=t.agentRegistry.findAgentByName(l.startsWith("peer_")?l.substring(5):l);if(!h){console.error(`[Timeline] Source peer agent not found for peer response: ${l}.`);return}if(wo(c)){t.indentationLevel=0;const x=vo(t,c,e,n);sn(h.id,x.orchestratorAgent.id,e,r,t,o,a,"peer-bottom-output","orch-top-input"),t.currentSubflowIndex=-1}else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const x=tv(e,t)||Array.from(t.parallelFlows.values()).some(w=>w.subflowFunctionCallIds.some(v=>i.subflows.some(b=>b.functionCallId===v))),g=Ml(t,c,e,n,x);g&&sn(h.id,g.peerAgent.id,e,r,t,o,a,"peer-bottom-output","peer-top-input")}}else{let f;const m=li(t,e),x=nv((m||i).toolInstances,l,n,e.functionCallId);if(x&&(f=x.id),f){let g,w;if(m)g=m.peerAgent.id,w="peer-right-input-tools";else{const v=t.agentRegistry.findAgentByName(c);v?(g=v.id,w=Pl(v.type,"input","right")):(g=i.orchestratorAgent.id,w="orch-right-input-tools")}sn(f,g,e,r,t,o,a,l==="LLM"?"llm-bottom-output":`${f}-tool-bottom-output`,w)}else console.error(`[Timeline] Could not find source tool node for regular tool result: ${e.id}. Step source (tool name): ${l}.`)}}function iI(e,t,n,r,o,a){const i=Vt(t);if(!i||e.isSubTaskStep)return;const l=i.orchestratorAgent.id,c=od(t,i,e,n);sn(l,c.id,e,r,t,o,a,"orch-bottom-output","user-top-input")}function lI(e,t,n,r,o,a){const i=Vt(t);if(!i)return;const l=Array.from(t.parallelFlows.values()).find(h=>h.subflowFunctionCallIds.includes(e.functionCallId||""));if(l){if(l.completedSubflows.add(e.functionCallId||""),l.completedSubflows.size===l.subflowFunctionCallIds.length){t.indentationLevel=0;const h=vo(t,"OrchestratorAgent",e,n);i.subflows.forEach(x=>{l.subflowFunctionCallIds.includes(x.functionCallId)&&sn(x.peerAgent.id,h.orchestratorAgent.id,e,r,t,o,a,"peer-bottom-output","orch-top-input")}),t.currentSubflowIndex=-1}return}if(!e.isSubTaskStep)return;const c=Is(t);if(!c){console.warn(`[Timeline] TASK_COMPLETED with isSubTaskStep=true but no active subflow. Step ID: ${e.id}`);return}if(!i){console.error(`[Timeline] No current phase found for TASK_COMPLETED. Step ID: ${e.id}`);return}const u=c.peerAgent,p=n.some(h=>typeof h.data.label=="string"&&wo(h.data.label));let f,m;p?(t.indentationLevel=0,f=vo(t,"OrchestratorAgent",e,n).orchestratorAgent.id,m="orch-top-input"):(f=od(t,i,e,n).id,m="user-top-input"),sn(u.id,f,e,r,t,o,a,"peer-bottom-output",m),t.currentSubflowIndex=-1}function cI(e,t,n,r){const o=Vt(t);if(!o)return;const a=e.source||"UnknownSource",i=e.target||"User";let l,c="orch-bottom-output";const u=Is(t);if(u&&u.peerAgent.id.includes(a.replace(/[^a-zA-Z0-9_]/g,"_")))l=u.peerAgent,c="peer-bottom-output";else if(o.orchestratorAgent.id.includes(a.replace(/[^a-zA-Z0-9_]/g,"_")))l=o.orchestratorAgent,c="orch-bottom-output";else for(const m of o.subflows)if(m.peerAgent.id.includes(a.replace(/[^a-zA-Z0-9_]/g,"_"))){l=m.peerAgent,c="peer-bottom-output";break}if(!l){console.error(`[Timeline] Could not find source agent node for TASK_FAILED: ${a}`);return}let p,f;wo(i)?(t.indentationLevel=0,p=vo(t,i,e,n).orchestratorAgent.id,f="orch-top-input",t.currentSubflowIndex=-1):(p=od(t,o,e,n).id,f="user-top-input"),dI(l.id,p,e,r,t,c,f)}function dI(e,t,n,r,o,a,i){var f;if(!e||!t||e===t)return;const l=o.allCreatedNodeIds.has(e),c=o.allCreatedNodeIds.has(t);if(!l||!c)return;const u=`error-edge-${e}${a||""}-to-${t}${i||""}-${n.id}`;if(!r.some(m=>m.id===u)){const m=((f=n.data.errorDetails)==null?void 0:f.message)||"Task failed",h=m.length>30?"Error":m,x={id:u,source:e,target:t,label:h,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:!1,animationType:"static",isError:!0,errorMessage:m}};a&&(x.sourceHandle=a),i&&(x.targetHandle=i),r.push(x)}}const uI=(e,t={})=>{const n=[],r=[];if(!e||e.length===0)return{nodes:n,edges:r};const o=new Qx,a={phases:[],currentPhaseIndex:-1,currentSubflowIndex:-1,parallelFlows:new Map,nextAvailableGlobalY:Y_,nodeIdCounter:0,allCreatedNodeIds:new Set,nodePositions:new Map,allUserNodes:[],userNodeCounter:0,agentRegistry:eI(),indentationLevel:0,indentationStep:50,agentNameMap:t},i=e.filter(u=>tI.includes(u.type)),l=i.findIndex(u=>u.type==="USER_REQUEST");let c=i;l>0&&(c=[i[l],...i.slice(0,l),...i.slice(l+1)]);for(const u of c)switch(u.type){case"USER_REQUEST":nI(u,a,n,r,o,e);break;case"AGENT_LLM_CALL":rI(u,a,n,r,o,e);break;case"AGENT_LLM_RESPONSE_TO_AGENT":case"AGENT_LLM_RESPONSE_TOOL_DECISION":oI(u,a,n,r,o,e);break;case"AGENT_TOOL_INVOCATION_START":sI(u,a,n,r,o,e);break;case"AGENT_TOOL_EXECUTION_RESULT":aI(u,a,n,r,o,e);break;case"AGENT_RESPONSE_TEXT":iI(u,a,n,r,o,e);break;case"TASK_COMPLETED":lI(u,a,n,r,o,e);break;case"TASK_FAILED":cI(u,a,n,r);break}return a.phases.forEach(u=>{u.subflows.forEach(p=>{const f=n.find(m=>m.id===p.groupNode.id);if(f&&f.style){const h=p.maxY-p.groupNode.yPosition+Bn;f.style.height=`${Math.max(St+2*Bn,h)}px`;const x=p.maxContentXRelative+xo,g=En+2*xo+a.indentationLevel*a.indentationStep;f.style.width=`${Math.max(x,g)}px`}})}),{nodes:n,edges:r}},fI=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:a,targetPosition:i,style:l={},markerEnd:c,data:u})=>{const[p,f]=d.useState(!1),[m]=Rv({sourceX:t,sourceY:n,sourcePosition:a,targetX:r,targetY:o,targetPosition:i}),h=()=>{const w={strokeWidth:p?3:2,stroke:"var(--color-muted-foreground)",...l},v=u;return v!=null&&v.isError?{...w,stroke:p?"var(--color-error-wMain)":"var(--color-error-w70)",strokeWidth:p?3:2}:v!=null&&v.isSelected?{...w,stroke:"#3b82f6",strokeWidth:3}:v!=null&&v.isAnimated?{...w,stroke:p?"#1d4ed8":"#3b82f6",strokeWidth:p?4:3}:p?{...w,stroke:"var(--edge-hover-color)"}:w},x=()=>f(!0),g=()=>f(!1);return s.jsxs(s.Fragment,{children:[s.jsx("path",{id:`${e}-interaction`,style:{strokeWidth:16,stroke:"transparent",fill:"none",cursor:"pointer"},className:"react-flow__edge-interaction",d:m,onMouseEnter:x,onMouseLeave:g}),s.jsx("path",{id:e,style:{...h(),cursor:"pointer",transition:"all 0.2s ease-in-out"},className:"react-flow__edge-path",d:m,markerEnd:c,onMouseEnter:x,onMouseLeave:g})]})},pI=({data:e})=>s.jsxs("div",{className:"cursor-pointer rounded-md border-2 border-blue-700 bg-white px-5 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-blue-600 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"180px",textAlign:"center"},children:[s.jsx(kt,{type:"target",position:Tt.Top,id:"peer-top-input",className:"!bg-blue-700",isConnectable:!0}),s.jsx(kt,{type:"source",position:Tt.Right,id:"peer-right-output-tools",className:"!bg-blue-700",style:{top:"25%"},isConnectable:!0}),s.jsx(kt,{type:"target",position:Tt.Right,id:"peer-right-input-tools",className:"!bg-blue-700",style:{top:"75%"},isConnectable:!0}),s.jsx(kt,{type:"source",position:Tt.Bottom,id:"peer-bottom-output",className:"!bg-blue-700",isConnectable:!0}),s.jsx(kt,{type:"target",position:Tt.Left,id:"peer-left-input",className:"!bg-blue-700",isConnectable:!0}),s.jsx("div",{className:"flex items-center justify-center",children:s.jsx("div",{className:"text-md truncate font-semibold",style:{maxWidth:"200px"},children:e.label})})]}),mI=({data:e,id:t})=>{const n=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-cyan-500"}};return s.jsxs("div",{className:"cursor-pointer rounded-lg border-2 border-cyan-600 bg-white px-3 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-cyan-400 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"100px",textAlign:"center"},children:[s.jsx(kt,{type:"target",position:Tt.Left,id:`${t}-tool-left-input`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"25%"}}),s.jsxs("div",{className:"flex items-center justify-center",children:[s.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${n()}`}),s.jsx("div",{className:"text-md truncate",style:{maxWidth:"200px"},children:e.label})]}),s.jsx(kt,{type:"source",position:Tt.Left,id:`${t}-tool-bottom-output`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"75%"}})]})},hI=({data:e})=>{const t=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-teal-500"}};return s.jsxs("div",{className:"cursor-pointer rounded-lg border-2 border-teal-600 bg-white px-3 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-teal-400 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"100px",textAlign:"center"},children:[s.jsx(kt,{type:"target",position:Tt.Left,id:"llm-left-input",className:"!bg-teal-500",isConnectable:!0,style:{top:"25%"}}),s.jsxs("div",{className:"flex items-center justify-center",children:[s.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${t()}`}),s.jsx("div",{className:"text-md",children:e.label})]}),s.jsx(kt,{type:"source",position:Tt.Left,id:"llm-bottom-output",className:"!bg-teal-500",isConnectable:!0,style:{top:"75%"}})]})},gI=({data:e})=>s.jsxs("div",{className:"cursor-pointer rounded-lg border-indigo-600 bg-gradient-to-r from-indigo-50 to-purple-50 px-5 py-3 text-gray-900 shadow-xl transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-2xl dark:border-indigo-400 dark:bg-gradient-to-r dark:from-indigo-900 dark:to-purple-900 dark:text-gray-100",style:{minWidth:"180px",textAlign:"center",borderWidth:"2px",borderStyle:"solid",boxShadow:"0 0 0 1px rgba(79, 70, 229, 0.3), 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},children:[s.jsx(kt,{type:"source",position:Tt.Right,id:"orch-right-output-tools",className:"!bg-indigo-500",style:{top:"25%"},isConnectable:!0}),s.jsx(kt,{type:"target",position:Tt.Right,id:"orch-right-input-tools",className:"!bg-indigo-500",style:{top:"75%"},isConnectable:!0}),s.jsx(kt,{type:"target",position:Tt.Top,id:"orch-top-input",className:"!bg-indigo-500",isConnectable:!0}),s.jsx(kt,{type:"source",position:Tt.Bottom,id:"orch-bottom-output",className:"!bg-indigo-500",isConnectable:!0}),s.jsx(kt,{type:"target",position:Tt.Left,id:"orch-left-input",className:"!bg-indigo-500",isConnectable:!0}),s.jsx("div",{className:"flex items-center justify-center",children:s.jsx("div",{className:"text-md truncate font-bold",style:{maxWidth:"200px"},children:e.label})})]}),xI=({data:e})=>{const t=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-purple-500"}};return s.jsxs("div",{className:"cursor-pointer rounded-md border-2 border-purple-600 bg-white px-4 py-3 text-gray-800 shadow-lg transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-purple-400 dark:bg-gray-700 dark:text-gray-200",style:{minWidth:"120px",textAlign:"center"},children:[e.isTopNode&&s.jsx(kt,{type:"source",position:Tt.Bottom,id:"user-bottom-output",className:"!bg-gray-500",isConnectable:!0}),e.isBottomNode&&s.jsx(kt,{type:"target",position:Tt.Top,id:"user-top-input",className:"!bg-gray-500",isConnectable:!0}),!e.isTopNode&&!e.isBottomNode&&s.jsx(kt,{type:"source",position:Tt.Right,id:"user-right-output",className:"!bg-gray-500",isConnectable:!0}),s.jsxs("div",{className:"flex items-center justify-center",children:[s.jsx("div",{className:`mr-2 h-3 w-3 rounded-full ${t()}`}),s.jsx("div",{className:"text-sm font-bold",children:e.label})]})]})},vI=({step:e,isHighlighted:t,onClick:n,variant:r="list"})=>{const o=()=>{var v,b,y;switch(e.type){case"USER_REQUEST":return s.jsx(Lv,{className:"mr-2 text-blue-500 dark:text-blue-400",size:18});case"AGENT_RESPONSE_TEXT":return s.jsx(di,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"TASK_COMPLETED":return s.jsx(sf,{className:"mr-2 text-green-500 dark:text-green-400",size:18});case"TASK_FAILED":return s.jsx(Dv,{className:"mr-2 text-red-500 dark:text-red-400",size:18});case"AGENT_LLM_CALL":return s.jsx(di,{className:"mr-2 text-purple-500 dark:text-purple-400",size:18});case"AGENT_LLM_RESPONSE_TO_AGENT":return s.jsx(di,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_LLM_RESPONSE_TOOL_DECISION":{const C=(b=(v=e.data.toolDecision)==null?void 0:v.decisions)==null?void 0:b[0];return(C==null?void 0:C.isPeerDelegation)?s.jsx(gd,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18}):s.jsx(xd,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18})}case"AGENT_TOOL_INVOCATION_START":return(y=e.data.toolInvocationStart)!=null&&y.isPeerInvocation?s.jsx(gd,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18}):s.jsx(xd,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18});case"AGENT_TOOL_EXECUTION_RESULT":return s.jsx(Pv,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_ARTIFACT_NOTIFICATION":return s.jsx(Gn,{className:"mr-2 text-indigo-500 dark:text-indigo-400",size:18});default:return s.jsx(Mv,{className:"mr-2 text-gray-500 dark:text-gray-400",size:18})}},a=new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),i=String(new Date(e.timestamp).getMilliseconds()).padStart(3,"0"),l=`${a}.${i}`,c=v=>s.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Model:"})," ",v.modelName]}),s.jsx("p",{className:"mt-1",children:s.jsx("strong",{children:"Prompt Preview:"})}),s.jsx("pre",{className:"max-h-28 overflow-y-auto rounded bg-gray-100 p-1.5 font-mono text-xs break-all whitespace-pre-wrap dark:bg-gray-700",children:v.promptPreview})]}),u=({data:v})=>{const[b,y]=At.useState(!1),C=k=>{k.stopPropagation(),y(!b)};return b?s.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[s.jsx("strong",{children:"LLM Response Details:"}),s.jsx("button",{onClick:C,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Hide details"})]}),v.modelName&&s.jsxs("p",{children:[s.jsx("strong",{children:"Model:"})," ",v.modelName]}),s.jsxs("div",{className:"mt-1",children:[s.jsx("p",{children:s.jsx("strong",{children:"Response Preview:"})}),s.jsx("pre",{className:"max-h-28 overflow-y-auto rounded bg-gray-100 p-1.5 font-mono text-xs break-all whitespace-pre-wrap dark:bg-gray-700",children:v.responsePreview})]}),v.isFinalResponse!==void 0&&s.jsxs("p",{className:"mt-1",children:[s.jsx("strong",{children:"Final Response:"})," ",v.isFinalResponse?"Yes":"No"]})]}):s.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[s.jsx("span",{className:"italic",children:"Internal LLM response"}),s.jsx("button",{onClick:C,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Show details"})]})},p=v=>s.jsxs("div",{className:"mt-1.5 rounded-md bg-blue-50 p-2 font-mono text-xs text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:[s.jsx("p",{className:"mb-2",children:s.jsxs("strong",{children:["🔧 ",v.isParallel?"Parallel Tool Calls:":"Tool Call:"]})}),s.jsx("ul",{className:"space-y-1 pl-2",children:v.decisions.map(b=>s.jsxs("li",{className:"flex items-center",children:[s.jsx("span",{className:"mr-2",children:"•"}),s.jsx("code",{children:b.toolName})]},b.functionCallId))})]}),f=v=>s.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Tool:"})," ",v.toolName]}),s.jsx("p",{className:"mt-1",children:s.jsx("strong",{children:"Arguments:"})}),s.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:s.jsx(Ll,{data:v.toolArguments})})]}),m=v=>s.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Tool:"})," ",v.toolName]}),s.jsx("p",{className:"mt-1",children:s.jsx("strong",{children:"Result:"})}),s.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:typeof v.resultData=="object"?s.jsx(Ll,{data:v.resultData}):s.jsx("pre",{className:"font-mono text-xs break-all whitespace-pre-wrap",children:String(v.resultData)})})]}),h=v=>s.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Artifact:"})," ",v.artifactName,v.version!==void 0&&s.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[" (v",v.version,")"]})]}),v.mimeType&&s.jsxs("p",{children:[s.jsx("strong",{children:"Type:"})," ",v.mimeType]}),v.description&&s.jsxs("p",{className:"mt-1",children:[s.jsx("strong",{children:"Description:"})," ",v.description]})]}),x=r==="list"&&e.nestingLevel&&e.nestingLevel>0?{marginLeft:`${e.nestingLevel*24}px`}:{},g=r==="popover"?`
|
|
340
|
+
p-3 bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors duration-150
|
|
341
|
+
${n?"cursor-pointer":""}
|
|
342
|
+
`:`
|
|
343
|
+
mb-3 p-3 border rounded-lg shadow-sm
|
|
344
|
+
bg-white dark:bg-gray-800 hover:shadow-md transition-shadow duration-150
|
|
345
|
+
${t?"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500 dark:ring-blue-400":"border-gray-200 dark:border-gray-700"}
|
|
346
|
+
${n?"cursor-pointer":""}
|
|
347
|
+
`,w=()=>e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||e.type==="AGENT_TOOL_INVOCATION_START"?"Delegated to: ":e.type==="AGENT_TOOL_EXECUTION_RESULT"?"Response from: ":"Peer Interaction with: ";return s.jsxs("div",{className:g,style:x,onClick:n,children:[s.jsxs("div",{className:"mb-1.5 flex w-full items-center gap-1",children:[o(),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-between gap-2",children:[s.jsx("h4",{className:"flex-1 truncate text-sm font-semibold",title:e.title,children:e.title}),s.jsx("span",{className:"text-muted-foreground shrink-0 font-mono text-xs",children:l})]})]}),e.delegationInfo&&e.delegationInfo.length>0&&s.jsx("div",{className:"mt-2 mb-1.5 space-y-2 rounded-r-md border-l-4 border-blue-500 bg-blue-50 p-2 text-sm dark:border-blue-400 dark:bg-gray-700/60",children:e.delegationInfo.map(v=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center font-semibold text-blue-700 dark:text-blue-300",children:[s.jsx(cf,{className:"mr-2 h-4 w-4 flex-shrink-0"}),s.jsxs("span",{children:[w(),v.peerAgentName]})]}),v.subTaskId&&s.jsxs("div",{className:"mt-0.5 ml-[24px] text-xs text-blue-600 dark:text-blue-400",children:["Sub-Task:"," ",s.jsxs("span",{className:"font-mono",title:v.subTaskId,children:[v.subTaskId.substring(0,15),"..."]})]})]},v.functionCallId))}),e.data.text&&s.jsx("div",{className:"max-h-20 overflow-y-auto pl-1 text-sm text-gray-800 dark:text-gray-100",children:s.jsx(fo,{children:e.data.text})}),e.data.finalMessage&&s.jsx("div",{className:"pl-1 text-sm text-gray-800 dark:text-gray-100",children:s.jsx(fo,{children:e.data.finalMessage})}),e.type==="TASK_COMPLETED"&&!e.data.finalMessage&&s.jsx("div",{className:"pl-1 text-sm text-gray-600 italic dark:text-gray-300",children:"Task completed successfully."}),e.data.errorDetails&&s.jsxs("div",{className:"mt-1 rounded-md bg-red-50 p-2 pl-1 text-sm text-red-700 dark:bg-red-900/30 dark:text-red-400",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Error:"})," ",e.data.errorDetails.message]}),e.data.errorDetails.code&&s.jsxs("p",{className:"text-xs",children:["Code: ",e.data.errorDetails.code]})]}),e.data.llmCall&&c(e.data.llmCall),e.data.llmResponseToAgent&&s.jsx(u,{data:e.data.llmResponseToAgent}),e.data.toolDecision&&p(e.data.toolDecision),e.data.toolInvocationStart&&f(e.data.toolInvocationStart),e.data.toolResult&&m(e.data.toolResult),e.data.artifactNotification&&h(e.data.artifactNotification)]})},wI={genericAgentNode:pI,userNode:xI,llmNode:hI,orchestratorNode:gI,genericToolNode:mI},bI={defaultFlowEdge:fI},yI={x:16,y:0},CI=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,a]=$v([]),[i,l,c]=Fv([]),{fitView:u}=zv(),{highlightedStepId:p,setHighlightedStepId:f}=Rc(),{taskIdInSidePanel:m}=qe(),{agentNameMap:h}=_c(),x=d.useRef([]),[g,w]=d.useState(!1),[v,b]=d.useState(null),[y,C]=d.useState(!1),k=d.useRef(null),[E,S]=d.useState(null),N=d.useRef(new Qx),L=d.useMemo(()=>!e||e.length===0?{nodes:[],edges:[]}:uI(e,h),[e,h]),$=d.useMemo(()=>L.edges.length?L.edges.map(j=>{const _=j.data;let O={isAnimated:!1,animationType:"none"};if(_!=null&&_.visualizerStepId){const Q=e.length-1;O=N.current.getEdgeAnimationState(_.visualizerStepId,Q,e)}let H=j.id===E;return p&&(_==null?void 0:_.visualizerStepId)===p&&(H=!0),{...j,animated:O.isAnimated,data:{..._,isAnimated:O.isAnimated,animationType:O.animationType,isSelected:H}}}):[],[L.edges,e,E,p]),D=d.useCallback(()=>{o(j=>j.map(_=>{var oe,re,ie,te;if(_.type!=="group")return _;const O=j.filter(ue=>ue.parentId===_.id);if(O.length===0)return _;let H=0,Q=0;O.forEach(ue=>{const De=ue.position.x+En,Re=ue.position.y+St;H=Math.max(H,De),Q=Math.max(Q,Re)});const W=H+xo,U=Q+Bn;let Y=0;const P=_.id.split("_");if(P.length>2){const ue=P.find(De=>De.startsWith("subflow"));if(ue){const De=parseInt(ue.replace("subflow",""));isNaN(De)||(Y=De)}}const I=En+2*xo+Y*50,K=Math.max(W,I),Z=parseInt(((re=(oe=_.style)==null?void 0:oe.width)==null?void 0:re.toString().replace("px",""))||"0"),J=parseInt(((te=(ie=_.style)==null?void 0:ie.height)==null?void 0:te.toString().replace("px",""))||"0");return Z!==K||J!==U?{..._,style:{..._.style,width:`${K}px`,height:`${U}px`}}:_}))},[o]);d.useEffect(()=>{o(L.nodes),l($),D()},[L.nodes,$,o,l,D]);const M=d.useCallback((j,_)=>i.find(O=>O.source===j&&(_?O.sourceHandle===_:!0))||null,[i]),R=d.useCallback((j,_)=>{var H;w(!0);const O=(H=_.data)==null?void 0:H.visualizerStepId;if(O){const Q=e.find(W=>W.id===O);Q&&(S(_.id),t?f(O):(f(O),b(Q),C(!0)))}},[e,t,f]),F=d.useCallback(j=>{switch(j.type){case"userNode":{const _=j.data;return _!=null&&_.isTopNode?["user-bottom-output"]:_!=null&&_.isBottomNode?["user-top-input"]:["user-right-output"]}case"orchestratorNode":return["orch-right-output-tools","orch-bottom-output"];case"genericAgentNode":return["peer-right-output-tools","peer-bottom-output"];case"llmNode":return["llm-bottom-output"];case"genericToolNode":return[`${j.id}-tool-bottom-output`];default:return[]}},[]),z=d.useCallback(()=>{C(!1),b(null)},[]),A=d.useCallback((j,_)=>{if(w(!0),_.type==="group"){f(null),S(null),z();return}const O=F(_);let H=null;for(const Q of O)if(H=M(_.id,Q),H)break;if(!H&&_.type==="userNode"){const Q=_.data;Q!=null&&Q.isBottomNode&&(H=i.find(W=>W.target===_.id)||null)}H&&R(j,H)},[F,f,z,M,i,R]),G=d.useCallback(j=>{j!=null&&j.isTrusted&&w(!0)},[]);return d.useEffect(()=>{w(!1)},[m]),d.useEffect(()=>{!n&&u&&r.length>0&&x.current!==e&&g===!1&&(u({duration:200,padding:.1,maxZoom:1.2}),x.current=e)},[r.length,u,e,n,g]),d.useEffect(()=>{if(o(j=>j.map(_=>{var W;const O=((W=_.data)==null?void 0:W.visualizerStepId)&&_.data.visualizerStepId===p,H=L.nodes.find(U=>U.id===_.id),Q=(H==null?void 0:H.style)||{};return{..._,style:{...Q,boxShadow:O?"0px 4px 12px rgba(0, 0, 0, 0.2)":Q.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}})),p){const j=$.find(_=>{const O=_.data;return(O==null?void 0:O.visualizerStepId)===p});j&&S(j.id)}else S(null)},[p,o,L.nodes,$]),!e||e.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:Object.keys(e).length>0?"Processing flow data...":"No steps to display in flow chart."}):L.nodes.length===0&&e.length>0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:"Generating flow chart..."}):s.jsxs("div",{style:{height:"100%",width:"100%"},className:"relative",children:[s.jsxs(Uv,{nodes:r,edges:i.map(j=>({...j,markerEnd:{type:Vv.ArrowClosed,color:"#888"}})),onNodesChange:a,onEdgesChange:c,onEdgeClick:R,onNodeClick:A,onPaneClick:()=>{f(null),S(null),z()},onMoveStart:G,nodeTypes:wI,edgeTypes:bI,fitViewOptions:{padding:.1},className:"bg-gray-50 dark:bg-gray-900 [&>button]:dark:bg-gray-700",proOptions:{hideAttribution:!0},nodesDraggable:!1,elementsSelectable:!1,nodesConnectable:!1,minZoom:.2,children:[s.jsx(Bv,{}),s.jsx(Hv,{className:ib()}),s.jsx(Wv,{position:"top-right",className:"flex items-center space-x-4",children:s.jsx("div",{ref:k})})]}),s.jsx(XE,{isOpen:y,onClose:z,anchorRef:k,offset:yI,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:v&&s.jsx(vI,{step:v,variant:"popover"})})]})},EI=e=>s.jsx(Ov,{children:s.jsx(CI,{...e})}),sv=e=>{var t,n,r,o;if(e.events&&e.events.length>0){const a=e.events[0];if((o=(r=(n=(t=a.full_payload)==null?void 0:t.params)==null?void 0:n.message)==null?void 0:r.metadata)!=null&&o.parentTaskId)return a.full_payload.params.message.metadata.parentTaskId}},Fo=e=>{var t,n,r;return((r=(n=(t=e.full_payload)==null?void 0:t.result)==null?void 0:n.status)==null?void 0:r.timestamp)||e.timestamp},av=(e,t,n,r)=>{const o=t[e];if(!o)return console.warn(`[collectAllDescendantEvents] Task not found in allMonitoredTasks: ${e}`),[];n.set(e,r);let a=[...o.events||[]];for(const i in t){const l=t[i];if(l.taskId===e)continue;sv(l)===e&&(a=a.concat(av(l.taskId,t,n,r+1)))}return a},SI=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,a=new Map,i=(A,G)=>(r.agents[A]||(r.agents[A]={agentName:G,instanceId:A,displayName:G,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[A]),l=new Map,c=av(n.taskId,t,l,0);if(c.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const u=c.sort((A,G)=>new Date(Fo(A)).getTime()-new Date(Fo(G)).getTime()),p=[];let f,m="",h,x,g=[],w=null,v;const b=new Map,y=new Map,C=new Map,k=A=>{if(m.trim()&&h&&x){const G=m.trim();let j=n.taskId;if(g.length>0){const H=g[0].split("-");H.length>2&&H[1]!=="global"&&(j=H.slice(1,H.length-1).join("-"))}else A&&(j=A);const _=l.get(j)??0,O=b.get(j)||C.get(j);p.push({id:`vstep-agenttext-${p.length}-${g[0]||"unknown"}`,type:"AGENT_RESPONSE_TEXT",timestamp:x,title:`${h}: Response`,source:h,target:"User",data:{text:G},rawEventIds:[...g],isSubTaskStep:_>0,nestingLevel:_,owningTaskId:j,functionCallId:O}),w=G}m="",h=void 0,x=void 0,g=[],v=void 0};u.forEach((A,G)=>{var K,Z,J,oe,re,ie,te,ue,De,Re,Ae,Le,Nt,tt,bt,Lt,ft,pt,at,Jt,Fn,Gt,Ot,hn,Qt,gn,yt,le,Yt,Kt,zn,en,tn,Nn,nn,xn,vn,Ve,Mt,Un,jn,An,wn,Pt,Qn;const j=Fo(A),_=`raw-${A.task_id||"global"}-${G}`,O=A.full_payload,H=A.task_id||n.taskId,Q=l.get(H)??0;let W=A.source_entity||"UnknownAgent";(J=(Z=(K=O==null?void 0:O.params)==null?void 0:K.message)==null?void 0:Z.metadata)!=null&&J.agent_name?W=O.params.message.metadata.agent_name:(re=(oe=O==null?void 0:O.result)==null?void 0:oe.metadata)!=null&&re.agent_name?W=O.result.metadata.agent_name:(De=(ue=(te=(ie=O==null?void 0:O.result)==null?void 0:ie.status)==null?void 0:te.message)==null?void 0:ue.metadata)!=null&&De.agent_name?W=O.result.status.message.metadata.agent_name:(Le=(Ae=(Re=O==null?void 0:O.result)==null?void 0:Re.artifact)==null?void 0:Ae.metadata)!=null&&Le.agent_name&&(W=O.result.artifact.metadata.agent_name);let U;if(Q>0?U=b.get(H):U=C.get(H),A.direction==="request"&&Q>0){const we=(Nt=O.params)==null?void 0:Nt.metadata,Oe=we==null?void 0:we.function_call_id,Be=A.task_id;if(Be&&Oe){b.set(Be,Oe);return}}if(A.payload_summary.method&&A.payload_summary.method==="tasks/cancel")return;if(A.direction==="request"&&Q===0&&A.task_id===n.taskId){k(H),w=null;const we=O.params;let Oe="User request";if((tt=we==null?void 0:we.message)!=null&&tt.parts){const Be=we.message.parts.filter(Me=>Me.kind==="text"&&Me.text);Be.length>0&&(Oe=Be[Be.length-1].text)}p.push({id:`vstep-userreq-${p.length}-${_}`,type:"USER_REQUEST",timestamp:j,title:"User Input",source:"User",target:A.target_entity||W,data:{text:Oe},rawEventIds:[_],isSubTaskStep:!1,nestingLevel:0,owningTaskId:H});return}if(A.direction==="status-update"&&(O!=null&&O.result)){const we=O.result,Oe=(bt=we.status)==null?void 0:bt.message,Be=Oe==null?void 0:Oe.metadata;let Me;const mt=!!(Be!=null&&Be.forwarded_from_peer);mt?Me=Be.forwarded_from_peer:(Lt=we.metadata)!=null&&Lt.agent_name?Me=we.metadata.agent_name:Be!=null&&Be.agent_name?Me=Be.agent_name:Me=A.source_entity||"Agent";const Ct=`${Me}:${H}`;if(!mt&&(Oe!=null&&Oe.parts))for(const Ne of Oe.parts){if(Ne.kind==="data"){const ht=Ne.data;ht.type==="agent_progress_update"?f=ht.status_text:ht.type==="artifact_creation_progress"&&(f=`Saving artifact: ${ht.filename} (${ht.bytes_saved} bytes)`)}if(Ne.kind==="data"){k(H);const Ke=Ne.data;switch(Ke==null?void 0:Ke.type){case"agent_progress_update":{p.push({id:`vstep-progress-${p.length}-${_}`,type:"AGENT_RESPONSE_TEXT",timestamp:j,title:`${Me}: Progress Update`,source:Me,target:"User",data:{text:Ke.status_text},rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U});break}case"llm_invocation":{const Ee=Ke.request;let ze="System-initiated LLM call";if(Ee!=null&&Ee.contents&&Array.isArray(Ee.contents)&&Ee.contents.length>0){const T=[...Ee.contents].reverse().find(q=>q.role==="user");T&&T.parts&&(ze=T.parts.map(q=>q.text||"").join(`
|
|
348
|
+
`).trim())}const se={modelName:(Ee==null?void 0:Ee.model)||"Unknown Model",promptPreview:ze||"No text in user prompt."};i(Ct,Me),o.set(Ct,{timestamp:j,modelName:se.modelName}),p.push({id:`vstep-llmcall-${p.length}-${_}`,type:"AGENT_LLM_CALL",timestamp:j,title:`${Me}: LLM Call`,source:Me,target:"LLM",data:{llmCall:se},rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U});break}case"llm_response":{const Ee=o.get(Ct);if(Ee){const q=new Date(j).getTime()-new Date(Ee.timestamp).getTime();i(Ct,Me).llmCalls.push({modelName:Ee.modelName,durationMs:q,timestamp:Ee.timestamp}),o.delete(Ct)}const ze=Ke.data,se=(ft=ze.content)==null?void 0:ft.parts,T=se==null?void 0:se.filter(q=>q.function_call);if(T&&T.length>0){k(H),w=null,C.delete(H);const q=T.map(Ge=>{var Xt;return{functionCallId:Ge.function_call.id,toolName:Ge.function_call.name,toolArguments:Ge.function_call.args||{},isPeerDelegation:(Xt=Ge.function_call.name)==null?void 0:Xt.startsWith("peer_")}}),ae={decisions:q,isParallel:q.length>1},$e=[],it=new Set;q.forEach(Ge=>{if(Ge.isPeerDelegation){const Xt=Ge.toolName.substring(5);for(const Qe in t){const $t=t[Qe];if(it.has($t.taskId))continue;if(sv($t)===H&&$t.events&&$t.events.length>0){const qr=$t.events.find(mr=>{var ko,To,Rs,B;return mr.direction==="request"&&((B=(Rs=(To=(ko=mr.full_payload)==null?void 0:ko.params)==null?void 0:To.message)==null?void 0:Rs.metadata)==null?void 0:B.function_call_id)===Ge.functionCallId});if(qr&&new Date(Fo(qr)).getTime()>=new Date(j).getTime()){const mr={functionCallId:Ge.functionCallId,peerAgentName:Xt,subTaskId:$t.taskId};$e.push(mr),y.set(Ge.functionCallId,mr),$t.taskId&&(b.set($t.taskId,Ge.functionCallId),it.add($t.taskId));break}}}}});const Xe={id:`vstep-tooldecision-${p.length}-${_}`,type:"AGENT_LLM_RESPONSE_TOOL_DECISION",timestamp:j,title:`LLM: Tool Decision${ae.isParallel?" (Parallel)":""}`,source:"LLM",target:Me,data:{toolDecision:ae},rawEventIds:[_],delegationInfo:$e.length>0?$e:void 0,isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U};p.push(Xe);const Et=ae.isParallel?Xe.id:void 0,qt=Ct;i(qt,Me),q.forEach(Ge=>{var Qe;const Xt=Ge.isPeerDelegation?(Qe=y.get(Ge.functionCallId))==null?void 0:Qe.subTaskId:void 0;a.has(Ge.functionCallId)||a.set(Ge.functionCallId,{timestamp:j,toolName:Ge.toolName,isPeer:Ge.isPeerDelegation,invokingAgentInstanceId:qt,subTaskId:Xt,parallelBlockId:Et})})}else{const q=(se==null?void 0:se.filter($e=>$e.text).map($e=>$e.text).join(`
|
|
349
|
+
`))||"",ae={responsePreview:q.substring(0,200)+(q.length>200?"...":""),isFinalResponse:(ze==null?void 0:ze.partial)===!1};p.push({id:`vstep-llmrespagent-${p.length}-${_}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:j,title:`${Me}: LLM Response`,source:"LLM",target:Me,data:{llmResponseToAgent:ae},rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U})}break}case"tool_invocation_start":{const Ee={functionCallId:Ke.function_call_id,toolName:Ke.tool_name,toolArguments:Ke.tool_args,isPeerInvocation:(pt=Ke.tool_name)==null?void 0:pt.startsWith("peer_")};p.push({id:`vstep-toolinvokestart-${p.length}-${_}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:j,title:`${Me}: Executing tool ${Ee.toolName}`,source:Me,target:Ee.toolName,data:{toolInvocationStart:Ee},rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U});break}case"tool_result":{const Ee=Ke.function_call_id,ze=a.get(Ee);if(ze){const T=new Date(j).getTime()-new Date(ze.timestamp).getTime(),q=r.agents[ze.invokingAgentInstanceId];if(q){const ae={toolName:ze.toolName,durationMs:T,isPeer:ze.isPeer,timestamp:ze.timestamp,peerAgentName:ze.isPeer?ze.toolName.substring(5):void 0,subTaskId:ze.subTaskId,parallelBlockId:ze.parallelBlockId};q.toolCalls.push(ae)}a.delete(Ee)}const se={toolName:Ke.tool_name,functionCallId:Ee,resultData:Ke.result_data,isPeerResponse:(at=Ke.tool_name)==null?void 0:at.startsWith("peer_")};p.push({id:`vstep-toolresult-${p.length}-${_}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:j,title:`${Me}: Tool Result - ${se.toolName}`,source:se.toolName,target:Me,data:{toolResult:se},rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U});break}}}else Ne.kind==="text"&&Ne.text&&(h&&h!==Me&&(k(H),w=null),h||(h=Me,x=j,v=mt),m+=Ne.text,g.push(_))}return}if(A.direction==="artifact_update"&&((Jt=O==null?void 0:O.result)!=null&&Jt.artifact)){k(H);const we=O.result.artifact,Oe=((Fn=we.metadata)==null?void 0:Fn.agent_name)||A.source_entity||"Agent";let Be;if(we.parts&&we.parts.length>0){const mt=we.parts[0];mt.kind==="file"?Be=mt.file.mimeType||void 0:(Gt=mt.metadata)!=null&&Gt.mime_type&&(Be=mt.metadata.mime_type)}const Me={artifactName:we.name||"Unnamed Artifact",version:typeof((Ot=we.metadata)==null?void 0:Ot.version)=="number"?we.metadata.version:void 0,description:we.description||void 0,mimeType:Be};p.push({id:`vstep-artifactnotify-${p.length}-${_}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:j,title:`${Oe}: Artifact Update - ${Me.artifactName}`,source:Oe,target:"User/System",data:{artifactNotification:Me},rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U});return}if(["response","task"].includes(A.direction)&&((Qt=(hn=O==null?void 0:O.result)==null?void 0:hn.status)!=null&&Qt.state)){m.trim()&&k(H);const we=O.result,Oe=we.status.state,Be=((gn=we.metadata)==null?void 0:gn.agent_name)||((Yt=(le=(yt=we.status)==null?void 0:yt.message)==null?void 0:le.metadata)==null?void 0:Yt.agent_name)||A.source_entity||"Agent";if(["completed","failed","canceled"].includes(Oe)&&Q==0){const Me=Oe==="completed"?"TASK_COMPLETED":"TASK_FAILED",mt=`${Be}: Task ${Oe.charAt(0).toUpperCase()+Oe.slice(1)}`;let Ct={},Ne="";if((Kt=we.status.message)!=null&&Kt.parts){const lt=we.status.message.parts.find(Ee=>Ee.kind==="text");lt!=null&<.text&&(Ne=lt.text.trim())}const ht=H===n.taskId,Ke=Ne&&(!ht||Ne!==w);if(Me==="TASK_COMPLETED")Ct={finalMessage:Ke?Ne:void 0};else{const Ee={message:Ke?Ne:`Task ${Oe}.`},ze=O.error;ze&&(Ee.message=ze.message||Ee.message,Ee.code=ze.code,ze.data&&(Ee.details=ze.data)),we.error&&(Ee.message=we.error.message||Ee.message,Ee.code=we.error.code||Ee.code,Ee.details=we.error.data||Ee.details),Ct={errorDetails:Ee}}p.push({id:`vstep-${Oe}-${p.length}-${_}`,type:Me,timestamp:j,title:mt,source:Be,target:"User",data:Ct,rawEventIds:[_],isSubTaskStep:Q>0,nestingLevel:Q,owningTaskId:H,functionCallId:U}),ht&&(w=null);return}}const P=A.direction==="status-update"&&((Nn=(tn=(en=(zn=O==null?void 0:O.result)==null?void 0:zn.status)==null?void 0:en.message)==null?void 0:tn.parts)==null?void 0:Nn.some(we=>we.kind==="text"));let I=A.source_entity;(Ve=(vn=(xn=(nn=O==null?void 0:O.result)==null?void 0:nn.status)==null?void 0:xn.message)==null?void 0:vn.metadata)!=null&&Ve.forwarded_from_peer?I=O.result.status.message.metadata.forwarded_from_peer:(Un=(Mt=O==null?void 0:O.result)==null?void 0:Mt.metadata)!=null&&Un.agent_name?I=O.result.metadata.agent_name:(Pt=(wn=(An=(jn=O==null?void 0:O.result)==null?void 0:jn.status)==null?void 0:An.message)==null?void 0:wn.metadata)!=null&&Pt.agent_name&&(I=O.result.status.message.metadata.agent_name),m.trim()&&h&&(!P||P&&I!==h)&&(k(H),l.get(((Qn=g[0])==null?void 0:Qn.split("-")[1])||n.taskId)===0&&!v&&(w=null))});const E=u.length>0&&u[u.length-1].task_id||n.taskId;k(E);const S=u[0]?Fo(u[0]):n.firstSeen.toISOString();let N,L="working";const $=p.filter(A=>A.owningTaskId===n.taskId),D=$.length>0?$[$.length-1]:null;if(D&&(D.type==="TASK_COMPLETED"?(L="completed",N=D.timestamp):D.type==="TASK_FAILED"&&(L="failed",N=D.timestamp)),L==="working"&&u.length>0){const A=u[u.length-1];t[A.task_id||n.taskId]}let M;S&&N&&(M=new Date(N).getTime()-new Date(S).getTime()),["completed","failed","canceled","rejected"].includes(L)&&(f=void 0);const R={taskId:n.taskId,initialRequestText:n.initialRequestText,status:L,currentStatusText:f,startTime:S,endTime:N,durationMs:M,steps:p};R.steps.forEach((A,G)=>{if(A.type==="TASK_COMPLETED"){let j="";for(let _=G-1;_>=0;_--){const O=R.steps[_];if(O.type!=="AGENT_RESPONSE_TEXT"||O.source!==A.source)break;j=O.data.text+j}A.data.finalMessage&&(j+=A.data.finalMessage),A.data.finalMessage=j.trim()||void 0}}),Object.values(r.agents).forEach(A=>{A.totalLlmTimeMs=A.llmCalls.reduce((H,Q)=>H+Q.durationMs,0);const G=A.toolCalls.filter(H=>!H.parallelBlockId),j=new Map;A.toolCalls.forEach(H=>{H.parallelBlockId&&(j.has(H.parallelBlockId)||j.set(H.parallelBlockId,[]),j.get(H.parallelBlockId).push(H))});const _=G.reduce((H,Q)=>H+Q.durationMs,0);let O=0;j.forEach(H=>{if(H.length>0){const Q=Math.min(...H.map(U=>new Date(U.timestamp).getTime())),W=Math.max(...H.map(U=>new Date(U.timestamp).getTime()+U.durationMs));O+=W-Q}}),A.totalToolTimeMs=_+O});const F=new Map;Object.values(r.agents).forEach(A=>{F.has(A.agentName)||F.set(A.agentName,[]),F.get(A.agentName).push(A)}),F.forEach(A=>{A.length>1&&(A.sort((G,j)=>{const _=O=>{const H=[...O.llmCalls.map(Q=>new Date(Q.timestamp).getTime()),...O.toolCalls.map(Q=>new Date(Q.timestamp).getTime())];return H.length>0?Math.min(...H):1/0};return _(G)-_(j)}),A.forEach((G,j)=>{G.displayName=`${G.agentName} (${j+1})`}))});const z=new Map;return Object.values(r.agents).forEach(A=>{const G=A.instanceId.split(":").slice(1).join(":");G&&z.set(G,A.displayName)}),Object.values(r.agents).forEach(A=>{A.toolCalls.forEach(G=>{if(G.isPeer&&G.subTaskId){const j=z.get(G.subTaskId);j&&(G.peerAgentName=j)}})}),M!==void 0&&(r.overall.totalTaskDurationMs=M),R.performanceReport=r,R},NI=({items:e,bottomItems:t,activeItem:n,onItemChange:r,onHeaderClick:o})=>{const a=i=>{r(i)};return s.jsxs("aside",{className:"flex h-screen w-[100px] flex-col border-r border-[var(--color-secondary-w70)] bg-[var(--color-primary-w100)]",children:[s.jsx(AI,{onClick:o}),s.jsx(TI,{items:e,bottomItems:t,activeItem:n,onItemClick:a})]})},jI=s.jsxs("svg",{id:"header-icon",xmlns:"http://www.w3.org/2000/svg",version:"1.1",viewBox:"0 0 500 150",width:"100%",height:"100%",children:[s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M14.3,82.5c0-4.4,1-8.2,2.9-11.3,1.9-3.1,4.4-5.7,7.5-7.8,3.1-2,6.5-3.6,10.4-4.6,3.8-1,7.7-1.5,11.5-1.5s7.1.3,10.2.9c3.1.6,5.9,1.5,8.2,2.6,2.4,1.1,4.2,2.4,5.6,3.8,1.4,1.4,2,3,2,4.6,0,2.4,0,4.3-.2,5.7-.1,1.4-.3,2.4-.6,3.1-.3.7-.7,1.1-1.1,1.3-.4.2-.9.2-1.6.2-1.8,0-3.2-.7-4.3-2-1.1-1.3-2.3-2.8-3.7-4.4-1.4-1.6-3.1-3.1-5.3-4.4-2.1-1.3-5.3-2-9.3-2s-4.4.3-6,.9c-1.6.6-2.9,1.5-3.8,2.5-.9,1-1.6,2.2-2,3.4-.4,1.2-.6,2.4-.6,3.5,0,2.5,1,4.4,3.1,5.7,2.1,1.3,4.7,2.3,7.8,3.2,3.1.9,6.5,1.7,10.1,2.5,3.6.8,7,1.9,10.1,3.4,3.1,1.5,5.8,3.5,7.9,6.1,2.1,2.6,3.1,6.1,3.1,10.5s-.8,8-2.5,11.3c-1.7,3.4-4,6.2-7,8.5-3,2.3-6.6,4.1-10.8,5.3-4.2,1.3-8.9,1.9-13.9,1.9s-8.8-.6-12.5-1.9c-3.7-1.3-6.9-2.8-9.6-4.6-2.7-1.8-4.7-3.7-6.2-5.6-1.5-1.9-2.2-3.5-2.2-4.7,0-1.8.5-3.6,1.6-5.3,1-1.8,2.6-2.7,4.7-2.7s2.5.4,3.5,1.2c.9.8,1.8,1.7,2.7,2.8.8,1.1,1.7,2.3,2.6,3.7.9,1.4,2,2.6,3.3,3.7,1.3,1.1,2.9,2,4.7,2.8,1.8.8,4.1,1.2,6.8,1.2,4.1,0,7.5-1,10.3-3.1,2.8-2.1,4.2-4.8,4.2-8s-1-4.9-3.1-6.4c-2-1.4-4.6-2.6-7.7-3.5-3.1-.9-6.4-1.7-10-2.4-3.6-.7-7-1.8-10-3.2-3.1-1.4-5.7-3.4-7.7-6-2-2.6-3.1-6.3-3.1-11"}),s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M124.6,66.8c-4,0-7.3.9-9.9,2.7-2.6,1.8-4.7,4.2-6.4,7.1-1.6,2.9-2.8,6.1-3.5,9.7-.7,3.5-1,6.9-1,10.1,0,4.9.5,9.2,1.6,13,1,3.7,2.5,6.8,4.4,9.3,1.9,2.5,4.1,4.3,6.7,5.6,2.6,1.3,5.3,1.9,8.2,1.9s5.7-.6,8.2-1.9c2.6-1.3,4.8-3.1,6.7-5.6,1.9-2.5,3.3-5.5,4.4-9.3,1-3.7,1.6-8,1.6-13,0-9.5-1.9-16.9-5.8-22-3.9-5.1-8.9-7.7-15.2-7.7M82.2,96.5c0-5.8,1.1-11,3.3-15.9,2.2-4.8,5.2-8.9,9.1-12.4,3.9-3.5,8.4-6.1,13.6-8,5.2-1.9,10.7-2.8,16.6-2.8s11.4.9,16.6,2.8c5.2,1.9,9.7,4.6,13.5,8,3.8,3.5,6.9,7.6,9.1,12.4,2.2,4.8,3.4,10.1,3.4,15.9s-1.1,11.2-3.4,15.9c-2.3,4.8-5.3,8.9-9.1,12.3-3.8,3.5-8.3,6.1-13.5,8-5.2,1.9-10.7,2.8-16.6,2.8s-11.4-.9-16.6-2.8c-5.2-1.9-9.7-4.6-13.6-8-3.9-3.5-6.9-7.6-9.1-12.3-2.2-4.8-3.3-10.1-3.3-15.9"}),s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M172.3,23.3c0-.8.9-1.8,2.7-2.8,1.8-1,4-2,6.5-2.9,2.5-.9,5.1-1.6,7.7-2.3,2.6-.6,4.7-.9,6.3-.9s1.3,0,1.9.2c.6.2,1.2.5,1.8,1.2.6.6,1,1.6,1.4,2.9.4,1.3.5,3.1.5,5.4v94.7c0,2.4.4,4.1,1.2,4.9.8.9,1.6,1.5,2.5,2,.9.4,1.7.8,2.5,1.3.8.4,1.2,1.4,1.2,2.8s-.5,2.5-1.6,3.2c-1,.7-2.4,1-3.9,1h-24.2c-1.6,0-2.9-.3-3.9-1-1-.7-1.6-1.8-1.6-3.2s.4-2.3,1.2-2.7c.8-.5,1.6-.9,2.5-1.3.9-.4,1.7-1.1,2.5-2,.8-.9,1.2-2.5,1.2-4.9V34.5c0-2-.4-3.4-1.3-4.2-.9-.8-1.9-1.4-2.9-1.9-1-.5-2-1-2.9-1.6-.9-.6-1.3-1.8-1.3-3.5"}),s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M254.4,93.3c-3.7,1.2-6.8,2.8-9.4,4.7-2.6,1.9-4.6,4.1-6,6.6-1.4,2.5-2.1,5-2.1,7.6s.3,3.6,1,5.3c.7,1.8,1.6,3.4,2.9,4.7,1.3,1.4,2.7,2.5,4.5,3.3,1.7.8,3.6,1.3,5.7,1.3s5.2-.7,7.2-2c2-1.3,3.6-2.9,4.9-4.7,1.3-1.8,2.2-3.7,2.7-5.7.6-1.9.9-3.6.9-4.9v-18.2c-4.5.1-8.6.8-12.2,2M220.5,69.7c0-1.9.9-3.6,2.6-5.1,1.7-1.5,4-2.8,6.8-3.8,2.8-1,6-1.9,9.5-2.4,3.5-.6,7-.9,10.4-.9,7,0,12.9.8,17.6,2.3,4.7,1.5,8.5,3.6,11.5,6.1,2.9,2.6,5,5.5,6.3,8.7,1.3,3.2,1.9,6.6,1.9,10v34.5c0,1.9.4,3.2,1.3,4.1.8.8,1.7,1.5,2.7,2,.9.5,1.8,1,2.7,1.5.8.5,1.3,1.4,1.3,2.7s-.4,2.5-1.2,3.4c-.8.9-2.7,1.3-5.7,1.3h-13.2c-2.4,0-4.1-.5-5.1-1.6-1-1-1.5-2.8-1.5-5.2v-1.7h-.6c-2.4,3.5-5.9,6-10.4,7.6-4.6,1.6-9.3,2.4-14.4,2.4s-8.5-.6-11.9-1.9c-3.4-1.3-6.3-3-8.6-5.1-2.4-2.1-4.1-4.6-5.3-7.5-1.2-2.8-1.8-5.8-1.8-8.8,0-5.2,1.6-9.7,4.8-13.5,3.2-3.8,7.3-6.8,12.2-9.2,5-2.4,10.5-4.1,16.6-5.2,6.1-1.1,12-1.6,17.9-1.6,0-4.7-1.3-8.6-4-11.5-2.7-3-6.6-4.5-11.7-4.5s-5.7.5-7.5,1.4c-1.9.9-3.6,2-5.1,3.1-1.5,1.2-3.1,2.2-4.7,3.1-1.6.9-3.7,1.4-6.2,1.4s-3.8-.5-5-1.6c-1.3-1.1-1.9-2.6-1.9-4.6"}),s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M301.5,97.6c0-5.9,1-11.3,3.1-16.2,2.1-4.9,4.9-9.2,8.6-12.7,3.6-3.6,7.9-6.3,12.9-8.3,5-2,10.4-3,16.2-3s7.2.4,10.8,1.3c3.5.9,6.6,2.1,9.3,3.5,2.7,1.5,4.9,3.2,6.5,5.2,1.6,2,2.4,4.1,2.4,6.3s-.9,4.1-2.7,5.5c-1.8,1.4-4.2,2-7.2,2s-4.1-.8-5.3-2.4c-1.2-1.6-2.4-3.4-3.5-5.3-1.1-1.9-2.4-3.6-4-5.3-1.6-1.6-3.9-2.4-7.1-2.4s-5.2.8-7.5,2.3c-2.3,1.5-4.2,3.7-5.9,6.5-1.7,2.8-3,6.2-3.8,10-.9,3.9-1.3,8.2-1.3,12.9s.6,7.9,1.8,11.2c1.2,3.3,2.8,6.1,4.8,8.4,2,2.3,4.3,4.1,6.9,5.3,2.6,1.2,5.4,1.8,8.3,1.8s6.9-.6,9.4-1.9c2.5-1.3,4.7-2.6,6.4-4.2,1.8-1.5,3.3-2.9,4.6-4.2,1.3-1.3,2.6-1.9,4-1.9s2,.3,2.7,1c.8.7,1.2,1.6,1.2,2.7,0,1.7-.8,3.6-2.5,5.9-1.7,2.3-4,4.4-6.9,6.4-2.9,2-6.4,3.8-10.4,5.2-4,1.4-8.4,2.1-13.1,2.1s-10.7-.9-15.5-2.7c-4.8-1.8-8.9-4.4-12.3-7.8-3.5-3.3-6.2-7.4-8.2-12-2-4.7-3-9.8-3-15.5"}),s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M423.2,65.9c-3.4,0-6.3.7-8.9,2.2-2.6,1.5-4.9,3.5-6.8,6.1-1.9,2.6-3.3,5.8-4.3,9.4-1,3.7-1.5,7.7-1.5,12.1v.9c3.5-.3,7.1-.9,11-1.7,3.9-.8,7.4-2,10.7-3.5,3.2-1.5,5.9-3.4,8.1-5.7,2.1-2.4,3.2-5.3,3.2-8.7s-.9-5.9-2.7-8c-1.8-2.1-4.7-3.1-8.7-3.1M380,98.4c0-5.7.9-11,2.7-15.9,1.8-5,4.5-9.3,8.2-13,3.7-3.7,8.3-6.6,13.9-8.8,5.6-2.1,12.2-3.2,19.9-3.2s6.8.4,10.4,1.2c3.6.8,6.8,2,9.8,3.8,3,1.7,5.4,4,7.4,6.8,1.9,2.8,2.9,6.1,2.9,10s-1.6,9-4.9,12.2c-3.3,3.2-7.5,5.8-12.6,7.7-5.1,1.9-10.8,3.4-16.9,4.3-6.1.9-12,1.6-17.7,1.9.5,3.1,1.5,5.9,2.9,8.3,1.4,2.4,3.1,4.4,5.2,6,2,1.6,4.2,2.8,6.6,3.6,2.4.8,4.7,1.2,7.1,1.2s5-.3,7.2-.9c2.2-.6,4.2-1.3,6-2.3,1.8-.9,3.5-2,4.9-3.1,1.5-1.1,2.8-2.2,3.9-3.2,1-1,2-1.9,2.8-2.4.8-.6,1.8-.9,3-.9,2.4,0,3.6,1.2,3.6,3.6s-1,4-3,6.4c-2,2.4-4.7,4.6-8,6.7-3.4,2-7.2,3.8-11.5,5.2-4.3,1.4-8.9,2.1-13.7,2.1s-10.9-.9-15.8-2.8c-4.9-1.9-9.1-4.5-12.7-7.8-3.6-3.3-6.4-7.2-8.5-11.8-2-4.6-3.1-9.5-3.1-14.8"}),s.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M464.7,123.7c0-6.5,5.3-11.8,11.8-11.8s11.8,5.3,11.8,11.8-5.3,11.8-11.8,11.8-11.8-5.3-11.8-11.8"})]}),AI=({onClick:e})=>s.jsx("div",{className:"flex h-[80px] min-h-[80px] cursor-pointer items-center justify-center border-b",onClick:e,children:s.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-full",children:jI})}),kI=()=>{const{currentTheme:e,toggleTheme:t}=Xa(),n=`Toggle theme (currently ${e})`;return s.jsxs(hs,{children:[s.jsx(gs,{asChild:!0,children:s.jsx("button",{type:"button",onClick:t,className:"relative mx-auto flex w-full cursor-pointer flex-col items-center bg-[var(--color-primary-w100)] px-3 py-5 text-xs text-[var(--color-primary-text-w10)] transition-colors hover:bg-[var(--color-primary-w90)] hover:text-[var(--color-primary-text-w10)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":n,title:n,children:s.jsx(ff,{className:"mb-1 h-6 w-6"})})}),s.jsx(xs,{side:"right",children:n})]})},TI=({items:e,bottomItems:t,activeItem:n,onItemClick:r})=>s.jsxs("nav",{className:"flex flex-1 flex-col",role:"navigation","aria-label":"Main navigation",children:[s.jsx("ul",{className:"space-y-1",children:e.map(o=>s.jsxs("li",{children:[s.jsx(Zu,{item:o,isActive:n===o.id,onItemClick:r}),o.showDividerAfter&&s.jsx("div",{className:"mx-4 my-3 border-t border-[var(--color-secondary-w70)]"})]},o.id))}),t&&t.length>0&&s.jsx("div",{className:"flex-1"}),t&&t.length>0&&s.jsx("ul",{className:"space-y-1",children:t.map(o=>s.jsx("li",{className:"my-4",children:o.id==="theme-toggle"?s.jsx(kI,{}):s.jsx(Zu,{item:o,isActive:n===o.id,onItemClick:r},o.id)},o.id))})]}),Zu=({item:e,isActive:t,onItemClick:n})=>{const{id:r,label:o,icon:a,disabled:i}=e,l=()=>{!i&&n&&n(r)},c=u=>{(u.key==="Enter"||u.key===" ")&&l()};return s.jsxs(hs,{children:[s.jsx(gs,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:n?l:void 0,onKeyDown:n?c:void 0,disabled:i,className:me("relative mx-auto flex w-full cursor-pointer flex-col items-center border-l-4 border-[var(--color-primary-w100)] px-3 py-5 text-xs transition-colors","bg-[var(--color-primary-w100)] hover:bg-[var(--color-primary-w90)]","text-[var(--color-primary-text-w10)] hover:bg-[var(--color-primary-w90)] hover:text-[var(--color-primary-text-w10)]","disabled:cursor-not-allowed disabled:opacity-50",t?"border-l-4 border-[var(--color-brand-wMain)] bg-[var(--color-primary-w90)]":""),"aria-label":o,"aria-current":t?"page":void 0,children:[s.jsx(a,{className:me("mb-1 h-6 w-6",t&&"text-[var(--color-brand-wMain)]")}),s.jsx("span",{className:"text-center text-[13px] leading-tight",children:o})]})}),s.jsx(xs,{side:"right",children:o})]})},_I=[{id:"chat",label:"Chat",icon:ia},{id:"agentMesh",label:"Agents",icon:Fl},{id:"projects",label:"Projects",icon:pf}],Ju=[{id:"theme-toggle",label:"Theme",icon:ff,onClick:()=>{}}];function iv(e=!0){return _I.filter(t=>!(t.id==="projects"&&!e))}iv(!0);const ci=({title:e,breadcrumbs:t,tabs:n,buttons:r,leadingAction:o})=>s.jsxs("div",{className:"relative flex max-h-[80px] min-h-[80px] w-full items-center border-b px-8",children:[t&&t.length>0&&s.jsx("div",{className:"absolute top-1 left-8 flex h-8 items-center",children:t.map((a,i)=>s.jsxs(At.Fragment,{children:[i>0&&s.jsx("span",{className:"mx-1",children:s.jsx(Gv,{size:16})}),a.onClick?s.jsx(ne,{variant:"link",className:"m-0 p-0",onClick:a.onClick,children:a.label}):s.jsx("div",{children:a.label})]},i))}),o&&s.jsx("div",{className:"mr-4 flex items-center pt-[35px]",children:o}),s.jsx("div",{className:"flex items-center pt-[35px] text-xl",children:e}),n&&n.length>0&&s.jsx("div",{className:"ml-8 flex items-center pt-[35px]",role:"tablist",children:n.map((a,i)=>s.jsxs("button",{role:"tab","aria-selected":a.isActive,onClick:a.onClick,className:`relative cursor-pointer px-4 py-3 font-medium transition-colors duration-200 ${a.isActive?"border-b-2 border-[var(--color-brand-wMain)] font-semibold":""} ${i>0?"ml-6":""}`,children:[a.label,a.isActive&&s.jsx("div",{className:"absolute right-0 bottom-0 left-0 h-0.5"})]},a.id))}),s.jsx("div",{className:"flex-1"}),r&&r.length>0&&s.jsx("div",{className:"flex items-center gap-2 pt-[35px]",children:r.map((a,i)=>s.jsx(At.Fragment,{children:a},i))})]});function II(){const{agents:e,agentsLoading:t,agentsError:n,agentsRefetch:r}=qe(),[o,a]=d.useState("cards"),i=()=>{if(o===Gu.CARDS)return s.jsx(_l,{agents:e});const l=Zx.getPluginById(o);return l?l.render({agents:e}):(console.warn(`Layout ${o} not found, falling back to cards layout`),s.jsx(_l,{agents:e}))};return s.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsx(ci,{title:"Agents",buttons:[s.jsxs(ne,{"data-testid":"refreshAgents",disabled:t,variant:"ghost",title:"Refresh Agents",onClick:()=>r(),children:[s.jsx(Ul,{className:"size-4"}),"Refresh Agents"]})]}),t?s.jsx(ns,{title:"Loading agents...",variant:"loading"}):n?s.jsx(ns,{variant:"error",title:"Error loading agents",subtitle:n}):s.jsxs("div",{className:`relative flex-1 p-4 ${o===Gu.CARDS?"":"bg-[var(--muted)] dark:bg-[var(--color-bg-wMain)]"}`,children:[s.jsx("div",{className:"absolute right-8 z-20 flex items-center space-x-4",children:s.jsx(p_,{currentLayout:o,onLayoutChange:a})}),i()]})]})}const RI=At.memo(({isOpen:e,onClose:t,onConfirm:n,sessionName:r})=>e?s.jsx(dn,{open:e,onOpenChange:t,children:s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Delete Chat Session?"}),s.jsxs(mn,{children:["This action cannot be undone. This chat session and any associated artifacts will be permanently deleted: ",s.jsx("strong",{children:r})]})]}),s.jsxs($n,{children:[s.jsx(ne,{variant:"ghost",onClick:t,title:"Cancel",children:"Cancel"}),s.jsx(ne,{onClick:n,title:"Delete",children:"Delete"})]})]})}):null),Zs=4,Dl={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},MI={chatPanelSizes:{...Dl.chatPanelSizes,min:50},sidePanelSizes:{...Dl.sidePanelSizes,max:50}};function Qu(){var W;const{activeProject:e}=pr(),{agents:t,sessionName:n,messages:r,isSidePanelCollapsed:o,setIsSidePanelCollapsed:a,openSidePanelTab:i,setTaskIdInSidePanel:l,isResponding:c,latestStatusText:u,isLoadingSession:p,sessionToDelete:f,closeSessionDeleteModal:m,confirmSessionDelete:h,currentTaskId:x}=qe(),{isTaskMonitorConnected:g,isTaskMonitorConnecting:w,taskMonitorSseError:v,connectTaskMonitorStream:b}=Rc(),[y,C]=d.useState(!0),[k,E]=d.useState(!1),S=d.useRef(null),N=d.useRef(null),L=d.useRef(null),{chatPanelSizes:$,sidePanelSizes:D}=d.useMemo(()=>y?Dl:MI,[y]),M=d.useCallback(U=>{if(E(!0),N.current)if(U)N.current.resize(Zs);else{const Y=L.current||D.default;N.current.resize(Y)}setTimeout(()=>E(!1),300)},[D.default]),R=d.useCallback(()=>{a(!0)},[a]),F=d.useCallback(()=>{a(!1)},[a]),z=d.useCallback(U=>{U>Zs+1&&(L.current=U)},[]),A=d.useCallback(()=>{C(!y)},[y]),G=void 0,j=d.useMemo(()=>n||"New Chat",[n]);d.useEffect(()=>{N.current&&o&&N.current.resize(Zs);const U=()=>{if(N.current&&o){E(!0);const Y=L.current||D.default;N.current.resize(Y),a(!1),setTimeout(()=>E(!1),300)}};return window.addEventListener("expand-side-panel",U),()=>{window.removeEventListener("expand-side-panel",U)}},[o,a,D.default]);const _=d.useMemo(()=>{const U=new Map;return r.forEach((Y,P)=>{Y.taskId&&U.set(Y.taskId,P)}),U},[r]),O=d.useMemo(()=>r.find(U=>U.isStatusBubble),[r]),H=d.useMemo(()=>{if(!O||!O.parts)return null;const U=O.parts.find(Y=>Y.kind==="text");return(U==null?void 0:U.text)||null},[O]),Q=d.useMemo(()=>{if(x)return()=>{l(x),i("workflow")}},[x,l,i]);return d.useEffect(()=>{const U=()=>{!g&&!w&&v&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),b())};return window.addEventListener("focus",U),()=>{window.removeEventListener("focus",U)}},[g,w,v,b]),s.jsxs("div",{className:"relative flex h-screen w-full flex-col overflow-hidden",children:[s.jsx("div",{className:`absolute top-0 left-0 z-20 h-screen transition-transform duration-300 ${y?"-translate-x-full":"translate-x-0"}`,children:s.jsx(W_,{onToggle:A})}),s.jsx("div",{className:`transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:s.jsx(ci,{title:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(hs,{delayDuration:300,children:[s.jsx(gs,{className:"truncate max-w-[400px] cursor-default text-left border-0 bg-transparent p-0 hover:bg-transparent font-inherit text-inherit",children:j}),s.jsx(xs,{side:"bottom",children:s.jsx("p",{children:j})})]}),e&&s.jsx(Kr,{variant:"outline",className:"text-xs bg-primary/10 border-primary/30 text-primary font-semibold px-2 py-0.5 shadow-sm max-w-[200px]",title:e.name,children:s.jsx("span",{className:"block truncate text-left",children:e.name})})]}),breadcrumbs:G,leadingAction:y?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{"data-testid":"showSessionsPanel",variant:"ghost",onClick:A,className:"h-10 w-10 p-0",tooltip:"Show Chat Sessions",children:s.jsx(uf,{className:"size-5"})}),s.jsx("div",{className:"h-6 border-r"}),s.jsx(Jx,{})]}):null})}),s.jsx("div",{className:"flex min-h-0 flex-1",children:s.jsx("div",{className:`min-h-0 flex-1 overflow-x-auto transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:s.jsxs(qC,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[s.jsx(iu,{defaultSize:$.default,minSize:$.min,maxSize:$.max,id:"chat-panel",children:s.jsx("div",{className:"flex h-full w-full flex-col",children:s.jsx("div",{className:"flex flex-1 flex-col py-6 min-h-0",children:p?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(cr,{size:"medium",variant:"primary",children:s.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Loading session..."})})}):s.jsxs(s.Fragment,{children:[s.jsx(Jg,{className:"text-base",ref:S,children:r.map((U,Y)=>{var K;const P=!!(U.taskId&&_.get(U.taskId)===Y),I=((K=U.metadata)==null?void 0:K.messageId)||`temp-${Y}`;return s.jsx(y_,{message:U,isLastWithTaskId:P},I)})}),s.jsxs("div",{style:Zg,children:[c&&s.jsx(Rl,{statusText:(H||u.current)??void 0,onViewWorkflow:Q}),s.jsx(kj,{agents:t,scrollToBottom:(W=S.current)==null?void 0:W.scrollToBottom})]})]})})})}),s.jsx(XC,{}),s.jsx(iu,{ref:N,defaultSize:D.default,minSize:D.min,maxSize:D.max,collapsedSize:Zs,collapsible:!0,onCollapse:R,onExpand:F,onResize:z,id:"chat-side-panel",className:k?"transition-all duration-300 ease-in-out":"",children:s.jsx("div",{className:"h-full",children:s.jsx(H_,{onCollapsedToggle:M,isSidePanelCollapsed:o,setIsSidePanelCollapsed:a,isSidePanelTransitioning:k})})})]})})}),s.jsx(RI,{isOpen:!!f,onClose:m,onConfirm:h,sessionName:(f==null?void 0:f.name)||`Session ${f==null?void 0:f.id.substring(0,8)}`})]})}const PI=e=>({displayName:e?"Solace Dark JER":"Solace Light JER",styles:{container:{backgroundColor:"transparent",fontFamily:"monospace",fontSize:"14px"},property:e?"var(--color-primary-text-w10)":"var(--color-primary-text-wMain)",bracket:"var(--color-secondary-text-w50)",itemCount:{color:"var(--color-secondary-text-w50)",fontStyle:"italic"},string:e?"var(--color-success-w70)":"var(--color-success-wMain)",number:"var(--color-accent-n0-wMain)",boolean:e?"var(--color-warning-w70)":"var(--color-warning-wMain)",null:{color:"var(--color-secondary-text-w50)",fontStyle:"italic"},iconCollection:"var(--color-secondary-text-w50)",iconCopy:"var(--color-secondary-text-w50)"}}),Ll=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=Xa(),o=d.useMemo(()=>PI(r==="dark"),[r]),a=d.useMemo(()=>t===void 0||t<0?!1:t,[t]),i=d.useMemo(()=>e===null||typeof e!="object"?{value:e}:e,[e]),l=`rounded-lg border overflow-auto ${n}`.trim();return e===void 0?s.jsx("div",{className:l,children:s.jsx("span",{className:"italic",children:"No JSON data"})}):s.jsx("div",{className:l,children:s.jsx(Yv,{data:i,theme:o,viewOnly:!0,collapse:a,showStringQuotes:!0,showCollectionCount:"when-closed"})})},DI=({isOpen:e,onClose:t,onSubmit:n,isSubmitting:r=!1})=>{const[o,a]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(null),p=async m=>{if(m.preventDefault(),!o.trim()){u("Project name is required");return}try{await n({name:o.trim(),description:i.trim()}),a(""),l(""),u(null)}catch(h){u(h instanceof Error?h.message:"Failed to create project")}},f=()=>{r||(a(""),l(""),u(null),t())};return s.jsx(dn,{open:e,onOpenChange:m=>!m&&f(),children:s.jsx(un,{className:"sm:max-w-[500px]",children:s.jsxs("form",{onSubmit:p,children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Create New Project"}),s.jsx(mn,{children:"Create a new project to organize your chats and files. You can add more details after creation."})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[c&&s.jsx(br,{variant:"error",message:c}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{htmlFor:"project-name",className:"text-sm font-medium",children:["Project Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx(bc,{id:"project-name",value:o,onChange:m=>a(m.target.value),disabled:r,required:!0,maxLength:255})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"project-description",className:"text-sm font-medium",children:"Description"}),s.jsx(Vr,{id:"project-description",value:i,onChange:m=>l(m.target.value),disabled:r,rows:3,maxLength:1e3}),s.jsxs("div",{className:"text-xs text-muted-foreground text-right",children:[i.length,"/1000 characters"]})]})]}),s.jsxs($n,{children:[s.jsx(ne,{type:"button",variant:"ghost",onClick:f,disabled:r,children:"Cancel"}),s.jsx(ne,{type:"submit",disabled:r,children:r?"Creating...":"Create Project"})]})]})})})},LI=({onClick:e})=>s.jsx(yc,{className:"h-[196px] w-full sm:w-[380px] flex-shrink-0 cursor-pointer transition-all duration-200 hover:shadow-lg bg-card border border-dashed border-muted-foreground/50 hover:border-primary hover:bg-accent/30",onClick:e,role:"button",tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e())},children:s.jsx(Cc,{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"rounded-full bg-primary/10 p-4",children:s.jsx(Zi,{className:"h-8 w-8 text-primary"})})}),s.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Create New Project"})]})})}),OI=({isOpen:e,files:t,onClose:n,onConfirm:r,isSubmitting:o=!1})=>{const[a,i]=d.useState({});d.useEffect(()=>{e&&i({})},[e]);const l=d.useCallback((p,f)=>{i(m=>({...m,[p]:f}))},[]),c=d.useCallback(()=>{if(!t)return;const p=new FormData,f={};for(const m of Array.from(t))p.append("files",m),a[m.name]&&(f[m.name]=a[m.name]);Object.keys(f).length>0&&p.append("fileMetadata",JSON.stringify(f)),r(p)},[t,a,r]),u=t?Array.from(t):[];return s.jsx(dn,{open:e,onOpenChange:p=>!p&&n(),children:s.jsxs(un,{className:"sm:max-w-[600px]",children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Upload Files to Project"}),s.jsx(mn,{children:"Add descriptions for each file. This helps Solace Agent Mesh understand the file's purpose."})]}),s.jsx("div",{className:"space-y-4 py-4",children:u.length>0?s.jsx("div",{className:"space-y-2 max-h-[50vh] overflow-y-auto pr-2",children:u.map((p,f)=>s.jsx(yc,{noPadding:!0,className:"bg-muted/50 overflow-hidden shadow-none py-3",children:s.jsxs(Cc,{noPadding:!0,className:"px-3 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(Gn,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[s.jsx("p",{className:"text-sm font-medium text-foreground break-all line-clamp-2",title:p.name,children:p.name}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[(p.size/1024).toFixed(1)," KB"]})]})]}),s.jsx(Vr,{className:"bg-background text-foreground mt-2",rows:2,disabled:o,value:a[p.name]||"",onChange:m=>l(p.name,m.target.value)})]})},f))}):s.jsx("p",{className:"text-muted-foreground",children:"No files selected."})}),s.jsxs($n,{children:[s.jsx(ne,{variant:"ghost",onClick:n,disabled:o,children:"Cancel"}),s.jsx(ne,{onClick:c,disabled:o||u.length===0,children:o?"Uploading...":`Upload ${u.length} File(s)`})]})]})})},$I=({project:e,onClick:t,onDelete:n})=>{const[r,o]=d.useState(!1),a=[{id:"deleteProject",label:"Delete",onClick:()=>{n==null||n(e)}}];return s.jsxs(yc,{className:`group bg-card flex h-[196px] w-full flex-shrink-0 cursor-pointer flex-col gap-4 border py-4 transition-all duration-200 sm:w-[380px] ${t?"hover:bg-accent/50":""} `,onClick:()=>t==null?void 0:t(),role:t?"button":void 0,tabIndex:t?0:void 0,children:[s.jsx(a1,{children:s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("div",{className:"max-w-[225px] min-w-0",children:s.jsx(i1,{className:"text-foreground truncate text-lg font-semibold",title:e.name,children:e.name})}),s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n&&s.jsxs(Pc,{open:r,onOpenChange:o,children:[s.jsx(Dc,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",tooltip:"More options",onClick:i=>i.stopPropagation(),children:s.jsx(zl,{className:"h-4 w-4"})})}),s.jsx(Lc,{align:"start",side:"bottom",className:"w-auto",sideOffset:0,onClick:i=>i.stopPropagation(),children:s.jsx(Ja,{actions:a})})]})})]})}),s.jsxs(Cc,{className:"flex flex-1 flex-col justify-between",children:[s.jsx("div",{children:e.description?s.jsx(l1,{className:"line-clamp-3",title:e.description,children:e.description}):s.jsx("div",{})}),s.jsxs("div",{className:"text-muted-foreground mt-3 flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1",children:["Created: ",ql(e.createdAt),s.jsx("div",{children:"|"}),s.jsx("div",{className:"max-w-[80px] truncate",title:e.userId,children:e.userId})]}),s.jsx("div",{children:e.artifactCount!==void 0&&e.artifactCount!==null&&s.jsxs(Kr,{variant:"secondary",className:"flex h-6 items-center gap-1",title:`${e.artifactCount} ${e.artifactCount===1?"file":"files"}`,children:[s.jsx(Gn,{className:"h-3.5 w-3.5"}),s.jsx("span",{children:e.artifactCount})]})})]})]})]})},lv=({isOpen:e,onClose:t,onConfirm:n,project:r,isDeleting:o=!1})=>!e||!r?null:s.jsx(dn,{open:e,onOpenChange:t,children:s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Delete Project?"}),s.jsxs(mn,{children:["Are you sure you want to delete the project ",s.jsxs("strong",{children:['"',r.name,'"']}),"?",s.jsx("br",{}),s.jsx("br",{}),"This will remove the project and all its associated chat sessions and artifacts. This action cannot be undone."]})]}),s.jsxs($n,{children:[s.jsx(ne,{variant:"ghost",onClick:t,disabled:o,children:"Cancel"}),s.jsx(ne,{variant:"outline",onClick:n,disabled:o,children:o?"Deleting...":"Delete Project"})]})]})}),FI=({projects:e,searchQuery:t,onSearchChange:n,onProjectClick:r,onCreateNew:o,onDelete:a,isLoading:i=!1})=>s.jsx("div",{className:"flex h-full flex-col bg-background",children:s.jsxs("div",{className:"h-full w-full pt-12 pl-12",children:[s.jsx("input",{type:"text",placeholder:"Search...",value:t,onChange:l=>n(l.target.value),className:"bg-background mb-4 rounded-md border px-3 py-2"}),i?s.jsx("div",{className:"flex items-center justify-center p-12",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading projects..."})]})}):e.length===0&&t?s.jsxs("div",{className:"flex flex-col items-center justify-center p-12 text-center",children:[s.jsx(pf,{className:"mb-4 h-16 w-16 text-muted-foreground"}),s.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:"No projects found"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your search terms"})]}):s.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:s.jsxs("div",{className:"flex flex-wrap gap-10",children:[s.jsx(LI,{onClick:o}),e.map(l=>s.jsx($I,{project:l,onClick:()=>r(l),onDelete:a},l.id))]})})]})}),zI=({isOpen:e,onClose:t,onSave:n,project:r,isSaving:o,error:a})=>{const{validationLimits:i}=Rt(),l=(i==null?void 0:i.projectInstructionsMax)??4e3,[c,u]=d.useState(r.systemPrompt||""),[p,f]=d.useState(null);d.useEffect(()=>{e&&(u(r.systemPrompt||""),f(null))},[e,r.systemPrompt]),d.useEffect(()=>{a&&f(a)},[a]);const m=async()=>{if(f(null),c.trim()!==(r.systemPrompt||""))try{await n(c.trim()),t()}catch{}else t()},h=()=>{u(r.systemPrompt||""),f(null),t()},x=c.length,g=x>l,w=x>l*.9;return s.jsx(dn,{open:e,onOpenChange:v=>!v&&h(),children:s.jsxs(un,{className:"max-w-3xl max-h-[80vh] flex flex-col",children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Edit Project Instructions"}),s.jsx(mn,{children:"Provide instructions that will guide the AI when working with this project."})]}),s.jsxs("div",{className:"flex-1 min-h-0 space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Vr,{value:c,onChange:v=>u(v.target.value),placeholder:"Add instructions for this project...",rows:15,disabled:o,className:`text-sm resize-none ${g?"border-destructive focus-visible:ring-destructive":""}`}),s.jsx("div",{className:`mt-1 text-xs ${g?"text-destructive font-medium":w?"text-orange-500":"text-muted-foreground"}`,children:g?`Instructions must be less than ${l} characters (currently ${x})`:`${x} / ${l} characters`})]}),p&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:[s.jsx(cs,{className:"h-4 w-4 flex-shrink-0"}),s.jsx("span",{children:p})]})]}),s.jsxs($n,{children:[s.jsx(ne,{variant:"outline",onClick:h,disabled:o,children:"Discard Changes"}),s.jsx(ne,{onClick:m,disabled:o||g,children:"Save"})]})]})})},UI=({project:e,onSave:t,isSaving:n,error:r})=>{const[o,a]=d.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Instructions"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-8 w-8 p-0",tooltip:"Edit",children:s.jsx(Ta,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"px-4",children:s.jsx("div",{className:`text-sm text-muted-foreground whitespace-pre-wrap rounded-md bg-muted p-3 min-h-[120px] max-h-[400px] overflow-y-auto ${e.systemPrompt?"":"flex items-center justify-center"}`,children:e.systemPrompt||"No instructions provided."})})]}),s.jsx(zI,{isOpen:o,onClose:()=>a(!1),onSave:t,project:e,isSaving:n,error:r})]})},BI=({project:e,onSave:t,isSaving:n})=>{const[r,o]=d.useState(!1),[a,i]=d.useState(e.defaultAgentId||null),{agents:l,isLoading:c}=_c();d.useEffect(()=>{i(e.defaultAgentId||null)},[e.defaultAgentId]);const u=async()=>{a!==(e.defaultAgentId||null)&&await t(a),o(!1)},p=()=>{i(e.defaultAgentId||null),o(!1)},f=l.find(h=>h.name===e.defaultAgentId),m=(f==null?void 0:f.displayName)||e.defaultAgentId||"None";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Default Agent"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>o(!0),disabled:c,className:"h-8 w-8 p-0",tooltip:"Edit",children:s.jsx(Ta,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"px-4",children:s.jsx("div",{className:"text-sm text-muted-foreground rounded-md bg-muted p-2.5 flex items-center",children:e.defaultAgentId?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fl,{className:"h-4 w-4"}),s.jsx("span",{children:m})]}):s.jsx("span",{className:"w-full text-center",children:"No default agent set."})})})]}),s.jsx(dn,{open:r,onOpenChange:o,children:s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Edit Default Agent"}),s.jsx(mn,{children:"Select the default agent for this project. This agent will be used when starting new chats in this project."})]}),s.jsx("div",{className:"py-4",children:s.jsxs(Cs,{value:a||"none",onValueChange:h=>i(h==="none"?null:h),disabled:n||c,children:[s.jsx(Ss,{className:"w-full",children:s.jsx(Es,{placeholder:"Select default agent..."})}),s.jsxs(Ns,{children:[s.jsx(Nr,{value:"none",children:s.jsx("span",{className:"text-muted-foreground italic",children:"No default agent"})}),l.map(h=>s.jsx(Nr,{value:h.name||"",children:h.displayName||h.name},h.name))]})]})}),s.jsxs($n,{children:[s.jsx(ne,{variant:"ghost",onClick:p,disabled:n,children:"Cancel"}),s.jsx(ne,{onClick:u,disabled:n||c,children:"Save"})]})]})})]})},HI=e=>{const{configServerUrl:t}=Rt(),[n,r]=d.useState([]),[o,a]=d.useState(!0),[i,l]=d.useState(null),c=`${t}/api/v1`,u=d.useCallback(async()=>{if(!e){r([]),a(!1);return}a(!0),l(null);try{const p=`${c}/projects/${e}/artifacts`,f=await je(p,{credentials:"include"});if(!f.ok){const h=await f.json().catch(()=>({message:`Failed to fetch project artifacts. ${f.statusText}`}));throw new Error(h.message||`Failed to fetch project artifacts. ${f.statusText}`)}const m=await f.json();r(m)}catch(p){const f=p instanceof Error?p.message:"Failed to fetch project artifacts.";l(f),r([])}finally{a(!1)}},[c,e]);return d.useEffect(()=>{u()},[u]),{artifacts:n,isLoading:o,error:i,refetch:u}},WI=({artifact:e,onDownload:t,onDelete:n})=>s.jsxs("div",{className:"hover:bg-accent/50 group flex items-center justify-between rounded-md p-2",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Pm(e,"h-4 w-4 flex-shrink-0 text-muted-foreground"),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-foreground truncate text-sm font-medium",title:e.filename,children:e.filename}),s.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.last_modified&&s.jsx("span",{className:"truncate",title:Ko(e.last_modified),children:Ko(e.last_modified)}),e.size!==void 0&&s.jsxs(s.Fragment,{children:[e.last_modified&&s.jsx("span",{children:"•"}),s.jsx("span",{children:Pa(e.size)})]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",tooltip:"Download",children:s.jsx(bo,{className:"h-4 w-4"})}),n&&s.jsxs(dn,{children:[s.jsx(nm,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",tooltip:"Delete",children:s.jsx(ka,{className:"h-4 w-4"})})}),s.jsxs(un,{children:[s.jsxs(fn,{children:[s.jsxs(pn,{children:["Delete ",e.filename,"?"]}),s.jsx(mn,{children:"This action cannot be undone. This file will be permanently removed from the project."})]}),s.jsxs($n,{children:[s.jsx(dl,{asChild:!0,children:s.jsx(ne,{variant:"ghost",title:"Cancel",children:"Cancel"})}),s.jsx(ne,{variant:"outline",onClick:n,title:"Delete",children:"Delete"})]})]})]})]})]}),VI=({project:e})=>{const{artifacts:t,isLoading:n,error:r,refetch:o}=HI(e.id),{addFilesToProject:a,removeFileFromProject:i}=pr(),{onDownload:l}=Ic(e.id),c=d.useRef(null),[u,p]=d.useState(null),[f,m]=d.useState(!1),[h,x]=d.useState(!1),g=At.useMemo(()=>[...t].sort((S,N)=>{const L=S.last_modified?new Date(S.last_modified).getTime():0;return(N.last_modified?new Date(N.last_modified).getTime():0)-L}),[t]),w=()=>{var S;(S=c.current)==null||S.click()},v=S=>{const N=S.target.files;if(N&&N.length>0){const L=new DataTransfer;Array.from(N).forEach($=>L.items.add($)),p(L.files)}S.target&&(S.target.value="")},b=S=>{S.preventDefault(),S.stopPropagation(),x(!0)},y=S=>{S.preventDefault(),S.stopPropagation(),x(!1)},C=S=>{S.preventDefault(),S.stopPropagation(),x(!1);const N=S.dataTransfer.files;if(N&&N.length>0){const L=new DataTransfer;Array.from(N).forEach($=>L.items.add($)),p(L.files)}},k=async S=>{m(!0);try{await a(e.id,S),await o(),p(null)}catch(N){console.error("Failed to add files:",N)}finally{m(!1)}},E=async S=>{try{await i(e.id,S),await o()}catch(N){console.error(`Failed to delete file ${S}:`,N)}};return s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-foreground text-sm font-semibold",children:"Knowledge"}),!n&&t.length>0&&s.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",t.length,")"]})]}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:w,children:[s.jsx(ui,{className:"mr-2 h-4 w-4"}),"Upload"]})]}),s.jsxs("div",{className:"px-4 pb-3",onDragOver:b,onDragLeave:y,onDrop:C,children:[n&&s.jsx("div",{className:"flex items-center justify-center p-4",children:s.jsx(cr,{size:"small"})}),r&&s.jsxs("div",{className:"text-destructive border-destructive/50 rounded-md border p-3 text-sm",children:["Error loading files: ",r]}),!n&&!r&&t.length===0&&s.jsxs("div",{className:`flex flex-col items-center justify-center rounded-md border-2 border-dashed p-6 text-center transition-all ${h?"border-primary bg-primary/10 scale-[1.02]":"border-muted-foreground/30"}`,children:[s.jsx(ui,{className:`mb-3 h-10 w-10 transition-colors ${h?"text-primary":"text-muted-foreground"}`}),s.jsx("p",{className:`mb-1 text-sm font-medium transition-colors ${h?"text-primary":"text-foreground"}`,children:h?"Drop files here to upload":"Drag and drop files here"}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"or click the Upload button above"})]}),!n&&!r&&t.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`mb-2 rounded-md border-2 border-dashed p-3 text-center transition-all ${h?"border-primary bg-primary/10 scale-[1.02]":"border-muted-foreground/20 bg-muted/30"}`,children:[s.jsx(ui,{className:`mx-auto mb-1 h-5 w-5 transition-colors ${h?"text-primary":"text-muted-foreground"}`}),s.jsx("p",{className:`text-xs transition-colors ${h?"text-primary font-medium":"text-muted-foreground"}`,children:h?"Drop files here to upload":"Drag and drop files here to upload"})]}),s.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto rounded-md",children:g.map(S=>s.jsx(WI,{artifact:S,onDownload:()=>l(S),onDelete:()=>E(S.filename)},S.filename))})]}),s.jsx("input",{type:"file",ref:c,onChange:v,className:"hidden",multiple:!0})]}),s.jsx(OI,{isOpen:!!u,files:u,onClose:()=>p(null),onConfirm:k,isSubmitting:f})]})},GI=({project:e,onChatClick:t,onStartNewChat:n})=>{const{sessions:r,isLoading:o,error:a}=ME(e.id);return s.jsxs("div",{className:"px-6 py-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Chats"}),n&&s.jsxs(ne,{onClick:n,size:"sm",children:[s.jsx(Zi,{className:"h-4 w-4 mr-2"}),"New Chat"]})]}),o&&s.jsx("div",{className:"flex items-center justify-center p-8",children:s.jsx(cr,{size:"small"})}),a&&s.jsxs("div",{className:"text-sm text-destructive p-4 border border-destructive/50 rounded-md",children:["Error loading chats: ",a]}),!o&&!a&&r.length===0&&s.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center border border-dashed rounded-md",children:[s.jsx(ia,{className:"h-8 w-8 text-muted-foreground mb-2"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"No chats yet. Start a new chat with this project's context."}),n&&s.jsxs(ne,{onClick:n,size:"sm",children:[s.jsx(Zi,{className:"h-4 w-4 mr-2"}),"Start New Chat"]})]}),!o&&!a&&r.length>0&&s.jsx("div",{className:"space-y-2",children:r.map(i=>s.jsx("div",{className:"p-3 border rounded-md hover:bg-accent/50 cursor-pointer transition-colors shadow-sm",onClick:()=>t(i.id),role:"button",tabIndex:0,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.id))},children:s.jsx("div",{className:"flex items-start justify-between gap-2",children:s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:i.name||`Chat ${i.id.substring(0,8)}`}),s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-1",children:[s.jsx(Kv,{className:"h-3 w-3"}),s.jsx("span",{children:ql(i.updatedTime)})]})]})})},i.id))})]})},YI=({project:e,onBack:t,onStartNewChat:n,onChatClick:r})=>{const{updateProject:o,projects:a,deleteProject:i}=pr(),[l,c]=d.useState(!1),[u,p]=d.useState(null),[f,m]=d.useState(!1),[h,x]=d.useState(e.name),[g,w]=d.useState(e.description||""),[v,b]=d.useState(null),[y,C]=d.useState(!1),[k,E]=d.useState(!1),S=async R=>{p(null),c(!0);try{const F={systemPrompt:R};await o(e.id,F)}catch(F){const z=F instanceof Error?F.message:"Failed to update instructions";throw p(z),F}finally{c(!1)}},N=async R=>{c(!0);try{const F={defaultAgentId:R};await o(e.id,F)}catch(F){throw console.error("Failed to update default agent:",F),F}finally{c(!1)}},L=async()=>{const R=h.trim(),F=g.trim();if(a.some(A=>A.id!==e.id&&A.name.toLowerCase()===R.toLowerCase())){b("A project with this name already exists");return}b(null),c(!0);try{const A={};R!==e.name&&(A.name=R),F!==(e.description||"")&&(A.description=F),Object.keys(A).length>0&&await o(e.id,A),m(!1)}catch(A){console.error("Failed to update project:",A),b(A instanceof Error?A.message:"Failed to update project")}finally{c(!1)}},$=()=>{x(e.name),w(e.description||""),m(!1),b(null)},D=()=>{C(!0)},M=async()=>{E(!0);try{await i(e.id),C(!1),t()}catch(R){console.error("Failed to delete project:",R)}finally{E(!1)}};return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx(ci,{title:e.name,breadcrumbs:[{label:"Projects",onClick:t},{label:e.name}],buttons:[s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>m(!0),className:"gap-2",children:[s.jsx(Ta,{className:"h-4 w-4"}),"Edit Details"]},"edit"),s.jsxs(Vg,{children:[s.jsx(Gg,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(tf,{className:"h-4 w-4"})})}),s.jsx(Yg,{align:"end",children:s.jsxs(Wo,{onClick:D,children:[s.jsx(df,{className:"mr-2 h-4 w-4"}),"Delete"]})})]},"more")]}),e.description&&s.jsxs("div",{className:"border-b px-8 py-4",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Description"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),s.jsxs("div",{className:"flex flex-1 min-h-0",children:[s.jsx("div",{className:"w-[60%] overflow-y-auto border-r",children:r&&s.jsx(GI,{project:e,onChatClick:r,onStartNewChat:n})}),s.jsxs("div",{className:"w-[40%] overflow-y-auto bg-muted/30",children:[s.jsx(UI,{project:e,onSave:S,isSaving:l,error:u}),s.jsx(BI,{project:e,onSave:N,isSaving:l}),s.jsx(VI,{project:e})]})]}),s.jsx(dn,{open:f,onOpenChange:m,children:s.jsxs(un,{onOpenAutoFocus:R=>R.preventDefault(),children:[s.jsxs(fn,{children:[s.jsx(pn,{children:"Edit Project Details"}),s.jsx(mn,{children:"Update the name and description for this project."})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",children:"Name*"}),s.jsx(bc,{value:h,onChange:R=>x(R.target.value),placeholder:"Project name",disabled:l,maxLength:255,autoFocus:!1})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",children:"Description*"}),s.jsx(Vr,{value:g,onChange:R=>w(R.target.value),placeholder:"Project description (optional)",rows:4,disabled:l,maxLength:1e3}),s.jsxs("div",{className:"text-xs text-muted-foreground text-right",children:[g.length,"/1000 characters"]})]}),v&&s.jsx(br,{variant:"error",message:v})]}),s.jsxs($n,{children:[s.jsx(ne,{variant:"outline",onClick:$,disabled:l,children:"Discard Changes"}),s.jsx(ne,{onClick:L,disabled:l,children:"Save"})]})]})}),s.jsx(lv,{isOpen:y,onClose:()=>C(!1),onConfirm:M,project:e,isDeleting:k})]})},KI=({onProjectActivated:e})=>{const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[a,i]=d.useState(!1),[l,c]=d.useState(null),[u,p]=d.useState(!1),{isLoading:f,createProject:m,selectedProject:h,setSelectedProject:x,setActiveProject:g,refetch:w,searchQuery:v,setSearchQuery:b,filteredProjects:y,deleteProject:C}=pr(),{handleNewSession:k,handleSwitchSession:E}=qe(),S=async A=>{o(!0);try{const G=new FormData;G.append("name",A.name),A.description&&G.append("description",A.description);const j=await m(G);n(!1),await w(),x(j)}finally{o(!1)}},N=A=>{x(A)},L=()=>{x(null)},$=async A=>{h&&g(h),await E(A),e()},D=()=>{n(!0)},M=A=>{c(A),i(!0)},R=async()=>{if(l){p(!0);try{await C(l.id),i(!1),c(null)}catch(A){console.error("Failed to delete project:",A)}finally{p(!1)}}},F=async()=>{h&&(g(h),await k(!0),e(),setTimeout(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("focus-chat-input"))},150))};d.useEffect(()=>{const A=G=>{const{projectId:j}=G.detail,_=y.find(O=>O.id===j);_&&x(_)};return window.addEventListener("navigate-to-project",A),()=>{window.removeEventListener("navigate-to-project",A)}},[y,x]);const z=h!==null;return s.jsxs("div",{className:"flex h-full w-full flex-col",children:[!z&&s.jsx(ci,{title:"Projects",buttons:[s.jsxs(ne,{"data-testid":"refreshProjects",disabled:f,variant:"ghost",title:"Refresh Projects",onClick:()=>w(),children:[s.jsx(Ul,{className:"size-4"}),"Refresh"]},"refresh-projects")]}),s.jsx("div",{className:"flex-1 min-h-0",children:z?s.jsx(YI,{project:h,onBack:L,onStartNewChat:F,onChatClick:$}):s.jsx(FI,{projects:y,searchQuery:v,onSearchChange:b,onProjectClick:N,onCreateNew:D,onDelete:M,isLoading:f})}),s.jsx(DI,{isOpen:t,onClose:()=>n(!1),onSubmit:S,isSubmitting:r}),s.jsx(lv,{isOpen:a,onClose:()=>{i(!1),c(null)},onConfirm:R,project:l,isDeleting:u})]})};function qI(){const[e,t]=d.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=kE(),{projectsEnabled:a}=Rt();TE(),d.useEffect(()=>{const p=f=>{a&&!f.detail.handled&&(t("projects"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("navigate-to-project",{detail:{...f.detail,handled:!0}}))},100))};return window.addEventListener("navigate-to-project",p),()=>{window.removeEventListener("navigate-to-project",p)}},[a]);const i=d.useMemo(()=>iv(a??!1),[a]);if(o&&!n)return s.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:s.jsx(ne,{onClick:r,children:"Login"})});const l=p=>{const f=i.find(m=>m.id===p)||Ju.find(m=>m.id===p);f!=null&&f.onClick&&p!=="settings"?f.onClick():p!=="settings"&&t(p)},c=()=>{t("chat")},u=()=>{switch(e){case"chat":return s.jsx(Qu,{});case"agentMesh":return s.jsx(II,{});case"projects":return a?s.jsx(KI,{onProjectActivated:()=>t("chat")}):s.jsx(Qu,{})}};return s.jsxs("div",{className:"relative flex h-screen",children:[s.jsx(NI,{items:i,bottomItems:Ju,activeItem:e,onItemChange:l,onHeaderClick:c}),s.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:u()}),s.jsx(Nj,{})]})}function XI(){return s.jsx(Qj,{children:s.jsx(Wj,{children:s.jsx(Tj,{children:s.jsx(zj,{children:s.jsx(jE,{children:s.jsx(i0,{children:s.jsx(Fj,{children:s.jsx(_j,{children:s.jsx(qI,{})})})})})})})})})}uv.createRoot(document.getElementById("root")).render(s.jsx(d.StrictMode,{children:s.jsx(XI,{})}));
|