solace-agent-mesh 1.3.1__py3-none-any.whl → 1.3.3__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/adk/artifacts/filesystem_artifact_service.py +16 -8
- solace_agent_mesh/agent/protocol/event_handlers.py +91 -0
- solace_agent_mesh/agent/sac/app.py +2 -0
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/0e682baa.da822665.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1023fc19.8a8a9309.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.2645ef68.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.43771adc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.2afaee76.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/332e10b5.f7629851.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3d406171.5560fdf9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.3f34bf76.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/442a8107.b5c2532a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/483cef9a.8d318c2f.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/55f47984.bcd00a86.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.dff11eca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/664b740a.ba305a89.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/75384d09.abdf9cf9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/768e31b0.9abcdc48.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/945fb41e.abf2be91.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9a09e75d.5a319fd4.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.d62aad71.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.1d029b81.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{aba87c2f.071e2d94.js → aba87c2f.4ddf32f2.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/ae0e903d.abca774a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ae4415af.24cdc514.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bac0be12.27ee2c26.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c2c06897.87cb1f47.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c835a94d.ce21f0bf.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cc969b05.feef7dcc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.a19e7d78.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{cee5d587.f5b73ca1.js → cee5d587.f1e1ca86.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.cad4dbf2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f897a61a.bc634a3e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{main.1c79039d.js → main.e82b32e6.js} +2 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.aad1f874.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +18 -18
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +23 -23
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +8 -8
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +18 -18
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +8 -8
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +4 -4
- solace_agent_mesh/assets/docs/lunr-index-1757873594308.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1757873594308.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{main-C1k9E0aC.js → main-DjoMeldu.js} +8 -8
- solace_agent_mesh/client/webui/frontend/static/index.html +1 -1
- solace_agent_mesh/common/a2a/__init__.py +4 -0
- solace_agent_mesh/common/a2a/protocol.py +20 -0
- solace_agent_mesh/common/sac/sam_component_base.py +29 -9
- solace_agent_mesh/common/sam_events/__init__.py +9 -0
- solace_agent_mesh/common/sam_events/event_service.py +207 -0
- solace_agent_mesh/gateway/http_sse/alembic/env.py +1 -1
- solace_agent_mesh/gateway/http_sse/component.py +45 -35
- solace_agent_mesh/gateway/http_sse/dependencies.py +123 -60
- solace_agent_mesh/gateway/http_sse/main.py +20 -33
- solace_agent_mesh/gateway/http_sse/repository/__init__.py +37 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +9 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/message.py +41 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session.py +45 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +16 -0
- solace_agent_mesh/gateway/http_sse/repository/interfaces.py +64 -0
- solace_agent_mesh/gateway/http_sse/repository/message_repository.py +78 -0
- solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -0
- solace_agent_mesh/gateway/http_sse/repository/models/base.py +7 -0
- solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +27 -0
- solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +27 -0
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +139 -0
- solace_agent_mesh/gateway/http_sse/routers/config.py +1 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +20 -0
- solace_agent_mesh/gateway/http_sse/{api → routers}/dto/requests/session_requests.py +1 -8
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +16 -0
- solace_agent_mesh/gateway/http_sse/{api → routers}/dto/responses/session_responses.py +3 -30
- solace_agent_mesh/gateway/http_sse/{api/controllers/session_controller.py → routers/sessions.py} +20 -77
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +42 -49
- solace_agent_mesh/gateway/http_sse/{api/controllers/user_controller.py → routers/users.py} +1 -1
- solace_agent_mesh/gateway/http_sse/services/session_service.py +245 -0
- solace_agent_mesh/gateway/http_sse/session_manager.py +0 -3
- solace_agent_mesh/gateway/http_sse/shared/enums.py +0 -5
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/METADATA +1 -1
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/RECORD +120 -128
- solace_agent_mesh/assets/docs/assets/js/0e682baa.b3bbde9a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1023fc19.364235d5.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.1b0ec6f9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.a8c5ce5a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.8909df92.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/332e10b5.7a103f42.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3d406171.0b9eeed1.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.d97b8e94.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/442a8107.b3159bb2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/483cef9a.4e972867.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/55f47984.cf3781c4.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.0d080cd9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/664b740a.1b744a32.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/75384d09.c193a8f0.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/768e31b0.8b51cd70.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/945fb41e.c63791d1.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/9a09e75d.d6607c56.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.472b0310.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.4b7fa6a2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ae0e903d.4d8dda10.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ae4415af.7a2f0bbf.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/bac0be12.f50d9bac.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c2c06897.587b4af5.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c835a94d.146e3186.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/cc969b05.bd3e0d6c.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.b6535013.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.7334119c.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f897a61a.0aa29dbb.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/runtime~main.858117b7.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1757531604543.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1757531604543.json +0 -1
- solace_agent_mesh/gateway/http_sse/ARCHITECTURE_GUIDE.md +0 -676
- solace_agent_mesh/gateway/http_sse/api/__init__.py +0 -11
- solace_agent_mesh/gateway/http_sse/api/controllers/__init__.py +0 -9
- solace_agent_mesh/gateway/http_sse/api/controllers/task_controller.py +0 -279
- solace_agent_mesh/gateway/http_sse/api/dto/requests/__init__.py +0 -37
- solace_agent_mesh/gateway/http_sse/api/dto/requests/task_requests.py +0 -66
- solace_agent_mesh/gateway/http_sse/api/dto/responses/__init__.py +0 -43
- solace_agent_mesh/gateway/http_sse/api/dto/responses/task_responses.py +0 -74
- solace_agent_mesh/gateway/http_sse/application/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/application/services/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/application/services/session_service.py +0 -135
- solace_agent_mesh/gateway/http_sse/domain/entities/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/domain/entities/session.py +0 -90
- solace_agent_mesh/gateway/http_sse/domain/repositories/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/domain/repositories/session_repository.py +0 -54
- solace_agent_mesh/gateway/http_sse/infrastructure/__init__.py +0 -4
- solace_agent_mesh/gateway/http_sse/infrastructure/dependency_injection/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/infrastructure/dependency_injection/container.py +0 -123
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/__init__.py +0 -4
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/database_persistence_service.py +0 -16
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/database_service.py +0 -119
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/models.py +0 -31
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence_service.py +0 -12
- solace_agent_mesh/gateway/http_sse/infrastructure/repositories/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/infrastructure/repositories/session_repository.py +0 -174
- /solace_agent_mesh/assets/docs/assets/js/{main.1c79039d.js.LICENSE.txt → main.e82b32e6.js.LICENSE.txt} +0 -0
- /solace_agent_mesh/gateway/http_sse/{api → routers}/dto/__init__.py +0 -0
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ap=Object.defineProperty;var Np=(e,t,n)=>t in e?Ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ua=(e,t,n)=>Np(e,typeof t!="symbol"?t+"":t,n);import{c as kp}from"./client-DXU9SPI5.js";import{r as u,j as a,c as zl,a as Ur,R as pi,b as _p,N as po,X as Ro,E as Ip,d as zt,C as $l,e as mi,f as jp,A as Bl,L as hi,g as gi,P as Ul,B as Mp,S as Rp,F as da,h as Pp,i as Lp,k as sr,l as Dp,m as Op,n as Fp,o as Hl,D as xi,p as Wl,q as vi,T as zp,I as wi,s as Gl,t as $p,u as Bp,v as Up,w as Vl,x as Hp,y as Yl,z as Wp,G as Gp,H as fa,J as Vp,K as Kl,M as Yp,O as Xe,Q as Ze,U as ql,V as Kp,W as qp,Y as pa,Z as ma,_ as cs,$ as Xp,a0 as Zp,a1 as Jp,a2 as Qp,a3 as em,a4 as tm,a5 as nm,a6 as rm,a7 as om,a8 as sm,a9 as im,aa as Xl,ab as am,ac as Zl,ad as lm,ae as ha,af as ga,ag as cm,ah as xa,ai as um,aj as dm,ak as fm}from"./vendor-B0BEKoAR.js";function va(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jl(...e){return t=>{let n=!1;const r=e.map(o=>{const s=va(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():va(e[o],null)}}}}function $e(...e){return u.useCallback(Jl(...e),e)}function Pn(e){const t=pm(e),n=u.forwardRef((r,o)=>{const{children:s,...i}=r,l=u.Children.toArray(s),c=l.find(hm);if(c){const d=c.props.children,f=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return a.jsx(t,{...i,ref:o,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Ql=Pn("Slot");function pm(e){const t=u.forwardRef((n,r)=>{const{children:o,...s}=n;if(u.isValidElement(o)){const i=xm(o),l=gm(s,o.props);return o.type!==u.Fragment&&(l.ref=r?Jl(r,i):i),u.cloneElement(o,l)}return u.Children.count(o)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ec=Symbol("radix.slottable");function mm(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ec,t}function hm(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ec}function gm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function xm(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 wa=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ba=zl,Tn=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ba(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(d=>{const f=n==null?void 0:n[d],p=s==null?void 0:s[d];if(f===null)return null;const m=wa(f)||wa(p);return o[d][m]}),l=n&&Object.entries(n).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:p,className:m,...h}=f;return Object.entries(h).every(x=>{let[g,v]=x;return Array.isArray(v)?v.includes({...s,...l}[g]):{...s,...l}[g]===v})?[...d,p,m]:d},[]);return ba(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},bi=()=>localStorage.getItem("access_token"),vm=()=>localStorage.getItem("refresh_token"),wm=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},bm=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},ym=async()=>{const e=vm();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 wm(n.access_token,n.refresh_token),n.access_token}return bm(),window.location.href="/api/v1/auth/login",null},ze=async(e,t={})=>{const n=bi();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 ym();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},yi="-",Sm=e=>{const t=Em(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(yi);return l[0]===""&&l.length!==1&&l.shift(),tc(l,t)||Cm(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},tc=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?tc(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(yi);return(i=t.validators.find(({validator:l})=>l(s)))==null?void 0:i.classGroupId},ya=/^\[(.+)\]$/,Cm=e=>{if(ya.test(e)){const t=ya.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Em=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Os(n[o],r,o,t);return r},Os=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Sa(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(Tm(o)){Os(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Os(i,Sa(t,s),n,r)})})},Sa=(e,t)=>{let n=e;return t.split(yi).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Tm=e=>e.isThemeGetter,Am=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Fs="!",zs=":",Nm=zs.length,km=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,d;for(let x=0;x<o.length;x++){let g=o[x];if(i===0&&l===0){if(g===zs){s.push(o.slice(c,x)),c=x+Nm;continue}if(g==="/"){d=x;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const f=s.length===0?o:o.substring(c),p=_m(f),m=p!==f,h=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:h}};if(t){const o=t+zs,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},_m=e=>e.endsWith(Fs)?e.substring(0,e.length-1):e.startsWith(Fs)?e.substring(1):e,Im=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},jm=e=>({cache:Am(e.cacheSize),parseClassName:km(e),sortModifiers:Im(e),...Sm(e)}),Mm=/\s+/,Rm=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(Mm);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:g}=n(f);if(p){c=f+(c.length>0?" "+c:c);continue}let v=!!g,b=r(v?x.substring(0,g):x);if(!b){if(!v){c=f+(c.length>0?" "+c:c);continue}if(b=r(x),!b){c=f+(c.length>0?" "+c:c);continue}v=!1}const w=s(m).join(":"),y=h?w+Fs:w,E=y+b;if(i.includes(E))continue;i.push(E);const T=o(b,v);for(let _=0;_<T.length;++_){const I=T[_];i.push(y+I)}c=f+(c.length>0?" "+c:c)}return c};function Pm(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=nc(t))&&(r&&(r+=" "),r+=n);return r}const nc=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=nc(e[r]))&&(n&&(n+=" "),n+=t);return n};function Lm(e,...t){let n,r,o,s=i;function i(c){const d=t.reduce((f,p)=>p(f),e());return n=jm(d),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const d=r(c);if(d)return d;const f=Rm(c,n);return o(c,f),f}return function(){return s(Pm.apply(null,arguments))}}const Ge=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},rc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Dm=/^\d+\/\d+$/,Om=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Fm=/\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$/,zm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$m=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wn=e=>Dm.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),gn=e=>!!e&&Number.isInteger(Number(e)),us=e=>e.endsWith("%")&&Te(e.slice(0,-1)),an=e=>Om.test(e),Um=()=>!0,Hm=e=>Fm.test(e)&&!zm.test(e),sc=()=>!1,Wm=e=>$m.test(e),Gm=e=>Bm.test(e),Vm=e=>!ne(e)&&!re(e),Ym=e=>pr(e,lc,sc),ne=e=>rc.test(e),In=e=>pr(e,cc,Hm),ds=e=>pr(e,Jm,Te),Ca=e=>pr(e,ic,sc),Km=e=>pr(e,ac,Gm),Zr=e=>pr(e,uc,Wm),re=e=>oc.test(e),yr=e=>mr(e,cc),qm=e=>mr(e,Qm),Ea=e=>mr(e,ic),Xm=e=>mr(e,lc),Zm=e=>mr(e,ac),Jr=e=>mr(e,uc,!0),pr=(e,t,n)=>{const r=rc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mr=(e,t,n=!1)=>{const r=oc.exec(e);return r?r[1]?t(r[1]):n:!1},ic=e=>e==="position"||e==="percentage",ac=e=>e==="image"||e==="url",lc=e=>e==="length"||e==="size"||e==="bg-size",cc=e=>e==="length",Jm=e=>e==="number",Qm=e=>e==="family-name",uc=e=>e==="shadow",eh=()=>{const e=Ge("color"),t=Ge("font"),n=Ge("text"),r=Ge("font-weight"),o=Ge("tracking"),s=Ge("leading"),i=Ge("breakpoint"),l=Ge("container"),c=Ge("spacing"),d=Ge("radius"),f=Ge("shadow"),p=Ge("inset-shadow"),m=Ge("text-shadow"),h=Ge("drop-shadow"),x=Ge("blur"),g=Ge("perspective"),v=Ge("aspect"),b=Ge("ease"),w=Ge("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),re,ne],_=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],A=()=>[re,ne,c],q=()=>[Wn,"full","auto",...A()],K=()=>[gn,"none","subgrid",re,ne],U=()=>["auto",{span:["full",gn,re,ne]},gn,re,ne],Y=()=>[gn,"auto",re,ne],J=()=>["auto","min","max","fr",re,ne],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],N=()=>["auto",...A()],R=()=>[Wn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],S=()=>[e,re,ne],F=()=>[...E(),Ea,Ca,{position:[re,ne]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",Xm,Ym,{size:[re,ne]}],ee=()=>[us,yr,In],D=()=>["","none","full",d,re,ne],$=()=>["",Te,yr,In],L=()=>["solid","dashed","dotted","double"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>[Te,us,Ea,Ca],G=()=>["","none",x,re,ne],Q=()=>["none",Te,re,ne],te=()=>["none",Te,re,ne],oe=()=>[Te,re,ne],se=()=>[Wn,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[Um],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[Vm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[an],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[an],shadow:[an],spacing:["px",Te],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Wn,ne,re,v]}],container:["container"],columns:[{columns:[Te,ne,re,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:T()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[gn,"auto",re,ne]}],basis:[{basis:[Wn,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Wn,"auto","initial","none",ne]}],grow:[{grow:["",Te,re,ne]}],shrink:[{shrink:["",Te,re,ne]}],order:[{order:[gn,"first","last","none",re,ne]}],"grid-cols":[{"grid-cols":K()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":K()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[l,"screen",...R()]}],"min-w":[{"min-w":[l,"screen","none",...R()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,yr,In]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,re,ds]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",us,ne]}],"font-family":[{font:[qm,ne,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,re,ne]}],"line-clamp":[{"line-clamp":[Te,"none",re,ds]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",re,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",re,In]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Te,"auto",re,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,ne]}],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",re,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gn,re,ne],radial:["",re,ne],conic:[gn,re,ne]},Zm,Km]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,re,ne]}],"outline-w":[{outline:["",Te,yr,In]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",f,Jr,Zr]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",p,Jr,Zr]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Te,In]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",m,Jr,Zr]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Te,re,ne]}],"mix-blend":[{"mix-blend":[...W(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":W()}],"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":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":k()}],"mask-image-linear-to-pos":[{"mask-linear-to":k()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":k()}],"mask-image-t-to-pos":[{"mask-t-to":k()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":k()}],"mask-image-r-to-pos":[{"mask-r-to":k()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":k()}],"mask-image-b-to-pos":[{"mask-b-to":k()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":k()}],"mask-image-l-to-pos":[{"mask-l-to":k()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":k()}],"mask-image-x-to-pos":[{"mask-x-to":k()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":k()}],"mask-image-y-to-pos":[{"mask-y-to":k()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[re,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":k()}],"mask-image-radial-to-pos":[{"mask-radial-to":k()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":k()}],"mask-image-conic-to-pos":[{"mask-conic-to":k()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,ne]}],filter:[{filter:["","none",re,ne]}],blur:[{blur:G()}],brightness:[{brightness:[Te,re,ne]}],contrast:[{contrast:[Te,re,ne]}],"drop-shadow":[{"drop-shadow":["","none",h,Jr,Zr]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Te,re,ne]}],"hue-rotate":[{"hue-rotate":[Te,re,ne]}],invert:[{invert:["",Te,re,ne]}],saturate:[{saturate:[Te,re,ne]}],sepia:[{sepia:["",Te,re,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",re,ne]}],"backdrop-blur":[{"backdrop-blur":G()}],"backdrop-brightness":[{"backdrop-brightness":[Te,re,ne]}],"backdrop-contrast":[{"backdrop-contrast":[Te,re,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,re,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,re,ne]}],"backdrop-invert":[{"backdrop-invert":["",Te,re,ne]}],"backdrop-opacity":[{"backdrop-opacity":[Te,re,ne]}],"backdrop-saturate":[{"backdrop-saturate":[Te,re,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,re,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",re,ne]}],ease:[{ease:["linear","initial",b,re,ne]}],delay:[{delay:[Te,re,ne]}],animate:[{animate:["none",w,re,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,re,ne]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[re,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",re,ne]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",re,ne]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Te,yr,In,ds]}],stroke:[{stroke:["none",...S()]}],"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"]}},th=Lm(eh);function Ce(...e){return th(zl(e))}const nh=e=>{try{const t=new URL(e);if(t.protocol!=="artifact:")return null;const n=t.pathname.split("/").filter(s=>s),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}},dc=(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)}},rh=async e=>{try{let t,n=e.name;if(e.content){const r=atob(e.content),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);const s=new Uint8Array(o);t=new Blob([s],{type:e.mime_type||"application/octet-stream"})}else if(e.uri){const r=nh(e.uri);if(!r)throw new Error(`Invalid or unhandled URI format: ${e.uri}`);n=r.filename;const o=r.version||"latest",s=`/api/v1/artifacts/${encodeURIComponent(n)}/versions/${o}`,i=await ze(s,{credentials:"include"});if(!i.ok)throw new Error(`Failed to download file: ${i.statusText}`);t=await i.blob()}else throw new Error("File has no content or URI to download.");dc(t,n)}catch(t){console.error("Error creating download link:",t)}},fc=(e,t=2)=>{if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,s)).toFixed(r))+" "+o[s]},Ta=e=>{try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.floor(r/60),s=Math.floor(o/60),i=Math.floor(s/24);return r<60?`${r}s ago`:o<60?`${o}m ago`:s<24?`${s}h ago`:i===1?"Yesterday":i<7?`${i}d ago`:t.toLocaleDateString()}catch(t){return console.error("Error formatting date:",t),e}},Aa=(e="")=>`
|
|
1
|
+
var Ap=Object.defineProperty;var Np=(e,t,n)=>t in e?Ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ua=(e,t,n)=>Np(e,typeof t!="symbol"?t+"":t,n);import{c as kp}from"./client-DXU9SPI5.js";import{r as u,j as a,c as zl,a as Ur,R as pi,b as _p,N as po,X as Ro,E as Ip,d as zt,C as $l,e as mi,f as jp,A as Bl,L as hi,g as gi,P as Ul,B as Mp,S as Rp,F as da,h as Pp,i as Lp,k as sr,l as Dp,m as Op,n as Fp,o as Hl,D as xi,p as Wl,q as vi,T as zp,I as wi,s as Gl,t as $p,u as Bp,v as Up,w as Vl,x as Hp,y as Yl,z as Wp,G as Gp,H as fa,J as Vp,K as Kl,M as Yp,O as Xe,Q as Ze,U as ql,V as Kp,W as qp,Y as pa,Z as ma,_ as cs,$ as Xp,a0 as Zp,a1 as Jp,a2 as Qp,a3 as em,a4 as tm,a5 as nm,a6 as rm,a7 as om,a8 as sm,a9 as im,aa as Xl,ab as am,ac as Zl,ad as lm,ae as ha,af as ga,ag as cm,ah as xa,ai as um,aj as dm,ak as fm}from"./vendor-B0BEKoAR.js";function va(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jl(...e){return t=>{let n=!1;const r=e.map(o=>{const s=va(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():va(e[o],null)}}}}function $e(...e){return u.useCallback(Jl(...e),e)}function Pn(e){const t=pm(e),n=u.forwardRef((r,o)=>{const{children:s,...i}=r,l=u.Children.toArray(s),c=l.find(hm);if(c){const d=c.props.children,f=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return a.jsx(t,{...i,ref:o,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Ql=Pn("Slot");function pm(e){const t=u.forwardRef((n,r)=>{const{children:o,...s}=n;if(u.isValidElement(o)){const i=xm(o),l=gm(s,o.props);return o.type!==u.Fragment&&(l.ref=r?Jl(r,i):i),u.cloneElement(o,l)}return u.Children.count(o)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ec=Symbol("radix.slottable");function mm(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ec,t}function hm(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ec}function gm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function xm(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 wa=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ba=zl,Tn=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ba(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(d=>{const f=n==null?void 0:n[d],p=s==null?void 0:s[d];if(f===null)return null;const m=wa(f)||wa(p);return o[d][m]}),l=n&&Object.entries(n).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:p,className:m,...h}=f;return Object.entries(h).every(x=>{let[g,v]=x;return Array.isArray(v)?v.includes({...s,...l}[g]):{...s,...l}[g]===v})?[...d,p,m]:d},[]);return ba(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},bi=()=>localStorage.getItem("access_token"),vm=()=>localStorage.getItem("refresh_token"),wm=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},bm=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},ym=async()=>{const e=vm();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 wm(n.access_token,n.refresh_token),n.access_token}return bm(),window.location.href="/api/v1/auth/login",null},ze=async(e,t={})=>{const n=bi();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 ym();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},yi="-",Sm=e=>{const t=Em(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(yi);return l[0]===""&&l.length!==1&&l.shift(),tc(l,t)||Cm(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},tc=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?tc(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(yi);return(i=t.validators.find(({validator:l})=>l(s)))==null?void 0:i.classGroupId},ya=/^\[(.+)\]$/,Cm=e=>{if(ya.test(e)){const t=ya.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Em=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Os(n[o],r,o,t);return r},Os=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Sa(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(Tm(o)){Os(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Os(i,Sa(t,s),n,r)})})},Sa=(e,t)=>{let n=e;return t.split(yi).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Tm=e=>e.isThemeGetter,Am=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Fs="!",zs=":",Nm=zs.length,km=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,d;for(let x=0;x<o.length;x++){let g=o[x];if(i===0&&l===0){if(g===zs){s.push(o.slice(c,x)),c=x+Nm;continue}if(g==="/"){d=x;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const f=s.length===0?o:o.substring(c),p=_m(f),m=p!==f,h=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:h}};if(t){const o=t+zs,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},_m=e=>e.endsWith(Fs)?e.substring(0,e.length-1):e.startsWith(Fs)?e.substring(1):e,Im=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},jm=e=>({cache:Am(e.cacheSize),parseClassName:km(e),sortModifiers:Im(e),...Sm(e)}),Mm=/\s+/,Rm=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(Mm);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:g}=n(f);if(p){c=f+(c.length>0?" "+c:c);continue}let v=!!g,b=r(v?x.substring(0,g):x);if(!b){if(!v){c=f+(c.length>0?" "+c:c);continue}if(b=r(x),!b){c=f+(c.length>0?" "+c:c);continue}v=!1}const w=s(m).join(":"),y=h?w+Fs:w,E=y+b;if(i.includes(E))continue;i.push(E);const T=o(b,v);for(let _=0;_<T.length;++_){const I=T[_];i.push(y+I)}c=f+(c.length>0?" "+c:c)}return c};function Pm(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=nc(t))&&(r&&(r+=" "),r+=n);return r}const nc=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=nc(e[r]))&&(n&&(n+=" "),n+=t);return n};function Lm(e,...t){let n,r,o,s=i;function i(c){const d=t.reduce((f,p)=>p(f),e());return n=jm(d),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const d=r(c);if(d)return d;const f=Rm(c,n);return o(c,f),f}return function(){return s(Pm.apply(null,arguments))}}const Ge=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},rc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Dm=/^\d+\/\d+$/,Om=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Fm=/\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$/,zm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$m=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wn=e=>Dm.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),gn=e=>!!e&&Number.isInteger(Number(e)),us=e=>e.endsWith("%")&&Te(e.slice(0,-1)),an=e=>Om.test(e),Um=()=>!0,Hm=e=>Fm.test(e)&&!zm.test(e),sc=()=>!1,Wm=e=>$m.test(e),Gm=e=>Bm.test(e),Vm=e=>!ne(e)&&!re(e),Ym=e=>pr(e,lc,sc),ne=e=>rc.test(e),In=e=>pr(e,cc,Hm),ds=e=>pr(e,Jm,Te),Ca=e=>pr(e,ic,sc),Km=e=>pr(e,ac,Gm),Zr=e=>pr(e,uc,Wm),re=e=>oc.test(e),yr=e=>mr(e,cc),qm=e=>mr(e,Qm),Ea=e=>mr(e,ic),Xm=e=>mr(e,lc),Zm=e=>mr(e,ac),Jr=e=>mr(e,uc,!0),pr=(e,t,n)=>{const r=rc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mr=(e,t,n=!1)=>{const r=oc.exec(e);return r?r[1]?t(r[1]):n:!1},ic=e=>e==="position"||e==="percentage",ac=e=>e==="image"||e==="url",lc=e=>e==="length"||e==="size"||e==="bg-size",cc=e=>e==="length",Jm=e=>e==="number",Qm=e=>e==="family-name",uc=e=>e==="shadow",eh=()=>{const e=Ge("color"),t=Ge("font"),n=Ge("text"),r=Ge("font-weight"),o=Ge("tracking"),s=Ge("leading"),i=Ge("breakpoint"),l=Ge("container"),c=Ge("spacing"),d=Ge("radius"),f=Ge("shadow"),p=Ge("inset-shadow"),m=Ge("text-shadow"),h=Ge("drop-shadow"),x=Ge("blur"),g=Ge("perspective"),v=Ge("aspect"),b=Ge("ease"),w=Ge("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),re,ne],_=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],A=()=>[re,ne,c],q=()=>[Wn,"full","auto",...A()],K=()=>[gn,"none","subgrid",re,ne],U=()=>["auto",{span:["full",gn,re,ne]},gn,re,ne],Y=()=>[gn,"auto",re,ne],J=()=>["auto","min","max","fr",re,ne],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],N=()=>["auto",...A()],R=()=>[Wn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],S=()=>[e,re,ne],F=()=>[...E(),Ea,Ca,{position:[re,ne]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",Xm,Ym,{size:[re,ne]}],ee=()=>[us,yr,In],D=()=>["","none","full",d,re,ne],$=()=>["",Te,yr,In],L=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>[Te,us,Ea,Ca],V=()=>["","none",x,re,ne],Q=()=>["none",Te,re,ne],te=()=>["none",Te,re,ne],oe=()=>[Te,re,ne],se=()=>[Wn,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[Um],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[Vm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[an],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[an],shadow:[an],spacing:["px",Te],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Wn,ne,re,v]}],container:["container"],columns:[{columns:[Te,ne,re,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:T()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[gn,"auto",re,ne]}],basis:[{basis:[Wn,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Wn,"auto","initial","none",ne]}],grow:[{grow:["",Te,re,ne]}],shrink:[{shrink:["",Te,re,ne]}],order:[{order:[gn,"first","last","none",re,ne]}],"grid-cols":[{"grid-cols":K()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":K()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[l,"screen",...R()]}],"min-w":[{"min-w":[l,"screen","none",...R()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,yr,In]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,re,ds]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",us,ne]}],"font-family":[{font:[qm,ne,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,re,ne]}],"line-clamp":[{"line-clamp":[Te,"none",re,ds]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",re,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",re,In]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Te,"auto",re,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,ne]}],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",re,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gn,re,ne],radial:["",re,ne],conic:[gn,re,ne]},Zm,Km]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,re,ne]}],"outline-w":[{outline:["",Te,yr,In]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",f,Jr,Zr]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",p,Jr,Zr]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Te,In]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",m,Jr,Zr]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Te,re,ne]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"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":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":k()}],"mask-image-linear-to-pos":[{"mask-linear-to":k()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":k()}],"mask-image-t-to-pos":[{"mask-t-to":k()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":k()}],"mask-image-r-to-pos":[{"mask-r-to":k()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":k()}],"mask-image-b-to-pos":[{"mask-b-to":k()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":k()}],"mask-image-l-to-pos":[{"mask-l-to":k()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":k()}],"mask-image-x-to-pos":[{"mask-x-to":k()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":k()}],"mask-image-y-to-pos":[{"mask-y-to":k()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[re,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":k()}],"mask-image-radial-to-pos":[{"mask-radial-to":k()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":k()}],"mask-image-conic-to-pos":[{"mask-conic-to":k()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,ne]}],filter:[{filter:["","none",re,ne]}],blur:[{blur:V()}],brightness:[{brightness:[Te,re,ne]}],contrast:[{contrast:[Te,re,ne]}],"drop-shadow":[{"drop-shadow":["","none",h,Jr,Zr]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Te,re,ne]}],"hue-rotate":[{"hue-rotate":[Te,re,ne]}],invert:[{invert:["",Te,re,ne]}],saturate:[{saturate:[Te,re,ne]}],sepia:[{sepia:["",Te,re,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",re,ne]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[Te,re,ne]}],"backdrop-contrast":[{"backdrop-contrast":[Te,re,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,re,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,re,ne]}],"backdrop-invert":[{"backdrop-invert":["",Te,re,ne]}],"backdrop-opacity":[{"backdrop-opacity":[Te,re,ne]}],"backdrop-saturate":[{"backdrop-saturate":[Te,re,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,re,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",re,ne]}],ease:[{ease:["linear","initial",b,re,ne]}],delay:[{delay:[Te,re,ne]}],animate:[{animate:["none",w,re,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,re,ne]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[re,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",re,ne]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",re,ne]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Te,yr,In,ds]}],stroke:[{stroke:["none",...S()]}],"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"]}},th=Lm(eh);function Ce(...e){return th(zl(e))}const nh=e=>{try{const t=new URL(e);if(t.protocol!=="artifact:")return null;const n=t.pathname.split("/").filter(s=>s),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}},dc=(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)}},rh=async e=>{try{let t,n=e.name;if(e.content){const r=atob(e.content),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);const s=new Uint8Array(o);t=new Blob([s],{type:e.mime_type||"application/octet-stream"})}else if(e.uri){const r=nh(e.uri);if(!r)throw new Error(`Invalid or unhandled URI format: ${e.uri}`);n=r.filename;const o=r.version||"latest",s=`/api/v1/artifacts/${encodeURIComponent(n)}/versions/${o}`,i=await ze(s,{credentials:"include"});if(!i.ok)throw new Error(`Failed to download file: ${i.statusText}`);t=await i.blob()}else throw new Error("File has no content or URI to download.");dc(t,n)}catch(t){console.error("Error creating download link:",t)}},fc=(e,t=2)=>{if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,s)).toFixed(r))+" "+o[s]},Ta=e=>{try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.floor(r/60),s=Math.floor(o/60),i=Math.floor(s/24);return r<60?`${r}s ago`:o<60?`${o}m ago`:s<24?`${s}h ago`:i===1?"Yesterday":i<7?`${i}d ago`:t.toLocaleDateString()}catch(t){return console.error("Error formatting date:",t),e}},Aa=(e="")=>`
|
|
2
2
|
whitespace-normal
|
|
3
3
|
break-words
|
|
4
4
|
leading-[24px]
|
|
@@ -69,7 +69,7 @@ var Ap=Object.defineProperty;var Np=(e,t,n)=>t in e?Ap(e,t,{enumerable:!0,config
|
|
|
69
69
|
[&>button]:dark:!border-[var(--color-secondary-w70)]
|
|
70
70
|
|
|
71
71
|
${e}
|
|
72
|
-
`.trim().replace(/\s+/g," ");function ve(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 sh(e,t){const n=u.createContext(t),r=s=>{const{children:i,...l}=s,c=u.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function An(e,t=[]){let n=[];function r(s,i){const l=u.createContext(i),c=n.length;n=[...n,i];const d=p=>{var b;const{scope:m,children:h,...x}=p,g=((b=m==null?void 0:m[e])==null?void 0:b[c])||l,v=u.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:h})};d.displayName=s+"Provider";function f(p,m){var g;const h=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=u.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,f]}const o=()=>{const s=n.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||s;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,ih(o,...t)]}function ih(...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(s){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const p=c(s)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var ah=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=ah.reduce((e,t)=>{const n=Pn(`Primitive.${t}`),r=u.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function lh(e,t){e&&Ur.flushSync(()=>e.dispatchEvent(t))}function yn(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ch(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e);u.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 uh="DismissableLayer",$s="dismissableLayer.update",dh="dismissableLayer.pointerDownOutside",fh="dismissableLayer.focusOutside",Na,pc=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hr=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(pc),[f,p]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=u.useState({}),x=$e(t,I=>p(I)),g=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),w=f?g.indexOf(f):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=b,T=hh(I=>{const A=I.target,q=[...d.branches].some(K=>K.contains(A));!E||q||(o==null||o(I),i==null||i(I),I.defaultPrevented||l==null||l())},m),_=gh(I=>{const A=I.target;[...d.branches].some(K=>K.contains(A))||(s==null||s(I),i==null||i(I),I.defaultPrevented||l==null||l())},m);return ch(I=>{w===d.layers.size-1&&(r==null||r(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Na=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),ka(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Na)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),ka())},[f,d]),u.useEffect(()=>{const I=()=>h({});return document.addEventListener($s,I),()=>document.removeEventListener($s,I)},[]),a.jsx(ke.div,{...c,ref:x,style:{pointerEvents:y?E?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,T.onPointerDownCapture)})});Hr.displayName=uh;var ph="DismissableLayerBranch",mh=u.forwardRef((e,t)=>{const n=u.useContext(pc),r=u.useRef(null),o=$e(t,r);return u.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(ke.div,{...e,ref:o})});mh.displayName=ph;function hh(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=u.useRef(!1),o=u.useRef(()=>{});return u.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){mc(dh,n,d,{discrete:!0})};const d={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",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function gh(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=u.useRef(!1);return u.useEffect(()=>{const o=s=>{s.target&&!r.current&&mc(fh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ka(){const e=new CustomEvent($s);document.dispatchEvent(e)}function mc(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?lh(o,s):o.dispatchEvent(s)}var nt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},xh=pi[" useId ".trim().toString()]||(()=>{}),vh=0;function Xt(e){const[t,n]=u.useState(xh());return nt(()=>{n(r=>r??String(vh++))},[e]),t?`radix-${t}`:""}const wh=["top","right","bottom","left"],Sn=Math.min,yt=Math.max,wo=Math.round,Qr=Math.floor,Zt=e=>({x:e,y:e}),bh={left:"right",right:"left",bottom:"top",top:"bottom"},yh={start:"end",end:"start"};function Bs(e,t,n){return yt(e,Sn(t,n))}function dn(e,t){return typeof e=="function"?e(t):e}function fn(e){return e.split("-")[0]}function hr(e){return e.split("-")[1]}function Si(e){return e==="x"?"y":"x"}function Ci(e){return e==="y"?"height":"width"}const Sh=new Set(["top","bottom"]);function Kt(e){return Sh.has(fn(e))?"y":"x"}function Ei(e){return Si(Kt(e))}function Ch(e,t,n){n===void 0&&(n=!1);const r=hr(e),o=Ei(e),s=Ci(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=bo(i)),[i,bo(i)]}function Eh(e){const t=bo(e);return[Us(e),t,Us(t)]}function Us(e){return e.replace(/start|end/g,t=>yh[t])}const _a=["left","right"],Ia=["right","left"],Th=["top","bottom"],Ah=["bottom","top"];function Nh(e,t,n){switch(e){case"top":case"bottom":return n?t?Ia:_a:t?_a:Ia;case"left":case"right":return t?Th:Ah;default:return[]}}function kh(e,t,n,r){const o=hr(e);let s=Nh(fn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Us)))),s}function bo(e){return e.replace(/left|right|bottom|top/g,t=>bh[t])}function _h(e){return{top:0,right:0,bottom:0,left:0,...e}}function hc(e){return typeof e!="number"?_h(e):{top:e,right:e,bottom:e,left:e}}function yo(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 ja(e,t,n){let{reference:r,floating:o}=e;const s=Kt(t),i=Ei(t),l=Ci(i),c=fn(t),d=s==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let h;switch(c){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-o.width,y:p};break;default:h={x:r.x,y:r.y}}switch(hr(t)){case"start":h[i]-=m*(n&&d?-1:1);break;case"end":h[i]+=m*(n&&d?-1:1);break}return h}const Ih=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=ja(d,r,c),m=r,h={},x=0;for(let g=0;g<l.length;g++){const{name:v,fn:b}=l[g],{x:w,y,data:E,reset:T}=await b({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:d,platform:i,elements:{reference:e,floating:t}});f=w??f,p=y??p,h={...h,[v]:{...h[v],...E}},T&&x<=50&&(x++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(d=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:f,y:p}=ja(d,m,c)),g=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:h}};async function Rr(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:h=0}=dn(t,e),x=hc(h),v=l[m?p==="floating"?"reference":"floating":p],b=yo(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),w=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),E=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},T=yo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:y,strategy:c}):w);return{top:(b.top-T.top+x.top)/E.y,bottom:(T.bottom-b.bottom+x.bottom)/E.y,left:(b.left-T.left+x.left)/E.x,right:(T.right-b.right+x.right)/E.x}}const jh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=dn(e,t)||{};if(d==null)return{};const p=hc(f),m={x:n,y:r},h=Ei(o),x=Ci(h),g=await i.getDimensions(d),v=h==="y",b=v?"top":"left",w=v?"bottom":"right",y=v?"clientHeight":"clientWidth",E=s.reference[x]+s.reference[h]-m[h]-s.floating[x],T=m[h]-s.reference[h],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let I=_?_[y]:0;(!I||!await(i.isElement==null?void 0:i.isElement(_)))&&(I=l.floating[y]||s.floating[x]);const A=E/2-T/2,q=I/2-g[x]/2-1,K=Sn(p[b],q),U=Sn(p[w],q),Y=K,J=I-g[x]-U,O=I/2-g[x]/2+A,X=Bs(Y,O,J),N=!c.arrow&&hr(o)!=null&&O!==X&&s.reference[x]/2-(O<Y?K:U)-g[x]/2<0,R=N?O<Y?O-Y:O-J:0;return{[h]:m[h]+R,data:{[h]:X,centerOffset:O-X-R,...N&&{alignmentOffset:R}},reset:N}}}),Mh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:g=!0,...v}=dn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=fn(o),w=Kt(l),y=fn(l)===l,E=await(c.isRTL==null?void 0:c.isRTL(d.floating)),T=m||(y||!g?[bo(l)]:Eh(l)),_=x!=="none";!m&&_&&T.push(...kh(l,g,x,E));const I=[l,...T],A=await Rr(t,v),q=[];let K=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(A[b]),p){const O=Ch(o,i,E);q.push(A[O[0]],A[O[1]])}if(K=[...K,{placement:o,overflows:q}],!q.every(O=>O<=0)){var U,Y;const O=(((U=s.flip)==null?void 0:U.index)||0)+1,X=I[O];if(X&&(!(p==="alignment"?w!==Kt(X):!1)||K.every(S=>Kt(S.placement)===w?S.overflows[0]>0:!0)))return{data:{index:O,overflows:K},reset:{placement:X}};let N=(Y=K.filter(R=>R.overflows[0]<=0).sort((R,S)=>R.overflows[1]-S.overflows[1])[0])==null?void 0:Y.placement;if(!N)switch(h){case"bestFit":{var J;const R=(J=K.filter(S=>{if(_){const F=Kt(S.placement);return F===w||F==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(F=>F>0).reduce((F,M)=>F+M,0)]).sort((S,F)=>S[1]-F[1])[0])==null?void 0:J[0];R&&(N=R);break}case"initialPlacement":N=l;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function Ma(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ra(e){return wh.some(t=>e[t]>=0)}const Rh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=dn(e,t);switch(r){case"referenceHidden":{const s=await Rr(t,{...o,elementContext:"reference"}),i=Ma(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ra(i)}}}case"escaped":{const s=await Rr(t,{...o,altBoundary:!0}),i=Ma(s,n.floating);return{data:{escapedOffsets:i,escaped:Ra(i)}}}default:return{}}}}},gc=new Set(["left","top"]);async function Ph(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=fn(n),l=hr(n),c=Kt(n)==="y",d=gc.has(i)?-1:1,f=s&&c?-1:1,p=dn(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*f,y:m*d}:{x:m*d,y:h*f}}const Lh=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await Ph(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Dh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=dn(e,t),d={x:n,y:r},f=await Rr(t,c),p=Kt(fn(o)),m=Si(p);let h=d[m],x=d[p];if(s){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",w=h+f[v],y=h-f[b];h=Bs(w,h,y)}if(i){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=x+f[v],y=x-f[b];x=Bs(w,x,y)}const g=l.fn({...t,[m]:h,[p]:x});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:s,[p]:i}}}}}},Oh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=dn(e,t),f={x:n,y:r},p=Kt(o),m=Si(p);let h=f[m],x=f[p];const g=dn(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const y=m==="y"?"height":"width",E=s.reference[m]-s.floating[y]+v.mainAxis,T=s.reference[m]+s.reference[y]-v.mainAxis;h<E?h=E:h>T&&(h=T)}if(d){var b,w;const y=m==="y"?"width":"height",E=gc.has(fn(o)),T=s.reference[p]-s.floating[y]+(E&&((b=i.offset)==null?void 0:b[p])||0)+(E?0:v.crossAxis),_=s.reference[p]+s.reference[y]+(E?0:((w=i.offset)==null?void 0:w[p])||0)-(E?v.crossAxis:0);x<T?x=T:x>_&&(x=_)}return{[m]:h,[p]:x}}}},Fh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=dn(e,t),f=await Rr(t,d),p=fn(o),m=hr(o),h=Kt(o)==="y",{width:x,height:g}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const w=g-f.top-f.bottom,y=x-f.left-f.right,E=Sn(g-f[v],w),T=Sn(x-f[b],y),_=!t.middlewareData.shift;let I=E,A=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(I=w),_&&!m){const K=yt(f.left,0),U=yt(f.right,0),Y=yt(f.top,0),J=yt(f.bottom,0);h?A=x-2*(K!==0||U!==0?K+U:yt(f.left,f.right)):I=g-2*(Y!==0||J!==0?Y+J:yt(f.top,f.bottom))}await c({...t,availableWidth:A,availableHeight:I});const q=await i.getDimensions(l.floating);return x!==q.width||g!==q.height?{reset:{rects:!0}}:{}}}};function Po(){return typeof window<"u"}function gr(e){return xc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function en(e){var t;return(t=(xc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xc(e){return Po()?e instanceof Node||e instanceof Ct(e).Node:!1}function Bt(e){return Po()?e instanceof Element||e instanceof Ct(e).Element:!1}function Qt(e){return Po()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:!1}function Pa(e){return!Po()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}const zh=new Set(["inline","contents"]);function Wr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zh.has(o)}const $h=new Set(["table","td","th"]);function Bh(e){return $h.has(gr(e))}const Uh=[":popover-open",":modal"];function Lo(e){return Uh.some(t=>{try{return e.matches(t)}catch{return!1}})}const Hh=["transform","translate","scale","rotate","perspective"],Wh=["transform","translate","scale","rotate","perspective","filter"],Gh=["paint","layout","strict","content"];function Ti(e){const t=Ai(),n=Bt(e)?Ut(e):e;return Hh.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)||Wh.some(r=>(n.willChange||"").includes(r))||Gh.some(r=>(n.contain||"").includes(r))}function Vh(e){let t=Cn(e);for(;Qt(t)&&!ir(t);){if(Ti(t))return t;if(Lo(t))return null;t=Cn(t)}return null}function Ai(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yh=new Set(["html","body","#document"]);function ir(e){return Yh.has(gr(e))}function Ut(e){return Ct(e).getComputedStyle(e)}function Do(e){return Bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cn(e){if(gr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pa(e)&&e.host||en(e);return Pa(t)?t.host:t}function vc(e){const t=Cn(e);return ir(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qt(t)&&Wr(t)?t:vc(t)}function Pr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ct(o);if(s){const l=Hs(i);return t.concat(i,i.visualViewport||[],Wr(o)?o:[],l&&n?Pr(l):[])}return t.concat(o,Pr(o,[],n))}function Hs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wc(e){const t=Ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Qt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=wo(n)!==s||wo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function Ni(e){return Bt(e)?e:e.contextElement}function tr(e){const t=Ni(e);if(!Qt(t))return Zt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=wc(t);let i=(s?wo(n.width):n.width)/r,l=(s?wo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Kh=Zt(0);function bc(e){const t=Ct(e);return!Ai()||!t.visualViewport?Kh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ct(e)?!1:t}function Ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ni(e);let i=Zt(1);t&&(r?Bt(r)&&(i=tr(r)):i=tr(e));const l=qh(s,n,r)?bc(s):Zt(0);let c=(o.left+l.x)/i.x,d=(o.top+l.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=Ct(s),h=r&&Bt(r)?Ct(r):r;let x=m,g=Hs(x);for(;g&&r&&h!==x;){const v=tr(g),b=g.getBoundingClientRect(),w=Ut(g),y=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,E=b.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,p*=v.y,c+=y,d+=E,x=Ct(g),g=Hs(x)}}return yo({width:f,height:p,x:c,y:d})}function Oo(e,t){const n=Do(e).scrollLeft;return t?t.left+n:Ln(en(e)).left+n}function yc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Oo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Xh(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=en(r),l=t?Lo(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=Zt(1);const f=Zt(0),p=Qt(r);if((p||!p&&!s)&&((gr(r)!=="body"||Wr(i))&&(c=Do(r)),Qt(r))){const h=Ln(r);d=tr(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const m=i&&!p&&!s?yc(i,c):Zt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function Zh(e){return Array.from(e.getClientRects())}function Jh(e){const t=en(e),n=Do(e),r=e.ownerDocument.body,o=yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Oo(e);const l=-n.scrollTop;return Ut(r).direction==="rtl"&&(i+=yt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const La=25;function Qh(e,t){const n=Ct(e),r=en(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const f=Ai();(!f||f&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const d=Oo(r);if(d<=0){const f=r.ownerDocument,p=f.body,m=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-h);x<=La&&(s-=x)}else d<=La&&(s+=d);return{width:s,height:i,x:l,y:c}}const eg=new Set(["absolute","fixed"]);function tg(e,t){const n=Ln(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Qt(e)?tr(e):Zt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,d=r*s.y;return{width:i,height:l,x:c,y:d}}function Da(e,t,n){let r;if(t==="viewport")r=Qh(e,n);else if(t==="document")r=Jh(en(e));else if(Bt(t))r=tg(t,n);else{const o=bc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return yo(r)}function Sc(e,t){const n=Cn(e);return n===t||!Bt(n)||ir(n)?!1:Ut(n).position==="fixed"||Sc(n,t)}function ng(e,t){const n=t.get(e);if(n)return n;let r=Pr(e,[],!1).filter(l=>Bt(l)&&gr(l)!=="body"),o=null;const s=Ut(e).position==="fixed";let i=s?Cn(e):e;for(;Bt(i)&&!ir(i);){const l=Ut(i),c=Ti(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&eg.has(o.position)||Wr(i)&&!c&&Sc(e,i))?r=r.filter(f=>f!==i):o=l,i=Cn(i)}return t.set(e,r),r}function rg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Lo(t)?[]:ng(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((d,f)=>{const p=Da(t,f,o);return d.top=yt(p.top,d.top),d.right=Sn(p.right,d.right),d.bottom=Sn(p.bottom,d.bottom),d.left=yt(p.left,d.left),d},Da(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function og(e){const{width:t,height:n}=wc(e);return{width:t,height:n}}function sg(e,t,n){const r=Qt(t),o=en(t),s=n==="fixed",i=Ln(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Zt(0);function d(){c.x=Oo(o)}if(r||!r&&!s)if((gr(t)!=="body"||Wr(o))&&(l=Do(t)),r){const h=Ln(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&d();s&&!r&&o&&d();const f=o&&!r&&!s?yc(o,l):Zt(0),p=i.left+l.scrollLeft-c.x-f.x,m=i.top+l.scrollTop-c.y-f.y;return{x:p,y:m,width:i.width,height:i.height}}function fs(e){return Ut(e).position==="static"}function Oa(e,t){if(!Qt(e)||Ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return en(e)===n&&(n=n.ownerDocument.body),n}function Cc(e,t){const n=Ct(e);if(Lo(e))return n;if(!Qt(e)){let o=Cn(e);for(;o&&!ir(o);){if(Bt(o)&&!fs(o))return o;o=Cn(o)}return n}let r=Oa(e,t);for(;r&&Bh(r)&&fs(r);)r=Oa(r,t);return r&&ir(r)&&fs(r)&&!Ti(r)?n:r||Vh(e)||n}const ig=async function(e){const t=this.getOffsetParent||Cc,n=this.getDimensions,r=await n(e.floating);return{reference:sg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ag(e){return Ut(e).direction==="rtl"}const lg={convertOffsetParentRelativeRectToViewportRelativeRect:Xh,getDocumentElement:en,getClippingRect:rg,getOffsetParent:Cc,getElementRects:ig,getClientRects:Zh,getDimensions:og,getScale:tr,isElement:Bt,isRTL:ag};function Ec(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cg(e,t){let n=null,r;const o=en(e);function s(){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),s();const d=e.getBoundingClientRect(),{left:f,top:p,width:m,height:h}=d;if(l||t(),!m||!h)return;const x=Qr(p),g=Qr(o.clientWidth-(f+m)),v=Qr(o.clientHeight-(p+h)),b=Qr(f),y={rootMargin:-x+"px "+-g+"px "+-v+"px "+-b+"px",threshold:yt(0,Sn(1,c))||1};let E=!0;function T(_){const I=_[0].intersectionRatio;if(I!==c){if(!E)return i();I?i(!1,I):r=setTimeout(()=>{i(!1,1e-7)},1e3)}I===1&&!Ec(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(T,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(T,y)}n.observe(e)}return i(!0),s}function ug(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Ni(e),f=o||s?[...d?Pr(d):[],...Pr(t)]:[];f.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const p=d&&l?cg(d,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),n()}),d&&!c&&h.observe(d),h.observe(t));let x,g=c?Ln(e):null;c&&v();function v(){const b=Ln(e);g&&!Ec(g,b)&&n(),g=b,x=requestAnimationFrame(v)}return n(),()=>{var b;f.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const dg=Lh,fg=Dh,pg=Mh,mg=Fh,hg=Rh,Fa=jh,gg=Oh,xg=(e,t,n)=>{const r=new Map,o={platform:lg,...n},s={...o.platform,_c:r};return Ih(e,t,{...o,platform:s})};var vg=typeof document<"u",wg=function(){},mo=vg?u.useLayoutEffect:wg;function So(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(!So(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!So(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Tc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function za(e,t){const n=Tc(e);return Math.round(t*n)/n}function ps(e){const t=u.useRef(e);return mo(()=>{t.current=e}),t}function bg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=u.useState(r);So(m,r)||h(r);const[x,g]=u.useState(null),[v,b]=u.useState(null),w=u.useCallback(S=>{S!==_.current&&(_.current=S,g(S))},[]),y=u.useCallback(S=>{S!==I.current&&(I.current=S,b(S))},[]),E=s||x,T=i||v,_=u.useRef(null),I=u.useRef(null),A=u.useRef(f),q=c!=null,K=ps(c),U=ps(o),Y=ps(d),J=u.useCallback(()=>{if(!_.current||!I.current)return;const S={placement:t,strategy:n,middleware:m};U.current&&(S.platform=U.current),xg(_.current,I.current,S).then(F=>{const M={...F,isPositioned:Y.current!==!1};O.current&&!So(A.current,M)&&(A.current=M,Ur.flushSync(()=>{p(M)}))})},[m,t,n,U,Y]);mo(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,p(S=>({...S,isPositioned:!1})))},[d]);const O=u.useRef(!1);mo(()=>(O.current=!0,()=>{O.current=!1}),[]),mo(()=>{if(E&&(_.current=E),T&&(I.current=T),E&&T){if(K.current)return K.current(E,T,J);J()}},[E,T,J,K,q]);const X=u.useMemo(()=>({reference:_,floating:I,setReference:w,setFloating:y}),[w,y]),N=u.useMemo(()=>({reference:E,floating:T}),[E,T]),R=u.useMemo(()=>{const S={position:n,left:0,top:0};if(!N.floating)return S;const F=za(N.floating,f.x),M=za(N.floating,f.y);return l?{...S,transform:"translate("+F+"px, "+M+"px)",...Tc(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:M}},[n,l,N.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:J,refs:X,elements:N,floatingStyles:R}),[f,J,X,N,R])}const yg=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?Fa({element:r.current,padding:o}).fn(n):{}:r?Fa({element:r,padding:o}).fn(n):{}}}},Sg=(e,t)=>({...dg(e),options:[e,t]}),Cg=(e,t)=>({...fg(e),options:[e,t]}),Eg=(e,t)=>({...gg(e),options:[e,t]}),Tg=(e,t)=>({...pg(e),options:[e,t]}),Ag=(e,t)=>({...mg(e),options:[e,t]}),Ng=(e,t)=>({...hg(e),options:[e,t]}),kg=(e,t)=>({...yg(e),options:[e,t]});var _g="Arrow",Ac=u.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(ke.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ac.displayName=_g;var Ig=Ac;function jg(e){const[t,n]=u.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.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 ki="Popper",[Nc,xr]=An(ki),[Mg,kc]=Nc(ki),_c=e=>{const{__scopePopper:t,children:n}=e,[r,o]=u.useState(null);return a.jsx(Mg,{scope:t,anchor:r,onAnchorChange:o,children:n})};_c.displayName=ki;var Ic="PopperAnchor",jc=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=kc(Ic,n),i=u.useRef(null),l=$e(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(ke.div,{...o,ref:l})});jc.displayName=Ic;var _i="PopperContent",[Rg,Pg]=Nc(_i),Mc=u.forwardRef((e,t)=>{var k,G,Q,te,oe,se;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,v=kc(_i,n),[b,w]=u.useState(null),y=$e(t,de=>w(de)),[E,T]=u.useState(null),_=jg(E),I=(_==null?void 0:_.width)??0,A=(_==null?void 0:_.height)??0,q=r+(s!=="center"?"-"+s:""),K=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},U=Array.isArray(d)?d:[d],Y=U.length>0,J={padding:K,boundary:U.filter(Dg),altBoundary:Y},{refs:O,floatingStyles:X,placement:N,isPositioned:R,middlewareData:S}=bg({strategy:"fixed",placement:q,whileElementsMounted:(...de)=>ug(...de,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Sg({mainAxis:o+A,alignmentAxis:i}),c&&Cg({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Eg():void 0,...J}),c&&Tg({...J}),Ag({...J,apply:({elements:de,rects:me,availableWidth:Me,availableHeight:Oe})=>{const{width:Le,height:je}=me.reference,He=de.floating.style;He.setProperty("--radix-popper-available-width",`${Me}px`),He.setProperty("--radix-popper-available-height",`${Oe}px`),He.setProperty("--radix-popper-anchor-width",`${Le}px`),He.setProperty("--radix-popper-anchor-height",`${je}px`)}}),E&&kg({element:E,padding:l}),Og({arrowWidth:I,arrowHeight:A}),m&&Ng({strategy:"referenceHidden",...J})]}),[F,M]=Lc(N),P=yn(x);nt(()=>{R&&(P==null||P())},[R,P]);const ee=(k=S.arrow)==null?void 0:k.x,D=(G=S.arrow)==null?void 0:G.y,$=((Q=S.arrow)==null?void 0:Q.centerOffset)!==0,[L,W]=u.useState();return nt(()=>{b&&W(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:R?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:L,"--radix-popper-transform-origin":[(te=S.transformOrigin)==null?void 0:te.x,(oe=S.transformOrigin)==null?void 0:oe.y].join(" "),...((se=S.hide)==null?void 0:se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Rg,{scope:n,placedSide:F,onArrowChange:T,arrowX:ee,arrowY:D,shouldHideArrow:$,children:a.jsx(ke.div,{"data-side":F,"data-align":M,...g,ref:y,style:{...g.style,animation:R?void 0:"none"}})})})});Mc.displayName=_i;var Rc="PopperArrow",Lg={top:"bottom",right:"left",bottom:"top",left:"right"},Pc=u.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Pg(Rc,r),i=Lg[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(Ig,{...o,ref:n,style:{...o.style,display:"block"}})})});Pc.displayName=Rc;function Dg(e){return e!==null}var Og=e=>({name:"transformOrigin",options:e,fn(t){var v,b,w;const{placement:n,rects:r,middlewareData:o}=t,i=((v=o.arrow)==null?void 0:v.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=Lc(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((b=o.arrow)==null?void 0:b.x)??0)+l/2,h=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let x="",g="";return d==="bottom"?(x=i?p:`${m}px`,g=`${-c}px`):d==="top"?(x=i?p:`${m}px`,g=`${r.floating.height+c}px`):d==="right"?(x=`${-c}px`,g=i?p:`${h}px`):d==="left"&&(x=`${r.floating.width+c}px`,g=i?p:`${h}px`),{data:{x,y:g}}}});function Lc(e){const[t,n="center"]=e.split("-");return[t,n]}var Ii=_c,Fo=jc,ji=Mc,Mi=Pc,Fg="Portal",Gr=u.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=u.useState(!1);nt(()=>s(!0),[]);const i=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?_p.createPortal(a.jsx(ke.div,{...r,ref:t}),i):null});Gr.displayName=Fg;function zg(e,t){return u.useReducer((n,r)=>t[n][r]??n,e)}var mn=e=>{const{present:t,children:n}=e,r=$g(t),o=typeof n=="function"?n({present:r.isPresent}):u.Children.only(n),s=$e(r.ref,Bg(o));return typeof n=="function"||r.isPresent?u.cloneElement(o,{ref:s}):null};mn.displayName="Presence";function $g(e){const[t,n]=u.useState(),r=u.useRef(null),o=u.useRef(e),s=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=zg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=eo(r.current);s.current=l==="mounted"?d:"none"},[l]),nt(()=>{const d=r.current,f=o.current;if(f!==e){const m=s.current,h=eo(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),nt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,p=h=>{const g=eo(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=h=>{h.target===t&&(s.current=eo(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function eo(e){return(e==null?void 0:e.animationName)||"none"}function Bg(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 Ug=pi[" useInsertionEffect ".trim().toString()]||nt;function Dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Hg({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const p=f.current;p!==l&&console.warn(`${r} is changing from ${p?"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.`),f.current=l},[l,r])}const d=u.useCallback(f=>{var p;if(l){const m=Wg(f)?f(e):f;m!==e&&((p=i.current)==null||p.call(i,m))}else s(f)},[l,e,s,i]);return[c,d]}function Hg({defaultProp:e,onChange:t}){const[n,r]=u.useState(e),o=u.useRef(n),s=u.useRef(t);return Ug(()=>{s.current=t},[t]),u.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Wg(e){return typeof e=="function"}var Dc=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"}),Gg="VisuallyHidden",Oc=u.forwardRef((e,t)=>a.jsx(ke.span,{...e,ref:t,style:{...Dc,...e.style}}));Oc.displayName=Gg;var Vg=Oc,[zo,t1]=An("Tooltip",[xr]),$o=xr(),Fc="TooltipProvider",Yg=700,Ws="tooltip.open",[Kg,Ri]=zo(Fc),zc=e=>{const{__scopeTooltip:t,delayDuration:n=Yg,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=u.useRef(!0),l=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(Kg,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:u.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:s})};zc.displayName=Fc;var Lr="Tooltip",[qg,Vr]=zo(Lr),$c=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Ri(Lr,e.__scopeTooltip),d=$o(t),[f,p]=u.useState(null),m=Xt(),h=u.useRef(0),x=i??c.disableHoverableContent,g=l??c.delayDuration,v=u.useRef(!1),[b,w]=Dn({prop:r,defaultProp:o??!1,onChange:I=>{I?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ws))):c.onClose(),s==null||s(I)},caller:Lr}),y=u.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),E=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,w(!0)},[w]),T=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),_=u.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,w(!0),h.current=0},g)},[g,w]);return u.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),a.jsx(Ii,{...d,children:a.jsx(qg,{scope:t,contentId:m,open:b,stateAttribute:y,trigger:f,onTriggerChange:p,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?_():E()},[c.isOpenDelayedRef,_,E]),onTriggerLeave:u.useCallback(()=>{x?T():(window.clearTimeout(h.current),h.current=0)},[T,x]),onOpen:E,onClose:T,disableHoverableContent:x,children:n})})};$c.displayName=Lr;var Gs="TooltipTrigger",Bc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Vr(Gs,n),s=Ri(Gs,n),i=$o(n),l=u.useRef(null),c=$e(t,l,o.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),p=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(Fo,{asChild:!0,...i,children:a.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ve(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ve(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:ve(e.onBlur,o.onClose),onClick:ve(e.onClick,o.onClose)})})});Bc.displayName=Gs;var Pi="TooltipPortal",[Xg,Zg]=zo(Pi,{forceMount:void 0}),Uc=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Vr(Pi,t);return a.jsx(Xg,{scope:t,forceMount:n,children:a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:r})})})};Uc.displayName=Pi;var ar="TooltipContent",Hc=u.forwardRef((e,t)=>{const n=Zg(ar,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Vr(ar,e.__scopeTooltip);return a.jsx(mn,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Wc,{side:o,...s,ref:t}):a.jsx(Jg,{side:o,...s,ref:t})})}),Jg=u.forwardRef((e,t)=>{const n=Vr(ar,e.__scopeTooltip),r=Ri(ar,e.__scopeTooltip),o=u.useRef(null),s=$e(t,o),[i,l]=u.useState(null),{trigger:c,onClose:d}=n,f=o.current,{onPointerInTransitChange:p}=r,m=u.useCallback(()=>{l(null),p(!1)},[p]),h=u.useCallback((x,g)=>{const v=x.currentTarget,b={x:x.clientX,y:x.clientY},w=nx(b,v.getBoundingClientRect()),y=rx(b,w),E=ox(g.getBoundingClientRect()),T=ix([...y,...E]);l(T),p(!0)},[p]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const x=v=>h(v,f),g=v=>h(v,c);return c.addEventListener("pointerleave",x),f.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",g)}}},[c,f,h,m]),u.useEffect(()=>{if(i){const x=g=>{const v=g.target,b={x:g.clientX,y:g.clientY},w=(c==null?void 0:c.contains(v))||(f==null?void 0:f.contains(v)),y=!sx(b,i);w?m():y&&(m(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,f,i,d,m]),a.jsx(Wc,{...e,ref:s})}),[Qg,ex]=zo(Lr,{isInside:!1}),tx=mm("TooltipContent"),Wc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Vr(ar,n),d=$o(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(Ws,f),()=>document.removeEventListener(Ws,f)),[f]),u.useEffect(()=>{if(c.trigger){const p=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,f]),a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:a.jsxs(ji,{"data-state":c.stateAttribute,...d,...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:[a.jsx(tx,{children:r}),a.jsx(Qg,{scope:n,isInside:!0,children:a.jsx(Vg,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Hc.displayName=ar;var Gc="TooltipArrow",Vc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$o(n);return ex(Gc,n).isInside?null:a.jsx(Mi,{...o,...r,ref:t})});Vc.displayName=Gc;function nx(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function rx(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 ox(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 sx(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,f=l.y,p=c.x,m=c.y;f>r!=m>r&&n<(p-d)*(r-f)/(m-f)+d&&(o=!o)}return o}function ix(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),ax(t)}function ax(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.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 lx=zc,cx=$c,ux=Bc,dx=Uc,fx=Hc,px=Vc;function mx({delayDuration:e=0,...t}){return a.jsx(lx,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Li({...e}){return a.jsx(mx,{delayDuration:500,children:a.jsx(cx,{"data-slot":"tooltip",...e})})}function Di({...e}){return a.jsx(ux,{"data-slot":"tooltip-trigger",...e})}function Oi({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(dx,{children:a.jsxs(fx,{"data-slot":"tooltip-content",sideOffset:t,className:Ce("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,a.jsx(px,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Yc="text-[var(--color-primary-wMain)] hover:text-[var(--color-primary-text-w60)] dark:text-[var(--color-primary-w20)] dark:hover:text-[var(--color-primary-text-w10)]",ms=Yc+" hover:bg-[var(--color-primary-w10)] dark:hover:bg-[var(--color-primary-w60)]",hx=Tn("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 disabled:hover:bg-transparent dark:disabled:hover:bg-transparent",{variants:{variant:{default:"text-[var(--color-primary-text-w10)] bg-[var(--color-primary-wMain)] hover:bg-[var(--color-primary-w100)] dark:hover:bg-[var(--color-primary-w60)]",destructive:"text-[var(--color-primary-text-w10)] bg-[var(--color-error-wMain)] hover:bg-[var(--color-error-w70)]",outline:ms+" border border-1 border-[var(--color-primary-wMain)]",secondary:ms,ghost:ms,link:Yc+" underline-offset-4 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 Ae({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",testid:s="",...i}){const l=r?Ql:"button",c=o?{...i,"aria-label":o}:i,d=a.jsx(l,{"data-slot":"button","data-testid":s||o||i.title,className:Ce(hx({variant:t,size:n,className:e})),...c});return o?a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:d}),a.jsx(Oi,{children:o})]}):d}const Kc=({onClick:e,text:t="View Agent Workflow"})=>a.jsx(Ae,{variant:"ghost",size:"sm",onClick:e,tooltip:t,children:a.jsx(po,{className:"h-4 w-4"})}),qc=u.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Ce("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}));qc.displayName="Textarea";var hs="focusScope.autoFocusOnMount",gs="focusScope.autoFocusOnUnmount",$a={bubbles:!1,cancelable:!0},gx="FocusScope",Bo=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=u.useState(null),d=yn(o),f=yn(s),p=u.useRef(null),m=$e(t,g=>c(g)),h=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let g=function(y){if(h.paused||!l)return;const E=y.target;l.contains(E)?p.current=E:xn(p.current,{select:!0})},v=function(y){if(h.paused||!l)return;const E=y.relatedTarget;E!==null&&(l.contains(E)||xn(p.current,{select:!0}))},b=function(y){if(document.activeElement===document.body)for(const T of y)T.removedNodes.length>0&&xn(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),w.disconnect()}}},[r,l,h.paused]),u.useEffect(()=>{if(l){Ua.add(h);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(hs,$a);l.addEventListener(hs,d),l.dispatchEvent(b),b.defaultPrevented||(xx(Sx(Xc(l)),{select:!0}),document.activeElement===g&&xn(l))}return()=>{l.removeEventListener(hs,d),setTimeout(()=>{const b=new CustomEvent(gs,$a);l.addEventListener(gs,f),l.dispatchEvent(b),b.defaultPrevented||xn(g??document.body,{select:!0}),l.removeEventListener(gs,f),Ua.remove(h)},0)}}},[l,d,f,h]);const x=u.useCallback(g=>{if(!n&&!r||h.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(v&&b){const w=g.currentTarget,[y,E]=vx(w);y&&E?!g.shiftKey&&b===E?(g.preventDefault(),n&&xn(y,{select:!0})):g.shiftKey&&b===y&&(g.preventDefault(),n&&xn(E,{select:!0})):b===w&&g.preventDefault()}},[n,r,h.paused]);return a.jsx(ke.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});Bo.displayName=gx;function xx(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(xn(r,{select:t}),document.activeElement!==n)return}function vx(e){const t=Xc(e),n=Ba(t,e),r=Ba(t.reverse(),e);return[n,r]}function Xc(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 Ba(e,t){for(const n of e)if(!wx(n,{upTo:t}))return n}function wx(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 bx(e){return e instanceof HTMLInputElement&&"select"in e}function xn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bx(e)&&t&&e.select()}}var Ua=yx();function yx(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ha(e,t),e.unshift(t)},remove(t){var n;e=Ha(e,t),(n=e[0])==null||n.resume()}}}function Ha(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Sx(e){return e.filter(t=>t.tagName!=="A")}var xs=0;function Fi(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Wa()),document.body.insertAdjacentElement("beforeend",e[1]??Wa()),xs++,()=>{xs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xs--}},[])}function Wa(){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 Yt=function(){return Yt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Yt.apply(this,arguments)};function Zc(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 Cx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var ho="right-scroll-bar-position",go="width-before-scroll-bar",Ex="with-scroll-bars-hidden",Tx="--removed-body-scroll-bar-size";function vs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ax(e,t){var n=u.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 Nx=typeof window<"u"?u.useLayoutEffect:u.useEffect,Ga=new WeakMap;function kx(e,t){var n=Ax(null,function(r){return e.forEach(function(o){return vs(o,r)})});return Nx(function(){var r=Ga.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||vs(l,null)}),s.forEach(function(l){o.has(l)||vs(l,i)})}Ga.set(n,e)},[e]),n}function _x(e){return e}function Ix(e,t){t===void 0&&(t=_x);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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var f=i;i=[],f.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return o}function jx(e){e===void 0&&(e={});var t=Ix(null);return t.options=Yt({async:!0,ssr:!1},e),t}var Jc=function(e){var t=e.sideCar,n=Zc(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 u.createElement(r,Yt({},n))};Jc.isSideCarExport=!0;function Mx(e,t){return e.useMedium(t),Jc}var Qc=jx(),ws=function(){},Uo=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:ws,onWheelCapture:ws,onTouchMoveCapture:ws}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,y=e.gapMode,E=Zc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,_=kx([n,t]),I=Yt(Yt({},E),o);return u.createElement(u.Fragment,null,f&&u.createElement(T,{sideCar:Qc,removeScrollBar:d,shards:p,noRelative:h,noIsolation:x,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:n,gapMode:y}),i?u.cloneElement(u.Children.only(l),Yt(Yt({},I),{ref:_})):u.createElement(w,Yt({},I,{className:c,ref:_}),l))});Uo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Uo.classNames={fullWidth:go,zeroRight:ho};var Rx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Px(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Rx();return t&&e.setAttribute("nonce",t),e}function Lx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Dx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ox=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Px())&&(Lx(t,n),Dx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fx=function(){var e=Ox();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},eu=function(){var e=Fx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zx={left:0,top:0,right:0,gap:0},bs=function(e){return parseInt(e||"",10)||0},$x=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[bs(n),bs(r),bs(o)]},Bx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zx;var t=$x(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])}},Ux=eu(),nr="data-scroll-locked",Hx=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
72
|
+
`.trim().replace(/\s+/g," ");function ve(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 sh(e,t){const n=u.createContext(t),r=s=>{const{children:i,...l}=s,c=u.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function An(e,t=[]){let n=[];function r(s,i){const l=u.createContext(i),c=n.length;n=[...n,i];const d=p=>{var b;const{scope:m,children:h,...x}=p,g=((b=m==null?void 0:m[e])==null?void 0:b[c])||l,v=u.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:h})};d.displayName=s+"Provider";function f(p,m){var g;const h=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=u.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,f]}const o=()=>{const s=n.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||s;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,ih(o,...t)]}function ih(...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(s){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const p=c(s)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var ah=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=ah.reduce((e,t)=>{const n=Pn(`Primitive.${t}`),r=u.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function lh(e,t){e&&Ur.flushSync(()=>e.dispatchEvent(t))}function yn(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ch(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e);u.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 uh="DismissableLayer",$s="dismissableLayer.update",dh="dismissableLayer.pointerDownOutside",fh="dismissableLayer.focusOutside",Na,pc=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hr=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(pc),[f,p]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=u.useState({}),x=$e(t,I=>p(I)),g=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),w=f?g.indexOf(f):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=b,T=hh(I=>{const A=I.target,q=[...d.branches].some(K=>K.contains(A));!E||q||(o==null||o(I),i==null||i(I),I.defaultPrevented||l==null||l())},m),_=gh(I=>{const A=I.target;[...d.branches].some(K=>K.contains(A))||(s==null||s(I),i==null||i(I),I.defaultPrevented||l==null||l())},m);return ch(I=>{w===d.layers.size-1&&(r==null||r(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Na=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),ka(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Na)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),ka())},[f,d]),u.useEffect(()=>{const I=()=>h({});return document.addEventListener($s,I),()=>document.removeEventListener($s,I)},[]),a.jsx(ke.div,{...c,ref:x,style:{pointerEvents:y?E?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,T.onPointerDownCapture)})});Hr.displayName=uh;var ph="DismissableLayerBranch",mh=u.forwardRef((e,t)=>{const n=u.useContext(pc),r=u.useRef(null),o=$e(t,r);return u.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(ke.div,{...e,ref:o})});mh.displayName=ph;function hh(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=u.useRef(!1),o=u.useRef(()=>{});return u.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){mc(dh,n,d,{discrete:!0})};const d={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",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function gh(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=u.useRef(!1);return u.useEffect(()=>{const o=s=>{s.target&&!r.current&&mc(fh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ka(){const e=new CustomEvent($s);document.dispatchEvent(e)}function mc(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?lh(o,s):o.dispatchEvent(s)}var nt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},xh=pi[" useId ".trim().toString()]||(()=>{}),vh=0;function Xt(e){const[t,n]=u.useState(xh());return nt(()=>{n(r=>r??String(vh++))},[e]),t?`radix-${t}`:""}const wh=["top","right","bottom","left"],Sn=Math.min,yt=Math.max,wo=Math.round,Qr=Math.floor,Zt=e=>({x:e,y:e}),bh={left:"right",right:"left",bottom:"top",top:"bottom"},yh={start:"end",end:"start"};function Bs(e,t,n){return yt(e,Sn(t,n))}function dn(e,t){return typeof e=="function"?e(t):e}function fn(e){return e.split("-")[0]}function hr(e){return e.split("-")[1]}function Si(e){return e==="x"?"y":"x"}function Ci(e){return e==="y"?"height":"width"}const Sh=new Set(["top","bottom"]);function Kt(e){return Sh.has(fn(e))?"y":"x"}function Ei(e){return Si(Kt(e))}function Ch(e,t,n){n===void 0&&(n=!1);const r=hr(e),o=Ei(e),s=Ci(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=bo(i)),[i,bo(i)]}function Eh(e){const t=bo(e);return[Us(e),t,Us(t)]}function Us(e){return e.replace(/start|end/g,t=>yh[t])}const _a=["left","right"],Ia=["right","left"],Th=["top","bottom"],Ah=["bottom","top"];function Nh(e,t,n){switch(e){case"top":case"bottom":return n?t?Ia:_a:t?_a:Ia;case"left":case"right":return t?Th:Ah;default:return[]}}function kh(e,t,n,r){const o=hr(e);let s=Nh(fn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Us)))),s}function bo(e){return e.replace(/left|right|bottom|top/g,t=>bh[t])}function _h(e){return{top:0,right:0,bottom:0,left:0,...e}}function hc(e){return typeof e!="number"?_h(e):{top:e,right:e,bottom:e,left:e}}function yo(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 ja(e,t,n){let{reference:r,floating:o}=e;const s=Kt(t),i=Ei(t),l=Ci(i),c=fn(t),d=s==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let h;switch(c){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-o.width,y:p};break;default:h={x:r.x,y:r.y}}switch(hr(t)){case"start":h[i]-=m*(n&&d?-1:1);break;case"end":h[i]+=m*(n&&d?-1:1);break}return h}const Ih=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=ja(d,r,c),m=r,h={},x=0;for(let g=0;g<l.length;g++){const{name:v,fn:b}=l[g],{x:w,y,data:E,reset:T}=await b({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:d,platform:i,elements:{reference:e,floating:t}});f=w??f,p=y??p,h={...h,[v]:{...h[v],...E}},T&&x<=50&&(x++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(d=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:f,y:p}=ja(d,m,c)),g=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:h}};async function Rr(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:h=0}=dn(t,e),x=hc(h),v=l[m?p==="floating"?"reference":"floating":p],b=yo(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),w=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),E=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},T=yo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:y,strategy:c}):w);return{top:(b.top-T.top+x.top)/E.y,bottom:(T.bottom-b.bottom+x.bottom)/E.y,left:(b.left-T.left+x.left)/E.x,right:(T.right-b.right+x.right)/E.x}}const jh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=dn(e,t)||{};if(d==null)return{};const p=hc(f),m={x:n,y:r},h=Ei(o),x=Ci(h),g=await i.getDimensions(d),v=h==="y",b=v?"top":"left",w=v?"bottom":"right",y=v?"clientHeight":"clientWidth",E=s.reference[x]+s.reference[h]-m[h]-s.floating[x],T=m[h]-s.reference[h],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let I=_?_[y]:0;(!I||!await(i.isElement==null?void 0:i.isElement(_)))&&(I=l.floating[y]||s.floating[x]);const A=E/2-T/2,q=I/2-g[x]/2-1,K=Sn(p[b],q),U=Sn(p[w],q),Y=K,J=I-g[x]-U,O=I/2-g[x]/2+A,X=Bs(Y,O,J),N=!c.arrow&&hr(o)!=null&&O!==X&&s.reference[x]/2-(O<Y?K:U)-g[x]/2<0,R=N?O<Y?O-Y:O-J:0;return{[h]:m[h]+R,data:{[h]:X,centerOffset:O-X-R,...N&&{alignmentOffset:R}},reset:N}}}),Mh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:g=!0,...v}=dn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=fn(o),w=Kt(l),y=fn(l)===l,E=await(c.isRTL==null?void 0:c.isRTL(d.floating)),T=m||(y||!g?[bo(l)]:Eh(l)),_=x!=="none";!m&&_&&T.push(...kh(l,g,x,E));const I=[l,...T],A=await Rr(t,v),q=[];let K=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(A[b]),p){const O=Ch(o,i,E);q.push(A[O[0]],A[O[1]])}if(K=[...K,{placement:o,overflows:q}],!q.every(O=>O<=0)){var U,Y;const O=(((U=s.flip)==null?void 0:U.index)||0)+1,X=I[O];if(X&&(!(p==="alignment"?w!==Kt(X):!1)||K.every(S=>Kt(S.placement)===w?S.overflows[0]>0:!0)))return{data:{index:O,overflows:K},reset:{placement:X}};let N=(Y=K.filter(R=>R.overflows[0]<=0).sort((R,S)=>R.overflows[1]-S.overflows[1])[0])==null?void 0:Y.placement;if(!N)switch(h){case"bestFit":{var J;const R=(J=K.filter(S=>{if(_){const F=Kt(S.placement);return F===w||F==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(F=>F>0).reduce((F,M)=>F+M,0)]).sort((S,F)=>S[1]-F[1])[0])==null?void 0:J[0];R&&(N=R);break}case"initialPlacement":N=l;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function Ma(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ra(e){return wh.some(t=>e[t]>=0)}const Rh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=dn(e,t);switch(r){case"referenceHidden":{const s=await Rr(t,{...o,elementContext:"reference"}),i=Ma(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ra(i)}}}case"escaped":{const s=await Rr(t,{...o,altBoundary:!0}),i=Ma(s,n.floating);return{data:{escapedOffsets:i,escaped:Ra(i)}}}default:return{}}}}},gc=new Set(["left","top"]);async function Ph(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=fn(n),l=hr(n),c=Kt(n)==="y",d=gc.has(i)?-1:1,f=s&&c?-1:1,p=dn(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*f,y:m*d}:{x:m*d,y:h*f}}const Lh=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await Ph(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Dh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=dn(e,t),d={x:n,y:r},f=await Rr(t,c),p=Kt(fn(o)),m=Si(p);let h=d[m],x=d[p];if(s){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",w=h+f[v],y=h-f[b];h=Bs(w,h,y)}if(i){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=x+f[v],y=x-f[b];x=Bs(w,x,y)}const g=l.fn({...t,[m]:h,[p]:x});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:s,[p]:i}}}}}},Oh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=dn(e,t),f={x:n,y:r},p=Kt(o),m=Si(p);let h=f[m],x=f[p];const g=dn(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const y=m==="y"?"height":"width",E=s.reference[m]-s.floating[y]+v.mainAxis,T=s.reference[m]+s.reference[y]-v.mainAxis;h<E?h=E:h>T&&(h=T)}if(d){var b,w;const y=m==="y"?"width":"height",E=gc.has(fn(o)),T=s.reference[p]-s.floating[y]+(E&&((b=i.offset)==null?void 0:b[p])||0)+(E?0:v.crossAxis),_=s.reference[p]+s.reference[y]+(E?0:((w=i.offset)==null?void 0:w[p])||0)-(E?v.crossAxis:0);x<T?x=T:x>_&&(x=_)}return{[m]:h,[p]:x}}}},Fh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=dn(e,t),f=await Rr(t,d),p=fn(o),m=hr(o),h=Kt(o)==="y",{width:x,height:g}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const w=g-f.top-f.bottom,y=x-f.left-f.right,E=Sn(g-f[v],w),T=Sn(x-f[b],y),_=!t.middlewareData.shift;let I=E,A=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(I=w),_&&!m){const K=yt(f.left,0),U=yt(f.right,0),Y=yt(f.top,0),J=yt(f.bottom,0);h?A=x-2*(K!==0||U!==0?K+U:yt(f.left,f.right)):I=g-2*(Y!==0||J!==0?Y+J:yt(f.top,f.bottom))}await c({...t,availableWidth:A,availableHeight:I});const q=await i.getDimensions(l.floating);return x!==q.width||g!==q.height?{reset:{rects:!0}}:{}}}};function Po(){return typeof window<"u"}function gr(e){return xc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function en(e){var t;return(t=(xc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xc(e){return Po()?e instanceof Node||e instanceof Ct(e).Node:!1}function Bt(e){return Po()?e instanceof Element||e instanceof Ct(e).Element:!1}function Qt(e){return Po()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:!1}function Pa(e){return!Po()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}const zh=new Set(["inline","contents"]);function Wr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zh.has(o)}const $h=new Set(["table","td","th"]);function Bh(e){return $h.has(gr(e))}const Uh=[":popover-open",":modal"];function Lo(e){return Uh.some(t=>{try{return e.matches(t)}catch{return!1}})}const Hh=["transform","translate","scale","rotate","perspective"],Wh=["transform","translate","scale","rotate","perspective","filter"],Gh=["paint","layout","strict","content"];function Ti(e){const t=Ai(),n=Bt(e)?Ut(e):e;return Hh.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)||Wh.some(r=>(n.willChange||"").includes(r))||Gh.some(r=>(n.contain||"").includes(r))}function Vh(e){let t=Cn(e);for(;Qt(t)&&!ir(t);){if(Ti(t))return t;if(Lo(t))return null;t=Cn(t)}return null}function Ai(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yh=new Set(["html","body","#document"]);function ir(e){return Yh.has(gr(e))}function Ut(e){return Ct(e).getComputedStyle(e)}function Do(e){return Bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cn(e){if(gr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pa(e)&&e.host||en(e);return Pa(t)?t.host:t}function vc(e){const t=Cn(e);return ir(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qt(t)&&Wr(t)?t:vc(t)}function Pr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ct(o);if(s){const l=Hs(i);return t.concat(i,i.visualViewport||[],Wr(o)?o:[],l&&n?Pr(l):[])}return t.concat(o,Pr(o,[],n))}function Hs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wc(e){const t=Ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Qt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=wo(n)!==s||wo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function Ni(e){return Bt(e)?e:e.contextElement}function tr(e){const t=Ni(e);if(!Qt(t))return Zt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=wc(t);let i=(s?wo(n.width):n.width)/r,l=(s?wo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Kh=Zt(0);function bc(e){const t=Ct(e);return!Ai()||!t.visualViewport?Kh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ct(e)?!1:t}function Ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ni(e);let i=Zt(1);t&&(r?Bt(r)&&(i=tr(r)):i=tr(e));const l=qh(s,n,r)?bc(s):Zt(0);let c=(o.left+l.x)/i.x,d=(o.top+l.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=Ct(s),h=r&&Bt(r)?Ct(r):r;let x=m,g=Hs(x);for(;g&&r&&h!==x;){const v=tr(g),b=g.getBoundingClientRect(),w=Ut(g),y=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,E=b.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,p*=v.y,c+=y,d+=E,x=Ct(g),g=Hs(x)}}return yo({width:f,height:p,x:c,y:d})}function Oo(e,t){const n=Do(e).scrollLeft;return t?t.left+n:Ln(en(e)).left+n}function yc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Oo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Xh(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=en(r),l=t?Lo(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=Zt(1);const f=Zt(0),p=Qt(r);if((p||!p&&!s)&&((gr(r)!=="body"||Wr(i))&&(c=Do(r)),Qt(r))){const h=Ln(r);d=tr(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const m=i&&!p&&!s?yc(i,c):Zt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function Zh(e){return Array.from(e.getClientRects())}function Jh(e){const t=en(e),n=Do(e),r=e.ownerDocument.body,o=yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Oo(e);const l=-n.scrollTop;return Ut(r).direction==="rtl"&&(i+=yt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const La=25;function Qh(e,t){const n=Ct(e),r=en(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const f=Ai();(!f||f&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const d=Oo(r);if(d<=0){const f=r.ownerDocument,p=f.body,m=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-h);x<=La&&(s-=x)}else d<=La&&(s+=d);return{width:s,height:i,x:l,y:c}}const eg=new Set(["absolute","fixed"]);function tg(e,t){const n=Ln(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Qt(e)?tr(e):Zt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,d=r*s.y;return{width:i,height:l,x:c,y:d}}function Da(e,t,n){let r;if(t==="viewport")r=Qh(e,n);else if(t==="document")r=Jh(en(e));else if(Bt(t))r=tg(t,n);else{const o=bc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return yo(r)}function Sc(e,t){const n=Cn(e);return n===t||!Bt(n)||ir(n)?!1:Ut(n).position==="fixed"||Sc(n,t)}function ng(e,t){const n=t.get(e);if(n)return n;let r=Pr(e,[],!1).filter(l=>Bt(l)&&gr(l)!=="body"),o=null;const s=Ut(e).position==="fixed";let i=s?Cn(e):e;for(;Bt(i)&&!ir(i);){const l=Ut(i),c=Ti(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&eg.has(o.position)||Wr(i)&&!c&&Sc(e,i))?r=r.filter(f=>f!==i):o=l,i=Cn(i)}return t.set(e,r),r}function rg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Lo(t)?[]:ng(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((d,f)=>{const p=Da(t,f,o);return d.top=yt(p.top,d.top),d.right=Sn(p.right,d.right),d.bottom=Sn(p.bottom,d.bottom),d.left=yt(p.left,d.left),d},Da(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function og(e){const{width:t,height:n}=wc(e);return{width:t,height:n}}function sg(e,t,n){const r=Qt(t),o=en(t),s=n==="fixed",i=Ln(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Zt(0);function d(){c.x=Oo(o)}if(r||!r&&!s)if((gr(t)!=="body"||Wr(o))&&(l=Do(t)),r){const h=Ln(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&d();s&&!r&&o&&d();const f=o&&!r&&!s?yc(o,l):Zt(0),p=i.left+l.scrollLeft-c.x-f.x,m=i.top+l.scrollTop-c.y-f.y;return{x:p,y:m,width:i.width,height:i.height}}function fs(e){return Ut(e).position==="static"}function Oa(e,t){if(!Qt(e)||Ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return en(e)===n&&(n=n.ownerDocument.body),n}function Cc(e,t){const n=Ct(e);if(Lo(e))return n;if(!Qt(e)){let o=Cn(e);for(;o&&!ir(o);){if(Bt(o)&&!fs(o))return o;o=Cn(o)}return n}let r=Oa(e,t);for(;r&&Bh(r)&&fs(r);)r=Oa(r,t);return r&&ir(r)&&fs(r)&&!Ti(r)?n:r||Vh(e)||n}const ig=async function(e){const t=this.getOffsetParent||Cc,n=this.getDimensions,r=await n(e.floating);return{reference:sg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ag(e){return Ut(e).direction==="rtl"}const lg={convertOffsetParentRelativeRectToViewportRelativeRect:Xh,getDocumentElement:en,getClippingRect:rg,getOffsetParent:Cc,getElementRects:ig,getClientRects:Zh,getDimensions:og,getScale:tr,isElement:Bt,isRTL:ag};function Ec(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cg(e,t){let n=null,r;const o=en(e);function s(){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),s();const d=e.getBoundingClientRect(),{left:f,top:p,width:m,height:h}=d;if(l||t(),!m||!h)return;const x=Qr(p),g=Qr(o.clientWidth-(f+m)),v=Qr(o.clientHeight-(p+h)),b=Qr(f),y={rootMargin:-x+"px "+-g+"px "+-v+"px "+-b+"px",threshold:yt(0,Sn(1,c))||1};let E=!0;function T(_){const I=_[0].intersectionRatio;if(I!==c){if(!E)return i();I?i(!1,I):r=setTimeout(()=>{i(!1,1e-7)},1e3)}I===1&&!Ec(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(T,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(T,y)}n.observe(e)}return i(!0),s}function ug(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Ni(e),f=o||s?[...d?Pr(d):[],...Pr(t)]:[];f.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const p=d&&l?cg(d,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),n()}),d&&!c&&h.observe(d),h.observe(t));let x,g=c?Ln(e):null;c&&v();function v(){const b=Ln(e);g&&!Ec(g,b)&&n(),g=b,x=requestAnimationFrame(v)}return n(),()=>{var b;f.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const dg=Lh,fg=Dh,pg=Mh,mg=Fh,hg=Rh,Fa=jh,gg=Oh,xg=(e,t,n)=>{const r=new Map,o={platform:lg,...n},s={...o.platform,_c:r};return Ih(e,t,{...o,platform:s})};var vg=typeof document<"u",wg=function(){},mo=vg?u.useLayoutEffect:wg;function So(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(!So(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!So(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Tc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function za(e,t){const n=Tc(e);return Math.round(t*n)/n}function ps(e){const t=u.useRef(e);return mo(()=>{t.current=e}),t}function bg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=u.useState(r);So(m,r)||h(r);const[x,g]=u.useState(null),[v,b]=u.useState(null),w=u.useCallback(S=>{S!==_.current&&(_.current=S,g(S))},[]),y=u.useCallback(S=>{S!==I.current&&(I.current=S,b(S))},[]),E=s||x,T=i||v,_=u.useRef(null),I=u.useRef(null),A=u.useRef(f),q=c!=null,K=ps(c),U=ps(o),Y=ps(d),J=u.useCallback(()=>{if(!_.current||!I.current)return;const S={placement:t,strategy:n,middleware:m};U.current&&(S.platform=U.current),xg(_.current,I.current,S).then(F=>{const M={...F,isPositioned:Y.current!==!1};O.current&&!So(A.current,M)&&(A.current=M,Ur.flushSync(()=>{p(M)}))})},[m,t,n,U,Y]);mo(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,p(S=>({...S,isPositioned:!1})))},[d]);const O=u.useRef(!1);mo(()=>(O.current=!0,()=>{O.current=!1}),[]),mo(()=>{if(E&&(_.current=E),T&&(I.current=T),E&&T){if(K.current)return K.current(E,T,J);J()}},[E,T,J,K,q]);const X=u.useMemo(()=>({reference:_,floating:I,setReference:w,setFloating:y}),[w,y]),N=u.useMemo(()=>({reference:E,floating:T}),[E,T]),R=u.useMemo(()=>{const S={position:n,left:0,top:0};if(!N.floating)return S;const F=za(N.floating,f.x),M=za(N.floating,f.y);return l?{...S,transform:"translate("+F+"px, "+M+"px)",...Tc(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:M}},[n,l,N.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:J,refs:X,elements:N,floatingStyles:R}),[f,J,X,N,R])}const yg=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?Fa({element:r.current,padding:o}).fn(n):{}:r?Fa({element:r,padding:o}).fn(n):{}}}},Sg=(e,t)=>({...dg(e),options:[e,t]}),Cg=(e,t)=>({...fg(e),options:[e,t]}),Eg=(e,t)=>({...gg(e),options:[e,t]}),Tg=(e,t)=>({...pg(e),options:[e,t]}),Ag=(e,t)=>({...mg(e),options:[e,t]}),Ng=(e,t)=>({...hg(e),options:[e,t]}),kg=(e,t)=>({...yg(e),options:[e,t]});var _g="Arrow",Ac=u.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(ke.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ac.displayName=_g;var Ig=Ac;function jg(e){const[t,n]=u.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.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 ki="Popper",[Nc,xr]=An(ki),[Mg,kc]=Nc(ki),_c=e=>{const{__scopePopper:t,children:n}=e,[r,o]=u.useState(null);return a.jsx(Mg,{scope:t,anchor:r,onAnchorChange:o,children:n})};_c.displayName=ki;var Ic="PopperAnchor",jc=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=kc(Ic,n),i=u.useRef(null),l=$e(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(ke.div,{...o,ref:l})});jc.displayName=Ic;var _i="PopperContent",[Rg,Pg]=Nc(_i),Mc=u.forwardRef((e,t)=>{var k,V,Q,te,oe,se;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,v=kc(_i,n),[b,w]=u.useState(null),y=$e(t,de=>w(de)),[E,T]=u.useState(null),_=jg(E),I=(_==null?void 0:_.width)??0,A=(_==null?void 0:_.height)??0,q=r+(s!=="center"?"-"+s:""),K=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},U=Array.isArray(d)?d:[d],Y=U.length>0,J={padding:K,boundary:U.filter(Dg),altBoundary:Y},{refs:O,floatingStyles:X,placement:N,isPositioned:R,middlewareData:S}=bg({strategy:"fixed",placement:q,whileElementsMounted:(...de)=>ug(...de,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Sg({mainAxis:o+A,alignmentAxis:i}),c&&Cg({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Eg():void 0,...J}),c&&Tg({...J}),Ag({...J,apply:({elements:de,rects:me,availableWidth:Me,availableHeight:Oe})=>{const{width:Le,height:je}=me.reference,He=de.floating.style;He.setProperty("--radix-popper-available-width",`${Me}px`),He.setProperty("--radix-popper-available-height",`${Oe}px`),He.setProperty("--radix-popper-anchor-width",`${Le}px`),He.setProperty("--radix-popper-anchor-height",`${je}px`)}}),E&&kg({element:E,padding:l}),Og({arrowWidth:I,arrowHeight:A}),m&&Ng({strategy:"referenceHidden",...J})]}),[F,M]=Lc(N),P=yn(x);nt(()=>{R&&(P==null||P())},[R,P]);const ee=(k=S.arrow)==null?void 0:k.x,D=(V=S.arrow)==null?void 0:V.y,$=((Q=S.arrow)==null?void 0:Q.centerOffset)!==0,[L,G]=u.useState();return nt(()=>{b&&G(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:R?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:L,"--radix-popper-transform-origin":[(te=S.transformOrigin)==null?void 0:te.x,(oe=S.transformOrigin)==null?void 0:oe.y].join(" "),...((se=S.hide)==null?void 0:se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Rg,{scope:n,placedSide:F,onArrowChange:T,arrowX:ee,arrowY:D,shouldHideArrow:$,children:a.jsx(ke.div,{"data-side":F,"data-align":M,...g,ref:y,style:{...g.style,animation:R?void 0:"none"}})})})});Mc.displayName=_i;var Rc="PopperArrow",Lg={top:"bottom",right:"left",bottom:"top",left:"right"},Pc=u.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Pg(Rc,r),i=Lg[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(Ig,{...o,ref:n,style:{...o.style,display:"block"}})})});Pc.displayName=Rc;function Dg(e){return e!==null}var Og=e=>({name:"transformOrigin",options:e,fn(t){var v,b,w;const{placement:n,rects:r,middlewareData:o}=t,i=((v=o.arrow)==null?void 0:v.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=Lc(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((b=o.arrow)==null?void 0:b.x)??0)+l/2,h=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let x="",g="";return d==="bottom"?(x=i?p:`${m}px`,g=`${-c}px`):d==="top"?(x=i?p:`${m}px`,g=`${r.floating.height+c}px`):d==="right"?(x=`${-c}px`,g=i?p:`${h}px`):d==="left"&&(x=`${r.floating.width+c}px`,g=i?p:`${h}px`),{data:{x,y:g}}}});function Lc(e){const[t,n="center"]=e.split("-");return[t,n]}var Ii=_c,Fo=jc,ji=Mc,Mi=Pc,Fg="Portal",Gr=u.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=u.useState(!1);nt(()=>s(!0),[]);const i=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?_p.createPortal(a.jsx(ke.div,{...r,ref:t}),i):null});Gr.displayName=Fg;function zg(e,t){return u.useReducer((n,r)=>t[n][r]??n,e)}var mn=e=>{const{present:t,children:n}=e,r=$g(t),o=typeof n=="function"?n({present:r.isPresent}):u.Children.only(n),s=$e(r.ref,Bg(o));return typeof n=="function"||r.isPresent?u.cloneElement(o,{ref:s}):null};mn.displayName="Presence";function $g(e){const[t,n]=u.useState(),r=u.useRef(null),o=u.useRef(e),s=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=zg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=eo(r.current);s.current=l==="mounted"?d:"none"},[l]),nt(()=>{const d=r.current,f=o.current;if(f!==e){const m=s.current,h=eo(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),nt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,p=h=>{const g=eo(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=h=>{h.target===t&&(s.current=eo(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function eo(e){return(e==null?void 0:e.animationName)||"none"}function Bg(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 Ug=pi[" useInsertionEffect ".trim().toString()]||nt;function Dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Hg({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const p=f.current;p!==l&&console.warn(`${r} is changing from ${p?"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.`),f.current=l},[l,r])}const d=u.useCallback(f=>{var p;if(l){const m=Wg(f)?f(e):f;m!==e&&((p=i.current)==null||p.call(i,m))}else s(f)},[l,e,s,i]);return[c,d]}function Hg({defaultProp:e,onChange:t}){const[n,r]=u.useState(e),o=u.useRef(n),s=u.useRef(t);return Ug(()=>{s.current=t},[t]),u.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Wg(e){return typeof e=="function"}var Dc=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"}),Gg="VisuallyHidden",Oc=u.forwardRef((e,t)=>a.jsx(ke.span,{...e,ref:t,style:{...Dc,...e.style}}));Oc.displayName=Gg;var Vg=Oc,[zo,t1]=An("Tooltip",[xr]),$o=xr(),Fc="TooltipProvider",Yg=700,Ws="tooltip.open",[Kg,Ri]=zo(Fc),zc=e=>{const{__scopeTooltip:t,delayDuration:n=Yg,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=u.useRef(!0),l=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(Kg,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:u.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:s})};zc.displayName=Fc;var Lr="Tooltip",[qg,Vr]=zo(Lr),$c=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Ri(Lr,e.__scopeTooltip),d=$o(t),[f,p]=u.useState(null),m=Xt(),h=u.useRef(0),x=i??c.disableHoverableContent,g=l??c.delayDuration,v=u.useRef(!1),[b,w]=Dn({prop:r,defaultProp:o??!1,onChange:I=>{I?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ws))):c.onClose(),s==null||s(I)},caller:Lr}),y=u.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),E=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,w(!0)},[w]),T=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),_=u.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,w(!0),h.current=0},g)},[g,w]);return u.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),a.jsx(Ii,{...d,children:a.jsx(qg,{scope:t,contentId:m,open:b,stateAttribute:y,trigger:f,onTriggerChange:p,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?_():E()},[c.isOpenDelayedRef,_,E]),onTriggerLeave:u.useCallback(()=>{x?T():(window.clearTimeout(h.current),h.current=0)},[T,x]),onOpen:E,onClose:T,disableHoverableContent:x,children:n})})};$c.displayName=Lr;var Gs="TooltipTrigger",Bc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Vr(Gs,n),s=Ri(Gs,n),i=$o(n),l=u.useRef(null),c=$e(t,l,o.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),p=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(Fo,{asChild:!0,...i,children:a.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ve(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ve(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:ve(e.onBlur,o.onClose),onClick:ve(e.onClick,o.onClose)})})});Bc.displayName=Gs;var Pi="TooltipPortal",[Xg,Zg]=zo(Pi,{forceMount:void 0}),Uc=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Vr(Pi,t);return a.jsx(Xg,{scope:t,forceMount:n,children:a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:r})})})};Uc.displayName=Pi;var ar="TooltipContent",Hc=u.forwardRef((e,t)=>{const n=Zg(ar,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Vr(ar,e.__scopeTooltip);return a.jsx(mn,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Wc,{side:o,...s,ref:t}):a.jsx(Jg,{side:o,...s,ref:t})})}),Jg=u.forwardRef((e,t)=>{const n=Vr(ar,e.__scopeTooltip),r=Ri(ar,e.__scopeTooltip),o=u.useRef(null),s=$e(t,o),[i,l]=u.useState(null),{trigger:c,onClose:d}=n,f=o.current,{onPointerInTransitChange:p}=r,m=u.useCallback(()=>{l(null),p(!1)},[p]),h=u.useCallback((x,g)=>{const v=x.currentTarget,b={x:x.clientX,y:x.clientY},w=nx(b,v.getBoundingClientRect()),y=rx(b,w),E=ox(g.getBoundingClientRect()),T=ix([...y,...E]);l(T),p(!0)},[p]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const x=v=>h(v,f),g=v=>h(v,c);return c.addEventListener("pointerleave",x),f.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",g)}}},[c,f,h,m]),u.useEffect(()=>{if(i){const x=g=>{const v=g.target,b={x:g.clientX,y:g.clientY},w=(c==null?void 0:c.contains(v))||(f==null?void 0:f.contains(v)),y=!sx(b,i);w?m():y&&(m(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,f,i,d,m]),a.jsx(Wc,{...e,ref:s})}),[Qg,ex]=zo(Lr,{isInside:!1}),tx=mm("TooltipContent"),Wc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Vr(ar,n),d=$o(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(Ws,f),()=>document.removeEventListener(Ws,f)),[f]),u.useEffect(()=>{if(c.trigger){const p=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,f]),a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:a.jsxs(ji,{"data-state":c.stateAttribute,...d,...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:[a.jsx(tx,{children:r}),a.jsx(Qg,{scope:n,isInside:!0,children:a.jsx(Vg,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Hc.displayName=ar;var Gc="TooltipArrow",Vc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$o(n);return ex(Gc,n).isInside?null:a.jsx(Mi,{...o,...r,ref:t})});Vc.displayName=Gc;function nx(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function rx(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 ox(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 sx(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,f=l.y,p=c.x,m=c.y;f>r!=m>r&&n<(p-d)*(r-f)/(m-f)+d&&(o=!o)}return o}function ix(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),ax(t)}function ax(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.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 lx=zc,cx=$c,ux=Bc,dx=Uc,fx=Hc,px=Vc;function mx({delayDuration:e=0,...t}){return a.jsx(lx,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Li({...e}){return a.jsx(mx,{delayDuration:500,children:a.jsx(cx,{"data-slot":"tooltip",...e})})}function Di({...e}){return a.jsx(ux,{"data-slot":"tooltip-trigger",...e})}function Oi({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(dx,{children:a.jsxs(fx,{"data-slot":"tooltip-content",sideOffset:t,className:Ce("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,a.jsx(px,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Yc="text-[var(--color-primary-wMain)] hover:text-[var(--color-primary-text-w60)] dark:text-[var(--color-primary-w20)] dark:hover:text-[var(--color-primary-text-w10)]",ms=Yc+" hover:bg-[var(--color-primary-w10)] dark:hover:bg-[var(--color-primary-w60)]",hx=Tn("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 disabled:hover:bg-transparent dark:disabled:hover:bg-transparent",{variants:{variant:{default:"text-[var(--color-primary-text-w10)] bg-[var(--color-primary-wMain)] hover:bg-[var(--color-primary-w100)] dark:hover:bg-[var(--color-primary-w60)]",destructive:"text-[var(--color-primary-text-w10)] bg-[var(--color-error-wMain)] hover:bg-[var(--color-error-w70)]",outline:ms+" border border-1 border-[var(--color-primary-wMain)]",secondary:ms,ghost:ms,link:Yc+" underline-offset-4 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 Ae({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",testid:s="",...i}){const l=r?Ql:"button",c=o?{...i,"aria-label":o}:i,d=a.jsx(l,{"data-slot":"button","data-testid":s||o||i.title,className:Ce(hx({variant:t,size:n,className:e})),...c});return o?a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:d}),a.jsx(Oi,{children:o})]}):d}const Kc=({onClick:e,text:t="View Agent Workflow"})=>a.jsx(Ae,{variant:"ghost",size:"sm",onClick:e,tooltip:t,children:a.jsx(po,{className:"h-4 w-4"})}),qc=u.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Ce("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}));qc.displayName="Textarea";var hs="focusScope.autoFocusOnMount",gs="focusScope.autoFocusOnUnmount",$a={bubbles:!1,cancelable:!0},gx="FocusScope",Bo=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=u.useState(null),d=yn(o),f=yn(s),p=u.useRef(null),m=$e(t,g=>c(g)),h=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let g=function(y){if(h.paused||!l)return;const E=y.target;l.contains(E)?p.current=E:xn(p.current,{select:!0})},v=function(y){if(h.paused||!l)return;const E=y.relatedTarget;E!==null&&(l.contains(E)||xn(p.current,{select:!0}))},b=function(y){if(document.activeElement===document.body)for(const T of y)T.removedNodes.length>0&&xn(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),w.disconnect()}}},[r,l,h.paused]),u.useEffect(()=>{if(l){Ua.add(h);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(hs,$a);l.addEventListener(hs,d),l.dispatchEvent(b),b.defaultPrevented||(xx(Sx(Xc(l)),{select:!0}),document.activeElement===g&&xn(l))}return()=>{l.removeEventListener(hs,d),setTimeout(()=>{const b=new CustomEvent(gs,$a);l.addEventListener(gs,f),l.dispatchEvent(b),b.defaultPrevented||xn(g??document.body,{select:!0}),l.removeEventListener(gs,f),Ua.remove(h)},0)}}},[l,d,f,h]);const x=u.useCallback(g=>{if(!n&&!r||h.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(v&&b){const w=g.currentTarget,[y,E]=vx(w);y&&E?!g.shiftKey&&b===E?(g.preventDefault(),n&&xn(y,{select:!0})):g.shiftKey&&b===y&&(g.preventDefault(),n&&xn(E,{select:!0})):b===w&&g.preventDefault()}},[n,r,h.paused]);return a.jsx(ke.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});Bo.displayName=gx;function xx(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(xn(r,{select:t}),document.activeElement!==n)return}function vx(e){const t=Xc(e),n=Ba(t,e),r=Ba(t.reverse(),e);return[n,r]}function Xc(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 Ba(e,t){for(const n of e)if(!wx(n,{upTo:t}))return n}function wx(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 bx(e){return e instanceof HTMLInputElement&&"select"in e}function xn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bx(e)&&t&&e.select()}}var Ua=yx();function yx(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ha(e,t),e.unshift(t)},remove(t){var n;e=Ha(e,t),(n=e[0])==null||n.resume()}}}function Ha(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Sx(e){return e.filter(t=>t.tagName!=="A")}var xs=0;function Fi(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Wa()),document.body.insertAdjacentElement("beforeend",e[1]??Wa()),xs++,()=>{xs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xs--}},[])}function Wa(){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 Yt=function(){return Yt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Yt.apply(this,arguments)};function Zc(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 Cx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var ho="right-scroll-bar-position",go="width-before-scroll-bar",Ex="with-scroll-bars-hidden",Tx="--removed-body-scroll-bar-size";function vs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ax(e,t){var n=u.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 Nx=typeof window<"u"?u.useLayoutEffect:u.useEffect,Ga=new WeakMap;function kx(e,t){var n=Ax(null,function(r){return e.forEach(function(o){return vs(o,r)})});return Nx(function(){var r=Ga.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||vs(l,null)}),s.forEach(function(l){o.has(l)||vs(l,i)})}Ga.set(n,e)},[e]),n}function _x(e){return e}function Ix(e,t){t===void 0&&(t=_x);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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var f=i;i=[],f.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return o}function jx(e){e===void 0&&(e={});var t=Ix(null);return t.options=Yt({async:!0,ssr:!1},e),t}var Jc=function(e){var t=e.sideCar,n=Zc(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 u.createElement(r,Yt({},n))};Jc.isSideCarExport=!0;function Mx(e,t){return e.useMedium(t),Jc}var Qc=jx(),ws=function(){},Uo=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:ws,onWheelCapture:ws,onTouchMoveCapture:ws}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,y=e.gapMode,E=Zc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,_=kx([n,t]),I=Yt(Yt({},E),o);return u.createElement(u.Fragment,null,f&&u.createElement(T,{sideCar:Qc,removeScrollBar:d,shards:p,noRelative:h,noIsolation:x,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:n,gapMode:y}),i?u.cloneElement(u.Children.only(l),Yt(Yt({},I),{ref:_})):u.createElement(w,Yt({},I,{className:c,ref:_}),l))});Uo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Uo.classNames={fullWidth:go,zeroRight:ho};var Rx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Px(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Rx();return t&&e.setAttribute("nonce",t),e}function Lx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Dx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ox=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Px())&&(Lx(t,n),Dx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fx=function(){var e=Ox();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},eu=function(){var e=Fx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zx={left:0,top:0,right:0,gap:0},bs=function(e){return parseInt(e||"",10)||0},$x=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[bs(n),bs(r),bs(o)]},Bx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zx;var t=$x(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])}},Ux=eu(),nr="data-scroll-locked",Hx=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
73
73
|
.`.concat(Ex,` {
|
|
74
74
|
overflow: hidden `).concat(r,`;
|
|
75
75
|
padding-right: `).concat(l,"px ").concat(r,`;
|
|
@@ -113,15 +113,15 @@ var Ap=Object.defineProperty;var Np=(e,t,n)=>t in e?Ap(e,t,{enumerable:!0,config
|
|
|
113
113
|
|
|
114
114
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
115
115
|
|
|
116
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},gv="DialogDescriptionWarning",xv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wu(gv).contentName}}.`;return u.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vv=iu,wv=cu,bv=uu,yv=du,Sv=pu,Cv=hu,Ev=xu;function Go({...e}){return a.jsx(vv,{"data-slot":"dialog",...e})}function Tv({...e}){return a.jsx(wv,{"data-slot":"dialog-portal",...e})}function Av({className:e,...t}){return a.jsx(bv,{"data-slot":"dialog-overlay",className:Ce("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 Vo({className:e,children:t,showCloseButton:n=!0,...r}){return a.jsxs(Tv,{"data-slot":"dialog-portal",children:[a.jsx(Av,{}),a.jsxs(yv,{"data-slot":"dialog-content",className:Ce("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&&a.jsxs(Ev,{"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:[a.jsx(Ro,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Yo({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:Ce("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nv({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-footer",className:Ce("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Ko({className:e,...t}){return a.jsx(Sv,{"data-slot":"dialog-title",className:Ce("text-lg leading-none font-semibold",e),...t})}function qo({className:e,...t}){return a.jsx(Cv,{"data-slot":"dialog-description",className:Ce("py-4 text-sm",e),...t})}const Xo=u.createContext(null);Xo.displayName="PanelGroupContext";const Be={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"},Hi=10,Mn=u.useLayoutEffect,Xa=pi.useId,kv=typeof Xa=="function"?Xa:()=>null;let _v=0;function Wi(e=null){const t=kv(),n=u.useRef(e||t||null);return n.current===null&&(n.current=""+_v++),e??n.current}function bu({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:i,maxSize:l,minSize:c,onCollapse:d,onExpand:f,onResize:p,order:m,style:h,tagName:x="div",...g}){const v=u.useContext(Xo);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:w,getPanelSize:y,getPanelStyle:E,groupId:T,isPanelCollapsed:_,reevaluatePanelConstraints:I,registerPanel:A,resizePanel:q,unregisterPanel:K}=v,U=Wi(i),Y=u.useRef({callbacks:{onCollapse:d,onExpand:f,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:U,idIsFromProps:i!==void 0,order:m});u.useRef({didLogMissingDefaultSizeWarning:!1}),Mn(()=>{const{callbacks:O,constraints:X}=Y.current,N={...X};Y.current.id=U,Y.current.idIsFromProps=i!==void 0,Y.current.order=m,O.onCollapse=d,O.onExpand=f,O.onResize=p,X.collapsedSize=n,X.collapsible=r,X.defaultSize=o,X.maxSize=l,X.minSize=c,(N.collapsedSize!==X.collapsedSize||N.collapsible!==X.collapsible||N.maxSize!==X.maxSize||N.minSize!==X.minSize)&&I(Y.current,N)}),Mn(()=>{const O=Y.current;return A(O),()=>{K(O)}},[m,U,A,K]),u.useImperativeHandle(s,()=>({collapse:()=>{b(Y.current)},expand:O=>{w(Y.current,O)},getId(){return U},getSize(){return y(Y.current)},isCollapsed(){return _(Y.current)},isExpanded(){return!_(Y.current)},resize:O=>{q(Y.current,O)}}),[b,w,y,_,U,q]);const J=E(Y.current,o);return u.createElement(x,{...g,children:e,className:t,id:U,style:{...J,...h},[Be.groupId]:T,[Be.panel]:"",[Be.panelCollapsible]:r||void 0,[Be.panelId]:U,[Be.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const yu=u.forwardRef((e,t)=>u.createElement(bu,{...e,forwardedRef:t}));bu.displayName="Panel";yu.displayName="forwardRef(Panel)";let Ys=null,xo=-1,vn=null;function Iv(e,t,n){const r=(t&Au)!==0,o=(t&Nu)!==0,s=(t&ku)!==0,i=(t&_u)!==0;if(t){if(r)return s?"se-resize":i?"ne-resize":"e-resize";if(o)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function jv(){vn!==null&&(document.head.removeChild(vn),Ys=null,vn=null,xo=-1)}function Ss(e,t,n){var r,o;const s=Iv(e,t);if(Ys!==s){if(Ys=s,vn===null&&(vn=document.createElement("style"),document.head.appendChild(vn)),xo>=0){var i;(i=vn.sheet)===null||i===void 0||i.removeRule(xo)}xo=(r=(o=vn.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function Su(e){return e.type==="keydown"}function Cu(e){return e.type.startsWith("pointer")}function Eu(e){return e.type.startsWith("mouse")}function Zo(e){if(Cu(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Eu(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Mv(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Rv(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 Pv(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Qa(e),b:Qa(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Se(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Ja(Za(n.a)),b:Ja(Za(n.b))};if(o.a===o.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const c=s[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(o.a-o.b)}const Lv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Dv(e){var t;const n=getComputedStyle((t=Tu(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Ov(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Dv(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"||Lv.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Za(e){let t=e.length;for(;t--;){const n=e[t];if(Se(n,"Missing node"),Ov(n))return n}return null}function Ja(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qa(e){const t=[];for(;e;)t.push(e),e=Tu(e);return t}function Tu(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Au=1,Nu=2,ku=4,_u=8,Fv=Mv()==="coarse";let $t=[],rr=!1,wn=new Map,Jo=new Map;const Dr=new Set;function zv(e,t,n,r,o){var s;const{ownerDocument:i}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=wn.get(i))!==null&&s!==void 0?s:0;return wn.set(i,c+1),Dr.add(l),Eo(),function(){var f;Jo.delete(e),Dr.delete(l);const p=(f=wn.get(i))!==null&&f!==void 0?f:1;if(wn.set(i,p-1),Eo(),p===1&&wn.delete(i),$t.includes(l)){const m=$t.indexOf(l);m>=0&&$t.splice(m,1),Qo(),o("up",!0,null)}}}function $v(e){const{target:t}=e,{x:n,y:r}=Zo(e);rr=!0,Gi({target:t,x:n,y:r}),Eo(),$t.length>0&&(To("down",e),Qo(),e.preventDefault(),Iu(t)||e.stopImmediatePropagation())}function Cs(e){const{x:t,y:n}=Zo(e);if(rr&&e.buttons===0&&(rr=!1,To("up",e)),!rr){const{target:r}=e;Gi({target:r,x:t,y:n})}To("move",e),Qo(),$t.length>0&&e.preventDefault()}function Es(e){const{target:t}=e,{x:n,y:r}=Zo(e);Jo.clear(),rr=!1,$t.length>0&&(e.preventDefault(),Iu(t)||e.stopImmediatePropagation()),To("up",e),Gi({target:t,x:n,y:r}),Qo(),Eo()}function Iu(e){let t=e;for(;t;){if(t.hasAttribute(Be.resizeHandle))return!0;t=t.parentElement}return!1}function Gi({target:e,x:t,y:n}){$t.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Dr.forEach(o=>{const{element:s,hitAreaMargins:i}=o,l=s.getBoundingClientRect(),{bottom:c,left:d,right:f,top:p}=l,m=Fv?i.coarse:i.fine;if(t>=d-m&&t<=f+m&&n>=p-m&&n<=c+m){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&Pv(r,s)>0){let x=r,g=!1;for(;x&&!x.contains(s);){if(Rv(x.getBoundingClientRect(),l)){g=!0;break}x=x.parentElement}if(g)return}$t.push(o)}})}function Ts(e,t){Jo.set(e,t)}function Qo(){let e=!1,t=!1;$t.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;Jo.forEach(r=>{n|=r}),e&&t?Ss("intersection",n):e?Ss("horizontal",n):t?Ss("vertical",n):jv()}let As;function Eo(){var e;(e=As)===null||e===void 0||e.abort(),As=new AbortController;const t={capture:!0,signal:As.signal};Dr.size&&(rr?($t.length>0&&wn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",Es,t),o.addEventListener("pointerleave",Cs,t),o.addEventListener("pointermove",Cs,t))}),wn.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",Es,t),o.addEventListener("pointercancel",Es,t)})):wn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",$v,t),o.addEventListener("pointermove",Cs,t))}))}function To(e,t){Dr.forEach(n=>{const{setResizeHandlerState:r}=n,o=$t.includes(n);r(e,o,t)})}function Bv(){const[e,t]=u.useState(0);return u.useCallback(()=>t(n=>n+1),[])}function Se(e,t){if(!e)throw console.error(t),Error(t)}function Fn(e,t,n=Hi){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function cn(e,t,n=Hi){return Fn(e,t,n)===0}function bt(e,t,n){return Fn(e,t,n)===0}function Uv(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],s=t[r];if(!bt(o,s,n))return!1}return!0}function Jn({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Se(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:s,maxSize:i=100,minSize:l=0}=r;if(Fn(n,l)<0)if(s){const c=(o+l)/2;Fn(n,c)<0?n=o:n=l}else n=l;return n=Math.min(i,n),n=parseFloat(n.toFixed(Hi)),n}function _r({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(bt(e,0))return t;const i=[...t],[l,c]=r;Se(l!=null,"Invalid first pivot index"),Se(c!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const p=e<0?c:l,m=n[p];Se(m,`Panel constraints not found for index ${p}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const v=t[p];if(Se(v!=null,`Previous layout not found for panel index ${p}`),bt(v,h)){const b=g-v;Fn(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const p=e<0?l:c,m=n[p];Se(m,`No panel constraints found for index ${p}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const v=t[p];if(Se(v!=null,`Previous layout not found for panel index ${p}`),bt(v,g)){const b=v-h;Fn(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}}{const p=e<0?1:-1;let m=e<0?c:l,h=0;for(;;){const g=t[m];Se(g!=null,`Previous layout not found for panel index ${m}`);const b=Jn({panelConstraints:n,panelIndex:m,size:100})-g;if(h+=b,m+=p,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(d),x=t[m];Se(x!=null,`Previous layout not found for panel index ${m}`);const g=x-h,v=Jn({panelConstraints:n,panelIndex:m,size:g});if(!bt(x,v)&&(d+=x-v,i[m]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Uv(o,i))return o;{const p=e<0?c:l,m=t[p];Se(m!=null,`Previous layout not found for panel index ${p}`);const h=m+d,x=Jn({panelConstraints:n,panelIndex:p,size:h});if(i[p]=x,!bt(x,h)){let g=h-x,b=e<0?c:l;for(;b>=0&&b<n.length;){const w=i[b];Se(w!=null,`Previous layout not found for panel index ${b}`);const y=w+g,E=Jn({panelConstraints:n,panelIndex:b,size:y});if(bt(w,E)||(g-=E-w,i[b]=E),bt(g,0))break;e>0?b--:b++}}}const f=i.reduce((p,m)=>m+p,0);return bt(f,100)?i:o}function Hv({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,i=0;const l=n[0];Se(l!=null,"No pivot index found"),t.forEach((p,m)=>{const{constraints:h}=p,{maxSize:x=100,minSize:g=0}=h;m===l?(r=g,o=x):(s+=g,i+=x)});const c=Math.min(o,100-s),d=Math.max(r,100-i),f=e[l];return{valueMax:c,valueMin:d,valueNow:f}}function Or(e,t=document){return Array.from(t.querySelectorAll(`[${Be.resizeHandleId}][data-panel-group-id="${e}"]`))}function ju(e,t,n=document){const o=Or(e,n).findIndex(s=>s.getAttribute(Be.resizeHandleId)===t);return o??null}function Mu(e,t,n){const r=ju(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function Wv(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Ru(e,t=document){if(Wv(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function es(e,t=document){const n=t.querySelector(`[${Be.resizeHandleId}="${e}"]`);return n||null}function Gv(e,t,n,r=document){var o,s,i,l;const c=es(t,r),d=Or(e,r),f=c?d.indexOf(c):-1,p=(o=(s=n[f])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,m=(i=(l=n[f+1])===null||l===void 0?void 0:l.id)!==null&&i!==void 0?i:null;return[p,m]}function Vv({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:i}){u.useRef({didWarnAboutMissingResizeHandle:!1}),Mn(()=>{if(!s)return;const l=Or(n,s);for(let c=0;c<o.length-1;c++){const{valueMax:d,valueMin:f,valueNow:p}=Hv({layout:r,panelsArray:o,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const h=o[c];Se(h,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",h.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(f)),m.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{l.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),u.useEffect(()=>{if(!s)return;const l=t.current;Se(l,"Eager values not found");const{panelDataArray:c}=l,d=Ru(n,s);Se(d!=null,`No group found for id "${n}"`);const f=Or(n,s);Se(f,`No resize handles found for group id "${n}"`);const p=f.map(m=>{const h=m.getAttribute(Be.resizeHandleId);Se(h,"Resize handle element has no handle id attribute");const[x,g]=Gv(n,h,c,s);if(x==null||g==null)return()=>{};const v=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const w=c.findIndex(y=>y.id===x);if(w>=0){const y=c[w];Se(y,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:T=0,collapsible:_,minSize:I=0}=y.constraints;if(E!=null&&_){const A=_r({delta:bt(E,T)?I-T:T-E,initialLayout:r,panelConstraints:c.map(q=>q.constraints),pivotIndices:Mu(n,h,s),prevLayout:r,trigger:"keyboard"});r!==A&&i(A)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{p.forEach(m=>m())}},[s,e,t,n,r,o,i])}function el(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 Pu(e,t){const n=e==="horizontal",{x:r,y:o}=Zo(t);return n?r:o}function Yv(e,t,n,r,o){const s=n==="horizontal",i=es(t,o);Se(i,`No resize handle element found for id "${t}"`);const l=i.getAttribute(Be.groupId);Se(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const d=Pu(n,e),f=Ru(l,o);Se(f,`No group element found for id "${l}"`);const p=f.getBoundingClientRect(),m=s?p.width:p.height;return(d-c)/m*100}function Kv(e,t,n,r,o,s){if(Su(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:Yv(e,t,n,r,s)}function qv({panelDataArray:e}){const t=Array(e.length),n=e.map(s=>s.constraints);let r=0,o=100;for(let s=0;s<e.length;s++){const i=n[s];Se(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;l!=null&&(r++,t[s]=l,o-=l)}for(let s=0;s<e.length;s++){const i=n[s];Se(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;if(l!=null)continue;const c=e.length-r,d=o/c;r++,t[s]=d,o-=d}return t}function Kn(e,t,n){t.forEach((r,o)=>{const s=e[o];Se(s,`Panel data not found for index ${o}`);const{callbacks:i,constraints:l,id:c}=s,{collapsedSize:d=0,collapsible:f}=l,p=n[c];if(p==null||r!==p){n[c]=r;const{onCollapse:m,onExpand:h,onResize:x}=i;x&&x(r,p),f&&(m||h)&&(h&&(p==null||cn(p,d))&&!cn(r,d)&&h(),m&&(p==null||!cn(p,d))&&cn(r,d)&&m())}})}function so(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 Xv({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:s=3}){const i=n[o];let l;return i==null?l=e!=null?e.toFixed(s):"1":r.length===1?l="1":l=i.toFixed(s),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Zv(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function tl(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 Lu(e){return`react-resizable-panels:${e}`}function Du(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:s}=t;return o?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Ou(e,t){try{const n=Lu(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function Jv(e,t,n){var r,o;const s=(r=Ou(e,n))!==null&&r!==void 0?r:{},i=Du(t);return(o=s[i])!==null&&o!==void 0?o:null}function Qv(e,t,n,r,o){var s;const i=Lu(e),l=Du(t),c=(s=Ou(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(i,JSON.stringify(c))}catch(d){console.error(d)}}function nl({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,i)=>s+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!bt(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=100/r*i;n[s]=l}let o=0;for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=Jn({panelConstraints:t,panelIndex:s,size:i});i!=l&&(o+=i-l,n[s]=l)}if(!bt(o,0))for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=i+o,c=Jn({panelConstraints:t,panelIndex:s,size:l});if(i!==c&&(o-=c-i,n[s]=c,bt(o,0)))break}return n}const ew=100,Ir={getItem:e=>(tl(Ir),Ir.getItem(e)),setItem:(e,t)=>{tl(Ir),Ir.setItem(e,t)}},rl={};function Fu({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:i=null,keyboardResizeBy:l=null,storage:c=Ir,style:d,tagName:f="div",...p}){const m=Wi(s),h=u.useRef(null),[x,g]=u.useState(null),[v,b]=u.useState([]),w=Bv(),y=u.useRef({}),E=u.useRef(new Map),T=u.useRef(0),_=u.useRef({autoSaveId:e,direction:r,dragState:x,id:m,keyboardResizeBy:l,onLayout:i,storage:c}),I=u.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});u.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),u.useImperativeHandle(o,()=>({getId:()=>_.current.id,getLayout:()=>{const{layout:D}=I.current;return D},setLayout:D=>{const{onLayout:$}=_.current,{layout:L,panelDataArray:W}=I.current,k=nl({layout:D,panelConstraints:W.map(G=>G.constraints)});el(L,k)||(b(k),I.current.layout=k,$&&$(k),Kn(W,k,y.current))}}),[]),Mn(()=>{_.current.autoSaveId=e,_.current.direction=r,_.current.dragState=x,_.current.id=m,_.current.onLayout=i,_.current.storage=c}),Vv({committedValuesRef:_,eagerValuesRef:I,groupId:m,layout:v,panelDataArray:I.current.panelDataArray,setLayout:b,panelGroupElement:h.current}),u.useEffect(()=>{const{panelDataArray:D}=I.current;if(e){if(v.length===0||v.length!==D.length)return;let $=rl[e];$==null&&($=Zv(Qv,ew),rl[e]=$);const L=[...D],W=new Map(E.current);$(e,L,W,v,c)}},[e,v,c]),u.useEffect(()=>{});const A=u.useCallback(D=>{const{onLayout:$}=_.current,{layout:L,panelDataArray:W}=I.current;if(D.constraints.collapsible){const k=W.map(oe=>oe.constraints),{collapsedSize:G=0,panelSize:Q,pivotIndices:te}=jn(W,D,L);if(Se(Q!=null,`Panel size not found for panel "${D.id}"`),!cn(Q,G)){E.current.set(D.id,Q);const se=Xn(W,D)===W.length-1?Q-G:G-Q,de=_r({delta:se,initialLayout:L,panelConstraints:k,pivotIndices:te,prevLayout:L,trigger:"imperative-api"});so(L,de)||(b(de),I.current.layout=de,$&&$(de),Kn(W,de,y.current))}}},[]),q=u.useCallback((D,$)=>{const{onLayout:L}=_.current,{layout:W,panelDataArray:k}=I.current;if(D.constraints.collapsible){const G=k.map(me=>me.constraints),{collapsedSize:Q=0,panelSize:te=0,minSize:oe=0,pivotIndices:se}=jn(k,D,W),de=$??oe;if(cn(te,Q)){const me=E.current.get(D.id),Me=me!=null&&me>=de?me:de,Le=Xn(k,D)===k.length-1?te-Me:Me-te,je=_r({delta:Le,initialLayout:W,panelConstraints:G,pivotIndices:se,prevLayout:W,trigger:"imperative-api"});so(W,je)||(b(je),I.current.layout=je,L&&L(je),Kn(k,je,y.current))}}},[]),K=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{panelSize:W}=jn(L,D,$);return Se(W!=null,`Panel size not found for panel "${D.id}"`),W},[]),U=u.useCallback((D,$)=>{const{panelDataArray:L}=I.current,W=Xn(L,D);return Xv({defaultSize:$,dragState:x,layout:v,panelData:L,panelIndex:W})},[x,v]),Y=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{collapsedSize:W=0,collapsible:k,panelSize:G}=jn(L,D,$);return Se(G!=null,`Panel size not found for panel "${D.id}"`),k===!0&&cn(G,W)},[]),J=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{collapsedSize:W=0,collapsible:k,panelSize:G}=jn(L,D,$);return Se(G!=null,`Panel size not found for panel "${D.id}"`),!k||Fn(G,W)>0},[]),O=u.useCallback(D=>{const{panelDataArray:$}=I.current;$.push(D),$.sort((L,W)=>{const k=L.order,G=W.order;return k==null&&G==null?0:k==null?-1:G==null?1:k-G}),I.current.panelDataArrayChanged=!0,w()},[w]);Mn(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:D,onLayout:$,storage:L}=_.current,{layout:W,panelDataArray:k}=I.current;let G=null;if(D){const te=Jv(D,k,L);te&&(E.current=new Map(Object.entries(te.expandToSizes)),G=te.layout)}G==null&&(G=qv({panelDataArray:k}));const Q=nl({layout:G,panelConstraints:k.map(te=>te.constraints)});el(W,Q)||(b(Q),I.current.layout=Q,$&&$(Q),Kn(k,Q,y.current))}}),Mn(()=>{const D=I.current;return()=>{D.layout=[]}},[]);const X=u.useCallback(D=>{let $=!1;const L=h.current;return L&&window.getComputedStyle(L,null).getPropertyValue("direction")==="rtl"&&($=!0),function(k){k.preventDefault();const G=h.current;if(!G)return()=>null;const{direction:Q,dragState:te,id:oe,keyboardResizeBy:se,onLayout:de}=_.current,{layout:me,panelDataArray:Me}=I.current,{initialLayout:Oe}=te??{},Le=Mu(oe,D,G);let je=Kv(k,D,Q,te,se,G);const He=Q==="horizontal";He&&$&&(je=-je);const ot=Me.map(le=>le.constraints),Qe=_r({delta:je,initialLayout:Oe??me,panelConstraints:ot,pivotIndices:Le,prevLayout:me,trigger:Su(k)?"keyboard":"mouse-or-touch"}),et=!so(me,Qe);(Cu(k)||Eu(k))&&T.current!=je&&(T.current=je,!et&&je!==0?He?Ts(D,je<0?Au:Nu):Ts(D,je<0?ku:_u):Ts(D,0)),et&&(b(Qe),I.current.layout=Qe,de&&de(Qe),Kn(Me,Qe,y.current))}},[]),N=u.useCallback((D,$)=>{const{onLayout:L}=_.current,{layout:W,panelDataArray:k}=I.current,G=k.map(me=>me.constraints),{panelSize:Q,pivotIndices:te}=jn(k,D,W);Se(Q!=null,`Panel size not found for panel "${D.id}"`);const se=Xn(k,D)===k.length-1?Q-$:$-Q,de=_r({delta:se,initialLayout:W,panelConstraints:G,pivotIndices:te,prevLayout:W,trigger:"imperative-api"});so(W,de)||(b(de),I.current.layout=de,L&&L(de),Kn(k,de,y.current))},[]),R=u.useCallback((D,$)=>{const{layout:L,panelDataArray:W}=I.current,{collapsedSize:k=0,collapsible:G}=$,{collapsedSize:Q=0,collapsible:te,maxSize:oe=100,minSize:se=0}=D.constraints,{panelSize:de}=jn(W,D,L);de!=null&&(G&&te&&cn(de,k)?cn(k,Q)||N(D,Q):de<se?N(D,se):de>oe&&N(D,oe))},[N]),S=u.useCallback((D,$)=>{const{direction:L}=_.current,{layout:W}=I.current;if(!h.current)return;const k=es(D,h.current);Se(k,`Drag handle element not found for id "${D}"`);const G=Pu(L,$);g({dragHandleId:D,dragHandleRect:k.getBoundingClientRect(),initialCursorPosition:G,initialLayout:W})},[]),F=u.useCallback(()=>{g(null)},[]),M=u.useCallback(D=>{const{panelDataArray:$}=I.current,L=Xn($,D);L>=0&&($.splice(L,1),delete y.current[D.id],I.current.panelDataArrayChanged=!0,w())},[w]),P=u.useMemo(()=>({collapsePanel:A,direction:r,dragState:x,expandPanel:q,getPanelSize:K,getPanelStyle:U,groupId:m,isPanelCollapsed:Y,isPanelExpanded:J,reevaluatePanelConstraints:R,registerPanel:O,registerResizeHandle:X,resizePanel:N,startDragging:S,stopDragging:F,unregisterPanel:M,panelGroupElement:h.current}),[A,x,r,q,K,U,m,Y,J,R,O,X,N,S,F,M]),ee={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return u.createElement(Xo.Provider,{value:P},u.createElement(f,{...p,children:t,className:n,id:s,ref:h,style:{...ee,...d},[Be.group]:"",[Be.groupDirection]:r,[Be.groupId]:m}))}const zu=u.forwardRef((e,t)=>u.createElement(Fu,{...e,forwardedRef:t}));Fu.displayName="PanelGroup";zu.displayName="forwardRef(PanelGroup)";function Xn(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function jn(e,t,n){const r=Xn(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function tw({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){u.useEffect(()=>{if(e||n==null||r==null)return;const o=es(t,r);if(o==null)return;const s=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(Be.groupId);Se(l,`No group element found for id "${l}"`);const c=Or(l,r),d=ju(l,t,r);Se(d!==null,`No resize element found for id "${t}"`);const f=i.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[f].focus();break}}};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}},[r,e,t,n])}function $u({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onClick:i,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:f,style:p={},tabIndex:m=0,tagName:h="div",...x}){var g,v;const b=u.useRef(null),w=u.useRef({onClick:i,onDragging:l,onPointerDown:d,onPointerUp:f});u.useEffect(()=>{w.current.onClick=i,w.current.onDragging=l,w.current.onPointerDown=d,w.current.onPointerUp=f});const y=u.useContext(Xo);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:T,registerResizeHandle:_,startDragging:I,stopDragging:A,panelGroupElement:q}=y,K=Wi(o),[U,Y]=u.useState("inactive"),[J,O]=u.useState(!1),[X,N]=u.useState(null),R=u.useRef({state:U});Mn(()=>{R.current.state=U}),u.useEffect(()=>{if(n)N(null);else{const P=_(K);N(()=>P)}},[n,K,_]);const S=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,F=(v=r==null?void 0:r.fine)!==null&&v!==void 0?v:5;u.useEffect(()=>{if(n||X==null)return;const P=b.current;Se(P,"Element ref not attached");let ee=!1;return zv(K,P,E,{coarse:S,fine:F},($,L,W)=>{if(!L){Y("inactive");return}switch($){case"down":{Y("drag"),ee=!1,Se(W,'Expected event to be defined for "down" action'),I(K,W);const{onDragging:k,onPointerDown:G}=w.current;k==null||k(!0),G==null||G();break}case"move":{const{state:k}=R.current;ee=!0,k!=="drag"&&Y("hover"),Se(W,'Expected event to be defined for "move" action'),X(W);break}case"up":{Y("hover"),A();const{onClick:k,onDragging:G,onPointerUp:Q}=w.current;G==null||G(!1),Q==null||Q(),ee||k==null||k();break}}})},[S,E,n,F,_,K,X,I,A]),tw({disabled:n,handleId:K,resizeHandler:X,panelGroupElement:q});const M={touchAction:"none",userSelect:"none"};return u.createElement(h,{...x,children:e,className:t,id:o,onBlur:()=>{O(!1),s==null||s()},onFocus:()=>{O(!0),c==null||c()},ref:b,role:"separator",style:{...M,...p},tabIndex:m,[Be.groupDirection]:E,[Be.groupId]:T,[Be.resizeHandle]:"",[Be.resizeHandleActive]:U==="drag"?"pointer":J?"keyboard":void 0,[Be.resizeHandleEnabled]:!n,[Be.resizeHandleId]:K,[Be.resizeHandleState]:U})}$u.displayName="PanelResizeHandle";function nw({className:e,...t}){return a.jsx(zu,{"data-slot":"resizable-panel-group",className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ol({...e}){return a.jsx(yu,{"data-slot":"resizable-panel",...e})}function rw({withHandle:e,className:t,...n}){return a.jsx($u,{"data-slot":"resizable-handle",className:Ce("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&&a.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:a.jsx(Ip,{className:"size-2.5"})})})}function ow({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){u.useEffect(()=>{if(!r)return;const o=s=>{const i=s.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 sw({onEscape:e,enabled:t=!0}){u.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const iw={x:0,y:0},kt=16,aw=["top-start","bottom-end","top-end"];function lw({anchorRef:e,placement:t="top-start",offset:n=iw,fallbackPlacements:r=aw}){const o=u.useCallback((c,d,f)=>{let p=0,m=0;switch(f){case"top":p=c.top-d.height-n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"top-start":p=c.top-d.height-n.y,m=c.left+n.x;break;case"top-end":p=c.top-d.height-n.y,m=c.right-d.width-n.x;break;case"bottom":p=c.bottom+n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"bottom-start":p=c.bottom+n.y,m=c.left+n.x;break;case"bottom-end":p=c.bottom+n.y,m=c.right-d.width-n.x;break;case"left":p=c.top+(c.height-d.height)/2+n.y,m=c.left-d.width-n.x;break;case"left-start":p=c.top+n.y,m=c.left-d.width-n.x;break;case"left-end":p=c.bottom-d.height-n.y,m=c.left-d.width-n.x;break;case"right":p=c.top+(c.height-d.height)/2+n.y,m=c.right+n.x;break;case"right-start":p=c.top+n.y,m=c.right+n.x;break;case"right-end":p=c.bottom-d.height-n.y,m=c.right+n.x;break}return console.log(`Calculated position for ${f}:`,{top:p,left:m}),{top:p,left:m,placement:f}},[n.x,n.y]),s=u.useCallback((c,d)=>{const f={width:window.innerWidth,height:window.innerHeight};return c.left<kt||c.top<kt||c.left+d.width>f.width-kt||c.top+d.height>f.height-kt},[]),i=u.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 d=e.current.getBoundingClientRect(),f=c.getBoundingClientRect(),p=o(d,f,t);if(!s(p,f))return p;for(const x of r){const g=o(d,f,x);if(!s(g,f))return g}const m={width:window.innerWidth,height:window.innerHeight},h={...p};return h.left<kt?h.left=kt:h.left+f.width>m.width-kt&&(h.left=m.width-f.width-kt),h.top<kt?h.top=kt:h.top+f.height>m.height-kt&&(h.top=m.height-f.height-kt),h},[e,t,r,o,s]);return{getPositionStyle:u.useCallback(c=>{const d=i(c);return{position:"fixed",top:d.top,left:d.left,zIndex:1e3}},[i]),getOptimalPosition:i}}function cw({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[s,i]=u.useState(e),[l,c]=u.useState(!1),d=u.useRef(0),f=u.useRef(e),p=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.clientX,f.current=s},[s]),m=u.useCallback(b=>{if(!l)return;const w=b.clientX-d.current,y=r==="right"?-w:w,E=Math.min(Math.max(f.current+y,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),h=u.useCallback(()=>{c(!1)},[]),x=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.touches[0].clientX,f.current=s},[s]),g=u.useCallback(b=>{if(!l)return;const w=b.touches[0].clientX-d.current,y=r==="right"?-w:w,E=Math.min(Math.max(f.current+y,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),v=u.useCallback(()=>{c(!1)},[]);return u.useEffect(()=>{if(l)return document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.addEventListener("touchmove",g),document.addEventListener("touchend",v),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",v),document.body.style.userSelect="",document.body.style.cursor=""}},[l,m,h,g,v]),{width:s,isResizing:l,handleMouseDown:p,handleTouchStart:x,setWidth:i}}const uw=u.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:s=!0,className:i,onWidthChange:l,...c},d)=>{const{width:f,isResizing:p,handleMouseDown:m,handleTouchStart:h}=cw({defaultWidth:t,minWidth:n,maxWidth:r,position:o,onWidthChange:l}),x={width:`${f}px`},g=o==="left"?"right-0":"left-0";return a.jsxs("div",{ref:d,className:Ce("relative h-full flex-shrink-0 cursor-pointer",o==="left"?"border-r":"border-l",i),style:x,...c,children:[a.jsx("div",{className:Ce("h-full overflow-x-hidden overflow-y-auto"),children:e}),s&&a.jsx("div",{className:Ce("group absolute top-0 bottom-0 w-2",g,"cursor-col-resize","hover:bg-[var(--color-primary-wMain)]","transition-all duration-200",p&&"bg-[var(--color-primary-wMain)]"),onMouseDown:m,onTouchStart:h,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} panel`,tabIndex:0,onKeyDown:b=>{if(b.key==="ArrowLeft"||b.key==="ArrowRight"){b.preventDefault();const w=b.key==="ArrowRight"?10:-10,y=o==="right"?-w:w,E=Math.min(Math.max(f+y,n),r);l==null||l(E)}},children:a.jsx("div",{className:Ce("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",p&&"bg-[var(--color-primary-wMain)]")})})]})});uw.displayName="SidePanel";const Bu=u.createContext(null),Uu=u.createContext(void 0),Hu=u.createContext(null),Wu=u.createContext(null),Gu=u.createContext(void 0),Vu=u.createContext(null);function tn(){const e=u.useContext(Hu);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const dw="https://solace.com/a2a/extensions/display-name",fw="https://solace.com/a2a/extensions/peer-agent-topology",pw="https://solace.com/a2a/extensions/sam/tools",mw=e=>{var o,s,i,l;let t,n,r;if((o=e.capabilities)!=null&&o.extensions){const c=e.capabilities.extensions.find(p=>p.uri===dw);(s=c==null?void 0:c.params)!=null&&s.displayName&&(t=c.params.displayName);const d=e.capabilities.extensions.find(p=>p.uri===fw);(i=d==null?void 0:d.params)!=null&&i.peer_agent_names&&(n=d.params.peer_agent_names);const f=e.capabilities.extensions.find(p=>p.uri===pw);(l=f==null?void 0:f.params)!=null&&l.tools&&(r=f.params.tools)}return{...e,display_name:t,peer_agents:n||[],tools:r||[],displayName:t,peerAgents:n||[]}},hw=()=>{const{configServerUrl:e}=tn(),[t,n]=u.useState([]),[r,o]=u.useState(!0),[s,i]=u.useState(null),l=`${e}/api/v1`,c=u.useCallback(async()=>{o(!0),i(null);try{const d=await ze(`${l}/agentCards`,{credentials:"include"});if(!d.ok){const m=await d.json().catch(()=>({message:`Failed to fetch agents: ${d.statusText}`}));throw new Error(m.message||`Failed to fetch agents: ${d.statusText}`)}const p=(await d.json()).map(mw);n(p)}catch(d){console.error("Error fetching agents:",d),i(d instanceof Error?d.message:"Could not load agent information."),n([])}finally{o(!1)}},[l]);return u.useEffect(()=>{c()},[c]),{agents:t,isLoading:r,error:s,refetch:c}},gw=e=>{const{configServerUrl:t}=tn(),[n,r]=u.useState([]),[o,s]=u.useState(!0),[i,l]=u.useState(null),c=`${t}/api/v1`,d=u.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0),l(null);try{const f=await ze(`${c}/artifacts/${e}`,{credentials:"include"});if(!f.ok){const m=await f.json().catch(()=>({message:`Failed to fetch artifacts. ${f.statusText}`}));throw new Error(m.message||`Failed to fetch artifacts. ${f.statusText}`)}const p=await f.json();r(p)}catch(f){const p=f instanceof Error?f.message:"Failed to fetch artifacts.";l(p),r([])}finally{s(!1)}},[c,e]);return u.useEffect(()=>{d()},[d]),{artifacts:n,isLoading:o,error:i,refetch:d}},Yu=()=>{const e=u.useContext(Bu);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ue=()=>{const e=u.useContext(Uu);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function xw(){const{messages:e}=Ue(),t=tn(),n=u.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]);u.useEffect(()=>(window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}),[n])}function Ku(){const e=u.useContext(Wu);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}function vw(e,t){const[n,r]=u.useState(e);return u.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}const ww=async(e,t,n)=>{const r=await ze(`${e}/api/v1/artifacts/${t}/${encodeURIComponent(n.filename)}`,{credentials:"include"});if(!r.ok)throw new Error(`Failed to download artifact: ${n.filename}. Status: ${r.status}`);const o=await r.blob();dc(o,n.filename)},qu=()=>{const{configServerUrl:e}=tn(),{addNotification:t,sessionId:n}=Ue();return{onDownload:async o=>{if(!n){t("Cannot download artifact: No active session.","error");return}try{await ww(e,n,o),t(`Downloaded artifact: ${o.filename}.`)}catch{t(`Failed to download artifact: ${o.filename}.`,"error")}}}},bw=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=u.useState(!1),s=u.useRef(0),i=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)+1,f.dataTransfer.types.includes("Files")&&o(!0))},[n,s]),l=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.types.includes("Files")&&(f.dataTransfer.dropEffect="copy"))},[n]),c=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)-1,s.current===0&&o(!1))},[n,s]),d=u.useCallback(f=>{if(n||(f.preventDefault(),f.stopPropagation(),o(!1),s.current=0,!f.dataTransfer.files||f.dataTransfer.files.length===0))return;const p=Array.from(f.dataTransfer.files),m=t?p.filter(t):p;m.length!==0&&e(m)},[n,s,t,e]);return{isDragging:r,handleDragEnter:i,handleDragOver:l,handleDragLeave:c,handleDrop:d}},Xu=()=>{const{messages:e,sessionName:t}=Ue();return u.useMemo(()=>{const n=e.find(r=>r.isUser?r.parts.some(o=>o.kind==="text"&&o.text.trim()):!1);if(n){const o=n.parts.filter(s=>s.kind==="text").map(s=>s.text).join(" ").trim();if(o)return o.length>100?`${o.substring(0,100)}...`:o}return"New Chat"},[e,t])},Vi=()=>{const e=u.useContext(Gu);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function Zu(){const e=u.useContext(Vu);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}u.createContext(null);function Ju(e){const t=e+"CollectionProvider",[n,r]=An(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:b}=g,w=zt.useRef(null),y=zt.useRef(new Map).current;return a.jsx(o,{scope:v,itemMap:y,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=Pn(l),d=zt.forwardRef((g,v)=>{const{scope:b,children:w}=g,y=s(l,b),E=$e(v,y.collectionRef);return a.jsx(c,{ref:E,children:w})});d.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Pn(f),h=zt.forwardRef((g,v)=>{const{scope:b,children:w,...y}=g,E=zt.useRef(null),T=$e(v,E),_=s(f,b);return zt.useEffect(()=>(_.itemMap.set(E,{ref:E,...y}),()=>void _.itemMap.delete(E))),a.jsx(m,{[p]:"",ref:T,children:w})});h.displayName=f;function x(g){const v=s(e+"CollectionConsumer",g);return zt.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const y=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((_,I)=>y.indexOf(_.ref.current)-y.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:h},x,r]}var yw=u.createContext(void 0);function Yi(e){const t=u.useContext(yw);return e||t||"ltr"}const Ki=u.forwardRef(({actions:e,className:t,...n},r)=>{const o=(i,l)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),l.onClick())},s=(i,l)=>{var d,f,p,m,h;const c=(d=i.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="menuitem"]');if(c)switch(i.key){case"ArrowDown":{i.preventDefault();const x=(l+1)%c.length;(f=c[x])==null||f.focus();break}case"ArrowUp":{i.preventDefault();const x=(l-1+c.length)%c.length;(p=c[x])==null||p.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 a.jsx("div",{ref:r,role:"menu",className:Ce("min-w-[8rem] overflow-hidden",t),...n,children:e.map((i,l)=>a.jsxs(u.Fragment,{children:[i.divider&&l>0&&a.jsx("div",{className:"my-1 h-px bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]"}),a.jsxs("div",{role:"menuitem",tabIndex:0,className:Ce("relative flex cursor-pointer items-center gap-2 px-3 py-1.5 my-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),s(c,l)},children:[i.icon&&i.iconPosition!=="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon}),a.jsx("span",{className:"flex-1",children:i.label}),i.icon&&i.iconPosition==="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon})]})]},i.id))})});Ki.displayName="Menu";var ts="Popover",[Qu,o1]=An(ts,[xr]),Yr=xr(),[Sw,Nn]=Qu(ts),ed=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,l=Yr(t),c=u.useRef(null),[d,f]=u.useState(!1),[p,m]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:ts});return a.jsx(Ii,{...l,children:a.jsx(Sw,{scope:t,contentId:Xt(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(h=>!h),[m]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>f(!0),[]),onCustomAnchorRemove:u.useCallback(()=>f(!1),[]),modal:i,children:n})})};ed.displayName=ts;var td="PopoverAnchor",Cw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(td,n),s=Yr(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return u.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(Fo,{...s,...r,ref:t})});Cw.displayName=td;var nd="PopoverTrigger",rd=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(nd,n),s=Yr(n),i=$e(t,o.triggerRef),l=a.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ld(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:a.jsx(Fo,{asChild:!0,...s,children:l})});rd.displayName=nd;var qi="PopoverPortal",[Ew,Tw]=Qu(qi,{forceMount:void 0}),od=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=Nn(qi,t);return a.jsx(Ew,{scope:t,forceMount:n,children:a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:r})})})};od.displayName=qi;var lr="PopoverContent",sd=u.forwardRef((e,t)=>{const n=Tw(lr,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=Nn(lr,e.__scopePopover);return a.jsx(mn,{present:r||s.open,children:s.modal?a.jsx(Nw,{...o,ref:t}):a.jsx(kw,{...o,ref:t})})});sd.displayName=lr;var Aw=Pn("PopoverContent.RemoveScroll"),Nw=u.forwardRef((e,t)=>{const n=Nn(lr,e.__scopePopover),r=u.useRef(null),o=$e(t,r),s=u.useRef(!1);return u.useEffect(()=>{const i=r.current;if(i)return zi(i)},[]),a.jsx(Ho,{as:Aw,allowPinchZoom:!0,children:a.jsx(id,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),kw=u.forwardRef((e,t)=>{const n=Nn(lr,e.__scopePopover),r=u.useRef(!1),o=u.useRef(!1);return a.jsx(id,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),id=u.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...p}=e,m=Nn(lr,n),h=Yr(n);return Fi(),a.jsx(Bo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:a.jsx(ji,{"data-state":ld(m.open),role:"dialog",id:m.contentId,...h,...p,ref:t,style:{...p.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)"}})})})}),ad="PopoverClose",_w=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(ad,n);return a.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});_w.displayName=ad;var Iw="PopoverArrow",jw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Yr(n);return a.jsx(Mi,{...o,...r,ref:t})});jw.displayName=Iw;function ld(e){return e?"open":"closed"}var Mw=ed,Rw=rd,Pw=od,Lw=sd;function cd({...e}){return a.jsx(Mw,{"data-slot":"popover",...e})}function ud({...e}){return a.jsx(Rw,{"data-slot":"popover-trigger",...e})}function dd({className:e,align:t="center",sideOffset:n=4,...r}){return a.jsx(Pw,{children:a.jsx(Lw,{"data-slot":"popover-content",align:t,sideOffset:n,className:Ce("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 w-auto origin-(--radix-popover-content-transform-origin) bg-background rounded-sm border px-0 py-1 shadow-sm outline-hidden",e),...r})})}function Dw({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:s,className:i,closeOnClickOutside:l=!0,closeOnEscape:c=!0,portal:d=!0,animationDuration:f=150,fallbackPlacements:p}){const m=u.useRef(null),[h,x]=u.useState({}),[g,v]=u.useState(!1);ow({ref:m,anchorRef:n,onClickOutside:t,enabled:e&&l}),sw({onEscape:t,enabled:e&&c});const{getPositionStyle:b}=lw({anchorRef:n,placement:o,offset:s,fallbackPlacements:p});if(u.useEffect(()=>{e&&m.current?(v(!1),requestAnimationFrame(()=>{if(m.current){const y=b(m.current);x(y),v(!0)}})):v(!1)},[e,b]),!e)return null;const w=a.jsx("div",{ref:m,role:"dialog","aria-modal":"false",className:Ce("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 ${f}ms ease-in-out, transform ${f}ms ease-in-out`,pointerEvents:e&&g?"auto":"none",visibility:g?"visible":"hidden"},children:r});return d?Ur.createPortal(w,document.body):w}function sl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ow(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Fw=[" ","Enter","ArrowUp","ArrowDown"],zw=[" ","Enter"],zn="Select",[ns,rs,$w]=Ju(zn),[vr,s1]=An(zn,[$w,xr]),os=xr(),[Bw,kn]=vr(zn),[Uw,Hw]=vr(zn),fd=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:x}=e,g=os(t),[v,b]=u.useState(null),[w,y]=u.useState(null),[E,T]=u.useState(!1),_=Yi(d),[I,A]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:zn}),[q,K]=Dn({prop:i,defaultProp:l,onChange:c,caller:zn}),U=u.useRef(null),Y=v?x||!!v.closest("form"):!0,[J,O]=u.useState(new Set),X=Array.from(J).map(N=>N.props.value).join(";");return a.jsx(Ii,{...g,children:a.jsxs(Bw,{required:h,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:y,valueNodeHasChildren:E,onValueNodeHasChildrenChange:T,contentId:Xt(),value:q,onValueChange:K,open:I,onOpenChange:A,dir:_,triggerPointerDownPosRef:U,disabled:m,children:[a.jsx(ns.Provider,{scope:t,children:a.jsx(Uw,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(N=>{O(R=>new Set(R).add(N))},[]),onNativeOptionRemove:u.useCallback(N=>{O(R=>{const S=new Set(R);return S.delete(N),S})},[]),children:n})}),Y?a.jsxs(Pd,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:q,onChange:N=>K(N.target.value),disabled:m,form:x,children:[q===void 0?a.jsx("option",{value:""}):null,Array.from(J)]},X):null]})})};fd.displayName=zn;var pd="SelectTrigger",md=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=os(n),i=kn(pd,n),l=i.disabled||r,c=$e(t,i.onTriggerChange),d=rs(n),f=u.useRef("touch"),[p,m,h]=Dd(g=>{const v=d().filter(y=>!y.disabled),b=v.find(y=>y.value===i.value),w=Od(v,g,b);w!==void 0&&i.onValueChange(w.value)}),x=g=>{l||(i.onOpenChange(!0),h()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return a.jsx(Fo,{asChild:!0,...s,children:a.jsx(ke.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":Ld(i.value)?"":void 0,...o,ref:c,onClick:ve(o.onClick,g=>{g.currentTarget.focus(),f.current!=="mouse"&&x(g)}),onPointerDown:ve(o.onPointerDown,g=>{f.current=g.pointerType;const v=g.target;v.hasPointerCapture(g.pointerId)&&v.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(x(g),g.preventDefault())}),onKeyDown:ve(o.onKeyDown,g=>{const v=p.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(v&&g.key===" ")&&Fw.includes(g.key)&&(x(),g.preventDefault())})})})});md.displayName=pd;var hd="SelectValue",gd=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=kn(hd,n),{onValueNodeHasChildrenChange:d}=c,f=s!==void 0,p=$e(t,c.onValueNodeChange);return nt(()=>{d(f)},[d,f]),a.jsx(ke.span,{...l,ref:p,style:{pointerEvents:"none"},children:Ld(c.value)?a.jsx(a.Fragment,{children:i}):s})});gd.displayName=hd;var Ww="SelectIcon",xd=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});xd.displayName=Ww;var Gw="SelectPortal",vd=e=>a.jsx(Gr,{asChild:!0,...e});vd.displayName=Gw;var $n="SelectContent",wd=u.forwardRef((e,t)=>{const n=kn($n,e.__scopeSelect),[r,o]=u.useState();if(nt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ur.createPortal(a.jsx(bd,{scope:e.__scopeSelect,children:a.jsx(ns.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(yd,{...e,ref:t})});wd.displayName=$n;var Ot=10,[bd,_n]=vr($n),Vw="SelectContentImpl",Yw=Pn("SelectContent.RemoveScroll"),yd=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:v,...b}=e,w=kn($n,n),[y,E]=u.useState(null),[T,_]=u.useState(null),I=$e(t,k=>E(k)),[A,q]=u.useState(null),[K,U]=u.useState(null),Y=rs(n),[J,O]=u.useState(!1),X=u.useRef(!1);u.useEffect(()=>{if(y)return zi(y)},[y]),Fi();const N=u.useCallback(k=>{const[G,...Q]=Y().map(se=>se.ref.current),[te]=Q.slice(-1),oe=document.activeElement;for(const se of k)if(se===oe||(se==null||se.scrollIntoView({block:"nearest"}),se===G&&T&&(T.scrollTop=0),se===te&&T&&(T.scrollTop=T.scrollHeight),se==null||se.focus(),document.activeElement!==oe))return},[Y,T]),R=u.useCallback(()=>N([A,y]),[N,A,y]);u.useEffect(()=>{J&&R()},[J,R]);const{onOpenChange:S,triggerPointerDownPosRef:F}=w;u.useEffect(()=>{if(y){let k={x:0,y:0};const G=te=>{var oe,se;k={x:Math.abs(Math.round(te.pageX)-(((oe=F.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(te.pageY)-(((se=F.current)==null?void 0:se.y)??0))}},Q=te=>{k.x<=10&&k.y<=10?te.preventDefault():y.contains(te.target)||S(!1),document.removeEventListener("pointermove",G),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",Q,{capture:!0})}}},[y,S,F]),u.useEffect(()=>{const k=()=>S(!1);return window.addEventListener("blur",k),window.addEventListener("resize",k),()=>{window.removeEventListener("blur",k),window.removeEventListener("resize",k)}},[S]);const[M,P]=Dd(k=>{const G=Y().filter(oe=>!oe.disabled),Q=G.find(oe=>oe.ref.current===document.activeElement),te=Od(G,k,Q);te&&setTimeout(()=>te.ref.current.focus())}),ee=u.useCallback((k,G,Q)=>{const te=!X.current&&!Q;(w.value!==void 0&&w.value===G||te)&&(q(k),te&&(X.current=!0))},[w.value]),D=u.useCallback(()=>y==null?void 0:y.focus(),[y]),$=u.useCallback((k,G,Q)=>{const te=!X.current&&!Q;(w.value!==void 0&&w.value===G||te)&&U(k)},[w.value]),L=r==="popper"?Ks:Sd,W=L===Ks?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:v}:{};return a.jsx(bd,{scope:n,content:y,viewport:T,onViewportChange:_,itemRefCallback:ee,selectedItem:A,onItemLeave:D,itemTextRefCallback:$,focusSelectedItem:R,selectedItemText:K,position:r,isPositioned:J,searchRef:M,children:a.jsx(Ho,{as:Yw,allowPinchZoom:!0,children:a.jsx(Bo,{asChild:!0,trapped:w.open,onMountAutoFocus:k=>{k.preventDefault()},onUnmountAutoFocus:ve(o,k=>{var G;(G=w.trigger)==null||G.focus({preventScroll:!0}),k.preventDefault()}),children:a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:k=>k.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:a.jsx(L,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:k=>k.preventDefault(),...b,...W,onPlaced:()=>O(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,k=>{const G=k.ctrlKey||k.altKey||k.metaKey;if(k.key==="Tab"&&k.preventDefault(),!G&&k.key.length===1&&P(k.key),["ArrowUp","ArrowDown","Home","End"].includes(k.key)){let te=Y().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(k.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(k.key)){const oe=k.target,se=te.indexOf(oe);te=te.slice(se+1)}setTimeout(()=>N(te)),k.preventDefault()}})})})})})})});yd.displayName=Vw;var Kw="SelectItemAlignedPosition",Sd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=kn($n,n),i=_n($n,n),[l,c]=u.useState(null),[d,f]=u.useState(null),p=$e(t,I=>f(I)),m=rs(n),h=u.useRef(!1),x=u.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,y=u.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&g&&v&&b){const I=s.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),q=s.valueNode.getBoundingClientRect(),K=b.getBoundingClientRect();if(s.dir!=="rtl"){const oe=K.left-A.left,se=q.left-oe,de=I.left-se,me=I.width+de,Me=Math.max(me,A.width),Oe=window.innerWidth-Ot,Le=sl(se,[Ot,Math.max(Ot,Oe-Me)]);l.style.minWidth=me+"px",l.style.left=Le+"px"}else{const oe=A.right-K.right,se=window.innerWidth-q.right-oe,de=window.innerWidth-I.right-se,me=I.width+de,Me=Math.max(me,A.width),Oe=window.innerWidth-Ot,Le=sl(se,[Ot,Math.max(Ot,Oe-Me)]);l.style.minWidth=me+"px",l.style.right=Le+"px"}const U=m(),Y=window.innerHeight-Ot*2,J=g.scrollHeight,O=window.getComputedStyle(d),X=parseInt(O.borderTopWidth,10),N=parseInt(O.paddingTop,10),R=parseInt(O.borderBottomWidth,10),S=parseInt(O.paddingBottom,10),F=X+N+J+S+R,M=Math.min(v.offsetHeight*5,F),P=window.getComputedStyle(g),ee=parseInt(P.paddingTop,10),D=parseInt(P.paddingBottom,10),$=I.top+I.height/2-Ot,L=Y-$,W=v.offsetHeight/2,k=v.offsetTop+W,G=X+N+k,Q=F-G;if(G<=$){const oe=U.length>0&&v===U[U.length-1].ref.current;l.style.bottom="0px";const se=d.clientHeight-g.offsetTop-g.offsetHeight,de=Math.max(L,W+(oe?D:0)+se+R),me=G+de;l.style.height=me+"px"}else{const oe=U.length>0&&v===U[0].ref.current;l.style.top="0px";const de=Math.max($,X+g.offsetTop+(oe?ee:0)+W)+Q;l.style.height=de+"px",g.scrollTop=G-$+g.offsetTop}l.style.margin=`${Ot}px 0`,l.style.minHeight=M+"px",l.style.maxHeight=Y+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,d,g,v,b,s.dir,r]);nt(()=>y(),[y]);const[E,T]=u.useState();nt(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);const _=u.useCallback(I=>{I&&x.current===!0&&(y(),w==null||w(),x.current=!1)},[y,w]);return a.jsx(Xw,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:_,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:a.jsx(ke.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Sd.displayName=Kw;var qw="SelectPopperPosition",Ks=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ot,...s}=e,i=os(n);return a.jsx(ji,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Ks.displayName=qw;var[Xw,Xi]=vr($n,{}),qs="SelectViewport",Cd=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=_n(qs,n),i=Xi(qs,n),l=$e(t,s.onViewportChange),c=u.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(ns.Slot,{scope:n,children:a.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,d=>{const f=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const h=Math.abs(c.current-f.scrollTop);if(h>0){const x=window.innerHeight-Ot*2,g=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(g,v);if(b<x){const w=b+h,y=Math.min(x,w),E=w-y;p.style.height=y+"px",p.style.bottom==="0px"&&(f.scrollTop=E>0?E:0,p.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Cd.displayName=qs;var Ed="SelectGroup",[Zw,Jw]=vr(Ed),Qw=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Xt();return a.jsx(Zw,{scope:n,id:o,children:a.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Qw.displayName=Ed;var Td="SelectLabel",e0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Jw(Td,n);return a.jsx(ke.div,{id:o.id,...r,ref:t})});e0.displayName=Td;var Ao="SelectItem",[t0,Ad]=vr(Ao),Nd=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=kn(Ao,n),c=_n(Ao,n),d=l.value===r,[f,p]=u.useState(s??""),[m,h]=u.useState(!1),x=$e(t,w=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,w,r,o)}),g=Xt(),v=u.useRef("touch"),b=()=>{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 a.jsx(t0,{scope:n,value:r,disabled:o,textId:g,isSelected:d,onItemTextChange:u.useCallback(w=>{p(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:a.jsx(ns.ItemSlot,{scope:n,value:r,disabled:o,textValue:f,children:a.jsx(ke.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:x,onFocus:ve(i.onFocus,()=>h(!0)),onBlur:ve(i.onBlur,()=>h(!1)),onClick:ve(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:ve(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:ve(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:ve(i.onPointerMove,w=>{var y;v.current=w.pointerType,o?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:ve(i.onKeyDown,w=>{var E;((E=c.searchRef)==null?void 0:E.current)!==""&&w.key===" "||(zw.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Nd.displayName=Ao;var jr="SelectItemText",kd=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=kn(jr,n),l=_n(jr,n),c=Ad(jr,n),d=Hw(jr,n),[f,p]=u.useState(null),m=$e(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),h=f==null?void 0:f.textContent,x=u.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=d;return nt(()=>(g(x),()=>v(x)),[g,v,x]),a.jsxs(a.Fragment,{children:[a.jsx(ke.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ur.createPortal(s.children,i.valueNode):null]})});kd.displayName=jr;var _d="SelectItemIndicator",Id=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ad(_d,n).isSelected?a.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});Id.displayName=_d;var Xs="SelectScrollUpButton",jd=u.forwardRef((e,t)=>{const n=_n(Xs,e.__scopeSelect),r=Xi(Xs,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return nt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});jd.displayName=Xs;var Zs="SelectScrollDownButton",Md=u.forwardRef((e,t)=>{const n=_n(Zs,e.__scopeSelect),r=Xi(Zs,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return nt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Md.displayName=Zs;var Rd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=_n("SelectScrollButton",n),i=u.useRef(null),l=rs(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),nt(()=>{var f;const d=l().find(p=>p.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),a.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ve(o.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{c()})})}),n0="SelectSeparator",r0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});r0.displayName=n0;var Js="SelectArrow",o0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=os(n),s=kn(Js,n),i=_n(Js,n);return s.open&&i.position==="popper"?a.jsx(Mi,{...o,...r,ref:t}):null});o0.displayName=Js;var s0="SelectBubbleInput",Pd=u.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=u.useRef(null),s=$e(r,o),i=Ow(t);return u.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const p=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(p)}},[i,t]),a.jsx(ke.select,{...n,style:{...Dc,...n.style},ref:s,defaultValue:t})});Pd.displayName=s0;function Ld(e){return e===""||e===void 0}function Dd(e){const t=yn(e),n=u.useRef(""),r=u.useRef(0),o=u.useCallback(i=>{const l=n.current+i;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=u.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Od(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=i0(e,Math.max(s,0));o.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function i0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a0=fd,l0=md,c0=gd,u0=xd,d0=vd,f0=wd,p0=Cd,m0=Nd,h0=kd,g0=Id,x0=jd,v0=Md;function Fd({...e}){return a.jsx(a0,{"data-slot":"select",...e})}function zd({...e}){return a.jsx(c0,{"data-slot":"select-value",...e})}function $d({className:e,size:t="default",children:n,...r}){return a.jsxs(l0,{"data-slot":"select-trigger","data-size":t,className:Ce("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,a.jsx(u0,{asChild:!0,children:a.jsx($l,{className:"size-4 opacity-50"})})]})}function Bd({className:e,children:t,position:n="popper",...r}){return a.jsx(d0,{children:a.jsxs(f0,{"data-slot":"select-content",className:Ce("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:[a.jsx(w0,{}),a.jsx(p0,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(b0,{})]})})}function Ud({className:e,children:t,...n}){return a.jsxs(m0,{"data-slot":"select-item",className:Ce("[&_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 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 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)]",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(g0,{children:a.jsx(mi,{className:"size-4"})})}),a.jsx(h0,{children:t})]})}function w0({className:e,...t}){return a.jsx(x0,{"data-slot":"select-scroll-up-button",className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(jp,{className:"size-4"})})}function b0({className:e,...t}){return a.jsx(v0,{"data-slot":"select-scroll-down-button",className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx($l,{className:"size-4"})})}var Ns="rovingFocusGroup.onEntryFocus",y0={bubbles:!1,cancelable:!0},Kr="RovingFocusGroup",[Qs,Hd,S0]=Ju(Kr),[C0,Wd]=An(Kr,[S0]),[E0,T0]=C0(Kr),Gd=u.forwardRef((e,t)=>a.jsx(Qs.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Qs.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(A0,{...e,ref:t})})}));Gd.displayName=Kr;var A0=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,m=u.useRef(null),h=$e(t,m),x=Yi(s),[g,v]=Dn({prop:i,defaultProp:l??null,onChange:c,caller:Kr}),[b,w]=u.useState(!1),y=yn(d),E=Hd(n),T=u.useRef(!1),[_,I]=u.useState(0);return u.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(Ns,y),()=>A.removeEventListener(Ns,y)},[y]),a.jsx(E0,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:g,onItemFocus:u.useCallback(A=>v(A),[v]),onItemShiftTab:u.useCallback(()=>w(!0),[]),onFocusableItemAdd:u.useCallback(()=>I(A=>A+1),[]),onFocusableItemRemove:u.useCallback(()=>I(A=>A-1),[]),children:a.jsx(ke.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{T.current=!0}),onFocus:ve(e.onFocus,A=>{const q=!T.current;if(A.target===A.currentTarget&&q&&!b){const K=new CustomEvent(Ns,y0);if(A.currentTarget.dispatchEvent(K),!K.defaultPrevented){const U=E().filter(N=>N.focusable),Y=U.find(N=>N.active),J=U.find(N=>N.id===g),X=[Y,J,...U].filter(Boolean).map(N=>N.ref.current);Kd(X,f)}}T.current=!1}),onBlur:ve(e.onBlur,()=>w(!1))})})}),Vd="RovingFocusGroupItem",Yd=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Xt(),d=s||c,f=T0(Vd,n),p=f.currentTabStopId===d,m=Hd(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:g}=f;return u.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),a.jsx(Qs.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:a.jsx(ke.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:ve(e.onMouseDown,v=>{r?f.onItemFocus(d):v.preventDefault()}),onFocus:ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ve(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=_0(v,f.orientation,f.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=m().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")y.reverse();else if(b==="prev"||b==="next"){b==="prev"&&y.reverse();const E=y.indexOf(v.currentTarget);y=f.loop?I0(y,E+1):y.slice(E+1)}setTimeout(()=>Kd(y))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:g!=null}):i})})});Yd.displayName=Vd;var N0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function k0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _0(e,t,n){const r=k0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return N0[r]}function Kd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var j0=Gd,M0=Yd,ss="Tabs",[R0,i1]=An(ss,[Wd]),qd=Wd(),[P0,Zi]=R0(ss),Xd=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=Yi(l),[p,m]=Dn({prop:r,onChange:o,defaultProp:s??"",caller:ss});return a.jsx(P0,{scope:n,baseId:Xt(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(ke.div,{dir:f,"data-orientation":i,...d,ref:t})})});Xd.displayName=ss;var Zd="TabsList",Jd=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Zi(Zd,n),i=qd(n);return a.jsx(j0,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(ke.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Jd.displayName=Zd;var Qd="TabsTrigger",ef=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Zi(Qd,n),l=qd(n),c=rf(i.baseId,r),d=of(i.baseId,r),f=r===i.value;return a.jsx(M0,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(ke.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ve(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:ve(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});ef.displayName=Qd;var tf="TabsContent",nf=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=Zi(tf,n),c=rf(l.baseId,r),d=of(l.baseId,r),f=r===l.value,p=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(mn,{present:o||f,children:({present:m})=>a.jsx(ke.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});nf.displayName=tf;function rf(e,t){return`${e}-trigger-${t}`}function of(e,t){return`${e}-content-${t}`}var L0=Xd,D0=Jd,O0=ef,F0=nf;function z0({className:e,...t}){return a.jsx(L0,{"data-slot":"tabs",className:Ce("flex flex-col gap-2",e),...t})}function $0({className:e,...t}){return a.jsx(D0,{"data-slot":"tabs-list",className:Ce("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function il({className:e,...t}){return a.jsx(O0,{"data-slot":"tabs-trigger","data-testid":t.value,"aria-label":t.value,title:t.title,className:Ce("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 al({className:e,...t}){return a.jsx(F0,{"data-slot":"tabs-content",className:Ce("flex-1 outline-none",e),...t})}const sf=u.forwardRef(({className:e,...t},n)=>a.jsx(qc,{autoComplete:"off",ref:n,name:"message","data-testid":"chat-input",className:Ce("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}));sf.displayName="ChatInput";const B0=Tn("flex gap-2 max-w-[90%] 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"}}),af=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:Ce(B0({variant:t,layout:n,className:e}),"group relative"),ref:s,...o,children:u.Children.map(r,i=>u.isValidElement(i)&&typeof i.type!="string"?u.cloneElement(i,{variant:t,layout:n}):i)}));af.displayName="ChatBubble";const U0=Tn("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"}}),lf=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:Ce(U0({variant:t,layout:n,className:e}),"relative max-w-full break-words whitespace-pre-wrap"),ref:s,...o,children:a.jsx(a.Fragment,{children:r})}));lf.displayName="ChatBubbleMessage";const H0=u.forwardRef(({variant:e,className:t,children:n,...r},o)=>a.jsx("div",{ref:o,className:Ce("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}));H0.displayName="ChatBubbleActionWrapper";const cf={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},uf=zt.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:s,disableAutoScroll:i,scrollToBottom:l,userHasScrolled:c}=eb({smooth:!0,content:t});return u.useImperativeHandle(r,()=>({scrollToBottom:l})),a.jsxs("div",{className:`fade-both-mask min-h-0 flex-1 py-3 relative h-full w-full ${e}`,children:[a.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:a.jsx("div",{className:"flex flex-col gap-6",style:cf,children:t})}),!s&&c&&a.jsx(Ae,{onClick:()=>{l()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 z-20 inline-flex -translate-x-1/2 transform rounded-full shadow-md bg-background","aria-label":"Scroll to bottom",children:a.jsx(Bl,{className:"h-4 w-4"})})]})});uf.displayName="ChatMessageList";const W0=Tn("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),G0=Tn("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 V0({size:e,show:t,children:n,className:r,variant:o}){return a.jsxs("span",{className:W0({show:t}),children:[a.jsx(hi,{className:Ce(G0({size:e,variant:o}),r)}),n]})}function Y0({className:e=""}){return a.jsx(V0,{size:"small",variant:"primary",className:e})}const io={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)]"},K0=Tn("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:io.error,warning:io.warning,info:io.info,success:io.success}},defaultVariants:{variant:"default"}});function df({className:e,variant:t,type:n,asChild:r=!1,...o}){const s=r?Ql:"span";return a.jsx(s,{"data-slot":"badge",className:Ce(K0({variant:t,type:n}),e),...o})}const q0=Tn("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 X0({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:Ce(q0({variant:t}),e),...n})}function Z0({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:Ce("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function J0({message:e,type:t}){return a.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:a.jsx(X0,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:a.jsxs(Z0,{className:"flex items-center text-sm",children:[t==="error"&&a.jsx(gi,{className:"mr-2 text-[var(--color-error-wMain)]"}),a.jsx("div",{className:"truncate",children:e})]})})})}function Q0(){const{notifications:e}=Ue();return e.length===0?null:a.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=>a.jsx("div",{className:"pointer-events-auto",children:a.jsx(J0,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function eb(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,s=u.useRef(null),i=u.useRef(0),l=u.useRef(!1),[c,d]=u.useState({isAtBottom:!0,autoScrollEnabled:!0}),f=u.useCallback(x=>{const{scrollTop:g,scrollHeight:v,clientHeight:b}=x;return Math.abs(v-g-b)<=t},[t]),p=u.useCallback(x=>{if(!s.current)return;const g=s.current.scrollHeight-s.current.clientHeight;x?s.current.scrollTop=g:s.current.scrollTo({top:g,behavior:n?"smooth":"auto"}),d({isAtBottom:!0,autoScrollEnabled:!0}),l.current=!1},[n]),m=u.useCallback(()=>{if(!s.current)return;const x=f(s.current);d(g=>({isAtBottom:x,autoScrollEnabled:x?!0:g.autoScrollEnabled}))},[f]);u.useEffect(()=>{const x=s.current;if(x)return x.addEventListener("scroll",m,{passive:!0}),()=>x.removeEventListener("scroll",m)},[m]),u.useEffect(()=>{const x=s.current;if(!x)return;const g=x.scrollHeight;g!==i.current&&((c.autoScrollEnabled||o)&&requestAnimationFrame(()=>{p(i.current===0)}),i.current=g)},[r,c.autoScrollEnabled,p,o]),u.useEffect(()=>{const x=s.current;if(!x)return;const g=new ResizeObserver(()=>{c.autoScrollEnabled&&p(!0)});return g.observe(x),()=>g.disconnect()},[c.autoScrollEnabled,p]);const h=u.useCallback(()=>{(s.current?f(s.current):!1)||(l.current=!0,d(g=>({...g,autoScrollEnabled:!1})))},[f]);return{scrollRef:s,isAtBottom:c.isAtBottom,autoScrollEnabled:c.autoScrollEnabled,scrollToBottom:()=>p(),disableAutoScroll:h,userHasScrolled:l.current}}const tb=({fileName:e,onRemove:t})=>a.jsxs(df,{className:"max-w-50 gap-1.5 rounded-full bg-muted pr-1",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs md:text-sm",title:e,children:e}),t&&a.jsx(Ae,{variant:"ghost",size:"icon",onClick:t,className:"h-2 min-h-0 w-2 min-w-0 p-2",title:"Remove file",children:a.jsx(Ro,{})})]}),nb=({agents:e=[],scrollToBottom:t})=>{const{isResponding:n,isCancelling:r,userInput:o,selectedAgentName:s,setSelectedAgentName:i,setUserInput:l,handleSubmit:c,handleCancel:d}=Ue(),f=u.useRef(null),[p,m]=u.useState([]),h=u.useRef(null),x=u.useRef(n),[g,v]=u.useState(o),b=vw(g,300);u.useEffect(()=>{l(b)},[b,l]),u.useEffect(()=>{v(o)},[o]),u.useEffect(()=>{x.current&&!n&&setTimeout(()=>{var O;(O=h.current)==null||O.focus()},100),x.current=n},[n]);const w=()=>{var O;n||(O=f.current)==null||O.click()},y=O=>{const X=O.target.files;if(X){const N=Array.from(X).filter(R=>!p.some(S=>S.name===R.name&&S.size===R.size&&S.lastModified===R.lastModified));N.length>0&&m(R=>[...R,...N])}O.target&&(O.target.value=""),setTimeout(()=>{var N;(N=h.current)==null||N.focus()},100)},E=O=>{if(n)return;const X=O.clipboardData;if(!X||!X.files||X.files.length===0)return;X.files.length>0&&O.preventDefault();const N=Array.from(X.files).filter(R=>!p.some(S=>S.name===R.name&&S.size===R.size&&S.lastModified===R.lastModified));N.length>0&&m(R=>[...R,...N])},T=O=>{m(X=>X.filter((N,R)=>R!==O))},_=u.useMemo(()=>!n&&((g==null?void 0:g.trim())||p.length!==0),[n,g,p]),I=async O=>{O.preventDefault(),_&&(await c(O,p,g.trim()),m([]),v(""),t==null||t())},A=O=>{if(n)return;const X=O.filter(N=>!p.some(R=>R.name===N.name&&R.size===N.size&&R.lastModified===N.lastModified));X.length>0&&m(N=>[...N,...X])},{isDragging:q,handleDragEnter:K,handleDragOver:U,handleDragLeave:Y,handleDrop:J}=bw({onFilesDropped:A,disabled:n});return a.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${q?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:K,onDragOver:U,onDragLeave:Y,onDrop:J,children:[a.jsx("input",{type:"file",ref:f,className:"hidden",multiple:!0,onChange:y,accept:"*/*",disabled:n}),p.length>0&&a.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:p.map((O,X)=>a.jsx(tb,{fileName:O.name,onRemove:()=>T(X)},`${O.name}-${O.lastModified}-${X}`))}),a.jsx(sf,{ref:h,value:g,onChange:O=>v(O.target.value),placeholder:"How can I help you today?",className:"text-base/normal min-h-0 max-h-50 resize-none border-none p-3 shadow-none rounded-2xl focus-visible:outline-none field-sizing-content transition-[height] duration-500 ease-in-out",rows:1,onPaste:E,onKeyDown:O=>{O.key==="Enter"&&!O.shiftKey&&_&&I(O)}}),a.jsxs("div",{className:"flex items-center gap-2 m-2",children:[a.jsx(Ae,{variant:"ghost",onClick:w,disabled:n,tooltip:"Attach file",children:a.jsx(Ul,{className:"size-4"})}),a.jsx("div",{children:"Agent: "}),a.jsxs(Fd,{value:s,onValueChange:i,disabled:n||e.length===0,children:[a.jsx($d,{className:"w-[250px]",children:a.jsx(zd,{defaultValue:s})}),a.jsx(Bd,{children:e.map(O=>a.jsx(Ud,{value:O.name,children:O.displayName||O.name},O.name))})]}),n&&!r?a.jsxs(Ae,{className:"ml-auto gap-1.5",onClick:d,variant:"outline",disabled:r,tooltip:"Cancel",children:[a.jsx(Mp,{className:"size-4"}),"Stop"]}):a.jsx(Ae,{variant:"ghost",className:"ml-auto gap-1.5",onClick:I,disabled:!_,tooltip:"Send message",children:a.jsx(Rp,{className:"size-4"})})]})]})};function rb(e,t){return t&&t.toLowerCase().startsWith("text/")?!0:e?e.toLowerCase().endsWith(".txt")||e.toLowerCase().endsWith(".text"):!1}function ob(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 sb(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 ib(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 ab(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 lb(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 cb(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 ub(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 db(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 qr(e,t){return ob(e,t)?"html":sb(e,t)?"mermaid":ab(e,t)?"image":ub(e,t)?"markdown":db(e,t)?"audio":lb(e,t)?"json":cb(e,t)?"yaml":ib(e,t)?"csv":rb(e,t)?"text":null}function ff(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 pf=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],fb=["image","audio"],pb=e=>{if(!e||!e.content)return"";const t=qr(e.name,e.mime_type);if(!t||!pf.includes(t))return"";if(fb.includes(t))return e.content;try{return ff(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},mf=5*1024*1024,mb=fc(mf);function hb(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=qr(e.filename,e.mime_type);return!t||!pf.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>mf?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${mb}.`}:{canPreview:!0}}const hf=(e,t="h-4 w-4")=>{if(!e)return a.jsx(da,{className:t});switch(qr(e.filename,e.mime_type)){case"image":case"mermaid":return a.jsx(Fp,{className:t});case"audio":return a.jsx(Op,{className:t});case"html":return a.jsx(Dp,{className:t});case"text":return a.jsx(sr,{className:t});case"csv":return a.jsx(Lp,{className:t});case"json":return a.jsx(Pp,{className:t});default:return a.jsx(da,{className:t})}},gf=({fileAttachment:e,isEmbedded:t=!1})=>a.jsx(xf,{filename:e.name,mimeType:e.mime_type,onDownload:()=>rh(e),className:"ml-4",isEmbedded:t}),xf=({filename:e,mimeType:t,className:n,onDownload:r,isEmbedded:o=!1})=>{const{artifacts:s,setPreviewArtifact:i,openSidePanelTab:l}=Ue(),c=u.useMemo(()=>s.find(f=>f.filename===e),[s,e]),d=u.useMemo(()=>hf(c||{filename:e,mime_type:t||""}),[c,e,t]);return a.jsxs("div",{className:`flex flex-shrink items-center gap-2 rounded-lg bg-[var(--accent-background)] px-2 py-1 h-11 max-w-xs ${n||""}`,children:[d,a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm leading-9",title:e,children:a.jsx("strong",{children:a.jsx("code",{children:e})})}),c&&!o&&a.jsx(Ae,{variant:"ghost",onClick:f=>{f.stopPropagation(),l("files"),i(c)},tooltip:"Preview",children:a.jsx(Hl,{className:"h-4 w-4"})}),r&&a.jsx(Ae,{variant:"ghost",onClick:()=>r(),tooltip:"Download file",children:a.jsx(xi,{className:"h-4 w-4"})})]})},gb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"audio/mpeg"};base64,${e}`;return a.jsx("div",{className:"flex h-auto max-w-[100vw] items-center justify-center p-4",children:a.jsxs("audio",{controls:!0,className:"w-full",onLoad:()=>n(null),onError:()=>n("Failed to load audio content."),children:[a.jsx("source",{src:r,type:t||"audio/mpeg"}),"Your browser does not support the audio element."]})})},xb=e=>{if(!e)return[];const t=[];let n=[],r="",o=!1;for(let s=0;s<e.length;s++){const i=e[s],l=s<e.length-1?e[s+1]:"";i==='"'?l==='"'?(r+='"',s++):o=!o:i===","&&!o?(n.push(r.trim()),r=""):(i===`
|
|
116
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},gv="DialogDescriptionWarning",xv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wu(gv).contentName}}.`;return u.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vv=iu,wv=cu,bv=uu,yv=du,Sv=pu,Cv=hu,Ev=xu;function Go({...e}){return a.jsx(vv,{"data-slot":"dialog",...e})}function Tv({...e}){return a.jsx(wv,{"data-slot":"dialog-portal",...e})}function Av({className:e,...t}){return a.jsx(bv,{"data-slot":"dialog-overlay",className:Ce("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 Vo({className:e,children:t,showCloseButton:n=!0,...r}){return a.jsxs(Tv,{"data-slot":"dialog-portal",children:[a.jsx(Av,{}),a.jsxs(yv,{"data-slot":"dialog-content",className:Ce("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&&a.jsxs(Ev,{"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:[a.jsx(Ro,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Yo({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:Ce("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nv({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-footer",className:Ce("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Ko({className:e,...t}){return a.jsx(Sv,{"data-slot":"dialog-title",className:Ce("text-lg leading-none font-semibold",e),...t})}function qo({className:e,...t}){return a.jsx(Cv,{"data-slot":"dialog-description",className:Ce("py-4 text-sm",e),...t})}const Xo=u.createContext(null);Xo.displayName="PanelGroupContext";const Be={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"},Hi=10,Mn=u.useLayoutEffect,Xa=pi.useId,kv=typeof Xa=="function"?Xa:()=>null;let _v=0;function Wi(e=null){const t=kv(),n=u.useRef(e||t||null);return n.current===null&&(n.current=""+_v++),e??n.current}function bu({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:i,maxSize:l,minSize:c,onCollapse:d,onExpand:f,onResize:p,order:m,style:h,tagName:x="div",...g}){const v=u.useContext(Xo);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:w,getPanelSize:y,getPanelStyle:E,groupId:T,isPanelCollapsed:_,reevaluatePanelConstraints:I,registerPanel:A,resizePanel:q,unregisterPanel:K}=v,U=Wi(i),Y=u.useRef({callbacks:{onCollapse:d,onExpand:f,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:U,idIsFromProps:i!==void 0,order:m});u.useRef({didLogMissingDefaultSizeWarning:!1}),Mn(()=>{const{callbacks:O,constraints:X}=Y.current,N={...X};Y.current.id=U,Y.current.idIsFromProps=i!==void 0,Y.current.order=m,O.onCollapse=d,O.onExpand=f,O.onResize=p,X.collapsedSize=n,X.collapsible=r,X.defaultSize=o,X.maxSize=l,X.minSize=c,(N.collapsedSize!==X.collapsedSize||N.collapsible!==X.collapsible||N.maxSize!==X.maxSize||N.minSize!==X.minSize)&&I(Y.current,N)}),Mn(()=>{const O=Y.current;return A(O),()=>{K(O)}},[m,U,A,K]),u.useImperativeHandle(s,()=>({collapse:()=>{b(Y.current)},expand:O=>{w(Y.current,O)},getId(){return U},getSize(){return y(Y.current)},isCollapsed(){return _(Y.current)},isExpanded(){return!_(Y.current)},resize:O=>{q(Y.current,O)}}),[b,w,y,_,U,q]);const J=E(Y.current,o);return u.createElement(x,{...g,children:e,className:t,id:U,style:{...J,...h},[Be.groupId]:T,[Be.panel]:"",[Be.panelCollapsible]:r||void 0,[Be.panelId]:U,[Be.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const yu=u.forwardRef((e,t)=>u.createElement(bu,{...e,forwardedRef:t}));bu.displayName="Panel";yu.displayName="forwardRef(Panel)";let Ys=null,xo=-1,vn=null;function Iv(e,t,n){const r=(t&Au)!==0,o=(t&Nu)!==0,s=(t&ku)!==0,i=(t&_u)!==0;if(t){if(r)return s?"se-resize":i?"ne-resize":"e-resize";if(o)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function jv(){vn!==null&&(document.head.removeChild(vn),Ys=null,vn=null,xo=-1)}function Ss(e,t,n){var r,o;const s=Iv(e,t);if(Ys!==s){if(Ys=s,vn===null&&(vn=document.createElement("style"),document.head.appendChild(vn)),xo>=0){var i;(i=vn.sheet)===null||i===void 0||i.removeRule(xo)}xo=(r=(o=vn.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function Su(e){return e.type==="keydown"}function Cu(e){return e.type.startsWith("pointer")}function Eu(e){return e.type.startsWith("mouse")}function Zo(e){if(Cu(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Eu(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Mv(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Rv(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 Pv(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Qa(e),b:Qa(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Se(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Ja(Za(n.a)),b:Ja(Za(n.b))};if(o.a===o.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const c=s[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(o.a-o.b)}const Lv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Dv(e){var t;const n=getComputedStyle((t=Tu(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Ov(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Dv(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"||Lv.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Za(e){let t=e.length;for(;t--;){const n=e[t];if(Se(n,"Missing node"),Ov(n))return n}return null}function Ja(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qa(e){const t=[];for(;e;)t.push(e),e=Tu(e);return t}function Tu(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Au=1,Nu=2,ku=4,_u=8,Fv=Mv()==="coarse";let $t=[],rr=!1,wn=new Map,Jo=new Map;const Dr=new Set;function zv(e,t,n,r,o){var s;const{ownerDocument:i}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=wn.get(i))!==null&&s!==void 0?s:0;return wn.set(i,c+1),Dr.add(l),Eo(),function(){var f;Jo.delete(e),Dr.delete(l);const p=(f=wn.get(i))!==null&&f!==void 0?f:1;if(wn.set(i,p-1),Eo(),p===1&&wn.delete(i),$t.includes(l)){const m=$t.indexOf(l);m>=0&&$t.splice(m,1),Qo(),o("up",!0,null)}}}function $v(e){const{target:t}=e,{x:n,y:r}=Zo(e);rr=!0,Gi({target:t,x:n,y:r}),Eo(),$t.length>0&&(To("down",e),Qo(),e.preventDefault(),Iu(t)||e.stopImmediatePropagation())}function Cs(e){const{x:t,y:n}=Zo(e);if(rr&&e.buttons===0&&(rr=!1,To("up",e)),!rr){const{target:r}=e;Gi({target:r,x:t,y:n})}To("move",e),Qo(),$t.length>0&&e.preventDefault()}function Es(e){const{target:t}=e,{x:n,y:r}=Zo(e);Jo.clear(),rr=!1,$t.length>0&&(e.preventDefault(),Iu(t)||e.stopImmediatePropagation()),To("up",e),Gi({target:t,x:n,y:r}),Qo(),Eo()}function Iu(e){let t=e;for(;t;){if(t.hasAttribute(Be.resizeHandle))return!0;t=t.parentElement}return!1}function Gi({target:e,x:t,y:n}){$t.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Dr.forEach(o=>{const{element:s,hitAreaMargins:i}=o,l=s.getBoundingClientRect(),{bottom:c,left:d,right:f,top:p}=l,m=Fv?i.coarse:i.fine;if(t>=d-m&&t<=f+m&&n>=p-m&&n<=c+m){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&Pv(r,s)>0){let x=r,g=!1;for(;x&&!x.contains(s);){if(Rv(x.getBoundingClientRect(),l)){g=!0;break}x=x.parentElement}if(g)return}$t.push(o)}})}function Ts(e,t){Jo.set(e,t)}function Qo(){let e=!1,t=!1;$t.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;Jo.forEach(r=>{n|=r}),e&&t?Ss("intersection",n):e?Ss("horizontal",n):t?Ss("vertical",n):jv()}let As;function Eo(){var e;(e=As)===null||e===void 0||e.abort(),As=new AbortController;const t={capture:!0,signal:As.signal};Dr.size&&(rr?($t.length>0&&wn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",Es,t),o.addEventListener("pointerleave",Cs,t),o.addEventListener("pointermove",Cs,t))}),wn.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",Es,t),o.addEventListener("pointercancel",Es,t)})):wn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",$v,t),o.addEventListener("pointermove",Cs,t))}))}function To(e,t){Dr.forEach(n=>{const{setResizeHandlerState:r}=n,o=$t.includes(n);r(e,o,t)})}function Bv(){const[e,t]=u.useState(0);return u.useCallback(()=>t(n=>n+1),[])}function Se(e,t){if(!e)throw console.error(t),Error(t)}function Fn(e,t,n=Hi){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function cn(e,t,n=Hi){return Fn(e,t,n)===0}function bt(e,t,n){return Fn(e,t,n)===0}function Uv(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],s=t[r];if(!bt(o,s,n))return!1}return!0}function Jn({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Se(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:s,maxSize:i=100,minSize:l=0}=r;if(Fn(n,l)<0)if(s){const c=(o+l)/2;Fn(n,c)<0?n=o:n=l}else n=l;return n=Math.min(i,n),n=parseFloat(n.toFixed(Hi)),n}function _r({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(bt(e,0))return t;const i=[...t],[l,c]=r;Se(l!=null,"Invalid first pivot index"),Se(c!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const p=e<0?c:l,m=n[p];Se(m,`Panel constraints not found for index ${p}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const v=t[p];if(Se(v!=null,`Previous layout not found for panel index ${p}`),bt(v,h)){const b=g-v;Fn(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const p=e<0?l:c,m=n[p];Se(m,`No panel constraints found for index ${p}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const v=t[p];if(Se(v!=null,`Previous layout not found for panel index ${p}`),bt(v,g)){const b=v-h;Fn(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}}{const p=e<0?1:-1;let m=e<0?c:l,h=0;for(;;){const g=t[m];Se(g!=null,`Previous layout not found for panel index ${m}`);const b=Jn({panelConstraints:n,panelIndex:m,size:100})-g;if(h+=b,m+=p,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(d),x=t[m];Se(x!=null,`Previous layout not found for panel index ${m}`);const g=x-h,v=Jn({panelConstraints:n,panelIndex:m,size:g});if(!bt(x,v)&&(d+=x-v,i[m]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Uv(o,i))return o;{const p=e<0?c:l,m=t[p];Se(m!=null,`Previous layout not found for panel index ${p}`);const h=m+d,x=Jn({panelConstraints:n,panelIndex:p,size:h});if(i[p]=x,!bt(x,h)){let g=h-x,b=e<0?c:l;for(;b>=0&&b<n.length;){const w=i[b];Se(w!=null,`Previous layout not found for panel index ${b}`);const y=w+g,E=Jn({panelConstraints:n,panelIndex:b,size:y});if(bt(w,E)||(g-=E-w,i[b]=E),bt(g,0))break;e>0?b--:b++}}}const f=i.reduce((p,m)=>m+p,0);return bt(f,100)?i:o}function Hv({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,i=0;const l=n[0];Se(l!=null,"No pivot index found"),t.forEach((p,m)=>{const{constraints:h}=p,{maxSize:x=100,minSize:g=0}=h;m===l?(r=g,o=x):(s+=g,i+=x)});const c=Math.min(o,100-s),d=Math.max(r,100-i),f=e[l];return{valueMax:c,valueMin:d,valueNow:f}}function Or(e,t=document){return Array.from(t.querySelectorAll(`[${Be.resizeHandleId}][data-panel-group-id="${e}"]`))}function ju(e,t,n=document){const o=Or(e,n).findIndex(s=>s.getAttribute(Be.resizeHandleId)===t);return o??null}function Mu(e,t,n){const r=ju(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function Wv(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Ru(e,t=document){if(Wv(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function es(e,t=document){const n=t.querySelector(`[${Be.resizeHandleId}="${e}"]`);return n||null}function Gv(e,t,n,r=document){var o,s,i,l;const c=es(t,r),d=Or(e,r),f=c?d.indexOf(c):-1,p=(o=(s=n[f])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,m=(i=(l=n[f+1])===null||l===void 0?void 0:l.id)!==null&&i!==void 0?i:null;return[p,m]}function Vv({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:i}){u.useRef({didWarnAboutMissingResizeHandle:!1}),Mn(()=>{if(!s)return;const l=Or(n,s);for(let c=0;c<o.length-1;c++){const{valueMax:d,valueMin:f,valueNow:p}=Hv({layout:r,panelsArray:o,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const h=o[c];Se(h,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",h.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(f)),m.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{l.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),u.useEffect(()=>{if(!s)return;const l=t.current;Se(l,"Eager values not found");const{panelDataArray:c}=l,d=Ru(n,s);Se(d!=null,`No group found for id "${n}"`);const f=Or(n,s);Se(f,`No resize handles found for group id "${n}"`);const p=f.map(m=>{const h=m.getAttribute(Be.resizeHandleId);Se(h,"Resize handle element has no handle id attribute");const[x,g]=Gv(n,h,c,s);if(x==null||g==null)return()=>{};const v=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const w=c.findIndex(y=>y.id===x);if(w>=0){const y=c[w];Se(y,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:T=0,collapsible:_,minSize:I=0}=y.constraints;if(E!=null&&_){const A=_r({delta:bt(E,T)?I-T:T-E,initialLayout:r,panelConstraints:c.map(q=>q.constraints),pivotIndices:Mu(n,h,s),prevLayout:r,trigger:"keyboard"});r!==A&&i(A)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{p.forEach(m=>m())}},[s,e,t,n,r,o,i])}function el(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 Pu(e,t){const n=e==="horizontal",{x:r,y:o}=Zo(t);return n?r:o}function Yv(e,t,n,r,o){const s=n==="horizontal",i=es(t,o);Se(i,`No resize handle element found for id "${t}"`);const l=i.getAttribute(Be.groupId);Se(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const d=Pu(n,e),f=Ru(l,o);Se(f,`No group element found for id "${l}"`);const p=f.getBoundingClientRect(),m=s?p.width:p.height;return(d-c)/m*100}function Kv(e,t,n,r,o,s){if(Su(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:Yv(e,t,n,r,s)}function qv({panelDataArray:e}){const t=Array(e.length),n=e.map(s=>s.constraints);let r=0,o=100;for(let s=0;s<e.length;s++){const i=n[s];Se(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;l!=null&&(r++,t[s]=l,o-=l)}for(let s=0;s<e.length;s++){const i=n[s];Se(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;if(l!=null)continue;const c=e.length-r,d=o/c;r++,t[s]=d,o-=d}return t}function Kn(e,t,n){t.forEach((r,o)=>{const s=e[o];Se(s,`Panel data not found for index ${o}`);const{callbacks:i,constraints:l,id:c}=s,{collapsedSize:d=0,collapsible:f}=l,p=n[c];if(p==null||r!==p){n[c]=r;const{onCollapse:m,onExpand:h,onResize:x}=i;x&&x(r,p),f&&(m||h)&&(h&&(p==null||cn(p,d))&&!cn(r,d)&&h(),m&&(p==null||!cn(p,d))&&cn(r,d)&&m())}})}function so(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 Xv({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:s=3}){const i=n[o];let l;return i==null?l=e!=null?e.toFixed(s):"1":r.length===1?l="1":l=i.toFixed(s),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Zv(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function tl(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 Lu(e){return`react-resizable-panels:${e}`}function Du(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:s}=t;return o?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Ou(e,t){try{const n=Lu(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function Jv(e,t,n){var r,o;const s=(r=Ou(e,n))!==null&&r!==void 0?r:{},i=Du(t);return(o=s[i])!==null&&o!==void 0?o:null}function Qv(e,t,n,r,o){var s;const i=Lu(e),l=Du(t),c=(s=Ou(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(i,JSON.stringify(c))}catch(d){console.error(d)}}function nl({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,i)=>s+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!bt(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=100/r*i;n[s]=l}let o=0;for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=Jn({panelConstraints:t,panelIndex:s,size:i});i!=l&&(o+=i-l,n[s]=l)}if(!bt(o,0))for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=i+o,c=Jn({panelConstraints:t,panelIndex:s,size:l});if(i!==c&&(o-=c-i,n[s]=c,bt(o,0)))break}return n}const ew=100,Ir={getItem:e=>(tl(Ir),Ir.getItem(e)),setItem:(e,t)=>{tl(Ir),Ir.setItem(e,t)}},rl={};function Fu({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:i=null,keyboardResizeBy:l=null,storage:c=Ir,style:d,tagName:f="div",...p}){const m=Wi(s),h=u.useRef(null),[x,g]=u.useState(null),[v,b]=u.useState([]),w=Bv(),y=u.useRef({}),E=u.useRef(new Map),T=u.useRef(0),_=u.useRef({autoSaveId:e,direction:r,dragState:x,id:m,keyboardResizeBy:l,onLayout:i,storage:c}),I=u.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});u.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),u.useImperativeHandle(o,()=>({getId:()=>_.current.id,getLayout:()=>{const{layout:D}=I.current;return D},setLayout:D=>{const{onLayout:$}=_.current,{layout:L,panelDataArray:G}=I.current,k=nl({layout:D,panelConstraints:G.map(V=>V.constraints)});el(L,k)||(b(k),I.current.layout=k,$&&$(k),Kn(G,k,y.current))}}),[]),Mn(()=>{_.current.autoSaveId=e,_.current.direction=r,_.current.dragState=x,_.current.id=m,_.current.onLayout=i,_.current.storage=c}),Vv({committedValuesRef:_,eagerValuesRef:I,groupId:m,layout:v,panelDataArray:I.current.panelDataArray,setLayout:b,panelGroupElement:h.current}),u.useEffect(()=>{const{panelDataArray:D}=I.current;if(e){if(v.length===0||v.length!==D.length)return;let $=rl[e];$==null&&($=Zv(Qv,ew),rl[e]=$);const L=[...D],G=new Map(E.current);$(e,L,G,v,c)}},[e,v,c]),u.useEffect(()=>{});const A=u.useCallback(D=>{const{onLayout:$}=_.current,{layout:L,panelDataArray:G}=I.current;if(D.constraints.collapsible){const k=G.map(oe=>oe.constraints),{collapsedSize:V=0,panelSize:Q,pivotIndices:te}=jn(G,D,L);if(Se(Q!=null,`Panel size not found for panel "${D.id}"`),!cn(Q,V)){E.current.set(D.id,Q);const se=Xn(G,D)===G.length-1?Q-V:V-Q,de=_r({delta:se,initialLayout:L,panelConstraints:k,pivotIndices:te,prevLayout:L,trigger:"imperative-api"});so(L,de)||(b(de),I.current.layout=de,$&&$(de),Kn(G,de,y.current))}}},[]),q=u.useCallback((D,$)=>{const{onLayout:L}=_.current,{layout:G,panelDataArray:k}=I.current;if(D.constraints.collapsible){const V=k.map(me=>me.constraints),{collapsedSize:Q=0,panelSize:te=0,minSize:oe=0,pivotIndices:se}=jn(k,D,G),de=$??oe;if(cn(te,Q)){const me=E.current.get(D.id),Me=me!=null&&me>=de?me:de,Le=Xn(k,D)===k.length-1?te-Me:Me-te,je=_r({delta:Le,initialLayout:G,panelConstraints:V,pivotIndices:se,prevLayout:G,trigger:"imperative-api"});so(G,je)||(b(je),I.current.layout=je,L&&L(je),Kn(k,je,y.current))}}},[]),K=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{panelSize:G}=jn(L,D,$);return Se(G!=null,`Panel size not found for panel "${D.id}"`),G},[]),U=u.useCallback((D,$)=>{const{panelDataArray:L}=I.current,G=Xn(L,D);return Xv({defaultSize:$,dragState:x,layout:v,panelData:L,panelIndex:G})},[x,v]),Y=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{collapsedSize:G=0,collapsible:k,panelSize:V}=jn(L,D,$);return Se(V!=null,`Panel size not found for panel "${D.id}"`),k===!0&&cn(V,G)},[]),J=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{collapsedSize:G=0,collapsible:k,panelSize:V}=jn(L,D,$);return Se(V!=null,`Panel size not found for panel "${D.id}"`),!k||Fn(V,G)>0},[]),O=u.useCallback(D=>{const{panelDataArray:$}=I.current;$.push(D),$.sort((L,G)=>{const k=L.order,V=G.order;return k==null&&V==null?0:k==null?-1:V==null?1:k-V}),I.current.panelDataArrayChanged=!0,w()},[w]);Mn(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:D,onLayout:$,storage:L}=_.current,{layout:G,panelDataArray:k}=I.current;let V=null;if(D){const te=Jv(D,k,L);te&&(E.current=new Map(Object.entries(te.expandToSizes)),V=te.layout)}V==null&&(V=qv({panelDataArray:k}));const Q=nl({layout:V,panelConstraints:k.map(te=>te.constraints)});el(G,Q)||(b(Q),I.current.layout=Q,$&&$(Q),Kn(k,Q,y.current))}}),Mn(()=>{const D=I.current;return()=>{D.layout=[]}},[]);const X=u.useCallback(D=>{let $=!1;const L=h.current;return L&&window.getComputedStyle(L,null).getPropertyValue("direction")==="rtl"&&($=!0),function(k){k.preventDefault();const V=h.current;if(!V)return()=>null;const{direction:Q,dragState:te,id:oe,keyboardResizeBy:se,onLayout:de}=_.current,{layout:me,panelDataArray:Me}=I.current,{initialLayout:Oe}=te??{},Le=Mu(oe,D,V);let je=Kv(k,D,Q,te,se,V);const He=Q==="horizontal";He&&$&&(je=-je);const ot=Me.map(le=>le.constraints),Qe=_r({delta:je,initialLayout:Oe??me,panelConstraints:ot,pivotIndices:Le,prevLayout:me,trigger:Su(k)?"keyboard":"mouse-or-touch"}),et=!so(me,Qe);(Cu(k)||Eu(k))&&T.current!=je&&(T.current=je,!et&&je!==0?He?Ts(D,je<0?Au:Nu):Ts(D,je<0?ku:_u):Ts(D,0)),et&&(b(Qe),I.current.layout=Qe,de&&de(Qe),Kn(Me,Qe,y.current))}},[]),N=u.useCallback((D,$)=>{const{onLayout:L}=_.current,{layout:G,panelDataArray:k}=I.current,V=k.map(me=>me.constraints),{panelSize:Q,pivotIndices:te}=jn(k,D,G);Se(Q!=null,`Panel size not found for panel "${D.id}"`);const se=Xn(k,D)===k.length-1?Q-$:$-Q,de=_r({delta:se,initialLayout:G,panelConstraints:V,pivotIndices:te,prevLayout:G,trigger:"imperative-api"});so(G,de)||(b(de),I.current.layout=de,L&&L(de),Kn(k,de,y.current))},[]),R=u.useCallback((D,$)=>{const{layout:L,panelDataArray:G}=I.current,{collapsedSize:k=0,collapsible:V}=$,{collapsedSize:Q=0,collapsible:te,maxSize:oe=100,minSize:se=0}=D.constraints,{panelSize:de}=jn(G,D,L);de!=null&&(V&&te&&cn(de,k)?cn(k,Q)||N(D,Q):de<se?N(D,se):de>oe&&N(D,oe))},[N]),S=u.useCallback((D,$)=>{const{direction:L}=_.current,{layout:G}=I.current;if(!h.current)return;const k=es(D,h.current);Se(k,`Drag handle element not found for id "${D}"`);const V=Pu(L,$);g({dragHandleId:D,dragHandleRect:k.getBoundingClientRect(),initialCursorPosition:V,initialLayout:G})},[]),F=u.useCallback(()=>{g(null)},[]),M=u.useCallback(D=>{const{panelDataArray:$}=I.current,L=Xn($,D);L>=0&&($.splice(L,1),delete y.current[D.id],I.current.panelDataArrayChanged=!0,w())},[w]),P=u.useMemo(()=>({collapsePanel:A,direction:r,dragState:x,expandPanel:q,getPanelSize:K,getPanelStyle:U,groupId:m,isPanelCollapsed:Y,isPanelExpanded:J,reevaluatePanelConstraints:R,registerPanel:O,registerResizeHandle:X,resizePanel:N,startDragging:S,stopDragging:F,unregisterPanel:M,panelGroupElement:h.current}),[A,x,r,q,K,U,m,Y,J,R,O,X,N,S,F,M]),ee={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return u.createElement(Xo.Provider,{value:P},u.createElement(f,{...p,children:t,className:n,id:s,ref:h,style:{...ee,...d},[Be.group]:"",[Be.groupDirection]:r,[Be.groupId]:m}))}const zu=u.forwardRef((e,t)=>u.createElement(Fu,{...e,forwardedRef:t}));Fu.displayName="PanelGroup";zu.displayName="forwardRef(PanelGroup)";function Xn(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function jn(e,t,n){const r=Xn(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function tw({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){u.useEffect(()=>{if(e||n==null||r==null)return;const o=es(t,r);if(o==null)return;const s=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(Be.groupId);Se(l,`No group element found for id "${l}"`);const c=Or(l,r),d=ju(l,t,r);Se(d!==null,`No resize element found for id "${t}"`);const f=i.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[f].focus();break}}};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}},[r,e,t,n])}function $u({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onClick:i,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:f,style:p={},tabIndex:m=0,tagName:h="div",...x}){var g,v;const b=u.useRef(null),w=u.useRef({onClick:i,onDragging:l,onPointerDown:d,onPointerUp:f});u.useEffect(()=>{w.current.onClick=i,w.current.onDragging=l,w.current.onPointerDown=d,w.current.onPointerUp=f});const y=u.useContext(Xo);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:T,registerResizeHandle:_,startDragging:I,stopDragging:A,panelGroupElement:q}=y,K=Wi(o),[U,Y]=u.useState("inactive"),[J,O]=u.useState(!1),[X,N]=u.useState(null),R=u.useRef({state:U});Mn(()=>{R.current.state=U}),u.useEffect(()=>{if(n)N(null);else{const P=_(K);N(()=>P)}},[n,K,_]);const S=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,F=(v=r==null?void 0:r.fine)!==null&&v!==void 0?v:5;u.useEffect(()=>{if(n||X==null)return;const P=b.current;Se(P,"Element ref not attached");let ee=!1;return zv(K,P,E,{coarse:S,fine:F},($,L,G)=>{if(!L){Y("inactive");return}switch($){case"down":{Y("drag"),ee=!1,Se(G,'Expected event to be defined for "down" action'),I(K,G);const{onDragging:k,onPointerDown:V}=w.current;k==null||k(!0),V==null||V();break}case"move":{const{state:k}=R.current;ee=!0,k!=="drag"&&Y("hover"),Se(G,'Expected event to be defined for "move" action'),X(G);break}case"up":{Y("hover"),A();const{onClick:k,onDragging:V,onPointerUp:Q}=w.current;V==null||V(!1),Q==null||Q(),ee||k==null||k();break}}})},[S,E,n,F,_,K,X,I,A]),tw({disabled:n,handleId:K,resizeHandler:X,panelGroupElement:q});const M={touchAction:"none",userSelect:"none"};return u.createElement(h,{...x,children:e,className:t,id:o,onBlur:()=>{O(!1),s==null||s()},onFocus:()=>{O(!0),c==null||c()},ref:b,role:"separator",style:{...M,...p},tabIndex:m,[Be.groupDirection]:E,[Be.groupId]:T,[Be.resizeHandle]:"",[Be.resizeHandleActive]:U==="drag"?"pointer":J?"keyboard":void 0,[Be.resizeHandleEnabled]:!n,[Be.resizeHandleId]:K,[Be.resizeHandleState]:U})}$u.displayName="PanelResizeHandle";function nw({className:e,...t}){return a.jsx(zu,{"data-slot":"resizable-panel-group",className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ol({...e}){return a.jsx(yu,{"data-slot":"resizable-panel",...e})}function rw({withHandle:e,className:t,...n}){return a.jsx($u,{"data-slot":"resizable-handle",className:Ce("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&&a.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:a.jsx(Ip,{className:"size-2.5"})})})}function ow({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){u.useEffect(()=>{if(!r)return;const o=s=>{const i=s.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 sw({onEscape:e,enabled:t=!0}){u.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const iw={x:0,y:0},kt=16,aw=["top-start","bottom-end","top-end"];function lw({anchorRef:e,placement:t="top-start",offset:n=iw,fallbackPlacements:r=aw}){const o=u.useCallback((c,d,f)=>{let p=0,m=0;switch(f){case"top":p=c.top-d.height-n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"top-start":p=c.top-d.height-n.y,m=c.left+n.x;break;case"top-end":p=c.top-d.height-n.y,m=c.right-d.width-n.x;break;case"bottom":p=c.bottom+n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"bottom-start":p=c.bottom+n.y,m=c.left+n.x;break;case"bottom-end":p=c.bottom+n.y,m=c.right-d.width-n.x;break;case"left":p=c.top+(c.height-d.height)/2+n.y,m=c.left-d.width-n.x;break;case"left-start":p=c.top+n.y,m=c.left-d.width-n.x;break;case"left-end":p=c.bottom-d.height-n.y,m=c.left-d.width-n.x;break;case"right":p=c.top+(c.height-d.height)/2+n.y,m=c.right+n.x;break;case"right-start":p=c.top+n.y,m=c.right+n.x;break;case"right-end":p=c.bottom-d.height-n.y,m=c.right+n.x;break}return console.log(`Calculated position for ${f}:`,{top:p,left:m}),{top:p,left:m,placement:f}},[n.x,n.y]),s=u.useCallback((c,d)=>{const f={width:window.innerWidth,height:window.innerHeight};return c.left<kt||c.top<kt||c.left+d.width>f.width-kt||c.top+d.height>f.height-kt},[]),i=u.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 d=e.current.getBoundingClientRect(),f=c.getBoundingClientRect(),p=o(d,f,t);if(!s(p,f))return p;for(const x of r){const g=o(d,f,x);if(!s(g,f))return g}const m={width:window.innerWidth,height:window.innerHeight},h={...p};return h.left<kt?h.left=kt:h.left+f.width>m.width-kt&&(h.left=m.width-f.width-kt),h.top<kt?h.top=kt:h.top+f.height>m.height-kt&&(h.top=m.height-f.height-kt),h},[e,t,r,o,s]);return{getPositionStyle:u.useCallback(c=>{const d=i(c);return{position:"fixed",top:d.top,left:d.left,zIndex:1e3}},[i]),getOptimalPosition:i}}function cw({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[s,i]=u.useState(e),[l,c]=u.useState(!1),d=u.useRef(0),f=u.useRef(e),p=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.clientX,f.current=s},[s]),m=u.useCallback(b=>{if(!l)return;const w=b.clientX-d.current,y=r==="right"?-w:w,E=Math.min(Math.max(f.current+y,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),h=u.useCallback(()=>{c(!1)},[]),x=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.touches[0].clientX,f.current=s},[s]),g=u.useCallback(b=>{if(!l)return;const w=b.touches[0].clientX-d.current,y=r==="right"?-w:w,E=Math.min(Math.max(f.current+y,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),v=u.useCallback(()=>{c(!1)},[]);return u.useEffect(()=>{if(l)return document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.addEventListener("touchmove",g),document.addEventListener("touchend",v),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",v),document.body.style.userSelect="",document.body.style.cursor=""}},[l,m,h,g,v]),{width:s,isResizing:l,handleMouseDown:p,handleTouchStart:x,setWidth:i}}const uw=u.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:s=!0,className:i,onWidthChange:l,...c},d)=>{const{width:f,isResizing:p,handleMouseDown:m,handleTouchStart:h}=cw({defaultWidth:t,minWidth:n,maxWidth:r,position:o,onWidthChange:l}),x={width:`${f}px`},g=o==="left"?"right-0":"left-0";return a.jsxs("div",{ref:d,className:Ce("relative h-full flex-shrink-0 cursor-pointer",o==="left"?"border-r":"border-l",i),style:x,...c,children:[a.jsx("div",{className:Ce("h-full overflow-x-hidden overflow-y-auto"),children:e}),s&&a.jsx("div",{className:Ce("group absolute top-0 bottom-0 w-2",g,"cursor-col-resize","hover:bg-[var(--color-primary-wMain)]","transition-all duration-200",p&&"bg-[var(--color-primary-wMain)]"),onMouseDown:m,onTouchStart:h,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} panel`,tabIndex:0,onKeyDown:b=>{if(b.key==="ArrowLeft"||b.key==="ArrowRight"){b.preventDefault();const w=b.key==="ArrowRight"?10:-10,y=o==="right"?-w:w,E=Math.min(Math.max(f+y,n),r);l==null||l(E)}},children:a.jsx("div",{className:Ce("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",p&&"bg-[var(--color-primary-wMain)]")})})]})});uw.displayName="SidePanel";const Bu=u.createContext(null),Uu=u.createContext(void 0),Hu=u.createContext(null),Wu=u.createContext(null),Gu=u.createContext(void 0),Vu=u.createContext(null);function tn(){const e=u.useContext(Hu);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const dw="https://solace.com/a2a/extensions/display-name",fw="https://solace.com/a2a/extensions/peer-agent-topology",pw="https://solace.com/a2a/extensions/sam/tools",mw=e=>{var o,s,i,l;let t,n,r;if((o=e.capabilities)!=null&&o.extensions){const c=e.capabilities.extensions.find(p=>p.uri===dw);(s=c==null?void 0:c.params)!=null&&s.display_name&&(t=c.params.display_name);const d=e.capabilities.extensions.find(p=>p.uri===fw);(i=d==null?void 0:d.params)!=null&&i.peer_agent_names&&(n=d.params.peer_agent_names);const f=e.capabilities.extensions.find(p=>p.uri===pw);(l=f==null?void 0:f.params)!=null&&l.tools&&(r=f.params.tools)}return{...e,display_name:t,peer_agents:n||[],tools:r||[],displayName:t,peerAgents:n||[]}},hw=()=>{const{configServerUrl:e}=tn(),[t,n]=u.useState([]),[r,o]=u.useState(!0),[s,i]=u.useState(null),l=`${e}/api/v1`,c=u.useCallback(async()=>{o(!0),i(null);try{const d=await ze(`${l}/agentCards`,{credentials:"include"});if(!d.ok){const m=await d.json().catch(()=>({message:`Failed to fetch agents: ${d.statusText}`}));throw new Error(m.message||`Failed to fetch agents: ${d.statusText}`)}const p=(await d.json()).map(mw);n(p)}catch(d){console.error("Error fetching agents:",d),i(d instanceof Error?d.message:"Could not load agent information."),n([])}finally{o(!1)}},[l]);return u.useEffect(()=>{c()},[c]),{agents:t,isLoading:r,error:s,refetch:c}},gw=e=>{const{configServerUrl:t}=tn(),[n,r]=u.useState([]),[o,s]=u.useState(!0),[i,l]=u.useState(null),c=`${t}/api/v1`,d=u.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0),l(null);try{const f=await ze(`${c}/artifacts/${e}`,{credentials:"include"});if(!f.ok){const m=await f.json().catch(()=>({message:`Failed to fetch artifacts. ${f.statusText}`}));throw new Error(m.message||`Failed to fetch artifacts. ${f.statusText}`)}const p=await f.json();r(p)}catch(f){const p=f instanceof Error?f.message:"Failed to fetch artifacts.";l(p),r([])}finally{s(!1)}},[c,e]);return u.useEffect(()=>{d()},[d]),{artifacts:n,isLoading:o,error:i,refetch:d}},Yu=()=>{const e=u.useContext(Bu);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ue=()=>{const e=u.useContext(Uu);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function xw(){const{messages:e}=Ue(),t=tn(),n=u.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]);u.useEffect(()=>(window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}),[n])}function Ku(){const e=u.useContext(Wu);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}function vw(e,t){const[n,r]=u.useState(e);return u.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}const ww=async(e,t,n)=>{const r=await ze(`${e}/api/v1/artifacts/${t}/${encodeURIComponent(n.filename)}`,{credentials:"include"});if(!r.ok)throw new Error(`Failed to download artifact: ${n.filename}. Status: ${r.status}`);const o=await r.blob();dc(o,n.filename)},qu=()=>{const{configServerUrl:e}=tn(),{addNotification:t,sessionId:n}=Ue();return{onDownload:async o=>{if(!n){t("Cannot download artifact: No active session.","error");return}try{await ww(e,n,o),t(`Downloaded artifact: ${o.filename}.`)}catch{t(`Failed to download artifact: ${o.filename}.`,"error")}}}},bw=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=u.useState(!1),s=u.useRef(0),i=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)+1,f.dataTransfer.types.includes("Files")&&o(!0))},[n,s]),l=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.types.includes("Files")&&(f.dataTransfer.dropEffect="copy"))},[n]),c=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)-1,s.current===0&&o(!1))},[n,s]),d=u.useCallback(f=>{if(n||(f.preventDefault(),f.stopPropagation(),o(!1),s.current=0,!f.dataTransfer.files||f.dataTransfer.files.length===0))return;const p=Array.from(f.dataTransfer.files),m=t?p.filter(t):p;m.length!==0&&e(m)},[n,s,t,e]);return{isDragging:r,handleDragEnter:i,handleDragOver:l,handleDragLeave:c,handleDrop:d}},Xu=()=>{const{messages:e,sessionName:t}=Ue();return u.useMemo(()=>{const n=e.find(r=>r.isUser?r.parts.some(o=>o.kind==="text"&&o.text.trim()):!1);if(n){const o=n.parts.filter(s=>s.kind==="text").map(s=>s.text).join(" ").trim();if(o)return o.length>100?`${o.substring(0,100)}...`:o}return"New Chat"},[e,t])},Vi=()=>{const e=u.useContext(Gu);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function Zu(){const e=u.useContext(Vu);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}u.createContext(null);function Ju(e){const t=e+"CollectionProvider",[n,r]=An(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:b}=g,w=zt.useRef(null),y=zt.useRef(new Map).current;return a.jsx(o,{scope:v,itemMap:y,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=Pn(l),d=zt.forwardRef((g,v)=>{const{scope:b,children:w}=g,y=s(l,b),E=$e(v,y.collectionRef);return a.jsx(c,{ref:E,children:w})});d.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Pn(f),h=zt.forwardRef((g,v)=>{const{scope:b,children:w,...y}=g,E=zt.useRef(null),T=$e(v,E),_=s(f,b);return zt.useEffect(()=>(_.itemMap.set(E,{ref:E,...y}),()=>void _.itemMap.delete(E))),a.jsx(m,{[p]:"",ref:T,children:w})});h.displayName=f;function x(g){const v=s(e+"CollectionConsumer",g);return zt.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const y=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((_,I)=>y.indexOf(_.ref.current)-y.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:h},x,r]}var yw=u.createContext(void 0);function Yi(e){const t=u.useContext(yw);return e||t||"ltr"}const Ki=u.forwardRef(({actions:e,className:t,...n},r)=>{const o=(i,l)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),l.onClick())},s=(i,l)=>{var d,f,p,m,h;const c=(d=i.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="menuitem"]');if(c)switch(i.key){case"ArrowDown":{i.preventDefault();const x=(l+1)%c.length;(f=c[x])==null||f.focus();break}case"ArrowUp":{i.preventDefault();const x=(l-1+c.length)%c.length;(p=c[x])==null||p.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 a.jsx("div",{ref:r,role:"menu",className:Ce("min-w-[8rem] overflow-hidden",t),...n,children:e.map((i,l)=>a.jsxs(u.Fragment,{children:[i.divider&&l>0&&a.jsx("div",{className:"my-1 h-px bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]"}),a.jsxs("div",{role:"menuitem",tabIndex:0,className:Ce("relative flex cursor-pointer items-center gap-2 px-3 py-1.5 my-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),s(c,l)},children:[i.icon&&i.iconPosition!=="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon}),a.jsx("span",{className:"flex-1",children:i.label}),i.icon&&i.iconPosition==="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon})]})]},i.id))})});Ki.displayName="Menu";var ts="Popover",[Qu,o1]=An(ts,[xr]),Yr=xr(),[Sw,Nn]=Qu(ts),ed=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,l=Yr(t),c=u.useRef(null),[d,f]=u.useState(!1),[p,m]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:ts});return a.jsx(Ii,{...l,children:a.jsx(Sw,{scope:t,contentId:Xt(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(h=>!h),[m]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>f(!0),[]),onCustomAnchorRemove:u.useCallback(()=>f(!1),[]),modal:i,children:n})})};ed.displayName=ts;var td="PopoverAnchor",Cw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(td,n),s=Yr(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return u.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(Fo,{...s,...r,ref:t})});Cw.displayName=td;var nd="PopoverTrigger",rd=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(nd,n),s=Yr(n),i=$e(t,o.triggerRef),l=a.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ld(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:a.jsx(Fo,{asChild:!0,...s,children:l})});rd.displayName=nd;var qi="PopoverPortal",[Ew,Tw]=Qu(qi,{forceMount:void 0}),od=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=Nn(qi,t);return a.jsx(Ew,{scope:t,forceMount:n,children:a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:r})})})};od.displayName=qi;var lr="PopoverContent",sd=u.forwardRef((e,t)=>{const n=Tw(lr,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=Nn(lr,e.__scopePopover);return a.jsx(mn,{present:r||s.open,children:s.modal?a.jsx(Nw,{...o,ref:t}):a.jsx(kw,{...o,ref:t})})});sd.displayName=lr;var Aw=Pn("PopoverContent.RemoveScroll"),Nw=u.forwardRef((e,t)=>{const n=Nn(lr,e.__scopePopover),r=u.useRef(null),o=$e(t,r),s=u.useRef(!1);return u.useEffect(()=>{const i=r.current;if(i)return zi(i)},[]),a.jsx(Ho,{as:Aw,allowPinchZoom:!0,children:a.jsx(id,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),kw=u.forwardRef((e,t)=>{const n=Nn(lr,e.__scopePopover),r=u.useRef(!1),o=u.useRef(!1);return a.jsx(id,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),id=u.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...p}=e,m=Nn(lr,n),h=Yr(n);return Fi(),a.jsx(Bo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:a.jsx(ji,{"data-state":ld(m.open),role:"dialog",id:m.contentId,...h,...p,ref:t,style:{...p.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)"}})})})}),ad="PopoverClose",_w=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(ad,n);return a.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});_w.displayName=ad;var Iw="PopoverArrow",jw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Yr(n);return a.jsx(Mi,{...o,...r,ref:t})});jw.displayName=Iw;function ld(e){return e?"open":"closed"}var Mw=ed,Rw=rd,Pw=od,Lw=sd;function cd({...e}){return a.jsx(Mw,{"data-slot":"popover",...e})}function ud({...e}){return a.jsx(Rw,{"data-slot":"popover-trigger",...e})}function dd({className:e,align:t="center",sideOffset:n=4,...r}){return a.jsx(Pw,{children:a.jsx(Lw,{"data-slot":"popover-content",align:t,sideOffset:n,className:Ce("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 w-auto origin-(--radix-popover-content-transform-origin) bg-background rounded-sm border px-0 py-1 shadow-sm outline-hidden",e),...r})})}function Dw({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:s,className:i,closeOnClickOutside:l=!0,closeOnEscape:c=!0,portal:d=!0,animationDuration:f=150,fallbackPlacements:p}){const m=u.useRef(null),[h,x]=u.useState({}),[g,v]=u.useState(!1);ow({ref:m,anchorRef:n,onClickOutside:t,enabled:e&&l}),sw({onEscape:t,enabled:e&&c});const{getPositionStyle:b}=lw({anchorRef:n,placement:o,offset:s,fallbackPlacements:p});if(u.useEffect(()=>{e&&m.current?(v(!1),requestAnimationFrame(()=>{if(m.current){const y=b(m.current);x(y),v(!0)}})):v(!1)},[e,b]),!e)return null;const w=a.jsx("div",{ref:m,role:"dialog","aria-modal":"false",className:Ce("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 ${f}ms ease-in-out, transform ${f}ms ease-in-out`,pointerEvents:e&&g?"auto":"none",visibility:g?"visible":"hidden"},children:r});return d?Ur.createPortal(w,document.body):w}function sl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ow(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Fw=[" ","Enter","ArrowUp","ArrowDown"],zw=[" ","Enter"],zn="Select",[ns,rs,$w]=Ju(zn),[vr,s1]=An(zn,[$w,xr]),os=xr(),[Bw,kn]=vr(zn),[Uw,Hw]=vr(zn),fd=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:x}=e,g=os(t),[v,b]=u.useState(null),[w,y]=u.useState(null),[E,T]=u.useState(!1),_=Yi(d),[I,A]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:zn}),[q,K]=Dn({prop:i,defaultProp:l,onChange:c,caller:zn}),U=u.useRef(null),Y=v?x||!!v.closest("form"):!0,[J,O]=u.useState(new Set),X=Array.from(J).map(N=>N.props.value).join(";");return a.jsx(Ii,{...g,children:a.jsxs(Bw,{required:h,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:y,valueNodeHasChildren:E,onValueNodeHasChildrenChange:T,contentId:Xt(),value:q,onValueChange:K,open:I,onOpenChange:A,dir:_,triggerPointerDownPosRef:U,disabled:m,children:[a.jsx(ns.Provider,{scope:t,children:a.jsx(Uw,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(N=>{O(R=>new Set(R).add(N))},[]),onNativeOptionRemove:u.useCallback(N=>{O(R=>{const S=new Set(R);return S.delete(N),S})},[]),children:n})}),Y?a.jsxs(Pd,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:q,onChange:N=>K(N.target.value),disabled:m,form:x,children:[q===void 0?a.jsx("option",{value:""}):null,Array.from(J)]},X):null]})})};fd.displayName=zn;var pd="SelectTrigger",md=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=os(n),i=kn(pd,n),l=i.disabled||r,c=$e(t,i.onTriggerChange),d=rs(n),f=u.useRef("touch"),[p,m,h]=Dd(g=>{const v=d().filter(y=>!y.disabled),b=v.find(y=>y.value===i.value),w=Od(v,g,b);w!==void 0&&i.onValueChange(w.value)}),x=g=>{l||(i.onOpenChange(!0),h()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return a.jsx(Fo,{asChild:!0,...s,children:a.jsx(ke.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":Ld(i.value)?"":void 0,...o,ref:c,onClick:ve(o.onClick,g=>{g.currentTarget.focus(),f.current!=="mouse"&&x(g)}),onPointerDown:ve(o.onPointerDown,g=>{f.current=g.pointerType;const v=g.target;v.hasPointerCapture(g.pointerId)&&v.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(x(g),g.preventDefault())}),onKeyDown:ve(o.onKeyDown,g=>{const v=p.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(v&&g.key===" ")&&Fw.includes(g.key)&&(x(),g.preventDefault())})})})});md.displayName=pd;var hd="SelectValue",gd=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=kn(hd,n),{onValueNodeHasChildrenChange:d}=c,f=s!==void 0,p=$e(t,c.onValueNodeChange);return nt(()=>{d(f)},[d,f]),a.jsx(ke.span,{...l,ref:p,style:{pointerEvents:"none"},children:Ld(c.value)?a.jsx(a.Fragment,{children:i}):s})});gd.displayName=hd;var Ww="SelectIcon",xd=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});xd.displayName=Ww;var Gw="SelectPortal",vd=e=>a.jsx(Gr,{asChild:!0,...e});vd.displayName=Gw;var $n="SelectContent",wd=u.forwardRef((e,t)=>{const n=kn($n,e.__scopeSelect),[r,o]=u.useState();if(nt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ur.createPortal(a.jsx(bd,{scope:e.__scopeSelect,children:a.jsx(ns.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(yd,{...e,ref:t})});wd.displayName=$n;var Ot=10,[bd,_n]=vr($n),Vw="SelectContentImpl",Yw=Pn("SelectContent.RemoveScroll"),yd=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:v,...b}=e,w=kn($n,n),[y,E]=u.useState(null),[T,_]=u.useState(null),I=$e(t,k=>E(k)),[A,q]=u.useState(null),[K,U]=u.useState(null),Y=rs(n),[J,O]=u.useState(!1),X=u.useRef(!1);u.useEffect(()=>{if(y)return zi(y)},[y]),Fi();const N=u.useCallback(k=>{const[V,...Q]=Y().map(se=>se.ref.current),[te]=Q.slice(-1),oe=document.activeElement;for(const se of k)if(se===oe||(se==null||se.scrollIntoView({block:"nearest"}),se===V&&T&&(T.scrollTop=0),se===te&&T&&(T.scrollTop=T.scrollHeight),se==null||se.focus(),document.activeElement!==oe))return},[Y,T]),R=u.useCallback(()=>N([A,y]),[N,A,y]);u.useEffect(()=>{J&&R()},[J,R]);const{onOpenChange:S,triggerPointerDownPosRef:F}=w;u.useEffect(()=>{if(y){let k={x:0,y:0};const V=te=>{var oe,se;k={x:Math.abs(Math.round(te.pageX)-(((oe=F.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(te.pageY)-(((se=F.current)==null?void 0:se.y)??0))}},Q=te=>{k.x<=10&&k.y<=10?te.preventDefault():y.contains(te.target)||S(!1),document.removeEventListener("pointermove",V),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",Q,{capture:!0})}}},[y,S,F]),u.useEffect(()=>{const k=()=>S(!1);return window.addEventListener("blur",k),window.addEventListener("resize",k),()=>{window.removeEventListener("blur",k),window.removeEventListener("resize",k)}},[S]);const[M,P]=Dd(k=>{const V=Y().filter(oe=>!oe.disabled),Q=V.find(oe=>oe.ref.current===document.activeElement),te=Od(V,k,Q);te&&setTimeout(()=>te.ref.current.focus())}),ee=u.useCallback((k,V,Q)=>{const te=!X.current&&!Q;(w.value!==void 0&&w.value===V||te)&&(q(k),te&&(X.current=!0))},[w.value]),D=u.useCallback(()=>y==null?void 0:y.focus(),[y]),$=u.useCallback((k,V,Q)=>{const te=!X.current&&!Q;(w.value!==void 0&&w.value===V||te)&&U(k)},[w.value]),L=r==="popper"?Ks:Sd,G=L===Ks?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:v}:{};return a.jsx(bd,{scope:n,content:y,viewport:T,onViewportChange:_,itemRefCallback:ee,selectedItem:A,onItemLeave:D,itemTextRefCallback:$,focusSelectedItem:R,selectedItemText:K,position:r,isPositioned:J,searchRef:M,children:a.jsx(Ho,{as:Yw,allowPinchZoom:!0,children:a.jsx(Bo,{asChild:!0,trapped:w.open,onMountAutoFocus:k=>{k.preventDefault()},onUnmountAutoFocus:ve(o,k=>{var V;(V=w.trigger)==null||V.focus({preventScroll:!0}),k.preventDefault()}),children:a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:k=>k.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:a.jsx(L,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:k=>k.preventDefault(),...b,...G,onPlaced:()=>O(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,k=>{const V=k.ctrlKey||k.altKey||k.metaKey;if(k.key==="Tab"&&k.preventDefault(),!V&&k.key.length===1&&P(k.key),["ArrowUp","ArrowDown","Home","End"].includes(k.key)){let te=Y().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(k.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(k.key)){const oe=k.target,se=te.indexOf(oe);te=te.slice(se+1)}setTimeout(()=>N(te)),k.preventDefault()}})})})})})})});yd.displayName=Vw;var Kw="SelectItemAlignedPosition",Sd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=kn($n,n),i=_n($n,n),[l,c]=u.useState(null),[d,f]=u.useState(null),p=$e(t,I=>f(I)),m=rs(n),h=u.useRef(!1),x=u.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,y=u.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&g&&v&&b){const I=s.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),q=s.valueNode.getBoundingClientRect(),K=b.getBoundingClientRect();if(s.dir!=="rtl"){const oe=K.left-A.left,se=q.left-oe,de=I.left-se,me=I.width+de,Me=Math.max(me,A.width),Oe=window.innerWidth-Ot,Le=sl(se,[Ot,Math.max(Ot,Oe-Me)]);l.style.minWidth=me+"px",l.style.left=Le+"px"}else{const oe=A.right-K.right,se=window.innerWidth-q.right-oe,de=window.innerWidth-I.right-se,me=I.width+de,Me=Math.max(me,A.width),Oe=window.innerWidth-Ot,Le=sl(se,[Ot,Math.max(Ot,Oe-Me)]);l.style.minWidth=me+"px",l.style.right=Le+"px"}const U=m(),Y=window.innerHeight-Ot*2,J=g.scrollHeight,O=window.getComputedStyle(d),X=parseInt(O.borderTopWidth,10),N=parseInt(O.paddingTop,10),R=parseInt(O.borderBottomWidth,10),S=parseInt(O.paddingBottom,10),F=X+N+J+S+R,M=Math.min(v.offsetHeight*5,F),P=window.getComputedStyle(g),ee=parseInt(P.paddingTop,10),D=parseInt(P.paddingBottom,10),$=I.top+I.height/2-Ot,L=Y-$,G=v.offsetHeight/2,k=v.offsetTop+G,V=X+N+k,Q=F-V;if(V<=$){const oe=U.length>0&&v===U[U.length-1].ref.current;l.style.bottom="0px";const se=d.clientHeight-g.offsetTop-g.offsetHeight,de=Math.max(L,G+(oe?D:0)+se+R),me=V+de;l.style.height=me+"px"}else{const oe=U.length>0&&v===U[0].ref.current;l.style.top="0px";const de=Math.max($,X+g.offsetTop+(oe?ee:0)+G)+Q;l.style.height=de+"px",g.scrollTop=V-$+g.offsetTop}l.style.margin=`${Ot}px 0`,l.style.minHeight=M+"px",l.style.maxHeight=Y+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,d,g,v,b,s.dir,r]);nt(()=>y(),[y]);const[E,T]=u.useState();nt(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);const _=u.useCallback(I=>{I&&x.current===!0&&(y(),w==null||w(),x.current=!1)},[y,w]);return a.jsx(Xw,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:_,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:a.jsx(ke.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Sd.displayName=Kw;var qw="SelectPopperPosition",Ks=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ot,...s}=e,i=os(n);return a.jsx(ji,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Ks.displayName=qw;var[Xw,Xi]=vr($n,{}),qs="SelectViewport",Cd=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=_n(qs,n),i=Xi(qs,n),l=$e(t,s.onViewportChange),c=u.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(ns.Slot,{scope:n,children:a.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,d=>{const f=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const h=Math.abs(c.current-f.scrollTop);if(h>0){const x=window.innerHeight-Ot*2,g=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(g,v);if(b<x){const w=b+h,y=Math.min(x,w),E=w-y;p.style.height=y+"px",p.style.bottom==="0px"&&(f.scrollTop=E>0?E:0,p.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Cd.displayName=qs;var Ed="SelectGroup",[Zw,Jw]=vr(Ed),Qw=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Xt();return a.jsx(Zw,{scope:n,id:o,children:a.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Qw.displayName=Ed;var Td="SelectLabel",e0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Jw(Td,n);return a.jsx(ke.div,{id:o.id,...r,ref:t})});e0.displayName=Td;var Ao="SelectItem",[t0,Ad]=vr(Ao),Nd=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=kn(Ao,n),c=_n(Ao,n),d=l.value===r,[f,p]=u.useState(s??""),[m,h]=u.useState(!1),x=$e(t,w=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,w,r,o)}),g=Xt(),v=u.useRef("touch"),b=()=>{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 a.jsx(t0,{scope:n,value:r,disabled:o,textId:g,isSelected:d,onItemTextChange:u.useCallback(w=>{p(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:a.jsx(ns.ItemSlot,{scope:n,value:r,disabled:o,textValue:f,children:a.jsx(ke.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:x,onFocus:ve(i.onFocus,()=>h(!0)),onBlur:ve(i.onBlur,()=>h(!1)),onClick:ve(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:ve(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:ve(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:ve(i.onPointerMove,w=>{var y;v.current=w.pointerType,o?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:ve(i.onKeyDown,w=>{var E;((E=c.searchRef)==null?void 0:E.current)!==""&&w.key===" "||(zw.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Nd.displayName=Ao;var jr="SelectItemText",kd=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=kn(jr,n),l=_n(jr,n),c=Ad(jr,n),d=Hw(jr,n),[f,p]=u.useState(null),m=$e(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),h=f==null?void 0:f.textContent,x=u.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=d;return nt(()=>(g(x),()=>v(x)),[g,v,x]),a.jsxs(a.Fragment,{children:[a.jsx(ke.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ur.createPortal(s.children,i.valueNode):null]})});kd.displayName=jr;var _d="SelectItemIndicator",Id=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ad(_d,n).isSelected?a.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});Id.displayName=_d;var Xs="SelectScrollUpButton",jd=u.forwardRef((e,t)=>{const n=_n(Xs,e.__scopeSelect),r=Xi(Xs,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return nt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});jd.displayName=Xs;var Zs="SelectScrollDownButton",Md=u.forwardRef((e,t)=>{const n=_n(Zs,e.__scopeSelect),r=Xi(Zs,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return nt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Md.displayName=Zs;var Rd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=_n("SelectScrollButton",n),i=u.useRef(null),l=rs(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),nt(()=>{var f;const d=l().find(p=>p.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),a.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ve(o.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{c()})})}),n0="SelectSeparator",r0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});r0.displayName=n0;var Js="SelectArrow",o0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=os(n),s=kn(Js,n),i=_n(Js,n);return s.open&&i.position==="popper"?a.jsx(Mi,{...o,...r,ref:t}):null});o0.displayName=Js;var s0="SelectBubbleInput",Pd=u.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=u.useRef(null),s=$e(r,o),i=Ow(t);return u.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const p=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(p)}},[i,t]),a.jsx(ke.select,{...n,style:{...Dc,...n.style},ref:s,defaultValue:t})});Pd.displayName=s0;function Ld(e){return e===""||e===void 0}function Dd(e){const t=yn(e),n=u.useRef(""),r=u.useRef(0),o=u.useCallback(i=>{const l=n.current+i;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=u.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Od(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=i0(e,Math.max(s,0));o.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function i0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a0=fd,l0=md,c0=gd,u0=xd,d0=vd,f0=wd,p0=Cd,m0=Nd,h0=kd,g0=Id,x0=jd,v0=Md;function Fd({...e}){return a.jsx(a0,{"data-slot":"select",...e})}function zd({...e}){return a.jsx(c0,{"data-slot":"select-value",...e})}function $d({className:e,size:t="default",children:n,...r}){return a.jsxs(l0,{"data-slot":"select-trigger","data-size":t,className:Ce("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,a.jsx(u0,{asChild:!0,children:a.jsx($l,{className:"size-4 opacity-50"})})]})}function Bd({className:e,children:t,position:n="popper",...r}){return a.jsx(d0,{children:a.jsxs(f0,{"data-slot":"select-content",className:Ce("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:[a.jsx(w0,{}),a.jsx(p0,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(b0,{})]})})}function Ud({className:e,children:t,...n}){return a.jsxs(m0,{"data-slot":"select-item",className:Ce("[&_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 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 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)]",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(g0,{children:a.jsx(mi,{className:"size-4"})})}),a.jsx(h0,{children:t})]})}function w0({className:e,...t}){return a.jsx(x0,{"data-slot":"select-scroll-up-button",className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(jp,{className:"size-4"})})}function b0({className:e,...t}){return a.jsx(v0,{"data-slot":"select-scroll-down-button",className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx($l,{className:"size-4"})})}var Ns="rovingFocusGroup.onEntryFocus",y0={bubbles:!1,cancelable:!0},Kr="RovingFocusGroup",[Qs,Hd,S0]=Ju(Kr),[C0,Wd]=An(Kr,[S0]),[E0,T0]=C0(Kr),Gd=u.forwardRef((e,t)=>a.jsx(Qs.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Qs.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(A0,{...e,ref:t})})}));Gd.displayName=Kr;var A0=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,m=u.useRef(null),h=$e(t,m),x=Yi(s),[g,v]=Dn({prop:i,defaultProp:l??null,onChange:c,caller:Kr}),[b,w]=u.useState(!1),y=yn(d),E=Hd(n),T=u.useRef(!1),[_,I]=u.useState(0);return u.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(Ns,y),()=>A.removeEventListener(Ns,y)},[y]),a.jsx(E0,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:g,onItemFocus:u.useCallback(A=>v(A),[v]),onItemShiftTab:u.useCallback(()=>w(!0),[]),onFocusableItemAdd:u.useCallback(()=>I(A=>A+1),[]),onFocusableItemRemove:u.useCallback(()=>I(A=>A-1),[]),children:a.jsx(ke.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{T.current=!0}),onFocus:ve(e.onFocus,A=>{const q=!T.current;if(A.target===A.currentTarget&&q&&!b){const K=new CustomEvent(Ns,y0);if(A.currentTarget.dispatchEvent(K),!K.defaultPrevented){const U=E().filter(N=>N.focusable),Y=U.find(N=>N.active),J=U.find(N=>N.id===g),X=[Y,J,...U].filter(Boolean).map(N=>N.ref.current);Kd(X,f)}}T.current=!1}),onBlur:ve(e.onBlur,()=>w(!1))})})}),Vd="RovingFocusGroupItem",Yd=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Xt(),d=s||c,f=T0(Vd,n),p=f.currentTabStopId===d,m=Hd(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:g}=f;return u.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),a.jsx(Qs.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:a.jsx(ke.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:ve(e.onMouseDown,v=>{r?f.onItemFocus(d):v.preventDefault()}),onFocus:ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ve(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=_0(v,f.orientation,f.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=m().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")y.reverse();else if(b==="prev"||b==="next"){b==="prev"&&y.reverse();const E=y.indexOf(v.currentTarget);y=f.loop?I0(y,E+1):y.slice(E+1)}setTimeout(()=>Kd(y))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:g!=null}):i})})});Yd.displayName=Vd;var N0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function k0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _0(e,t,n){const r=k0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return N0[r]}function Kd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var j0=Gd,M0=Yd,ss="Tabs",[R0,i1]=An(ss,[Wd]),qd=Wd(),[P0,Zi]=R0(ss),Xd=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=Yi(l),[p,m]=Dn({prop:r,onChange:o,defaultProp:s??"",caller:ss});return a.jsx(P0,{scope:n,baseId:Xt(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(ke.div,{dir:f,"data-orientation":i,...d,ref:t})})});Xd.displayName=ss;var Zd="TabsList",Jd=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Zi(Zd,n),i=qd(n);return a.jsx(j0,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(ke.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Jd.displayName=Zd;var Qd="TabsTrigger",ef=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Zi(Qd,n),l=qd(n),c=rf(i.baseId,r),d=of(i.baseId,r),f=r===i.value;return a.jsx(M0,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(ke.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ve(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:ve(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});ef.displayName=Qd;var tf="TabsContent",nf=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=Zi(tf,n),c=rf(l.baseId,r),d=of(l.baseId,r),f=r===l.value,p=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(mn,{present:o||f,children:({present:m})=>a.jsx(ke.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});nf.displayName=tf;function rf(e,t){return`${e}-trigger-${t}`}function of(e,t){return`${e}-content-${t}`}var L0=Xd,D0=Jd,O0=ef,F0=nf;function z0({className:e,...t}){return a.jsx(L0,{"data-slot":"tabs",className:Ce("flex flex-col gap-2",e),...t})}function $0({className:e,...t}){return a.jsx(D0,{"data-slot":"tabs-list",className:Ce("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function il({className:e,...t}){return a.jsx(O0,{"data-slot":"tabs-trigger","data-testid":t.value,"aria-label":t.value,title:t.title,className:Ce("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 al({className:e,...t}){return a.jsx(F0,{"data-slot":"tabs-content",className:Ce("flex-1 outline-none",e),...t})}const sf=u.forwardRef(({className:e,...t},n)=>a.jsx(qc,{autoComplete:"off",ref:n,name:"message","data-testid":"chat-input",className:Ce("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}));sf.displayName="ChatInput";const B0=Tn("flex gap-2 max-w-[90%] 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"}}),af=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:Ce(B0({variant:t,layout:n,className:e}),"group relative"),ref:s,...o,children:u.Children.map(r,i=>u.isValidElement(i)&&typeof i.type!="string"?u.cloneElement(i,{variant:t,layout:n}):i)}));af.displayName="ChatBubble";const U0=Tn("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"}}),lf=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:Ce(U0({variant:t,layout:n,className:e}),"relative max-w-full break-words whitespace-pre-wrap"),ref:s,...o,children:a.jsx(a.Fragment,{children:r})}));lf.displayName="ChatBubbleMessage";const H0=u.forwardRef(({variant:e,className:t,children:n,...r},o)=>a.jsx("div",{ref:o,className:Ce("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}));H0.displayName="ChatBubbleActionWrapper";const cf={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},uf=zt.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:s,disableAutoScroll:i,scrollToBottom:l,userHasScrolled:c}=eb({smooth:!0,content:t});return u.useImperativeHandle(r,()=>({scrollToBottom:l})),a.jsxs("div",{className:`fade-both-mask min-h-0 flex-1 py-3 relative h-full w-full ${e}`,children:[a.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:a.jsx("div",{className:"flex flex-col gap-6",style:cf,children:t})}),!s&&c&&a.jsx(Ae,{onClick:()=>{l()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 z-20 inline-flex -translate-x-1/2 transform rounded-full shadow-md bg-background","aria-label":"Scroll to bottom",children:a.jsx(Bl,{className:"h-4 w-4"})})]})});uf.displayName="ChatMessageList";const W0=Tn("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),G0=Tn("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 V0({size:e,show:t,children:n,className:r,variant:o}){return a.jsxs("span",{className:W0({show:t}),children:[a.jsx(hi,{className:Ce(G0({size:e,variant:o}),r)}),n]})}function Y0({className:e=""}){return a.jsx(V0,{size:"small",variant:"primary",className:e})}const io={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)]"},K0=Tn("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:io.error,warning:io.warning,info:io.info,success:io.success}},defaultVariants:{variant:"default"}});function df({className:e,variant:t,type:n,asChild:r=!1,...o}){const s=r?Ql:"span";return a.jsx(s,{"data-slot":"badge",className:Ce(K0({variant:t,type:n}),e),...o})}const q0=Tn("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 X0({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:Ce(q0({variant:t}),e),...n})}function Z0({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:Ce("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function J0({message:e,type:t}){return a.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:a.jsx(X0,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:a.jsxs(Z0,{className:"flex items-center text-sm",children:[t==="error"&&a.jsx(gi,{className:"mr-2 text-[var(--color-error-wMain)]"}),a.jsx("div",{className:"truncate",children:e})]})})})}function Q0(){const{notifications:e}=Ue();return e.length===0?null:a.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=>a.jsx("div",{className:"pointer-events-auto",children:a.jsx(J0,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function eb(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,s=u.useRef(null),i=u.useRef(0),l=u.useRef(!1),[c,d]=u.useState({isAtBottom:!0,autoScrollEnabled:!0}),f=u.useCallback(x=>{const{scrollTop:g,scrollHeight:v,clientHeight:b}=x;return Math.abs(v-g-b)<=t},[t]),p=u.useCallback(x=>{if(!s.current)return;const g=s.current.scrollHeight-s.current.clientHeight;x?s.current.scrollTop=g:s.current.scrollTo({top:g,behavior:n?"smooth":"auto"}),d({isAtBottom:!0,autoScrollEnabled:!0}),l.current=!1},[n]),m=u.useCallback(()=>{if(!s.current)return;const x=f(s.current);d(g=>({isAtBottom:x,autoScrollEnabled:x?!0:g.autoScrollEnabled}))},[f]);u.useEffect(()=>{const x=s.current;if(x)return x.addEventListener("scroll",m,{passive:!0}),()=>x.removeEventListener("scroll",m)},[m]),u.useEffect(()=>{const x=s.current;if(!x)return;const g=x.scrollHeight;g!==i.current&&((c.autoScrollEnabled||o)&&requestAnimationFrame(()=>{p(i.current===0)}),i.current=g)},[r,c.autoScrollEnabled,p,o]),u.useEffect(()=>{const x=s.current;if(!x)return;const g=new ResizeObserver(()=>{c.autoScrollEnabled&&p(!0)});return g.observe(x),()=>g.disconnect()},[c.autoScrollEnabled,p]);const h=u.useCallback(()=>{(s.current?f(s.current):!1)||(l.current=!0,d(g=>({...g,autoScrollEnabled:!1})))},[f]);return{scrollRef:s,isAtBottom:c.isAtBottom,autoScrollEnabled:c.autoScrollEnabled,scrollToBottom:()=>p(),disableAutoScroll:h,userHasScrolled:l.current}}const tb=({fileName:e,onRemove:t})=>a.jsxs(df,{className:"max-w-50 gap-1.5 rounded-full bg-muted pr-1",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs md:text-sm",title:e,children:e}),t&&a.jsx(Ae,{variant:"ghost",size:"icon",onClick:t,className:"h-2 min-h-0 w-2 min-w-0 p-2",title:"Remove file",children:a.jsx(Ro,{})})]}),nb=({agents:e=[],scrollToBottom:t})=>{const{isResponding:n,isCancelling:r,userInput:o,selectedAgentName:s,setSelectedAgentName:i,setUserInput:l,handleSubmit:c,handleCancel:d}=Ue(),f=u.useRef(null),[p,m]=u.useState([]),h=u.useRef(null),x=u.useRef(n),[g,v]=u.useState(o),b=vw(g,300);u.useEffect(()=>{l(b)},[b,l]),u.useEffect(()=>{v(o)},[o]),u.useEffect(()=>{x.current&&!n&&setTimeout(()=>{var O;(O=h.current)==null||O.focus()},100),x.current=n},[n]);const w=()=>{var O;n||(O=f.current)==null||O.click()},y=O=>{const X=O.target.files;if(X){const N=Array.from(X).filter(R=>!p.some(S=>S.name===R.name&&S.size===R.size&&S.lastModified===R.lastModified));N.length>0&&m(R=>[...R,...N])}O.target&&(O.target.value=""),setTimeout(()=>{var N;(N=h.current)==null||N.focus()},100)},E=O=>{if(n)return;const X=O.clipboardData;if(!X||!X.files||X.files.length===0)return;X.files.length>0&&O.preventDefault();const N=Array.from(X.files).filter(R=>!p.some(S=>S.name===R.name&&S.size===R.size&&S.lastModified===R.lastModified));N.length>0&&m(R=>[...R,...N])},T=O=>{m(X=>X.filter((N,R)=>R!==O))},_=u.useMemo(()=>!n&&((g==null?void 0:g.trim())||p.length!==0),[n,g,p]),I=async O=>{O.preventDefault(),_&&(await c(O,p,g.trim()),m([]),v(""),t==null||t())},A=O=>{if(n)return;const X=O.filter(N=>!p.some(R=>R.name===N.name&&R.size===N.size&&R.lastModified===N.lastModified));X.length>0&&m(N=>[...N,...X])},{isDragging:q,handleDragEnter:K,handleDragOver:U,handleDragLeave:Y,handleDrop:J}=bw({onFilesDropped:A,disabled:n});return a.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${q?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:K,onDragOver:U,onDragLeave:Y,onDrop:J,children:[a.jsx("input",{type:"file",ref:f,className:"hidden",multiple:!0,onChange:y,accept:"*/*",disabled:n}),p.length>0&&a.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:p.map((O,X)=>a.jsx(tb,{fileName:O.name,onRemove:()=>T(X)},`${O.name}-${O.lastModified}-${X}`))}),a.jsx(sf,{ref:h,value:g,onChange:O=>v(O.target.value),placeholder:"How can I help you today?",className:"text-base/normal min-h-0 max-h-50 resize-none border-none p-3 shadow-none rounded-2xl focus-visible:outline-none field-sizing-content transition-[height] duration-500 ease-in-out",rows:1,onPaste:E,onKeyDown:O=>{O.key==="Enter"&&!O.shiftKey&&_&&I(O)}}),a.jsxs("div",{className:"flex items-center gap-2 m-2",children:[a.jsx(Ae,{variant:"ghost",onClick:w,disabled:n,tooltip:"Attach file",children:a.jsx(Ul,{className:"size-4"})}),a.jsx("div",{children:"Agent: "}),a.jsxs(Fd,{value:s,onValueChange:i,disabled:n||e.length===0,children:[a.jsx($d,{className:"w-[250px]",children:a.jsx(zd,{defaultValue:s})}),a.jsx(Bd,{children:e.map(O=>a.jsx(Ud,{value:O.name,children:O.displayName||O.name},O.name))})]}),n&&!r?a.jsxs(Ae,{className:"ml-auto gap-1.5",onClick:d,variant:"outline",disabled:r,tooltip:"Cancel",children:[a.jsx(Mp,{className:"size-4"}),"Stop"]}):a.jsx(Ae,{variant:"ghost",className:"ml-auto gap-1.5",onClick:I,disabled:!_,tooltip:"Send message",children:a.jsx(Rp,{className:"size-4"})})]})]})};function rb(e,t){return t&&t.toLowerCase().startsWith("text/")?!0:e?e.toLowerCase().endsWith(".txt")||e.toLowerCase().endsWith(".text"):!1}function ob(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 sb(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 ib(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 ab(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 lb(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 cb(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 ub(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 db(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 qr(e,t){return ob(e,t)?"html":sb(e,t)?"mermaid":ab(e,t)?"image":ub(e,t)?"markdown":db(e,t)?"audio":lb(e,t)?"json":cb(e,t)?"yaml":ib(e,t)?"csv":rb(e,t)?"text":null}function ff(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 pf=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],fb=["image","audio"],pb=e=>{if(!e||!e.content)return"";const t=qr(e.name,e.mime_type);if(!t||!pf.includes(t))return"";if(fb.includes(t))return e.content;try{return ff(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},mf=5*1024*1024,mb=fc(mf);function hb(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=qr(e.filename,e.mime_type);return!t||!pf.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>mf?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${mb}.`}:{canPreview:!0}}const hf=(e,t="h-4 w-4")=>{if(!e)return a.jsx(da,{className:t});switch(qr(e.filename,e.mime_type)){case"image":case"mermaid":return a.jsx(Fp,{className:t});case"audio":return a.jsx(Op,{className:t});case"html":return a.jsx(Dp,{className:t});case"text":return a.jsx(sr,{className:t});case"csv":return a.jsx(Lp,{className:t});case"json":return a.jsx(Pp,{className:t});default:return a.jsx(da,{className:t})}},gf=({fileAttachment:e,isEmbedded:t=!1})=>a.jsx(xf,{filename:e.name,mimeType:e.mime_type,onDownload:()=>rh(e),className:"ml-4",isEmbedded:t}),xf=({filename:e,mimeType:t,className:n,onDownload:r,isEmbedded:o=!1})=>{const{artifacts:s,setPreviewArtifact:i,openSidePanelTab:l}=Ue(),c=u.useMemo(()=>s.find(f=>f.filename===e),[s,e]),d=u.useMemo(()=>hf(c||{filename:e,mime_type:t||""}),[c,e,t]);return a.jsxs("div",{className:`flex flex-shrink items-center gap-2 rounded-lg bg-[var(--accent-background)] px-2 py-1 h-11 max-w-xs ${n||""}`,children:[d,a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm leading-9",title:e,children:a.jsx("strong",{children:a.jsx("code",{children:e})})}),c&&!o&&a.jsx(Ae,{variant:"ghost",onClick:f=>{f.stopPropagation(),l("files"),i(c)},tooltip:"Preview",children:a.jsx(Hl,{className:"h-4 w-4"})}),r&&a.jsx(Ae,{variant:"ghost",onClick:()=>r(),tooltip:"Download file",children:a.jsx(xi,{className:"h-4 w-4"})})]})},gb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"audio/mpeg"};base64,${e}`;return a.jsx("div",{className:"flex h-auto max-w-[100vw] items-center justify-center p-4",children:a.jsxs("audio",{controls:!0,className:"w-full",onLoad:()=>n(null),onError:()=>n("Failed to load audio content."),children:[a.jsx("source",{src:r,type:t||"audio/mpeg"}),"Your browser does not support the audio element."]})})},xb=e=>{if(!e)return[];const t=[];let n=[],r="",o=!1;for(let s=0;s<e.length;s++){const i=e[s],l=s<e.length-1?e[s+1]:"";i==='"'?l==='"'?(r+='"',s++):o=!o:i===","&&!o?(n.push(r.trim()),r=""):(i===`
|
|
117
117
|
`||i==="\r"&&l===`
|
|
118
118
|
`)&&!o?(i==="\r"&&l===`
|
|
119
119
|
`&&s++,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(s=>s.trim())&&t.push(n)),t},vb=({content:e,setRenderError:t})=>{u.useEffect(()=>{t(null)},[e,t]);const n=u.useMemo(()=>{try{return xb(e)}catch(r){return console.error("Error parsing CSV:",r),t("Failed to parse CSV content."),[]}},[e,t]);return n.length?a.jsx("div",{className:"block w-full overflow-x-scroll p-4",children:a.jsx("div",{style:{minWidth:"min(100%, max-content)"},children:a.jsxs("table",{className:"border text-sm w-full",children:[a.jsx("thead",{className:"sticky top-0 z-10 shadow-sm",children:n.length>0&&a.jsx("tr",{children:n[0].map((r,o)=>a.jsx("th",{className:"border-b p-2 text-left font-medium whitespace-nowrap",title:r,children:(r==null?void 0:r.trim())||""},`header-${o}`))})}),a.jsx("tbody",{children:n.slice(1).map((r,o)=>a.jsx("tr",{className:o%2===0?"bg-muted dark:bg-gray-700":"",children:r.map((s,i)=>a.jsx("td",{className:"min-w-0 border-b p-2 break-words align-top",title:s,children:(s==null?void 0:s.trim())||""},`cell-${o}-${i}`))},`row-${o}`))})]})})}):a.jsx("div",{children:"No valid CSV content found or failed to parse."})},wb=({content:e,setRenderError:t})=>{const n=u.useMemo(()=>e.replace(/<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi,(s,i)=>{const l=s.match(/<script(\s[^>]*)?>/i);return`<script${l&&l[1]?l[1]:""}>(function() {
|
|
120
120
|
try {
|
|
121
121
|
${i}
|
|
122
122
|
} catch (e) { console.error('Error in sandboxed script:', e); }
|
|
123
|
-
})();<\/script>`}),[e]);return a.jsx("div",{className:"h-full w-full overflow-hidden dark:bg-gray-400 border",children:a.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)})})},bb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"image/png"};base64,${e}`;return a.jsx("div",{className:"flex h-auto w-auto max-w-[100vw] items-center justify-center p-4",children:a.jsx("img",{src:r,onError:()=>n("Failed to load image"),onLoad:()=>n(null),alt:"Preview",className:"h-full w-full object-contain"})})};function vf(){const e=u.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 yb=({content:e})=>{const{ref:t,handleKeyDown:n}=vf();return a.jsx("div",{className:"w-full p-4",children:a.jsx("div",{ref:t,className:"max-w-full overflow-hidden focus-visible:outline-none select-text",tabIndex:0,onKeyDown:n,children:a.jsx(or,{className:"max-w-full break-words",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:wf,setPrototypeOf:ll,isFrozen:Sb,getPrototypeOf:Cb,getOwnPropertyDescriptor:Eb}=Object;let{freeze:ut,seal:It,create:bf}=Object,{apply:ei,construct:ti}=typeof Reflect<"u"&&Reflect;ut||(ut=function(t){return t});It||(It=function(t){return t});ei||(ei=function(t,n,r){return t.apply(n,r)});ti||(ti=function(t,n){return new t(...n)});const ao=dt(Array.prototype.forEach),Tb=dt(Array.prototype.lastIndexOf),cl=dt(Array.prototype.pop),Sr=dt(Array.prototype.push),Ab=dt(Array.prototype.splice),vo=dt(String.prototype.toLowerCase),ks=dt(String.prototype.toString),ul=dt(String.prototype.match),Cr=dt(String.prototype.replace),Nb=dt(String.prototype.indexOf),kb=dt(String.prototype.trim),Ft=dt(Object.prototype.hasOwnProperty),at=dt(RegExp.prototype.test),Er=_b(TypeError);function dt(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 ei(e,t,r)}}function _b(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ti(e,n)}}function Ne(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vo;ll&&ll(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Sb(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Ib(e){for(let t=0;t<e.length;t++)Ft(e,t)||(e[t]=null);return e}function ln(e){const t=bf(null);for(const[n,r]of wf(e))Ft(e,n)&&(Array.isArray(r)?t[n]=Ib(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=ln(r):t[n]=r);return t}function Tr(e,t){for(;e!==null;){const r=Eb(e,t);if(r){if(r.get)return dt(r.get);if(typeof r.value=="function")return dt(r.value)}e=Cb(e)}function n(){return null}return n}const dl=ut(["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"]),_s=ut(["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"]),Is=ut(["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"]),jb=ut(["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"]),js=ut(["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"]),Mb=ut(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fl=ut(["#text"]),pl=ut(["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"]),Ms=ut(["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"]),ml=ut(["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"]),lo=ut(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rb=It(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Pb=It(/<%[\w\W]*|[\w\W]*%>/gm),Lb=It(/\$\{[\w\W]*/gm),Db=It(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ob=It(/^aria-[\-\w]+$/),yf=It(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Fb=It(/^(?:\w+script|data):/i),zb=It(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sf=It(/^html$/i),$b=It(/^[a-z][.\w]*(-[.\w]+)+$/i);var hl=Object.freeze({__proto__:null,ARIA_ATTR:Ob,ATTR_WHITESPACE:zb,CUSTOM_ELEMENT:$b,DATA_ATTR:Db,DOCTYPE_NAME:Sf,ERB_EXPR:Pb,IS_ALLOWED_URI:yf,IS_SCRIPT_OR_DATA:Fb,MUSTACHE_EXPR:Rb,TMPLIT_EXPR:Lb});const Ar={element:1,text:3,progressingInstruction:7,comment:8,document:9},Bb=function(){return typeof window>"u"?null:window},Ub=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 s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},gl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bb();const t=Z=>Cf(Z);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==Ar.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:h}=e,x=c.prototype,g=Tr(x,"cloneNode"),v=Tr(x,"remove"),b=Tr(x,"nextSibling"),w=Tr(x,"childNodes"),y=Tr(x,"parentNode");if(typeof i=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let E,T="";const{implementation:_,createNodeIterator:I,createDocumentFragment:A,getElementsByTagName:q}=n,{importNode:K}=r;let U=gl();t.isSupported=typeof wf=="function"&&typeof y=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:J,TMPLIT_EXPR:O,DATA_ATTR:X,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:S,CUSTOM_ELEMENT:F}=hl;let{IS_ALLOWED_URI:M}=hl,P=null;const ee=Ne({},[...dl,..._s,...Is,...js,...fl]);let D=null;const $=Ne({},[...pl,...Ms,...ml,...lo]);let L=Object.seal(bf(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}})),W=null,k=null,G=!0,Q=!0,te=!1,oe=!0,se=!1,de=!0,me=!1,Me=!1,Oe=!1,Le=!1,je=!1,He=!1,ot=!0,Qe=!1;const et="user-content-";let le=!0,pt=!1,tt={},mt=null;const jt=Ne({},["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 wt=null;const Et=Ne({},["audio","video","img","source","image","track"]);let Tt=null;const Wt=Ne({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let gt=Ke,Mt=!1,Rt=null;const nn=Ne({},[ht,At,Ke],ks);let Nt=Ne({},["mi","mo","mn","ms","mtext"]),De=Ne({},["annotation-xml"]);const qe=Ne({},["title","style","font","a","script"]);let st=null;const rn=["application/xhtml+xml","text/html"],on="text/html";let Pe=null,xt=null;const sn=n.createElement("form"),Gt=function(C){return C instanceof RegExp||C instanceof Function},Pt=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xt&&xt===C)){if((!C||typeof C!="object")&&(C={}),C=ln(C),st=rn.indexOf(C.PARSER_MEDIA_TYPE)===-1?on:C.PARSER_MEDIA_TYPE,Pe=st==="application/xhtml+xml"?ks:vo,P=Ft(C,"ALLOWED_TAGS")?Ne({},C.ALLOWED_TAGS,Pe):ee,D=Ft(C,"ALLOWED_ATTR")?Ne({},C.ALLOWED_ATTR,Pe):$,Rt=Ft(C,"ALLOWED_NAMESPACES")?Ne({},C.ALLOWED_NAMESPACES,ks):nn,Tt=Ft(C,"ADD_URI_SAFE_ATTR")?Ne(ln(Wt),C.ADD_URI_SAFE_ATTR,Pe):Wt,wt=Ft(C,"ADD_DATA_URI_TAGS")?Ne(ln(Et),C.ADD_DATA_URI_TAGS,Pe):Et,mt=Ft(C,"FORBID_CONTENTS")?Ne({},C.FORBID_CONTENTS,Pe):jt,W=Ft(C,"FORBID_TAGS")?Ne({},C.FORBID_TAGS,Pe):ln({}),k=Ft(C,"FORBID_ATTR")?Ne({},C.FORBID_ATTR,Pe):ln({}),tt=Ft(C,"USE_PROFILES")?C.USE_PROFILES:!1,G=C.ALLOW_ARIA_ATTR!==!1,Q=C.ALLOW_DATA_ATTR!==!1,te=C.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=C.SAFE_FOR_TEMPLATES||!1,de=C.SAFE_FOR_XML!==!1,me=C.WHOLE_DOCUMENT||!1,Le=C.RETURN_DOM||!1,je=C.RETURN_DOM_FRAGMENT||!1,He=C.RETURN_TRUSTED_TYPE||!1,Oe=C.FORCE_BODY||!1,ot=C.SANITIZE_DOM!==!1,Qe=C.SANITIZE_NAMED_PROPS||!1,le=C.KEEP_CONTENT!==!1,pt=C.IN_PLACE||!1,M=C.ALLOWED_URI_REGEXP||yf,gt=C.NAMESPACE||Ke,Nt=C.MATHML_TEXT_INTEGRATION_POINTS||Nt,De=C.HTML_INTEGRATION_POINTS||De,L=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Gt(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Gt(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Q=!1),je&&(Le=!0),tt&&(P=Ne({},fl),D=[],tt.html===!0&&(Ne(P,dl),Ne(D,pl)),tt.svg===!0&&(Ne(P,_s),Ne(D,Ms),Ne(D,lo)),tt.svgFilters===!0&&(Ne(P,Is),Ne(D,Ms),Ne(D,lo)),tt.mathMl===!0&&(Ne(P,js),Ne(D,ml),Ne(D,lo))),C.ADD_TAGS&&(P===ee&&(P=ln(P)),Ne(P,C.ADD_TAGS,Pe)),C.ADD_ATTR&&(D===$&&(D=ln(D)),Ne(D,C.ADD_ATTR,Pe)),C.ADD_URI_SAFE_ATTR&&Ne(Tt,C.ADD_URI_SAFE_ATTR,Pe),C.FORBID_CONTENTS&&(mt===jt&&(mt=ln(mt)),Ne(mt,C.FORBID_CONTENTS,Pe)),le&&(P["#text"]=!0),me&&Ne(P,["html","head","body"]),P.table&&(Ne(P,["tbody"]),delete W.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=C.TRUSTED_TYPES_POLICY,T=E.createHTML("")}else E===void 0&&(E=Ub(h,o)),E!==null&&typeof T=="string"&&(T=E.createHTML(""));ut&&ut(C),xt=C}},Lt=Ne({},[..._s,...Is,...jb]),Dt=Ne({},[...js,...Mb]),be=function(C){let j=y(C);(!j||!j.tagName)&&(j={namespaceURI:gt,tagName:"template"});const H=vo(C.tagName),he=vo(j.tagName);return Rt[C.namespaceURI]?C.namespaceURI===At?j.namespaceURI===Ke?H==="svg":j.namespaceURI===ht?H==="svg"&&(he==="annotation-xml"||Nt[he]):!!Lt[H]:C.namespaceURI===ht?j.namespaceURI===Ke?H==="math":j.namespaceURI===At?H==="math"&&De[he]:!!Dt[H]:C.namespaceURI===Ke?j.namespaceURI===At&&!De[he]||j.namespaceURI===ht&&!Nt[he]?!1:!Dt[H]&&(qe[H]||!Lt[H]):!!(st==="application/xhtml+xml"&&Rt[C.namespaceURI]):!1},Ee=function(C){Sr(t.removed,{element:C});try{y(C).removeChild(C)}catch{v(C)}},B=function(C,j){try{Sr(t.removed,{attribute:j.getAttributeNode(C),from:j})}catch{Sr(t.removed,{attribute:null,from:j})}if(j.removeAttribute(C),C==="is")if(Le||je)try{Ee(j)}catch{}else try{j.setAttribute(C,"")}catch{}},z=function(C){let j=null,H=null;if(Oe)C="<remove></remove>"+C;else{const Re=ul(C,/^[\r\n\t ]+/);H=Re&&Re[0]}st==="application/xhtml+xml"&>===Ke&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const he=E?E.createHTML(C):C;if(gt===Ke)try{j=new m().parseFromString(he,st)}catch{}if(!j||!j.documentElement){j=_.createDocument(gt,"template",null);try{j.documentElement.innerHTML=Mt?T:he}catch{}}const ye=j.body||j.documentElement;return C&&H&&ye.insertBefore(n.createTextNode(H),ye.childNodes[0]||null),gt===Ke?q.call(j,me?"html":"body")[0]:me?j.documentElement:ye},V=function(C){return I.call(C.ownerDocument||C,C,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ie=function(C){return C instanceof p&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof f)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},fe=function(C){return typeof l=="function"&&C instanceof l};function pe(Z,C,j){ao(Z,H=>{H.call(t,C,j,xt)})}const ge=function(C){let j=null;if(pe(U.beforeSanitizeElements,C,null),ie(C))return Ee(C),!0;const H=Pe(C.nodeName);if(pe(U.uponSanitizeElement,C,{tagName:H,allowedTags:P}),de&&C.hasChildNodes()&&!fe(C.firstElementChild)&&at(/<[/\w!]/g,C.innerHTML)&&at(/<[/\w!]/g,C.textContent)||C.nodeType===Ar.progressingInstruction||de&&C.nodeType===Ar.comment&&at(/<[/\w]/g,C.data))return Ee(C),!0;if(!P[H]||W[H]){if(!W[H]&&ae(H)&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,H)||L.tagNameCheck instanceof Function&&L.tagNameCheck(H)))return!1;if(le&&!mt[H]){const he=y(C)||C.parentNode,ye=w(C)||C.childNodes;if(ye&&he){const Re=ye.length;for(let we=Re-1;we>=0;--we){const xe=g(ye[we],!0);xe.__removalCount=(C.__removalCount||0)+1,he.insertBefore(xe,b(C))}}}return Ee(C),!0}return C instanceof c&&!be(C)||(H==="noscript"||H==="noembed"||H==="noframes")&&at(/<\/no(script|embed|frames)/i,C.innerHTML)?(Ee(C),!0):(se&&C.nodeType===Ar.text&&(j=C.textContent,ao([Y,J,O],he=>{j=Cr(j,he," ")}),C.textContent!==j&&(Sr(t.removed,{element:C.cloneNode()}),C.textContent=j)),pe(U.afterSanitizeElements,C,null),!1)},_e=function(C,j,H){if(ot&&(j==="id"||j==="name")&&(H in n||H in sn))return!1;if(!(Q&&!k[j]&&at(X,j))){if(!(G&&at(N,j))){if(!D[j]||k[j]){if(!(ae(C)&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,C)||L.tagNameCheck instanceof Function&&L.tagNameCheck(C))&&(L.attributeNameCheck instanceof RegExp&&at(L.attributeNameCheck,j)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(j))||j==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,H)||L.tagNameCheck instanceof Function&&L.tagNameCheck(H))))return!1}else if(!Tt[j]){if(!at(M,Cr(H,S,""))){if(!((j==="src"||j==="xlink:href"||j==="href")&&C!=="script"&&Nb(H,"data:")===0&&wt[C])){if(!(te&&!at(R,Cr(H,S,"")))){if(H)return!1}}}}}}return!0},ae=function(C){return C!=="annotation-xml"&&ul(C,F)},ue=function(C){pe(U.beforeSanitizeAttributes,C,null);const{attributes:j}=C;if(!j||ie(C))return;const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let he=j.length;for(;he--;){const ye=j[he],{name:Re,namespaceURI:we,value:xe}=ye,it=Pe(Re),hn=xe;let Fe=Re==="value"?hn:kb(hn);if(H.attrName=it,H.attrValue=Fe,H.keepAttr=!0,H.forceKeepAttr=void 0,pe(U.uponSanitizeAttribute,C,H),Fe=H.attrValue,Qe&&(it==="id"||it==="name")&&(B(Re,C),Fe=et+Fe),de&&at(/((--!?|])>)|<\/(style|title)/i,Fe)){B(Re,C);continue}if(H.forceKeepAttr)continue;if(!H.keepAttr){B(Re,C);continue}if(!oe&&at(/\/>/i,Fe)){B(Re,C);continue}se&&ao([Y,J,O],wr=>{Fe=Cr(Fe,wr," ")});const ls=Pe(C.nodeName);if(!_e(ls,it,Fe)){B(Re,C);continue}if(E&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!we)switch(h.getAttributeType(ls,it)){case"TrustedHTML":{Fe=E.createHTML(Fe);break}case"TrustedScriptURL":{Fe=E.createScriptURL(Fe);break}}if(Fe!==hn)try{we?C.setAttributeNS(we,Re,Fe):C.setAttribute(Re,Fe),ie(C)?Ee(C):cl(t.removed)}catch{B(Re,C)}}pe(U.afterSanitizeAttributes,C,null)},Ie=function Z(C){let j=null;const H=V(C);for(pe(U.beforeSanitizeShadowDOM,C,null);j=H.nextNode();)pe(U.uponSanitizeShadowNode,j,null),ge(j),ue(j),j.content instanceof s&&Z(j.content);pe(U.afterSanitizeShadowDOM,C,null)};return t.sanitize=function(Z){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=null,H=null,he=null,ye=null;if(Mt=!Z,Mt&&(Z="<!-->"),typeof Z!="string"&&!fe(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return Z;if(Me||Pt(C),t.removed=[],typeof Z=="string"&&(pt=!1),pt){if(Z.nodeName){const xe=Pe(Z.nodeName);if(!P[xe]||W[xe])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof l)j=z("<!---->"),H=j.ownerDocument.importNode(Z,!0),H.nodeType===Ar.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?j=H:j.appendChild(H);else{if(!Le&&!se&&!me&&Z.indexOf("<")===-1)return E&&He?E.createHTML(Z):Z;if(j=z(Z),!j)return Le?null:He?T:""}j&&Oe&&Ee(j.firstChild);const Re=V(pt?Z:j);for(;he=Re.nextNode();)ge(he),ue(he),he.content instanceof s&&Ie(he.content);if(pt)return Z;if(Le){if(je)for(ye=A.call(j.ownerDocument);j.firstChild;)ye.appendChild(j.firstChild);else ye=j;return(D.shadowroot||D.shadowrootmode)&&(ye=K.call(r,ye,!0)),ye}let we=me?j.outerHTML:j.innerHTML;return me&&P["!doctype"]&&j.ownerDocument&&j.ownerDocument.doctype&&j.ownerDocument.doctype.name&&at(Sf,j.ownerDocument.doctype.name)&&(we="<!DOCTYPE "+j.ownerDocument.doctype.name+`>
|
|
124
|
-
`+we),se&&ao([Y,J,O],xe=>{we=Cr(we,xe," ")}),E&&He?E.createHTML(we):we},t.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pt(Z),Me=!0},t.clearConfig=function(){xt=null,Me=!1},t.isValidAttribute=function(Z,C,j){xt||Pt({});const
|
|
123
|
+
})();<\/script>`}),[e]);return a.jsx("div",{className:"h-full w-full overflow-hidden dark:bg-gray-400 border",children:a.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)})})},bb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"image/png"};base64,${e}`;return a.jsx("div",{className:"flex h-auto w-auto max-w-[100vw] items-center justify-center p-4",children:a.jsx("img",{src:r,onError:()=>n("Failed to load image"),onLoad:()=>n(null),alt:"Preview",className:"h-full w-full object-contain"})})};function vf(){const e=u.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 yb=({content:e})=>{const{ref:t,handleKeyDown:n}=vf();return a.jsx("div",{className:"w-full p-4",children:a.jsx("div",{ref:t,className:"max-w-full overflow-hidden focus-visible:outline-none select-text",tabIndex:0,onKeyDown:n,children:a.jsx(or,{className:"max-w-full break-words",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:wf,setPrototypeOf:ll,isFrozen:Sb,getPrototypeOf:Cb,getOwnPropertyDescriptor:Eb}=Object;let{freeze:ut,seal:It,create:bf}=Object,{apply:ei,construct:ti}=typeof Reflect<"u"&&Reflect;ut||(ut=function(t){return t});It||(It=function(t){return t});ei||(ei=function(t,n,r){return t.apply(n,r)});ti||(ti=function(t,n){return new t(...n)});const ao=dt(Array.prototype.forEach),Tb=dt(Array.prototype.lastIndexOf),cl=dt(Array.prototype.pop),Sr=dt(Array.prototype.push),Ab=dt(Array.prototype.splice),vo=dt(String.prototype.toLowerCase),ks=dt(String.prototype.toString),ul=dt(String.prototype.match),Cr=dt(String.prototype.replace),Nb=dt(String.prototype.indexOf),kb=dt(String.prototype.trim),Ft=dt(Object.prototype.hasOwnProperty),at=dt(RegExp.prototype.test),Er=_b(TypeError);function dt(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 ei(e,t,r)}}function _b(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ti(e,n)}}function Ne(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vo;ll&&ll(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Sb(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Ib(e){for(let t=0;t<e.length;t++)Ft(e,t)||(e[t]=null);return e}function ln(e){const t=bf(null);for(const[n,r]of wf(e))Ft(e,n)&&(Array.isArray(r)?t[n]=Ib(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=ln(r):t[n]=r);return t}function Tr(e,t){for(;e!==null;){const r=Eb(e,t);if(r){if(r.get)return dt(r.get);if(typeof r.value=="function")return dt(r.value)}e=Cb(e)}function n(){return null}return n}const dl=ut(["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"]),_s=ut(["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"]),Is=ut(["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"]),jb=ut(["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"]),js=ut(["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"]),Mb=ut(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fl=ut(["#text"]),pl=ut(["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"]),Ms=ut(["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"]),ml=ut(["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"]),lo=ut(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rb=It(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Pb=It(/<%[\w\W]*|[\w\W]*%>/gm),Lb=It(/\$\{[\w\W]*/gm),Db=It(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ob=It(/^aria-[\-\w]+$/),yf=It(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Fb=It(/^(?:\w+script|data):/i),zb=It(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sf=It(/^html$/i),$b=It(/^[a-z][.\w]*(-[.\w]+)+$/i);var hl=Object.freeze({__proto__:null,ARIA_ATTR:Ob,ATTR_WHITESPACE:zb,CUSTOM_ELEMENT:$b,DATA_ATTR:Db,DOCTYPE_NAME:Sf,ERB_EXPR:Pb,IS_ALLOWED_URI:yf,IS_SCRIPT_OR_DATA:Fb,MUSTACHE_EXPR:Rb,TMPLIT_EXPR:Lb});const Ar={element:1,text:3,progressingInstruction:7,comment:8,document:9},Bb=function(){return typeof window>"u"?null:window},Ub=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 s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},gl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bb();const t=Z=>Cf(Z);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==Ar.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:h}=e,x=c.prototype,g=Tr(x,"cloneNode"),v=Tr(x,"remove"),b=Tr(x,"nextSibling"),w=Tr(x,"childNodes"),y=Tr(x,"parentNode");if(typeof i=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let E,T="";const{implementation:_,createNodeIterator:I,createDocumentFragment:A,getElementsByTagName:q}=n,{importNode:K}=r;let U=gl();t.isSupported=typeof wf=="function"&&typeof y=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:J,TMPLIT_EXPR:O,DATA_ATTR:X,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:S,CUSTOM_ELEMENT:F}=hl;let{IS_ALLOWED_URI:M}=hl,P=null;const ee=Ne({},[...dl,..._s,...Is,...js,...fl]);let D=null;const $=Ne({},[...pl,...Ms,...ml,...lo]);let L=Object.seal(bf(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}})),G=null,k=null,V=!0,Q=!0,te=!1,oe=!0,se=!1,de=!0,me=!1,Me=!1,Oe=!1,Le=!1,je=!1,He=!1,ot=!0,Qe=!1;const et="user-content-";let le=!0,pt=!1,tt={},mt=null;const jt=Ne({},["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 wt=null;const Et=Ne({},["audio","video","img","source","image","track"]);let Tt=null;const Wt=Ne({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let gt=Ke,Mt=!1,Rt=null;const nn=Ne({},[ht,At,Ke],ks);let Nt=Ne({},["mi","mo","mn","ms","mtext"]),De=Ne({},["annotation-xml"]);const qe=Ne({},["title","style","font","a","script"]);let st=null;const rn=["application/xhtml+xml","text/html"],on="text/html";let Pe=null,xt=null;const sn=n.createElement("form"),Gt=function(C){return C instanceof RegExp||C instanceof Function},Pt=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xt&&xt===C)){if((!C||typeof C!="object")&&(C={}),C=ln(C),st=rn.indexOf(C.PARSER_MEDIA_TYPE)===-1?on:C.PARSER_MEDIA_TYPE,Pe=st==="application/xhtml+xml"?ks:vo,P=Ft(C,"ALLOWED_TAGS")?Ne({},C.ALLOWED_TAGS,Pe):ee,D=Ft(C,"ALLOWED_ATTR")?Ne({},C.ALLOWED_ATTR,Pe):$,Rt=Ft(C,"ALLOWED_NAMESPACES")?Ne({},C.ALLOWED_NAMESPACES,ks):nn,Tt=Ft(C,"ADD_URI_SAFE_ATTR")?Ne(ln(Wt),C.ADD_URI_SAFE_ATTR,Pe):Wt,wt=Ft(C,"ADD_DATA_URI_TAGS")?Ne(ln(Et),C.ADD_DATA_URI_TAGS,Pe):Et,mt=Ft(C,"FORBID_CONTENTS")?Ne({},C.FORBID_CONTENTS,Pe):jt,G=Ft(C,"FORBID_TAGS")?Ne({},C.FORBID_TAGS,Pe):ln({}),k=Ft(C,"FORBID_ATTR")?Ne({},C.FORBID_ATTR,Pe):ln({}),tt=Ft(C,"USE_PROFILES")?C.USE_PROFILES:!1,V=C.ALLOW_ARIA_ATTR!==!1,Q=C.ALLOW_DATA_ATTR!==!1,te=C.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=C.SAFE_FOR_TEMPLATES||!1,de=C.SAFE_FOR_XML!==!1,me=C.WHOLE_DOCUMENT||!1,Le=C.RETURN_DOM||!1,je=C.RETURN_DOM_FRAGMENT||!1,He=C.RETURN_TRUSTED_TYPE||!1,Oe=C.FORCE_BODY||!1,ot=C.SANITIZE_DOM!==!1,Qe=C.SANITIZE_NAMED_PROPS||!1,le=C.KEEP_CONTENT!==!1,pt=C.IN_PLACE||!1,M=C.ALLOWED_URI_REGEXP||yf,gt=C.NAMESPACE||Ke,Nt=C.MATHML_TEXT_INTEGRATION_POINTS||Nt,De=C.HTML_INTEGRATION_POINTS||De,L=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Gt(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Gt(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Q=!1),je&&(Le=!0),tt&&(P=Ne({},fl),D=[],tt.html===!0&&(Ne(P,dl),Ne(D,pl)),tt.svg===!0&&(Ne(P,_s),Ne(D,Ms),Ne(D,lo)),tt.svgFilters===!0&&(Ne(P,Is),Ne(D,Ms),Ne(D,lo)),tt.mathMl===!0&&(Ne(P,js),Ne(D,ml),Ne(D,lo))),C.ADD_TAGS&&(P===ee&&(P=ln(P)),Ne(P,C.ADD_TAGS,Pe)),C.ADD_ATTR&&(D===$&&(D=ln(D)),Ne(D,C.ADD_ATTR,Pe)),C.ADD_URI_SAFE_ATTR&&Ne(Tt,C.ADD_URI_SAFE_ATTR,Pe),C.FORBID_CONTENTS&&(mt===jt&&(mt=ln(mt)),Ne(mt,C.FORBID_CONTENTS,Pe)),le&&(P["#text"]=!0),me&&Ne(P,["html","head","body"]),P.table&&(Ne(P,["tbody"]),delete G.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=C.TRUSTED_TYPES_POLICY,T=E.createHTML("")}else E===void 0&&(E=Ub(h,o)),E!==null&&typeof T=="string"&&(T=E.createHTML(""));ut&&ut(C),xt=C}},Lt=Ne({},[..._s,...Is,...jb]),Dt=Ne({},[...js,...Mb]),be=function(C){let j=y(C);(!j||!j.tagName)&&(j={namespaceURI:gt,tagName:"template"});const W=vo(C.tagName),he=vo(j.tagName);return Rt[C.namespaceURI]?C.namespaceURI===At?j.namespaceURI===Ke?W==="svg":j.namespaceURI===ht?W==="svg"&&(he==="annotation-xml"||Nt[he]):!!Lt[W]:C.namespaceURI===ht?j.namespaceURI===Ke?W==="math":j.namespaceURI===At?W==="math"&&De[he]:!!Dt[W]:C.namespaceURI===Ke?j.namespaceURI===At&&!De[he]||j.namespaceURI===ht&&!Nt[he]?!1:!Dt[W]&&(qe[W]||!Lt[W]):!!(st==="application/xhtml+xml"&&Rt[C.namespaceURI]):!1},Ee=function(C){Sr(t.removed,{element:C});try{y(C).removeChild(C)}catch{v(C)}},B=function(C,j){try{Sr(t.removed,{attribute:j.getAttributeNode(C),from:j})}catch{Sr(t.removed,{attribute:null,from:j})}if(j.removeAttribute(C),C==="is")if(Le||je)try{Ee(j)}catch{}else try{j.setAttribute(C,"")}catch{}},z=function(C){let j=null,W=null;if(Oe)C="<remove></remove>"+C;else{const Re=ul(C,/^[\r\n\t ]+/);W=Re&&Re[0]}st==="application/xhtml+xml"&>===Ke&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const he=E?E.createHTML(C):C;if(gt===Ke)try{j=new m().parseFromString(he,st)}catch{}if(!j||!j.documentElement){j=_.createDocument(gt,"template",null);try{j.documentElement.innerHTML=Mt?T:he}catch{}}const ye=j.body||j.documentElement;return C&&W&&ye.insertBefore(n.createTextNode(W),ye.childNodes[0]||null),gt===Ke?q.call(j,me?"html":"body")[0]:me?j.documentElement:ye},H=function(C){return I.call(C.ownerDocument||C,C,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ie=function(C){return C instanceof p&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof f)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},fe=function(C){return typeof l=="function"&&C instanceof l};function pe(Z,C,j){ao(Z,W=>{W.call(t,C,j,xt)})}const ge=function(C){let j=null;if(pe(U.beforeSanitizeElements,C,null),ie(C))return Ee(C),!0;const W=Pe(C.nodeName);if(pe(U.uponSanitizeElement,C,{tagName:W,allowedTags:P}),de&&C.hasChildNodes()&&!fe(C.firstElementChild)&&at(/<[/\w!]/g,C.innerHTML)&&at(/<[/\w!]/g,C.textContent)||C.nodeType===Ar.progressingInstruction||de&&C.nodeType===Ar.comment&&at(/<[/\w]/g,C.data))return Ee(C),!0;if(!P[W]||G[W]){if(!G[W]&&ae(W)&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,W)||L.tagNameCheck instanceof Function&&L.tagNameCheck(W)))return!1;if(le&&!mt[W]){const he=y(C)||C.parentNode,ye=w(C)||C.childNodes;if(ye&&he){const Re=ye.length;for(let we=Re-1;we>=0;--we){const xe=g(ye[we],!0);xe.__removalCount=(C.__removalCount||0)+1,he.insertBefore(xe,b(C))}}}return Ee(C),!0}return C instanceof c&&!be(C)||(W==="noscript"||W==="noembed"||W==="noframes")&&at(/<\/no(script|embed|frames)/i,C.innerHTML)?(Ee(C),!0):(se&&C.nodeType===Ar.text&&(j=C.textContent,ao([Y,J,O],he=>{j=Cr(j,he," ")}),C.textContent!==j&&(Sr(t.removed,{element:C.cloneNode()}),C.textContent=j)),pe(U.afterSanitizeElements,C,null),!1)},_e=function(C,j,W){if(ot&&(j==="id"||j==="name")&&(W in n||W in sn))return!1;if(!(Q&&!k[j]&&at(X,j))){if(!(V&&at(N,j))){if(!D[j]||k[j]){if(!(ae(C)&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,C)||L.tagNameCheck instanceof Function&&L.tagNameCheck(C))&&(L.attributeNameCheck instanceof RegExp&&at(L.attributeNameCheck,j)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(j))||j==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,W)||L.tagNameCheck instanceof Function&&L.tagNameCheck(W))))return!1}else if(!Tt[j]){if(!at(M,Cr(W,S,""))){if(!((j==="src"||j==="xlink:href"||j==="href")&&C!=="script"&&Nb(W,"data:")===0&&wt[C])){if(!(te&&!at(R,Cr(W,S,"")))){if(W)return!1}}}}}}return!0},ae=function(C){return C!=="annotation-xml"&&ul(C,F)},ue=function(C){pe(U.beforeSanitizeAttributes,C,null);const{attributes:j}=C;if(!j||ie(C))return;const W={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let he=j.length;for(;he--;){const ye=j[he],{name:Re,namespaceURI:we,value:xe}=ye,it=Pe(Re),hn=xe;let Fe=Re==="value"?hn:kb(hn);if(W.attrName=it,W.attrValue=Fe,W.keepAttr=!0,W.forceKeepAttr=void 0,pe(U.uponSanitizeAttribute,C,W),Fe=W.attrValue,Qe&&(it==="id"||it==="name")&&(B(Re,C),Fe=et+Fe),de&&at(/((--!?|])>)|<\/(style|title)/i,Fe)){B(Re,C);continue}if(W.forceKeepAttr)continue;if(!W.keepAttr){B(Re,C);continue}if(!oe&&at(/\/>/i,Fe)){B(Re,C);continue}se&&ao([Y,J,O],wr=>{Fe=Cr(Fe,wr," ")});const ls=Pe(C.nodeName);if(!_e(ls,it,Fe)){B(Re,C);continue}if(E&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!we)switch(h.getAttributeType(ls,it)){case"TrustedHTML":{Fe=E.createHTML(Fe);break}case"TrustedScriptURL":{Fe=E.createScriptURL(Fe);break}}if(Fe!==hn)try{we?C.setAttributeNS(we,Re,Fe):C.setAttribute(Re,Fe),ie(C)?Ee(C):cl(t.removed)}catch{B(Re,C)}}pe(U.afterSanitizeAttributes,C,null)},Ie=function Z(C){let j=null;const W=H(C);for(pe(U.beforeSanitizeShadowDOM,C,null);j=W.nextNode();)pe(U.uponSanitizeShadowNode,j,null),ge(j),ue(j),j.content instanceof s&&Z(j.content);pe(U.afterSanitizeShadowDOM,C,null)};return t.sanitize=function(Z){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=null,W=null,he=null,ye=null;if(Mt=!Z,Mt&&(Z="<!-->"),typeof Z!="string"&&!fe(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return Z;if(Me||Pt(C),t.removed=[],typeof Z=="string"&&(pt=!1),pt){if(Z.nodeName){const xe=Pe(Z.nodeName);if(!P[xe]||G[xe])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof l)j=z("<!---->"),W=j.ownerDocument.importNode(Z,!0),W.nodeType===Ar.element&&W.nodeName==="BODY"||W.nodeName==="HTML"?j=W:j.appendChild(W);else{if(!Le&&!se&&!me&&Z.indexOf("<")===-1)return E&&He?E.createHTML(Z):Z;if(j=z(Z),!j)return Le?null:He?T:""}j&&Oe&&Ee(j.firstChild);const Re=H(pt?Z:j);for(;he=Re.nextNode();)ge(he),ue(he),he.content instanceof s&&Ie(he.content);if(pt)return Z;if(Le){if(je)for(ye=A.call(j.ownerDocument);j.firstChild;)ye.appendChild(j.firstChild);else ye=j;return(D.shadowroot||D.shadowrootmode)&&(ye=K.call(r,ye,!0)),ye}let we=me?j.outerHTML:j.innerHTML;return me&&P["!doctype"]&&j.ownerDocument&&j.ownerDocument.doctype&&j.ownerDocument.doctype.name&&at(Sf,j.ownerDocument.doctype.name)&&(we="<!DOCTYPE "+j.ownerDocument.doctype.name+`>
|
|
124
|
+
`+we),se&&ao([Y,J,O],xe=>{we=Cr(we,xe," ")}),E&&He?E.createHTML(we):we},t.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pt(Z),Me=!0},t.clearConfig=function(){xt=null,Me=!1},t.isValidAttribute=function(Z,C,j){xt||Pt({});const W=Pe(Z),he=Pe(C);return _e(W,he,j)},t.addHook=function(Z,C){typeof C=="function"&&Sr(U[Z],C)},t.removeHook=function(Z,C){if(C!==void 0){const j=Tb(U[Z],C);return j===-1?void 0:Ab(U[Z],j,1)[0]}return cl(U[Z])},t.removeHooks=function(Z){U[Z]=[]},t.removeAllHooks=function(){U=gl()},t}var Ef=Cf();const Hb=({content:e,setRenderError:t})=>{const[n,r]=u.useState(""),o=u.useMemo(()=>Ef.sanitize(e,{USE_PROFILES:{html:!1},ALLOWED_TAGS:["br","em","strong","b","i"],ALLOWED_ATTR:[]}),[e]);return u.useEffect(()=>{r(`<!DOCTYPE html>
|
|
125
125
|
<html>
|
|
126
126
|
<head>
|
|
127
127
|
<meta charset="utf-8">
|
|
@@ -334,6 +334,6 @@ ${i}
|
|
|
334
334
|
bg-white dark:bg-gray-800 hover:shadow-md transition-shadow duration-150
|
|
335
335
|
${t?"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500 dark:ring-blue-400":"border-gray-200 dark:border-gray-700"}
|
|
336
336
|
${n?"cursor-pointer":""}
|
|
337
|
-
`,v=()=>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: ",b=e.title;return a.jsxs("div",{className:g,style:x,onClick:n,children:[a.jsxs("div",{className:"mb-1.5 flex items-center",children:[o(),a.jsx("h4",{className:"flex-grow text-sm font-semibold text-gray-700 dark:text-gray-200",title:e.title,children:b}),a.jsx("span",{className:"font-mono text-xs text-gray-500 dark:text-gray-400",children:l})]}),e.delegationInfo&&e.delegationInfo.length>0&&a.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(w=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center font-semibold text-blue-700 dark:text-blue-300",children:[a.jsx(ql,{className:"mr-2 h-4 w-4 flex-shrink-0"}),a.jsxs("span",{children:[v(),w.peerAgentName]})]}),w.subTaskId&&a.jsxs("div",{className:"mt-0.5 ml-[24px] text-xs text-blue-600 dark:text-blue-400",children:["Sub-Task:"," ",a.jsxs("span",{className:"font-mono",title:w.subTaskId,children:[w.subTaskId.substring(0,15),"..."]})]})]},w.functionCallId))}),e.data.text&&a.jsx("div",{className:"max-h-20 overflow-y-auto pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(or,{children:e.data.text})}),e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(or,{children:e.data.finalMessage})}),e.type==="TASK_COMPLETED"&&!e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-600 italic dark:text-gray-300",children:"Task completed successfully."}),e.data.errorDetails&&a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Error:"})," ",e.data.errorDetails.message]}),e.data.errorDetails.code&&a.jsxs("p",{className:"text-xs",children:["Code: ",e.data.errorDetails.code]})]}),e.data.llmCall&&c(e.data.llmCall),e.data.llmResponseToAgent&&a.jsx(d,{data:e.data.llmResponseToAgent}),e.data.toolDecision&&f(e.data.toolDecision),e.data.toolInvocationStart&&p(e.data.toolInvocationStart),e.data.toolResult&&m(e.data.toolResult),e.data.artifactNotification&&h(e.data.artifactNotification)]})},mE={genericAgentNode:lE,userNode:fE,llmNode:uE,orchestratorNode:dE,genericToolNode:cE},hE={defaultFlowEdge:aE},gE={x:16,y:0},xE=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,s]=Qp([]),[i,l,c]=em([]),{fitView:d}=tm(),{highlightedStepId:f,setHighlightedStepId:p}=Vi(),{taskIdInSidePanel:m}=Ue(),h=u.useRef([]),[x,g]=u.useState(!1),[v,b]=u.useState(null),[w,y]=u.useState(!1),E=u.useRef(null),[T,_]=u.useState(null),I=u.useRef(new gp),A=u.useMemo(()=>!e||e.length===0?{nodes:[],edges:[]}:iE(e),[e]),q=u.useMemo(()=>A.edges.length?A.edges.map(R=>{const S=R.data;let F={isAnimated:!1,animationType:"none"};if(S!=null&&S.visualizerStepId){const P=e.length-1;F=I.current.getEdgeAnimationState(S.visualizerStepId,P,e)}let M=R.id===T;return f&&(S==null?void 0:S.visualizerStepId)===f&&(M=!0),{...R,animated:F.isAnimated,data:{...S,isAnimated:F.isAnimated,animationType:F.animationType,isSelected:M}}}):[],[A.edges,e,T,f]),K=u.useCallback(()=>{o(R=>R.map(S=>{var te,oe,se,de;if(S.type!=="group")return S;const F=R.filter(me=>me.parentId===S.id);if(F.length===0)return S;let M=0,P=0;F.forEach(me=>{const Me=me.position.x+_t,Oe=me.position.y+Ye;M=Math.max(M,Me),P=Math.max(P,Oe)});const ee=M+ur,D=P+Vt;let $=0;const L=S.id.split("_");if(L.length>2){const me=L.find(Me=>Me.startsWith("subflow"));if(me){const Me=parseInt(me.replace("subflow",""));isNaN(Me)||($=Me)}}const W=_t+2*ur+$*50,k=Math.max(ee,W),G=parseInt(((oe=(te=S.style)==null?void 0:te.width)==null?void 0:oe.toString().replace("px",""))||"0"),Q=parseInt(((de=(se=S.style)==null?void 0:se.height)==null?void 0:de.toString().replace("px",""))||"0");return G!==k||Q!==D?{...S,style:{...S.style,width:`${k}px`,height:`${D}px`}}:S}))},[o]);u.useEffect(()=>{o(A.nodes),l(q),K()},[A.nodes,q,o,l,K]);const U=u.useCallback((R,S)=>i.find(F=>F.source===R&&(S?F.sourceHandle===S:!0))||null,[i]),Y=u.useCallback((R,S)=>{var M;g(!0);const F=(M=S.data)==null?void 0:M.visualizerStepId;if(F){const P=e.find(ee=>ee.id===F);P&&(_(S.id),t?p(F):(p(F),b(P),y(!0)))}},[e,t,p]),J=u.useCallback(R=>{switch(R.type){case"userNode":{const S=R.data;return S!=null&&S.isTopNode?["user-bottom-output"]:S!=null&&S.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[`${R.id}-tool-bottom-output`];default:return[]}},[]),O=u.useCallback(()=>{y(!1),b(null)},[]),X=u.useCallback((R,S)=>{if(g(!0),S.type==="group"){p(null),_(null),O();return}const F=J(S);let M=null;for(const P of F)if(M=U(S.id,P),M)break;if(!M&&S.type==="userNode"){const P=S.data;P!=null&&P.isBottomNode&&(M=i.find(ee=>ee.target===S.id)||null)}M&&Y(R,M)},[J,p,O,U,i,Y]),N=u.useCallback(R=>{R!=null&&R.isTrusted&&g(!0)},[]);return u.useEffect(()=>{g(!1)},[m]),u.useEffect(()=>{!n&&d&&r.length>0&&h.current!==e&&x===!1&&(d({duration:200,padding:.1,maxZoom:1.2}),h.current=e)},[r.length,d,e,n,x]),u.useEffect(()=>{if(o(R=>R.map(S=>{var ee;const F=((ee=S.data)==null?void 0:ee.visualizerStepId)&&S.data.visualizerStepId===f,M=A.nodes.find(D=>D.id===S.id),P=(M==null?void 0:M.style)||{};return{...S,style:{...P,boxShadow:F?"0px 4px 12px rgba(0, 0, 0, 0.2)":P.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}})),f){const R=q.find(S=>{const F=S.data;return(F==null?void 0:F.visualizerStepId)===f});R&&_(R.id)}else _(null)},[f,o,A.nodes,q]),!e||e.length===0?a.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."}):A.nodes.length===0&&e.length>0?a.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:"Generating flow chart..."}):a.jsxs("div",{style:{height:"100%",width:"100%"},className:"relative",children:[a.jsxs(nm,{nodes:r,edges:i.map(R=>({...R,markerEnd:{type:im.ArrowClosed,color:"#888"}})),onNodesChange:s,onEdgesChange:c,onEdgeClick:Y,onNodeClick:X,onPaneClick:()=>{p(null),_(null),O()},onMoveStart:N,nodeTypes:mE,edgeTypes:hE,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:[a.jsx(rm,{}),a.jsx(om,{className:oh()}),a.jsx(sm,{position:"top-right",className:"flex items-center space-x-4",children:a.jsx("div",{ref:E})})]}),a.jsx(Dw,{isOpen:w,onClose:O,anchorRef:E,offset:gE,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:v&&a.jsx(pE,{step:v,variant:"popover"})})]})},vE=e=>a.jsx(Jp,{children:a.jsx(xE,{...e})}),yp=e=>{var t,n,r,o;if(e.events&&e.events.length>0){const s=e.events[0];if((o=(r=(n=(t=s.full_payload)==null?void 0:t.params)==null?void 0:n.message)==null?void 0:r.metadata)!=null&&o.parentTaskId)return s.full_payload.params.message.metadata.parentTaskId}},kr=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},Sp=(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 s=[...o.events||[]];for(const i in t){const l=t[i];if(l.taskId===e)continue;yp(l)===e&&(s=s.concat(Sp(l.taskId,t,n,r+1)))}return s},wE=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,s=new Map,i=(N,R)=>(r.agents[N]||(r.agents[N]={agentName:R,instanceId:N,displayName:R,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[N]),l=new Map,c=Sp(n.taskId,t,l,0);if(c.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const d=c.sort((N,R)=>new Date(kr(N)).getTime()-new Date(kr(R)).getTime()),f=[];let p,m="",h,x,g=[],v=null,b;const w=new Map,y=new Map,E=new Map,T=N=>{if(m.trim()&&h&&x){const R=m.trim();let S=n.taskId;if(g.length>0){const P=g[0].split("-");P.length>2&&P[1]!=="global"&&(S=P.slice(1,P.length-1).join("-"))}else N&&(S=N);const F=l.get(S)??0,M=w.get(S)||E.get(S);f.push({id:`vstep-agenttext-${f.length}-${g[0]||"unknown"}`,type:"AGENT_RESPONSE_TEXT",timestamp:x,title:`${h}: Response`,source:h,target:"User",data:{text:R},rawEventIds:[...g],isSubTaskStep:F>0,nestingLevel:F,owningTaskId:S,functionCallId:M}),v=R}m="",h=void 0,x=void 0,g=[],b=void 0};d.forEach((N,R)=>{var k,G,Q,te,oe,se,de,me,Me,Oe,Le,je,He,ot,Qe,et,le,pt,tt,mt,jt,wt,Et,Tt,Wt,ht,At,Ke,gt,Mt,Rt,nn,Nt,De,qe,st,rn,on,Pe,xt,sn,Gt,Pt,Lt,Dt;const S=kr(N),F=`raw-${N.task_id||"global"}-${R}`,M=N.full_payload,P=N.task_id||n.taskId,ee=l.get(P)??0;let D=N.source_entity||"UnknownAgent";(Q=(G=(k=M==null?void 0:M.params)==null?void 0:k.message)==null?void 0:G.metadata)!=null&&Q.agent_name?D=M.params.message.metadata.agent_name:(oe=(te=M==null?void 0:M.result)==null?void 0:te.metadata)!=null&&oe.agent_name?D=M.result.metadata.agent_name:(Me=(me=(de=(se=M==null?void 0:M.result)==null?void 0:se.status)==null?void 0:de.message)==null?void 0:me.metadata)!=null&&Me.agent_name?D=M.result.status.message.metadata.agent_name:(je=(Le=(Oe=M==null?void 0:M.result)==null?void 0:Oe.artifact)==null?void 0:Le.metadata)!=null&&je.agent_name&&(D=M.result.artifact.metadata.agent_name);let $;if(ee>0?$=w.get(P):$=E.get(P),N.direction==="request"&&ee>0){const be=(He=M.params)==null?void 0:He.metadata,Ee=be==null?void 0:be.function_call_id,B=N.task_id;if(B&&Ee){w.set(B,Ee);return}}if(N.direction==="request"&&ee===0&&N.task_id===n.taskId){T(P),v=null;const be=M.params;let Ee="User request";if((ot=be==null?void 0:be.message)!=null&&ot.parts){const B=be.message.parts.filter(z=>z.kind==="text"&&z.text);B.length>0&&(Ee=B[B.length-1].text)}f.push({id:`vstep-userreq-${f.length}-${F}`,type:"USER_REQUEST",timestamp:S,title:"User Input",source:"User",target:N.target_entity||D,data:{text:Ee},rawEventIds:[F],isSubTaskStep:!1,nestingLevel:0,owningTaskId:P});return}if(N.direction==="status-update"&&(M!=null&&M.result)){const be=M.result,Ee=(Qe=be.status)==null?void 0:Qe.message,B=Ee==null?void 0:Ee.metadata;let z;const V=!!(B!=null&&B.forwarded_from_peer);V?z=B.forwarded_from_peer:(et=be.metadata)!=null&&et.agent_name?z=be.metadata.agent_name:B!=null&&B.agent_name?z=B.agent_name:z=N.source_entity||"Agent";const ie=`${z}:${P}`;if(!V&&(Ee!=null&&Ee.parts))for(const fe of Ee.parts){if(fe.kind==="data"){const pe=fe.data;pe.type==="agent_progress_update"?p=pe.status_text:pe.type==="artifact_creation_progress"&&(p=`Saving artifact: ${pe.filename} (${pe.bytes_saved} bytes)`)}if(fe.kind==="data"){T(P);const ge=fe.data;switch(ge==null?void 0:ge.type){case"agent_progress_update":{f.push({id:`vstep-progress-${f.length}-${F}`,type:"AGENT_RESPONSE_TEXT",timestamp:S,title:`${z}: Progress Update`,source:z,target:"User",data:{text:ge.status_text},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"llm_invocation":{const ae=ge.request;let ue="System-initiated LLM call";if(ae!=null&&ae.contents&&Array.isArray(ae.contents)&&ae.contents.length>0){const Z=[...ae.contents].reverse().find(C=>C.role==="user");Z&&Z.parts&&(ue=Z.parts.map(C=>C.text||"").join(`
|
|
338
|
-
`).trim())}const Ie={modelName:(ae==null?void 0:ae.model)||"Unknown Model",promptPreview:ue||"No text in user prompt."};i(ie,z),o.set(ie,{timestamp:S,modelName:Ie.modelName}),f.push({id:`vstep-llmcall-${f.length}-${F}`,type:"AGENT_LLM_CALL",timestamp:S,title:`${z}: LLM Call`,source:z,target:"LLM",data:{llmCall:Ie},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"llm_response":{const ae=o.get(ie);if(ae){const C=new Date(S).getTime()-new Date(ae.timestamp).getTime();i(ie,z).llmCalls.push({modelName:ae.modelName,durationMs:C,timestamp:ae.timestamp}),o.delete(ie)}const ue=ge.data,Ie=(le=ue.content)==null?void 0:le.parts,Z=Ie==null?void 0:Ie.filter(C=>C.function_call);if(Z&&Z.length>0){T(P),v=null,E.delete(P);const C=Z.map(xe=>{var it;return{functionCallId:xe.function_call.id,toolName:xe.function_call.name,toolArguments:xe.function_call.args||{},isPeerDelegation:(it=xe.function_call.name)==null?void 0:it.startsWith("peer_")}}),j={decisions:C,isParallel:C.length>1},
|
|
339
|
-
`))||"",j={responsePreview:C.substring(0,200)+(C.length>200?"...":""),isFinalResponse:(ue==null?void 0:ue.partial)===!1};f.push({id:`vstep-llmrespagent-${f.length}-${F}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:S,title:`${z}: LLM Response`,source:"LLM",target:z,data:{llmResponseToAgent:j},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$})}break}case"tool_invocation_start":{const ae={functionCallId:ge.function_call_id,toolName:ge.tool_name,toolArguments:ge.tool_args,isPeerInvocation:(pt=ge.tool_name)==null?void 0:pt.startsWith("peer_")};f.push({id:`vstep-toolinvokestart-${f.length}-${F}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:S,title:`${z}: Executing tool ${ae.toolName}`,source:z,target:ae.toolName,data:{toolInvocationStart:ae},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"tool_result":{const ae=ge.function_call_id,ue=s.get(ae);if(ue){const Z=new Date(S).getTime()-new Date(ue.timestamp).getTime(),C=r.agents[ue.invokingAgentInstanceId];if(C){const j={toolName:ue.toolName,durationMs:Z,isPeer:ue.isPeer,timestamp:ue.timestamp,peerAgentName:ue.isPeer?ue.toolName.substring(5):void 0,subTaskId:ue.subTaskId,parallelBlockId:ue.parallelBlockId};C.toolCalls.push(j)}s.delete(ae)}const Ie={toolName:ge.tool_name,functionCallId:ae,resultData:ge.result_data,isPeerResponse:(tt=ge.tool_name)==null?void 0:tt.startsWith("peer_")};f.push({id:`vstep-toolresult-${f.length}-${F}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:S,title:`${z}: Tool Result - ${Ie.toolName}`,source:Ie.toolName,target:z,data:{toolResult:Ie},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}}}else fe.kind==="text"&&fe.text&&(h&&h!==z&&(T(P),v=null),h||(h=z,x=S,b=V),m+=fe.text,g.push(F))}return}if(N.direction==="artifact_update"&&((mt=M==null?void 0:M.result)!=null&&mt.artifact)){T(P);const be=M.result.artifact,Ee=((jt=be.metadata)==null?void 0:jt.agent_name)||N.source_entity||"Agent";let B;if(be.parts&&be.parts.length>0){const V=be.parts[0];V.kind==="file"?B=V.file.mimeType||void 0:(wt=V.metadata)!=null&&wt.mime_type&&(B=V.metadata.mime_type)}const z={artifactName:be.name||"Unnamed Artifact",version:typeof((Et=be.metadata)==null?void 0:Et.version)=="number"?be.metadata.version:void 0,description:be.description||void 0,mimeType:B};f.push({id:`vstep-artifactnotify-${f.length}-${F}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:S,title:`${Ee}: Artifact Update - ${z.artifactName}`,source:Ee,target:"User/System",data:{artifactNotification:z},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});return}if(["response","task"].includes(N.direction)&&((Wt=(Tt=M==null?void 0:M.result)==null?void 0:Tt.status)!=null&&Wt.state)){m.trim()&&T(P);const be=M.result,Ee=be.status.state,B=((ht=be.metadata)==null?void 0:ht.agent_name)||((gt=(Ke=(At=be.status)==null?void 0:At.message)==null?void 0:Ke.metadata)==null?void 0:gt.agent_name)||N.source_entity||"Agent";if(["completed","failed","canceled"].includes(Ee)&&ee==0){const z=Ee==="completed"?"TASK_COMPLETED":"TASK_FAILED",V=`${B}: Task ${Ee.charAt(0).toUpperCase()+Ee.slice(1)}`;let ie={},fe="";if((Mt=be.status.message)!=null&&Mt.parts){const _e=be.status.message.parts.find(ae=>ae.kind==="text");_e!=null&&_e.text&&(fe=_e.text.trim())}const pe=P===n.taskId,ge=fe&&(!pe||fe!==v);if(z==="TASK_COMPLETED")ie={finalMessage:ge?fe:void 0};else{const ae={message:ge?fe:`Task ${Ee}.`},ue=M.error;ue&&(ae.message=ue.message||ae.message,ae.code=ue.code,ue.data&&(ae.details=ue.data)),be.error&&(ae.message=be.error.message||ae.message,ae.code=be.error.code||ae.code,ae.details=be.error.data||ae.details),ie={errorDetails:ae}}f.push({id:`vstep-${Ee}-${f.length}-${F}`,type:z,timestamp:S,title:V,source:B,target:"User",data:ie,rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$}),pe&&(v=null);return}}const L=N.direction==="status-update"&&((De=(Nt=(nn=(Rt=M==null?void 0:M.result)==null?void 0:Rt.status)==null?void 0:nn.message)==null?void 0:Nt.parts)==null?void 0:De.some(be=>be.kind==="text"));let W=N.source_entity;(on=(rn=(st=(qe=M==null?void 0:M.result)==null?void 0:qe.status)==null?void 0:st.message)==null?void 0:rn.metadata)!=null&&on.forwarded_from_peer?W=M.result.status.message.metadata.forwarded_from_peer:(xt=(Pe=M==null?void 0:M.result)==null?void 0:Pe.metadata)!=null&&xt.agent_name?W=M.result.metadata.agent_name:(Lt=(Pt=(Gt=(sn=M==null?void 0:M.result)==null?void 0:sn.status)==null?void 0:Gt.message)==null?void 0:Pt.metadata)!=null&&Lt.agent_name&&(W=M.result.status.message.metadata.agent_name),m.trim()&&h&&(!L||L&&W!==h)&&(T(P),l.get(((Dt=g[0])==null?void 0:Dt.split("-")[1])||n.taskId)===0&&!b&&(v=null))});const _=d.length>0&&d[d.length-1].task_id||n.taskId;T(_);const I=d[0]?kr(d[0]):n.firstSeen.toISOString();let A,q="working";const K=f.filter(N=>N.owningTaskId===n.taskId),U=K.length>0?K[K.length-1]:null;if(U&&(U.type==="TASK_COMPLETED"?(q="completed",A=U.timestamp):U.type==="TASK_FAILED"&&(q="failed",A=U.timestamp)),q==="working"&&d.length>0){const N=d[d.length-1];t[N.task_id||n.taskId]}let Y;I&&A&&(Y=new Date(A).getTime()-new Date(I).getTime()),["completed","failed","canceled","rejected"].includes(q)&&(p=void 0);const J={taskId:n.taskId,initialRequestText:n.initialRequestText,status:q,currentStatusText:p,startTime:I,endTime:A,durationMs:Y,steps:f};J.steps.forEach((N,R)=>{if(N.type==="TASK_COMPLETED"){let S="";for(let F=R-1;F>=0;F--){const M=J.steps[F];if(M.type!=="AGENT_RESPONSE_TEXT"||M.source!==N.source)break;S=M.data.text+S}N.data.finalMessage&&(S+=N.data.finalMessage),N.data.finalMessage=S.trim()||void 0}}),Object.values(r.agents).forEach(N=>{N.totalLlmTimeMs=N.llmCalls.reduce((P,ee)=>P+ee.durationMs,0);const R=N.toolCalls.filter(P=>!P.parallelBlockId),S=new Map;N.toolCalls.forEach(P=>{P.parallelBlockId&&(S.has(P.parallelBlockId)||S.set(P.parallelBlockId,[]),S.get(P.parallelBlockId).push(P))});const F=R.reduce((P,ee)=>P+ee.durationMs,0);let M=0;S.forEach(P=>{if(P.length>0){const ee=Math.min(...P.map($=>new Date($.timestamp).getTime())),D=Math.max(...P.map($=>new Date($.timestamp).getTime()+$.durationMs));M+=D-ee}}),N.totalToolTimeMs=F+M});const O=new Map;Object.values(r.agents).forEach(N=>{O.has(N.agentName)||O.set(N.agentName,[]),O.get(N.agentName).push(N)}),O.forEach(N=>{N.length>1&&(N.sort((R,S)=>{const F=M=>{const P=[...M.llmCalls.map(ee=>new Date(ee.timestamp).getTime()),...M.toolCalls.map(ee=>new Date(ee.timestamp).getTime())];return P.length>0?Math.min(...P):1/0};return F(R)-F(S)}),N.forEach((R,S)=>{R.displayName=`${R.agentName} (${S+1})`}))});const X=new Map;return Object.values(r.agents).forEach(N=>{const R=N.instanceId.split(":").slice(1).join(":");R&&X.set(R,N.displayName)}),Object.values(r.agents).forEach(N=>{N.toolCalls.forEach(R=>{if(R.isPeer&&R.subTaskId){const S=X.get(R.subTaskId);S&&(R.peerAgentName=S)}})}),Y!==void 0&&(r.overall.totalTaskDurationMs=Y),J.performanceReport=r,J},bE=({items:e,bottomItems:t,activeItem:n,onItemChange:r,onHeaderClick:o})=>{const s=i=>{r(i)};return a.jsxs("aside",{className:"flex h-screen w-[100px] flex-col border-r border-[var(--color-secondary-w70)] bg-[var(--color-primary-w100)]",children:[a.jsx(SE,{onClick:o}),a.jsx(EE,{items:e,bottomItems:t,activeItem:n,onItemClick:s})]})},yE=a.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:[a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]}),SE=({onClick:e})=>a.jsx("div",{className:"flex h-[80px] min-h-[80px] cursor-pointer items-center justify-center border-b",onClick:e,children:a.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-full",children:yE})}),CE=()=>{const{currentTheme:e,toggleTheme:t}=Zu(),n=`Toggle theme (currently ${e})`;return a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:a.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:a.jsx(Xl,{className:"mb-1 w-6 h-6"})})}),a.jsx(Oi,{side:"right",children:n})]})},EE=({items:e,bottomItems:t,activeItem:n,onItemClick:r})=>a.jsxs("nav",{className:"flex flex-1 flex-col",role:"navigation","aria-label":"Main navigation",children:[a.jsx("ul",{className:"space-y-1",children:e.map(o=>a.jsxs("li",{children:[a.jsx(Pl,{item:o,isActive:n===o.id,onItemClick:r}),o.showDividerAfter&&a.jsx("div",{className:"mx-4 my-3 border-t border-[var(--color-secondary-w70)]"})]},o.id))}),t&&t.length>0&&a.jsx("div",{className:"flex-1"}),t&&t.length>0&&a.jsx("ul",{className:"space-y-1",children:t.map(o=>a.jsx("li",{className:"my-4",children:o.id==="theme-toggle"?a.jsx(CE,{}):a.jsx(Pl,{item:o,isActive:n===o.id,onItemClick:r},o.id)},o.id))})]}),Pl=({item:e,isActive:t,onItemClick:n})=>{const{id:r,label:o,icon:s,disabled:i}=e,l=()=>{!i&&n&&n(r)},c=d=>{(d.key==="Enter"||d.key===" ")&&l()};return a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:n?l:void 0,onKeyDown:n?c:void 0,disabled:i,className:Ce("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:[a.jsx(s,{className:Ce("mb-1 h-6 w-6",t&&"text-[var(--color-brand-wMain)]")}),a.jsx("span",{className:"text-center text-[13px] leading-tight",children:o})]})}),a.jsx(Oi,{side:"right",children:o})]})},Ll=[{id:"chat",label:"Chat",icon:am},{id:"agentMesh",label:"Agents",icon:Zl}],Dl=[{id:"theme-toggle",label:"Theme",icon:Xl,onClick:()=>{}}],Cp=({title:e,breadcrumbs:t,tabs:n,buttons:r,leadingAction:o})=>a.jsxs("div",{className:"relative flex max-h-[80px] min-h-[80px] w-full items-center border-b px-8",children:[t&&t.length>0&&a.jsx("div",{className:"absolute top-1 left-8 flex items-center h-8",children:t.map((s,i)=>a.jsxs(zt.Fragment,{children:[i>0&&a.jsx("span",{className:"mx-1",children:a.jsx(lm,{size:16})}),s.onClick?a.jsx(Ae,{variant:"link",className:"p-0 m-0",onClick:s.onClick,children:s.label}):a.jsx("div",{children:s.label})]},i))}),o&&a.jsx("div",{className:"mr-4 flex items-center pt-[35px]",children:o}),a.jsx("div",{className:"truncate text-xl text-nowrap pt-[35px]",children:e}),n&&n.length>0&&a.jsx("div",{className:"ml-8 flex items-center pt-[35px]",role:"tablist",children:n.map((s,i)=>a.jsxs("button",{role:"tab","aria-selected":s.isActive,onClick:s.onClick,className:`relative cursor-pointer px-4 py-3 font-medium transition-colors duration-200 ${s.isActive?"border-b-2 border-[var(--color-brand-wMain)] font-semibold":""} ${i>0?"ml-6":""}`,children:[s.label,s.isActive&&a.jsx("div",{className:"absolute right-0 bottom-0 left-0 h-0.5"})]},s.id))}),a.jsx("div",{className:"flex-1"}),r&&r.length>0&&a.jsx("div",{className:"flex items-center gap-2",children:r.map((s,i)=>a.jsx(zt.Fragment,{children:s},i))})]}),lt=({label:e,value:t,icon:n,fullWidthValue:r=!1})=>t==null||typeof t=="string"&&!t.trim()?null:a.jsxs("div",{className:`flex mb-1.5 text-sm ${r?"flex-col items-start":"items-center"}`,children:[a.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center text-sm font-semibold text-nowrap",children:[n&&a.jsx("span",{className:"mr-2",children:n}),e,":"]}),a.jsx("div",{className:`text-accent-foreground text-sm ${r?"mt-1 w-full":"truncate"}`,title:typeof t=="string"?t:void 0,children:t})]}),TE=({agent:e,isExpanded:t,onToggleExpand:n})=>{const r=l=>!l||Object.keys(l).length===0?a.jsx("span",{className:"text-sm",children:"N/A"}):a.jsx("ul",{className:"list-inside list-disc pl-1",children:Object.entries(l).map(([c,d])=>a.jsxs("li",{className:"text-sm",children:[a.jsxs("span",{className:"capitalize",children:[c.replace(/_/g," "),":"]})," ",d?"Yes":"No"]},c))}),o=(l,c="None")=>!l||l.length===0?a.jsx("span",{children:c}):l.map(d=>a.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:d},d)),s=l=>!l||l.length===0?a.jsx("span",{children:"No skills listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold",children:c.name}),a.jsx("p",{children:c.description})]},c.id||c.name))}),i=l=>!l||l.length===0?a.jsx("span",{children:"No tools listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold text-foreground",children:c.name}),a.jsx("p",{className:"mb-1",children:c.description})]},c.name))});return a.jsx("div",{className:"h-[400px] cursor-pointer w-full sm:w-[380px] flex-shrink-0 bg-card rounded-lg",onClick:n,role:"button",tabIndex:0,"aria-expanded":t,children:a.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:[a.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:[a.jsx("div",{className:"flex items-center p-4",children:a.jsxs("div",{className:"flex min-w-0 items-center",children:[a.jsx(Zl,{className:"mr-3 h-8 w-8 flex-shrink-0 text-[var(--color-brand-wMain)]"}),a.jsx("div",{className:"min-w-0",children:a.jsx("h2",{className:"truncate text-xl font-semibold",title:e.name,children:e.displayName||e.name})})]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-3 overflow-y-auto p-4",children:[a.jsx("div",{className:"mb-2 line-clamp-4 text-base",children:e.description||"No description provided."}),a.jsx(lt,{label:"Version",value:e.version,icon:a.jsx(ha,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&a.jsx(lt,{label:"Key Capabilities",value:r(e.capabilities),icon:a.jsx(ga,{size:14}),fullWidthValue:!0})]}),a.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for details"})]}),a.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:[a.jsx("div",{className:"flex items-center p-3",children:a.jsxs("h3",{className:"text-md truncate font-semibold",title:e.name,children:["Details: ",e.displayName||e.name]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-1.5 overflow-y-auto p-3 text-xs",children:[a.jsx(lt,{label:"Name",value:e.name,icon:a.jsx(wi,{size:14})}),a.jsx(lt,{label:"Description",value:e.description,icon:a.jsx(cm,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Version",value:e.version,icon:a.jsx(ha,{size:14})}),a.jsx(lt,{label:"Endpoint",value:e.url||"N/A",icon:a.jsx(ql,{size:14})}),a.jsx(lt,{label:"Docs",value:e.documentationUrl?a.jsx("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"break-all",children:"View Docs"}):"N/A",icon:a.jsx(Ul,{size:14})}),e.provider&&a.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[a.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Provider"}),a.jsx(lt,{label:"Name",value:e.provider.organization}),a.jsx(lt,{label:"URL",value:e.provider.url||"N/A"})]}),a.jsx(lt,{label:"Capabilities",value:r(e.capabilities),icon:a.jsx(ga,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Input Modes",value:o(e.defaultInputModes),icon:a.jsx(xa,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Output Modes",value:o(e.defaultOutputModes),icon:a.jsx(xa,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Skills",value:s(e.skills),icon:a.jsx(um,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Tools Info",value:i(e.tools),icon:a.jsx(Wl,{size:14}),fullWidthValue:!0}),a.jsx("div",{className:"text-2xs mt-1.5 pt-1.5",children:a.jsx(lt,{label:"A2A Protocol",value:e.protocolVersion})})]}),a.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for summary"})]})]})})},ui=({agents:e})=>{const[t,n]=u.useState(null),[r,o]=u.useState(""),s=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 a.jsx("div",{children:e.length===0?a.jsx("div",{className:"flex h-[calc(100vh-250px)] items-center justify-center",children:"No agents discovered in the current namespace."}):a.jsxs("div",{className:"mx-auto mt-[50px] ml-[50px]",children:[a.jsx("div",{className:"my-4",children:a.jsx("input",{type:"text","data-testid":"agent-search-input",placeholder:"Search...",value:r,onChange:l=>o(l.target.value),className:"bg-background rounded-md border px-3 py-2"})}),i.length===0&&r?a.jsxs("div",{className:"flex h-[calc(100vh-250px)] flex-col items-center justify-center gap-6",children:["No agents match your search.",a.jsx(Ae,{variant:"outline",title:"Clear Search",onClick:()=>o(""),children:"Clear Search"})]}):a.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:a.jsx("div",{className:"flex flex-wrap gap-10",children:i.map(l=>a.jsx(TE,{agent:l,isExpanded:t===l.name,onToggleExpand:()=>s(l.name)},l.name))})})]})})},Ep={LAYOUT:"layout"};class AE{constructor(){ua(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:Ep.LAYOUT,id:"cards",label:"Cards",icon:dm,priority:100,render:t=>a.jsx(ui,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const Tp=new AE,NE=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=Tp.getPluginsByType(Ep.LAYOUT);return r&&r.length>1?a.jsxs("div",{className:`flex items-center space-x-1 ${n}`,children:[a.jsx("span",{className:"text-sm font-semibold",children:"Layout:"}),a.jsx("div",{className:"flex gap-1 rounded-sm p-1",children:r.map(o=>{const s=o.icon,i=e===o.id;return a.jsxs(Ae,{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:[s&&a.jsx(s,{size:14}),a.jsx("span",{children:o.label})]},o.id)})})]}):null},Ol={CARDS:"cards"};function kE(){const{agents:e,agentsLoading:t,agentsError:n,agentsRefetch:r}=Ue(),[o,s]=u.useState("cards");if(t)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx("div",{children:"Loading agents..."})})});if(n)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx(oa,{variant:"error",message:`Error loading agents. ${n}`})})});const i=()=>{if(o===Ol.CARDS)return a.jsx(ui,{agents:e});const l=Tp.getPluginById(o);return l?l.render({agents:e}):(console.warn(`Layout ${o} not found, falling back to cards layout`),a.jsx(ui,{agents:e}))};return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(Cp,{title:"Agents",buttons:[a.jsxs(Ae,{variant:"ghost",title:"Refresh Agents",onClick:()=>r(),children:[a.jsx(Yl,{className:"size-4"}),"Refresh Agents"]})]}),a.jsxs("div",{className:`relative flex-1 p-4 ${o===Ol.CARDS?"":"bg-[var(--muted)] dark:bg-[var(--color-bg-wMain)]"}`,children:[a.jsx("div",{className:"absolute right-8 z-20 flex items-center space-x-4",children:a.jsx(NE,{currentLayout:o,onLayoutChange:s})}),i()]})]})}const _E=({isOpen:e,onClose:t,onConfirm:n,sessionName:r})=>e?a.jsx(Go,{open:e,onOpenChange:t,children:a.jsxs(Vo,{children:[a.jsxs(Yo,{children:[a.jsx(Ko,{children:"Are you sure?"}),a.jsxs(qo,{children:["This action cannot be undone. This will permanently delete the chat session: ",a.jsx("strong",{children:r}),"."]})]}),a.jsxs(Nv,{children:[a.jsx(Ae,{variant:"outline",onClick:t,children:"Cancel"}),a.jsx(Ae,{variant:"destructive",onClick:n,children:"Delete"})]})]})}):null,co=4,di={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},IE={chatPanelSizes:{...di.chatPanelSizes,min:50},sidePanelSizes:{...di.sidePanelSizes,max:50}};function jE(){var $;const{agents:e,sessionId:t,messages:n,setMessages:r,selectedAgentName:o,setSelectedAgentName:s,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,openSidePanelTab:c,setTaskIdInSidePanel:d,isResponding:f,latestStatusText:p,sessionToDelete:m,closeSessionDeleteModal:h,confirmSessionDelete:x}=Ue(),{isTaskMonitorConnected:g,isTaskMonitorConnecting:v,taskMonitorSseError:b,connectTaskMonitorStream:w}=Vi(),[y,E]=u.useState(!0),[T,_]=u.useState(!1),I=Xu(),[A,q]=u.useState(!1),K=u.useRef(null),U=u.useRef(null),Y=u.useRef(null),{chatPanelSizes:J,sidePanelSizes:O}=u.useMemo(()=>y?di:IE,[y]),X=u.useCallback(L=>{if(_(!0),U.current)if(L)U.current.resize(co);else{const W=Y.current||O.default;U.current.resize(W)}setTimeout(()=>_(!1),300)},[O.default]),N=u.useCallback(()=>{l(!0)},[l]),R=u.useCallback(()=>{l(!1)},[l]),S=u.useCallback(L=>{L>co+1&&(Y.current=L)},[]),F=u.useCallback(()=>{E(!y)},[y]);u.useEffect(()=>{U.current&&i&&U.current.resize(co);const L=()=>{if(U.current&&i){_(!0);const W=Y.current||O.default;U.current.resize(W),l(!1),setTimeout(()=>_(!1),300)}};return window.addEventListener("expand-side-panel",L),()=>{window.removeEventListener("expand-side-panel",L)}},[i,l,O.default]),u.useEffect(()=>{if(!o&&e.length>0){const L=e.find(Q=>Q.name==="OrchestratorAgent"),W=L?L.name:e[0].name;s(W);const k=e.find(Q=>Q.name===W),G=k!=null&&k.displayName?`Hi! I'm the ${k==null?void 0:k.displayName} Agent. How can I help?`:`Hi! I'm ${W}. How can I help?`;r(Q=>[...Q.filter(oe=>!oe.isStatusBubble),{role:"agent",kind:"message",messageId:`welcome-${Date.now()}`,parts:[{kind:"text",text:G}],isUser:!1,isComplete:!0,metadata:{sessionId:t,lastProcessedEventSequence:0}}])}},[e,o,t,r,s]);const M=u.useMemo(()=>{const L=new Map;return n.forEach((W,k)=>{W.taskId&&L.set(W.taskId,k)}),L},[n]),P=u.useMemo(()=>n.find(L=>L.isStatusBubble),[n]),ee=u.useMemo(()=>{if(!P||!P.parts)return null;const L=P.parts.find(W=>W.kind==="text");return(L==null?void 0:L.text)||null},[P]),D=u.useMemo(()=>{if(P!=null&&P.taskId)return()=>{d(P.taskId),c("workflow")}},[P==null?void 0:P.taskId,d,c]);return u.useEffect(()=>{const L=()=>{!g&&!v&&b&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),w())};return window.addEventListener("focus",L),()=>{window.removeEventListener("focus",L)}},[g,v,b,w]),a.jsxs("div",{className:"relative flex h-screen w-full flex-col overflow-hidden",children:[a.jsx("div",{className:`absolute top-0 left-0 z-20 h-screen transition-transform duration-300 ${y?"-translate-x-full":"translate-x-0"}`,children:a.jsx(zC,{onToggle:F})}),a.jsx("div",{className:`transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:a.jsx(Cp,{title:I,leadingAction:y?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{variant:"ghost",onClick:F,className:"h-10 w-10 p-0",tooltip:"Show Sessions Panel",children:a.jsx(Kl,{className:"size-5"})}),a.jsx("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),a.jsx(Ae,{variant:"ghost",onClick:()=>q(!0),className:"h-10 w-10 p-0",tooltip:"Start New Chat Session",children:a.jsx(vi,{className:"size-5"})})]}):null})}),a.jsx("div",{className:"flex min-h-0 flex-1",children:a.jsx("div",{className:`min-h-0 flex-1 overflow-x-auto transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:a.jsxs(nw,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[a.jsx(ol,{defaultSize:J.default,minSize:J.min,maxSize:J.max,id:"chat-panel",children:a.jsxs("div",{className:"flex h-full w-full flex-col py-6",children:[a.jsx(uf,{className:"text-base",ref:K,children:n.map((L,W)=>{var G;const k=!!(L.taskId&&M.get(L.taskId)===W);return a.jsx(SC,{message:L,isLastWithTaskId:k},`${((G=L.metadata)==null?void 0:G.sessionId)||"session"}-${W}-${L.isUser?"received":"sent"}`)})}),a.jsxs("div",{style:cf,children:[f&&a.jsx(ai,{statusText:(ee||p.current)??void 0,onViewWorkflow:D}),a.jsx(nb,{agents:e,scrollToBottom:($=K.current)==null?void 0:$.scrollToBottom})]})]})}),a.jsx(rw,{}),a.jsx(ol,{ref:U,defaultSize:O.default,minSize:O.min,maxSize:O.max,collapsedSize:co,collapsible:!0,onCollapse:N,onExpand:R,onResize:S,id:"chat-side-panel",className:T?"transition-all duration-300 ease-in-out":"",children:a.jsx("div",{className:"h-full",children:a.jsx(FC,{onCollapsedToggle:X,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,isSidePanelTransitioning:T})})})]})})}),a.jsx(hp,{isOpen:A,onClose:()=>q(!1)}),a.jsx(_E,{isOpen:!!m,onClose:h,onConfirm:x,sessionName:(m==null?void 0:m.name)||`Session ${m==null?void 0:m.id.substring(0,8)}`})]})}const ME=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)"}}),fi=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=Zu(),o=u.useMemo(()=>ME(r==="dark"),[r]),s=u.useMemo(()=>t===void 0||t<0?!1:t,[t]),i=u.useMemo(()=>e===null||typeof e!="object"?{value:e}:e,[e]),l=`rounded-lg border overflow-auto ${n}`.trim();return e===void 0?a.jsx("div",{className:l,children:a.jsx("span",{className:"italic",children:"No JSON data"})}):a.jsx("div",{className:l,children:a.jsx(fm,{data:i,theme:o,viewOnly:!0,collapse:s,showStringQuotes:!0,showCollectionCount:"when-closed"})})};let uo=null,fo=null;function RE({children:e}){const{fetchCsrfToken:t}=Ku(),[n,r]=u.useState(uo),[o,s]=u.useState(!uo&&!fo),[i,l]=u.useState(fo);return u.useEffect(()=>{if(uo||fo)return;let c=!0;return(async()=>{s(!0),l(null);try{let f=await ze("/api/v1/config",{credentials:"include",headers:{Accept:"application/json"}}),p;if(f.ok)p=await f.json();else{const x=await f.text();if(console.error("Initial config fetch failed:",f.status,x),f.status===403){console.log("Config fetch failed with 403, attempting to get CSRF token first...");const g=await t();if(!g)throw new Error("Failed to obtain CSRF token after config fetch failed.");if(console.log("Retrying config fetch with CSRF token..."),f=await ze("/api/v1/config",{credentials:"include",headers:{"X-CSRF-TOKEN":g,Accept:"application/json"}}),!f.ok){const v=await f.text();throw console.error("Config fetch retry failed:",f.status,v),new Error(`Failed to fetch config on retry: ${f.status} ${v}`)}p=await f.json()}else throw new Error(`Failed to fetch config: ${f.status} ${x}`)}const m=p.frontend_use_authorization??!1;m&&(console.log("Fetching CSRF token for config-related requests..."),await t());const h={configServerUrl:p.frontend_server_url,configAuthLoginUrl:p.frontend_auth_login_url,configUseAuthorization:m,configWelcomeMessage:p.frontend_welcome_message,configRedirectUrl:p.frontend_redirect_url,configCollectFeedback:p.frontend_collect_feedback,configBotName:p.frontend_bot_name,frontend_use_authorization:p.frontend_use_authorization,persistenceEnabled:p.persistence_enabled??!0};c&&(uo=h,r(h)),console.log("App config processed and set:",h)}catch(f){if(console.error("Error initializing app:",f),c){const p=f.message||"Failed to load application configuration.";fo=p,l(p)}}finally{c&&s(!1)}})(),()=>{c=!1}},[t]),n?a.jsx(Hu.Provider,{value:n,children:e}):o?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Loading Configuration..."})]})}):i?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-red-100 dark:bg-red-900",children:a.jsxs("div",{className:"rounded border border-red-400 bg-white p-4 text-center dark:bg-gray-800",children:[a.jsx("h1",{className:"text-xl font-bold text-red-700 dark:text-red-300",children:"Configuration Error"}),a.jsx("p",{className:"mt-2 text-red-600 dark:text-red-200",children:i}),a.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Please check the backend server and network connection, then refresh the page."})]})}):a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl",children:"Initializing Application..."})]})})}const PE=({children:e})=>{const{configServerUrl:t}=tn(),n=`${t}/api/v1`,[r,o]=u.useState(null),[s,i]=u.useState(!1),[l,c]=u.useState(!1),[d,f]=u.useState(null),[p,m]=u.useState({}),[h,x]=u.useState([]),[g,v]=u.useState(null),[b,w]=u.useState(0),[y,E]=u.useState(!1),T=10,_=u.useRef(null),I=u.useRef(null),A=u.useRef(null);u.useEffect(()=>{I.current=r},[r]);const q=u.useCallback(S=>{m(F=>{var D,$,L;const M=S.task_id;if(!M)return S.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",S),F;const P=F[M],ee=new Date(S.timestamp);if(P){const W=[...P.events,S].sort((k,G)=>new Date(k.timestamp).getTime()-new Date(G.timestamp).getTime());return{...F,[M]:{...P,events:W,lastUpdated:ee}}}else{let W="Task started...";if(S.direction==="request"&&(($=(D=S.full_payload)==null?void 0:D.method)!=null&&$.startsWith("message/"))){const G=S.full_payload.params;if((L=G==null?void 0:G.message)!=null&&L.parts){const Q=G.message.parts.filter(te=>te.kind==="text"&&te.text);Q.length>0&&(W=Q[Q.length-1].text)}}const k={taskId:M,initialRequestText:W,events:[S],firstSeen:ee,lastUpdated:ee};return x(G=>[M,...G.filter(Q=>Q!==M)]),{...F,[M]:k}}})},[]),K=u.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),i(!1),c(!0),f(null),w(0),E(!1),A.current&&(clearTimeout(A.current),A.current=null)},[]),U=u.useCallback(S=>{try{const F=JSON.parse(S.data);q(F)}catch(F){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",F,"Raw data:",S.data),f("Received unparseable 'a2a_message' event from server.")}},[q]),Y=u.useCallback(S=>{console.error("TaskMonitorContext: SSE connection error:",S),i(!1),c(!1),_.current&&_.current.readyState===EventSource.CLOSED?f("Task Monitor SSE connection closed by server or network issue."):f("Task Monitor SSE connection error occurred."),_.current&&(_.current.close(),_.current=null),A.current&&(clearTimeout(A.current),A.current=null)},[]),J=u.useCallback(async()=>{if(l||s){console.warn("TaskMonitorContext: Stream is already active or connecting.");return}console.log("TaskMonitorContext: Attempting to connect stream..."),i(!0);try{const S={subscription_targets:[{type:"my_a2a_messages"}]},F=await ze(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S),credentials:"include"});if(!F.ok){const L=await F.json().catch(()=>({detail:"Failed to subscribe"}));if(L.error_type==="authorization_failure"){const W=L.message||"Access denied: insufficient permissions",k=L.suggested_action?` ${L.suggested_action}`:"";throw new Error(`${W}${k}`)}else if(L.error_type==="subscription_failure"){const W=L.message||"Subscription failed",k=L.suggested_action?` ${L.suggested_action}`:"";throw new Error(`${W}${k}`)}else throw new Error(L.detail||L.message||`Subscription failed: ${F.statusText}`)}const M=await F.json();o(M.stream_id);const P=M.sse_endpoint_url.startsWith("/")?`${t||""}${M.sse_endpoint_url}`:M.sse_endpoint_url;_.current&&_.current.close();const ee=bi(),D=`${P}${ee?`?token=${ee}`:""}`,$=new EventSource(D,{withCredentials:!0});_.current=$,$.onopen=K,$.addEventListener("a2a_message",U),$.onerror=Y}catch(S){console.error("TaskMonitorContext: Error connecting stream:",S),f(S instanceof Error?S.message:String(S)),i(!1),c(!1),o(null),_.current&&(_.current.close(),_.current=null),A.current&&(clearTimeout(A.current),A.current=null)}},[n,t,l,s,K,U,Y]),O=u.useCallback(()=>{if(A.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(b>=T){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),E(!1),f(`Connection lost. Max reconnection attempts (${T}) reached.`);return}const S=2e3;console.log(`TaskMonitorContext: Attempting reconnection ${b+1}/${T} in ${S}ms...`),E(!0),w(F=>F+1),A.current=setTimeout(()=>{J()},S)},[b,J]),X=u.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),A.current&&(clearTimeout(A.current),A.current=null),_.current&&(_.current.close(),_.current=null);const S=I.current;if(S)try{await ze(`${n}/visualization/${S}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(F){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${S}`,F)}o(null),i(!1),c(!1),f(null),m({}),x([]),v(null),w(0),E(!1)},[n]);u.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),_.current&&(_.current.close(),_.current=null);const S=I.current;if(S)if(navigator.sendBeacon){const F=new FormData;navigator.sendBeacon(`${n}/visualization/${S}/unsubscribe`,F)}else ze(`${n}/visualization/${S}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(F=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",F))},[n]),u.useEffect(()=>{!l&&!s&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),J())},[]),u.useEffect(()=>{!l&&!s&&d&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),O())},[l,s,d,O]),u.useEffect(()=>()=>{A.current&&(clearTimeout(A.current),A.current=null)},[]);const N=u.useCallback(S=>{v(S)},[]),R={isTaskMonitorConnecting:s,isTaskMonitorConnected:l,taskMonitorSseError:d,monitoredTasks:p,monitoredTaskOrder:h,highlightedStepId:g,isReconnecting:y,reconnectionAttempts:b,connectTaskMonitorStream:J,disconnectTaskMonitorStream:X,setHighlightedStepId:N};return a.jsx(Gu.Provider,{value:R,children:e})},LE=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n}=tn(),r=`${n}/api/v1`,o=1*1024*1024,s=B=>new Promise((z,V)=>{const ie=new FileReader;ie.readAsDataURL(B),ie.onload=()=>z(ie.result.split(",")[1]),ie.onerror=fe=>V(fe)}),[i,l]=u.useState(""),[c,d]=u.useState([]),[f,p]=u.useState(""),[m,h]=u.useState(!1),[x,g]=u.useState([]),[v,b]=u.useState(null),w=u.useRef(null),[y,E]=u.useState(""),[T,_]=u.useState(!1),I=u.useRef(T);u.useEffect(()=>{I.current=T},[T]);const[A,q]=u.useState(null),K=u.useRef(null),U=u.useRef(!1),Y=u.useRef(null),J=u.useRef(0),{agents:O,error:X,isLoading:N,refetch:R}=hw(),{artifacts:S,isLoading:F,refetch:M}=gw(i),[P,ee]=u.useState(!0),[D,$]=u.useState("files"),[L,W]=u.useState(!1),[k,G]=u.useState(null),[Q,te]=u.useState(!1),[oe,se]=u.useState(new Set),[de,me]=u.useState(!1),[Me,Oe]=u.useState(null),[Le,je]=u.useState(null),[He,ot]=u.useState(null),[Qe,et]=u.useState(null),le=u.useCallback((B,z)=>{g(V=>{if(V.find(ge=>ge.message===B))return V;const fe=Date.now().toString(),pe={id:fe,message:B,type:z||"info"};return setTimeout(()=>{g(ge=>ge.filter(_e=>_e.id!==fe))},3e3),[...V,pe]})},[]),pt=u.useCallback(async B=>{const z=await ze(`${r}/sessions/${B}/messages`);if(!z.ok){const V=await z.json().catch(()=>({detail:"Failed to fetch session history"}));throw new Error(V.detail||`HTTP error ${z.status}`)}return z.json()},[r]),tt=u.useCallback(async B=>{const z=new FormData;z.append("file",B);try{const V=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B.name)}`,{method:"POST",body:z,credentials:"include"});if(!V.ok){const fe=await V.json().catch(()=>({detail:`Failed to upload ${B.name}`}));throw new Error(fe.detail||`HTTP error ${V.status}`)}const ie=await V.json();return le(`Artifact "${B.name}" uploaded successfully.`),await M(),ie.uri||null}catch(V){return le(`Error uploading artifact "${B.name}": ${V instanceof Error?V.message:"Unknown error"}`),null}},[r,le,M]),[mt,jt]=u.useState(null),[wt,Et]=u.useState(null),Tt=u.useCallback(async B=>{try{const z=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}`,{method:"DELETE",credentials:"include"});if(!z.ok&&z.status!==204){const V=await z.json().catch(()=>({detail:`Failed to delete ${B}`}));throw new Error(V.detail||`HTTP error ${z.status}`)}le(`File "${B}" deleted successfully.`),M()}catch(z){le(`Error deleting file "${B}": ${z instanceof Error?z.message:"Unknown error"}`)}},[r,le,M]),Wt=u.useCallback(B=>{G(B),W(!0)},[]),ht=u.useCallback(()=>{G(null),W(!1)},[]),At=u.useCallback(async()=>{k&&await Tt(k.filename),ht()},[k,Tt,ht]),Ke=u.useCallback(()=>{if(oe.size===0){le("No files selected for deletion.");return}me(!0)},[oe,le]),gt=u.useCallback(async()=>{me(!1);const B=Array.from(oe);let z=0,V=0;for(const ie of B)try{const fe=await ze(`${r}/artifacts/${encodeURIComponent(ie)}`,{method:"DELETE",credentials:"include"});if(!fe.ok&&fe.status!==204)throw new Error(`Failed to delete ${ie}`);z++}catch(fe){console.error(fe),V++}z>0&&le(`${z} files(s) deleted successfully.`),V>0&&le(`Failed to delete ${V} files(s).`),M(),se(new Set),te(!1)},[oe,r,le,M]),Mt=u.useCallback(async B=>{je(null),ot(null),et(null);try{const z=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions`,{credentials:"include"});if(!z.ok)throw new Error("Error fetching version list");const V=await z.json();if(!V||V.length===0)throw new Error("No versions available");je(V.sort((ue,Ie)=>ue-Ie));const ie=Math.max(...V);ot(ie);const fe=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions/${ie}`,{credentials:"include"});if(!fe.ok)throw new Error("Error fetching latest version content");const pe=await fe.blob(),ge=await new Promise((ue,Ie)=>{const Z=new FileReader;Z.onloadend=()=>{var C;return ue(((C=Z.result)==null?void 0:C.toString().split(",")[1])||"")},Z.onerror=Ie,Z.readAsDataURL(pe)}),_e=S.find(ue=>ue.filename===B),ae={name:B,mime_type:(_e==null?void 0:_e.mime_type)||"application/octet-stream",content:ge,last_modified:(_e==null?void 0:_e.last_modified)||new Date().toISOString()};return et(ae),ae}catch(z){return le(`Error loading preview for ${B}: ${z instanceof Error?z.message:"Unknown error"}`),null}},[r,le,S]),Rt=u.useCallback(async(B,z)=>{if(!Le||!Le.includes(z))return le(`Version ${z} is not available for ${B}.`),null;et(null);try{const V=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions/${z}`,{credentials:"include"});if(!V.ok)throw new Error(`Error fetching version ${z}`);const ie=await V.blob(),fe=await new Promise((_e,ae)=>{const ue=new FileReader;ue.onloadend=()=>{var Ie;return _e(((Ie=ue.result)==null?void 0:Ie.toString().split(",")[1])||"")},ue.onerror=ae,ue.readAsDataURL(ie)}),pe=S.find(_e=>_e.filename===B),ge={name:B,mime_type:(pe==null?void 0:pe.mime_type)||"application/octet-stream",content:fe,last_modified:(pe==null?void 0:pe.last_modified)||new Date().toISOString()};return ot(z),et(ge),ge}catch(V){return le(`Error loading version ${z}: ${V instanceof Error?V.message:"Unknown error"}`),null}},[r,le,S,Le]),nn=u.useCallback(B=>{le(`Loading preview for attached file: ${B.name}`),et(B),je(null),ot(null)},[le]),Nt=u.useCallback(B=>{ee(!1),$(B),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:B}}))},[]),De=u.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=null),w.current&&(w.current.close(),w.current=null),U.current=!1},[]),qe=u.useCallback(B=>{var Z;J.current+=1;const z=J.current;let V;try{console.log("TEST-SSE ChatProvider Raw Message:",B.data),V=JSON.parse(B.data)}catch(C){console.error("Failed to parse SSE message:",C),le("Received unparseable agent update.","error");return}if("error"in V&&V.error){const j=`Error: ${V.error.message}`;d(H=>{const he=H.filter(ye=>!ye.isStatusBubble);return he.push({role:"agent",parts:[{kind:"text",text:j}],isUser:!1,isError:!0,isComplete:!0,metadata:{messageId:`msg-${crypto.randomUUID()}`,lastProcessedEventSequence:z}}),he}),h(!1),De(),b(null);return}if(!("result"in V)||!V.result){console.warn("Received SSE message without a result or error field.",V);return}const ie=V.result;let fe=!1,pe,ge,_e;switch(ie.kind){case"task":fe=!0,pe=void 0,_e=ie.id,ie.artifacts&&ie.artifacts.length>0&&console.log("Final task has artifacts to process:",ie.artifacts);break;case"status-update":fe=ie.final,pe=(Z=ie.status)==null?void 0:Z.message,_e=ie.taskId;break;case"artifact-update":ge=ie.artifact,_e=ie.taskId;break;default:console.warn("Received unknown result kind in SSE message:",ie);return}const ae=[],ue=[];let Ie=null;if(pe!=null&&pe.parts)for(const C of pe.parts)if(C.kind==="data"){const j=C.data;if(j&&typeof j=="object"&&"type"in j)switch(j.type){case"agent_progress_update":Ie=String((j==null?void 0:j.status_text)??"Processing...");break;case"artifact_creation_progress":Ie=`Saving artifact: ${String((j==null?void 0:j.filename)??"unknown file")} (${Number((j==null?void 0:j.bytes_saved)??0)} bytes)`;break;case"tool_invocation_start":break;default:ae.push(C)}}else if(C.kind==="file"){const H=C.file,he={name:H.name||"untitled_file",mime_type:H.mimeType};"bytes"in H&&H.bytes?he.content=H.bytes:"uri"in H&&H.uri&&(he.uri=H.uri),ue.push(he)}else ae.push(C);Ie&&(Y.current=Ie),d(C=>{var Re;const j=[...C];let H=j[j.length-1];H!=null&&H.isStatusBubble&&(j.pop(),H=j[j.length-1]);const he=ae.find(we=>we.kind==="text"),ye=ae.filter(we=>we.kind!=="text");if(H&&!H.isUser&&!H.isComplete&&H.taskId===ie.taskId&&(he||ue.length>0)){const we={...H,parts:[...H.parts],files:H.files?[...H.files]:[],isComplete:fe||ue.length>0,metadata:{...H.metadata,lastProcessedEventSequence:z}};if(he){const xe=we.parts[we.parts.length-1];(xe==null?void 0:xe.kind)==="text"?we.parts[we.parts.length-1]={...xe,text:xe.text+he.text}:we.parts.push(he)}ye.length>0&&we.parts.push(...ye),ue.length>0&&we.files.push(...ue),j[j.length-1]=we}else if(ae.some(xe=>xe.kind==="text"&&xe.text.trim())||ue.length>0||ge){const xe={role:"agent",parts:ae,files:ue.length>0?ue:void 0,taskId:ie.taskId,isUser:!1,isComplete:fe||ue.length>0,metadata:{messageId:((Re=V.id)==null?void 0:Re.toString())||`msg-${crypto.randomUUID()}`,sessionId:ie.contextId,lastProcessedEventSequence:z}};ge&&(xe.artifactNotification={name:ge.name||ge.artifactId}),j.push(xe)}if(!fe&&Y.current)j.push({role:"agent",parts:[{kind:"text",text:Y.current}],taskId:ie.taskId,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{messageId:`status-${crypto.randomUUID()}`,lastProcessedEventSequence:z}});else if(fe){Y.current=null;const we=j.findLastIndex(xe=>!xe.isUser&&xe.taskId===_e);we!==-1&&(j[we]={...j[we],isComplete:!0,metadata:{...j[we].metadata,lastProcessedEventSequence:z}})}return j}),fe&&(I.current&&(le("Task successfully cancelled."),K.current&&clearTimeout(K.current),_(!1)),h(!1),De(),b(null),U.current=!0,M(),setTimeout(()=>{U.current=!1},100))},[le,De,M]),st=u.useCallback(async()=>{const B="ChatProvider.handleNewSession:";if(console.log(`${B} Starting new session process...`),De(),m&&v&&y&&!T){console.log(`${B} Cancelling current task ${v}`);try{ze(`${r}/tasks/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_name:y,task_id:v}),credentials:"include"})}catch(V){console.warn(`${B} Failed to cancel current task:`,V)}}K.current&&(clearTimeout(K.current),K.current=null),_(!1),console.log(`${B} Resetting session state - new session will be created when first message is sent`),l(""),d(t?[{parts:[{kind:"text",text:t}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:"",lastProcessedEventSequence:0}}]:[]),p(""),h(!1),b(null),q(null),Oe(null),U.current=!1,Y.current=null,J.current=0,console.log(`${B} Refreshing artifacts for new session...`),await M(),le("New session started successfully."),console.log(`${B} New session setup complete - session will be created on first message.`)},[De,m,v,y,T,t,le,M]),rn=u.useCallback(async B=>{const z="ChatProvider.handleSwitchSession:";if(console.log(`${z} Switching to session ${B}...`),De(),m&&v&&y&&!T){console.log(`${z} Cancelling current task ${v}`);try{await ze(`${r}/tasks/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_name:y,task_id:v}),credentials:"include"})}catch(V){console.warn(`${z} Failed to cancel current task:`,V)}}K.current&&(clearTimeout(K.current),K.current=null),_(!1);try{const ie=(await pt(B)).map(pe=>({parts:[{kind:"text",text:pe.message}],isUser:pe.sender_type==="user",isComplete:!0,role:pe.sender_type==="user"?"user":"agent",metadata:{sessionId:pe.session_id,messageId:pe.id,lastProcessedEventSequence:0}})),fe=await ze(`${r}/sessions/${B}`);if(fe.ok){const pe=await fe.json();jt(pe.name)}l(B),d(ie),p(""),h(!1),b(null),q(null),Oe(null),U.current=!1,Y.current=null,J.current=0}catch(V){console.error(`${z} Failed to fetch session history:`,V),le("Error switching session. Please try again.","error")}},[De,m,v,y,T,r,le,pt]),on=u.useCallback(async(B,z)=>{try{const V=await ze(`${r}/sessions/${B}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z})});if(!V.ok){const ie=await V.json().catch(()=>({detail:"Failed to update session name"}));throw new Error(ie.detail||`HTTP error ${V.status}`)}le("Session name updated successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(V){le(`Error updating session name: ${V instanceof Error?V.message:"Unknown error"}`)}},[r,le]),Pe=u.useCallback(async B=>{try{const z=await ze(`${r}/sessions/${B}`,{method:"DELETE"});if(!z.ok){const V=await z.json().catch(()=>({detail:"Failed to delete session"}));throw new Error(V.detail||`HTTP error ${z.status}`)}le("Session deleted successfully."),B===i&&st(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(z){le(`Error deleting session: ${z instanceof Error?z.message:"Unknown error"}`)}},[r,le,st,i]),xt=u.useCallback(B=>{Et(B)},[]),sn=u.useCallback(()=>{Et(null)},[]),Gt=u.useCallback(async()=>{wt&&(await Pe(wt.id),Et(null))},[wt,Pe]),Pt=u.useCallback(async()=>{if(!m&&!T||!v){le("No active task to cancel.");return}if(T){le("Cancellation already in progress.");return}le(`Requesting cancellation for task ${v}...`),_(!0);try{const B={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}},z=await ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(z.status===202)K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{le(`Cancellation for task ${v} timed out. Allowing new input.`),_(!1),h(!1),De(),b(null),K.current=null,d(V=>V.filter(ie=>!ie.isStatusBubble))},15e3);else{const V=await z.json().catch(()=>({detail:"Unknown cancellation error"}));le(`Failed to request cancellation: ${V.detail||z.statusText}`),_(!1)}}catch(B){le(`Error sending cancellation request: ${B instanceof Error?B.message:"Network error"}`),_(!1)}},[m,T,v,r,le,De]),Lt=u.useCallback(()=>{},[]),Dt=u.useCallback(()=>{m&&!U.current&&!I.current&&le("Connection error with agent updates."),U.current||(h(!1),I.current||(De(),b(null)),Y.current=null),d(B=>B.filter(z=>!z.isStatusBubble).map((z,V,ie)=>V===ie.length-1&&!z.isUser?{...z,isComplete:!0}:z))},[le,De,m]),be=u.useCallback(async(B,z,V)=>{console.log("handleSubmit: using sessionId",i),B.preventDefault();const ie=(V==null?void 0:V.trim())||f.trim(),fe=z||[];if(!ie&&fe.length===0||m||T||!y){y||le("Please select an agent first."),T&&le("Cannot send new message while a task is being cancelled.");return}De(),U.current=!1,h(!0),b(null),Y.current=null,J.current=0;const pe={role:"user",parts:[{kind:"text",text:ie}],isUser:!0,uploadedFiles:fe.length>0?fe:void 0,metadata:{messageId:`msg-${crypto.randomUUID()}`,sessionId:i,lastProcessedEventSequence:0}};Y.current="Thinking",d(ge=>[...ge,pe]),p("");try{const ge=fe.map(async ye=>{if(ye.size<o)return{kind:"file",file:{bytes:await s(ye),name:ye.name,mimeType:ye.type}};{const Re=await tt(ye);return Re?{kind:"file",file:{uri:Re,name:ye.name,mimeType:ye.type}}:(le(`Failed to upload large file: ${ye.name}`,"error"),null)}}),_e=(await Promise.all(ge)).filter(ye=>ye!==null),ae=[];if(ie&&ae.push({kind:"text",text:ie}),ae.push(..._e),ae.length===0)throw new Error("Cannot send an empty message.");console.log(`ChatProvider handleSubmit: Using sessionId for contextId: ${i}`);const ue={role:"user",parts:ae,messageId:`msg-${crypto.randomUUID()}`,kind:"message",contextId:i,metadata:{agent_name:y}},Ie={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"message/stream",params:{message:ue}};console.log("ChatProvider handleSubmit: Sending POST to /message:stream");const Z=await ze(`${r}/message:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)});if(!Z.ok){const ye=await Z.json().catch(()=>({detail:"Unknown error"}));throw console.error("ChatProvider handleSubmit: Error from /message:stream",Z.status,ye),new Error(ye.detail||`HTTP error ${Z.status}`)}const C=await Z.json(),j=C==null?void 0:C.result,H=j==null?void 0:j.id,he=j==null?void 0:j.contextId;if(console.log(`ChatProvider handleSubmit: Extracted responseSessionId: ${he}, current sessionId: ${i}`),console.log("ChatProvider handleSubmit: Full result object:",C),!H)throw console.error("ChatProvider handleSubmit: Backend did not return a valid taskId. Result:",C),new Error("Backend did not return a valid taskId.");if(console.log(`ChatProvider handleSubmit: Checking session update condition - responseSessionId: ${he}, sessionId: ${i}, different: ${he!==i}`),he&&he!==i){console.log(`ChatProvider handleSubmit: Updating sessionId from ${i} to ${he}`);const ye=!i||i==="";l(he),d(Re=>Re.map(we=>{var xe,it;return((xe=we.metadata)==null?void 0:xe.messageId)===((it=pe.metadata)==null?void 0:it.messageId)?{...we,metadata:{...we.metadata,sessionId:he}}:we})),ye&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}console.log(`ChatProvider handleSubmit: Received taskId ${H}. Setting currentTaskId and taskIdInSidePanel.`),b(H),q(H)}catch(ge){console.error("ChatProvider handleSubmit: Catch block error",ge),le(`Error: ${ge instanceof Error?ge.message:"Unknown error"}`),h(!1),d(_e=>_e.filter(ae=>!ae.isStatusBubble)),b(null),U.current=!1,Y.current=null}},[f,m,T,i,y,r,le,De,tt]);u.useEffect(()=>{if(v&&r){console.log(`ChatProvider Effect: currentTaskId is ${v}. Setting up EventSource.`);const B=bi(),z=`${r}/sse/subscribe/${v}${B?`?token=${B}`:""}`,V=new EventSource(z,{withCredentials:!0});return w.current=V,V.onopen=Lt,V.onerror=Dt,V.addEventListener("status_update",qe),V.addEventListener("artifact_update",qe),V.addEventListener("final_response",qe),V.addEventListener("error",qe),()=>{console.log(`ChatProvider Effect Cleanup: currentTaskId was ${v}. Closing EventSource.`),V.removeEventListener("status_update",qe),V.removeEventListener("artifact_update",qe),V.removeEventListener("final_response",qe),V.removeEventListener("error",qe),De()}}else console.log("ChatProvider Effect: currentTaskId is null or apiPrefix missing. Ensuring EventSource is closed."),De()},[v,r,qe,Lt,Dt,De]);const Ee={sessionId:i,setSessionId:l,sessionName:mt,setSessionName:jt,messages:c,setMessages:d,userInput:f,setUserInput:p,isResponding:m,currentTaskId:v,isCancelling:T,latestStatusText:Y,agents:O,agentsLoading:N,agentsError:X,agentsRefetch:R,handleNewSession:st,handleSwitchSession:rn,handleSubmit:be,handleCancel:Pt,notifications:x,addNotification:le,selectedAgentName:y,setSelectedAgentName:E,artifacts:S,artifactsLoading:F,artifactsRefetch:M,uploadArtifactFile:tt,isSidePanelCollapsed:P,activeSidePanelTab:D,setIsSidePanelCollapsed:ee,setActiveSidePanelTab:$,openSidePanelTab:Nt,taskIdInSidePanel:A,setTaskIdInSidePanel:q,isDeleteModalOpen:L,artifactToDelete:k,openDeleteModal:Wt,closeDeleteModal:ht,confirmDelete:At,openSessionDeleteModal:xt,closeSessionDeleteModal:sn,confirmSessionDelete:Gt,sessionToDelete:wt,isArtifactEditMode:Q,setIsArtifactEditMode:te,selectedArtifactFilenames:oe,setSelectedArtifactFilenames:se,handleDeleteSelectedArtifacts:Ke,confirmBatchDeleteArtifacts:gt,isBatchDeleteModalOpen:de,setIsBatchDeleteModalOpen:me,previewedArtifactAvailableVersions:Le,currentPreviewedVersionNumber:He,previewFileContent:Qe,openArtifactForPreview:Mt,navigateArtifactVersion:Rt,openMessageAttachmentForPreview:nn,previewArtifact:Me,setPreviewArtifact:Oe,updateSessionName:on,deleteSession:Pe};return a.jsx(Uu.Provider,{value:Ee,children:e})},DE=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=tn(),{fetchCsrfToken:r,clearCsrfToken:o}=Ku(),[s,i]=u.useState(!1),[l,c]=u.useState(!0),[d,f]=u.useState(null);u.useEffect(()=>{let h=!0;const x=async()=>{if(!t){h&&(i(!0),c(!1));return}try{const v=await ze("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(v.ok){const b=await v.json();console.log("User is authenticated:",b),h&&(f(b),i(!0)),console.log("Fetching CSRF token for authenticated requests..."),await r()}else v.status===401?(console.log("User is not authenticated"),h&&i(!1)):(console.error("Unexpected response from /users/me:",v.status),h&&i(!1))}catch(v){console.error("Error checking authentication:",v),h&&i(!1)}finally{h&&c(!1)}};x();const g=v=>{v.key==="access_token"&&x()};return window.addEventListener("storage",g),()=>{h=!1,window.removeEventListener("storage",g)}},[t,n,r]);const p=()=>{window.location.href=n},m=()=>{i(!1),f(null),o()};return l?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Checking Authentication..."})]})}):a.jsx(Bu.Provider,{value:{isAuthenticated:s,useAuthorization:t,login:p,logout:m,userInfo:d},children:e})};function OE(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 FE=e=>new Promise(t=>setTimeout(t,e)),zE=async(e=5,t=50)=>{try{const n=await ze("/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 s=OE("csrf_token");if(s)return console.log(`CSRF token found in cookie after ${o} retries:`,s),s;console.log(`CSRF token not found in cookie, attempt ${o+1}/${e}. Waiting ${t}ms...`),await FE(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 $E({children:e}){const[t,n]=u.useState(null),r=u.useCallback(async()=>{if(t)return t;const i=await zE();if(i)n(i);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return i},[t]),o=u.useCallback(()=>{n(null)},[]),s={fetchCsrfToken:r,clearCsrfToken:o};return a.jsx(Wu.Provider,{value:s,children:e})}const BE={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"}},UE={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"}},HE={"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 Fl(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 WE(e,t){const n={},r=UE[t];for(const[o,s]of Object.entries(r)){const i=Fl(e,s);n[`--${o}`]=i}for(const[o,s]of Object.entries(HE)){const i=Fl(e,s);n[`--color-${o}`]=i}return n}const Mo="sam-theme";function GE(e){var n,r,o,s,i,l,c,d,f,p,m,h,x,g,v,b,w,y,E,T,_,I,A,q,K,U,Y,J,O,X,N,R,S,F,M,P,ee,D,$,L,W,k,G,Q,te,oe,se,de,me,Me,Oe,Le,je,He,ot,Qe,et,le,pt,tt,mt,jt,wt,Et,Tt,Wt,ht,At,Ke,gt,Mt,Rt,nn,Nt,De,qe,st,rn,on,Pe,xt,sn,Gt,Pt,Lt,Dt,be,Ee,B,z,V,ie,fe,pe,ge,_e,ae,ue,Ie,Z,C,j,H;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),(s=e.info)!=null&&s.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),(d=e.error)!=null&&d.w100&&(t["--color-error-w100"]=e.error.w100),(f=e.error)!=null&&f.w70&&(t["--color-error-w70"]=e.error.w70),(p=e.error)!=null&&p.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),(v=e.warning)!=null&&v.w70&&(t["--color-warning-w70"]=e.warning.w70),(b=e.warning)!=null&&b.w30&&(t["--color-warning-w30"]=e.warning.w30),(w=e.warning)!=null&&w.w20&&(t["--color-warning-w20"]=e.warning.w20),(y=e.warning)!=null&&y.w10&&(t["--color-warning-w10"]=e.warning.w10),(E=e.success)!=null&&E.wMain&&(t["--color-success-wMain"]=e.success.wMain),(T=e.success)!=null&&T.w100&&(t["--color-success-w100"]=e.success.w100),(_=e.success)!=null&&_.w70&&(t["--color-success-w70"]=e.success.w70),(I=e.success)!=null&&I.w30&&(t["--color-success-w30"]=e.success.w30),(A=e.success)!=null&&A.w20&&(t["--color-success-w20"]=e.success.w20),(q=e.success)!=null&&q.w10&&(t["--color-success-w10"]=e.success.w10),(K=e.stateLayer)!=null&&K.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(U=e.stateLayer)!=null&&U.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(J=(Y=e.accent)==null?void 0:Y.n0)!=null&&J.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(X=(O=e.accent)==null?void 0:O.n0)!=null&&X.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(R=(N=e.accent)==null?void 0:N.n0)!=null&&R.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(F=(S=e.accent)==null?void 0:S.n0)!=null&&F.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(P=(M=e.accent)==null?void 0:M.n1)!=null&&P.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(D=(ee=e.accent)==null?void 0:ee.n1)!=null&&D.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(L=($=e.accent)==null?void 0:$.n1)!=null&&L.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(k=(W=e.accent)==null?void 0:W.n1)!=null&&k.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(Q=(G=e.accent)==null?void 0:G.n1)!=null&&Q.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(oe=(te=e.accent)==null?void 0:te.n1)!=null&&oe.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(de=(se=e.accent)==null?void 0:se.n2)!=null&&de.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(Me=(me=e.accent)==null?void 0:me.n2)!=null&&Me.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),(Le=(Oe=e.accent)==null?void 0:Oe.n2)!=null&&Le.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(He=(je=e.accent)==null?void 0:je.n2)!=null&&He.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(Qe=(ot=e.accent)==null?void 0:ot.n2)!=null&&Qe.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(le=(et=e.accent)==null?void 0:et.n3)!=null&&le.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(tt=(pt=e.accent)==null?void 0:pt.n3)!=null&&tt.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(jt=(mt=e.accent)==null?void 0:mt.n3)!=null&&jt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(Et=(wt=e.accent)==null?void 0:wt.n3)!=null&&Et.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(Wt=(Tt=e.accent)==null?void 0:Tt.n4)!=null&&Wt.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(At=(ht=e.accent)==null?void 0:ht.n4)!=null&&At.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(gt=(Ke=e.accent)==null?void 0:Ke.n4)!=null&>.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Rt=(Mt=e.accent)==null?void 0:Mt.n5)!=null&&Rt.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(Nt=(nn=e.accent)==null?void 0:nn.n5)!=null&&Nt.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(qe=(De=e.accent)==null?void 0:De.n5)!=null&&qe.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(rn=(st=e.accent)==null?void 0:st.n5)!=null&&rn.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(Pe=(on=e.accent)==null?void 0:on.n6)!=null&&Pe.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(sn=(xt=e.accent)==null?void 0:xt.n6)!=null&&sn.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),(Pt=(Gt=e.accent)==null?void 0:Gt.n6)!=null&&Pt.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(Dt=(Lt=e.accent)==null?void 0:Lt.n7)!=null&&Dt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(Ee=(be=e.accent)==null?void 0:be.n7)!=null&&Ee.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),(z=(B=e.accent)==null?void 0:B.n7)!=null&&z.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(ie=(V=e.accent)==null?void 0:V.n8)!=null&&ie.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(pe=(fe=e.accent)==null?void 0:fe.n8)!=null&&pe.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(_e=(ge=e.accent)==null?void 0:ge.n8)!=null&&_e.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(ue=(ae=e.accent)==null?void 0:ae.n9)!=null&&ue.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(Ie=e.learning)!=null&&Ie.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(Z=e.learning)!=null&&Z.w100&&(t["--color-learning-w100"]=e.learning.w100),(C=e.learning)!=null&&C.w90&&(t["--color-learning-w90"]=e.learning.w90),(j=e.learning)!=null&&j.w20&&(t["--color-learning-w20"]=e.learning.w20),(H=e.learning)!=null&&H.w10&&(t["--color-learning-w10"]=e.learning.w10),t}function VE(e,t="light"){const n={};if(e){const o=GE(e);Object.assign(n,o)}const r=WE(e,t);return Object.assign(n,r),n}function YE(){const e=localStorage.getItem(Mo);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function KE(e,t){const n=VE(e,t),r=document.documentElement;for(const[o,s]of Object.entries(n))r.style.setProperty(o,s);requestAnimationFrame(()=>{console.log(`Applying ${t} theme with palette`),r.classList.remove("light","dark"),r.classList.add(t),localStorage.setItem(Mo,t)})}const qE=({children:e})=>{const t=u.useMemo(()=>BE,[]),[n,r]=u.useState(()=>YE()),o=u.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const s=n==="light"?"dark":"light";r(s),localStorage.setItem(Mo,s)}}),[n]);return u.useEffect(()=>{if(!(localStorage.getItem(Mo)!==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)}}},[]),u.useEffect(()=>{document.documentElement.classList.remove("light","dark"),KE(t,n)},[n,t]),a.jsx(Vu.Provider,{value:o,children:e})};function XE(){const[e,t]=u.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=Yu();if(xw(),o&&!n)return a.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:a.jsx(Ae,{onClick:r,children:"Login"})});const s=c=>{const d=Ll.find(f=>f.id===c)||Dl.find(f=>f.id===c);d!=null&&d.onClick&&c!=="settings"?d.onClick():c!=="settings"&&t(c)},i=()=>{t("chat")},l=()=>{switch(e){case"chat":return a.jsx(jE,{});case"agentMesh":return a.jsx(kE,{})}};return a.jsxs("div",{className:"relative flex h-screen",children:[a.jsx(bE,{items:Ll,bottomItems:Dl,activeItem:e,onItemChange:s,onHeaderClick:i}),a.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:l()}),a.jsx(Q0,{})]})}function ZE(){return a.jsx(qE,{children:a.jsx($E,{children:a.jsx(RE,{children:a.jsx(DE,{children:a.jsx(LE,{children:a.jsx(PE,{children:a.jsx(XE,{})})})})})})})}kp.createRoot(document.getElementById("root")).render(a.jsx(u.StrictMode,{children:a.jsx(ZE,{})}));
|
|
337
|
+
`,v=()=>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: ",b=e.title;return a.jsxs("div",{className:g,style:x,onClick:n,children:[a.jsxs("div",{className:"mb-1.5 flex items-center",children:[o(),a.jsx("h4",{className:"flex-grow text-sm font-semibold text-gray-700 dark:text-gray-200",title:e.title,children:b}),a.jsx("span",{className:"font-mono text-xs text-gray-500 dark:text-gray-400",children:l})]}),e.delegationInfo&&e.delegationInfo.length>0&&a.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(w=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center font-semibold text-blue-700 dark:text-blue-300",children:[a.jsx(ql,{className:"mr-2 h-4 w-4 flex-shrink-0"}),a.jsxs("span",{children:[v(),w.peerAgentName]})]}),w.subTaskId&&a.jsxs("div",{className:"mt-0.5 ml-[24px] text-xs text-blue-600 dark:text-blue-400",children:["Sub-Task:"," ",a.jsxs("span",{className:"font-mono",title:w.subTaskId,children:[w.subTaskId.substring(0,15),"..."]})]})]},w.functionCallId))}),e.data.text&&a.jsx("div",{className:"max-h-20 overflow-y-auto pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(or,{children:e.data.text})}),e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(or,{children:e.data.finalMessage})}),e.type==="TASK_COMPLETED"&&!e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-600 italic dark:text-gray-300",children:"Task completed successfully."}),e.data.errorDetails&&a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Error:"})," ",e.data.errorDetails.message]}),e.data.errorDetails.code&&a.jsxs("p",{className:"text-xs",children:["Code: ",e.data.errorDetails.code]})]}),e.data.llmCall&&c(e.data.llmCall),e.data.llmResponseToAgent&&a.jsx(d,{data:e.data.llmResponseToAgent}),e.data.toolDecision&&f(e.data.toolDecision),e.data.toolInvocationStart&&p(e.data.toolInvocationStart),e.data.toolResult&&m(e.data.toolResult),e.data.artifactNotification&&h(e.data.artifactNotification)]})},mE={genericAgentNode:lE,userNode:fE,llmNode:uE,orchestratorNode:dE,genericToolNode:cE},hE={defaultFlowEdge:aE},gE={x:16,y:0},xE=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,s]=Qp([]),[i,l,c]=em([]),{fitView:d}=tm(),{highlightedStepId:f,setHighlightedStepId:p}=Vi(),{taskIdInSidePanel:m}=Ue(),h=u.useRef([]),[x,g]=u.useState(!1),[v,b]=u.useState(null),[w,y]=u.useState(!1),E=u.useRef(null),[T,_]=u.useState(null),I=u.useRef(new gp),A=u.useMemo(()=>!e||e.length===0?{nodes:[],edges:[]}:iE(e),[e]),q=u.useMemo(()=>A.edges.length?A.edges.map(R=>{const S=R.data;let F={isAnimated:!1,animationType:"none"};if(S!=null&&S.visualizerStepId){const P=e.length-1;F=I.current.getEdgeAnimationState(S.visualizerStepId,P,e)}let M=R.id===T;return f&&(S==null?void 0:S.visualizerStepId)===f&&(M=!0),{...R,animated:F.isAnimated,data:{...S,isAnimated:F.isAnimated,animationType:F.animationType,isSelected:M}}}):[],[A.edges,e,T,f]),K=u.useCallback(()=>{o(R=>R.map(S=>{var te,oe,se,de;if(S.type!=="group")return S;const F=R.filter(me=>me.parentId===S.id);if(F.length===0)return S;let M=0,P=0;F.forEach(me=>{const Me=me.position.x+_t,Oe=me.position.y+Ye;M=Math.max(M,Me),P=Math.max(P,Oe)});const ee=M+ur,D=P+Vt;let $=0;const L=S.id.split("_");if(L.length>2){const me=L.find(Me=>Me.startsWith("subflow"));if(me){const Me=parseInt(me.replace("subflow",""));isNaN(Me)||($=Me)}}const G=_t+2*ur+$*50,k=Math.max(ee,G),V=parseInt(((oe=(te=S.style)==null?void 0:te.width)==null?void 0:oe.toString().replace("px",""))||"0"),Q=parseInt(((de=(se=S.style)==null?void 0:se.height)==null?void 0:de.toString().replace("px",""))||"0");return V!==k||Q!==D?{...S,style:{...S.style,width:`${k}px`,height:`${D}px`}}:S}))},[o]);u.useEffect(()=>{o(A.nodes),l(q),K()},[A.nodes,q,o,l,K]);const U=u.useCallback((R,S)=>i.find(F=>F.source===R&&(S?F.sourceHandle===S:!0))||null,[i]),Y=u.useCallback((R,S)=>{var M;g(!0);const F=(M=S.data)==null?void 0:M.visualizerStepId;if(F){const P=e.find(ee=>ee.id===F);P&&(_(S.id),t?p(F):(p(F),b(P),y(!0)))}},[e,t,p]),J=u.useCallback(R=>{switch(R.type){case"userNode":{const S=R.data;return S!=null&&S.isTopNode?["user-bottom-output"]:S!=null&&S.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[`${R.id}-tool-bottom-output`];default:return[]}},[]),O=u.useCallback(()=>{y(!1),b(null)},[]),X=u.useCallback((R,S)=>{if(g(!0),S.type==="group"){p(null),_(null),O();return}const F=J(S);let M=null;for(const P of F)if(M=U(S.id,P),M)break;if(!M&&S.type==="userNode"){const P=S.data;P!=null&&P.isBottomNode&&(M=i.find(ee=>ee.target===S.id)||null)}M&&Y(R,M)},[J,p,O,U,i,Y]),N=u.useCallback(R=>{R!=null&&R.isTrusted&&g(!0)},[]);return u.useEffect(()=>{g(!1)},[m]),u.useEffect(()=>{!n&&d&&r.length>0&&h.current!==e&&x===!1&&(d({duration:200,padding:.1,maxZoom:1.2}),h.current=e)},[r.length,d,e,n,x]),u.useEffect(()=>{if(o(R=>R.map(S=>{var ee;const F=((ee=S.data)==null?void 0:ee.visualizerStepId)&&S.data.visualizerStepId===f,M=A.nodes.find(D=>D.id===S.id),P=(M==null?void 0:M.style)||{};return{...S,style:{...P,boxShadow:F?"0px 4px 12px rgba(0, 0, 0, 0.2)":P.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}})),f){const R=q.find(S=>{const F=S.data;return(F==null?void 0:F.visualizerStepId)===f});R&&_(R.id)}else _(null)},[f,o,A.nodes,q]),!e||e.length===0?a.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."}):A.nodes.length===0&&e.length>0?a.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:"Generating flow chart..."}):a.jsxs("div",{style:{height:"100%",width:"100%"},className:"relative",children:[a.jsxs(nm,{nodes:r,edges:i.map(R=>({...R,markerEnd:{type:im.ArrowClosed,color:"#888"}})),onNodesChange:s,onEdgesChange:c,onEdgeClick:Y,onNodeClick:X,onPaneClick:()=>{p(null),_(null),O()},onMoveStart:N,nodeTypes:mE,edgeTypes:hE,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:[a.jsx(rm,{}),a.jsx(om,{className:oh()}),a.jsx(sm,{position:"top-right",className:"flex items-center space-x-4",children:a.jsx("div",{ref:E})})]}),a.jsx(Dw,{isOpen:w,onClose:O,anchorRef:E,offset:gE,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:v&&a.jsx(pE,{step:v,variant:"popover"})})]})},vE=e=>a.jsx(Jp,{children:a.jsx(xE,{...e})}),yp=e=>{var t,n,r,o;if(e.events&&e.events.length>0){const s=e.events[0];if((o=(r=(n=(t=s.full_payload)==null?void 0:t.params)==null?void 0:n.message)==null?void 0:r.metadata)!=null&&o.parentTaskId)return s.full_payload.params.message.metadata.parentTaskId}},kr=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},Sp=(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 s=[...o.events||[]];for(const i in t){const l=t[i];if(l.taskId===e)continue;yp(l)===e&&(s=s.concat(Sp(l.taskId,t,n,r+1)))}return s},wE=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,s=new Map,i=(N,R)=>(r.agents[N]||(r.agents[N]={agentName:R,instanceId:N,displayName:R,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[N]),l=new Map,c=Sp(n.taskId,t,l,0);if(c.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const d=c.sort((N,R)=>new Date(kr(N)).getTime()-new Date(kr(R)).getTime()),f=[];let p,m="",h,x,g=[],v=null,b;const w=new Map,y=new Map,E=new Map,T=N=>{if(m.trim()&&h&&x){const R=m.trim();let S=n.taskId;if(g.length>0){const P=g[0].split("-");P.length>2&&P[1]!=="global"&&(S=P.slice(1,P.length-1).join("-"))}else N&&(S=N);const F=l.get(S)??0,M=w.get(S)||E.get(S);f.push({id:`vstep-agenttext-${f.length}-${g[0]||"unknown"}`,type:"AGENT_RESPONSE_TEXT",timestamp:x,title:`${h}: Response`,source:h,target:"User",data:{text:R},rawEventIds:[...g],isSubTaskStep:F>0,nestingLevel:F,owningTaskId:S,functionCallId:M}),v=R}m="",h=void 0,x=void 0,g=[],b=void 0};d.forEach((N,R)=>{var k,V,Q,te,oe,se,de,me,Me,Oe,Le,je,He,ot,Qe,et,le,pt,tt,mt,jt,wt,Et,Tt,Wt,ht,At,Ke,gt,Mt,Rt,nn,Nt,De,qe,st,rn,on,Pe,xt,sn,Gt,Pt,Lt,Dt;const S=kr(N),F=`raw-${N.task_id||"global"}-${R}`,M=N.full_payload,P=N.task_id||n.taskId,ee=l.get(P)??0;let D=N.source_entity||"UnknownAgent";(Q=(V=(k=M==null?void 0:M.params)==null?void 0:k.message)==null?void 0:V.metadata)!=null&&Q.agent_name?D=M.params.message.metadata.agent_name:(oe=(te=M==null?void 0:M.result)==null?void 0:te.metadata)!=null&&oe.agent_name?D=M.result.metadata.agent_name:(Me=(me=(de=(se=M==null?void 0:M.result)==null?void 0:se.status)==null?void 0:de.message)==null?void 0:me.metadata)!=null&&Me.agent_name?D=M.result.status.message.metadata.agent_name:(je=(Le=(Oe=M==null?void 0:M.result)==null?void 0:Oe.artifact)==null?void 0:Le.metadata)!=null&&je.agent_name&&(D=M.result.artifact.metadata.agent_name);let $;if(ee>0?$=w.get(P):$=E.get(P),N.direction==="request"&&ee>0){const be=(He=M.params)==null?void 0:He.metadata,Ee=be==null?void 0:be.function_call_id,B=N.task_id;if(B&&Ee){w.set(B,Ee);return}}if(N.direction==="request"&&ee===0&&N.task_id===n.taskId){T(P),v=null;const be=M.params;let Ee="User request";if((ot=be==null?void 0:be.message)!=null&&ot.parts){const B=be.message.parts.filter(z=>z.kind==="text"&&z.text);B.length>0&&(Ee=B[B.length-1].text)}f.push({id:`vstep-userreq-${f.length}-${F}`,type:"USER_REQUEST",timestamp:S,title:"User Input",source:"User",target:N.target_entity||D,data:{text:Ee},rawEventIds:[F],isSubTaskStep:!1,nestingLevel:0,owningTaskId:P});return}if(N.direction==="status-update"&&(M!=null&&M.result)){const be=M.result,Ee=(Qe=be.status)==null?void 0:Qe.message,B=Ee==null?void 0:Ee.metadata;let z;const H=!!(B!=null&&B.forwarded_from_peer);H?z=B.forwarded_from_peer:(et=be.metadata)!=null&&et.agent_name?z=be.metadata.agent_name:B!=null&&B.agent_name?z=B.agent_name:z=N.source_entity||"Agent";const ie=`${z}:${P}`;if(!H&&(Ee!=null&&Ee.parts))for(const fe of Ee.parts){if(fe.kind==="data"){const pe=fe.data;pe.type==="agent_progress_update"?p=pe.status_text:pe.type==="artifact_creation_progress"&&(p=`Saving artifact: ${pe.filename} (${pe.bytes_saved} bytes)`)}if(fe.kind==="data"){T(P);const ge=fe.data;switch(ge==null?void 0:ge.type){case"agent_progress_update":{f.push({id:`vstep-progress-${f.length}-${F}`,type:"AGENT_RESPONSE_TEXT",timestamp:S,title:`${z}: Progress Update`,source:z,target:"User",data:{text:ge.status_text},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"llm_invocation":{const ae=ge.request;let ue="System-initiated LLM call";if(ae!=null&&ae.contents&&Array.isArray(ae.contents)&&ae.contents.length>0){const Z=[...ae.contents].reverse().find(C=>C.role==="user");Z&&Z.parts&&(ue=Z.parts.map(C=>C.text||"").join(`
|
|
338
|
+
`).trim())}const Ie={modelName:(ae==null?void 0:ae.model)||"Unknown Model",promptPreview:ue||"No text in user prompt."};i(ie,z),o.set(ie,{timestamp:S,modelName:Ie.modelName}),f.push({id:`vstep-llmcall-${f.length}-${F}`,type:"AGENT_LLM_CALL",timestamp:S,title:`${z}: LLM Call`,source:z,target:"LLM",data:{llmCall:Ie},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"llm_response":{const ae=o.get(ie);if(ae){const C=new Date(S).getTime()-new Date(ae.timestamp).getTime();i(ie,z).llmCalls.push({modelName:ae.modelName,durationMs:C,timestamp:ae.timestamp}),o.delete(ie)}const ue=ge.data,Ie=(le=ue.content)==null?void 0:le.parts,Z=Ie==null?void 0:Ie.filter(C=>C.function_call);if(Z&&Z.length>0){T(P),v=null,E.delete(P);const C=Z.map(xe=>{var it;return{functionCallId:xe.function_call.id,toolName:xe.function_call.name,toolArguments:xe.function_call.args||{},isPeerDelegation:(it=xe.function_call.name)==null?void 0:it.startsWith("peer_")}}),j={decisions:C,isParallel:C.length>1},W=[],he=new Set;C.forEach(xe=>{if(xe.isPeerDelegation){const it=xe.toolName.substring(5);for(const hn in t){const Fe=t[hn];if(he.has(Fe.taskId))continue;if(yp(Fe)===P&&Fe.events&&Fe.events.length>0){const wr=Fe.events.find(br=>{var ia,aa,la,ca;return br.direction==="request"&&((ca=(la=(aa=(ia=br.full_payload)==null?void 0:ia.params)==null?void 0:aa.message)==null?void 0:la.metadata)==null?void 0:ca.function_call_id)===xe.functionCallId});if(wr&&new Date(kr(wr)).getTime()>=new Date(S).getTime()){const br={functionCallId:xe.functionCallId,peerAgentName:it,subTaskId:Fe.taskId};W.push(br),y.set(xe.functionCallId,br),Fe.taskId&&(w.set(Fe.taskId,xe.functionCallId),he.add(Fe.taskId));break}}}}});const ye={id:`vstep-tooldecision-${f.length}-${F}`,type:"AGENT_LLM_RESPONSE_TOOL_DECISION",timestamp:S,title:`LLM: Tool Decision${j.isParallel?" (Parallel)":""}`,source:"LLM",target:z,data:{toolDecision:j},rawEventIds:[F],delegationInfo:W.length>0?W:void 0,isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$};f.push(ye);const Re=j.isParallel?ye.id:void 0,we=ie;i(we,z),C.forEach(xe=>{var hn;const it=xe.isPeerDelegation?(hn=y.get(xe.functionCallId))==null?void 0:hn.subTaskId:void 0;s.has(xe.functionCallId)||s.set(xe.functionCallId,{timestamp:S,toolName:xe.toolName,isPeer:xe.isPeerDelegation,invokingAgentInstanceId:we,subTaskId:it,parallelBlockId:Re})})}else{const C=(Ie==null?void 0:Ie.filter(W=>W.text).map(W=>W.text).join(`
|
|
339
|
+
`))||"",j={responsePreview:C.substring(0,200)+(C.length>200?"...":""),isFinalResponse:(ue==null?void 0:ue.partial)===!1};f.push({id:`vstep-llmrespagent-${f.length}-${F}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:S,title:`${z}: LLM Response`,source:"LLM",target:z,data:{llmResponseToAgent:j},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$})}break}case"tool_invocation_start":{const ae={functionCallId:ge.function_call_id,toolName:ge.tool_name,toolArguments:ge.tool_args,isPeerInvocation:(pt=ge.tool_name)==null?void 0:pt.startsWith("peer_")};f.push({id:`vstep-toolinvokestart-${f.length}-${F}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:S,title:`${z}: Executing tool ${ae.toolName}`,source:z,target:ae.toolName,data:{toolInvocationStart:ae},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"tool_result":{const ae=ge.function_call_id,ue=s.get(ae);if(ue){const Z=new Date(S).getTime()-new Date(ue.timestamp).getTime(),C=r.agents[ue.invokingAgentInstanceId];if(C){const j={toolName:ue.toolName,durationMs:Z,isPeer:ue.isPeer,timestamp:ue.timestamp,peerAgentName:ue.isPeer?ue.toolName.substring(5):void 0,subTaskId:ue.subTaskId,parallelBlockId:ue.parallelBlockId};C.toolCalls.push(j)}s.delete(ae)}const Ie={toolName:ge.tool_name,functionCallId:ae,resultData:ge.result_data,isPeerResponse:(tt=ge.tool_name)==null?void 0:tt.startsWith("peer_")};f.push({id:`vstep-toolresult-${f.length}-${F}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:S,title:`${z}: Tool Result - ${Ie.toolName}`,source:Ie.toolName,target:z,data:{toolResult:Ie},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}}}else fe.kind==="text"&&fe.text&&(h&&h!==z&&(T(P),v=null),h||(h=z,x=S,b=H),m+=fe.text,g.push(F))}return}if(N.direction==="artifact_update"&&((mt=M==null?void 0:M.result)!=null&&mt.artifact)){T(P);const be=M.result.artifact,Ee=((jt=be.metadata)==null?void 0:jt.agent_name)||N.source_entity||"Agent";let B;if(be.parts&&be.parts.length>0){const H=be.parts[0];H.kind==="file"?B=H.file.mimeType||void 0:(wt=H.metadata)!=null&&wt.mime_type&&(B=H.metadata.mime_type)}const z={artifactName:be.name||"Unnamed Artifact",version:typeof((Et=be.metadata)==null?void 0:Et.version)=="number"?be.metadata.version:void 0,description:be.description||void 0,mimeType:B};f.push({id:`vstep-artifactnotify-${f.length}-${F}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:S,title:`${Ee}: Artifact Update - ${z.artifactName}`,source:Ee,target:"User/System",data:{artifactNotification:z},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});return}if(["response","task"].includes(N.direction)&&((Wt=(Tt=M==null?void 0:M.result)==null?void 0:Tt.status)!=null&&Wt.state)){m.trim()&&T(P);const be=M.result,Ee=be.status.state,B=((ht=be.metadata)==null?void 0:ht.agent_name)||((gt=(Ke=(At=be.status)==null?void 0:At.message)==null?void 0:Ke.metadata)==null?void 0:gt.agent_name)||N.source_entity||"Agent";if(["completed","failed","canceled"].includes(Ee)&&ee==0){const z=Ee==="completed"?"TASK_COMPLETED":"TASK_FAILED",H=`${B}: Task ${Ee.charAt(0).toUpperCase()+Ee.slice(1)}`;let ie={},fe="";if((Mt=be.status.message)!=null&&Mt.parts){const _e=be.status.message.parts.find(ae=>ae.kind==="text");_e!=null&&_e.text&&(fe=_e.text.trim())}const pe=P===n.taskId,ge=fe&&(!pe||fe!==v);if(z==="TASK_COMPLETED")ie={finalMessage:ge?fe:void 0};else{const ae={message:ge?fe:`Task ${Ee}.`},ue=M.error;ue&&(ae.message=ue.message||ae.message,ae.code=ue.code,ue.data&&(ae.details=ue.data)),be.error&&(ae.message=be.error.message||ae.message,ae.code=be.error.code||ae.code,ae.details=be.error.data||ae.details),ie={errorDetails:ae}}f.push({id:`vstep-${Ee}-${f.length}-${F}`,type:z,timestamp:S,title:H,source:B,target:"User",data:ie,rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$}),pe&&(v=null);return}}const L=N.direction==="status-update"&&((De=(Nt=(nn=(Rt=M==null?void 0:M.result)==null?void 0:Rt.status)==null?void 0:nn.message)==null?void 0:Nt.parts)==null?void 0:De.some(be=>be.kind==="text"));let G=N.source_entity;(on=(rn=(st=(qe=M==null?void 0:M.result)==null?void 0:qe.status)==null?void 0:st.message)==null?void 0:rn.metadata)!=null&&on.forwarded_from_peer?G=M.result.status.message.metadata.forwarded_from_peer:(xt=(Pe=M==null?void 0:M.result)==null?void 0:Pe.metadata)!=null&&xt.agent_name?G=M.result.metadata.agent_name:(Lt=(Pt=(Gt=(sn=M==null?void 0:M.result)==null?void 0:sn.status)==null?void 0:Gt.message)==null?void 0:Pt.metadata)!=null&&Lt.agent_name&&(G=M.result.status.message.metadata.agent_name),m.trim()&&h&&(!L||L&&G!==h)&&(T(P),l.get(((Dt=g[0])==null?void 0:Dt.split("-")[1])||n.taskId)===0&&!b&&(v=null))});const _=d.length>0&&d[d.length-1].task_id||n.taskId;T(_);const I=d[0]?kr(d[0]):n.firstSeen.toISOString();let A,q="working";const K=f.filter(N=>N.owningTaskId===n.taskId),U=K.length>0?K[K.length-1]:null;if(U&&(U.type==="TASK_COMPLETED"?(q="completed",A=U.timestamp):U.type==="TASK_FAILED"&&(q="failed",A=U.timestamp)),q==="working"&&d.length>0){const N=d[d.length-1];t[N.task_id||n.taskId]}let Y;I&&A&&(Y=new Date(A).getTime()-new Date(I).getTime()),["completed","failed","canceled","rejected"].includes(q)&&(p=void 0);const J={taskId:n.taskId,initialRequestText:n.initialRequestText,status:q,currentStatusText:p,startTime:I,endTime:A,durationMs:Y,steps:f};J.steps.forEach((N,R)=>{if(N.type==="TASK_COMPLETED"){let S="";for(let F=R-1;F>=0;F--){const M=J.steps[F];if(M.type!=="AGENT_RESPONSE_TEXT"||M.source!==N.source)break;S=M.data.text+S}N.data.finalMessage&&(S+=N.data.finalMessage),N.data.finalMessage=S.trim()||void 0}}),Object.values(r.agents).forEach(N=>{N.totalLlmTimeMs=N.llmCalls.reduce((P,ee)=>P+ee.durationMs,0);const R=N.toolCalls.filter(P=>!P.parallelBlockId),S=new Map;N.toolCalls.forEach(P=>{P.parallelBlockId&&(S.has(P.parallelBlockId)||S.set(P.parallelBlockId,[]),S.get(P.parallelBlockId).push(P))});const F=R.reduce((P,ee)=>P+ee.durationMs,0);let M=0;S.forEach(P=>{if(P.length>0){const ee=Math.min(...P.map($=>new Date($.timestamp).getTime())),D=Math.max(...P.map($=>new Date($.timestamp).getTime()+$.durationMs));M+=D-ee}}),N.totalToolTimeMs=F+M});const O=new Map;Object.values(r.agents).forEach(N=>{O.has(N.agentName)||O.set(N.agentName,[]),O.get(N.agentName).push(N)}),O.forEach(N=>{N.length>1&&(N.sort((R,S)=>{const F=M=>{const P=[...M.llmCalls.map(ee=>new Date(ee.timestamp).getTime()),...M.toolCalls.map(ee=>new Date(ee.timestamp).getTime())];return P.length>0?Math.min(...P):1/0};return F(R)-F(S)}),N.forEach((R,S)=>{R.displayName=`${R.agentName} (${S+1})`}))});const X=new Map;return Object.values(r.agents).forEach(N=>{const R=N.instanceId.split(":").slice(1).join(":");R&&X.set(R,N.displayName)}),Object.values(r.agents).forEach(N=>{N.toolCalls.forEach(R=>{if(R.isPeer&&R.subTaskId){const S=X.get(R.subTaskId);S&&(R.peerAgentName=S)}})}),Y!==void 0&&(r.overall.totalTaskDurationMs=Y),J.performanceReport=r,J},bE=({items:e,bottomItems:t,activeItem:n,onItemChange:r,onHeaderClick:o})=>{const s=i=>{r(i)};return a.jsxs("aside",{className:"flex h-screen w-[100px] flex-col border-r border-[var(--color-secondary-w70)] bg-[var(--color-primary-w100)]",children:[a.jsx(SE,{onClick:o}),a.jsx(EE,{items:e,bottomItems:t,activeItem:n,onItemClick:s})]})},yE=a.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:[a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"}),a.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"})]}),SE=({onClick:e})=>a.jsx("div",{className:"flex h-[80px] min-h-[80px] cursor-pointer items-center justify-center border-b",onClick:e,children:a.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-full",children:yE})}),CE=()=>{const{currentTheme:e,toggleTheme:t}=Zu(),n=`Toggle theme (currently ${e})`;return a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:a.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:a.jsx(Xl,{className:"mb-1 w-6 h-6"})})}),a.jsx(Oi,{side:"right",children:n})]})},EE=({items:e,bottomItems:t,activeItem:n,onItemClick:r})=>a.jsxs("nav",{className:"flex flex-1 flex-col",role:"navigation","aria-label":"Main navigation",children:[a.jsx("ul",{className:"space-y-1",children:e.map(o=>a.jsxs("li",{children:[a.jsx(Pl,{item:o,isActive:n===o.id,onItemClick:r}),o.showDividerAfter&&a.jsx("div",{className:"mx-4 my-3 border-t border-[var(--color-secondary-w70)]"})]},o.id))}),t&&t.length>0&&a.jsx("div",{className:"flex-1"}),t&&t.length>0&&a.jsx("ul",{className:"space-y-1",children:t.map(o=>a.jsx("li",{className:"my-4",children:o.id==="theme-toggle"?a.jsx(CE,{}):a.jsx(Pl,{item:o,isActive:n===o.id,onItemClick:r},o.id)},o.id))})]}),Pl=({item:e,isActive:t,onItemClick:n})=>{const{id:r,label:o,icon:s,disabled:i}=e,l=()=>{!i&&n&&n(r)},c=d=>{(d.key==="Enter"||d.key===" ")&&l()};return a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:n?l:void 0,onKeyDown:n?c:void 0,disabled:i,className:Ce("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:[a.jsx(s,{className:Ce("mb-1 h-6 w-6",t&&"text-[var(--color-brand-wMain)]")}),a.jsx("span",{className:"text-center text-[13px] leading-tight",children:o})]})}),a.jsx(Oi,{side:"right",children:o})]})},Ll=[{id:"chat",label:"Chat",icon:am},{id:"agentMesh",label:"Agents",icon:Zl}],Dl=[{id:"theme-toggle",label:"Theme",icon:Xl,onClick:()=>{}}],Cp=({title:e,breadcrumbs:t,tabs:n,buttons:r,leadingAction:o})=>a.jsxs("div",{className:"relative flex max-h-[80px] min-h-[80px] w-full items-center border-b px-8",children:[t&&t.length>0&&a.jsx("div",{className:"absolute top-1 left-8 flex items-center h-8",children:t.map((s,i)=>a.jsxs(zt.Fragment,{children:[i>0&&a.jsx("span",{className:"mx-1",children:a.jsx(lm,{size:16})}),s.onClick?a.jsx(Ae,{variant:"link",className:"p-0 m-0",onClick:s.onClick,children:s.label}):a.jsx("div",{children:s.label})]},i))}),o&&a.jsx("div",{className:"mr-4 flex items-center pt-[35px]",children:o}),a.jsx("div",{className:"truncate text-xl text-nowrap pt-[35px]",children:e}),n&&n.length>0&&a.jsx("div",{className:"ml-8 flex items-center pt-[35px]",role:"tablist",children:n.map((s,i)=>a.jsxs("button",{role:"tab","aria-selected":s.isActive,onClick:s.onClick,className:`relative cursor-pointer px-4 py-3 font-medium transition-colors duration-200 ${s.isActive?"border-b-2 border-[var(--color-brand-wMain)] font-semibold":""} ${i>0?"ml-6":""}`,children:[s.label,s.isActive&&a.jsx("div",{className:"absolute right-0 bottom-0 left-0 h-0.5"})]},s.id))}),a.jsx("div",{className:"flex-1"}),r&&r.length>0&&a.jsx("div",{className:"flex items-center gap-2",children:r.map((s,i)=>a.jsx(zt.Fragment,{children:s},i))})]}),lt=({label:e,value:t,icon:n,fullWidthValue:r=!1})=>t==null||typeof t=="string"&&!t.trim()?null:a.jsxs("div",{className:`flex mb-1.5 text-sm ${r?"flex-col items-start":"items-center"}`,children:[a.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center text-sm font-semibold text-nowrap",children:[n&&a.jsx("span",{className:"mr-2",children:n}),e,":"]}),a.jsx("div",{className:`text-accent-foreground text-sm ${r?"mt-1 w-full":"truncate"}`,title:typeof t=="string"?t:void 0,children:t})]}),TE=({agent:e,isExpanded:t,onToggleExpand:n})=>{const r=l=>!l||Object.keys(l).length===0?a.jsx("span",{className:"text-sm",children:"N/A"}):a.jsx("ul",{className:"list-inside list-disc pl-1",children:Object.entries(l).map(([c,d])=>a.jsxs("li",{className:"text-sm",children:[a.jsxs("span",{className:"capitalize",children:[c.replace(/_/g," "),":"]})," ",d?"Yes":"No"]},c))}),o=(l,c="None")=>!l||l.length===0?a.jsx("span",{children:c}):l.map(d=>a.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:d},d)),s=l=>!l||l.length===0?a.jsx("span",{children:"No skills listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold",children:c.name}),a.jsx("p",{children:c.description})]},c.id||c.name))}),i=l=>!l||l.length===0?a.jsx("span",{children:"No tools listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold text-foreground",children:c.name}),a.jsx("p",{className:"mb-1",children:c.description})]},c.name))});return a.jsx("div",{className:"h-[400px] cursor-pointer w-full sm:w-[380px] flex-shrink-0 bg-card rounded-lg",onClick:n,role:"button",tabIndex:0,"aria-expanded":t,children:a.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:[a.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:[a.jsx("div",{className:"flex items-center p-4",children:a.jsxs("div",{className:"flex min-w-0 items-center",children:[a.jsx(Zl,{className:"mr-3 h-8 w-8 flex-shrink-0 text-[var(--color-brand-wMain)]"}),a.jsx("div",{className:"min-w-0",children:a.jsx("h2",{className:"truncate text-xl font-semibold",title:e.name,children:e.displayName||e.name})})]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-3 overflow-y-auto p-4",children:[a.jsx("div",{className:"mb-2 line-clamp-4 text-base",children:e.description||"No description provided."}),a.jsx(lt,{label:"Version",value:e.version,icon:a.jsx(ha,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&a.jsx(lt,{label:"Key Capabilities",value:r(e.capabilities),icon:a.jsx(ga,{size:14}),fullWidthValue:!0})]}),a.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for details"})]}),a.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:[a.jsx("div",{className:"flex items-center p-3",children:a.jsxs("h3",{className:"text-md truncate font-semibold",title:e.name,children:["Details: ",e.displayName||e.name]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-1.5 overflow-y-auto p-3 text-xs",children:[a.jsx(lt,{label:"Name",value:e.name,icon:a.jsx(wi,{size:14})}),a.jsx(lt,{label:"Description",value:e.description,icon:a.jsx(cm,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Version",value:e.version,icon:a.jsx(ha,{size:14})}),a.jsx(lt,{label:"Endpoint",value:e.url||"N/A",icon:a.jsx(ql,{size:14})}),a.jsx(lt,{label:"Docs",value:e.documentationUrl?a.jsx("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"break-all",children:"View Docs"}):"N/A",icon:a.jsx(Ul,{size:14})}),e.provider&&a.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[a.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Provider"}),a.jsx(lt,{label:"Name",value:e.provider.organization}),a.jsx(lt,{label:"URL",value:e.provider.url||"N/A"})]}),a.jsx(lt,{label:"Capabilities",value:r(e.capabilities),icon:a.jsx(ga,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Input Modes",value:o(e.defaultInputModes),icon:a.jsx(xa,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Output Modes",value:o(e.defaultOutputModes),icon:a.jsx(xa,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Skills",value:s(e.skills),icon:a.jsx(um,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Tools Info",value:i(e.tools),icon:a.jsx(Wl,{size:14}),fullWidthValue:!0}),a.jsx("div",{className:"text-2xs mt-1.5 pt-1.5",children:a.jsx(lt,{label:"A2A Protocol",value:e.protocolVersion})})]}),a.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for summary"})]})]})})},ui=({agents:e})=>{const[t,n]=u.useState(null),[r,o]=u.useState(""),s=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 a.jsx("div",{children:e.length===0?a.jsx("div",{className:"flex h-[calc(100vh-250px)] items-center justify-center",children:"No agents discovered in the current namespace."}):a.jsxs("div",{className:"mx-auto mt-[50px] ml-[50px]",children:[a.jsx("div",{className:"my-4",children:a.jsx("input",{type:"text","data-testid":"agent-search-input",placeholder:"Search...",value:r,onChange:l=>o(l.target.value),className:"bg-background rounded-md border px-3 py-2"})}),i.length===0&&r?a.jsxs("div",{className:"flex h-[calc(100vh-250px)] flex-col items-center justify-center gap-6",children:["No agents match your search.",a.jsx(Ae,{variant:"outline",title:"Clear Search",onClick:()=>o(""),children:"Clear Search"})]}):a.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:a.jsx("div",{className:"flex flex-wrap gap-10",children:i.map(l=>a.jsx(TE,{agent:l,isExpanded:t===l.name,onToggleExpand:()=>s(l.name)},l.name))})})]})})},Ep={LAYOUT:"layout"};class AE{constructor(){ua(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:Ep.LAYOUT,id:"cards",label:"Cards",icon:dm,priority:100,render:t=>a.jsx(ui,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const Tp=new AE,NE=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=Tp.getPluginsByType(Ep.LAYOUT);return r&&r.length>1?a.jsxs("div",{className:`flex items-center space-x-1 ${n}`,children:[a.jsx("span",{className:"text-sm font-semibold",children:"Layout:"}),a.jsx("div",{className:"flex gap-1 rounded-sm p-1",children:r.map(o=>{const s=o.icon,i=e===o.id;return a.jsxs(Ae,{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:[s&&a.jsx(s,{size:14}),a.jsx("span",{children:o.label})]},o.id)})})]}):null},Ol={CARDS:"cards"};function kE(){const{agents:e,agentsLoading:t,agentsError:n,agentsRefetch:r}=Ue(),[o,s]=u.useState("cards");if(t)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx("div",{children:"Loading agents..."})})});if(n)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx(oa,{variant:"error",message:`Error loading agents. ${n}`})})});const i=()=>{if(o===Ol.CARDS)return a.jsx(ui,{agents:e});const l=Tp.getPluginById(o);return l?l.render({agents:e}):(console.warn(`Layout ${o} not found, falling back to cards layout`),a.jsx(ui,{agents:e}))};return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(Cp,{title:"Agents",buttons:[a.jsxs(Ae,{variant:"ghost",title:"Refresh Agents",onClick:()=>r(),children:[a.jsx(Yl,{className:"size-4"}),"Refresh Agents"]})]}),a.jsxs("div",{className:`relative flex-1 p-4 ${o===Ol.CARDS?"":"bg-[var(--muted)] dark:bg-[var(--color-bg-wMain)]"}`,children:[a.jsx("div",{className:"absolute right-8 z-20 flex items-center space-x-4",children:a.jsx(NE,{currentLayout:o,onLayoutChange:s})}),i()]})]})}const _E=({isOpen:e,onClose:t,onConfirm:n,sessionName:r})=>e?a.jsx(Go,{open:e,onOpenChange:t,children:a.jsxs(Vo,{children:[a.jsxs(Yo,{children:[a.jsx(Ko,{children:"Are you sure?"}),a.jsxs(qo,{children:["This action cannot be undone. This will permanently delete the chat session: ",a.jsx("strong",{children:r}),"."]})]}),a.jsxs(Nv,{children:[a.jsx(Ae,{variant:"outline",onClick:t,children:"Cancel"}),a.jsx(Ae,{variant:"destructive",onClick:n,children:"Delete"})]})]})}):null,co=4,di={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},IE={chatPanelSizes:{...di.chatPanelSizes,min:50},sidePanelSizes:{...di.sidePanelSizes,max:50}};function jE(){var $;const{agents:e,sessionId:t,messages:n,setMessages:r,selectedAgentName:o,setSelectedAgentName:s,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,openSidePanelTab:c,setTaskIdInSidePanel:d,isResponding:f,latestStatusText:p,sessionToDelete:m,closeSessionDeleteModal:h,confirmSessionDelete:x}=Ue(),{isTaskMonitorConnected:g,isTaskMonitorConnecting:v,taskMonitorSseError:b,connectTaskMonitorStream:w}=Vi(),[y,E]=u.useState(!0),[T,_]=u.useState(!1),I=Xu(),[A,q]=u.useState(!1),K=u.useRef(null),U=u.useRef(null),Y=u.useRef(null),{chatPanelSizes:J,sidePanelSizes:O}=u.useMemo(()=>y?di:IE,[y]),X=u.useCallback(L=>{if(_(!0),U.current)if(L)U.current.resize(co);else{const G=Y.current||O.default;U.current.resize(G)}setTimeout(()=>_(!1),300)},[O.default]),N=u.useCallback(()=>{l(!0)},[l]),R=u.useCallback(()=>{l(!1)},[l]),S=u.useCallback(L=>{L>co+1&&(Y.current=L)},[]),F=u.useCallback(()=>{E(!y)},[y]);u.useEffect(()=>{U.current&&i&&U.current.resize(co);const L=()=>{if(U.current&&i){_(!0);const G=Y.current||O.default;U.current.resize(G),l(!1),setTimeout(()=>_(!1),300)}};return window.addEventListener("expand-side-panel",L),()=>{window.removeEventListener("expand-side-panel",L)}},[i,l,O.default]),u.useEffect(()=>{if(!o&&e.length>0){const L=e.find(Q=>Q.name==="OrchestratorAgent"),G=L?L.name:e[0].name;s(G);const k=e.find(Q=>Q.name===G),V=k!=null&&k.displayName?`Hi! I'm the ${k==null?void 0:k.displayName} Agent. How can I help?`:`Hi! I'm ${G}. How can I help?`;r(Q=>[...Q.filter(oe=>!oe.isStatusBubble),{role:"agent",kind:"message",messageId:`welcome-${Date.now()}`,parts:[{kind:"text",text:V}],isUser:!1,isComplete:!0,metadata:{sessionId:t,lastProcessedEventSequence:0}}])}},[e,o,t,r,s]);const M=u.useMemo(()=>{const L=new Map;return n.forEach((G,k)=>{G.taskId&&L.set(G.taskId,k)}),L},[n]),P=u.useMemo(()=>n.find(L=>L.isStatusBubble),[n]),ee=u.useMemo(()=>{if(!P||!P.parts)return null;const L=P.parts.find(G=>G.kind==="text");return(L==null?void 0:L.text)||null},[P]),D=u.useMemo(()=>{if(P!=null&&P.taskId)return()=>{d(P.taskId),c("workflow")}},[P==null?void 0:P.taskId,d,c]);return u.useEffect(()=>{const L=()=>{!g&&!v&&b&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),w())};return window.addEventListener("focus",L),()=>{window.removeEventListener("focus",L)}},[g,v,b,w]),a.jsxs("div",{className:"relative flex h-screen w-full flex-col overflow-hidden",children:[a.jsx("div",{className:`absolute top-0 left-0 z-20 h-screen transition-transform duration-300 ${y?"-translate-x-full":"translate-x-0"}`,children:a.jsx(zC,{onToggle:F})}),a.jsx("div",{className:`transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:a.jsx(Cp,{title:I,leadingAction:y?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{variant:"ghost",onClick:F,className:"h-10 w-10 p-0",tooltip:"Show Sessions Panel",children:a.jsx(Kl,{className:"size-5"})}),a.jsx("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),a.jsx(Ae,{variant:"ghost",onClick:()=>q(!0),className:"h-10 w-10 p-0",tooltip:"Start New Chat Session",children:a.jsx(vi,{className:"size-5"})})]}):null})}),a.jsx("div",{className:"flex min-h-0 flex-1",children:a.jsx("div",{className:`min-h-0 flex-1 overflow-x-auto transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:a.jsxs(nw,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[a.jsx(ol,{defaultSize:J.default,minSize:J.min,maxSize:J.max,id:"chat-panel",children:a.jsxs("div",{className:"flex h-full w-full flex-col py-6",children:[a.jsx(uf,{className:"text-base",ref:K,children:n.map((L,G)=>{var V;const k=!!(L.taskId&&M.get(L.taskId)===G);return a.jsx(SC,{message:L,isLastWithTaskId:k},`${((V=L.metadata)==null?void 0:V.sessionId)||"session"}-${G}-${L.isUser?"received":"sent"}`)})}),a.jsxs("div",{style:cf,children:[f&&a.jsx(ai,{statusText:(ee||p.current)??void 0,onViewWorkflow:D}),a.jsx(nb,{agents:e,scrollToBottom:($=K.current)==null?void 0:$.scrollToBottom})]})]})}),a.jsx(rw,{}),a.jsx(ol,{ref:U,defaultSize:O.default,minSize:O.min,maxSize:O.max,collapsedSize:co,collapsible:!0,onCollapse:N,onExpand:R,onResize:S,id:"chat-side-panel",className:T?"transition-all duration-300 ease-in-out":"",children:a.jsx("div",{className:"h-full",children:a.jsx(FC,{onCollapsedToggle:X,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,isSidePanelTransitioning:T})})})]})})}),a.jsx(hp,{isOpen:A,onClose:()=>q(!1)}),a.jsx(_E,{isOpen:!!m,onClose:h,onConfirm:x,sessionName:(m==null?void 0:m.name)||`Session ${m==null?void 0:m.id.substring(0,8)}`})]})}const ME=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)"}}),fi=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=Zu(),o=u.useMemo(()=>ME(r==="dark"),[r]),s=u.useMemo(()=>t===void 0||t<0?!1:t,[t]),i=u.useMemo(()=>e===null||typeof e!="object"?{value:e}:e,[e]),l=`rounded-lg border overflow-auto ${n}`.trim();return e===void 0?a.jsx("div",{className:l,children:a.jsx("span",{className:"italic",children:"No JSON data"})}):a.jsx("div",{className:l,children:a.jsx(fm,{data:i,theme:o,viewOnly:!0,collapse:s,showStringQuotes:!0,showCollectionCount:"when-closed"})})};let uo=null,fo=null;function RE({children:e}){const{fetchCsrfToken:t}=Ku(),[n,r]=u.useState(uo),[o,s]=u.useState(!uo&&!fo),[i,l]=u.useState(fo);return u.useEffect(()=>{if(uo||fo)return;let c=!0;return(async()=>{s(!0),l(null);try{let f=await ze("/api/v1/config",{credentials:"include",headers:{Accept:"application/json"}}),p;if(f.ok)p=await f.json();else{const x=await f.text();if(console.error("Initial config fetch failed:",f.status,x),f.status===403){console.log("Config fetch failed with 403, attempting to get CSRF token first...");const g=await t();if(!g)throw new Error("Failed to obtain CSRF token after config fetch failed.");if(console.log("Retrying config fetch with CSRF token..."),f=await ze("/api/v1/config",{credentials:"include",headers:{"X-CSRF-TOKEN":g,Accept:"application/json"}}),!f.ok){const v=await f.text();throw console.error("Config fetch retry failed:",f.status,v),new Error(`Failed to fetch config on retry: ${f.status} ${v}`)}p=await f.json()}else throw new Error(`Failed to fetch config: ${f.status} ${x}`)}const m=p.frontend_use_authorization??!1;m&&(console.log("Fetching CSRF token for config-related requests..."),await t());const h={configServerUrl:p.frontend_server_url,configAuthLoginUrl:p.frontend_auth_login_url,configUseAuthorization:m,configWelcomeMessage:p.frontend_welcome_message,configRedirectUrl:p.frontend_redirect_url,configCollectFeedback:p.frontend_collect_feedback,configBotName:p.frontend_bot_name,configFeatureEnablement:p.frontend_feature_enablement??{},frontend_use_authorization:p.frontend_use_authorization,persistenceEnabled:p.persistence_enabled??!0};c&&(uo=h,r(h)),console.log("App config processed and set:",h)}catch(f){if(console.error("Error initializing app:",f),c){const p=f.message||"Failed to load application configuration.";fo=p,l(p)}}finally{c&&s(!1)}})(),()=>{c=!1}},[t]),n?a.jsx(Hu.Provider,{value:n,children:e}):o?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Loading Configuration..."})]})}):i?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-red-100 dark:bg-red-900",children:a.jsxs("div",{className:"rounded border border-red-400 bg-white p-4 text-center dark:bg-gray-800",children:[a.jsx("h1",{className:"text-xl font-bold text-red-700 dark:text-red-300",children:"Configuration Error"}),a.jsx("p",{className:"mt-2 text-red-600 dark:text-red-200",children:i}),a.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Please check the backend server and network connection, then refresh the page."})]})}):a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl",children:"Initializing Application..."})]})})}const PE=({children:e})=>{const{configServerUrl:t}=tn(),n=`${t}/api/v1`,[r,o]=u.useState(null),[s,i]=u.useState(!1),[l,c]=u.useState(!1),[d,f]=u.useState(null),[p,m]=u.useState({}),[h,x]=u.useState([]),[g,v]=u.useState(null),[b,w]=u.useState(0),[y,E]=u.useState(!1),T=10,_=u.useRef(null),I=u.useRef(null),A=u.useRef(null);u.useEffect(()=>{I.current=r},[r]);const q=u.useCallback(S=>{m(F=>{var D,$,L;const M=S.task_id;if(!M)return S.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",S),F;const P=F[M],ee=new Date(S.timestamp);if(P){const G=[...P.events,S].sort((k,V)=>new Date(k.timestamp).getTime()-new Date(V.timestamp).getTime());return{...F,[M]:{...P,events:G,lastUpdated:ee}}}else{let G="Task started...";if(S.direction==="request"&&(($=(D=S.full_payload)==null?void 0:D.method)!=null&&$.startsWith("message/"))){const V=S.full_payload.params;if((L=V==null?void 0:V.message)!=null&&L.parts){const Q=V.message.parts.filter(te=>te.kind==="text"&&te.text);Q.length>0&&(G=Q[Q.length-1].text)}}const k={taskId:M,initialRequestText:G,events:[S],firstSeen:ee,lastUpdated:ee};return x(V=>[M,...V.filter(Q=>Q!==M)]),{...F,[M]:k}}})},[]),K=u.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),i(!1),c(!0),f(null),w(0),E(!1),A.current&&(clearTimeout(A.current),A.current=null)},[]),U=u.useCallback(S=>{try{const F=JSON.parse(S.data);q(F)}catch(F){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",F,"Raw data:",S.data),f("Received unparseable 'a2a_message' event from server.")}},[q]),Y=u.useCallback(S=>{console.error("TaskMonitorContext: SSE connection error:",S),i(!1),c(!1),_.current&&_.current.readyState===EventSource.CLOSED?f("Task Monitor SSE connection closed by server or network issue."):f("Task Monitor SSE connection error occurred."),_.current&&(_.current.close(),_.current=null),A.current&&(clearTimeout(A.current),A.current=null)},[]),J=u.useCallback(async()=>{if(l||s){console.warn("TaskMonitorContext: Stream is already active or connecting.");return}console.log("TaskMonitorContext: Attempting to connect stream..."),i(!0);try{const S={subscription_targets:[{type:"my_a2a_messages"}]},F=await ze(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S),credentials:"include"});if(!F.ok){const L=await F.json().catch(()=>({detail:"Failed to subscribe"}));if(L.error_type==="authorization_failure"){const G=L.message||"Access denied: insufficient permissions",k=L.suggested_action?` ${L.suggested_action}`:"";throw new Error(`${G}${k}`)}else if(L.error_type==="subscription_failure"){const G=L.message||"Subscription failed",k=L.suggested_action?` ${L.suggested_action}`:"";throw new Error(`${G}${k}`)}else throw new Error(L.detail||L.message||`Subscription failed: ${F.statusText}`)}const M=await F.json();o(M.stream_id);const P=M.sse_endpoint_url.startsWith("/")?`${t||""}${M.sse_endpoint_url}`:M.sse_endpoint_url;_.current&&_.current.close();const ee=bi(),D=`${P}${ee?`?token=${ee}`:""}`,$=new EventSource(D,{withCredentials:!0});_.current=$,$.onopen=K,$.addEventListener("a2a_message",U),$.onerror=Y}catch(S){console.error("TaskMonitorContext: Error connecting stream:",S),f(S instanceof Error?S.message:String(S)),i(!1),c(!1),o(null),_.current&&(_.current.close(),_.current=null),A.current&&(clearTimeout(A.current),A.current=null)}},[n,t,l,s,K,U,Y]),O=u.useCallback(()=>{if(A.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(b>=T){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),E(!1),f(`Connection lost. Max reconnection attempts (${T}) reached.`);return}const S=2e3;console.log(`TaskMonitorContext: Attempting reconnection ${b+1}/${T} in ${S}ms...`),E(!0),w(F=>F+1),A.current=setTimeout(()=>{J()},S)},[b,J]),X=u.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),A.current&&(clearTimeout(A.current),A.current=null),_.current&&(_.current.close(),_.current=null);const S=I.current;if(S)try{await ze(`${n}/visualization/${S}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(F){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${S}`,F)}o(null),i(!1),c(!1),f(null),m({}),x([]),v(null),w(0),E(!1)},[n]);u.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),_.current&&(_.current.close(),_.current=null);const S=I.current;if(S)if(navigator.sendBeacon){const F=new FormData;navigator.sendBeacon(`${n}/visualization/${S}/unsubscribe`,F)}else ze(`${n}/visualization/${S}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(F=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",F))},[n]),u.useEffect(()=>{!l&&!s&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),J())},[]),u.useEffect(()=>{!l&&!s&&d&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),O())},[l,s,d,O]),u.useEffect(()=>()=>{A.current&&(clearTimeout(A.current),A.current=null)},[]);const N=u.useCallback(S=>{v(S)},[]),R={isTaskMonitorConnecting:s,isTaskMonitorConnected:l,taskMonitorSseError:d,monitoredTasks:p,monitoredTaskOrder:h,highlightedStepId:g,isReconnecting:y,reconnectionAttempts:b,connectTaskMonitorStream:J,disconnectTaskMonitorStream:X,setHighlightedStepId:N};return a.jsx(Gu.Provider,{value:R,children:e})},LE=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n}=tn(),r=`${n}/api/v1`,o=1*1024*1024,s=B=>new Promise((z,H)=>{const ie=new FileReader;ie.readAsDataURL(B),ie.onload=()=>z(ie.result.split(",")[1]),ie.onerror=fe=>H(fe)}),[i,l]=u.useState(""),[c,d]=u.useState([]),[f,p]=u.useState(""),[m,h]=u.useState(!1),[x,g]=u.useState([]),[v,b]=u.useState(null),w=u.useRef(null),[y,E]=u.useState(""),[T,_]=u.useState(!1),I=u.useRef(T);u.useEffect(()=>{I.current=T},[T]);const[A,q]=u.useState(null),K=u.useRef(null),U=u.useRef(!1),Y=u.useRef(null),J=u.useRef(0),{agents:O,error:X,isLoading:N,refetch:R}=hw(),{artifacts:S,isLoading:F,refetch:M}=gw(i),[P,ee]=u.useState(!0),[D,$]=u.useState("files"),[L,G]=u.useState(!1),[k,V]=u.useState(null),[Q,te]=u.useState(!1),[oe,se]=u.useState(new Set),[de,me]=u.useState(!1),[Me,Oe]=u.useState(null),[Le,je]=u.useState(null),[He,ot]=u.useState(null),[Qe,et]=u.useState(null),le=u.useCallback((B,z)=>{g(H=>{if(H.find(ge=>ge.message===B))return H;const fe=Date.now().toString(),pe={id:fe,message:B,type:z||"info"};return setTimeout(()=>{g(ge=>ge.filter(_e=>_e.id!==fe))},3e3),[...H,pe]})},[]),pt=u.useCallback(async B=>{const z=await ze(`${r}/sessions/${B}/messages`);if(!z.ok){const H=await z.json().catch(()=>({detail:"Failed to fetch session history"}));throw new Error(H.detail||`HTTP error ${z.status}`)}return z.json()},[r]),tt=u.useCallback(async B=>{const z=new FormData;z.append("file",B);try{const H=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B.name)}`,{method:"POST",body:z,credentials:"include"});if(!H.ok){const fe=await H.json().catch(()=>({detail:`Failed to upload ${B.name}`}));throw new Error(fe.detail||`HTTP error ${H.status}`)}const ie=await H.json();return le(`Artifact "${B.name}" uploaded successfully.`),await M(),ie.uri||null}catch(H){return le(`Error uploading artifact "${B.name}": ${H instanceof Error?H.message:"Unknown error"}`),null}},[r,le,M]),[mt,jt]=u.useState(null),[wt,Et]=u.useState(null),Tt=u.useCallback(async B=>{try{const z=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}`,{method:"DELETE",credentials:"include"});if(!z.ok&&z.status!==204){const H=await z.json().catch(()=>({detail:`Failed to delete ${B}`}));throw new Error(H.detail||`HTTP error ${z.status}`)}le(`File "${B}" deleted successfully.`),M()}catch(z){le(`Error deleting file "${B}": ${z instanceof Error?z.message:"Unknown error"}`)}},[r,le,M]),Wt=u.useCallback(B=>{V(B),G(!0)},[]),ht=u.useCallback(()=>{V(null),G(!1)},[]),At=u.useCallback(async()=>{k&&await Tt(k.filename),ht()},[k,Tt,ht]),Ke=u.useCallback(()=>{if(oe.size===0){le("No files selected for deletion.");return}me(!0)},[oe,le]),gt=u.useCallback(async()=>{me(!1);const B=Array.from(oe);let z=0,H=0;for(const ie of B)try{const fe=await ze(`${r}/artifacts/${encodeURIComponent(ie)}`,{method:"DELETE",credentials:"include"});if(!fe.ok&&fe.status!==204)throw new Error(`Failed to delete ${ie}`);z++}catch(fe){console.error(fe),H++}z>0&&le(`${z} files(s) deleted successfully.`),H>0&&le(`Failed to delete ${H} files(s).`),M(),se(new Set),te(!1)},[oe,r,le,M]),Mt=u.useCallback(async B=>{je(null),ot(null),et(null);try{const z=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions`,{credentials:"include"});if(!z.ok)throw new Error("Error fetching version list");const H=await z.json();if(!H||H.length===0)throw new Error("No versions available");je(H.sort((ue,Ie)=>ue-Ie));const ie=Math.max(...H);ot(ie);const fe=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions/${ie}`,{credentials:"include"});if(!fe.ok)throw new Error("Error fetching latest version content");const pe=await fe.blob(),ge=await new Promise((ue,Ie)=>{const Z=new FileReader;Z.onloadend=()=>{var C;return ue(((C=Z.result)==null?void 0:C.toString().split(",")[1])||"")},Z.onerror=Ie,Z.readAsDataURL(pe)}),_e=S.find(ue=>ue.filename===B),ae={name:B,mime_type:(_e==null?void 0:_e.mime_type)||"application/octet-stream",content:ge,last_modified:(_e==null?void 0:_e.last_modified)||new Date().toISOString()};return et(ae),ae}catch(z){return le(`Error loading preview for ${B}: ${z instanceof Error?z.message:"Unknown error"}`),null}},[r,le,S]),Rt=u.useCallback(async(B,z)=>{if(!Le||!Le.includes(z))return le(`Version ${z} is not available for ${B}.`),null;et(null);try{const H=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions/${z}`,{credentials:"include"});if(!H.ok)throw new Error(`Error fetching version ${z}`);const ie=await H.blob(),fe=await new Promise((_e,ae)=>{const ue=new FileReader;ue.onloadend=()=>{var Ie;return _e(((Ie=ue.result)==null?void 0:Ie.toString().split(",")[1])||"")},ue.onerror=ae,ue.readAsDataURL(ie)}),pe=S.find(_e=>_e.filename===B),ge={name:B,mime_type:(pe==null?void 0:pe.mime_type)||"application/octet-stream",content:fe,last_modified:(pe==null?void 0:pe.last_modified)||new Date().toISOString()};return ot(z),et(ge),ge}catch(H){return le(`Error loading version ${z}: ${H instanceof Error?H.message:"Unknown error"}`),null}},[r,le,S,Le]),nn=u.useCallback(B=>{le(`Loading preview for attached file: ${B.name}`),et(B),je(null),ot(null)},[le]),Nt=u.useCallback(B=>{ee(!1),$(B),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:B}}))},[]),De=u.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=null),w.current&&(w.current.close(),w.current=null),U.current=!1},[]),qe=u.useCallback(B=>{var Z;J.current+=1;const z=J.current;let H;try{console.log("TEST-SSE ChatProvider Raw Message:",B.data),H=JSON.parse(B.data)}catch(C){console.error("Failed to parse SSE message:",C),le("Received unparseable agent update.","error");return}if("error"in H&&H.error){const j=`Error: ${H.error.message}`;d(W=>{const he=W.filter(ye=>!ye.isStatusBubble);return he.push({role:"agent",parts:[{kind:"text",text:j}],isUser:!1,isError:!0,isComplete:!0,metadata:{messageId:`msg-${crypto.randomUUID()}`,lastProcessedEventSequence:z}}),he}),h(!1),De(),b(null);return}if(!("result"in H)||!H.result){console.warn("Received SSE message without a result or error field.",H);return}const ie=H.result;let fe=!1,pe,ge,_e;switch(ie.kind){case"task":fe=!0,pe=void 0,_e=ie.id,ie.artifacts&&ie.artifacts.length>0&&console.log("Final task has artifacts to process:",ie.artifacts);break;case"status-update":fe=ie.final,pe=(Z=ie.status)==null?void 0:Z.message,_e=ie.taskId;break;case"artifact-update":ge=ie.artifact,_e=ie.taskId;break;default:console.warn("Received unknown result kind in SSE message:",ie);return}const ae=[],ue=[];let Ie=null;if(pe!=null&&pe.parts)for(const C of pe.parts)if(C.kind==="data"){const j=C.data;if(j&&typeof j=="object"&&"type"in j)switch(j.type){case"agent_progress_update":Ie=String((j==null?void 0:j.status_text)??"Processing...");break;case"artifact_creation_progress":Ie=`Saving artifact: ${String((j==null?void 0:j.filename)??"unknown file")} (${Number((j==null?void 0:j.bytes_saved)??0)} bytes)`;break;case"tool_invocation_start":break;default:ae.push(C)}}else if(C.kind==="file"){const W=C.file,he={name:W.name||"untitled_file",mime_type:W.mimeType};"bytes"in W&&W.bytes?he.content=W.bytes:"uri"in W&&W.uri&&(he.uri=W.uri),ue.push(he)}else ae.push(C);Ie&&(Y.current=Ie),d(C=>{var Re;const j=[...C];let W=j[j.length-1];W!=null&&W.isStatusBubble&&(j.pop(),W=j[j.length-1]);const he=ae.find(we=>we.kind==="text"),ye=ae.filter(we=>we.kind!=="text");if(W&&!W.isUser&&!W.isComplete&&W.taskId===ie.taskId&&(he||ue.length>0)){const we={...W,parts:[...W.parts],files:W.files?[...W.files]:[],isComplete:fe||ue.length>0,metadata:{...W.metadata,lastProcessedEventSequence:z}};if(he){const xe=we.parts[we.parts.length-1];(xe==null?void 0:xe.kind)==="text"?we.parts[we.parts.length-1]={...xe,text:xe.text+he.text}:we.parts.push(he)}ye.length>0&&we.parts.push(...ye),ue.length>0&&we.files.push(...ue),j[j.length-1]=we}else if(ae.some(xe=>xe.kind==="text"&&xe.text.trim())||ue.length>0||ge){const xe={role:"agent",parts:ae,files:ue.length>0?ue:void 0,taskId:ie.taskId,isUser:!1,isComplete:fe||ue.length>0,metadata:{messageId:((Re=H.id)==null?void 0:Re.toString())||`msg-${crypto.randomUUID()}`,sessionId:ie.contextId,lastProcessedEventSequence:z}};ge&&(xe.artifactNotification={name:ge.name||ge.artifactId}),j.push(xe)}if(!fe&&Y.current)j.push({role:"agent",parts:[{kind:"text",text:Y.current}],taskId:ie.taskId,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{messageId:`status-${crypto.randomUUID()}`,lastProcessedEventSequence:z}});else if(fe){Y.current=null;const we=j.findLastIndex(xe=>!xe.isUser&&xe.taskId===_e);we!==-1&&(j[we]={...j[we],isComplete:!0,metadata:{...j[we].metadata,lastProcessedEventSequence:z}})}return j}),fe&&(I.current&&(le("Task successfully cancelled."),K.current&&clearTimeout(K.current),_(!1)),h(!1),De(),b(null),U.current=!0,M(),setTimeout(()=>{U.current=!1},100))},[le,De,M]),st=u.useCallback(async()=>{const B="ChatProvider.handleNewSession:";if(console.log(`${B} Starting new session process...`),De(),m&&v&&y&&!T){console.log(`${B} Cancelling current task ${v}`);try{const H={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}};ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H),credentials:"include"})}catch(H){console.warn(`${B} Failed to cancel current task:`,H)}}K.current&&(clearTimeout(K.current),K.current=null),_(!1),console.log(`${B} Resetting session state - new session will be created when first message is sent`),l(""),d(t?[{parts:[{kind:"text",text:t}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:"",lastProcessedEventSequence:0}}]:[]),p(""),h(!1),b(null),q(null),Oe(null),U.current=!1,Y.current=null,J.current=0,console.log(`${B} Refreshing artifacts for new session...`),await M(),le("New session started successfully."),console.log(`${B} New session setup complete - session will be created on first message.`)},[De,m,v,y,T,t,le,M]),rn=u.useCallback(async B=>{const z="ChatProvider.handleSwitchSession:";if(console.log(`${z} Switching to session ${B}...`),De(),m&&v&&y&&!T){console.log(`${z} Cancelling current task ${v}`);try{const H={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}};await ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H),credentials:"include"})}catch(H){console.warn(`${z} Failed to cancel current task:`,H)}}K.current&&(clearTimeout(K.current),K.current=null),_(!1);try{const ie=(await pt(B)).map(pe=>({parts:[{kind:"text",text:pe.message}],isUser:pe.sender_type==="user",isComplete:!0,role:pe.sender_type==="user"?"user":"agent",metadata:{sessionId:pe.session_id,messageId:pe.id,lastProcessedEventSequence:0}})),fe=await ze(`${r}/sessions/${B}`);if(fe.ok){const pe=await fe.json();jt(pe.name)}l(B),d(ie),p(""),h(!1),b(null),q(null),Oe(null),U.current=!1,Y.current=null,J.current=0}catch(H){console.error(`${z} Failed to fetch session history:`,H),le("Error switching session. Please try again.","error")}},[De,m,v,y,T,r,le,pt]),on=u.useCallback(async(B,z)=>{try{const H=await ze(`${r}/sessions/${B}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z})});if(!H.ok){const ie=await H.json().catch(()=>({detail:"Failed to update session name"}));throw new Error(ie.detail||`HTTP error ${H.status}`)}le("Session name updated successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(H){le(`Error updating session name: ${H instanceof Error?H.message:"Unknown error"}`)}},[r,le]),Pe=u.useCallback(async B=>{try{const z=await ze(`${r}/sessions/${B}`,{method:"DELETE"});if(!z.ok){const H=await z.json().catch(()=>({detail:"Failed to delete session"}));throw new Error(H.detail||`HTTP error ${z.status}`)}le("Session deleted successfully."),B===i&&st(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(z){le(`Error deleting session: ${z instanceof Error?z.message:"Unknown error"}`)}},[r,le,st,i]),xt=u.useCallback(B=>{Et(B)},[]),sn=u.useCallback(()=>{Et(null)},[]),Gt=u.useCallback(async()=>{wt&&(await Pe(wt.id),Et(null))},[wt,Pe]),Pt=u.useCallback(async()=>{if(!m&&!T||!v){le("No active task to cancel.");return}if(T){le("Cancellation already in progress.");return}le(`Requesting cancellation for task ${v}...`),_(!0);try{const B={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}},z=await ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(z.status===202)K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{le(`Cancellation for task ${v} timed out. Allowing new input.`),_(!1),h(!1),De(),b(null),K.current=null,d(H=>H.filter(ie=>!ie.isStatusBubble))},15e3);else{const H=await z.json().catch(()=>({detail:"Unknown cancellation error"}));le(`Failed to request cancellation: ${H.detail||z.statusText}`),_(!1)}}catch(B){le(`Error sending cancellation request: ${B instanceof Error?B.message:"Network error"}`),_(!1)}},[m,T,v,r,le,De]),Lt=u.useCallback(()=>{},[]),Dt=u.useCallback(()=>{m&&!U.current&&!I.current&&le("Connection error with agent updates."),U.current||(h(!1),I.current||(De(),b(null)),Y.current=null),d(B=>B.filter(z=>!z.isStatusBubble).map((z,H,ie)=>H===ie.length-1&&!z.isUser?{...z,isComplete:!0}:z))},[le,De,m]),be=u.useCallback(async(B,z,H)=>{console.log("handleSubmit: using sessionId",i),B.preventDefault();const ie=(H==null?void 0:H.trim())||f.trim(),fe=z||[];if(!ie&&fe.length===0||m||T||!y){y||le("Please select an agent first."),T&&le("Cannot send new message while a task is being cancelled.");return}De(),U.current=!1,h(!0),b(null),Y.current=null,J.current=0;const pe={role:"user",parts:[{kind:"text",text:ie}],isUser:!0,uploadedFiles:fe.length>0?fe:void 0,metadata:{messageId:`msg-${crypto.randomUUID()}`,sessionId:i,lastProcessedEventSequence:0}};Y.current="Thinking",d(ge=>[...ge,pe]),p("");try{const ge=fe.map(async ye=>{if(ye.size<o)return{kind:"file",file:{bytes:await s(ye),name:ye.name,mimeType:ye.type}};{const Re=await tt(ye);return Re?{kind:"file",file:{uri:Re,name:ye.name,mimeType:ye.type}}:(le(`Failed to upload large file: ${ye.name}`,"error"),null)}}),_e=(await Promise.all(ge)).filter(ye=>ye!==null),ae=[];if(ie&&ae.push({kind:"text",text:ie}),ae.push(..._e),ae.length===0)throw new Error("Cannot send an empty message.");console.log(`ChatProvider handleSubmit: Using sessionId for contextId: ${i}`);const ue={role:"user",parts:ae,messageId:`msg-${crypto.randomUUID()}`,kind:"message",contextId:i,metadata:{agent_name:y}},Ie={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"message/stream",params:{message:ue}};console.log("ChatProvider handleSubmit: Sending POST to /message:stream");const Z=await ze(`${r}/message:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)});if(!Z.ok){const ye=await Z.json().catch(()=>({detail:"Unknown error"}));throw console.error("ChatProvider handleSubmit: Error from /message:stream",Z.status,ye),new Error(ye.detail||`HTTP error ${Z.status}`)}const C=await Z.json(),j=C==null?void 0:C.result,W=j==null?void 0:j.id,he=j==null?void 0:j.contextId;if(console.log(`ChatProvider handleSubmit: Extracted responseSessionId: ${he}, current sessionId: ${i}`),console.log("ChatProvider handleSubmit: Full result object:",C),!W)throw console.error("ChatProvider handleSubmit: Backend did not return a valid taskId. Result:",C),new Error("Backend did not return a valid taskId.");if(console.log(`ChatProvider handleSubmit: Checking session update condition - responseSessionId: ${he}, sessionId: ${i}, different: ${he!==i}`),he&&he!==i){console.log(`ChatProvider handleSubmit: Updating sessionId from ${i} to ${he}`);const ye=!i||i==="";l(he),d(Re=>Re.map(we=>{var xe,it;return((xe=we.metadata)==null?void 0:xe.messageId)===((it=pe.metadata)==null?void 0:it.messageId)?{...we,metadata:{...we.metadata,sessionId:he}}:we})),ye&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}console.log(`ChatProvider handleSubmit: Received taskId ${W}. Setting currentTaskId and taskIdInSidePanel.`),b(W),q(W)}catch(ge){console.error("ChatProvider handleSubmit: Catch block error",ge),le(`Error: ${ge instanceof Error?ge.message:"Unknown error"}`),h(!1),d(_e=>_e.filter(ae=>!ae.isStatusBubble)),b(null),U.current=!1,Y.current=null}},[f,m,T,i,y,r,le,De,tt]);u.useEffect(()=>{if(v&&r){console.log(`ChatProvider Effect: currentTaskId is ${v}. Setting up EventSource.`);const B=bi(),z=`${r}/sse/subscribe/${v}${B?`?token=${B}`:""}`,H=new EventSource(z,{withCredentials:!0});return w.current=H,H.onopen=Lt,H.onerror=Dt,H.addEventListener("status_update",qe),H.addEventListener("artifact_update",qe),H.addEventListener("final_response",qe),H.addEventListener("error",qe),()=>{console.log(`ChatProvider Effect Cleanup: currentTaskId was ${v}. Closing EventSource.`),H.removeEventListener("status_update",qe),H.removeEventListener("artifact_update",qe),H.removeEventListener("final_response",qe),H.removeEventListener("error",qe),De()}}else console.log("ChatProvider Effect: currentTaskId is null or apiPrefix missing. Ensuring EventSource is closed."),De()},[v,r,qe,Lt,Dt,De]);const Ee={sessionId:i,setSessionId:l,sessionName:mt,setSessionName:jt,messages:c,setMessages:d,userInput:f,setUserInput:p,isResponding:m,currentTaskId:v,isCancelling:T,latestStatusText:Y,agents:O,agentsLoading:N,agentsError:X,agentsRefetch:R,handleNewSession:st,handleSwitchSession:rn,handleSubmit:be,handleCancel:Pt,notifications:x,addNotification:le,selectedAgentName:y,setSelectedAgentName:E,artifacts:S,artifactsLoading:F,artifactsRefetch:M,uploadArtifactFile:tt,isSidePanelCollapsed:P,activeSidePanelTab:D,setIsSidePanelCollapsed:ee,setActiveSidePanelTab:$,openSidePanelTab:Nt,taskIdInSidePanel:A,setTaskIdInSidePanel:q,isDeleteModalOpen:L,artifactToDelete:k,openDeleteModal:Wt,closeDeleteModal:ht,confirmDelete:At,openSessionDeleteModal:xt,closeSessionDeleteModal:sn,confirmSessionDelete:Gt,sessionToDelete:wt,isArtifactEditMode:Q,setIsArtifactEditMode:te,selectedArtifactFilenames:oe,setSelectedArtifactFilenames:se,handleDeleteSelectedArtifacts:Ke,confirmBatchDeleteArtifacts:gt,isBatchDeleteModalOpen:de,setIsBatchDeleteModalOpen:me,previewedArtifactAvailableVersions:Le,currentPreviewedVersionNumber:He,previewFileContent:Qe,openArtifactForPreview:Mt,navigateArtifactVersion:Rt,openMessageAttachmentForPreview:nn,previewArtifact:Me,setPreviewArtifact:Oe,updateSessionName:on,deleteSession:Pe};return a.jsx(Uu.Provider,{value:Ee,children:e})},DE=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=tn(),{fetchCsrfToken:r,clearCsrfToken:o}=Ku(),[s,i]=u.useState(!1),[l,c]=u.useState(!0),[d,f]=u.useState(null);u.useEffect(()=>{let h=!0;const x=async()=>{if(!t){h&&(i(!0),c(!1));return}try{const v=await ze("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(v.ok){const b=await v.json();console.log("User is authenticated:",b),h&&(f(b),i(!0)),console.log("Fetching CSRF token for authenticated requests..."),await r()}else v.status===401?(console.log("User is not authenticated"),h&&i(!1)):(console.error("Unexpected response from /users/me:",v.status),h&&i(!1))}catch(v){console.error("Error checking authentication:",v),h&&i(!1)}finally{h&&c(!1)}};x();const g=v=>{v.key==="access_token"&&x()};return window.addEventListener("storage",g),()=>{h=!1,window.removeEventListener("storage",g)}},[t,n,r]);const p=()=>{window.location.href=n},m=()=>{i(!1),f(null),o()};return l?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Checking Authentication..."})]})}):a.jsx(Bu.Provider,{value:{isAuthenticated:s,useAuthorization:t,login:p,logout:m,userInfo:d},children:e})};function OE(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 FE=e=>new Promise(t=>setTimeout(t,e)),zE=async(e=5,t=50)=>{try{const n=await ze("/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 s=OE("csrf_token");if(s)return console.log(`CSRF token found in cookie after ${o} retries:`,s),s;console.log(`CSRF token not found in cookie, attempt ${o+1}/${e}. Waiting ${t}ms...`),await FE(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 $E({children:e}){const[t,n]=u.useState(null),r=u.useCallback(async()=>{if(t)return t;const i=await zE();if(i)n(i);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return i},[t]),o=u.useCallback(()=>{n(null)},[]),s={fetchCsrfToken:r,clearCsrfToken:o};return a.jsx(Wu.Provider,{value:s,children:e})}const BE={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"}},UE={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"}},HE={"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 Fl(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 WE(e,t){const n={},r=UE[t];for(const[o,s]of Object.entries(r)){const i=Fl(e,s);n[`--${o}`]=i}for(const[o,s]of Object.entries(HE)){const i=Fl(e,s);n[`--color-${o}`]=i}return n}const Mo="sam-theme";function GE(e){var n,r,o,s,i,l,c,d,f,p,m,h,x,g,v,b,w,y,E,T,_,I,A,q,K,U,Y,J,O,X,N,R,S,F,M,P,ee,D,$,L,G,k,V,Q,te,oe,se,de,me,Me,Oe,Le,je,He,ot,Qe,et,le,pt,tt,mt,jt,wt,Et,Tt,Wt,ht,At,Ke,gt,Mt,Rt,nn,Nt,De,qe,st,rn,on,Pe,xt,sn,Gt,Pt,Lt,Dt,be,Ee,B,z,H,ie,fe,pe,ge,_e,ae,ue,Ie,Z,C,j,W;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),(s=e.info)!=null&&s.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),(d=e.error)!=null&&d.w100&&(t["--color-error-w100"]=e.error.w100),(f=e.error)!=null&&f.w70&&(t["--color-error-w70"]=e.error.w70),(p=e.error)!=null&&p.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),(v=e.warning)!=null&&v.w70&&(t["--color-warning-w70"]=e.warning.w70),(b=e.warning)!=null&&b.w30&&(t["--color-warning-w30"]=e.warning.w30),(w=e.warning)!=null&&w.w20&&(t["--color-warning-w20"]=e.warning.w20),(y=e.warning)!=null&&y.w10&&(t["--color-warning-w10"]=e.warning.w10),(E=e.success)!=null&&E.wMain&&(t["--color-success-wMain"]=e.success.wMain),(T=e.success)!=null&&T.w100&&(t["--color-success-w100"]=e.success.w100),(_=e.success)!=null&&_.w70&&(t["--color-success-w70"]=e.success.w70),(I=e.success)!=null&&I.w30&&(t["--color-success-w30"]=e.success.w30),(A=e.success)!=null&&A.w20&&(t["--color-success-w20"]=e.success.w20),(q=e.success)!=null&&q.w10&&(t["--color-success-w10"]=e.success.w10),(K=e.stateLayer)!=null&&K.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(U=e.stateLayer)!=null&&U.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(J=(Y=e.accent)==null?void 0:Y.n0)!=null&&J.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(X=(O=e.accent)==null?void 0:O.n0)!=null&&X.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(R=(N=e.accent)==null?void 0:N.n0)!=null&&R.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(F=(S=e.accent)==null?void 0:S.n0)!=null&&F.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(P=(M=e.accent)==null?void 0:M.n1)!=null&&P.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(D=(ee=e.accent)==null?void 0:ee.n1)!=null&&D.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(L=($=e.accent)==null?void 0:$.n1)!=null&&L.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(k=(G=e.accent)==null?void 0:G.n1)!=null&&k.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(Q=(V=e.accent)==null?void 0:V.n1)!=null&&Q.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(oe=(te=e.accent)==null?void 0:te.n1)!=null&&oe.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(de=(se=e.accent)==null?void 0:se.n2)!=null&&de.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(Me=(me=e.accent)==null?void 0:me.n2)!=null&&Me.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),(Le=(Oe=e.accent)==null?void 0:Oe.n2)!=null&&Le.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(He=(je=e.accent)==null?void 0:je.n2)!=null&&He.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(Qe=(ot=e.accent)==null?void 0:ot.n2)!=null&&Qe.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(le=(et=e.accent)==null?void 0:et.n3)!=null&&le.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(tt=(pt=e.accent)==null?void 0:pt.n3)!=null&&tt.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(jt=(mt=e.accent)==null?void 0:mt.n3)!=null&&jt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(Et=(wt=e.accent)==null?void 0:wt.n3)!=null&&Et.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(Wt=(Tt=e.accent)==null?void 0:Tt.n4)!=null&&Wt.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(At=(ht=e.accent)==null?void 0:ht.n4)!=null&&At.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(gt=(Ke=e.accent)==null?void 0:Ke.n4)!=null&>.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Rt=(Mt=e.accent)==null?void 0:Mt.n5)!=null&&Rt.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(Nt=(nn=e.accent)==null?void 0:nn.n5)!=null&&Nt.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(qe=(De=e.accent)==null?void 0:De.n5)!=null&&qe.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(rn=(st=e.accent)==null?void 0:st.n5)!=null&&rn.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(Pe=(on=e.accent)==null?void 0:on.n6)!=null&&Pe.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(sn=(xt=e.accent)==null?void 0:xt.n6)!=null&&sn.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),(Pt=(Gt=e.accent)==null?void 0:Gt.n6)!=null&&Pt.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(Dt=(Lt=e.accent)==null?void 0:Lt.n7)!=null&&Dt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(Ee=(be=e.accent)==null?void 0:be.n7)!=null&&Ee.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),(z=(B=e.accent)==null?void 0:B.n7)!=null&&z.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(ie=(H=e.accent)==null?void 0:H.n8)!=null&&ie.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(pe=(fe=e.accent)==null?void 0:fe.n8)!=null&&pe.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(_e=(ge=e.accent)==null?void 0:ge.n8)!=null&&_e.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(ue=(ae=e.accent)==null?void 0:ae.n9)!=null&&ue.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(Ie=e.learning)!=null&&Ie.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(Z=e.learning)!=null&&Z.w100&&(t["--color-learning-w100"]=e.learning.w100),(C=e.learning)!=null&&C.w90&&(t["--color-learning-w90"]=e.learning.w90),(j=e.learning)!=null&&j.w20&&(t["--color-learning-w20"]=e.learning.w20),(W=e.learning)!=null&&W.w10&&(t["--color-learning-w10"]=e.learning.w10),t}function VE(e,t="light"){const n={};if(e){const o=GE(e);Object.assign(n,o)}const r=WE(e,t);return Object.assign(n,r),n}function YE(){const e=localStorage.getItem(Mo);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function KE(e,t){const n=VE(e,t),r=document.documentElement;for(const[o,s]of Object.entries(n))r.style.setProperty(o,s);requestAnimationFrame(()=>{console.log(`Applying ${t} theme with palette`),r.classList.remove("light","dark"),r.classList.add(t),localStorage.setItem(Mo,t)})}const qE=({children:e})=>{const t=u.useMemo(()=>BE,[]),[n,r]=u.useState(()=>YE()),o=u.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const s=n==="light"?"dark":"light";r(s),localStorage.setItem(Mo,s)}}),[n]);return u.useEffect(()=>{if(!(localStorage.getItem(Mo)!==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)}}},[]),u.useEffect(()=>{document.documentElement.classList.remove("light","dark"),KE(t,n)},[n,t]),a.jsx(Vu.Provider,{value:o,children:e})};function XE(){const[e,t]=u.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=Yu();if(xw(),o&&!n)return a.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:a.jsx(Ae,{onClick:r,children:"Login"})});const s=c=>{const d=Ll.find(f=>f.id===c)||Dl.find(f=>f.id===c);d!=null&&d.onClick&&c!=="settings"?d.onClick():c!=="settings"&&t(c)},i=()=>{t("chat")},l=()=>{switch(e){case"chat":return a.jsx(jE,{});case"agentMesh":return a.jsx(kE,{})}};return a.jsxs("div",{className:"relative flex h-screen",children:[a.jsx(bE,{items:Ll,bottomItems:Dl,activeItem:e,onItemChange:s,onHeaderClick:i}),a.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:l()}),a.jsx(Q0,{})]})}function ZE(){return a.jsx(qE,{children:a.jsx($E,{children:a.jsx(RE,{children:a.jsx(DE,{children:a.jsx(LE,{children:a.jsx(PE,{children:a.jsx(XE,{})})})})})})})}kp.createRoot(document.getElementById("root")).render(a.jsx(u.StrictMode,{children:a.jsx(ZE,{})}));
|