@agentatom/design-system 1.4.78 → 1.4.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Atom Design System
2
2
 
3
- Design tokens and React components for Atom products. Same component API as the shared design system core; brand tokens (Signal / Graphite / Snow) are baked into `tokens.css`.
3
+ Design tokens and React components for Atom products. Same component API as the shared design system core; Signal brand tokens are baked into `tokens.css`. Use `light.css` for the Snow light theme.
4
4
 
5
5
  ## Install
6
6
 
@@ -21,4 +21,4 @@ import { Button, Input, Card } from '@agentatom/design-system';
21
21
 
22
22
  ## Version
23
23
 
24
- `1.4.78` — built from the shared design-system source. Brand tokens are selected at package build time; each published package only contains its own brand assets.
24
+ `1.4.80` — built from the shared design-system source. Brand tokens are selected at package build time; each published package only contains its own brand assets.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),S=require("lucide-react"),se=require("react-dom"),z={1:16,2:20,3:24,4:28,5:48};var ge={exports:{}},me={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),T=require("lucide-react"),ne=require("react-dom"),z={1:16,2:20,3:24,4:28,5:48};var Se={exports:{}},ve={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Te;function Ze(){if(Te)return me;Te=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function n(r,a,o){var i=null;if(o!==void 0&&(i=""+o),a.key!==void 0&&(i=""+a.key),"key"in a){o={};for(var l in a)l!=="key"&&(o[l]=a[l])}else o=a;return a=o.ref,{$$typeof:t,type:r,key:i,ref:a!==void 0?a:null,props:o}}return me.Fragment=s,me.jsx=n,me.jsxs=n,me}var pe={};/**
9
+ */var Le;function ot(){if(Le)return ve;Le=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function n(a,r,o){var i=null;if(o!==void 0&&(i=""+o),r.key!==void 0&&(i=""+r.key),"key"in r){o={};for(var l in r)l!=="key"&&(o[l]=r[l])}else o=r;return r=o.ref,{$$typeof:t,type:a,key:i,ref:r!==void 0?r:null,props:o}}return ve.Fragment=s,ve.jsx=n,ve.jsxs=n,ve}var be={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var $e;function Qe(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){function t(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===M?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case j:return"Fragment";case g:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case C:return"SuspenseList";case N:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case w:return"Portal";case k:return m.displayName||"Context";case _:return(m._context.displayName||"Context")+".Consumer";case A:var $=m.render;return m=m.displayName,m||(m=$.displayName||$.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case F:return $=m.displayName||null,$!==null?$:t(m.type)||"Memo";case L:$=m._payload,m=m._init;try{return t(m($))}catch{}}return null}function s(m){return""+m}function n(m){try{s(m);var $=!1}catch{$=!0}if($){$=console;var W=$.error,V=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return W.call($,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",V),s(m)}}function r(m){if(m===j)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===L)return"<...>";try{var $=t(m);return $?"<"+$+">":"<...>"}catch{return"<...>"}}function a(){var m=Y.A;return m===null?null:m.getOwner()}function o(){return Error("react-stack-top-frame")}function i(m){if(U.call(m,"key")){var $=Object.getOwnPropertyDescriptor(m,"key").get;if($&&$.isReactWarning)return!1}return m.key!==void 0}function l(m,$){function W(){E||(E=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$))}W.isReactWarning=!0,Object.defineProperty(m,"key",{get:W,configurable:!0})}function d(){var m=t(this.type);return B[m]||(B[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function u(m,$,W,V,Z,re){var H=W.ref;return m={$$typeof:x,type:m,key:$,props:W,_owner:V},(H!==void 0?H:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:d}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function f(m,$,W,V,Z,re){var H=$.children;if(H!==void 0)if(V)if(D(H)){for(V=0;V<H.length;V++)p(H[V]);Object.freeze&&Object.freeze(H)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(H);if(U.call($,"key")){H=t(m);var J=Object.keys($).filter(function(_e){return _e!=="key"});V=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",R[H+V]||(J=0<J.length?"{"+J.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Ce;function it(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){function t(p){if(p==null)return null;if(typeof p=="function")return p.$$typeof===L?null:p.displayName||p.name||null;if(typeof p=="string")return p;switch(p){case w:return"Fragment";case k:return"Profiler";case E:return"StrictMode";case I:return"Suspense";case D:return"SuspenseList";case y:return"Activity"}if(typeof p=="object")switch(typeof p.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),p.$$typeof){case g:return"Portal";case j:return p.displayName||"Context";case R:return(p._context.displayName||"Context")+".Consumer";case _:var v=p.render;return p=p.displayName,p||(p=v.displayName||v.name||"",p=p!==""?"ForwardRef("+p+")":"ForwardRef"),p;case P:return v=p.displayName||null,v!==null?v:t(p.type)||"Memo";case F:v=p._payload,p=p._init;try{return t(p(v))}catch{}}return null}function s(p){return""+p}function n(p){try{s(p);var v=!1}catch{v=!0}if(v){v=console;var A=v.error,M=typeof Symbol=="function"&&Symbol.toStringTag&&p[Symbol.toStringTag]||p.constructor.name||"Object";return A.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",M),s(p)}}function a(p){if(p===w)return"<>";if(typeof p=="object"&&p!==null&&p.$$typeof===F)return"<...>";try{var v=t(p);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function r(){var p=O.A;return p===null?null:p.getOwner()}function o(){return Error("react-stack-top-frame")}function i(p){if(q.call(p,"key")){var v=Object.getOwnPropertyDescriptor(p,"key").get;if(v&&v.isReactWarning)return!1}return p.key!==void 0}function l(p,v){function A(){B||(B=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",v))}A.isReactWarning=!0,Object.defineProperty(p,"key",{get:A,configurable:!0})}function d(){var p=t(this.type);return $[p]||($[p]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),p=this.props.ref,p!==void 0?p:null}function f(p,v,A,M,Z,re){var H=A.ref;return p={$$typeof:b,type:p,key:v,props:A,_owner:M},(H!==void 0?H:null)!==null?Object.defineProperty(p,"ref",{enumerable:!1,get:d}):Object.defineProperty(p,"ref",{enumerable:!1,value:null}),p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(p,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(p,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(p,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p}function u(p,v,A,M,Z,re){var H=v.children;if(H!==void 0)if(M)if(V(H)){for(M=0;M<H.length;M++)h(H[M]);Object.freeze&&Object.freeze(H)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(H);if(q.call(v,"key")){H=t(p);var K=Object.keys(v).filter(function(he){return he!=="key"});M=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",W[H+M]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,V,H,J,H),R[H+V]=!0)}if(H=null,W!==void 0&&(n(W),H=""+W),i($)&&(n($.key),H=""+$.key),"key"in $){W={};for(var ae in $)ae!=="key"&&(W[ae]=$[ae])}else W=$;return H&&l(W,typeof m=="function"?m.displayName||m.name||"Unknown":m),u(m,H,W,a(),Z,re)}function p(m){v(m)?m._store&&(m._store.validated=1):typeof m=="object"&&m!==null&&m.$$typeof===L&&(m._payload.status==="fulfilled"?v(m._payload.value)&&m._payload.value._store&&(m._payload.value._store.validated=1):m._store&&(m._store.validated=1))}function v(m){return typeof m=="object"&&m!==null&&m.$$typeof===x}var h=c,x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),k=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),Y=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,D=Array.isArray,b=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(m){return m()}};var E,B={},O=h.react_stack_bottom_frame.bind(h,o)(),X=b(r(o)),R={};pe.Fragment=j,pe.jsx=function(m,$,W){var V=1e4>Y.recentlyCreatedOwnerStacks++;return f(m,$,W,!1,V?Error("react-stack-top-frame"):O,V?b(r(m)):X)},pe.jsxs=function(m,$,W){var V=1e4>Y.recentlyCreatedOwnerStacks++;return f(m,$,W,!0,V?Error("react-stack-top-frame"):O,V?b(r(m)):X)}}()),pe}process.env.NODE_ENV==="production"?ge.exports=Ze():ge.exports=Qe();var e=ge.exports;function ze({size:t="m",color:s="default",className:n="",...r}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${t}`,`ds-spinner--${s}`,n].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...r})}const et={xs:12,s:14,m:16,l:20};function te({children:t,variant:s="primary",size:n="m",fullWidth:r=!1,icon:a,disabled:o=!1,state:i="idle",onClick:l,type:d="button",href:u,"aria-label":f,className:p="",...v}){const h=a&&!t,x=i==="loading",w=i==="success",j=i==="error",T=x||w||j,g=n==="xs"?"s":"m",_=s==="danger"?"on-accent":"default",k=et[n]??16,A=x?e.jsx(ze,{size:g,color:_}):w?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(S.Check,{size:k,strokeWidth:2.5})}):j?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(S.X,{size:k,strokeWidth:2.5})}):null,I=["ds-button",`ds-button--${s}`,`ds-button--${n}`,r&&"ds-button--full",h&&"ds-button--icon-only",p].filter(Boolean).join(" "),C=i!=="idle"?i:void 0,F=e.jsxs(e.Fragment,{children:[T?A:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),t]});if(u){const L=N=>{if(o||x){N.preventDefault();return}N.metaKey||N.ctrlKey||N.button===1||(N.preventDefault(),l==null||l(N))};return e.jsx("a",{className:I,href:o||x?void 0:u,onClick:L,"aria-label":f,"aria-disabled":o||x?"true":void 0,"aria-busy":x?"true":void 0,"data-state":C,...v,children:F})}return e.jsx("button",{type:d,className:I,disabled:o,onClick:x?void 0:l,"aria-label":f,"aria-busy":x?"true":void 0,"data-state":C,...v,children:F})}function tt({label:t,error:s,hint:n,fullWidth:r=!0,icon:a,iconRight:o,onIconRightClick:i,size:l="m",disabled:d,id:u,...f}){const p=u||`input-${c.useId()}`,v=n?`${p}-hint`:void 0,h=s?`${p}-error`:void 0,x=h||v;return e.jsxs("div",{className:`ds-input-wrapper ${r?"ds-input-wrapper--full":""} ${d?"ds-input-wrapper--disabled":""} ${s?"ds-input-wrapper--error":""}`,children:[t&&e.jsx("label",{className:"ds-input-label",htmlFor:p,children:t}),e.jsxs("div",{className:"ds-input-container",children:[a&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:a}),e.jsx("input",{id:p,className:`ds-input ds-input--${l} ${a?"ds-input--with-icon":""} ${o?"ds-input--with-icon-right":""} ${s?"ds-input--error":""}`,disabled:d,"aria-invalid":s?"true":"false","aria-describedby":x,...f}),o&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:o})]}),n&&!s&&e.jsx("span",{id:v,className:"ds-input-hint",children:n}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:s&&e.jsx("span",{id:h,className:"ds-input-error",role:"alert",children:s})})})]})}function st({label:t,error:s,hint:n,fullWidth:r=!0,size:a="m",disabled:o,id:i,resize:l=!0,rows:d=3,...u}){const f=i||`textarea-${c.useId()}`,p=n?`${f}-hint`:void 0,v=s?`${f}-error`:void 0,h=v||p;return e.jsxs("div",{className:`ds-textarea-wrapper ${r?"ds-textarea-wrapper--full":""} ${o?"ds-textarea-wrapper--disabled":""}`,children:[t&&e.jsx("label",{className:"ds-textarea-label",htmlFor:f,children:t}),e.jsx("textarea",{id:f,className:`ds-textarea ds-textarea--${a} ${s?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:o,"aria-invalid":s?"true":"false","aria-describedby":h,rows:d,...u}),n&&!s&&e.jsx("span",{id:p,className:"ds-textarea-hint",children:n}),s&&e.jsx("span",{id:v,className:"ds-textarea-error",role:"alert",children:s})]})}function nt({label:t,value:s,onChange:n,options:r=[],placeholder:a="Select option",error:o,fullWidth:i=!0,size:l="m",disabled:d=!1,id:u,...f}){const[p,v]=c.useState(!1),[h,x]=c.useState(!1),[w,j]=c.useState({}),[T,g]=c.useState("down"),[_,k]=c.useState(-1),A=c.useRef(null),I=c.useRef(null),C=c.useRef(null),F=c.useRef(null),L=u||`select-${c.useId()}`,N=`${L}-label`,M=o?`${L}-error`:void 0,Y=150,U=(R=!1)=>{h||(x(!0),k(-1),F.current=setTimeout(()=>{var m;v(!1),x(!1),R&&((m=C.current)==null||m.focus())},Y))},D=R=>{clearTimeout(F.current),x(!1);const m=R!==void 0?R:Math.max(r.findIndex($=>$.value===s),0);k(m),v(!0)};c.useEffect(()=>()=>clearTimeout(F.current),[]);const b=()=>{var re;const R=(re=A.current)==null?void 0:re.getBoundingClientRect();if(!R)return;const m=window.innerHeight,$=m-R.bottom,W=R.top,Z=$<300&&W>$;g(Z?"up":"down"),j(Z?{bottom:m-R.top+4,left:R.left,width:R.width}:{top:R.bottom+4,left:R.left,width:R.width})};c.useEffect(()=>{if(p)return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[p]),c.useEffect(()=>{const R=m=>{A.current&&!A.current.contains(m.target)&&I.current&&!I.current.contains(m.target)&&U()};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[h]),c.useEffect(()=>{var m;if(!p||_<0||!I.current)return;(m=I.current.querySelectorAll(".ds-select-option")[_])==null||m.scrollIntoView({block:"nearest"})},[_,p]);const E=R=>{switch(R.key){case"ArrowDown":R.preventDefault(),p?k(m=>Math.min(m+1,r.length-1)):D();break;case"ArrowUp":R.preventDefault(),p?k(m=>Math.max(m-1,0)):D(r.length-1);break;case"Home":p&&(R.preventDefault(),k(0));break;case"End":p&&(R.preventDefault(),k(r.length-1));break;case"Enter":case" ":R.preventDefault(),p?_>=0&&(n==null||n(r[_].value),U(!0)):D();break;case"Escape":p&&(R.preventDefault(),U(!0));break;case"Tab":p&&U(!1);break}},B=r.find(R=>R.value===s),O=l==="xs"?z[1]:l==="small"?z[2]:z[3],X=p&&e.jsx("div",{ref:I,"data-ds-portal":"",role:"listbox","aria-labelledby":t?N:void 0,tabIndex:-1,className:["ds-select-dropdown ds-scrollable",`ds-select-dropdown--${l}`,`ds-select-dropdown--${T}`,h&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:w,children:r.map((R,m)=>e.jsx("button",{id:`${L}-opt-${m}`,type:"button",role:"option",tabIndex:-1,"aria-selected":s===R.value,className:["ds-select-option",`ds-select-option--${l}`,s===R.value&&"ds-select-option--selected",m===_&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{n==null||n(R.value),U(!0)},children:R.label},R.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${d?"ds-select-wrapper--disabled":""}`,children:[t&&e.jsx("label",{id:N,className:"ds-select-label",children:t}),e.jsx("div",{className:"ds-select-container",ref:A,children:e.jsxs("button",{ref:C,type:"button",id:L,role:"combobox","aria-haspopup":"listbox","aria-expanded":p,"aria-activedescendant":p&&_>=0?`${L}-opt-${_}`:void 0,"aria-labelledby":t?N:void 0,"aria-invalid":o?"true":"false","aria-describedby":M,className:`ds-select-trigger ds-select-trigger--${l} ${o?"ds-select-trigger--error":""}`,onClick:()=>{d||(p?U():D())},onKeyDown:E,disabled:d,...f,children:[e.jsx("span",{className:B?"":"ds-select-placeholder",children:(B==null?void 0:B.label)||a}),e.jsx(S.ChevronDown,{size:O,strokeWidth:1.5,className:`ds-select-icon ${p&&T==="down"?"ds-select-icon--open":""} ${p&&T==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),o&&e.jsx("span",{id:M,className:"ds-select-error",role:"alert",children:o}),typeof document<"u"&&se.createPortal(X,document.body)]})}function rt({label:t,value:s=0,onChange:n,min:r=0,max:a=100,step:o=1,size:i="m",disabled:l=!1,hint:d,error:u,...f}){const p=()=>{if(l)return;const T=Math.min(Number(s)+o,a);n==null||n(T)},v=()=>{if(l)return;const T=Math.max(Number(s)-o,r);n==null||n(T)},h=T=>{if(l)return;const g=T.target.value;if(g===""){n==null||n(r);return}const _=Number(g);if(!isNaN(_)){const k=Math.min(Math.max(_,r),a);n==null||n(k)}},x=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",u&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),w=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),j=i==="xs"?z[1]:i==="small"?z[2]:z[3];return e.jsxs("div",{className:x,children:[t&&e.jsx("label",{className:"ds-stepper-label",children:t}),e.jsxs("div",{className:w,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:v,disabled:l||s<=r,"aria-label":"Decrease",children:e.jsx(S.Minus,{size:j,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:s,onChange:h,min:r,max:a,step:o,disabled:l,...f}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:p,disabled:l||s>=a,"aria-label":"Increase",children:e.jsx(S.Plus,{size:j,strokeWidth:1.5})})]}),d&&!u&&e.jsx("div",{className:"ds-stepper-hint",children:d}),u&&e.jsx("div",{className:"ds-stepper-error",children:u})]})}function at({children:t,padding:s="m",variant:n="info",hover:r=!1,onClick:a,href:o,disabled:i=!1,...l}){const u=(r?"interactive":n)==="interactive"||a||o,f=["ds-card",`ds-card--${s}`,u&&"ds-card--interactive"].filter(Boolean).join(" ");if(o){const h=x=>{if(i){x.preventDefault();return}x.metaKey||x.ctrlKey||x.button===1||(x.preventDefault(),a==null||a(x))};return e.jsx("a",{className:f,href:i?void 0:o,onClick:h,"aria-disabled":i?"true":void 0,...l,children:t})}const p=u&&a?"button":"div",v=u&&a?{type:"button",onClick:a,disabled:i}:{};return e.jsx(p,{className:f,role:u&&!a?"article":void 0,...v,...l,children:t})}function ot({children:t,...s}){return e.jsx("h1",{className:"ds-h1",...s,children:t})}function it({children:t,...s}){return e.jsx("h2",{className:"ds-h2",...s,children:t})}function lt({children:t,...s}){return e.jsx("h3",{className:"ds-h3",...s,children:t})}function ct({children:t,...s}){return e.jsx("h4",{className:"ds-h4",...s,children:t})}function dt({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p1 ${s?"ds-p1--secondary":""}`,...n,children:t})}function Fe({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p2 ${s?"ds-p2--secondary":""}`,...n,children:t})}function Ee({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p3 ${s?"ds-p3--secondary":""}`,...n,children:t})}function le({children:t,variant:s="default",size:n="m",role:r,...a}){const o=["ds-badge",`ds-badge--${s}`,`ds-badge--${n}`].filter(Boolean).join(" "),i=r||(["info","success","warning","error"].includes(s)?"status":void 0);return e.jsx("span",{className:o,role:i,...a,children:t})}const ut={info:S.Info,success:S.CheckCircle,warning:S.AlertTriangle,error:S.XCircle},ft=c.forwardRef(function({children:s,variant:n="info",title:r,onClose:a,role:o,...i},l){const d=ut[n],u=o||(n==="error"?"alert":"status");return e.jsxs("div",{ref:l,className:`ds-alert ds-alert--${n} ${r?"":"ds-alert--no-title"}`,role:u,...i,children:[d&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(d,{size:z[3],strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[r&&e.jsx("div",{className:"ds-alert__title",children:r}),s&&e.jsx("div",{className:"ds-alert__message",children:s})]}),a&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:a,"aria-label":"Close alert",children:e.jsx(S.X,{size:z[3],strokeWidth:1.5})})]})}),mt=200;function pt({children:t,title:s,onClose:n,size:r="m",scrollable:a=!1,subHeader:o,...i}){const l=c.useRef(null),d=c.useId(),[u,f]=c.useState(!1),p=()=>{!n||u||(f(!0),setTimeout(()=>{f(!1),n()},mt))};c.useEffect(()=>{const j=g=>{g.key==="Escape"&&p()},T=g=>{var k,A,I;const _=((A=(k=g.composedPath)==null?void 0:k.call(g))==null?void 0:A[0])??g.target;l.current&&!l.current.contains(_)&&!((I=_.closest)!=null&&I.call(_,"[data-ds-portal]"))&&p()};return document.addEventListener("keydown",j),document.addEventListener("mousedown",T),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",T)}},[n,u]);const v=c.Children.toArray(t),h=v.find(j=>(j==null?void 0:j.type)===ce),x=v.filter(j=>(j==null?void 0:j.type)!==ce),w=e.jsx("div",{className:["ds-modal-overlay",u&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...i,children:e.jsxs("div",{className:[`ds-modal ds-modal--${r}`,a&&"ds-modal--scrollable"].filter(Boolean).join(" "),ref:l,role:"dialog","aria-modal":"true","aria-labelledby":s?d:void 0,children:[n&&e.jsx(te,{className:"ds-modal__close",variant:"ghost",size:"small",icon:e.jsx(S.X,{size:z[2],strokeWidth:1.5}),onClick:p,"aria-label":"Close modal"}),(s||o)&&e.jsxs("div",{className:"ds-modal__header",children:[s&&e.jsx("h3",{id:d,className:"ds-modal__title",children:s}),o&&e.jsx("div",{className:"ds-modal__subheader",children:o})]}),e.jsx("div",{className:"ds-modal__body ds-scrollable",children:x}),h]})});return typeof document>"u"?w:se.createPortal(w,document.body)}function ce({children:t}){return!t||c.Children.count(t)===0?null:e.jsx("div",{className:"ds-modal__footer",children:t})}const ht=320;function xt({children:t,title:s,onClose:n,subHeader:r,...a}){const o=c.useRef(null),i=c.useId(),[l,d]=c.useState(!1),u=()=>{!n||l||(d(!0),setTimeout(()=>{d(!1),n()},ht))};c.useEffect(()=>{const x=j=>{j.key==="Escape"&&u()},w=j=>{var g,_,k;const T=((_=(g=j.composedPath)==null?void 0:g.call(j))==null?void 0:_[0])??j.target;o.current&&!o.current.contains(T)&&!((k=T.closest)!=null&&k.call(T,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",x),document.addEventListener("mousedown",w),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",w)}},[n,l]);const f=c.Children.toArray(t),p=f.find(x=>(x==null?void 0:x.type)===ce),v=f.filter(x=>(x==null?void 0:x.type)!==ce),h=e.jsx("div",{className:["ds-bottom-sheet-overlay",l&&"ds-bottom-sheet-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("div",{ref:o,className:["ds-bottom-sheet",l&&"ds-bottom-sheet--closing"].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":s?i:void 0,children:[e.jsx("div",{className:"ds-bottom-sheet__handle","aria-hidden":"true"}),n&&e.jsx(te,{className:"ds-bottom-sheet__close",variant:"ghost",size:"small",icon:e.jsx(S.X,{size:z[2],strokeWidth:1.5}),onClick:u,"aria-label":"Close"}),(s||r)&&e.jsxs("div",{className:"ds-bottom-sheet__header",children:[s&&e.jsx("h3",{id:i,className:"ds-bottom-sheet__title",children:s}),r&&e.jsx("div",{className:"ds-bottom-sheet__subheader",children:r})]}),e.jsx("div",{className:"ds-bottom-sheet__body ds-scrollable",children:v}),p]})});return typeof document>"u"?h:se.createPortal(h,document.body)}function We({children:t,title:s="Code",defaultExpanded:n=!1,expanded:r,onToggle:a,padding:o="s",className:i="",...l}){const[d,u]=c.useState(n),f=r!==void 0,p=f?r:d,v=()=>{f?a==null||a(!r):u(x=>!x)},h=["ds-code-accordion",`ds-code-accordion--${o}`,p&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:h,...l,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:v,"aria-expanded":p,children:[e.jsx("span",{className:"ds-code-accordion__title",children:s}),e.jsx(S.ChevronDown,{size:z[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${p?"ds-code-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-code-accordion__content",children:e.jsx("div",{className:"ds-code-accordion__inner",children:e.jsx("pre",{className:"ds-code-accordion__pre ds-scrollable",children:e.jsx("code",{children:t})})})})]})}function vt({children:t,block:s=!1,collapsible:n=!1,title:r="Code",defaultExpanded:a=!1,...o}){return s?n?e.jsx(We,{title:r,defaultExpanded:a,...o,children:t}):e.jsx("pre",{className:"ds-code-block ds-scrollable",...o,children:e.jsx("code",{children:t})}):e.jsx("code",{className:"ds-code-inline",...o,children:t})}function bt({href:t,children:s,onClick:n,target:r,rel:a,...o}){const l=r==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:t,className:"ds-link",onClick:n,target:r,rel:l,...o,children:s})}function _t({children:t,size:s="m",variant:n="ghost",...r}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...r,children:c.Children.map(t,a=>c.isValidElement(a)?c.cloneElement(a,{size:s,variant:n}):a)})}function jt({children:t,selected:s=!1,onClick:n,size:r="m",variant:a="ghost",disabled:o=!1,icon:i,href:l,...d}){const u=i&&!t,f=["ds-tab",`ds-tab--${r}`,`ds-tab--${a}`,s&&"ds-tab--selected",u&&"ds-tab--icon-only"].filter(Boolean).join(" "),p=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),t]});if(l){const v=h=>{if(o){h.preventDefault();return}h.metaKey||h.ctrlKey||h.button===1||(h.preventDefault(),n==null||n(h))};return e.jsx("a",{role:"tab","aria-current":s?"page":void 0,"aria-disabled":o?"true":void 0,className:f,href:o?void 0:l,onClick:v,...d,children:p})}return e.jsx("button",{role:"tab","aria-selected":s,className:f,onClick:n,disabled:o,...d,children:p})}function Nt({options:t,value:s,onChange:n,size:r="m",disabled:a=!1}){const o=c.useRef(null),i=c.useRef(null),[l,d]=c.useState(!1),u=c.useRef(!1),f=c.useRef(null),p=c.useRef(null),v=()=>{if(!o.current)return;const h=o.current.querySelector(`[data-value="${s}"]`);if(!h)return;const x=o.current.getBoundingClientRect(),w=h.getBoundingClientRect(),j=w.left-x.left,T=w.width;i.current?(i.current.style.transition=u.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=j+"px",i.current.style.width=T+"px",u.current=!1):(d(!0),requestAnimationFrame(()=>{if(!i.current||!o.current)return;const g=o.current.querySelector(`[data-value="${s}"]`);if(!g)return;const _=o.current.getBoundingClientRect(),k=g.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=k.left-_.left+"px",i.current.style.width=k.width+"px"}))};return p.current=v,c.useLayoutEffect(()=>{const h=f.current!==s;f.current=s,u.current=l&&h,v()}),c.useEffect(()=>{if(!o.current)return;const h=new ResizeObserver(()=>{u.current=!1,p.current()});return h.observe(o.current),()=>h.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${r}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:o,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),t.map(h=>e.jsxs("button",{type:"button","data-value":h.value,className:["ds-seg__btn",s===h.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&n(h.value),"aria-pressed":s===h.value,disabled:a,children:[h.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:h.icon}),h.label]},h.value))]})}function xe({children:t,title:s,defaultExpanded:n=!1,expanded:r,onToggle:a,padding:o="m",...i}){const[l,d]=c.useState(n),u=r!==void 0,f=u?r:l,p=()=>{u?a==null||a(!r):d(h=>!h)},v=["ds-accordion",`ds-accordion--${o}`,f&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:v,...i,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:p,"aria-expanded":f,children:[e.jsx("span",{className:"ds-accordion__title",children:s}),e.jsx(S.ChevronDown,{size:z[2],strokeWidth:1.5,className:`ds-accordion__icon ${f?"ds-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-accordion__content",children:e.jsx("div",{className:"ds-accordion__content-inner",children:e.jsx("div",{className:"ds-accordion__content-body",children:t})})})]})}const ne=8,de=8;function gt(t,s,n){const r=window.innerWidth;let a,o;switch(t){case"top":a=s.top-n.height-ne,o=s.left+s.width/2-n.width/2;break;case"bottom":a=s.bottom+ne,o=s.left+s.width/2-n.width/2;break;case"left":a=s.top+s.height/2-n.height/2,o=s.left-n.width-ne;break;case"right":a=s.top+s.height/2-n.height/2,o=s.right+ne;break;default:a=s.bottom+ne,o=s.left}const i=Math.max(de,Math.min(r-n.width-de,o)),l=o-i;return{top:a,left:i,arrowOffset:l}}function wt(t,s,n){const r=window.innerWidth,a=window.innerHeight;if(t.top>=s+ne+de)return"top";if(a-t.bottom>=s+ne+de)return"bottom";if(r-t.right>=n+ne+de)return"right";if(t.left>=n+ne+de)return"left";const o=Math.max(t.top,a-t.bottom,t.left,r-t.right);return o===t.top?"top":o===a-t.bottom?"bottom":o===r-t.right?"right":"left"}function ve({children:t,content:s,position:n,...r}){const[a,o]=c.useState(!1),[i,l]=c.useState({visibility:"hidden"}),[d,u]=c.useState(n||"top"),f=c.useRef(null),p=c.useRef(null),v=c.useRef(!1),h=()=>{if(!f.current||!p.current)return;const w=f.current.getBoundingClientRect(),j=p.current.getBoundingClientRect(),T=n||wt(w,j.height,j.width),{top:g,left:_,arrowOffset:k}=gt(T,w,j);u(T),l({position:"fixed",top:g,left:_,visibility:"visible","--arrow-offset":`${k}px`})};if(c.useEffect(()=>{if(!a)return;l({position:"fixed",visibility:"hidden"});const w=requestAnimationFrame(h);return window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{cancelAnimationFrame(w),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[a,n]),c.useEffect(()=>{if(!a)return;const w=j=>{f.current&&!f.current.contains(j.target)&&o(!1)};return document.addEventListener("touchstart",w),()=>document.removeEventListener("touchstart",w)},[a]),!s)return t;const x=a&&e.jsx("div",{ref:p,"data-ds-portal":"",className:`ds-tooltip ds-tooltip--${d}`,role:"tooltip",style:i,children:s});return e.jsxs("div",{ref:f,className:"ds-tooltip-wrapper",onMouseEnter:()=>{v.current||o(!0)},onMouseLeave:()=>{v.current||o(!1)},onTouchStart:()=>{v.current=!0,o(w=>!w)},...r,children:[t,typeof document<"u"&&se.createPortal(x,document.body)]})}function yt({checked:t=!1,onChange:s,size:n="m",disabled:r=!1,label:a,id:o,...i}){const l=o||`toggle-${c.useId()}`,d=["ds-toggle",`ds-toggle--${n}`,r&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:d,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:t,onChange:u=>s==null?void 0:s(u.target.checked),disabled:r,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),a&&e.jsx("span",{className:"ds-toggle__label",children:a})]})}function kt({checked:t=!1,onChange:s,size:n="m",disabled:r=!1,label:a,id:o,...i}){const l=o||`checkbox-${c.useId()}`,d=["ds-checkbox",`ds-checkbox--${n}`,r&&"ds-checkbox--disabled"].filter(Boolean).join(" "),u=n==="xs"?10:n==="small"?14:n==="large"?20:16;return e.jsxs("label",{className:d,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:t,onChange:f=>s==null?void 0:s(f.target.checked),disabled:r,...i}),e.jsx("span",{className:"ds-checkbox__box",children:t&&e.jsx(S.Check,{size:u,strokeWidth:2.5,className:"ds-checkbox__icon"})}),a&&e.jsx("span",{className:"ds-checkbox__label",children:a})]})}function Et({checked:t=!1,onChange:s,size:n="m",disabled:r=!1,label:a,name:o,value:i,id:l,...d}){const u=l||`radio-${c.useId()}`,f=["ds-radio",`ds-radio--${n}`,r&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:f,htmlFor:u,children:[e.jsx("input",{type:"radio",id:u,className:"ds-radio__input",checked:t,onChange:p=>s==null?void 0:s(p.target.checked),disabled:r,name:o,value:i,...d}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),a&&e.jsx("span",{className:"ds-radio__label",children:a})]})}function Oe({width:t,height:s,shape:n="rect",aspectRatio:r,className:a="",style:o={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${n}`,a].filter(Boolean).join(" "),style:{width:t,height:s,aspectRatio:r,...o},"aria-hidden":"true",...i})}function Rt({lines:t=1,lastLineWidth:s="70%",gap:n,className:r="",style:a={},...o}){return e.jsx("span",{className:["ds-skeleton-text",r].filter(Boolean).join(" "),style:{gap:n,...a},"aria-hidden":"true",...o,children:Array.from({length:t},(i,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===t-1&&t>1?{width:s}:void 0},l))})}Oe.Text=Rt;function St(t){let s=2166136261;for(let n=0;n<t.length;n++)s^=t.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s%360}function Tt(t){if(!t)return"";const s=t.trim().split(/\s+/);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():t[0].toUpperCase()}function $t({seed:t,icon:s,src:n,size:r=32,className:a="",style:o={},...i}){const l=St(t??""),[d,u]=c.useState(!1),f=s??e.jsx("span",{className:"ds-avatar__initials",children:Tt(t)});return e.jsx("div",{className:["ds-avatar",a].filter(Boolean).join(" "),style:{width:r,height:r,"--ds-avatar-h":l,...o},"aria-hidden":"true",...i,children:n&&!d?e.jsx("img",{src:n,alt:"",onError:()=>u(!0)}):f})}function At({children:t,size:s="compact",stickyTop:n,maxHeight:r,className:a="",style:o={},...i}){const l={...r?{maxHeight:r}:{},...n!==void 0?{"--ds-table-sticky-top":typeof n=="number"?`${n}px`:n}:{},...o};return e.jsx("div",{className:["ds-table-wrap","ds-scrollable",r?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${s}`,a].filter(Boolean).join(" "),...i,children:t})})}function Bt({children:t,...s}){return e.jsx("thead",{...s,children:t})}function It({children:t,...s}){return e.jsx("tbody",{...s,children:t})}function Dt({children:t,interactive:s,selected:n,subheader:r,exiting:a,updated:o,className:i="",onClick:l,...d}){return e.jsx("tr",{className:["ds-table-row",s||l?"ds-table-row--interactive":"",n?"ds-table-row--selected":"",r?"ds-table-row--subheader":"",a?"ds-table-row--exiting":"",o?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...d,children:t})}function Pt({children:t,colSpan:s=999,...n}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...n,children:e.jsx("td",{colSpan:s,children:t})})}function Ct({children:t,align:s="left",sortDir:n,onSort:r,width:a,className:o="",style:i={},...l}){const d=!!r||n!==void 0,u=n==="asc"?S.ChevronUp:n==="desc"?S.ChevronDown:S.ChevronsUpDown;return e.jsx("th",{className:["ds-th",d?"ds-th--sortable":"",n?"ds-th--sorted":"",s!=="left"?`ds-table-cell--${s}`:"",o].filter(Boolean).join(" "),onClick:r,style:{width:a,...i},...l,children:d?e.jsxs("span",{className:"ds-th__inner",children:[t,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(u,{size:11,strokeWidth:2.5})})]}):t})}function Lt({children:t,align:s="left",secondary:n,muted:r,truncate:a,nowrap:o,className:i="",...l}){return e.jsx("td",{className:["ds-td",s!=="left"?`ds-table-cell--${s}`:"",n?"ds-table-cell--secondary":"",r?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",o?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:t})}function Mt({icon:t,title:s,description:n,action:r,size:a="m",className:o="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,o].filter(Boolean).join(" "),...i,children:[t&&e.jsx("div",{className:"ds-empty-state__icon",children:t}),e.jsx("div",{className:"ds-empty-state__title",children:s}),n&&e.jsx("div",{className:"ds-empty-state__description",children:n}),r&&e.jsx("div",{className:"ds-empty-state__action",children:r})]})}function zt({label:t,hint:s,error:n,required:r=!1,disabled:a=!1,htmlFor:o,children:i,className:l="",style:d,...u}){const f=c.useId(),p=o??f,v=`${p}-hint`,h=`${p}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":n?"error":void 0,"data-required":r?"":void 0,"data-disabled":a?"":void 0,style:d,...u,children:[t&&e.jsx("label",{className:"ds-field-label",htmlFor:p,children:t}),e.jsx("div",{className:"ds-field-control",children:i}),s&&!n&&e.jsx("p",{className:"ds-field-hint",id:v,children:s}),n&&e.jsx("p",{className:"ds-field-error",id:h,role:"alert",children:n})]})}function Ft({label:t,value:s,delta:n,size:r="m",inline:a=!1,className:o="",style:i,...l}){const d=n!=null&&n.startsWith("+")?"up":n!=null&&n.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${r}`,a&&"ds-stat--inline",o].filter(Boolean).join(" "),style:i,...l,children:[t&&e.jsx("span",{className:"ds-stat-label",children:t}),s!=null&&e.jsx("span",{className:"ds-stat-value",children:s}),n!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${d}`,children:n})]})}function Wt({children:t,separator:s="/","aria-label":n="Breadcrumb",className:r="",style:a,...o}){const i=c.Children.toArray(t).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${r?` ${r}`:""}`,"aria-label":n,style:a,...o,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:i.map((l,d)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[l,d<i.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:s})]},d))})})}function Ot({page:t,total:s,onChange:n,siblings:r=1,"aria-label":a="Pagination",className:o="",style:i,...l}){const d=Ut(t,s,r);return e.jsxs("nav",{className:`ds-pagination${o?` ${o}`:""}`,"aria-label":a,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(t-1),disabled:t<=1,"aria-label":"Previous page",children:e.jsx(S.ChevronLeft,{size:16})}),d.map((u,f)=>u==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${f}`):e.jsx("button",{className:`ds-pagination-page${u===t?" ds-pagination-page--current":""}`,onClick:()=>u!==t&&(n==null?void 0:n(u)),"aria-current":u===t?"page":void 0,"aria-label":`Page ${u}`,children:u},u)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(t+1),disabled:t>=s,"aria-label":"Next page",children:e.jsx(S.ChevronRight,{size:16})})]})}function Ut(t,s,n){if(s<=7)return Array.from({length:s},(i,l)=>l+1);const r=Math.max(2,t-n),a=Math.min(s-1,t+n),o=[1];r>2&&o.push("…");for(let i=r;i<=a;i++)o.push(i);return a<s-1&&o.push("…"),o.push(s),o}const Vt=300;function Ht({children:t,title:s,onClose:n,subHeader:r,side:a="right",size:o="wide",offsetLeft:i=0,offsetRight:l=0,keepOpenRef:d,...u}){const f=c.useRef(null),p=c.useId(),[v,h]=c.useState(!1),x=()=>{!n||v||(h(!0),setTimeout(()=>{h(!1),n()},Vt))};c.useEffect(()=>{const _=A=>{A.key==="Escape"&&x()},k=A=>{var C,F,L,N;const I=((F=(C=A.composedPath)==null?void 0:C.call(A))==null?void 0:F[0])??A.target;(L=d==null?void 0:d.current)!=null&&L.contains(I)||f.current&&!f.current.contains(I)&&!((N=I.closest)!=null&&N.call(I,"[data-ds-portal]"))&&x()};return document.addEventListener("keydown",_),document.addEventListener("mousedown",k),()=>{document.removeEventListener("keydown",_),document.removeEventListener("mousedown",k)}},[n,v,d]);const w=c.Children.toArray(t),j=w.find(_=>(_==null?void 0:_.type)===we||(_==null?void 0:_.type)===ce),T=w.filter(_=>(_==null?void 0:_.type)!==we&&(_==null?void 0:_.type)!==ce),g=e.jsx("div",{className:["ds-side-page-overlay",v&&"ds-side-page-overlay--closing"].filter(Boolean).join(" "),"data-side":a,style:{"--ds-side-page-offset-left":`${i}px`,"--ds-side-page-offset-right":`${l}px`},...u,children:e.jsxs("div",{ref:f,className:["ds-side-page",v&&"ds-side-page--closing"].filter(Boolean).join(" "),"data-side":a,"data-size":o,role:"dialog","aria-modal":"true","aria-labelledby":s?p:void 0,children:[n&&e.jsx(te,{className:"ds-side-page__close",variant:"ghost",size:"small",icon:e.jsx(S.X,{size:z[2],strokeWidth:1.5}),onClick:x,"aria-label":"Close"}),(s||r)&&e.jsxs("div",{className:"ds-side-page__header",children:[s&&e.jsx("h3",{id:p,className:"ds-side-page__title",children:s}),r&&e.jsx("div",{className:"ds-side-page__subheader",children:r})]}),e.jsx("div",{className:"ds-side-page__body ds-scrollable",children:T}),j]})});return typeof document>"u"?g:se.createPortal(g,document.body)}function we({children:t}){return!t||c.Children.count(t)===0?null:e.jsx("div",{className:"ds-side-page__footer",children:t})}const fe=c.createContext({collapsed:!1,side:"left"}),be=c.createContext(!1),Xt=c.forwardRef(function({children:s,collapsed:n=!1,side:r="left",onExpand:a,onCollapse:o,className:i="",...l},d){const u=["ds-nav-rail",n&&"ds-nav-rail--collapsed",`ds-nav-rail--${r}`,i].filter(Boolean).join(" "),f=c.useCallback(p=>{if(!p.target.closest('button, a, input, select, textarea, [role="button"], [tabindex]')){if(n&&a){a();return}!n&&o&&o()}},[n,a,o]);return e.jsx(fe.Provider,{value:{collapsed:n,side:r},children:e.jsx("nav",{ref:d,className:u,onClick:f,"data-expandable":n&&a?"":void 0,"data-collapsible":!n&&o?"":void 0,...l,children:s})})});function Yt({icon:t,label:s,selected:n=!1,disabled:r=!1,href:a,onClick:o,count:i,updated:l=!1,open:d=!1,onboarding:u=!1,className:f="",...p}){const{collapsed:v,side:h}=c.useContext(fe),x=c.useContext(be),T={className:["ds-nav-rail__item",f].filter(Boolean).join(" "),onClick:r?void 0:o,"aria-current":n?"page":void 0,"aria-disabled":r?"true":void 0,"aria-label":v?s:void 0,tabIndex:r?-1:void 0,...{"data-selected":n||void 0,"data-disabled":r||void 0,"data-open":d||void 0,"data-onboarding":u||void 0},...p},g=i!=null,_=h==="left"?"right":"left",k=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:t}),!v&&e.jsx("span",{className:"ds-nav-rail__label",children:s}),!v&&g&&e.jsx("span",{className:["ds-nav-rail__count",i===0&&"ds-nav-rail__count--zero"].filter(Boolean).join(" "),"data-updated":l&&i!==0||void 0,children:i}),!v&&l&&(!g||i===0)&&e.jsx("span",{className:"ds-nav-rail__dot ds-nav-rail__dot--inline","aria-hidden":"true"}),v&&g&&i!==0&&e.jsx("span",{className:"ds-nav-rail__count-collapsed","data-updated":l||void 0,children:i>99?"99+":i}),v&&l&&(!g||i===0)&&e.jsx("span",{className:"ds-nav-rail__dot","aria-hidden":"true"})]}),A=a?e.jsx("a",{href:r?void 0:a,...T,children:k}):e.jsx("button",{type:"button",...T,children:k});return v&&!x?e.jsx(ve,{content:s,position:_,children:A}):A}function qt({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__body","ds-scrollable",s].filter(Boolean).join(" "),...n,children:t})}function Gt({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__header",s].filter(Boolean).join(" "),...n,children:t})}function Kt({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__footer",s].filter(Boolean).join(" "),...n,children:t})}function Jt({className:t="",...s}){return e.jsx("hr",{className:["ds-nav-rail__divider",t].filter(Boolean).join(" "),...s})}function Zt({children:t,label:s="Recents",defaultOpen:n=!0,className:r="",...a}){const{collapsed:o}=c.useContext(fe),[i,l]=c.useState(n);return e.jsxs("div",{className:["ds-nav-rail__recents",r].filter(Boolean).join(" "),...a,children:[!o&&e.jsxs("button",{type:"button",className:["ds-nav-rail__recents-toggle",!i&&"ds-nav-rail__recents-toggle--closed"].filter(Boolean).join(" "),onClick:()=>l(d=>!d),"aria-expanded":i,children:[e.jsx("span",{className:"ds-nav-rail__recents-label",children:s}),e.jsx(S.ChevronDown,{size:12,strokeWidth:2,className:"ds-nav-rail__recents-chevron","aria-hidden":"true"})]}),(i||o)&&e.jsx("div",{className:"ds-nav-rail__recents-body",children:t})]})}const Qt=c.forwardRef(function({as:s="button",avatar:n,label:r,className:a="",...o},i){const{collapsed:l,side:d}=c.useContext(fe),u=c.useContext(be),f=d==="left"?"right":"left",p=["ds-nav-rail__item","ds-nav-rail__agent",a].filter(Boolean).join(" "),v=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:n}),!l&&e.jsx("span",{className:"ds-nav-rail__label",children:r})]}),h=e.jsx(s,{ref:i,className:p,"aria-label":l?r:void 0,...s==="button"?{type:"button"}:{},...o,children:v});return l&&!u?e.jsx(ve,{content:r,position:f,children:h}):h});function es({avatar:t,label:s,selected:n=!1,disabled:r=!1,href:a,onClick:o,className:i="",...l}){const{collapsed:d,side:u}=c.useContext(fe),f=c.useContext(be),h={className:["ds-nav-rail__item","ds-nav-rail__agent",i].filter(Boolean).join(" "),onClick:r?void 0:o,"aria-current":n?"page":void 0,"aria-disabled":r?"true":void 0,tabIndex:r?-1:void 0,...{"data-selected":n||void 0,"data-disabled":r||void 0},...l},x=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:t}),!d&&e.jsx("span",{className:"ds-nav-rail__label",children:s})]}),w=u==="left"?"right":"left",j=a?e.jsx("a",{href:r?void 0:a,...h,children:x}):e.jsx("button",{type:"button",...h,children:x});return d&&!f?e.jsx(ve,{content:s,position:w,children:j}):j}const Ae=240,Be=6,Ie=8;function ts({trigger:t,title:s,children:n,open:r,onOpenChange:a,defaultOpen:o=!1}){const{side:i}=c.useContext(fe),[l,d]=c.useState(o),u=r!==void 0,f=u?r:l,[p,v]=c.useState(!1),h=c.useRef(null),x=c.useRef(null),[w,j]=c.useState({}),T=c.useCallback(()=>{u?a==null||a(!0):d(!0)},[u,a]),g=c.useCallback(()=>{u?a==null||a(!1):d(!1)},[u,a]),_=c.useCallback(()=>f?g():T(),[f,T,g]),k=c.useCallback(()=>{var M;const I=h.current;if(!I)return;const C=I.getBoundingClientRect(),F=window.innerHeight,L=((M=x.current)==null?void 0:M.offsetHeight)??300,N=Math.max(Ie,Math.min(F-L-Ie,C.top));j(i==="right"?{position:"fixed",top:N,right:window.innerWidth-C.left+Be,width:Ae}:{position:"fixed",top:N,left:C.right+Be,width:Ae})},[i]);c.useEffect(()=>{if(!f){v(!1);return}return k(),requestAnimationFrame(()=>v(!0)),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[f,k]),c.useEffect(()=>{if(!f)return;const I=F=>{var L,N;!((L=x.current)!=null&&L.contains(F.target))&&!((N=h.current)!=null&&N.contains(F.target))&&g()},C=F=>{F.key==="Escape"&&g()};return document.addEventListener("mousedown",I),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",C)}},[f,g]);const A=f&&e.jsxs("div",{ref:x,className:["ds-nav-rail-flyout",`ds-nav-rail-flyout--${i}`,p&&"ds-nav-rail-flyout--visible"].filter(Boolean).join(" "),style:w,"data-ds-portal":"",role:"dialog","aria-modal":"false",children:[s!=null&&e.jsxs("div",{className:"ds-nav-rail-flyout__header",children:[e.jsx("span",{className:"ds-nav-rail-flyout__title",children:s}),e.jsx("button",{type:"button",className:"ds-nav-rail-flyout__close",onClick:g,"aria-label":"Close",children:e.jsx(S.X,{size:16,strokeWidth:2})})]}),e.jsx("div",{className:"ds-nav-rail-flyout__body",children:n})]});return e.jsxs(e.Fragment,{children:[e.jsx(be.Provider,{value:f,children:e.jsx("div",{ref:h,onClick:_,style:{display:"flex",flexDirection:"column",width:"100%"},children:t})}),typeof document<"u"&&se.createPortal(A,document.body)]})}const ss={info:S.Info,success:S.CheckCircle,warning:S.AlertTriangle,error:S.XCircle};function ns({children:t,variant:s="info",action:n,onAction:r,onDismiss:a,role:o,...i}){const l=ss[s],d=o||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${s}`,role:d,...i,children:[l&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(l,{size:z[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:t}),n&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:r,children:n}),a&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:a,"aria-label":"Dismiss",children:e.jsx(S.X,{size:z[2],strokeWidth:1.5})})]})}function rs({trigger:t,items:s=[],open:n,onOpenChange:r,align:a="left",fullWidth:o=!1,className:i="",style:l,...d}){const[u,f]=c.useState(!1),[p,v]=c.useState(!1),h=n!==void 0,x=h?n:u,w=c.useRef(null),j=c.useRef(null),T=c.useRef(null),g=c.useRef(null),[_,k]=c.useState({}),A=c.useRef(null),I=150,C=()=>{if(h)r==null||r(!1);else{if(p)return;v(!0),A.current=setTimeout(()=>{f(!1),v(!1)},I)}},F=()=>{const b=!x;h?r==null||r(b):b?(clearTimeout(A.current),v(!1),f(!0)):C()},L=()=>{x||(h?r==null||r(!0):(clearTimeout(A.current),v(!1),f(!0)))};c.useEffect(()=>()=>clearTimeout(A.current),[]),c.useEffect(()=>{if(!x)return;const b=300,E=()=>{var R;const B=(R=w.current)==null?void 0:R.getBoundingClientRect();if(!B)return;const O=window.innerHeight-B.bottom,X=O<b+8&&B.top>O;k(a==="right"?X?{bottom:window.innerHeight-B.top+4,top:"auto",right:window.innerWidth-B.right}:{top:B.bottom+4,bottom:"auto",right:window.innerWidth-B.right}:X?{bottom:window.innerHeight-B.top+4,top:"auto",left:B.left}:{top:B.bottom+4,bottom:"auto",left:B.left})};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[x,a]);const N=()=>{var E;const b=(E=T.current)==null?void 0:E.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};c.useEffect(()=>{if(!x)return;const b=B=>{var O,X;!((O=w.current)!=null&&O.contains(B.target))&&!((X=j.current)!=null&&X.contains(B.target))&&C()},E=B=>{B.key==="Escape"&&(C(),N())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",E)}},[x]),c.useEffect(()=>{if(!x||!g.current||!j.current)return;const b=M(),E=g.current==="last"?b[b.length-1]:b[0];E==null||E.focus(),g.current=null},[x]);const M=()=>j.current?[...j.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],Y=b=>{var E,B;if(b.key==="ArrowDown")b.preventDefault(),x?(E=M()[0])==null||E.focus():(g.current="first",L());else if(b.key==="ArrowUp")if(b.preventDefault(),!x)g.current="last",L();else{const O=M();(B=O[O.length-1])==null||B.focus()}},U=b=>{var O,X,R,m;const E=M(),B=E.findIndex($=>$===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(O=E[Math.min(B+1,E.length-1)])==null||O.focus();break;case"ArrowUp":b.preventDefault(),B<=0?N():(X=E[B-1])==null||X.focus();break;case"Home":b.preventDefault(),(R=E[0])==null||R.focus();break;case"End":b.preventDefault(),(m=E[E.length-1])==null||m.focus();break;case"Tab":C();break}},D=x&&e.jsx("div",{ref:j,role:"menu","data-ds-portal":"",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,p&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:_,onKeyDown:U,children:s.map((b,E)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},E);if(b.type==="section")return e.jsxs("div",{className:"ds-dropdown__section",children:[b.label&&e.jsx("div",{className:"ds-dropdown__section-label",children:b.label}),e.jsx("div",{className:"ds-dropdown__section-content",children:b.content})]},E);const B=!!b.href,O=B?"a":"button",X=B?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(O,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...X,onClick:()=>{var R;(R=b.onClick)==null||R.call(b),C()},children:[b.icon&&e.jsx("span",{className:"ds-dropdown__item-icon",children:b.icon}),e.jsx("span",{className:"ds-dropdown__item-label",children:b.label}),b.shortcut&&e.jsx("span",{className:"ds-dropdown__item-shortcut",children:b.shortcut})]},E)})});return e.jsxs("div",{ref:w,className:["ds-dropdown",o&&"ds-dropdown--full-width",i].filter(Boolean).join(" "),style:l,...d,children:[e.jsx("div",{ref:T,className:"ds-dropdown__trigger",onClick:F,onKeyDown:Y,children:t}),typeof document<"u"&&se.createPortal(D,document.body)]})}function as({value:t=0,size:s="m",variant:n="default",showValue:r=!1,min:a=2,animate:o=!0}){const i=Math.min(100,Math.max(0,t)),l=Math.max(a,i),d=n==="auto"?i>=70?"success":i>=50?"warning":"danger":n;return e.jsxs("div",{className:["ds-progress",`ds-progress--${s}`,!o&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("div",{className:"ds-progress__track",children:e.jsx("div",{className:`ds-progress__fill ds-progress__fill--${d}`,style:{width:`${l}%`}})}),r&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const os=t=>1-Math.pow(1-t,3),is=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Ue(t,{duration:s=600}={}){const[n,r]=c.useState(t),a=c.useRef(t),o=c.useRef(null);return c.useEffect(()=>{if(is()){r(t),a.current=t;return}const i=a.current,l=t-i;if(l===0)return;let d=null;const u=f=>{d||(d=f);const p=Math.min((f-d)/s,1);r(i+l*os(p)),p<1?o.current=requestAnimationFrame(u):a.current=t};return o.current=requestAnimationFrame(u),()=>cancelAnimationFrame(o.current)},[t,s]),n}function ls({value:t,duration:s=600,decimals:n=0,prefix:r="",suffix:a=""}){const i=Ue(t,{duration:s}).toFixed(n);return`${r}${i}${a}`}function Ve({threshold:t=.1,rootMargin:s="0px",once:n=!1}={}){const r=c.useRef(null),[a,o]=c.useState(!1);return c.useEffect(()=>{const i=r.current;if(!i)return;const l=new IntersectionObserver(([d])=>{d.isIntersecting?(o(!0),n&&l.disconnect()):n||o(!1)},{threshold:t,rootMargin:s});return l.observe(i),()=>l.disconnect()},[t,s,n]),{ref:r,inView:a}}function cs({children:t,as:s="div",once:n=!1,threshold:r=.1,rootMargin:a="0px",onEnter:o,onLeave:i,...l}){const{ref:d,inView:u}=Ve({threshold:r,rootMargin:a,once:n}),f=c.useRef(!1);return c.useEffect(()=>{u&&!f.current&&(o==null||o()),!u&&f.current&&(i==null||i()),f.current=u},[u]),e.jsx(s,{ref:d,...l,children:typeof t=="function"?t(u):t})}const De={default:S.Info,success:S.CheckCircle,warning:S.AlertTriangle,error:S.XCircle};let ue=[];const ye=new Set;function He(){ye.forEach(t=>t([...ue]))}function ds(t){ue=[...ue,t],He()}function us(t){ue=ue.filter(s=>s.id!==t),He()}function fs(){const t=(s,n={})=>{ds({id:`${Date.now()}-${Math.random()}`,message:s,type:"default",duration:4e3,...n})};return t.success=(s,n)=>t(s,{...n,type:"success"}),t.error=(s,n)=>t(s,{...n,type:"error"}),t.warning=(s,n)=>t(s,{...n,type:"warning"}),{toast:t}}function ms({data:t,onDismiss:s}){const[n,r]=c.useState(!1),a=c.useRef(null);c.useEffect(()=>(requestAnimationFrame(()=>r(!0)),t.duration>0&&(a.current=setTimeout(()=>o(),t.duration)),()=>clearTimeout(a.current)),[]);function o(){r(!1),setTimeout(()=>s(t.id),250)}const i=De[t.type]??De.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${t.type}`,n&&"ds-toast--visible"].filter(Boolean).join(" "),role:t.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(i,{size:z[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:t.message}),e.jsx("button",{className:"ds-toast__close",onClick:o,"aria-label":"Закрыть",children:e.jsx(S.X,{size:z[3],strokeWidth:1.5})})]})}function ps({position:t="bottom-right"}){const[s,n]=c.useState(()=>[...ue]);return c.useEffect(()=>(ye.add(n),()=>ye.delete(n)),[]),!s.length||typeof document>"u"?null:se.createPortal(e.jsx("div",{"data-ds-portal":"",className:["ds-toast-container",`ds-toast-container--${t}`].join(" "),children:s.map(r=>e.jsx(ms,{data:r,onDismiss:us},r.id))}),document.body)}const hs={running:e.jsx(le,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(le,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(le,{size:"xs",variant:"error",children:"Error"})};function Xe({label:t,status:s="idle",icon:n,badge:r,defaultExpanded:a=!1,expanded:o,onToggle:i,children:l,className:d="",...u}){const f=s==="running",p=e.jsxs("span",{className:"ds-tool-card__title-row",children:[n&&e.jsx("span",{className:"ds-tool-card__icon",children:n}),e.jsx("span",{className:"ds-tool-card__label",children:t}),hs[s],r]});return l?e.jsx("div",{className:["ds-tool-card",f&&"ds-tool-card--running",d].filter(Boolean).join(" "),...u,children:e.jsx(xe,{title:p,padding:"s",defaultExpanded:a,expanded:f?!1:o,onToggle:f?void 0:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})}):e.jsx("div",{className:["ds-tool-card","ds-tool-card--bubble",d].filter(Boolean).join(" "),...u,children:p})}function Ye({text:t,size:s="xs",timeout:n=800,"aria-label":r="Copy to clipboard",...a}){const[o,i]=c.useState(!1),l=d=>{d.currentTarget.blur(),navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),n)})};return e.jsx(te,{variant:"ghost",size:s,state:o?"success":"idle",icon:e.jsx(S.Copy,{size:z[1],strokeWidth:1.5}),"aria-label":r,onClick:l,...a})}function xs({content:t,streaming:s=!1,...n}){const[r,a]=c.useState(s);return c.useEffect(()=>{a(!!s)},[s]),e.jsx(xe,{expanded:r,onToggle:a,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(S.Brain,{size:z[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Fe,{secondary:!0,children:"Thinking"})]}),...n,children:e.jsxs(Ee,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[t,s&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function vs({count:t,current:s=0,done:n=[],onChange:r,showCounter:a=!0,className:o="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",o].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:t},(d,u)=>{const f=u===s,p=n.includes(u)&&!f,v=r&&(u<=s||n.includes(u)),h=["ds-step-indicator__dot",f&&"ds-step-indicator__dot--active",p&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:h,role:"tab","aria-selected":f,"aria-label":`Step ${u+1}`,disabled:!v||u===s,onClick:()=>r==null?void 0:r(u),children:p?e.jsx(S.Check,{size:8,strokeWidth:3}):null},u)})}),a&&e.jsxs(Ee,{secondary:!0,className:"ds-step-indicator__counter",children:[s+1," / ",t]})]})}function bs({content:t,isStreaming:s=!1,cursor:n="line",onChunk:r,className:a="",...o}){const i=c.useRef(t);return c.useEffect(()=>{t!==i.current&&(r==null||r(t),i.current=t)},[t,r]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...o,children:[t,s&&n!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${n}`,"aria-hidden":"true"})]})}function _s({role:t="assistant",header:s,footer:n,attachments:r,isStreaming:a=!1,children:o,className:i="",...l}){const d=["ds-chat-message",`ds-chat-message--${t}`,a&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return t==="system"?e.jsx("div",{className:d,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:o})}):t==="user"?e.jsxs("div",{className:d,...l,children:[r&&e.jsx("div",{className:"ds-chat-message__attachments",children:r}),e.jsx("div",{className:"ds-chat-message__bubble",children:o}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]}):e.jsxs("div",{className:d,...l,children:[s&&e.jsx("div",{className:"ds-chat-message__header",children:s}),r&&e.jsx("div",{className:"ds-chat-message__attachments",children:r}),e.jsx("div",{className:"ds-chat-message__body",children:o}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]})}function js(t,{containerRef:s,smartPause:n=!0}={}){const r=c.useRef(!1),a=c.useRef(0);c.useEffect(()=>{const o=s==null?void 0:s.current;if(!o)return;const i=()=>{const l=o.scrollHeight-o.scrollTop-o.clientHeight<64;!l&&o.scrollTop<a.current&&(r.current=!0),l&&(r.current=!1),a.current=o.scrollTop};return o.addEventListener("scroll",i,{passive:!0}),()=>o.removeEventListener("scroll",i)},[s]),c.useEffect(()=>{const o=s==null?void 0:s.current;o&&(n&&r.current||(o.scrollTop=o.scrollHeight))},t)}function qe({prompts:t,enabled:s,typingSpeed:n=38,erasingSpeed:r=18,holdTime:a=2200,betweenTime:o=380,manualPauseMs:i=5e3}){const[l,d]=c.useState(0),[u,f]=c.useState(""),p=c.useRef("typing"),v=c.useRef(0),h=c.useRef(0),x=c.useRef(null),w=c.useRef(0);c.useEffect(()=>{h.current=l},[l]),c.useEffect(()=>{if(x.current&&(clearTimeout(x.current),x.current=null),!s||t.length===0){f(""),v.current=0,p.current="typing";return}const k=()=>{const A=Date.now();if(w.current>A){x.current=setTimeout(k,w.current-A);return}const I=t[h.current%t.length]??"";p.current==="typing"?(v.current+=1,f(I.slice(0,v.current)),v.current>=I.length?(p.current="holding",x.current=setTimeout(k,a)):x.current=setTimeout(k,n+Math.random()*28)):p.current==="holding"?(p.current="erasing",x.current=setTimeout(k,r)):(v.current=Math.max(0,v.current-1),f(I.slice(0,v.current)),v.current<=0?(p.current="typing",h.current=(h.current+1)%t.length,d(h.current),x.current=setTimeout(k,o)):x.current=setTimeout(k,r))};return x.current=setTimeout(k,260),()=>{x.current&&clearTimeout(x.current)}},[s,t,n,r,a,o]);const j=k=>{if(t.length===0)return;const A=(k%t.length+t.length)%t.length,I=t[A];h.current=A,v.current=I.length,p.current="holding",w.current=Date.now()+i,d(A),f(I)},T=()=>j(h.current+1),g=()=>j(h.current-1),_=t[l%t.length]??"";return{displayed:u,currentPrompt:_,index:l,next:T,prev:g}}let Ns=0;function gs({value:t="",onChange:s,onSubmit:n,onStop:r,onKeyDown:a,loading:o=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:d,attachments:u,images:f,onAttachFiles:p,onAttachImages:v,onRemoveAttachment:h,onRemoveImage:x,acceptImage:w,acceptFile:j,maxImages:T,maxImageSize:g,leftSlot:_,rightSlot:k,className:A="",...I}){const C=c.useRef(null),F=c.useRef(null),L=c.useRef(0),[N,M]=c.useState(!1),[Y,U]=c.useState([]),D=y=>{const P=++Ns;U(q=>[...q,{id:P,msg:y}]),setTimeout(()=>U(q=>q.filter(G=>G.id!==P)),6e3)},b=y=>U(P=>P.filter(q=>q.id!==y)),E=y=>y.type.startsWith("image/"),B=()=>!0,O=w??E,X=j??B,R=y=>{const P=[],q=[],G=[],K=[];let Q=0,ie=T!=null?T-((f==null?void 0:f.length)??0):1/0;for(const ee of y)O(ee)?g&&ee.size>g?G.push(ee.name):ie>0?(P.push(ee),ie--):Q++:X(ee)?q.push(ee):K.push(ee.name);return{imageFiles:P,docFiles:q,tooLarge:G,skipped:K,limitExceeded:Q}},m=y=>{const{imageFiles:P,docFiles:q,tooLarge:G,skipped:K,limitExceeded:Q}=R(y);G.length&&D(`File${G.length>1?"s":""} too large${g?` (max ${g/1024/1024}MB)`:""}: ${G.join(", ")}`),K.length&&D(`Skipped unsupported file${K.length>1?"s":""}: ${K.join(", ")}`),Q&&D(`Max ${T} images per message`),v&&P.length&&v(P);const ie=q.concat(v?[]:P);p&&ie.length&&p(ie)};c.useEffect(()=>{const y=F.current;y&&(y.style.height="auto",y.style.height=`${Math.min(y.scrollHeight,200)}px`)},[t]),c.useEffect(()=>{const y=P=>{var G,K,Q;if(o||i)return;const q=(G=P.target)==null?void 0:G.tagName;q==="INPUT"||q==="TEXTAREA"||q==="SELECT"||(K=P.target)!=null&&K.isContentEditable||P.ctrlKey||P.metaKey||P.altKey||P.key.length!==1&&P.key!=="Backspace"&&P.key!=="Delete"||(Q=F.current)==null||Q.focus()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o,i]);const $=y=>{y.preventDefault(),L.current++,y.dataTransfer.types.includes("Files")&&M(!0)},W=y=>{y.preventDefault(),L.current--,L.current===0&&M(!1)},V=y=>y.preventDefault(),Z=y=>{y.preventDefault(),L.current=0,M(!1);const P=Array.from(y.dataTransfer.files);P.length&&m(P)},re=y=>{const P=Array.from(y.target.files||[]);C.current&&(C.current.value=""),P.length&&m(P)},H=y=>{var ee;if(!v)return;const P=(ee=y.clipboardData)==null?void 0:ee.items;if(!P)return;const q=[];for(const Je of P){const Se=Je.getAsFile();Se&&q.push(Se)}if(q.length===0)return;const{imageFiles:G,tooLarge:K,skipped:Q,limitExceeded:ie}=R(q);K.length&&D(`File${K.length>1?"s":""} too large: ${K.join(", ")}`),Q.length&&D(`Skipped unsupported file${Q.length>1?"s":""}: ${Q.join(", ")}`),ie&&D(`Max ${T} images per message`),G.length&&(y.preventDefault(),v(G))},J=!o&&!i&&!!(d!=null&&d.length)&&t.length===0,ae=qe({prompts:d??[],enabled:J}),_e=y=>{if(J){if(y.key==="ArrowDown"||y.key==="ArrowRight"){y.preventDefault(),ae.next();return}if(y.key==="ArrowUp"||y.key==="ArrowLeft"){y.preventDefault(),ae.prev();return}if(y.key==="Tab"&&!y.shiftKey){y.preventDefault(),s==null||s(ae.currentPrompt);return}}a==null||a(y)},Ke=(t.trim()||(f==null?void 0:f.length)>0||(u==null?void 0:u.length)>0)&&!i,Re=p||v;return e.jsxs("div",{className:["ds-prompt-input",A].filter(Boolean).join(" "),...I,children:[Re&&e.jsx("input",{ref:C,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:re}),e.jsxs("div",{className:["ds-prompt-input__box",N&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:$,onDragLeave:W,onDragOver:V,onDrop:Z,children:[N&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:F,value:t,onChange:y=>s==null?void 0:s(y.target.value),onKeyDown:_e,onPaste:H,placeholder:J?"":l,disabled:o||i,rows:1,className:["ds-prompt-input__textarea",J&&"ds-prompt-input__textarea--anim"].filter(Boolean).join(" ")}),J&&e.jsxs("div",{className:"ds-prompt-input__anim","aria-hidden":"true",children:[e.jsx("span",{className:"ds-prompt-input__anim-text",children:ae.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),f&&f.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:f.map((y,P)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:y.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>x==null?void 0:x(P),"aria-label":"Remove image",type:"button",children:e.jsx(S.X,{size:12,strokeWidth:2})})]},P))}),Y.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:Y.map(y=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:y.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>b(y.id),"aria-label":"Dismiss",children:e.jsx(S.X,{size:z[1],strokeWidth:1.5})})]},y.id))}),u&&u.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:u.map((y,P)=>e.jsx(le,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[y.uploading?e.jsx(S.Loader,{size:z[1],strokeWidth:1.5,className:"spin"}):e.jsx(S.Paperclip,{size:z[1],strokeWidth:1.5}),y.filename,y.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>h==null?void 0:h(P),children:e.jsx(S.X,{size:z[1],strokeWidth:1.5})})]})},P))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[Re&&e.jsx(te,{variant:"ghost",size:"xs",icon:e.jsx(S.Paperclip,{size:z[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var y;return(y=C.current)==null?void 0:y.click()}}),_,k,e.jsx("div",{className:"ds-prompt-input__spacer"}),o?e.jsx(te,{variant:"primary",size:"xs",icon:e.jsx(S.Square,{size:z[2],strokeWidth:1.5}),onClick:r,"aria-label":"Stop"}):e.jsx(te,{variant:"primary",size:"xs",icon:e.jsx(S.ArrowUp,{size:z[2],strokeWidth:1.5}),onClick:n,disabled:!Ke,"aria-label":"Send"})]})]})]})}const Pe={fast:0,standard:1,premium:2},Ce={fast:"data-5",standard:"data-3",premium:"data-6"};function ws({models:t=[],value:s,onChange:n,size:r="xs",minTier:a,showAutoOption:o=!1,groupByTier:i=!0,className:l="",...d}){const[u,f]=c.useState(!1),p=c.useRef(null),v=c.useRef(null),h=c.useRef(null),[x,w]=c.useState({}),j=t.filter(N=>!a||N.name==="auto"?!0:(Pe[N.tier]??1)>=(Pe[a]??1)),T=j.find(N=>N.name==="auto"),g=j.filter(N=>N.name!=="auto"),_=t.find(N=>N.name===s),A=new Set(g.map(N=>N.tier).filter(Boolean)).size>1;c.useEffect(()=>{if(!u)return;const N=320,M=()=>{var B;const D=(B=v.current)==null?void 0:B.getBoundingClientRect();if(!D)return;const b=window.innerHeight-D.bottom,E=b<N+8&&D.top>b;w({position:"fixed",zIndex:"var(--z-dropdown, 500)",left:D.left,...E?{bottom:window.innerHeight-D.top+4,top:"auto"}:{top:D.bottom+4,bottom:"auto"}})};M(),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M);const Y=D=>{var b,E;!((b=p.current)!=null&&b.contains(D.target))&&!((E=h.current)!=null&&E.contains(D.target))&&f(!1)},U=D=>{D.key==="Escape"&&f(!1)};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",U),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M),document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",U)}},[u]);const I=N=>{n==null||n(N),f(!1)},C=N=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",N.name===s&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I(N.name),children:[N.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:N.icon}):e.jsx(S.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:N.displayName||N.name}),A&&N.tier&&e.jsx(le,{size:"xs",variant:Ce[N.tier]||"default",children:N.tier})]},N.name),F=()=>!i||!A?g.map(C):["fast","standard","premium"].flatMap(N=>{const M=g.filter(Y=>Y.tier===N);return M.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":N,children:N.charAt(0).toUpperCase()+N.slice(1)},`lbl-${N}`),...M.map(C)]:[]}),L=u&&e.jsxs("div",{ref:h,className:"ds-model-picker__menu ds-scrollable","data-ds-portal":"",style:x,children:[o&&T&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",s==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(S.Zap,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:"Auto (smart routing)"})]}),g.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),F()]});return e.jsxs("div",{ref:p,className:["ds-model-picker",l].filter(Boolean).join(" "),...d,children:[e.jsxs("button",{ref:v,type:"button",className:"ds-model-picker__trigger",onClick:()=>f(N=>!N),"aria-haspopup":"listbox","aria-expanded":u,children:[_!=null&&_.icon?e.jsx("span",{children:_.icon}):e.jsx(S.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(_==null?void 0:_.displayName)||(_==null?void 0:_.name)||s}),A&&(_==null?void 0:_.tier)&&e.jsx(le,{size:"xs",variant:Ce[_.tier]||"default",children:_.tier})]}),typeof document<"u"&&se.createPortal(L,document.body)]})}const ys=({filename:t,pages:s})=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:t}),s.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:ke(s)})]});function ke(t){return t!=null&&t.length?"p. "+t.join(", "):null}function ks(t){const s=new Map;for(const n of t)s.has(n.filename)||s.set(n.filename,{filename:n.filename,url:n.url,items:[]}),s.get(n.filename).items.push(n);return[...s.values()]}function Es({sources:t=[],layout:s="list",title:n="Sources",maxVisible:r=5,onSourceClick:a}){const[o,i]=c.useState(!1),l=ks(t),d=l.length>r,u=o?l:l.slice(0,r),f=t.some(v=>v.snippet),p=["ds-sources-panel",s==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return s==="compact"?e.jsxs("div",{className:p,children:[u.map(v=>{const h=v.items.map(w=>w.page).filter(Boolean),x=!!a;return e.jsxs("div",{className:`ds-sources-panel__compact-row${x?" ds-sources-panel__compact-row--clickable":""}`,onClick:x?()=>a(v.items[0]):void 0,children:[e.jsx(S.FileText,{size:z[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:v.filename}),h.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:ke(h)})]},v.filename)}),d&&!o&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-r," more sources"]})]}):e.jsxs("div",{className:p,children:[n&&e.jsx("div",{className:"ds-sources-panel__title",children:n}),u.map(v=>{const h=v.items.map(w=>w.page).filter(Boolean),x=!!a;return f?e.jsx(xe,{title:e.jsx(ys,{filename:v.filename,pages:h}),padding:"s",children:v.items.map((w,j)=>e.jsx("div",{className:`ds-sources-panel__snippet${x?" ds-sources-panel__snippet--clickable":""}`,onClick:x?()=>a(w):void 0,children:w.snippet??`p. ${w.page}`},j))},v.filename):e.jsxs("div",{className:`ds-sources-panel__row${x?" ds-sources-panel__row--clickable":""}`,onClick:x?()=>a(v.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:v.filename}),h.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:ke(h)})]},v.filename)}),d&&!o&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-r," more sources"]})]})}function Le(t){return t>=1e6?(t/1e6).toFixed(1).replace(/\.0$/,"")+"M":t>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(t)}function Rs({used:t,limit:s,size:n="s",showCount:r=!0,showPercent:a=!1,warningThreshold:o=.8,errorThreshold:i=1}){const l=s>0?t/s:0,d=Math.min(l*100,100),u=l>=i?"error":l>=o?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${n}`,role:"meter","aria-valuenow":t,"aria-valuemax":s,children:[e.jsx("div",{className:"ds-token-counter__track",children:e.jsx("div",{className:`ds-token-counter__fill ds-token-counter__fill--${u}`,style:{width:`${d}%`}})}),(r||a)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${u}`,children:[r&&e.jsxs("span",{children:[Le(t)," / ",Le(s)]}),a&&e.jsxs("span",{style:{marginLeft:"auto"},children:[Math.round(l*100),"%"]})]})]})}const Me=5;function Ss(t){return t<.34?"low":t<.67?"medium":"high"}function Ts({value:t=0,size:s="xs",showLabel:n="none",layout:r="inline"}){const a=Math.max(0,Math.min(1,t)),o=Math.round(a*Me),i=Ss(a);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${s}`,`ds-confidence-bar--${i}`,r==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:Me},(l,d)=>e.jsx("div",{className:`ds-confidence-bar__seg${d<o?" ds-confidence-bar__seg--filled":""}`},d))}),n==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const $s={add:"+",remove:"-",context:" "};function je({line:t,lineNumbers:s}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${t.type}`,children:[s&&t.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:t.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:$s[t.type]}),e.jsx("span",{className:"ds-diff-view__text",children:t.text})]})}function As({lines:t=[],layout:s="inline",wordWrap:n=!1,lineNumbers:r=!0,maxHeight:a,title:o}){const i=["ds-diff-view",`ds-diff-view--${s}`,n&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=a?{maxHeight:a,overflowY:"auto"}:void 0;if(s==="split"){const d=t.filter(f=>f.type==="remove"||f.type==="context"),u=t.filter(f=>f.type==="add"||f.type==="context");return e.jsxs("div",{className:i,children:[o&&e.jsx("div",{className:"ds-diff-view__title",children:o}),e.jsxs("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:d.map((f,p)=>e.jsx(je,{line:f,lineNumbers:r},p))}),e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:u.map((f,p)=>e.jsx(je,{line:f,lineNumbers:r},p))})]})]})}return e.jsxs("div",{className:i,children:[o&&e.jsx("div",{className:"ds-diff-view__title",children:o}),e.jsx("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:t.map((d,u)=>e.jsx(je,{line:d,lineNumbers:r},u))})]})}function Ge({value:t="idle",onLike:s,onDislike:n,className:r="",...a}){const o=t!=="idle";return e.jsxs("div",{className:["ds-message-feedback",o&&"ds-message-feedback--voted",r].filter(Boolean).join(" "),...a,children:[(!o||t==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",t==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:s,disabled:o,"aria-label":"Like","aria-pressed":t==="liked",children:e.jsx(S.ThumbsUp,{size:z[1],strokeWidth:1.5,fill:t==="liked"?"currentColor":"none"})}),(!o||t==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",t==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:n,disabled:o,"aria-label":"Dislike","aria-pressed":t==="disliked",children:e.jsx(S.ThumbsDown,{size:z[1],strokeWidth:1.5,fill:t==="disliked"?"currentColor":"none"})})]})}function Bs(t){const s=t instanceof Date?t:new Date(t);if(isNaN(s))return null;const n=new Date,r=s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()),o=new Date(a-864e5);if(s>=a)return r;if(s>=o)return`Yesterday ${r}`;const i=s.getDate(),l=s.toLocaleString([],{month:"short"});return`${i} ${l} ${r}`}function Is({role:t="assistant",text:s,timestamp:n,feedbackValue:r="idle",onLike:a,onDislike:o,className:i="",...l}){const d=t==="assistant"&&(a||o),u=!!s,f=n?Bs(n):null;return!d&&!u&&!f?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${t}`,i].filter(Boolean).join(" "),...l,children:[t==="user"&&f&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:f}),d&&e.jsx(Ge,{className:"ds-message-action",value:r,onLike:a,onDislike:o}),u&&e.jsx(Ye,{className:"ds-message-action",text:s}),t==="assistant"&&f&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:f})]})}function Ds({label:t,className:s="",...n}){return e.jsxs("span",{className:["ds-thinking-dot",s].filter(Boolean).join(" "),...n,children:[e.jsx("span",{className:"ds-thinking-dot__pulse"}),t&&e.jsx("span",{className:"ds-thinking-dot__label",children:t})]})}function Ps({variant:t="light",glow:s,mask:n=!0,style:r,...a}){const o=t==="dark",i=s??o,l=o?"rgba(255,250,250,0.05)":"var(--color-border-light)",d=o?"rgba(255,250,250,0.025)":"color-mix(in srgb, var(--color-border-light) 50%, transparent)";return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden",zIndex:0,...i&&{background:"radial-gradient(ellipse 1000px 500px at 50% 30%, rgba(234,100,100,0.18), transparent 70%)"},...r},...a,children:e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:[`linear-gradient(${l} 1px, transparent 1px)`,`linear-gradient(90deg, ${l} 1px, transparent 1px)`,`linear-gradient(${d} 1px, transparent 1px)`,`linear-gradient(90deg, ${d} 1px, transparent 1px)`].join(", "),backgroundSize:"80px 80px, 80px 80px, 16px 16px, 16px 16px",backgroundPosition:"-1px -1px, -1px -1px, -1px -1px, -1px -1px",...n&&{WebkitMaskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)",maskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)"}}})})}function Cs({children:t,axis:s="y",style:n,className:r="",...a}){const o=s==="x"?{overflowX:"auto",overflowY:"hidden"}:s==="both"?{overflow:"auto"}:{overflowY:"auto",overflowX:"hidden"};return e.jsx("div",{className:`ds-scrollable ${r}`,style:{...o,...n},...a,children:t})}const Ne=280,Ls=22,Ms=14,oe=8,he=6,zs=200;function Fs(t){return t?typeof t=="function"?t():typeof t=="string"?document.querySelector(t):null:null}function Ws(t,s,n,r){const a=window.innerWidth,o=window.innerHeight;if(o-t.bottom>=s+r+oe)return"bottom";if(t.top>=s+r+oe)return"top";if(a-t.right>=n+r+oe)return"right";if(t.left>=n+r+oe)return"left";const i=Math.max(t.top,o-t.bottom,a-t.right,t.left);return i===o-t.bottom?"bottom":i===t.top?"top":i===a-t.right?"right":"left"}function Os(t,s,n,r,a){const o=window.innerWidth,i=window.innerHeight;let l,d;switch(t){case"top":l=s.top-n-a,d=s.left+s.width/2-r/2;break;case"bottom":l=s.bottom+a,d=s.left+s.width/2-r/2;break;case"left":l=s.top+s.height/2-n/2,d=s.left-r-a;break;default:l=s.top+s.height/2-n/2,d=s.right+a}const u=Math.max(oe,Math.min(o-r-oe,d)),f=Math.max(oe,Math.min(i-n-oe,l));return{top:f,left:u,arrowOffset:d-u,arrowOffsetY:l-f}}function Us({steps:t,currentStep:s,onNext:n,onBack:r,onSkip:a,onFinish:o,overlay:i=!0,ring:l=!0,labelNext:d="Next",labelBack:u="Back",labelSkip:f="Skip tour",labelFinish:p="Done",statePrimary:v="idle",stateBack:h="idle"}){const x=c.useRef(null),w=c.useRef(t),j=c.useRef(s),T=c.useRef(l);w.current=t,j.current=s,T.current=l;const[g,_]=c.useState(!1),[k,A]=c.useState({position:"fixed",visibility:"hidden",width:Ne}),[I,C]=c.useState("bottom"),[F,L]=c.useState(null),N=c.useRef(!1),M=t[s],Y=s===t.length-1,U=c.useCallback(()=>{const D=w.current[j.current];if(!D||!x.current)return;const b=Fs(D.target);if(!b)return;const E=b.getBoundingClientRect(),O=x.current.getBoundingClientRect().height||160,X=Ne,R=T.current?Ls:Ms,m=D.position||Ws(E,O,X,R),{top:$,left:W,arrowOffset:V,arrowOffsetY:Z}=Os(m,E,O,X,R);C(m),A({position:"fixed",top:$,left:W,width:Ne,visibility:"visible","--arrow-offset":`${V}px`,"--arrow-offset-y":`${Z}px`}),L({top:E.top-he,left:E.left-he,width:E.width+he*2,height:E.height+he*2})},[]);return c.useEffect(()=>{window.addEventListener("scroll",U,!0),window.addEventListener("resize",U);const D=requestAnimationFrame(()=>{U(),_(!0),N.current=!0});return()=>{cancelAnimationFrame(D),window.removeEventListener("scroll",U,!0),window.removeEventListener("resize",U)}},[]),c.useEffect(()=>{if(!N.current)return;_(!1);const D=setTimeout(()=>{A(b=>({...b,visibility:"hidden"})),requestAnimationFrame(()=>{U(),_(!0)})},zs+20);return()=>clearTimeout(D)},[s]),c.useEffect(()=>{g&&x.current&&x.current.focus({preventScroll:!0})},[g]),c.useEffect(()=>{const D=b=>{b.key==="Escape"&&a()};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[a]),c.useEffect(()=>{if(!g)return;const D=b=>{if(b.key!=="Tab"||!x.current)return;const E=Array.from(x.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'));if(!E.length)return;const B=E[0],O=E[E.length-1];b.shiftKey&&document.activeElement===B?(b.preventDefault(),O.focus()):!b.shiftKey&&document.activeElement===O&&(b.preventDefault(),B.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[g]),!M||typeof document>"u"?null:se.createPortal(e.jsxs(e.Fragment,{children:[F&&e.jsx("div",{className:["ds-coachmark__spotlight",i&&"ds-coachmark__spotlight--overlay",!l&&"ds-coachmark__spotlight--no-ring",g&&"ds-coachmark__spotlight--visible"].filter(Boolean).join(" "),style:F,"aria-hidden":"true"}),e.jsxs("div",{ref:x,"data-ds-portal":"",role:"dialog","aria-modal":"false","aria-live":"polite","aria-label":M.title??`Step ${s+1} of ${t.length}`,className:["ds-coachmark__bubble",`ds-coachmark__bubble--${I}`,g&&"ds-coachmark__bubble--visible"].filter(Boolean).join(" "),style:k,tabIndex:-1,children:[e.jsx("button",{type:"button",className:"ds-coachmark__close",onClick:a,"aria-label":f,children:e.jsx(S.X,{size:16,strokeWidth:2})}),M.title&&e.jsx("div",{className:"ds-coachmark__title",children:M.title}),e.jsx("div",{className:"ds-coachmark__body",children:M.content}),e.jsxs("div",{className:"ds-coachmark__footer",children:[t.length>1&&e.jsxs("span",{className:"ds-coachmark__counter",children:[s+1," / ",t.length]}),e.jsxs("div",{className:"ds-coachmark__footer-nav",children:[s>0&&e.jsx(te,{variant:"secondary",size:"s",state:h,onClick:r,children:u}),e.jsx(te,{variant:"primary",size:"s",state:v,onClick:Y?o:n,children:Y?p:d})]})]})]})]}),document.body)}function Vs(t,s={}){const{storageKey:n}=s,[r,a]=c.useState(0),[o,i]=c.useState(!1),l=()=>n&&typeof localStorage<"u"&&localStorage.getItem(n)==="done",d=c.useCallback(()=>{i(!1),n&&typeof localStorage<"u"&&localStorage.setItem(n,"done")},[n]);return{currentStep:r,isActive:o,start:()=>{l()||(a(0),i(!0))},next:()=>a(u=>Math.min(u+1,t.length-1)),back:()=>a(u=>Math.max(u-1,0)),skip:d,finish:d}}function Hs(){const t=c.useRef(null),s=c.useCallback(()=>{const n=t.current;if(!n)return;n.classList.remove("ds-shake"),n.offsetWidth,n.classList.add("ds-shake");const r=()=>{n.classList.remove("ds-shake"),n.removeEventListener("animationend",r)};n.addEventListener("animationend",r)},[]);return{ref:t,shake:s}}exports.Accordion=xe;exports.Alert=ft;exports.AnimatedNumber=ls;exports.Avatar=$t;exports.Badge=le;exports.Banner=ns;exports.BottomSheet=xt;exports.Breadcrumb=Wt;exports.Button=te;exports.Card=at;exports.ChatMessage=_s;exports.Checkbox=kt;exports.Coachmark=Us;exports.Code=vt;exports.CodeAccordion=We;exports.ConfidenceBar=Ts;exports.CopyButton=Ye;exports.DiffView=As;exports.Dropdown=rs;exports.EmptyState=Mt;exports.EngineerGrid=Ps;exports.FormField=zt;exports.H1=ot;exports.H2=it;exports.H3=lt;exports.H4=ct;exports.InView=cs;exports.Input=tt;exports.Link=bt;exports.MessageFeedback=Ge;exports.MessageFooter=Is;exports.Modal=pt;exports.ModalFooter=ce;exports.ModelPicker=ws;exports.NavRail=Xt;exports.NavRailAgent=es;exports.NavRailBody=qt;exports.NavRailCustomItem=Qt;exports.NavRailDivider=Jt;exports.NavRailFlyout=ts;exports.NavRailFooter=Kt;exports.NavRailHeader=Gt;exports.NavRailItem=Yt;exports.NavRailRecents=Zt;exports.P1=dt;exports.P2=Fe;exports.P3=Ee;exports.Pagination=Ot;exports.ProgressBar=as;exports.PromptInput=gs;exports.Radio=Et;exports.ReasoningBlock=xs;exports.Scrollable=Cs;exports.SegmentedControl=Nt;exports.Select=nt;exports.SidePage=Ht;exports.SidePageFooter=we;exports.Skeleton=Oe;exports.SourcesPanel=Es;exports.Spinner=ze;exports.Stat=Ft;exports.StepIndicator=vs;exports.Stepper=rt;exports.StreamingText=bs;exports.Tab=jt;exports.Table=At;exports.TableBody=It;exports.TableHead=Bt;exports.TableRow=Dt;exports.TableSubheaderRow=Pt;exports.Tabs=_t;exports.Td=Lt;exports.Textarea=st;exports.Th=Ct;exports.ThinkingDot=Ds;exports.ToastContainer=ps;exports.Toggle=yt;exports.TokenCounter=Rs;exports.ToolCallBubble=Xe;exports.ToolCallCard=Xe;exports.Tooltip=ve;exports.iconSizes=z;exports.useAnimatedNumber=Ue;exports.useAnimatedPlaceholder=qe;exports.useCoachmark=Vs;exports.useInView=Ve;exports.useShake=Hs;exports.useStreamScroll=js;exports.useToast=fs;
22
+ <%s key={someKey} {...props} />`,M,H,K,H),W[H+M]=!0)}if(H=null,A!==void 0&&(n(A),H=""+A),i(v)&&(n(v.key),H=""+v.key),"key"in v){A={};for(var ie in v)ie!=="key"&&(A[ie]=v[ie])}else A=v;return H&&l(A,typeof p=="function"?p.displayName||p.name||"Unknown":p),f(p,H,A,r(),Z,re)}function h(p){x(p)?p._store&&(p._store.validated=1):typeof p=="object"&&p!==null&&p.$$typeof===F&&(p._payload.status==="fulfilled"?x(p._payload.value)&&p._payload.value._store&&(p._payload.value._store.validated=1):p._store&&(p._store.validated=1))}function x(p){return typeof p=="object"&&p!==null&&p.$$typeof===b}var m=c,b=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),j=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),L=Symbol.for("react.client.reference"),O=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,V=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(p){return p()}};var B,$={},X=m.react_stack_bottom_frame.bind(m,o)(),U=N(a(o)),W={};be.Fragment=w,be.jsx=function(p,v,A){var M=1e4>O.recentlyCreatedOwnerStacks++;return u(p,v,A,!1,M?Error("react-stack-top-frame"):X,M?N(a(p)):U)},be.jsxs=function(p,v,A){var M=1e4>O.recentlyCreatedOwnerStacks++;return u(p,v,A,!0,M?Error("react-stack-top-frame"):X,M?N(a(p)):U)}}()),be}process.env.NODE_ENV==="production"?Se.exports=ot():Se.exports=it();var e=Se.exports;const _e={close:"Close",closeModal:"Close modal",closeAlert:"Close alert",dismiss:"Dismiss",loading:"Loading",next:"Next",back:"Back",skipTour:"Skip tour",done:"Done",previousPage:"Previous page",nextPage:"Next page",pagination:"Pagination",pageN:"Page {n}",breadcrumb:"Breadcrumb",recents:"Recents",steps:"Steps",stepN:"Step {n}",stepOf:"Step {current} of {total}",copyToClipboard:"Copy to clipboard",selectOption:"Select option",like:"Like",dislike:"Dislike",removeImage:"Remove image",attachFiles:"Attach files",stop:"Stop",send:"Send",toggleVisibility:"Toggle visibility",decrease:"Decrease",increase:"Increase",sources:"Sources",moreSources:"+{n} more sources",pageAbbrev:"p. {pages}",code:"Code",promptPlaceholder:"Let's get things done...",dropFilesHere:"Drop files here",fileTooLarge:"File(s) too large{maxHint}: {names}",fileTooLargeMaxHint:" (max {maxMb}MB)",filesSkipped:"Skipped unsupported file(s): {names}",maxImages:"Max {n} images per message",uploading:"Uploading...",removeAttachment:"Remove attachment"};function Ae(t,s={}){return typeof t=="function"?t(s):typeof t!="string"?"":t.replace(/\{(\w+)\}/g,(n,a)=>s[a]!==void 0&&s[a]!==null?String(s[a]):"")}const Ie=c.createContext({strings:_e,t:(t,s)=>Ae(_e[t]??t,s)});function lt({strings:t,children:s}){const n=c.useMemo(()=>{const a={..._e,...t};return{strings:a,t:(r,o)=>Ae(a[r]??_e[r]??r,o)}},[t]);return e.jsx(Ie.Provider,{value:n,children:s})}function me(){return c.useContext(Ie)}function Y(){return c.useContext(Ie).strings}function Xe({size:t="m",color:s="default",className:n="","aria-label":a,...r}){const o=Y();return e.jsx("span",{className:["ds-spinner",`ds-spinner--${t}`,`ds-spinner--${s}`,n].filter(Boolean).join(" "),role:"status","aria-label":a??o.loading,...r})}const ct={xs:12,s:14,m:16,l:20};function se({children:t,variant:s="primary",size:n="m",fullWidth:a=!1,icon:r,disabled:o=!1,state:i="idle",onClick:l,type:d="button",href:f,"aria-label":u,className:h="",...x}){const m=r&&!t,b=i==="loading",g=i==="success",w=i==="error",E=b||g||w,k=n==="xs"?"s":"m",R=s==="danger"?"on-accent":"default",j=ct[n]??16,_=b?e.jsx(Xe,{size:k,color:R}):g?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(T.Check,{size:j,strokeWidth:2.5})}):w?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(T.X,{size:j,strokeWidth:2.5})}):null,I=["ds-button",`ds-button--${s}`,`ds-button--${n}`,a&&"ds-button--full",m&&"ds-button--icon-only",h].filter(Boolean).join(" "),D=i!=="idle"?i:void 0,P=e.jsxs(e.Fragment,{children:[E?_:r&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:r}),t]});if(f){const F=y=>{if(o||b){y.preventDefault();return}y.metaKey||y.ctrlKey||y.button===1||(y.preventDefault(),l==null||l(y))};return e.jsx("a",{className:I,href:o||b?void 0:f,onClick:F,"aria-label":u,"aria-disabled":o||b?"true":void 0,"aria-busy":b?"true":void 0,"data-state":D,...x,children:P})}return e.jsx("button",{type:d,className:I,disabled:o,onClick:b?void 0:l,"aria-label":u,"aria-busy":b?"true":void 0,"data-state":D,...x,children:P})}function dt({label:t,error:s,hint:n,fullWidth:a=!0,icon:r,iconRight:o,onIconRightClick:i,size:l="m",disabled:d,id:f,iconRightLabel:u,...h}){const x=Y(),m=f||`input-${c.useId()}`,b=n?`${m}-hint`:void 0,g=s?`${m}-error`:void 0,w=g||b;return e.jsxs("div",{className:`ds-input-wrapper ${a?"ds-input-wrapper--full":""} ${d?"ds-input-wrapper--disabled":""} ${s?"ds-input-wrapper--error":""}`,children:[t&&e.jsx("label",{className:"ds-input-label",htmlFor:m,children:t}),e.jsxs("div",{className:"ds-input-container",children:[r&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:r}),e.jsx("input",{id:m,className:`ds-input ds-input--${l} ${r?"ds-input--with-icon":""} ${o?"ds-input--with-icon-right":""} ${s?"ds-input--error":""}`,disabled:d,"aria-invalid":s?"true":"false","aria-describedby":w,...h}),o&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":u??x.toggleVisibility,children:o})]}),n&&!s&&e.jsx("span",{id:b,className:"ds-input-hint",children:n}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:s&&e.jsx("span",{id:g,className:"ds-input-error",role:"alert",children:s})})})]})}function ut({label:t,error:s,hint:n,fullWidth:a=!0,size:r="m",disabled:o,id:i,resize:l=!0,rows:d=3,...f}){const u=i||`textarea-${c.useId()}`,h=n?`${u}-hint`:void 0,x=s?`${u}-error`:void 0,m=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${a?"ds-textarea-wrapper--full":""} ${o?"ds-textarea-wrapper--disabled":""}`,children:[t&&e.jsx("label",{className:"ds-textarea-label",htmlFor:u,children:t}),e.jsx("textarea",{id:u,className:`ds-textarea ds-textarea--${r} ${s?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:o,"aria-invalid":s?"true":"false","aria-describedby":m,rows:d,...f}),n&&!s&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:n}),s&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:s})]})}function ft({label:t,value:s,onChange:n,options:a=[],placeholder:r,error:o,fullWidth:i=!0,size:l="m",disabled:d=!1,id:f,...u}){const h=Y(),x=r??h.selectOption,[m,b]=c.useState(!1),[g,w]=c.useState(!1),[E,k]=c.useState({}),[R,j]=c.useState("down"),[_,I]=c.useState(-1),D=c.useRef(null),P=c.useRef(null),F=c.useRef(null),y=c.useRef(null),L=f||`select-${c.useId()}`,O=`${L}-label`,q=o?`${L}-error`:void 0,V=150,N=(v=!1)=>{g||(w(!0),I(-1),y.current=setTimeout(()=>{var A;b(!1),w(!1),v&&((A=F.current)==null||A.focus())},V))},B=v=>{clearTimeout(y.current),w(!1);const A=v!==void 0?v:Math.max(a.findIndex(M=>M.value===s),0);I(A),b(!0)};c.useEffect(()=>()=>clearTimeout(y.current),[]);const $=()=>{var K;const v=(K=D.current)==null?void 0:K.getBoundingClientRect();if(!v)return;const A=window.innerHeight,M=A-v.bottom,Z=v.top,H=M<300&&Z>M;j(H?"up":"down"),k(H?{bottom:A-v.top+4,left:v.left,width:v.width}:{top:v.bottom+4,left:v.left,width:v.width})};c.useEffect(()=>{if(m)return $(),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[m]),c.useEffect(()=>{const v=A=>{D.current&&!D.current.contains(A.target)&&P.current&&!P.current.contains(A.target)&&N()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[g]),c.useEffect(()=>{var A;if(!m||_<0||!P.current)return;(A=P.current.querySelectorAll(".ds-select-option")[_])==null||A.scrollIntoView({block:"nearest"})},[_,m]);const X=v=>{switch(v.key){case"ArrowDown":v.preventDefault(),m?I(A=>Math.min(A+1,a.length-1)):B();break;case"ArrowUp":v.preventDefault(),m?I(A=>Math.max(A-1,0)):B(a.length-1);break;case"Home":m&&(v.preventDefault(),I(0));break;case"End":m&&(v.preventDefault(),I(a.length-1));break;case"Enter":case" ":v.preventDefault(),m?_>=0&&(n==null||n(a[_].value),N(!0)):B();break;case"Escape":m&&(v.preventDefault(),N(!0));break;case"Tab":m&&N(!1);break}},U=a.find(v=>v.value===s),W=l==="xs"?z[1]:l==="small"?z[2]:z[3],p=m&&e.jsx("div",{ref:P,"data-ds-portal":"",role:"listbox","aria-labelledby":t?O:void 0,tabIndex:-1,className:["ds-select-dropdown ds-scrollable",`ds-select-dropdown--${l}`,`ds-select-dropdown--${R}`,g&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:E,children:a.map((v,A)=>e.jsx("button",{id:`${L}-opt-${A}`,type:"button",role:"option",tabIndex:-1,"aria-selected":s===v.value,className:["ds-select-option",`ds-select-option--${l}`,s===v.value&&"ds-select-option--selected",A===_&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{n==null||n(v.value),N(!0)},children:v.label},v.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${d?"ds-select-wrapper--disabled":""}`,children:[t&&e.jsx("label",{id:O,className:"ds-select-label",children:t}),e.jsx("div",{className:"ds-select-container",ref:D,children:e.jsxs("button",{ref:F,type:"button",id:L,role:"combobox","aria-haspopup":"listbox","aria-expanded":m,"aria-activedescendant":m&&_>=0?`${L}-opt-${_}`:void 0,"aria-labelledby":t?O:void 0,"aria-invalid":o?"true":"false","aria-describedby":q,className:`ds-select-trigger ds-select-trigger--${l} ${o?"ds-select-trigger--error":""}`,onClick:()=>{d||(m?N():B())},onKeyDown:X,disabled:d,...u,children:[e.jsx("span",{className:U?"":"ds-select-placeholder",children:(U==null?void 0:U.label)||x}),e.jsx(T.ChevronDown,{size:W,strokeWidth:1.5,className:`ds-select-icon ${m&&R==="down"?"ds-select-icon--open":""} ${m&&R==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),o&&e.jsx("span",{id:q,className:"ds-select-error",role:"alert",children:o}),typeof document<"u"&&ne.createPortal(p,document.body)]})}function mt({label:t,value:s=0,onChange:n,min:a=0,max:r=100,step:o=1,size:i="m",disabled:l=!1,hint:d,error:f,decreaseLabel:u,increaseLabel:h,...x}){const m=Y(),b=()=>{if(l)return;const j=Math.min(Number(s)+o,r);n==null||n(j)},g=()=>{if(l)return;const j=Math.max(Number(s)-o,a);n==null||n(j)},w=j=>{if(l)return;const _=j.target.value;if(_===""){n==null||n(a);return}const I=Number(_);if(!isNaN(I)){const D=Math.min(Math.max(I,a),r);n==null||n(D)}},E=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",f&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),k=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),R=i==="xs"?z[1]:i==="small"?z[2]:z[3];return e.jsxs("div",{className:E,children:[t&&e.jsx("label",{className:"ds-stepper-label",children:t}),e.jsxs("div",{className:k,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:g,disabled:l||s<=a,"aria-label":u??m.decrease,children:e.jsx(T.Minus,{size:R,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:s,onChange:w,min:a,max:r,step:o,disabled:l,...x}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:b,disabled:l||s>=r,"aria-label":h??m.increase,children:e.jsx(T.Plus,{size:R,strokeWidth:1.5})})]}),d&&!f&&e.jsx("div",{className:"ds-stepper-hint",children:d}),f&&e.jsx("div",{className:"ds-stepper-error",children:f})]})}function pt({children:t,padding:s="m",variant:n="default",hover:a=!1,onClick:r,href:o,disabled:i=!1,className:l="",...d}){const u=(a?"interactive":n)==="interactive"||r||o,h=["ds-card",`ds-card--${s}`,u&&"ds-card--interactive",l].filter(Boolean).join(" ");if(o){const b=g=>{if(i){g.preventDefault();return}g.metaKey||g.ctrlKey||g.button===1||(g.preventDefault(),r==null||r(g))};return e.jsx("a",{className:h,href:i?void 0:o,onClick:b,"aria-disabled":i?"true":void 0,...d,children:t})}const x=u&&r?"button":"div",m=u&&r?{type:"button",onClick:r,disabled:i}:{};return e.jsx(x,{className:h,role:u&&!r?"article":void 0,...m,...d,children:t})}function ht({children:t,...s}){return e.jsx("h1",{className:"ds-h1",...s,children:t})}function xt({children:t,...s}){return e.jsx("h2",{className:"ds-h2",...s,children:t})}function vt({children:t,...s}){return e.jsx("h3",{className:"ds-h3",...s,children:t})}function bt({children:t,...s}){return e.jsx("h4",{className:"ds-h4",...s,children:t})}function _t({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p1 ${s?"ds-p1--secondary":""}`,...n,children:t})}function Ye({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p2 ${s?"ds-p2--secondary":""}`,...n,children:t})}function Be({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p3 ${s?"ds-p3--secondary":""}`,...n,children:t})}function ce({children:t,variant:s="default",size:n="m",role:a,...r}){const o=["ds-badge",`ds-badge--${s}`,`ds-badge--${n}`].filter(Boolean).join(" "),i=a||(["info","success","warning","error"].includes(s)?"status":void 0);return e.jsx("span",{className:o,role:i,...r,children:t})}const jt={info:T.Info,success:T.CheckCircle,warning:T.AlertTriangle,error:T.XCircle},gt=c.forwardRef(function({children:s,variant:n="info",title:a,onClose:r,role:o,closeLabel:i,...l},d){const f=Y(),u=jt[n],h=o||(n==="error"?"alert":"status");return e.jsxs("div",{ref:d,className:`ds-alert ds-alert--${n} ${a?"":"ds-alert--no-title"}`,role:h,...l,children:[u&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(u,{size:z[3],strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[a&&e.jsx("div",{className:"ds-alert__title",children:a}),s&&e.jsx("div",{className:"ds-alert__message",children:s})]}),r&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:r,"aria-label":i??f.closeAlert,children:e.jsx(T.X,{size:z[3],strokeWidth:1.5})})]})}),Nt=200;function wt({children:t,title:s,onClose:n,size:a="m",scrollable:r=!1,subHeader:o,closeLabel:i,...l}){const d=Y(),f=c.useRef(null),u=c.useId(),[h,x]=c.useState(!1),m=()=>{!n||h||(x(!0),setTimeout(()=>{x(!1),n()},Nt))};c.useEffect(()=>{const k=j=>{j.key==="Escape"&&m()},R=j=>{var I,D,P;const _=((D=(I=j.composedPath)==null?void 0:I.call(j))==null?void 0:D[0])??j.target;f.current&&!f.current.contains(_)&&!((P=_.closest)!=null&&P.call(_,"[data-ds-portal]"))&&m()};return document.addEventListener("keydown",k),document.addEventListener("mousedown",R),()=>{document.removeEventListener("keydown",k),document.removeEventListener("mousedown",R)}},[n,h]);const b=c.Children.toArray(t),g=b.find(k=>(k==null?void 0:k.type)===de),w=b.filter(k=>(k==null?void 0:k.type)!==de),E=e.jsx("div",{className:["ds-modal-overlay",h&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...l,children:e.jsxs("div",{className:[`ds-modal ds-modal--${a}`,r&&"ds-modal--scrollable"].filter(Boolean).join(" "),ref:f,role:"dialog","aria-modal":"true","aria-labelledby":s?u:void 0,children:[n&&e.jsx(se,{className:"ds-modal__close",variant:"ghost",size:"small",icon:e.jsx(T.X,{size:z[2],strokeWidth:1.5}),onClick:m,"aria-label":i??d.closeModal}),(s||o)&&e.jsxs("div",{className:"ds-modal__header",children:[s&&e.jsx("h3",{id:u,className:"ds-modal__title",children:s}),o&&e.jsx("div",{className:"ds-modal__subheader",children:o})]}),e.jsx("div",{className:"ds-modal__body ds-scrollable",children:w}),g]})});return typeof document>"u"?E:ne.createPortal(E,document.body)}function de({children:t}){return!t||c.Children.count(t)===0?null:e.jsx("div",{className:"ds-modal__footer",children:t})}const yt=320;function kt({children:t,title:s,onClose:n,subHeader:a,closeLabel:r,...o}){const i=Y(),l=c.useRef(null),d=c.useId(),[f,u]=c.useState(!1),h=()=>{!n||f||(u(!0),setTimeout(()=>{u(!1),n()},yt))};c.useEffect(()=>{const w=k=>{k.key==="Escape"&&h()},E=k=>{var j,_,I;const R=((_=(j=k.composedPath)==null?void 0:j.call(k))==null?void 0:_[0])??k.target;l.current&&!l.current.contains(R)&&!((I=R.closest)!=null&&I.call(R,"[data-ds-portal]"))&&h()};return document.addEventListener("keydown",w),document.addEventListener("mousedown",E),()=>{document.removeEventListener("keydown",w),document.removeEventListener("mousedown",E)}},[n,f]);const x=c.Children.toArray(t),m=x.find(w=>(w==null?void 0:w.type)===de),b=x.filter(w=>(w==null?void 0:w.type)!==de),g=e.jsx("div",{className:["ds-bottom-sheet-overlay",f&&"ds-bottom-sheet-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("div",{ref:l,className:["ds-bottom-sheet",f&&"ds-bottom-sheet--closing"].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":s?d:void 0,children:[e.jsx("div",{className:"ds-bottom-sheet__handle","aria-hidden":"true"}),n&&e.jsx(se,{className:"ds-bottom-sheet__close",variant:"ghost",size:"small",icon:e.jsx(T.X,{size:z[2],strokeWidth:1.5}),onClick:h,"aria-label":r??i.close}),(s||a)&&e.jsxs("div",{className:"ds-bottom-sheet__header",children:[s&&e.jsx("h3",{id:d,className:"ds-bottom-sheet__title",children:s}),a&&e.jsx("div",{className:"ds-bottom-sheet__subheader",children:a})]}),e.jsx("div",{className:"ds-bottom-sheet__body ds-scrollable",children:b}),m]})});return typeof document>"u"?g:ne.createPortal(g,document.body)}function qe({children:t,title:s,defaultExpanded:n=!1,expanded:a,onToggle:r,padding:o="s",className:i="",...l}){const d=Y(),f=s??d.code,[u,h]=c.useState(n),x=a!==void 0,m=x?a:u,b=()=>{x?r==null||r(!a):h(w=>!w)},g=["ds-code-accordion",`ds-code-accordion--${o}`,m&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:g,...l,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:b,"aria-expanded":m,children:[e.jsx("span",{className:"ds-code-accordion__title",children:f}),e.jsx(T.ChevronDown,{size:z[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${m?"ds-code-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-code-accordion__content",children:e.jsx("div",{className:"ds-code-accordion__inner",children:e.jsx("pre",{className:"ds-code-accordion__pre ds-scrollable",children:e.jsx("code",{children:t})})})})]})}function Et({children:t,block:s=!1,collapsible:n=!1,title:a,defaultExpanded:r=!1,...o}){const i=Y(),l=a??i.code;return s?n?e.jsx(qe,{title:l,defaultExpanded:r,...o,children:t}):e.jsx("pre",{className:"ds-code-block ds-scrollable",...o,children:e.jsx("code",{children:t})}):e.jsx("code",{className:"ds-code-inline",...o,children:t})}function Rt({href:t,children:s,onClick:n,target:a,rel:r,...o}){const l=a==="_blank"?r?`${r} noopener noreferrer`:"noopener noreferrer":r;return e.jsx("a",{href:t,className:"ds-link",onClick:n,target:a,rel:l,...o,children:s})}function St({children:t,size:s="m",variant:n="ghost",...a}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...a,children:c.Children.map(t,r=>c.isValidElement(r)?c.cloneElement(r,{size:s,variant:n}):r)})}function Tt({children:t,selected:s=!1,onClick:n,size:a="m",variant:r="ghost",disabled:o=!1,icon:i,href:l,...d}){const f=i&&!t,u=["ds-tab",`ds-tab--${a}`,`ds-tab--${r}`,s&&"ds-tab--selected",f&&"ds-tab--icon-only"].filter(Boolean).join(" "),h=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),t]});if(l){const x=m=>{if(o){m.preventDefault();return}m.metaKey||m.ctrlKey||m.button===1||(m.preventDefault(),n==null||n(m))};return e.jsx("a",{role:"tab","aria-current":s?"page":void 0,"aria-disabled":o?"true":void 0,className:u,href:o?void 0:l,onClick:x,...d,children:h})}return e.jsx("button",{role:"tab","aria-selected":s,className:u,onClick:n,disabled:o,...d,children:h})}function $t({options:t,value:s,onChange:n,size:a="m",disabled:r=!1}){const o=c.useRef(null),i=c.useRef(null),[l,d]=c.useState(!1),f=c.useRef(!1),u=c.useRef(null),h=c.useRef(null),x=()=>{if(!o.current)return;const m=o.current.querySelector(`[data-value="${s}"]`);if(!m)return;const b=o.current.getBoundingClientRect(),g=m.getBoundingClientRect(),w=g.left-b.left,E=g.width;i.current?(i.current.style.transition=f.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=w+"px",i.current.style.width=E+"px",f.current=!1):(d(!0),requestAnimationFrame(()=>{if(!i.current||!o.current)return;const k=o.current.querySelector(`[data-value="${s}"]`);if(!k)return;const R=o.current.getBoundingClientRect(),j=k.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=j.left-R.left+"px",i.current.style.width=j.width+"px"}))};return h.current=x,c.useLayoutEffect(()=>{const m=u.current!==s;u.current=s,f.current=l&&m,x()}),c.useEffect(()=>{if(!o.current)return;const m=new ResizeObserver(()=>{f.current=!1,h.current()});return m.observe(o.current),()=>m.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${a}`,r&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:o,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),t.map(m=>e.jsxs("button",{type:"button","data-value":m.value,className:["ds-seg__btn",s===m.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!r&&n(m.value),"aria-pressed":s===m.value,disabled:r,children:[m.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:m.icon}),m.label]},m.value))]})}function Ne({children:t,title:s,defaultExpanded:n=!1,expanded:a,onToggle:r,padding:o="m",...i}){const[l,d]=c.useState(n),f=a!==void 0,u=f?a:l,h=()=>{f?r==null||r(!a):d(m=>!m)},x=["ds-accordion",`ds-accordion--${o}`,u&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:x,...i,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:h,"aria-expanded":u,children:[e.jsx("span",{className:"ds-accordion__title",children:s}),e.jsx(T.ChevronDown,{size:z[2],strokeWidth:1.5,className:`ds-accordion__icon ${u?"ds-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-accordion__content",children:e.jsx("div",{className:"ds-accordion__content-inner",children:e.jsx("div",{className:"ds-accordion__content-body",children:t})})})]})}const ae=8,ue=8;function At(t,s,n){const a=window.innerWidth;let r,o;switch(t){case"top":r=s.top-n.height-ae,o=s.left+s.width/2-n.width/2;break;case"bottom":r=s.bottom+ae,o=s.left+s.width/2-n.width/2;break;case"left":r=s.top+s.height/2-n.height/2,o=s.left-n.width-ae;break;case"right":r=s.top+s.height/2-n.height/2,o=s.right+ae;break;default:r=s.bottom+ae,o=s.left}const i=Math.max(ue,Math.min(a-n.width-ue,o)),l=o-i;return{top:r,left:i,arrowOffset:l}}function It(t,s,n){const a=window.innerWidth,r=window.innerHeight;if(t.top>=s+ae+ue)return"top";if(r-t.bottom>=s+ae+ue)return"bottom";if(a-t.right>=n+ae+ue)return"right";if(t.left>=n+ae+ue)return"left";const o=Math.max(t.top,r-t.bottom,t.left,a-t.right);return o===t.top?"top":o===r-t.bottom?"bottom":o===a-t.right?"right":"left"}function we({children:t,content:s,position:n,...a}){const[r,o]=c.useState(!1),[i,l]=c.useState({visibility:"hidden"}),[d,f]=c.useState(n||"top"),u=c.useRef(null),h=c.useRef(null),x=c.useRef(!1),m=()=>{if(!u.current||!h.current)return;const g=u.current.getBoundingClientRect(),w=h.current.getBoundingClientRect(),E=n||It(g,w.height,w.width),{top:k,left:R,arrowOffset:j}=At(E,g,w);f(E),l({position:"fixed",top:k,left:R,visibility:"visible","--arrow-offset":`${j}px`})};if(c.useEffect(()=>{if(!r)return;l({position:"fixed",visibility:"hidden"});const g=requestAnimationFrame(m);return window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{cancelAnimationFrame(g),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[r,n]),c.useEffect(()=>{if(!r)return;const g=w=>{u.current&&!u.current.contains(w.target)&&o(!1)};return document.addEventListener("touchstart",g),()=>document.removeEventListener("touchstart",g)},[r]),!s)return t;const b=r&&e.jsx("div",{ref:h,"data-ds-portal":"",className:`ds-tooltip ds-tooltip--${d}`,role:"tooltip",style:i,children:s});return e.jsxs("div",{ref:u,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||o(!0)},onMouseLeave:()=>{x.current||o(!1)},onTouchStart:()=>{x.current=!0,o(g=>!g)},...a,children:[t,typeof document<"u"&&ne.createPortal(b,document.body)]})}function Bt({checked:t=!1,onChange:s,size:n="m",disabled:a=!1,label:r,id:o,...i}){const l=o||`toggle-${c.useId()}`,d=["ds-toggle",`ds-toggle--${n}`,a&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:d,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:t,onChange:f=>s==null?void 0:s(f.target.checked),disabled:a,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),r&&e.jsx("span",{className:"ds-toggle__label",children:r})]})}function Dt({checked:t=!1,onChange:s,size:n="m",disabled:a=!1,label:r,id:o,...i}){const l=o||`checkbox-${c.useId()}`,d=["ds-checkbox",`ds-checkbox--${n}`,a&&"ds-checkbox--disabled"].filter(Boolean).join(" "),f=n==="xs"?10:n==="small"?14:n==="large"?20:16;return e.jsxs("label",{className:d,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:t,onChange:u=>s==null?void 0:s(u.target.checked),disabled:a,...i}),e.jsx("span",{className:"ds-checkbox__box",children:t&&e.jsx(T.Check,{size:f,strokeWidth:2.5,className:"ds-checkbox__icon"})}),r&&e.jsx("span",{className:"ds-checkbox__label",children:r})]})}function Pt({checked:t=!1,onChange:s,size:n="m",disabled:a=!1,label:r,name:o,value:i,id:l,...d}){const f=l||`radio-${c.useId()}`,u=["ds-radio",`ds-radio--${n}`,a&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:u,htmlFor:f,children:[e.jsx("input",{type:"radio",id:f,className:"ds-radio__input",checked:t,onChange:h=>s==null?void 0:s(h.target.checked),disabled:a,name:o,value:i,...d}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),r&&e.jsx("span",{className:"ds-radio__label",children:r})]})}function Ge({width:t,height:s,shape:n="rect",aspectRatio:a,className:r="",style:o={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${n}`,r].filter(Boolean).join(" "),style:{width:t,height:s,aspectRatio:a,...o},"aria-hidden":"true",...i})}function Lt({lines:t=1,lastLineWidth:s="70%",gap:n,className:a="",style:r={},...o}){return e.jsx("span",{className:["ds-skeleton-text",a].filter(Boolean).join(" "),style:{gap:n,...r},"aria-hidden":"true",...o,children:Array.from({length:t},(i,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===t-1&&t>1?{width:s}:void 0},l))})}Ge.Text=Lt;function Ct(t){let s=2166136261;for(let n=0;n<t.length;n++)s^=t.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s%360}function Mt(t){if(!t)return"";const s=t.trim().split(/\s+/);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():t[0].toUpperCase()}function Ft({seed:t,icon:s,src:n,size:a=32,className:r="",style:o={},...i}){const l=Ct(t??""),[d,f]=c.useState(!1),u=s??e.jsx("span",{className:"ds-avatar__initials",children:Mt(t)});return e.jsx("div",{className:["ds-avatar",r].filter(Boolean).join(" "),style:{width:a,height:a,"--ds-avatar-h":l,...o},"aria-hidden":"true",...i,children:n&&!d?e.jsx("img",{src:n,alt:"",onError:()=>f(!0)}):u})}function zt({children:t,size:s="compact",stickyTop:n,maxHeight:a,className:r="",style:o={},...i}){const l={...a?{maxHeight:a}:{},...n!==void 0?{"--ds-table-sticky-top":typeof n=="number"?`${n}px`:n}:{},...o};return e.jsx("div",{className:["ds-table-wrap","ds-scrollable",a?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${s}`,r].filter(Boolean).join(" "),...i,children:t})})}function Wt({children:t,...s}){return e.jsx("thead",{...s,children:t})}function Ot({children:t,...s}){return e.jsx("tbody",{...s,children:t})}function Ut({children:t,interactive:s,selected:n,subheader:a,exiting:r,updated:o,className:i="",onClick:l,...d}){return e.jsx("tr",{className:["ds-table-row",s||l?"ds-table-row--interactive":"",n?"ds-table-row--selected":"",a?"ds-table-row--subheader":"",r?"ds-table-row--exiting":"",o?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...d,children:t})}function Ht({children:t,colSpan:s=999,...n}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...n,children:e.jsx("td",{colSpan:s,children:t})})}function Vt({children:t,align:s="left",sortDir:n,onSort:a,width:r,className:o="",style:i={},...l}){const d=!!a||n!==void 0,f=n==="asc"?T.ChevronUp:n==="desc"?T.ChevronDown:T.ChevronsUpDown;return e.jsx("th",{className:["ds-th",d?"ds-th--sortable":"",n?"ds-th--sorted":"",s!=="left"?`ds-table-cell--${s}`:"",o].filter(Boolean).join(" "),onClick:a,style:{width:r,...i},...l,children:d?e.jsxs("span",{className:"ds-th__inner",children:[t,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(f,{size:11,strokeWidth:2.5})})]}):t})}function Xt({children:t,align:s="left",secondary:n,muted:a,truncate:r,nowrap:o,className:i="",...l}){return e.jsx("td",{className:["ds-td",s!=="left"?`ds-table-cell--${s}`:"",n?"ds-table-cell--secondary":"",a?"ds-table-cell--muted":"",r?"ds-table-cell--truncate":"",o?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:t})}function Yt({icon:t,title:s,description:n,action:a,size:r="m",className:o="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${r}`,o].filter(Boolean).join(" "),...i,children:[t&&e.jsx("div",{className:"ds-empty-state__icon",children:t}),e.jsx("div",{className:"ds-empty-state__title",children:s}),n&&e.jsx("div",{className:"ds-empty-state__description",children:n}),a&&e.jsx("div",{className:"ds-empty-state__action",children:a})]})}function qt({label:t,hint:s,error:n,required:a=!1,disabled:r=!1,htmlFor:o,children:i,className:l="",style:d,...f}){const u=c.useId(),h=o??u,x=`${h}-hint`,m=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":n?"error":void 0,"data-required":a?"":void 0,"data-disabled":r?"":void 0,style:d,...f,children:[t&&e.jsx("label",{className:"ds-field-label",htmlFor:h,children:t}),e.jsx("div",{className:"ds-field-control",children:i}),s&&!n&&e.jsx("p",{className:"ds-field-hint",id:x,children:s}),n&&e.jsx("p",{className:"ds-field-error",id:m,role:"alert",children:n})]})}function Gt({label:t,value:s,delta:n,size:a="m",inline:r=!1,className:o="",style:i,...l}){const d=n!=null&&n.startsWith("+")?"up":n!=null&&n.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${a}`,r&&"ds-stat--inline",o].filter(Boolean).join(" "),style:i,...l,children:[t&&e.jsx("span",{className:"ds-stat-label",children:t}),s!=null&&e.jsx("span",{className:"ds-stat-value",children:s}),n!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${d}`,children:n})]})}function Kt({children:t,separator:s="/","aria-label":n,className:a="",style:r,...o}){const i=Y(),l=c.Children.toArray(t).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${a?` ${a}`:""}`,"aria-label":n??i.breadcrumb,style:r,...o,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:l.map((d,f)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[d,f<l.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:s})]},f))})})}function Jt({page:t,total:s,onChange:n,siblings:a=1,"aria-label":r,previousLabel:o,nextLabel:i,className:l="",style:d,...f}){const u=Y(),{t:h}=me(),x=Zt(t,s,a);return e.jsxs("nav",{className:`ds-pagination${l?` ${l}`:""}`,"aria-label":r??u.pagination,style:d,...f,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(t-1),disabled:t<=1,"aria-label":o??u.previousPage,children:e.jsx(T.ChevronLeft,{size:16})}),x.map((m,b)=>m==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${b}`):e.jsx("button",{className:`ds-pagination-page${m===t?" ds-pagination-page--current":""}`,onClick:()=>m!==t&&(n==null?void 0:n(m)),"aria-current":m===t?"page":void 0,"aria-label":h("pageN",{n:m}),children:m},m)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(t+1),disabled:t>=s,"aria-label":i??u.nextPage,children:e.jsx(T.ChevronRight,{size:16})})]})}function Zt(t,s,n){if(s<=7)return Array.from({length:s},(i,l)=>l+1);const a=Math.max(2,t-n),r=Math.min(s-1,t+n),o=[1];a>2&&o.push("…");for(let i=a;i<=r;i++)o.push(i);return r<s-1&&o.push("…"),o.push(s),o}const Qt=300;function es({children:t,title:s,onClose:n,subHeader:a,side:r="right",size:o="wide",offsetLeft:i=0,offsetRight:l=0,keepOpenRef:d,closeLabel:f,...u}){const h=Y(),x=c.useRef(null),m=c.useId(),[b,g]=c.useState(!1),w=()=>{!n||b||(g(!0),setTimeout(()=>{g(!1),n()},Qt))};c.useEffect(()=>{const _=D=>{D.key==="Escape"&&w()},I=D=>{var F,y,L,O;const P=((y=(F=D.composedPath)==null?void 0:F.call(D))==null?void 0:y[0])??D.target;(L=d==null?void 0:d.current)!=null&&L.contains(P)||x.current&&!x.current.contains(P)&&!((O=P.closest)!=null&&O.call(P,"[data-ds-portal]"))&&w()};return document.addEventListener("keydown",_),document.addEventListener("mousedown",I),()=>{document.removeEventListener("keydown",_),document.removeEventListener("mousedown",I)}},[n,b,d]);const E=c.Children.toArray(t),k=E.find(_=>(_==null?void 0:_.type)===Te||(_==null?void 0:_.type)===de),R=E.filter(_=>(_==null?void 0:_.type)!==Te&&(_==null?void 0:_.type)!==de),j=e.jsx("div",{className:["ds-side-page-overlay",b&&"ds-side-page-overlay--closing"].filter(Boolean).join(" "),"data-side":r,style:{"--ds-side-page-offset-left":`${i}px`,"--ds-side-page-offset-right":`${l}px`},...u,children:e.jsxs("div",{ref:x,className:["ds-side-page",b&&"ds-side-page--closing"].filter(Boolean).join(" "),"data-side":r,"data-size":o,role:"dialog","aria-modal":"true","aria-labelledby":s?m:void 0,children:[n&&e.jsx(se,{className:"ds-side-page__close",variant:"ghost",size:"small",icon:e.jsx(T.X,{size:z[2],strokeWidth:1.5}),onClick:w,"aria-label":f??h.close}),(s||a)&&e.jsxs("div",{className:"ds-side-page__header",children:[s&&e.jsx("h3",{id:m,className:"ds-side-page__title",children:s}),a&&e.jsx("div",{className:"ds-side-page__subheader",children:a})]}),e.jsx("div",{className:"ds-side-page__body ds-scrollable",children:R}),k]})});return typeof document>"u"?j:ne.createPortal(j,document.body)}function Te({children:t}){return!t||c.Children.count(t)===0?null:e.jsx("div",{className:"ds-side-page__footer",children:t})}const pe=c.createContext({collapsed:!1,side:"left"}),ye=c.createContext(!1),ts=c.forwardRef(function({children:s,collapsed:n=!1,side:a="left",onExpand:r,onCollapse:o,className:i="",...l},d){const f=["ds-nav-rail",n&&"ds-nav-rail--collapsed",`ds-nav-rail--${a}`,i].filter(Boolean).join(" "),u=c.useCallback(h=>{if(!h.target.closest('button, a, input, select, textarea, [role="button"], [tabindex]')){if(n&&r){r();return}!n&&o&&o()}},[n,r,o]);return e.jsx(pe.Provider,{value:{collapsed:n,side:a},children:e.jsx("nav",{ref:d,className:f,onClick:u,"data-expandable":n&&r?"":void 0,"data-collapsible":!n&&o?"":void 0,...l,children:s})})});function ss({icon:t,label:s,selected:n=!1,disabled:a=!1,href:r,onClick:o,count:i,updated:l=!1,open:d=!1,onboarding:f=!1,className:u="",...h}){const{collapsed:x,side:m}=c.useContext(pe),b=c.useContext(ye),E={className:["ds-nav-rail__item",u].filter(Boolean).join(" "),onClick:a?void 0:o,"aria-current":n?"page":void 0,"aria-disabled":a?"true":void 0,"aria-label":x?s:void 0,tabIndex:a?-1:void 0,...{"data-selected":n||void 0,"data-disabled":a||void 0,"data-open":d||void 0,"data-onboarding":f||void 0},...h},k=i!=null,R=m==="left"?"right":"left",j=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:t}),!x&&e.jsx("span",{className:"ds-nav-rail__label",children:s}),!x&&k&&e.jsx("span",{className:["ds-nav-rail__count",i===0&&"ds-nav-rail__count--zero"].filter(Boolean).join(" "),"data-updated":l&&i!==0||void 0,children:i}),!x&&l&&(!k||i===0)&&e.jsx("span",{className:"ds-nav-rail__dot ds-nav-rail__dot--inline","aria-hidden":"true"}),x&&k&&i!==0&&e.jsx("span",{className:"ds-nav-rail__count-collapsed","data-updated":l||void 0,children:i>99?"99+":i}),x&&l&&(!k||i===0)&&e.jsx("span",{className:"ds-nav-rail__dot","aria-hidden":"true"})]}),_=r?e.jsx("a",{href:a?void 0:r,...E,children:j}):e.jsx("button",{type:"button",...E,children:j});return x&&!b?e.jsx(we,{content:s,position:R,children:_}):_}function ns({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__body","ds-scrollable",s].filter(Boolean).join(" "),...n,children:t})}function rs({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__header",s].filter(Boolean).join(" "),...n,children:t})}function as({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__footer",s].filter(Boolean).join(" "),...n,children:t})}function os({className:t="",...s}){return e.jsx("hr",{className:["ds-nav-rail__divider",t].filter(Boolean).join(" "),...s})}function is({children:t,label:s,defaultOpen:n=!0,className:a="",...r}){const{collapsed:o}=c.useContext(pe),i=Y(),l=s??i.recents,[d,f]=c.useState(n);return e.jsxs("div",{className:["ds-nav-rail__recents",a].filter(Boolean).join(" "),...r,children:[!o&&e.jsxs("button",{type:"button",className:["ds-nav-rail__recents-toggle",!d&&"ds-nav-rail__recents-toggle--closed"].filter(Boolean).join(" "),onClick:()=>f(u=>!u),"aria-expanded":d,children:[e.jsx("span",{className:"ds-nav-rail__recents-label",children:l}),e.jsx(T.ChevronDown,{size:12,strokeWidth:2,className:"ds-nav-rail__recents-chevron","aria-hidden":"true"})]}),(d||o)&&e.jsx("div",{className:"ds-nav-rail__recents-body",children:t})]})}const ls=c.forwardRef(function({as:s="button",avatar:n,label:a,className:r="",...o},i){const{collapsed:l,side:d}=c.useContext(pe),f=c.useContext(ye),u=d==="left"?"right":"left",h=["ds-nav-rail__item","ds-nav-rail__agent",r].filter(Boolean).join(" "),x=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:n}),!l&&e.jsx("span",{className:"ds-nav-rail__label",children:a})]}),m=e.jsx(s,{ref:i,className:h,"aria-label":l?a:void 0,...s==="button"?{type:"button"}:{},...o,children:x});return l&&!f?e.jsx(we,{content:a,position:u,children:m}):m});function cs({avatar:t,label:s,selected:n=!1,disabled:a=!1,href:r,onClick:o,className:i="",...l}){const{collapsed:d,side:f}=c.useContext(pe),u=c.useContext(ye),m={className:["ds-nav-rail__item","ds-nav-rail__agent",i].filter(Boolean).join(" "),onClick:a?void 0:o,"aria-current":n?"page":void 0,"aria-disabled":a?"true":void 0,tabIndex:a?-1:void 0,...{"data-selected":n||void 0,"data-disabled":a||void 0},...l},b=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:t}),!d&&e.jsx("span",{className:"ds-nav-rail__label",children:s})]}),g=f==="left"?"right":"left",w=r?e.jsx("a",{href:a?void 0:r,...m,children:b}):e.jsx("button",{type:"button",...m,children:b});return d&&!u?e.jsx(we,{content:s,position:g,children:w}):w}const Me=240,Fe=6,ze=8;function ds({trigger:t,title:s,children:n,open:a,onOpenChange:r,defaultOpen:o=!1,closeLabel:i}){const l=Y(),{side:d}=c.useContext(pe),[f,u]=c.useState(o),h=a!==void 0,x=h?a:f,[m,b]=c.useState(!1),g=c.useRef(null),w=c.useRef(null),[E,k]=c.useState({}),R=c.useCallback(()=>{h?r==null||r(!0):u(!0)},[h,r]),j=c.useCallback(()=>{h?r==null||r(!1):u(!1)},[h,r]),_=c.useCallback(()=>x?j():R(),[x,R,j]),I=c.useCallback(()=>{var q;const P=g.current;if(!P)return;const F=P.getBoundingClientRect(),y=window.innerHeight,L=((q=w.current)==null?void 0:q.offsetHeight)??300,O=Math.max(ze,Math.min(y-L-ze,F.top));k(d==="right"?{position:"fixed",top:O,right:window.innerWidth-F.left+Fe,width:Me}:{position:"fixed",top:O,left:F.right+Fe,width:Me})},[d]);c.useEffect(()=>{if(!x){b(!1);return}return I(),requestAnimationFrame(()=>b(!0)),window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[x,I]),c.useEffect(()=>{if(!x)return;const P=y=>{var L,O;!((L=w.current)!=null&&L.contains(y.target))&&!((O=g.current)!=null&&O.contains(y.target))&&j()},F=y=>{y.key==="Escape"&&j()};return document.addEventListener("mousedown",P),document.addEventListener("keydown",F),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",F)}},[x,j]);const D=x&&e.jsxs("div",{ref:w,className:["ds-nav-rail-flyout",`ds-nav-rail-flyout--${d}`,m&&"ds-nav-rail-flyout--visible"].filter(Boolean).join(" "),style:E,"data-ds-portal":"",role:"dialog","aria-modal":"false",children:[s!=null&&e.jsxs("div",{className:"ds-nav-rail-flyout__header",children:[e.jsx("span",{className:"ds-nav-rail-flyout__title",children:s}),e.jsx("button",{type:"button",className:"ds-nav-rail-flyout__close",onClick:j,"aria-label":i??l.close,children:e.jsx(T.X,{size:16,strokeWidth:2})})]}),e.jsx("div",{className:"ds-nav-rail-flyout__body",children:n})]});return e.jsxs(e.Fragment,{children:[e.jsx(ye.Provider,{value:x,children:e.jsx("div",{ref:g,onClick:_,style:{display:"flex",flexDirection:"column",width:"100%"},children:t})}),typeof document<"u"&&ne.createPortal(D,document.body)]})}const us={info:T.Info,success:T.CheckCircle,warning:T.AlertTriangle,error:T.XCircle};function fs({children:t,variant:s="info",action:n,onAction:a,onDismiss:r,role:o,dismissLabel:i,...l}){const d=Y(),f=us[s],u=o||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${s}`,role:u,...l,children:[f&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(f,{size:z[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:t}),n&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:a,children:n}),r&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:r,"aria-label":i??d.dismiss,children:e.jsx(T.X,{size:z[2],strokeWidth:1.5})})]})}function ms({trigger:t,items:s=[],open:n,onOpenChange:a,align:r="left",fullWidth:o=!1,className:i="",style:l,...d}){const[f,u]=c.useState(!1),[h,x]=c.useState(!1),m=n!==void 0,b=m?n:f,g=c.useRef(null),w=c.useRef(null),E=c.useRef(null),k=c.useRef(null),[R,j]=c.useState({}),_=c.useRef(null),I=150,D=()=>{if(m)a==null||a(!1);else{if(h)return;x(!0),_.current=setTimeout(()=>{u(!1),x(!1)},I)}},P=()=>{const N=!b;m?a==null||a(N):N?(clearTimeout(_.current),x(!1),u(!0)):D()},F=()=>{b||(m?a==null||a(!0):(clearTimeout(_.current),x(!1),u(!0)))};c.useEffect(()=>()=>clearTimeout(_.current),[]),c.useEffect(()=>{if(!b)return;const N=300,B=()=>{var W;const $=(W=g.current)==null?void 0:W.getBoundingClientRect();if(!$)return;const X=window.innerHeight-$.bottom,U=X<N+8&&$.top>X;j(r==="right"?U?{bottom:window.innerHeight-$.top+4,top:"auto",right:window.innerWidth-$.right}:{top:$.bottom+4,bottom:"auto",right:window.innerWidth-$.right}:U?{bottom:window.innerHeight-$.top+4,top:"auto",left:$.left}:{top:$.bottom+4,bottom:"auto",left:$.left})};return B(),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B)}},[b,r]);const y=()=>{var B;const N=(B=E.current)==null?void 0:B.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');N==null||N.focus()};c.useEffect(()=>{if(!b)return;const N=$=>{var X,U;!((X=g.current)!=null&&X.contains($.target))&&!((U=w.current)!=null&&U.contains($.target))&&D()},B=$=>{$.key==="Escape"&&(D(),y())};return document.addEventListener("mousedown",N),document.addEventListener("keydown",B),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",B)}},[b]),c.useEffect(()=>{if(!b||!k.current||!w.current)return;const N=L(),B=k.current==="last"?N[N.length-1]:N[0];B==null||B.focus(),k.current=null},[b]);const L=()=>w.current?[...w.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],O=N=>{var B,$;if(N.key==="ArrowDown")N.preventDefault(),b?(B=L()[0])==null||B.focus():(k.current="first",F());else if(N.key==="ArrowUp")if(N.preventDefault(),!b)k.current="last",F();else{const X=L();($=X[X.length-1])==null||$.focus()}},q=N=>{var X,U,W,p;const B=L(),$=B.findIndex(v=>v===document.activeElement);switch(N.key){case"ArrowDown":N.preventDefault(),(X=B[Math.min($+1,B.length-1)])==null||X.focus();break;case"ArrowUp":N.preventDefault(),$<=0?y():(U=B[$-1])==null||U.focus();break;case"Home":N.preventDefault(),(W=B[0])==null||W.focus();break;case"End":N.preventDefault(),(p=B[B.length-1])==null||p.focus();break;case"Tab":D();break}},V=b&&e.jsx("div",{ref:w,role:"menu","data-ds-portal":"",className:["ds-dropdown__menu",`ds-dropdown__menu--${r}`,h&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:R,onKeyDown:q,children:s.map((N,B)=>{if(N.separator)return e.jsx("div",{className:"ds-dropdown__separator"},B);if(N.type==="section")return e.jsxs("div",{className:"ds-dropdown__section",children:[N.label&&e.jsx("div",{className:"ds-dropdown__section-label",children:N.label}),e.jsx("div",{className:"ds-dropdown__section-content",children:N.content})]},B);const $=!!N.href,X=$?"a":"button",U=$?{href:N.disabled?void 0:N.href,"aria-disabled":N.disabled?"true":void 0}:{type:"button",disabled:N.disabled};return e.jsxs(X,{role:"menuitem",className:["ds-dropdown__item",N.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...U,onClick:()=>{var W;(W=N.onClick)==null||W.call(N),D()},children:[N.icon&&e.jsx("span",{className:"ds-dropdown__item-icon",children:N.icon}),e.jsx("span",{className:"ds-dropdown__item-label",children:N.label}),N.shortcut&&e.jsx("span",{className:"ds-dropdown__item-shortcut",children:N.shortcut})]},B)})});return e.jsxs("div",{ref:g,className:["ds-dropdown",o&&"ds-dropdown--full-width",i].filter(Boolean).join(" "),style:l,...d,children:[e.jsx("div",{ref:E,className:"ds-dropdown__trigger",onClick:P,onKeyDown:O,children:t}),typeof document<"u"&&ne.createPortal(V,document.body)]})}function ps({value:t=0,size:s="m",variant:n="default",showValue:a=!1,min:r=2,animate:o=!0}){const i=Math.min(100,Math.max(0,t)),l=Math.max(r,i),d=n==="auto"?i>=70?"success":i>=50?"warning":"danger":n;return e.jsxs("div",{className:["ds-progress",`ds-progress--${s}`,!o&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("div",{className:"ds-progress__track",children:e.jsx("div",{className:`ds-progress__fill ds-progress__fill--${d}`,style:{width:`${l}%`}})}),a&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const hs=t=>1-Math.pow(1-t,3),xs=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Ke(t,{duration:s=600}={}){const[n,a]=c.useState(t),r=c.useRef(t),o=c.useRef(null);return c.useEffect(()=>{if(xs()){a(t),r.current=t;return}const i=r.current,l=t-i;if(l===0)return;let d=null;const f=u=>{d||(d=u);const h=Math.min((u-d)/s,1);a(i+l*hs(h)),h<1?o.current=requestAnimationFrame(f):r.current=t};return o.current=requestAnimationFrame(f),()=>cancelAnimationFrame(o.current)},[t,s]),n}function vs({value:t,duration:s=600,decimals:n=0,prefix:a="",suffix:r=""}){const i=Ke(t,{duration:s}).toFixed(n);return`${a}${i}${r}`}function Je({threshold:t=.1,rootMargin:s="0px",once:n=!1}={}){const a=c.useRef(null),[r,o]=c.useState(!1);return c.useEffect(()=>{const i=a.current;if(!i)return;const l=new IntersectionObserver(([d])=>{d.isIntersecting?(o(!0),n&&l.disconnect()):n||o(!1)},{threshold:t,rootMargin:s});return l.observe(i),()=>l.disconnect()},[t,s,n]),{ref:a,inView:r}}function bs({children:t,as:s="div",once:n=!1,threshold:a=.1,rootMargin:r="0px",onEnter:o,onLeave:i,...l}){const{ref:d,inView:f}=Je({threshold:a,rootMargin:r,once:n}),u=c.useRef(!1);return c.useEffect(()=>{f&&!u.current&&(o==null||o()),!f&&u.current&&(i==null||i()),u.current=f},[f]),e.jsx(s,{ref:d,...l,children:typeof t=="function"?t(f):t})}const We={default:T.Info,success:T.CheckCircle,warning:T.AlertTriangle,error:T.XCircle};let fe=[];const $e=new Set;function Ze(){$e.forEach(t=>t([...fe]))}function _s(t){fe=[...fe,t],Ze()}function js(t){fe=fe.filter(s=>s.id!==t),Ze()}function gs(){const t=(s,n={})=>{_s({id:`${Date.now()}-${Math.random()}`,message:s,type:"default",duration:4e3,...n})};return t.success=(s,n)=>t(s,{...n,type:"success"}),t.error=(s,n)=>t(s,{...n,type:"error"}),t.warning=(s,n)=>t(s,{...n,type:"warning"}),{toast:t}}function Ns({data:t,onDismiss:s}){const n=Y(),[a,r]=c.useState(!1),o=c.useRef(null);c.useEffect(()=>(requestAnimationFrame(()=>r(!0)),t.duration>0&&(o.current=setTimeout(()=>i(),t.duration)),()=>clearTimeout(o.current)),[]);function i(){r(!1),setTimeout(()=>s(t.id),250)}const l=We[t.type]??We.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${t.type}`,a&&"ds-toast--visible"].filter(Boolean).join(" "),role:t.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(l,{size:z[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:t.message}),e.jsx("button",{className:"ds-toast__close",onClick:i,"aria-label":n.close,children:e.jsx(T.X,{size:z[3],strokeWidth:1.5})})]})}function ws({position:t="bottom-right"}){const[s,n]=c.useState(()=>[...fe]);return c.useEffect(()=>($e.add(n),()=>$e.delete(n)),[]),!s.length||typeof document>"u"?null:ne.createPortal(e.jsx("div",{"data-ds-portal":"",className:["ds-toast-container",`ds-toast-container--${t}`].join(" "),children:s.map(a=>e.jsx(Ns,{data:a,onDismiss:js},a.id))}),document.body)}const ys={running:e.jsx(ce,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(ce,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ce,{size:"xs",variant:"error",children:"Error"})};function Qe({label:t,status:s="idle",icon:n,badge:a,defaultExpanded:r=!1,expanded:o,onToggle:i,children:l,className:d="",...f}){const u=s==="running",h=e.jsxs("span",{className:"ds-tool-card__title-row",children:[n&&e.jsx("span",{className:"ds-tool-card__icon",children:n}),e.jsx("span",{className:"ds-tool-card__label",children:t}),ys[s],a]});return l?e.jsx("div",{className:["ds-tool-card",u&&"ds-tool-card--running",d].filter(Boolean).join(" "),...f,children:e.jsx(Ne,{title:h,padding:"s",defaultExpanded:r,expanded:u?!1:o,onToggle:u?void 0:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})}):e.jsx("div",{className:["ds-tool-card","ds-tool-card--bubble",d].filter(Boolean).join(" "),...f,children:h})}function et({text:t,size:s="xs",timeout:n=800,"aria-label":a,...r}){const o=Y(),[i,l]=c.useState(!1),d=f=>{f.currentTarget.blur(),navigator.clipboard.writeText(t).then(()=>{l(!0),setTimeout(()=>l(!1),n)})};return e.jsx(se,{variant:"ghost",size:s,state:i?"success":"idle",icon:e.jsx(T.Copy,{size:z[1],strokeWidth:1.5}),"aria-label":a??o.copyToClipboard,onClick:d,...r})}function ks({content:t,streaming:s=!1,...n}){const[a,r]=c.useState(s);return c.useEffect(()=>{r(!!s)},[s]),e.jsx(Ne,{expanded:a,onToggle:r,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(T.Brain,{size:z[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Ye,{secondary:!0,children:"Thinking"})]}),...n,children:e.jsxs(Be,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[t,s&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Es({count:t,current:s=0,done:n=[],onChange:a,showCounter:r=!0,className:o="","aria-label":i,...l}){const d=Y(),{t:f}=me();return e.jsxs("div",{className:["ds-step-indicator",o].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i??d.steps,children:Array.from({length:t},(u,h)=>{const x=h===s,m=n.includes(h)&&!x,b=a&&(h<=s||n.includes(h)),g=["ds-step-indicator__dot",x&&"ds-step-indicator__dot--active",m&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:g,role:"tab","aria-selected":x,"aria-label":f("stepN",{n:h+1}),disabled:!b||h===s,onClick:()=>a==null?void 0:a(h),children:m?e.jsx(T.Check,{size:8,strokeWidth:3}):null},h)})}),r&&e.jsxs(Be,{secondary:!0,className:"ds-step-indicator__counter",children:[s+1," / ",t]})]})}function Rs({content:t,isStreaming:s=!1,cursor:n="line",onChunk:a,className:r="",...o}){const i=c.useRef(t);return c.useEffect(()=>{t!==i.current&&(a==null||a(t),i.current=t)},[t,a]),e.jsxs("span",{className:["ds-streaming-text",r].filter(Boolean).join(" "),...o,children:[t,s&&n!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${n}`,"aria-hidden":"true"})]})}function Ss({role:t="assistant",header:s,footer:n,attachments:a,isStreaming:r=!1,children:o,className:i="",...l}){const d=["ds-chat-message",`ds-chat-message--${t}`,r&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return t==="system"?e.jsx("div",{className:d,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:o})}):t==="user"?e.jsxs("div",{className:d,...l,children:[a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__bubble",children:o}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]}):e.jsxs("div",{className:d,...l,children:[s&&e.jsx("div",{className:"ds-chat-message__header",children:s}),a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__body",children:o}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]})}function Ts(t,{containerRef:s,smartPause:n=!0}={}){const a=c.useRef(!1),r=c.useRef(0);c.useEffect(()=>{const o=s==null?void 0:s.current;if(!o)return;const i=()=>{const l=o.scrollHeight-o.scrollTop-o.clientHeight<64;!l&&o.scrollTop<r.current&&(a.current=!0),l&&(a.current=!1),r.current=o.scrollTop};return o.addEventListener("scroll",i,{passive:!0}),()=>o.removeEventListener("scroll",i)},[s]),c.useEffect(()=>{const o=s==null?void 0:s.current;o&&(n&&a.current||(o.scrollTop=o.scrollHeight))},t)}function tt({prompts:t,enabled:s,typingSpeed:n=38,erasingSpeed:a=18,holdTime:r=2200,betweenTime:o=380,manualPauseMs:i=5e3}){const[l,d]=c.useState(0),[f,u]=c.useState(""),h=c.useRef("typing"),x=c.useRef(0),m=c.useRef(0),b=c.useRef(null),g=c.useRef(0);c.useEffect(()=>{m.current=l},[l]),c.useEffect(()=>{if(b.current&&(clearTimeout(b.current),b.current=null),!s||t.length===0){u(""),x.current=0,h.current="typing";return}const j=()=>{const _=Date.now();if(g.current>_){b.current=setTimeout(j,g.current-_);return}const I=t[m.current%t.length]??"";h.current==="typing"?(x.current+=1,u(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",b.current=setTimeout(j,r)):b.current=setTimeout(j,n+Math.random()*28)):h.current==="holding"?(h.current="erasing",b.current=setTimeout(j,a)):(x.current=Math.max(0,x.current-1),u(I.slice(0,x.current)),x.current<=0?(h.current="typing",m.current=(m.current+1)%t.length,d(m.current),b.current=setTimeout(j,o)):b.current=setTimeout(j,a))};return b.current=setTimeout(j,260),()=>{b.current&&clearTimeout(b.current)}},[s,t,n,a,r,o]);const w=j=>{if(t.length===0)return;const _=(j%t.length+t.length)%t.length,I=t[_];m.current=_,x.current=I.length,h.current="holding",g.current=Date.now()+i,d(_),u(I)},E=()=>w(m.current+1),k=()=>w(m.current-1),R=t[l%t.length]??"";return{displayed:f,currentPrompt:R,index:l,next:E,prev:k}}let $s=0;function As({value:t="",onChange:s,onSubmit:n,onStop:a,onKeyDown:r,loading:o=!1,disabled:i=!1,placeholder:l,animatedPlaceholders:d,attachments:f,images:u,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:m,onRemoveImage:b,acceptImage:g,acceptFile:w,maxImages:E,maxImageSize:k,leftSlot:R,rightSlot:j,className:_="",...I}){const D=Y(),{t:P}=me(),F=c.useRef(null),y=c.useRef(null),L=c.useRef(0),[O,q]=c.useState(!1),[V,N]=c.useState([]),B=l??D.promptPlaceholder,$=S=>{const C=++$s;N(G=>[...G,{id:C,msg:S}]),setTimeout(()=>N(G=>G.filter(J=>J.id!==C)),6e3)},X=S=>N(C=>C.filter(G=>G.id!==S)),U=S=>S.type.startsWith("image/"),W=()=>!0,p=g??U,v=w??W,A=S=>{const C=[],G=[],J=[],Q=[];let ee=0,le=E!=null?E-((u==null?void 0:u.length)??0):1/0;for(const te of S)p(te)?k&&te.size>k?J.push(te.name):le>0?(C.push(te),le--):ee++:v(te)?G.push(te):Q.push(te.name);return{imageFiles:C,docFiles:G,tooLarge:J,skipped:Q,limitExceeded:ee}},M=S=>{const C=k?P("fileTooLargeMaxHint",{maxMb:k/1024/1024}):"";$(P("fileTooLarge",{maxHint:C,names:S.join(", ")}))},Z=S=>{const{imageFiles:C,docFiles:G,tooLarge:J,skipped:Q,limitExceeded:ee}=A(S);J.length&&M(J),Q.length&&$(P("filesSkipped",{names:Q.join(", ")})),ee&&$(P("maxImages",{n:E})),x&&C.length&&x(C);const le=G.concat(x?[]:C);h&&le.length&&h(le)};c.useEffect(()=>{const S=y.current;S&&(S.style.height="auto",S.style.height=`${Math.min(S.scrollHeight,200)}px`)},[t]),c.useEffect(()=>{const S=C=>{var J,Q,ee;if(o||i)return;const G=(J=C.target)==null?void 0:J.tagName;G==="INPUT"||G==="TEXTAREA"||G==="SELECT"||(Q=C.target)!=null&&Q.isContentEditable||C.ctrlKey||C.metaKey||C.altKey||C.key.length!==1&&C.key!=="Backspace"&&C.key!=="Delete"||(ee=y.current)==null||ee.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[o,i]);const re=S=>{S.preventDefault(),L.current++,S.dataTransfer.types.includes("Files")&&q(!0)},H=S=>{S.preventDefault(),L.current--,L.current===0&&q(!1)},K=S=>S.preventDefault(),ie=S=>{S.preventDefault(),L.current=0,q(!1);const C=Array.from(S.dataTransfer.files);C.length&&Z(C)},he=S=>{const C=Array.from(S.target.files||[]);F.current&&(F.current.value=""),C.length&&Z(C)},ke=S=>{var te;if(!x)return;const C=(te=S.clipboardData)==null?void 0:te.items;if(!C)return;const G=[];for(const at of C){const Pe=at.getAsFile();Pe&&G.push(Pe)}if(G.length===0)return;const{imageFiles:J,tooLarge:Q,skipped:ee,limitExceeded:le}=A(G);Q.length&&M(Q),ee.length&&$(P("filesSkipped",{names:ee.join(", ")})),le&&$(P("maxImages",{n:E})),J.length&&(S.preventDefault(),x(J))},xe=!o&&!i&&!!(d!=null&&d.length)&&t.length===0,je=tt({prompts:d??[],enabled:xe}),nt=S=>{if(xe){if(S.key==="ArrowDown"||S.key==="ArrowRight"){S.preventDefault(),je.next();return}if(S.key==="ArrowUp"||S.key==="ArrowLeft"){S.preventDefault(),je.prev();return}if(S.key==="Tab"&&!S.shiftKey){S.preventDefault(),s==null||s(je.currentPrompt);return}}r==null||r(S)},rt=(t.trim()||(u==null?void 0:u.length)>0||(f==null?void 0:f.length)>0)&&!i,De=h||x;return e.jsxs("div",{className:["ds-prompt-input",_].filter(Boolean).join(" "),...I,children:[De&&e.jsx("input",{ref:F,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:he}),e.jsxs("div",{className:["ds-prompt-input__box",O&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:re,onDragLeave:H,onDragOver:K,onDrop:ie,children:[O&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:D.dropFilesHere}),e.jsx("textarea",{ref:y,value:t,onChange:S=>s==null?void 0:s(S.target.value),onKeyDown:nt,onPaste:ke,placeholder:xe?"":B,disabled:o||i,rows:1,className:["ds-prompt-input__textarea",xe&&"ds-prompt-input__textarea--anim"].filter(Boolean).join(" ")}),xe&&e.jsxs("div",{className:"ds-prompt-input__anim","aria-hidden":"true",children:[e.jsx("span",{className:"ds-prompt-input__anim-text",children:je.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),u&&u.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:u.map((S,C)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:S.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>b==null?void 0:b(C),"aria-label":D.removeImage,type:"button",children:e.jsx(T.X,{size:12,strokeWidth:2})})]},C))}),V.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:V.map(S=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:S.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>X(S.id),"aria-label":D.dismiss,children:e.jsx(T.X,{size:z[1],strokeWidth:1.5})})]},S.id))}),f&&f.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:f.map((S,C)=>e.jsx(ce,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[S.uploading?e.jsx(T.Loader,{size:z[1],strokeWidth:1.5,className:"spin"}):e.jsx(T.Paperclip,{size:z[1],strokeWidth:1.5}),S.filename,S.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:D.uploading}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>m==null?void 0:m(C),"aria-label":D.removeAttachment,children:e.jsx(T.X,{size:z[1],strokeWidth:1.5})})]})},C))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[De&&e.jsx(se,{variant:"ghost",size:"xs",icon:e.jsx(T.Paperclip,{size:z[2],strokeWidth:1.5}),"aria-label":D.attachFiles,onClick:()=>{var S;return(S=F.current)==null?void 0:S.click()}}),R,j,e.jsx("div",{className:"ds-prompt-input__spacer"}),o?e.jsx(se,{variant:"primary",size:"xs",icon:e.jsx(T.Square,{size:z[2],strokeWidth:1.5}),onClick:a,"aria-label":D.stop}):e.jsx(se,{variant:"primary",size:"xs",icon:e.jsx(T.ArrowUp,{size:z[2],strokeWidth:1.5}),onClick:n,disabled:!rt,"aria-label":D.send})]})]})]})}const Oe={fast:0,standard:1,premium:2},Ue={fast:"data-5",standard:"data-3",premium:"data-6"};function Is({models:t=[],value:s,onChange:n,size:a="xs",minTier:r,showAutoOption:o=!1,groupByTier:i=!0,className:l="",...d}){const[f,u]=c.useState(!1),h=c.useRef(null),x=c.useRef(null),m=c.useRef(null),[b,g]=c.useState({}),w=t.filter(y=>!r||y.name==="auto"?!0:(Oe[y.tier]??1)>=(Oe[r]??1)),E=w.find(y=>y.name==="auto"),k=w.filter(y=>y.name!=="auto"),R=t.find(y=>y.name===s),_=new Set(k.map(y=>y.tier).filter(Boolean)).size>1;c.useEffect(()=>{if(!f)return;const y=320,L=()=>{var $;const V=($=x.current)==null?void 0:$.getBoundingClientRect();if(!V)return;const N=window.innerHeight-V.bottom,B=N<y+8&&V.top>N;g({position:"fixed",zIndex:"var(--z-dropdown, 500)",left:V.left,...B?{bottom:window.innerHeight-V.top+4,top:"auto"}:{top:V.bottom+4,bottom:"auto"}})};L(),window.addEventListener("scroll",L,!0),window.addEventListener("resize",L);const O=V=>{var N,B;!((N=h.current)!=null&&N.contains(V.target))&&!((B=m.current)!=null&&B.contains(V.target))&&u(!1)},q=V=>{V.key==="Escape"&&u(!1)};return document.addEventListener("mousedown",O),document.addEventListener("keydown",q),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L),document.removeEventListener("mousedown",O),document.removeEventListener("keydown",q)}},[f]);const I=y=>{n==null||n(y),u(!1)},D=y=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",y.name===s&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I(y.name),children:[y.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:y.icon}):e.jsx(T.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:y.displayName||y.name}),_&&y.tier&&e.jsx(ce,{size:"xs",variant:Ue[y.tier]||"default",children:y.tier})]},y.name),P=()=>!i||!_?k.map(D):["fast","standard","premium"].flatMap(y=>{const L=k.filter(O=>O.tier===y);return L.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":y,children:y.charAt(0).toUpperCase()+y.slice(1)},`lbl-${y}`),...L.map(D)]:[]}),F=f&&e.jsxs("div",{ref:m,className:"ds-model-picker__menu ds-scrollable","data-ds-portal":"",style:b,children:[o&&E&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",s==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(T.Zap,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:"Auto (smart routing)"})]}),k.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),P()]});return e.jsxs("div",{ref:h,className:["ds-model-picker",l].filter(Boolean).join(" "),...d,children:[e.jsxs("button",{ref:x,type:"button",className:"ds-model-picker__trigger",onClick:()=>u(y=>!y),"aria-haspopup":"listbox","aria-expanded":f,children:[R!=null&&R.icon?e.jsx("span",{children:R.icon}):e.jsx(T.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(R==null?void 0:R.displayName)||(R==null?void 0:R.name)||s}),_&&(R==null?void 0:R.tier)&&e.jsx(ce,{size:"xs",variant:Ue[R.tier]||"default",children:R.tier})]}),typeof document<"u"&&ne.createPortal(F,document.body)]})}const Bs=({filename:t,pagesLabel:s})=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:t}),s&&e.jsx("span",{className:"ds-sources-panel__pages",children:s})]});function Ds(t){const s=new Map;for(const n of t)s.has(n.filename)||s.set(n.filename,{filename:n.filename,url:n.url,items:[]}),s.get(n.filename).items.push(n);return[...s.values()]}function Ps({sources:t=[],layout:s="list",title:n,maxVisible:a=5,onSourceClick:r}){const o=Y(),{t:i}=me(),l=n??o.sources,[d,f]=c.useState(!1),u=Ds(t),h=u.length>a,x=d?u:u.slice(0,a),m=t.some(E=>E.snippet),b=E=>E!=null&&E.length?i("pageAbbrev",{pages:E.join(", ")}):null,g=i("moreSources",{n:u.length-a}),w=["ds-sources-panel",s==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return s==="compact"?e.jsxs("div",{className:w,children:[x.map(E=>{const k=E.items.map(_=>_.page).filter(Boolean),R=b(k),j=!!r;return e.jsxs("div",{className:`ds-sources-panel__compact-row${j?" ds-sources-panel__compact-row--clickable":""}`,onClick:j?()=>r(E.items[0]):void 0,children:[e.jsx(T.FileText,{size:z[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:E.filename}),R&&e.jsx("span",{className:"ds-sources-panel__pages",children:R})]},E.filename)}),h&&!d&&e.jsx("button",{className:"ds-sources-panel__more",onClick:()=>f(!0),children:g})]}):e.jsxs("div",{className:w,children:[l&&e.jsx("div",{className:"ds-sources-panel__title",children:l}),x.map(E=>{const k=E.items.map(_=>_.page).filter(Boolean),R=b(k),j=!!r;return m?e.jsx(Ne,{title:e.jsx(Bs,{filename:E.filename,pagesLabel:R}),padding:"s",children:E.items.map((_,I)=>e.jsx("div",{className:`ds-sources-panel__snippet${j?" ds-sources-panel__snippet--clickable":""}`,onClick:j?()=>r(_):void 0,children:_.snippet??i("pageAbbrev",{pages:_.page})},I))},E.filename):e.jsxs("div",{className:`ds-sources-panel__row${j?" ds-sources-panel__row--clickable":""}`,onClick:j?()=>r(E.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:E.filename}),R&&e.jsx("span",{className:"ds-sources-panel__pages",children:R})]},E.filename)}),h&&!d&&e.jsx("button",{className:"ds-sources-panel__more",onClick:()=>f(!0),children:g})]})}function He(t){return t>=1e6?(t/1e6).toFixed(1).replace(/\.0$/,"")+"M":t>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(t)}function Ls({used:t,limit:s,size:n="s",showCount:a=!0,showPercent:r=!1,warningThreshold:o=.8,errorThreshold:i=1}){const l=s>0?t/s:0,d=Math.min(l*100,100),f=l>=i?"error":l>=o?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${n}`,role:"meter","aria-valuenow":t,"aria-valuemax":s,children:[e.jsx("div",{className:"ds-token-counter__track",children:e.jsx("div",{className:`ds-token-counter__fill ds-token-counter__fill--${f}`,style:{width:`${d}%`}})}),(a||r)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${f}`,children:[a&&e.jsxs("span",{children:[He(t)," / ",He(s)]}),r&&e.jsxs("span",{style:{marginLeft:"auto"},children:[Math.round(l*100),"%"]})]})]})}const Ve=5;function Cs(t){return t<.34?"low":t<.67?"medium":"high"}function Ms({value:t=0,size:s="xs",showLabel:n="none",layout:a="inline"}){const r=Math.max(0,Math.min(1,t)),o=Math.round(r*Ve),i=Cs(r);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${s}`,`ds-confidence-bar--${i}`,a==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:Ve},(l,d)=>e.jsx("div",{className:`ds-confidence-bar__seg${d<o?" ds-confidence-bar__seg--filled":""}`},d))}),n==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const Fs={add:"+",remove:"-",context:" "};function Ee({line:t,lineNumbers:s}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${t.type}`,children:[s&&t.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:t.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:Fs[t.type]}),e.jsx("span",{className:"ds-diff-view__text",children:t.text})]})}function zs({lines:t=[],layout:s="inline",wordWrap:n=!1,lineNumbers:a=!0,maxHeight:r,title:o}){const i=["ds-diff-view",`ds-diff-view--${s}`,n&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=r?{maxHeight:r,overflowY:"auto"}:void 0;if(s==="split"){const d=t.filter(u=>u.type==="remove"||u.type==="context"),f=t.filter(u=>u.type==="add"||u.type==="context");return e.jsxs("div",{className:i,children:[o&&e.jsx("div",{className:"ds-diff-view__title",children:o}),e.jsxs("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:d.map((u,h)=>e.jsx(Ee,{line:u,lineNumbers:a},h))}),e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:f.map((u,h)=>e.jsx(Ee,{line:u,lineNumbers:a},h))})]})]})}return e.jsxs("div",{className:i,children:[o&&e.jsx("div",{className:"ds-diff-view__title",children:o}),e.jsx("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:t.map((d,f)=>e.jsx(Ee,{line:d,lineNumbers:a},f))})]})}function st({value:t="idle",onLike:s,onDislike:n,className:a="",likeLabel:r,dislikeLabel:o,...i}){const l=Y(),d=t!=="idle";return e.jsxs("div",{className:["ds-message-feedback",d&&"ds-message-feedback--voted",a].filter(Boolean).join(" "),...i,children:[(!d||t==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",t==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:s,disabled:d,"aria-label":r??l.like,"aria-pressed":t==="liked",children:e.jsx(T.ThumbsUp,{size:z[1],strokeWidth:1.5,fill:t==="liked"?"currentColor":"none"})}),(!d||t==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",t==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:n,disabled:d,"aria-label":o??l.dislike,"aria-pressed":t==="disliked",children:e.jsx(T.ThumbsDown,{size:z[1],strokeWidth:1.5,fill:t==="disliked"?"currentColor":"none"})})]})}function Ws(t){const s=t instanceof Date?t:new Date(t);if(isNaN(s))return null;const n=new Date,a=s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),o=new Date(r-864e5);if(s>=r)return a;if(s>=o)return`Yesterday ${a}`;const i=s.getDate(),l=s.toLocaleString([],{month:"short"});return`${i} ${l} ${a}`}function Os({role:t="assistant",text:s,timestamp:n,feedbackValue:a="idle",onLike:r,onDislike:o,className:i="",...l}){const d=t==="assistant"&&(r||o),f=!!s,u=n?Ws(n):null;return!d&&!f&&!u?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${t}`,i].filter(Boolean).join(" "),...l,children:[t==="user"&&u&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:u}),d&&e.jsx(st,{className:"ds-message-action",value:a,onLike:r,onDislike:o}),f&&e.jsx(et,{className:"ds-message-action",text:s}),t==="assistant"&&u&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:u})]})}function Us({label:t,className:s="",...n}){return e.jsxs("span",{className:["ds-thinking-dot",s].filter(Boolean).join(" "),...n,children:[e.jsx("span",{className:"ds-thinking-dot__pulse"}),t&&e.jsx("span",{className:"ds-thinking-dot__label",children:t})]})}function Hs({variant:t="light",glow:s,mask:n=!0,style:a,...r}){const o=t==="dark",i=s??o,l=o?"rgba(255,250,250,0.05)":"var(--color-border-light)",d=o?"rgba(255,250,250,0.025)":"color-mix(in srgb, var(--color-border-light) 50%, transparent)";return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden",zIndex:0,...i&&{background:"radial-gradient(ellipse 1000px 500px at 50% 30%, rgba(234,100,100,0.18), transparent 70%)"},...a},...r,children:e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:[`linear-gradient(${l} 1px, transparent 1px)`,`linear-gradient(90deg, ${l} 1px, transparent 1px)`,`linear-gradient(${d} 1px, transparent 1px)`,`linear-gradient(90deg, ${d} 1px, transparent 1px)`].join(", "),backgroundSize:"80px 80px, 80px 80px, 16px 16px, 16px 16px",backgroundPosition:"-1px -1px, -1px -1px, -1px -1px, -1px -1px",...n&&{WebkitMaskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)",maskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)"}}})})}function Vs({children:t,axis:s="y",style:n,className:a="",...r}){const o=s==="x"?{overflowX:"auto",overflowY:"hidden"}:s==="both"?{overflow:"auto"}:{overflowY:"auto",overflowX:"hidden"};return e.jsx("div",{className:`ds-scrollable ${a}`,style:{...o,...n},...r,children:t})}const Re=280,Xs=22,Ys=14,oe=8,ge=6,qs=200;function Gs(t){return t?typeof t=="function"?t():typeof t=="string"?document.querySelector(t):null:null}function Ks(t,s,n,a){const r=window.innerWidth,o=window.innerHeight;if(o-t.bottom>=s+a+oe)return"bottom";if(t.top>=s+a+oe)return"top";if(r-t.right>=n+a+oe)return"right";if(t.left>=n+a+oe)return"left";const i=Math.max(t.top,o-t.bottom,r-t.right,t.left);return i===o-t.bottom?"bottom":i===t.top?"top":i===r-t.right?"right":"left"}function Js(t,s,n,a,r){const o=window.innerWidth,i=window.innerHeight;let l,d;switch(t){case"top":l=s.top-n-r,d=s.left+s.width/2-a/2;break;case"bottom":l=s.bottom+r,d=s.left+s.width/2-a/2;break;case"left":l=s.top+s.height/2-n/2,d=s.left-a-r;break;default:l=s.top+s.height/2-n/2,d=s.right+r}const f=Math.max(oe,Math.min(o-a-oe,d)),u=Math.max(oe,Math.min(i-n-oe,l));return{top:u,left:f,arrowOffset:d-f,arrowOffsetY:l-u}}function Zs({steps:t,currentStep:s,onNext:n,onBack:a,onSkip:r,onFinish:o,overlay:i=!0,ring:l=!0,labelNext:d,labelBack:f,labelSkip:u,labelFinish:h,statePrimary:x="idle",stateBack:m="idle"}){const b=Y(),{t:g}=me(),w=d??b.next,E=f??b.back,k=u??b.skipTour,R=h??b.done,j=c.useRef(null),_=c.useRef(t),I=c.useRef(s),D=c.useRef(l);_.current=t,I.current=s,D.current=l;const[P,F]=c.useState(!1),[y,L]=c.useState({position:"fixed",visibility:"hidden",width:Re}),[O,q]=c.useState("bottom"),[V,N]=c.useState(null),B=c.useRef(!1),$=t[s],X=s===t.length-1,U=c.useCallback(()=>{const W=_.current[I.current];if(!W||!j.current)return;const p=Gs(W.target);if(!p)return;const v=p.getBoundingClientRect(),M=j.current.getBoundingClientRect().height||160,Z=Re,re=D.current?Xs:Ys,H=W.position||Ks(v,M,Z,re),{top:K,left:ie,arrowOffset:he,arrowOffsetY:ke}=Js(H,v,M,Z,re);q(H),L({position:"fixed",top:K,left:ie,width:Re,visibility:"visible","--arrow-offset":`${he}px`,"--arrow-offset-y":`${ke}px`}),N({top:v.top-ge,left:v.left-ge,width:v.width+ge*2,height:v.height+ge*2})},[]);return c.useEffect(()=>{window.addEventListener("scroll",U,!0),window.addEventListener("resize",U);const W=requestAnimationFrame(()=>{U(),F(!0),B.current=!0});return()=>{cancelAnimationFrame(W),window.removeEventListener("scroll",U,!0),window.removeEventListener("resize",U)}},[]),c.useEffect(()=>{if(!B.current)return;F(!1);const W=setTimeout(()=>{L(p=>({...p,visibility:"hidden"})),requestAnimationFrame(()=>{U(),F(!0)})},qs+20);return()=>clearTimeout(W)},[s]),c.useEffect(()=>{P&&j.current&&j.current.focus({preventScroll:!0})},[P]),c.useEffect(()=>{const W=p=>{p.key==="Escape"&&r()};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[r]),c.useEffect(()=>{if(!P)return;const W=p=>{if(p.key!=="Tab"||!j.current)return;const v=Array.from(j.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'));if(!v.length)return;const A=v[0],M=v[v.length-1];p.shiftKey&&document.activeElement===A?(p.preventDefault(),M.focus()):!p.shiftKey&&document.activeElement===M&&(p.preventDefault(),A.focus())};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[P]),!$||typeof document>"u"?null:ne.createPortal(e.jsxs(e.Fragment,{children:[V&&e.jsx("div",{className:["ds-coachmark__spotlight",i&&"ds-coachmark__spotlight--overlay",!l&&"ds-coachmark__spotlight--no-ring",P&&"ds-coachmark__spotlight--visible"].filter(Boolean).join(" "),style:V,"aria-hidden":"true"}),e.jsxs("div",{ref:j,"data-ds-portal":"",role:"dialog","aria-modal":"false","aria-live":"polite","aria-label":$.title??g("stepOf",{current:s+1,total:t.length}),className:["ds-coachmark__bubble",`ds-coachmark__bubble--${O}`,P&&"ds-coachmark__bubble--visible"].filter(Boolean).join(" "),style:y,tabIndex:-1,children:[e.jsx("button",{type:"button",className:"ds-coachmark__close",onClick:r,"aria-label":k,children:e.jsx(T.X,{size:16,strokeWidth:2})}),$.title&&e.jsx("div",{className:"ds-coachmark__title",children:$.title}),e.jsx("div",{className:"ds-coachmark__body",children:$.content}),e.jsxs("div",{className:"ds-coachmark__footer",children:[t.length>1&&e.jsxs("span",{className:"ds-coachmark__counter",children:[s+1," / ",t.length]}),e.jsxs("div",{className:"ds-coachmark__footer-nav",children:[s>0&&e.jsx(se,{variant:"secondary",size:"s",state:m,onClick:a,children:E}),e.jsx(se,{variant:"primary",size:"s",state:x,onClick:X?o:n,children:X?R:w})]})]})]})]}),document.body)}function Qs(t,s={}){const{storageKey:n}=s,[a,r]=c.useState(0),[o,i]=c.useState(!1),l=()=>n&&typeof localStorage<"u"&&localStorage.getItem(n)==="done",d=c.useCallback(()=>{i(!1),n&&typeof localStorage<"u"&&localStorage.setItem(n,"done")},[n]);return{currentStep:a,isActive:o,start:()=>{l()||(r(0),i(!0))},next:()=>r(f=>Math.min(f+1,t.length-1)),back:()=>r(f=>Math.max(f-1,0)),skip:d,finish:d}}function en(){const t=c.useRef(null),s=c.useCallback(()=>{const n=t.current;if(!n)return;n.classList.remove("ds-shake"),n.offsetWidth,n.classList.add("ds-shake");const a=()=>{n.classList.remove("ds-shake"),n.removeEventListener("animationend",a)};n.addEventListener("animationend",a)},[]);return{ref:t,shake:s}}exports.Accordion=Ne;exports.Alert=gt;exports.AnimatedNumber=vs;exports.Avatar=Ft;exports.Badge=ce;exports.Banner=fs;exports.BottomSheet=kt;exports.Breadcrumb=Kt;exports.Button=se;exports.Card=pt;exports.ChatMessage=Ss;exports.Checkbox=Dt;exports.Coachmark=Zs;exports.Code=Et;exports.CodeAccordion=qe;exports.ConfidenceBar=Ms;exports.CopyButton=et;exports.DiffView=zs;exports.Dropdown=ms;exports.EmptyState=Yt;exports.EngineerGrid=Hs;exports.FormField=qt;exports.H1=ht;exports.H2=xt;exports.H3=vt;exports.H4=bt;exports.InView=bs;exports.Input=dt;exports.Link=Rt;exports.LocaleProvider=lt;exports.MessageFeedback=st;exports.MessageFooter=Os;exports.Modal=wt;exports.ModalFooter=de;exports.ModelPicker=Is;exports.NavRail=ts;exports.NavRailAgent=cs;exports.NavRailBody=ns;exports.NavRailCustomItem=ls;exports.NavRailDivider=os;exports.NavRailFlyout=ds;exports.NavRailFooter=as;exports.NavRailHeader=rs;exports.NavRailItem=ss;exports.NavRailRecents=is;exports.P1=_t;exports.P2=Ye;exports.P3=Be;exports.Pagination=Jt;exports.ProgressBar=ps;exports.PromptInput=As;exports.Radio=Pt;exports.ReasoningBlock=ks;exports.Scrollable=Vs;exports.SegmentedControl=$t;exports.Select=ft;exports.SidePage=es;exports.SidePageFooter=Te;exports.Skeleton=Ge;exports.SourcesPanel=Ps;exports.Spinner=Xe;exports.Stat=Gt;exports.StepIndicator=Es;exports.Stepper=mt;exports.StreamingText=Rs;exports.Tab=Tt;exports.Table=zt;exports.TableBody=Ot;exports.TableHead=Wt;exports.TableRow=Ut;exports.TableSubheaderRow=Ht;exports.Tabs=St;exports.Td=Xt;exports.Textarea=ut;exports.Th=Vt;exports.ThinkingDot=Us;exports.ToastContainer=ws;exports.Toggle=Bt;exports.TokenCounter=Ls;exports.ToolCallBubble=Qe;exports.ToolCallCard=Qe;exports.Tooltip=we;exports.defaultStrings=_e;exports.formatString=Ae;exports.iconSizes=z;exports.useAnimatedNumber=Ke;exports.useAnimatedPlaceholder=tt;exports.useCoachmark=Qs;exports.useInView=Je;exports.useLocale=me;exports.useShake=en;exports.useStreamScroll=Ts;exports.useStrings=Y;exports.useToast=gs;