@donkit-ai/design-system 1.4.0 → 1.4.2

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/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),w=require("lucide-react"),ue=require("react-dom"),A={1:16,2:20,3:24,4:28,5:48};var he={exports:{}},ce={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),N=require("lucide-react"),ue=require("react-dom"),D={1:16,2:20,3:24,4:28,5:48};var he={exports:{}},ce={};/**
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 ye;function Fe(){if(ye)return ce;ye=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,a,n){var o=null;if(n!==void 0&&(o=""+n),a.key!==void 0&&(o=""+a.key),"key"in a){n={};for(var c in a)c!=="key"&&(n[c]=a[c])}else n=a;return a=n.ref,{$$typeof:s,type:i,key:o,ref:a!==void 0?a:null,props:n}}return ce.Fragment=t,ce.jsx=r,ce.jsxs=r,ce}var le={};/**
9
+ */var ge;function We(){if(ge)return ce;ge=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(o,a,n){var i=null;if(n!==void 0&&(i=""+n),a.key!==void 0&&(i=""+a.key),"key"in a){n={};for(var l in a)l!=="key"&&(n[l]=a[l])}else n=a;return a=n.ref,{$$typeof:s,type:o,key:i,ref:a!==void 0?a:null,props:n}}return ce.Fragment=t,ce.jsx=r,ce.jsxs=r,ce}var de={};/**
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 ge;function ze(){return ge||(ge=1,process.env.NODE_ENV!=="production"&&function(){function s(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Y?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case S:return"Fragment";case E:return"Profiler";case R:return"StrictMode";case D:return"Suspense";case N:return"SuspenseList";case V:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case v:return"Portal";case $:return l.displayName||"Context";case I:return(l._context.displayName||"Context")+".Consumer";case L:var y=l.render;return l=l.displayName,l||(l=y.displayName||y.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case P:return y=l.displayName||null,y!==null?y:s(l.type)||"Memo";case O:y=l._payload,l=l._init;try{return s(l(y))}catch{}}return null}function t(l){return""+l}function r(l){try{t(l);var y=!1}catch{y=!0}if(y){y=console;var B=y.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return B.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(l)}}function i(l){if(l===S)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===O)return"<...>";try{var y=s(l);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function a(){var l=X.A;return l===null?null:l.getOwner()}function n(){return Error("react-stack-top-frame")}function o(l){if(W.call(l,"key")){var y=Object.getOwnPropertyDescriptor(l,"key").get;if(y&&y.isReactWarning)return!1}return l.key!==void 0}function c(l,y){function B(){M||(M=!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)",y))}B.isReactWarning=!0,Object.defineProperty(l,"key",{get:B,configurable:!0})}function h(){var l=s(this.type);return z[l]||(z[l]=!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.")),l=this.props.ref,l!==void 0?l:null}function f(l,y,B,C,ee,te){var F=B.ref;return l={$$typeof:_,type:l,key:y,props:B,_owner:C},(F!==void 0?F:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:h}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function m(l,y,B,C,ee,te){var F=y.children;if(F!==void 0)if(C)if(b(F)){for(C=0;C<F.length;C++)p(F[C]);Object.freeze&&Object.freeze(F)}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(F);if(W.call(y,"key")){F=s(l);var J=Object.keys(y).filter(function(fe){return fe!=="key"});C=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",g[F+C]||(J=0<J.length?"{"+J.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ye;function Ue(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&function(){function s(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===O?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case A:return"Fragment";case B:return"Profiler";case S:return"StrictMode";case I:return"Suspense";case V:return"SuspenseList";case g:return"Activity"}if(typeof c=="object")switch(typeof c.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),c.$$typeof){case v:return"Portal";case $:return c.displayName||"Context";case E:return(c._context.displayName||"Context")+".Consumer";case z:var y=c.render;return c=c.displayName,c||(c=y.displayName||y.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case Y:return y=c.displayName||null,y!==null?y:s(c.type)||"Memo";case P:y=c._payload,c=c._init;try{return s(c(y))}catch{}}return null}function t(c){return""+c}function r(c){try{t(c);var y=!1}catch{y=!0}if(y){y=console;var L=y.error,F=typeof Symbol=="function"&&Symbol.toStringTag&&c[Symbol.toStringTag]||c.constructor.name||"Object";return L.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",F),t(c)}}function o(c){if(c===A)return"<>";if(typeof c=="object"&&c!==null&&c.$$typeof===P)return"<...>";try{var y=s(c);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function a(){var c=q.A;return c===null?null:c.getOwner()}function n(){return Error("react-stack-top-frame")}function i(c){if(W.call(c,"key")){var y=Object.getOwnPropertyDescriptor(c,"key").get;if(y&&y.isReactWarning)return!1}return c.key!==void 0}function l(c,y){function L(){T||(T=!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)",y))}L.isReactWarning=!0,Object.defineProperty(c,"key",{get:L,configurable:!0})}function p(){var c=s(this.type);return M[c]||(M[c]=!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.")),c=this.props.ref,c!==void 0?c:null}function d(c,y,L,F,se,re){var C=L.ref;return c={$$typeof:j,type:c,key:y,props:L,_owner:F},(C!==void 0?C:null)!==null?Object.defineProperty(c,"ref",{enumerable:!1,get:p}):Object.defineProperty(c,"ref",{enumerable:!1,value:null}),c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(c,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(c,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.defineProperty(c,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}function m(c,y,L,F,se,re){var C=y.children;if(C!==void 0)if(F)if(b(C)){for(F=0;F<C.length;F++)h(C[F]);Object.freeze&&Object.freeze(C)}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(C);if(W.call(y,"key")){C=s(c);var J=Object.keys(y).filter(function(me){return me!=="key"});F=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",k[C+F]||(J=0<J.length?"{"+J.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} />`,C,F,J,F),g[F+C]=!0)}if(F=null,B!==void 0&&(r(B),F=""+B),o(y)&&(r(y.key),F=""+y.key),"key"in y){B={};for(var re in y)re!=="key"&&(B[re]=y[re])}else B=y;return F&&c(B,typeof l=="function"?l.displayName||l.name||"Unknown":l),f(l,F,B,a(),ee,te)}function p(l){x(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===O&&(l._payload.status==="fulfilled"?x(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function x(l){return typeof l=="object"&&l!==null&&l.$$typeof===_}var d=u,_=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),$=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),X=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,b=Array.isArray,k=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(l){return l()}};var M,z={},q=d.react_stack_bottom_frame.bind(d,n)(),G=k(i(n)),g={};le.Fragment=S,le.jsx=function(l,y,B){var C=1e4>X.recentlyCreatedOwnerStacks++;return m(l,y,B,!1,C?Error("react-stack-top-frame"):q,C?k(i(l)):G)},le.jsxs=function(l,y,B){var C=1e4>X.recentlyCreatedOwnerStacks++;return m(l,y,B,!0,C?Error("react-stack-top-frame"):q,C?k(i(l)):G)}}()),le}process.env.NODE_ENV==="production"?he.exports=Fe():he.exports=ze();var e=he.exports;function Te({size:s="m",color:t="default",className:r="",...i}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,r].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...i})}const We={xs:12,s:14,m:16,l:20};function ie({children:s,variant:t="primary",size:r="m",fullWidth:i=!1,icon:a,disabled:n=!1,state:o="idle",onClick:c,type:h="button",href:f,"aria-label":m,...p}){const x=a&&!s,d=o==="loading",_=o==="success",v=o==="error",S=d||_||v,R=r==="xs"?"s":"m",E=We[r]??16,I=d?e.jsx(Te,{size:R}):_?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(w.Check,{size:E,strokeWidth:2.5})}):v?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(w.X,{size:E,strokeWidth:2.5})}):null,$=["ds-button",`ds-button--${t}`,`ds-button--${r}`,i&&"ds-button--full",x&&"ds-button--icon-only"].filter(Boolean).join(" "),L=o!=="idle"?o:void 0,D=e.jsxs(e.Fragment,{children:[S?I:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(f){const N=P=>{if(n||d){P.preventDefault();return}P.metaKey||P.ctrlKey||P.button===1||(P.preventDefault(),c==null||c(P))};return e.jsx("a",{className:$,href:n||d?void 0:f,onClick:N,"aria-label":m,"aria-disabled":n||d?"true":void 0,"aria-busy":d?"true":void 0,"data-state":L,...p,children:D})}return e.jsx("button",{type:h,className:$,disabled:n,onClick:d?void 0:c,"aria-label":m,"aria-busy":d?"true":void 0,"data-state":L,...p,children:D})}function Ue({label:s,error:t,hint:r,fullWidth:i=!0,icon:a,iconRight:n,onIconRightClick:o,size:c="m",disabled:h,id:f,...m}){const p=f||`input-${u.useId()}`,x=r?`${p}-hint`:void 0,d=t?`${p}-error`:void 0,_=d||x;return e.jsxs("div",{className:`ds-input-wrapper ${i?"ds-input-wrapper--full":""} ${h?"ds-input-wrapper--disabled":""} ${t?"ds-input-wrapper--error":""}`,children:[s&&e.jsx("label",{className:"ds-input-label",htmlFor:p,children:s}),e.jsxs("div",{className:"ds-input-container",children:[a&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${c}`,"aria-hidden":"true",children:a}),e.jsx("input",{id:p,className:`ds-input ds-input--${c} ${a?"ds-input--with-icon":""} ${n?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:h,"aria-invalid":t?"true":"false","aria-describedby":_,...m}),n&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${c}`,onClick:o,tabIndex:-1,"aria-label":"Toggle visibility",children:n})]}),r&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:r}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:d,className:"ds-input-error",role:"alert",children:t})})})]})}function Ve({label:s,error:t,hint:r,fullWidth:i=!0,size:a="m",disabled:n,id:o,resize:c=!0,rows:h=3,...f}){const m=o||`textarea-${u.useId()}`,p=r?`${m}-hint`:void 0,x=t?`${m}-error`:void 0,d=x||p;return e.jsxs("div",{className:`ds-textarea-wrapper ${i?"ds-textarea-wrapper--full":""} ${n?"ds-textarea-wrapper--disabled":""}`,children:[s&&e.jsx("label",{className:"ds-textarea-label",htmlFor:m,children:s}),e.jsx("textarea",{id:m,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${c?"":"ds-textarea--no-resize"}`,disabled:n,"aria-invalid":t?"true":"false","aria-describedby":d,rows:h,...f}),r&&!t&&e.jsx("span",{id:p,className:"ds-textarea-hint",children:r}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function Ye({label:s,value:t,onChange:r,options:i=[],placeholder:a="Select option",error:n,fullWidth:o=!0,size:c="m",disabled:h=!1,id:f,...m}){const[p,x]=u.useState(!1),[d,_]=u.useState(!1),[v,S]=u.useState({}),[R,E]=u.useState("down"),[I,$]=u.useState(-1),L=u.useRef(null),D=u.useRef(null),N=u.useRef(null),P=u.useRef(null),O=f||`select-${u.useId()}`,V=`${O}-label`,Y=n?`${O}-error`:void 0,X=150,W=(g=!1)=>{d||(_(!0),$(-1),P.current=setTimeout(()=>{var l;x(!1),_(!1),g&&((l=N.current)==null||l.focus())},X))},b=g=>{clearTimeout(P.current),_(!1);const l=g!==void 0?g:Math.max(i.findIndex(y=>y.value===t),0);$(l),x(!0)};u.useEffect(()=>()=>clearTimeout(P.current),[]);const k=()=>{var te;const g=(te=L.current)==null?void 0:te.getBoundingClientRect();if(!g)return;const l=window.innerHeight,y=l-g.bottom,B=g.top,ee=y<300&&B>y;E(ee?"up":"down"),S(ee?{bottom:l-g.top+4,left:g.left,width:g.width}:{top:g.bottom+4,left:g.left,width:g.width})};u.useEffect(()=>{if(p)return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[p]),u.useEffect(()=>{const g=l=>{L.current&&!L.current.contains(l.target)&&D.current&&!D.current.contains(l.target)&&W()};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),u.useEffect(()=>{var l;if(!p||I<0||!D.current)return;(l=D.current.querySelectorAll(".ds-select-option")[I])==null||l.scrollIntoView({block:"nearest"})},[I,p]);const M=g=>{switch(g.key){case"ArrowDown":g.preventDefault(),p?$(l=>Math.min(l+1,i.length-1)):b();break;case"ArrowUp":g.preventDefault(),p?$(l=>Math.max(l-1,0)):b(i.length-1);break;case"Home":p&&(g.preventDefault(),$(0));break;case"End":p&&(g.preventDefault(),$(i.length-1));break;case"Enter":case" ":g.preventDefault(),p?I>=0&&(r==null||r(i[I].value),W(!0)):b();break;case"Escape":p&&(g.preventDefault(),W(!0));break;case"Tab":p&&W(!1);break}},z=i.find(g=>g.value===t),q=c==="xs"?A[1]:c==="small"?A[2]:A[3],G=p&&e.jsx("div",{ref:D,role:"listbox","aria-labelledby":s?V:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${c}`,`ds-select-dropdown--${R}`,d&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:v,children:i.map((g,l)=>e.jsx("button",{id:`${O}-opt-${l}`,type:"button",role:"option",tabIndex:-1,"aria-selected":t===g.value,className:["ds-select-option",`ds-select-option--${c}`,t===g.value&&"ds-select-option--selected",l===I&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{r==null||r(g.value),W(!0)},children:g.label},g.value))});return e.jsxs("div",{className:`ds-select-wrapper ${o?"ds-select-wrapper--full":""} ${h?"ds-select-wrapper--disabled":""}`,children:[s&&e.jsx("label",{id:V,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:L,children:e.jsxs("button",{ref:N,type:"button",id:O,role:"combobox","aria-haspopup":"listbox","aria-expanded":p,"aria-activedescendant":p&&I>=0?`${O}-opt-${I}`:void 0,"aria-labelledby":s?V:void 0,"aria-invalid":n?"true":"false","aria-describedby":Y,className:`ds-select-trigger ds-select-trigger--${c} ${n?"ds-select-trigger--error":""}`,onClick:()=>{h||(p?W():b())},onKeyDown:M,disabled:h,...m,children:[e.jsx("span",{className:z?"":"ds-select-placeholder",children:(z==null?void 0:z.label)||a}),e.jsx(w.ChevronDown,{size:q,strokeWidth:1.5,className:`ds-select-icon ${p&&R==="down"?"ds-select-icon--open":""} ${p&&R==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),n&&e.jsx("span",{id:Y,className:"ds-select-error",role:"alert",children:n}),typeof document<"u"&&ue.createPortal(G,document.body)]})}function qe({label:s,value:t=0,onChange:r,min:i=0,max:a=100,step:n=1,size:o="m",disabled:c=!1,hint:h,error:f,...m}){const p=()=>{if(c)return;const R=Math.min(Number(t)+n,a);r==null||r(R)},x=()=>{if(c)return;const R=Math.max(Number(t)-n,i);r==null||r(R)},d=R=>{if(c)return;const E=R.target.value;if(E===""){r==null||r(i);return}const I=Number(E);if(!isNaN(I)){const $=Math.min(Math.max(I,i),a);r==null||r($)}},_=["ds-stepper-wrapper",c&&"ds-stepper-wrapper--disabled",f&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),v=["ds-stepper",`ds-stepper--${o}`,c&&"ds-stepper--disabled"].filter(Boolean).join(" "),S=o==="xs"?A[1]:o==="small"?A[2]:A[3];return e.jsxs("div",{className:_,children:[s&&e.jsx("label",{className:"ds-stepper-label",children:s}),e.jsxs("div",{className:v,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:c||t<=i,"aria-label":"Decrease",children:e.jsx(w.Minus,{size:S,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:d,min:i,max:a,step:n,disabled:c,...m}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:p,disabled:c||t>=a,"aria-label":"Increase",children:e.jsx(w.Plus,{size:S,strokeWidth:1.5})})]}),h&&!f&&e.jsx("div",{className:"ds-stepper-hint",children:h}),f&&e.jsx("div",{className:"ds-stepper-error",children:f})]})}function Se({children:s,padding:t="m",variant:r="info",hover:i=!1,onClick:a,href:n,disabled:o=!1,...c}){const f=(i?"interactive":r)==="interactive"||a||n,m=["ds-card",`ds-card--${t}`,f&&"ds-card--interactive"].filter(Boolean).join(" ");if(n){const d=_=>{if(o){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),a==null||a(_))};return e.jsx("a",{className:m,href:o?void 0:n,onClick:d,"aria-disabled":o?"true":void 0,...c,children:s})}const p=f&&a?"button":"div",x=f&&a?{type:"button",onClick:a,disabled:o}:{};return e.jsx(p,{className:m,role:f&&!a?"article":void 0,...x,...c,children:s})}function He({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function Xe({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function Ke({children:s,...t}){return e.jsx("h3",{className:"ds-h3",...t,children:s})}function Ge({children:s,...t}){return e.jsx("h4",{className:"ds-h4",...t,children:s})}function Je({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...r,children:s})}function Ae({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...r,children:s})}function je({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...r,children:s})}function de({children:s,variant:t="default",size:r="m",role:i,...a}){const n=["ds-badge",`ds-badge--${t}`,`ds-badge--${r}`].filter(Boolean).join(" "),o=i||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:n,role:o,...a,children:s})}const Ze={info:w.Info,success:w.CheckCircle,warning:w.AlertTriangle,error:w.XCircle};function Qe({children:s,variant:t="info",title:r,onClose:i,role:a,...n}){const o=Ze[t],c=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${r?"":"ds-alert--no-title"}`,role:c,...n,children:[o&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(o,{size:A[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})]}),i&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:i,"aria-label":"Close alert",children:e.jsx(w.X,{size:A[3],strokeWidth:1.5})})]})}const es=200;function ss({children:s,title:t,onClose:r,size:i="m",...a}){const n=u.useRef(null),o=u.useId(),[c,h]=u.useState(!1),f=()=>{!r||c||(h(!0),setTimeout(()=>{h(!1),r()},es))};u.useEffect(()=>{const d=v=>{v.key==="Escape"&&f()},_=v=>{n.current&&!n.current.contains(v.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",_)}},[r,c]);const m=u.Children.toArray(s),p=m.find(d=>(d==null?void 0:d.type)===xe),x=m.filter(d=>(d==null?void 0:d.type)!==xe);return e.jsx("div",{className:["ds-modal-overlay",c&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("div",{className:`ds-modal ds-modal--${i}`,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":t?o:void 0,children:[(t||r)&&e.jsxs("div",{className:"ds-modal__header",children:[t&&e.jsx("h3",{id:o,className:"ds-modal__title",children:t}),r&&e.jsx(ie,{variant:"ghost",size:"small",icon:e.jsx(w.X,{size:A[2],strokeWidth:1.5}),onClick:f,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:x}),p]})})}function xe({children:s}){return e.jsx("div",{className:"ds-modal__footer",children:s})}function Ie({children:s,title:t="Code",defaultExpanded:r=!1,expanded:i,onToggle:a,padding:n="s",className:o="",...c}){const[h,f]=u.useState(r),m=i!==void 0,p=m?i:h,x=()=>{m?a==null||a(!i):f(_=>!_)},d=["ds-code-accordion",`ds-code-accordion--${n}`,p&&"ds-code-accordion--expanded",o].filter(Boolean).join(" ");return e.jsxs("div",{className:d,...c,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:x,"aria-expanded":p,children:[e.jsx("span",{className:"ds-code-accordion__title",children:t}),e.jsx(w.ChevronDown,{size:A[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",children:e.jsx("code",{children:s})})})})]})}function ts({children:s,block:t=!1,collapsible:r=!1,title:i="Code",defaultExpanded:a=!1,...n}){return t?r?e.jsx(Ie,{title:i,defaultExpanded:a,...n,children:s}):e.jsx("pre",{className:"ds-code-block",...n,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...n,children:s})}function rs({href:s,children:t,onClick:r,target:i,rel:a,...n}){const c=i==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:r,target:i,rel:c,...n,children:t})}function ns({children:s,size:t="m",variant:r="ghost",...i}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...i,children:u.Children.map(s,a=>u.isValidElement(a)?u.cloneElement(a,{size:t,variant:r}):a)})}function as({children:s,selected:t=!1,onClick:r,size:i="m",variant:a="ghost",disabled:n=!1,icon:o,href:c,...h}){const f=o&&!s,m=["ds-tab",`ds-tab--${i}`,`ds-tab--${a}`,t&&"ds-tab--selected",f&&"ds-tab--icon-only"].filter(Boolean).join(" "),p=e.jsxs(e.Fragment,{children:[o&&e.jsx("span",{className:"ds-tab-icon",children:o}),s]});if(c){const x=d=>{if(n){d.preventDefault();return}d.metaKey||d.ctrlKey||d.button===1||(d.preventDefault(),r==null||r(d))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":n?"true":void 0,className:m,href:n?void 0:c,onClick:x,...h,children:p})}return e.jsx("button",{role:"tab","aria-selected":t,className:m,onClick:r,disabled:n,...h,children:p})}function is({options:s,value:t,onChange:r,size:i="m",disabled:a=!1}){const n=u.useRef(null),o=u.useRef(null),[c,h]=u.useState(!1),f=u.useRef(!1),m=u.useRef(null),p=u.useRef(null),x=()=>{if(!n.current)return;const d=n.current.querySelector(`[data-value="${t}"]`);if(!d)return;const _=n.current.getBoundingClientRect(),v=d.getBoundingClientRect(),S=v.left-_.left,R=v.width;o.current?(o.current.style.transition=f.current?"left var(--transition-normal), width var(--transition-normal)":"none",o.current.style.left=S+"px",o.current.style.width=R+"px",f.current=!1):(h(!0),requestAnimationFrame(()=>{if(!o.current||!n.current)return;const E=n.current.querySelector(`[data-value="${t}"]`);if(!E)return;const I=n.current.getBoundingClientRect(),$=E.getBoundingClientRect();o.current.style.transition="none",o.current.style.left=$.left-I.left+"px",o.current.style.width=$.width+"px"}))};return p.current=x,u.useLayoutEffect(()=>{const d=m.current!==t;m.current=t,f.current=c&&d,x()}),u.useEffect(()=>{if(!n.current)return;const d=new ResizeObserver(()=>{f.current=!1,p.current()});return d.observe(n.current),()=>d.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${i}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:n,role:"group",children:[c&&e.jsx("div",{ref:o,className:"ds-seg__pill","aria-hidden":"true"}),s.map(d=>e.jsxs("button",{type:"button","data-value":d.value,className:["ds-seg__btn",t===d.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&r(d.value),"aria-pressed":t===d.value,disabled:a,children:[d.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:d.icon}),d.label]},d.value))]})}function ve({children:s,title:t,defaultExpanded:r=!1,expanded:i,onToggle:a,padding:n="m",...o}){const[c,h]=u.useState(r),f=i!==void 0,m=f?i:c,p=()=>{f?a==null||a(!i):h(d=>!d)},x=["ds-accordion",`ds-accordion--${n}`,m&&"ds-accordion--expanded"].filter(Boolean).join(" ");return e.jsxs("div",{className:x,...o,children:[e.jsxs("button",{type:"button",className:"ds-accordion__header",onClick:p,"aria-expanded":m,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(w.ChevronDown,{size:A[2],strokeWidth:1.5,className:`ds-accordion__icon ${m?"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:s})})})]})}const se=8,ae=8;function os(s,t,r){const i=window.innerWidth;let a,n;switch(s){case"top":a=t.top-r.height-se,n=t.left+t.width/2-r.width/2;break;case"bottom":a=t.bottom+se,n=t.left+t.width/2-r.width/2;break;case"left":a=t.top+t.height/2-r.height/2,n=t.left-r.width-se;break;case"right":a=t.top+t.height/2-r.height/2,n=t.right+se;break;default:a=t.bottom+se,n=t.left}const o=Math.max(ae,Math.min(i-r.width-ae,n)),c=n-o;return{top:a,left:o,arrowOffset:c}}function cs(s,t,r){const i=window.innerWidth,a=window.innerHeight;if(s.top>=t+se+ae)return"top";if(a-s.bottom>=t+se+ae)return"bottom";if(i-s.right>=r+se+ae)return"right";if(s.left>=r+se+ae)return"left";const n=Math.max(s.top,a-s.bottom,s.left,i-s.right);return n===s.top?"top":n===a-s.bottom?"bottom":n===i-s.right?"right":"left"}function ls({children:s,content:t,position:r,...i}){const[a,n]=u.useState(!1),[o,c]=u.useState({visibility:"hidden"}),[h,f]=u.useState(r||"top"),m=u.useRef(null),p=u.useRef(null),x=u.useRef(!1),d=()=>{if(!m.current||!p.current)return;const v=m.current.getBoundingClientRect(),S=p.current.getBoundingClientRect(),R=r||cs(v,S.height,S.width),{top:E,left:I,arrowOffset:$}=os(R,v,S);f(R),c({position:"fixed",top:E,left:I,visibility:"visible","--arrow-offset":`${$}px`})};if(u.useEffect(()=>{if(!a)return;c({position:"fixed",visibility:"hidden"});const v=requestAnimationFrame(d);return window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(v),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[a,r]),u.useEffect(()=>{if(!a)return;const v=S=>{m.current&&!m.current.contains(S.target)&&n(!1)};return document.addEventListener("touchstart",v),()=>document.removeEventListener("touchstart",v)},[a]),!t)return s;const _=a&&e.jsx("div",{ref:p,className:`ds-tooltip ds-tooltip--${h}`,role:"tooltip",style:o,children:t});return e.jsxs("div",{ref:m,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||n(!0)},onMouseLeave:()=>{x.current||n(!1)},onTouchStart:()=>{x.current=!0,n(v=>!v)},...i,children:[s,typeof document<"u"&&ue.createPortal(_,document.body)]})}function ds({checked:s=!1,onChange:t,size:r="m",disabled:i=!1,label:a,id:n,...o}){const c=n||`toggle-${u.useId()}`,h=["ds-toggle",`ds-toggle--${r}`,i&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:h,htmlFor:c,children:[e.jsx("input",{type:"checkbox",id:c,className:"ds-toggle__input",checked:s,onChange:f=>t==null?void 0:t(f.target.checked),disabled:i,...o}),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 us({checked:s=!1,onChange:t,size:r="m",disabled:i=!1,label:a,id:n,...o}){const c=n||`checkbox-${u.useId()}`,h=["ds-checkbox",`ds-checkbox--${r}`,i&&"ds-checkbox--disabled"].filter(Boolean).join(" "),f=r==="xs"?10:r==="small"?14:r==="large"?20:16;return e.jsxs("label",{className:h,htmlFor:c,children:[e.jsx("input",{type:"checkbox",id:c,className:"ds-checkbox__input",checked:s,onChange:m=>t==null?void 0:t(m.target.checked),disabled:i,...o}),e.jsx("span",{className:"ds-checkbox__box",children:s&&e.jsx(w.Check,{size:f,strokeWidth:2.5,className:"ds-checkbox__icon"})}),a&&e.jsx("span",{className:"ds-checkbox__label",children:a})]})}function fs({checked:s=!1,onChange:t,size:r="m",disabled:i=!1,label:a,name:n,value:o,id:c,...h}){const f=c||`radio-${u.useId()}`,m=["ds-radio",`ds-radio--${r}`,i&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,htmlFor:f,children:[e.jsx("input",{type:"radio",id:f,className:"ds-radio__input",checked:s,onChange:p=>t==null?void 0:t(p.target.checked),disabled:i,name:n,value:o,...h}),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 De({width:s,height:t,shape:r="rect",aspectRatio:i,className:a="",style:n={},...o}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,a].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:i,...n},"aria-hidden":"true",...o})}function ms({lines:s=1,lastLineWidth:t="70%",gap:r,className:i="",style:a={},...n}){return e.jsx("span",{className:["ds-skeleton-text",i].filter(Boolean).join(" "),style:{gap:r,...a},"aria-hidden":"true",...n,children:Array.from({length:s},(o,c)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:c===s-1&&s>1?{width:t}:void 0},c))})}De.Text=ms;function ps(s){let t=2166136261;for(let r=0;r<s.length;r++)t^=s.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t%360}function hs(s){if(!s)return"";const t=s.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s[0].toUpperCase()}function xs({seed:s,icon:t,src:r,size:i=32,className:a="",style:n={},...o}){const c=ps(s??""),[h,f]=u.useState(!1),m=t??e.jsx("span",{className:"ds-avatar__initials",children:hs(s)});return e.jsx("div",{className:["ds-avatar",a].filter(Boolean).join(" "),style:{width:i,height:i,"--ds-avatar-h":c,...n},"aria-hidden":"true",...o,children:r&&!h?e.jsx("img",{src:r,alt:"",onError:()=>f(!0)}):m})}function _s({children:s,size:t="compact",stickyTop:r,maxHeight:i,className:a="",style:n={},...o}){const c={...i?{maxHeight:i}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...n};return e.jsx("div",{className:["ds-table-wrap",i?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:c,children:e.jsx("table",{className:["ds-table",`ds-table--${t}`,a].filter(Boolean).join(" "),...o,children:s})})}function bs({children:s,...t}){return e.jsx("thead",{...t,children:s})}function js({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function vs({children:s,interactive:t,selected:r,subheader:i,className:a="",onClick:n,...o}){return e.jsx("tr",{className:["ds-table-row",t||n?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",i?"ds-table-row--subheader":"",a].filter(Boolean).join(" "),onClick:n,...o,children:s})}function Ns({children:s,colSpan:t=999,...r}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:e.jsx("td",{colSpan:t,children:s})})}function ws({children:s,align:t="left",sortDir:r,onSort:i,width:a,className:n="",style:o={},...c}){const h=!!i||r!==void 0,f=r==="asc"?w.ChevronUp:r==="desc"?w.ChevronDown:w.ChevronsUpDown;return e.jsx("th",{className:["ds-th",h?"ds-th--sortable":"",r?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",n].filter(Boolean).join(" "),onClick:i,style:{width:a,...o},...c,children:h?e.jsxs("span",{className:"ds-th__inner",children:[s,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(f,{size:11,strokeWidth:2.5})})]}):s})}function ys({children:s,align:t="left",secondary:r,muted:i,truncate:a,nowrap:n,className:o="",...c}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",r?"ds-table-cell--secondary":"",i?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",n?"ds-table-cell--nowrap":"",o].filter(Boolean).join(" "),...c,children:s})}function gs({icon:s,title:t,description:r,action:i,size:a="m",className:n="",...o}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,n].filter(Boolean).join(" "),...o,children:[s&&e.jsx("div",{className:"ds-empty-state__icon",children:s}),e.jsx("div",{className:"ds-empty-state__title",children:t}),r&&e.jsx("div",{className:"ds-empty-state__description",children:r}),i&&e.jsx("div",{className:"ds-empty-state__action",children:i})]})}function ks({label:s,hint:t,error:r,required:i=!1,disabled:a=!1,htmlFor:n,children:o,className:c="",style:h,...f}){const m=u.useId(),p=n??m,x=`${p}-hint`,d=`${p}-error`;return e.jsxs("div",{className:`ds-field${c?` ${c}`:""}`,"data-state":r?"error":void 0,"data-required":i?"":void 0,"data-disabled":a?"":void 0,style:h,...f,children:[s&&e.jsx("label",{className:"ds-field-label",htmlFor:p,children:s}),e.jsx("div",{className:"ds-field-control",children:o}),t&&!r&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),r&&e.jsx("p",{className:"ds-field-error",id:d,role:"alert",children:r})]})}function Es({label:s,value:t,delta:r,size:i="m",inline:a=!1,className:n="",style:o,...c}){const h=r!=null&&r.startsWith("+")?"up":r!=null&&r.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${i}`,a&&"ds-stat--inline",n].filter(Boolean).join(" "),style:o,...c,children:[s&&e.jsx("span",{className:"ds-stat-label",children:s}),t!=null&&e.jsx("span",{className:"ds-stat-value",children:t}),r!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${h}`,children:r})]})}function $s({children:s,separator:t="/","aria-label":r="Breadcrumb",className:i="",style:a,...n}){const o=u.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${i?` ${i}`:""}`,"aria-label":r,style:a,...n,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:o.map((c,h)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[c,h<o.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:t})]},h))})})}function Rs({page:s,total:t,onChange:r,siblings:i=1,"aria-label":a="Pagination",className:n="",style:o,...c}){const h=Ts(s,t,i);return e.jsxs("nav",{className:`ds-pagination${n?` ${n}`:""}`,"aria-label":a,style:o,...c,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(w.ChevronLeft,{size:16})}),h.map((f,m)=>f==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${m}`):e.jsx("button",{className:`ds-pagination-page${f===s?" ds-pagination-page--current":""}`,onClick:()=>f!==s&&(r==null?void 0:r(f)),"aria-current":f===s?"page":void 0,"aria-label":`Page ${f}`,children:f},f)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(w.ChevronRight,{size:16})})]})}function Ts(s,t,r){if(t<=7)return Array.from({length:t},(o,c)=>c+1);const i=Math.max(2,s-r),a=Math.min(t-1,s+r),n=[1];i>2&&n.push("…");for(let o=i;o<=a;o++)n.push(o);return a<t-1&&n.push("…"),n.push(t),n}const Ss=200;function As({children:s,title:t,onClose:r,side:i="right",...a}){const n=u.useRef(null),o=u.useId(),[c,h]=u.useState(!1),f=()=>{!r||c||(h(!0),setTimeout(()=>{h(!1),r()},Ss))};u.useEffect(()=>{const d=v=>{v.key==="Escape"&&f()},_=v=>{n.current&&!n.current.contains(v.target)&&f()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",_)}},[r,c]);const m=u.Children.toArray(s),p=m.find(d=>(d==null?void 0:d.type)===_e),x=m.filter(d=>(d==null?void 0:d.type)!==_e);return e.jsx("div",{className:["ds-drawer-overlay",c&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("aside",{className:["ds-drawer",c&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":i,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":t?o:void 0,children:[e.jsxs("header",{className:"ds-drawer-header",children:[t&&e.jsx("h3",{id:o,className:"ds-drawer-title",children:t}),r&&e.jsx("button",{className:"ds-drawer-close",onClick:f,"aria-label":"Close drawer",children:e.jsx(w.X,{size:A[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body",children:x}),p]})})}function _e({children:s}){return e.jsx("footer",{className:"ds-drawer-footer",children:s})}const Is={info:w.Info,success:w.CheckCircle,warning:w.AlertTriangle,error:w.XCircle};function Ds({children:s,variant:t="info",action:r,onAction:i,onDismiss:a,role:n,...o}){const c=Is[t],h=n||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${t}`,role:h,...o,children:[c&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(c,{size:A[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:s}),r&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:i,children:r}),a&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:a,"aria-label":"Dismiss",children:e.jsx(w.X,{size:A[2],strokeWidth:1.5})})]})}function Bs({trigger:s,items:t=[],open:r,onOpenChange:i,align:a="left",className:n="",style:o,...c}){const[h,f]=u.useState(!1),[m,p]=u.useState(!1),x=r!==void 0,d=x?r:h,_=u.useRef(null),v=u.useRef(null),S=u.useRef(null),R=u.useRef(null),[E,I]=u.useState({}),$=u.useRef(null),L=150,D=()=>{if(x)i==null||i(!1);else{if(m)return;p(!0),$.current=setTimeout(()=>{f(!1),p(!1)},L)}},N=()=>{const b=!d;x?i==null||i(b):b?(clearTimeout($.current),p(!1),f(!0)):D()},P=()=>{d||(x?i==null||i(!0):(clearTimeout($.current),p(!1),f(!0)))};u.useEffect(()=>()=>clearTimeout($.current),[]),u.useEffect(()=>{if(!d)return;const b=()=>{var M;const k=(M=_.current)==null?void 0:M.getBoundingClientRect();k&&I(a==="right"?{top:k.bottom+4,right:window.innerWidth-k.right}:{top:k.bottom+4,left:k.left})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[d,a]);const O=()=>{var k;const b=(k=S.current)==null?void 0:k.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};u.useEffect(()=>{if(!d)return;const b=M=>{var z,q;!((z=_.current)!=null&&z.contains(M.target))&&!((q=v.current)!=null&&q.contains(M.target))&&D()},k=M=>{M.key==="Escape"&&(D(),O())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",k)}},[d]),u.useEffect(()=>{if(!d||!R.current||!v.current)return;const b=V(),k=R.current==="last"?b[b.length-1]:b[0];k==null||k.focus(),R.current=null},[d]);const V=()=>v.current?[...v.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],Y=b=>{var k,M;if(b.key==="ArrowDown")b.preventDefault(),d?(k=V()[0])==null||k.focus():(R.current="first",P());else if(b.key==="ArrowUp")if(b.preventDefault(),!d)R.current="last",P();else{const z=V();(M=z[z.length-1])==null||M.focus()}},X=b=>{var z,q,G,g;const k=V(),M=k.findIndex(l=>l===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(z=k[Math.min(M+1,k.length-1)])==null||z.focus();break;case"ArrowUp":b.preventDefault(),M<=0?O():(q=k[M-1])==null||q.focus();break;case"Home":b.preventDefault(),(G=k[0])==null||G.focus();break;case"End":b.preventDefault(),(g=k[k.length-1])==null||g.focus();break;case"Tab":D();break}},W=d&&e.jsx("div",{ref:v,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,m&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:E,onKeyDown:X,children:t.map((b,k)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},k);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})]},k);const M=!!b.href,z=M?"a":"button",q=M?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(z,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...q,onClick:()=>{var G;(G=b.onClick)==null||G.call(b),D()},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})]},k)})});return e.jsxs("div",{ref:_,className:["ds-dropdown",n].filter(Boolean).join(" "),style:o,...c,children:[e.jsx("div",{ref:S,className:"ds-dropdown__trigger",onClick:N,onKeyDown:Y,children:s}),typeof document<"u"&&ue.createPortal(W,document.body)]})}function Ps({value:s=0,size:t="m",variant:r="default",showValue:i=!1,min:a=2,animate:n=!0}){const o=Math.min(100,Math.max(0,s)),c=Math.max(a,o),h=r==="auto"?o>=70?"success":o>=50?"warning":"danger":r;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!n&&"ds-progress--instant"].filter(Boolean).join(" "),role:"progressbar","aria-valuenow":o,"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--${h}`,style:{width:`${c}%`}})}),i&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(o),"%"]})]})}const Ms=s=>1-Math.pow(1-s,3),Ls=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Be(s,{duration:t=600}={}){const[r,i]=u.useState(s),a=u.useRef(s),n=u.useRef(null);return u.useEffect(()=>{if(Ls()){i(s),a.current=s;return}const o=a.current,c=s-o;if(c===0)return;let h=null;const f=m=>{h||(h=m);const p=Math.min((m-h)/t,1);i(o+c*Ms(p)),p<1?n.current=requestAnimationFrame(f):a.current=s};return n.current=requestAnimationFrame(f),()=>cancelAnimationFrame(n.current)},[s,t]),r}function Os({value:s,duration:t=600,decimals:r=0,prefix:i="",suffix:a=""}){const o=Be(s,{duration:t}).toFixed(r);return`${i}${o}${a}`}function Pe({threshold:s=.1,rootMargin:t="0px",once:r=!1}={}){const i=u.useRef(null),[a,n]=u.useState(!1);return u.useEffect(()=>{const o=i.current;if(!o)return;const c=new IntersectionObserver(([h])=>{h.isIntersecting?(n(!0),r&&c.disconnect()):r||n(!1)},{threshold:s,rootMargin:t});return c.observe(o),()=>c.disconnect()},[s,t,r]),{ref:i,inView:a}}function Cs({children:s,as:t="div",once:r=!1,threshold:i=.1,rootMargin:a="0px",onEnter:n,onLeave:o,...c}){const{ref:h,inView:f}=Pe({threshold:i,rootMargin:a,once:r}),m=u.useRef(!1);return u.useEffect(()=>{f&&!m.current&&(n==null||n()),!f&&m.current&&(o==null||o()),m.current=f},[f]),e.jsx(t,{ref:h,...c,children:typeof s=="function"?s(f):s})}const ke={default:w.Info,success:w.CheckCircle,warning:w.AlertTriangle,error:w.XCircle};let oe=[];const be=new Set;function Me(){be.forEach(s=>s([...oe]))}function Fs(s){oe=[...oe,s],Me()}function zs(s){oe=oe.filter(t=>t.id!==s),Me()}function Ws(){const s=(t,r={})=>{Fs({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...r})};return s.success=(t,r)=>s(t,{...r,type:"success"}),s.error=(t,r)=>s(t,{...r,type:"error"}),s.warning=(t,r)=>s(t,{...r,type:"warning"}),{toast:s}}function Us({data:s,onDismiss:t}){const[r,i]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>(requestAnimationFrame(()=>i(!0)),s.duration>0&&(a.current=setTimeout(()=>n(),s.duration)),()=>clearTimeout(a.current)),[]);function n(){i(!1),setTimeout(()=>t(s.id),250)}const o=ke[s.type]??ke.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${s.type}`,r&&"ds-toast--visible"].filter(Boolean).join(" "),role:s.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(o,{size:A[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:s.message}),e.jsx("button",{className:"ds-toast__close",onClick:n,"aria-label":"Закрыть",children:e.jsx(w.X,{size:A[3],strokeWidth:1.5})})]})}function Vs({position:s="bottom-right"}){const[t,r]=u.useState(()=>[...oe]);return u.useEffect(()=>(be.add(r),()=>be.delete(r)),[]),!t.length||typeof document>"u"?null:ue.createPortal(e.jsx("div",{className:["ds-toast-container",`ds-toast-container--${s}`].join(" "),children:t.map(i=>e.jsx(Us,{data:i,onDismiss:zs},i.id))}),document.body)}const Ys={running:e.jsx(de,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(de,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(de,{size:"xs",variant:"error",children:"Error"})};function qs({label:s,status:t="idle",icon:r,badge:i,defaultExpanded:a=!1,expanded:n,onToggle:o,padding:c="s",children:h,...f}){const p=`tc-body-${u.useId().replace(/:/g,"")}`,[x,d]=u.useState(a),_=n!==void 0,v=_?n:x,S=()=>{_?o==null||o(!n):d(R=>!R)};return e.jsxs(Se,{padding:c,...f,children:[e.jsxs("button",{type:"button",className:"ds-tool-card__header",onClick:S,"aria-expanded":v,"aria-controls":p,children:[e.jsx(w.ChevronRight,{size:A[1],strokeWidth:1.5,className:`ds-tool-card__chevron${v?" ds-tool-card__chevron--expanded":""}`}),r&&e.jsx("span",{className:"ds-tool-card__icon",children:r}),e.jsx("span",{className:"ds-tool-card__label",children:s}),Ys[t],i]}),v&&e.jsx("div",{id:p,className:"ds-tool-card__body",children:h})]})}function Hs({text:s,size:t="xs",timeout:r=2e3,"aria-label":i="Copy to clipboard",...a}){const[n,o]=u.useState(!1),c=()=>{navigator.clipboard.writeText(s).then(()=>{o(!0),setTimeout(()=>o(!1),r)})};return e.jsx(ie,{variant:"ghost",size:t,icon:n?e.jsx(w.Check,{size:A[1],strokeWidth:1.5}):e.jsx(w.Copy,{size:A[1],strokeWidth:1.5}),"aria-label":i,onClick:c,...a})}function Xs({content:s,streaming:t=!1,...r}){const[i,a]=u.useState(t);return u.useEffect(()=>{a(!!t)},[t]),e.jsx(ve,{expanded:i,onToggle:a,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(w.Brain,{size:A[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Ae,{secondary:!0,children:"Thinking"})]}),...r,children:e.jsxs(je,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[s,t&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Ks({count:s,current:t=0,done:r=[],onChange:i,showCounter:a=!0,className:n="","aria-label":o="Steps",...c}){return e.jsxs("div",{className:["ds-step-indicator",n].filter(Boolean).join(" "),...c,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":o,children:Array.from({length:s},(h,f)=>{const m=f===t,p=r.includes(f)&&!m,x=i&&(f<=t||r.includes(f)),d=["ds-step-indicator__dot",m&&"ds-step-indicator__dot--active",p&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:d,role:"tab","aria-selected":m,"aria-label":`Step ${f+1}`,disabled:!x||f===t,onClick:()=>i==null?void 0:i(f),children:p?e.jsx(w.Check,{size:8,strokeWidth:3}):null},f)})}),a&&e.jsxs(je,{secondary:!0,className:"ds-step-indicator__counter",children:[t+1," / ",s]})]})}function Gs({content:s,isStreaming:t=!1,cursor:r="line",onChunk:i,className:a="",...n}){const o=u.useRef(s);return u.useEffect(()=>{s!==o.current&&(i==null||i(s),o.current=s)},[s,i]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...n,children:[s,t&&r!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${r}`,"aria-hidden":"true"})]})}function Js({role:s="assistant",header:t,footer:r,attachments:i,isStreaming:a=!1,children:n,className:o="",...c}){const h=["ds-chat-message",`ds-chat-message--${s}`,a&&"ds-chat-message--streaming",o].filter(Boolean).join(" ");return s==="system"?e.jsx("div",{className:h,...c,children:e.jsx("span",{className:"ds-chat-message__system-label",children:n})}):s==="user"?e.jsxs("div",{className:h,...c,children:[i&&e.jsx("div",{className:"ds-chat-message__attachments",children:i}),e.jsx("div",{className:"ds-chat-message__bubble",children:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]}):e.jsxs("div",{className:h,...c,children:[t&&e.jsx("div",{className:"ds-chat-message__header",children:t}),i&&e.jsx("div",{className:"ds-chat-message__attachments",children:i}),e.jsx("div",{className:"ds-chat-message__body",children:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]})}function Zs(s,{containerRef:t,smartPause:r=!0}={}){const i=u.useRef(!1),a=u.useRef(0);u.useEffect(()=>{const n=t==null?void 0:t.current;if(!n)return;const o=()=>{const c=n.scrollHeight-n.scrollTop-n.clientHeight<64;!c&&n.scrollTop<a.current&&(i.current=!0),c&&(i.current=!1),a.current=n.scrollTop};return n.addEventListener("scroll",o,{passive:!0}),()=>n.removeEventListener("scroll",o)},[t]),u.useEffect(()=>{const n=t==null?void 0:t.current;n&&(r&&i.current||(n.scrollTop=n.scrollHeight))},s)}function Le({prompts:s,enabled:t,typingSpeed:r=38,erasingSpeed:i=18,holdTime:a=2200,betweenTime:n=380,manualPauseMs:o=5e3}){const[c,h]=u.useState(0),[f,m]=u.useState(""),p=u.useRef("typing"),x=u.useRef(0),d=u.useRef(0),_=u.useRef(null),v=u.useRef(0);u.useEffect(()=>{d.current=c},[c]),u.useEffect(()=>{if(_.current&&(clearTimeout(_.current),_.current=null),!t||s.length===0){m(""),x.current=0,p.current="typing";return}const $=()=>{const L=Date.now();if(v.current>L){_.current=setTimeout($,v.current-L);return}const D=s[d.current%s.length]??"";p.current==="typing"?(x.current+=1,m(D.slice(0,x.current)),x.current>=D.length?(p.current="holding",_.current=setTimeout($,a)):_.current=setTimeout($,r+Math.random()*28)):p.current==="holding"?(p.current="erasing",_.current=setTimeout($,i)):(x.current=Math.max(0,x.current-1),m(D.slice(0,x.current)),x.current<=0?(p.current="typing",d.current=(d.current+1)%s.length,h(d.current),_.current=setTimeout($,n)):_.current=setTimeout($,i))};return _.current=setTimeout($,260),()=>{_.current&&clearTimeout(_.current)}},[t,s,r,i,a,n]);const S=$=>{if(s.length===0)return;const L=($%s.length+s.length)%s.length,D=s[L];d.current=L,x.current=D.length,p.current="holding",v.current=Date.now()+o,h(L),m(D)},R=()=>S(d.current+1),E=()=>S(d.current-1),I=s[c%s.length]??"";return{displayed:f,currentPrompt:I,index:c,next:R,prev:E}}let Qs=0;function et({value:s="",onChange:t,onSubmit:r,onStop:i,onKeyDown:a,loading:n=!1,disabled:o=!1,placeholder:c="Let's get things done...",animatedPlaceholders:h,attachments:f,images:m,onAttachFiles:p,onAttachImages:x,onRemoveAttachment:d,onRemoveImage:_,acceptImage:v,acceptFile:S,maxImages:R,maxImageSize:E,leftSlot:I,rightSlot:$,className:L="",...D}){const N=u.useRef(null),P=u.useRef(null),O=u.useRef(0),[V,Y]=u.useState(!1),[X,W]=u.useState([]),b=j=>{const T=++Qs;W(U=>[...U,{id:T,msg:j}]),setTimeout(()=>W(U=>U.filter(H=>H.id!==T)),6e3)},k=j=>W(T=>T.filter(U=>U.id!==j)),M=j=>j.type.startsWith("image/"),z=()=>!0,q=v??M,G=S??z,g=j=>{const T=[],U=[],H=[],K=[];let Z=0,ne=R!=null?R-((m==null?void 0:m.length)??0):1/0;for(const Q of j)q(Q)?E&&Q.size>E?H.push(Q.name):ne>0?(T.push(Q),ne--):Z++:G(Q)?U.push(Q):K.push(Q.name);return{imageFiles:T,docFiles:U,tooLarge:H,skipped:K,limitExceeded:Z}},l=j=>{const{imageFiles:T,docFiles:U,tooLarge:H,skipped:K,limitExceeded:Z}=g(j);H.length&&b(`File${H.length>1?"s":""} too large${E?` (max ${E/1024/1024}MB)`:""}: ${H.join(", ")}`),K.length&&b(`Skipped unsupported file${K.length>1?"s":""}: ${K.join(", ")}`),Z&&b(`Max ${R} images per message`),x&&T.length&&x(T);const ne=U.concat(x?[]:T);p&&ne.length&&p(ne)};u.useEffect(()=>{const j=P.current;j&&(j.style.height="auto",j.style.height=`${Math.min(j.scrollHeight,200)}px`)},[s]),u.useEffect(()=>{const j=T=>{var H,K,Z;if(n||o)return;const U=(H=T.target)==null?void 0:H.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(K=T.target)!=null&&K.isContentEditable||T.ctrlKey||T.metaKey||T.altKey||T.key.length!==1&&T.key!=="Backspace"&&T.key!=="Delete"||(Z=P.current)==null||Z.focus()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[n,o]);const y=j=>{j.preventDefault(),O.current++,j.dataTransfer.types.includes("Files")&&Y(!0)},B=j=>{j.preventDefault(),O.current--,O.current===0&&Y(!1)},C=j=>j.preventDefault(),ee=j=>{j.preventDefault(),O.current=0,Y(!1);const T=Array.from(j.dataTransfer.files);T.length&&l(T)},te=j=>{const T=Array.from(j.target.files||[]);N.current&&(N.current.value=""),T.length&&l(T)},F=j=>{var Q;if(!x)return;const T=(Q=j.clipboardData)==null?void 0:Q.items;if(!T)return;const U=[];for(const Ce of T){const we=Ce.getAsFile();we&&U.push(we)}if(U.length===0)return;const{imageFiles:H,tooLarge:K,skipped:Z,limitExceeded:ne}=g(U);K.length&&b(`File${K.length>1?"s":""} too large: ${K.join(", ")}`),Z.length&&b(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),ne&&b(`Max ${R} images per message`),H.length&&(j.preventDefault(),x(H))},J=!n&&!o&&!!(h!=null&&h.length)&&s.length===0,re=Le({prompts:h??[],enabled:J}),fe=j=>{if(J){if(j.key==="ArrowDown"||j.key==="ArrowRight"){j.preventDefault(),re.next();return}if(j.key==="ArrowUp"||j.key==="ArrowLeft"){j.preventDefault(),re.prev();return}if(j.key==="Tab"&&!j.shiftKey){j.preventDefault(),t==null||t(re.currentPrompt);return}}a==null||a(j)},Oe=(s.trim()||(m==null?void 0:m.length)>0||(f==null?void 0:f.length)>0)&&!o,Ne=p||x;return e.jsxs("div",{className:["ds-prompt-input",L].filter(Boolean).join(" "),...D,children:[Ne&&e.jsx("input",{ref:N,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:te}),e.jsxs("div",{className:["ds-prompt-input__box",V&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:B,onDragOver:C,onDrop:ee,children:[V&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:P,value:s,onChange:j=>t==null?void 0:t(j.target.value),onKeyDown:fe,onPaste:F,placeholder:J?"":c,disabled:n||o,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:re.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),m&&m.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:m.map((j,T)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:j.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>_==null?void 0:_(T),"aria-label":"Remove image",type:"button",children:e.jsx(w.X,{size:12,strokeWidth:2})})]},T))}),X.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:X.map(j=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:j.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>k(j.id),"aria-label":"Dismiss",children:e.jsx(w.X,{size:A[1],strokeWidth:1.5})})]},j.id))}),f&&f.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:f.map((j,T)=>e.jsx(de,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[j.uploading?e.jsx(w.Loader,{size:A[1],strokeWidth:1.5,className:"spin"}):e.jsx(w.Paperclip,{size:A[1],strokeWidth:1.5}),j.filename,j.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>d==null?void 0:d(T),children:e.jsx(w.X,{size:A[1],strokeWidth:1.5})})]})},T))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[Ne&&e.jsx(ie,{variant:"ghost",size:"xs",icon:e.jsx(w.Paperclip,{size:A[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var j;return(j=N.current)==null?void 0:j.click()}}),I,$,e.jsx("div",{className:"ds-prompt-input__spacer"}),n?e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(w.Square,{size:A[2],strokeWidth:1.5}),onClick:i,"aria-label":"Stop"}):e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(w.ArrowUp,{size:A[2],strokeWidth:1.5}),onClick:r,disabled:!Oe,"aria-label":"Send"})]})]})]})}const Ee={fast:0,standard:1,premium:2};function st({models:s=[],value:t,onChange:r,size:i="xs",minTier:a,showAutoOption:n=!1,groupByTier:o=!0,className:c="",...h}){const[f,m]=u.useState(!1),p=u.useRef(null),x=u.useRef(null),[d,_]=u.useState({}),v=s.filter(N=>!a||N.name==="auto"?!0:(Ee[N.tier]??1)>=(Ee[a]??1)),S=v.find(N=>N.name==="auto"),R=v.filter(N=>N.name!=="auto"),E=s.find(N=>N.name===t);u.useEffect(()=>{var V;if(!f)return;const N=(V=p.current)==null?void 0:V.getBoundingClientRect();N&&_({position:"fixed",zIndex:"var(--z-dropdown, 500)",top:N.bottom+4,right:window.innerWidth-N.right});const P=Y=>{var X,W;!((X=p.current)!=null&&X.contains(Y.target))&&!((W=x.current)!=null&&W.contains(Y.target))&&m(!1)},O=Y=>{Y.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",P),document.addEventListener("keydown",O),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",O)}},[f]);const I=N=>{r==null||r(N),m(!1)},$=N=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",N.name===t&&"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(w.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}),N.tier&&e.jsx("span",{className:"ds-model-picker__tier-badge","data-tier":N.tier,children:N.tier})]},N.name),L=()=>o?["fast","standard","premium"].flatMap(N=>{const P=R.filter(O=>O.tier===N);return P.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":N,children:N.charAt(0).toUpperCase()+N.slice(1)},`lbl-${N}`),...P.map($)]:[]}):R.map($),D=f&&e.jsxs("div",{ref:x,className:"ds-model-picker__menu",style:d,children:[n&&S&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",t==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(w.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)"})]}),R.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),L()]});return e.jsxs("div",{ref:p,className:["ds-model-picker",c].filter(Boolean).join(" "),...h,children:[e.jsxs("button",{type:"button",className:"ds-model-picker__trigger",onClick:()=>m(N=>!N),"aria-haspopup":"listbox","aria-expanded":f,children:[E!=null&&E.icon?e.jsx("span",{children:E.icon}):e.jsx(w.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(E==null?void 0:E.displayName)||(E==null?void 0:E.name)||t}),(E==null?void 0:E.tier)&&e.jsx("span",{className:"ds-model-picker__tier-badge","data-tier":E.tier,children:E.tier})]}),typeof document<"u"&&ue.createPortal(D,document.body)]})}function me(s){return s!=null&&s.length?"p. "+s.join(", "):null}function tt(s){const t=new Map;for(const r of s)t.has(r.filename)||t.set(r.filename,{filename:r.filename,url:r.url,items:[]}),t.get(r.filename).items.push(r);return[...t.values()]}function rt({sources:s=[],layout:t="list",title:r="Sources",maxVisible:i=5,onSourceClick:a}){const[n,o]=u.useState(!1),c=tt(s),h=c.length>i,f=n?c:c.slice(0,i),m=s.some(x=>x.snippet),p=["ds-sources-panel",t==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return t==="compact"?e.jsxs("div",{className:p,children:[f.map(x=>{const d=x.items.map(v=>v.page).filter(Boolean),_=!!a;return e.jsxs("div",{className:`ds-sources-panel__compact-row${_?" ds-sources-panel__compact-row--clickable":""}`,onClick:_?()=>a(x.items[0]):void 0,children:[e.jsx(w.FileText,{size:A[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),d.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:me(d)})]},x.filename)}),h&&!n&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>o(!0),children:["+",c.length-i," more sources"]})]}):e.jsxs("div",{className:p,children:[r&&e.jsx("div",{className:"ds-sources-panel__title",children:r}),f.map(x=>{const d=x.items.map(v=>v.page).filter(Boolean),_=!!a;return m?e.jsx(ve,{title:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),d.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:me(d)})]}),padding:"s",children:x.items.map((v,S)=>e.jsx("div",{className:`ds-sources-panel__snippet${_?" ds-sources-panel__snippet--clickable":""}`,onClick:_?()=>a(v):void 0,children:v.snippet??`p. ${v.page}`},S))},x.filename):e.jsxs("div",{className:`ds-sources-panel__row${_?" ds-sources-panel__row--clickable":""}`,onClick:_?()=>a(x.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),d.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:me(d)})]},x.filename)}),h&&!n&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>o(!0),children:["+",c.length-i," more sources"]})]})}function $e(s){return s>=1e6?(s/1e6).toFixed(1).replace(/\.0$/,"")+"M":s>=1e3?(s/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(s)}function nt({used:s,limit:t,size:r="s",showCount:i=!0,showPercent:a=!1,warningThreshold:n=.8,errorThreshold:o=1}){const c=t>0?s/t:0,h=Math.min(c*100,100),f=c>=o?"error":c>=n?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${r}`,role:"meter","aria-valuenow":s,"aria-valuemax":t,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:`${h}%`}})}),(i||a)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${f}`,children:[i&&e.jsxs("span",{children:[$e(s)," / ",$e(t)," tokens"]}),a&&e.jsxs("span",{children:[Math.round(c*100),"%"]})]})]})}const Re=5;function at(s){return s<.34?"low":s<.67?"medium":"high"}function it({value:s=0,size:t="xs",showLabel:r="none",layout:i="inline"}){const a=Math.max(0,Math.min(1,s)),n=Math.round(a*Re),o=at(a);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${t}`,`ds-confidence-bar--${o}`,i==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:Re},(c,h)=>e.jsx("div",{className:`ds-confidence-bar__seg${h<n?" ds-confidence-bar__seg--filled":""}`},h))}),r==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:o})]})}const ot={add:"+",remove:"-",context:" "};function pe({line:s,lineNumbers:t}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${s.type}`,children:[t&&s.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:s.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:ot[s.type]}),e.jsx("span",{className:"ds-diff-view__text",children:s.text})]})}function ct({lines:s=[],layout:t="inline",wordWrap:r=!1,lineNumbers:i=!0,maxHeight:a,title:n}){const o=["ds-diff-view",`ds-diff-view--${t}`,r&&"ds-diff-view--wrap"].filter(Boolean).join(" "),c=a?{maxHeight:a,overflowY:"auto"}:void 0;if(t==="split"){const h=s.filter(m=>m.type==="remove"||m.type==="context"),f=s.filter(m=>m.type==="add"||m.type==="context");return e.jsxs("div",{className:o,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsxs("div",{className:"ds-diff-view__body",style:c,children:[e.jsx("div",{className:"ds-diff-view__split-col",children:h.map((m,p)=>e.jsx(pe,{line:m,lineNumbers:i},p))}),e.jsx("div",{className:"ds-diff-view__split-col",children:f.map((m,p)=>e.jsx(pe,{line:m,lineNumbers:i},p))})]})]})}return e.jsxs("div",{className:o,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsx("div",{className:"ds-diff-view__body",style:c,children:s.map((h,f)=>e.jsx(pe,{line:h,lineNumbers:i},f))})]})}exports.Accordion=ve;exports.Alert=Qe;exports.AnimatedNumber=Os;exports.Avatar=xs;exports.Badge=de;exports.Banner=Ds;exports.Breadcrumb=$s;exports.Button=ie;exports.Card=Se;exports.ChatMessage=Js;exports.Checkbox=us;exports.Code=ts;exports.CodeAccordion=Ie;exports.ConfidenceBar=it;exports.CopyButton=Hs;exports.DiffView=ct;exports.Drawer=As;exports.DrawerFooter=_e;exports.Dropdown=Bs;exports.EmptyState=gs;exports.FormField=ks;exports.H1=He;exports.H2=Xe;exports.H3=Ke;exports.H4=Ge;exports.InView=Cs;exports.Input=Ue;exports.Link=rs;exports.Modal=ss;exports.ModalFooter=xe;exports.ModelPicker=st;exports.P1=Je;exports.P2=Ae;exports.P3=je;exports.Pagination=Rs;exports.ProgressBar=Ps;exports.PromptInput=et;exports.Radio=fs;exports.ReasoningBlock=Xs;exports.SegmentedControl=is;exports.Select=Ye;exports.Skeleton=De;exports.SourcesPanel=rt;exports.Spinner=Te;exports.Stat=Es;exports.StepIndicator=Ks;exports.Stepper=qe;exports.StreamingText=Gs;exports.Tab=as;exports.Table=_s;exports.TableBody=js;exports.TableHead=bs;exports.TableRow=vs;exports.TableSubheaderRow=Ns;exports.Tabs=ns;exports.Td=ys;exports.Textarea=Ve;exports.Th=ws;exports.ToastContainer=Vs;exports.Toggle=ds;exports.TokenCounter=nt;exports.ToolCallCard=qs;exports.Tooltip=ls;exports.iconSizes=A;exports.useAnimatedNumber=Be;exports.useAnimatedPlaceholder=Le;exports.useInView=Pe;exports.useStreamScroll=Zs;exports.useToast=Ws;
22
+ <%s key={someKey} {...props} />`,F,C,J,C),k[C+F]=!0)}if(C=null,L!==void 0&&(r(L),C=""+L),i(y)&&(r(y.key),C=""+y.key),"key"in y){L={};for(var ne in y)ne!=="key"&&(L[ne]=y[ne])}else L=y;return C&&l(L,typeof c=="function"?c.displayName||c.name||"Unknown":c),d(c,C,L,a(),se,re)}function h(c){x(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===P&&(c._payload.status==="fulfilled"?x(c._payload.value)&&c._payload.value._store&&(c._payload.value._store.validated=1):c._store&&(c._store.validated=1))}function x(c){return typeof c=="object"&&c!==null&&c.$$typeof===j}var u=f,j=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),$=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),q=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,b=Array.isArray,w=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(c){return c()}};var T,M={},H=u.react_stack_bottom_frame.bind(u,n)(),X=w(o(n)),k={};de.Fragment=A,de.jsx=function(c,y,L){var F=1e4>q.recentlyCreatedOwnerStacks++;return m(c,y,L,!1,F?Error("react-stack-top-frame"):H,F?w(o(c)):X)},de.jsxs=function(c,y,L){var F=1e4>q.recentlyCreatedOwnerStacks++;return m(c,y,L,!0,F?Error("react-stack-top-frame"):H,F?w(o(c)):X)}}()),de}process.env.NODE_ENV==="production"?he.exports=We():he.exports=Ue();var e=he.exports;function Se({size:s="m",color:t="default",className:r="",...o}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,r].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...o})}const Ve={xs:12,s:14,m:16,l:20};function ie({children:s,variant:t="primary",size:r="m",fullWidth:o=!1,icon:a,disabled:n=!1,state:i="idle",onClick:l,type:p="button",href:d,"aria-label":m,className:h="",...x}){const u=a&&!s,j=i==="loading",v=i==="success",A=i==="error",S=j||v||A,B=r==="xs"?"s":"m",E=Ve[r]??16,$=j?e.jsx(Se,{size:B}):v?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(N.Check,{size:E,strokeWidth:2.5})}):A?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(N.X,{size:E,strokeWidth:2.5})}):null,z=["ds-button",`ds-button--${t}`,`ds-button--${r}`,o&&"ds-button--full",u&&"ds-button--icon-only",h].filter(Boolean).join(" "),I=i!=="idle"?i:void 0,V=e.jsxs(e.Fragment,{children:[S?$:a&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:a}),s]});if(d){const Y=P=>{if(n||j){P.preventDefault();return}P.metaKey||P.ctrlKey||P.button===1||(P.preventDefault(),l==null||l(P))};return e.jsx("a",{className:z,href:n||j?void 0:d,onClick:Y,"aria-label":m,"aria-disabled":n||j?"true":void 0,"aria-busy":j?"true":void 0,"data-state":I,...x,children:V})}return e.jsx("button",{type:p,className:z,disabled:n,onClick:j?void 0:l,"aria-label":m,"aria-busy":j?"true":void 0,"data-state":I,...x,children:V})}function He({label:s,error:t,hint:r,fullWidth:o=!0,icon:a,iconRight:n,onIconRightClick:i,size:l="m",disabled:p,id:d,...m}){const h=d||`input-${f.useId()}`,x=r?`${h}-hint`:void 0,u=t?`${h}-error`:void 0,j=u||x;return e.jsxs("div",{className:`ds-input-wrapper ${o?"ds-input-wrapper--full":""} ${p?"ds-input-wrapper--disabled":""} ${t?"ds-input-wrapper--error":""}`,children:[s&&e.jsx("label",{className:"ds-input-label",htmlFor:h,children:s}),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:h,className:`ds-input ds-input--${l} ${a?"ds-input--with-icon":""} ${n?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:p,"aria-invalid":t?"true":"false","aria-describedby":j,...m}),n&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:n})]}),r&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:r}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:u,className:"ds-input-error",role:"alert",children:t})})})]})}function Ye({label:s,error:t,hint:r,fullWidth:o=!0,size:a="m",disabled:n,id:i,resize:l=!0,rows:p=3,...d}){const m=i||`textarea-${f.useId()}`,h=r?`${m}-hint`:void 0,x=t?`${m}-error`:void 0,u=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${o?"ds-textarea-wrapper--full":""} ${n?"ds-textarea-wrapper--disabled":""}`,children:[s&&e.jsx("label",{className:"ds-textarea-label",htmlFor:m,children:s}),e.jsx("textarea",{id:m,className:`ds-textarea ds-textarea--${a} ${t?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:n,"aria-invalid":t?"true":"false","aria-describedby":u,rows:p,...d}),r&&!t&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:r}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function qe({label:s,value:t,onChange:r,options:o=[],placeholder:a="Select option",error:n,fullWidth:i=!0,size:l="m",disabled:p=!1,id:d,...m}){const[h,x]=f.useState(!1),[u,j]=f.useState(!1),[v,A]=f.useState({}),[S,B]=f.useState("down"),[E,$]=f.useState(-1),z=f.useRef(null),I=f.useRef(null),V=f.useRef(null),Y=f.useRef(null),P=d||`select-${f.useId()}`,g=`${P}-label`,O=n?`${P}-error`:void 0,q=150,W=(k=!1)=>{u||(j(!0),$(-1),Y.current=setTimeout(()=>{var c;x(!1),j(!1),k&&((c=V.current)==null||c.focus())},q))},b=k=>{clearTimeout(Y.current),j(!1);const c=k!==void 0?k:Math.max(o.findIndex(y=>y.value===t),0);$(c),x(!0)};f.useEffect(()=>()=>clearTimeout(Y.current),[]);const w=()=>{var re;const k=(re=z.current)==null?void 0:re.getBoundingClientRect();if(!k)return;const c=window.innerHeight,y=c-k.bottom,L=k.top,se=y<300&&L>y;B(se?"up":"down"),A(se?{bottom:c-k.top+4,left:k.left,width:k.width}:{top:k.bottom+4,left:k.left,width:k.width})};f.useEffect(()=>{if(h)return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[h]),f.useEffect(()=>{const k=c=>{z.current&&!z.current.contains(c.target)&&I.current&&!I.current.contains(c.target)&&W()};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[u]),f.useEffect(()=>{var c;if(!h||E<0||!I.current)return;(c=I.current.querySelectorAll(".ds-select-option")[E])==null||c.scrollIntoView({block:"nearest"})},[E,h]);const T=k=>{switch(k.key){case"ArrowDown":k.preventDefault(),h?$(c=>Math.min(c+1,o.length-1)):b();break;case"ArrowUp":k.preventDefault(),h?$(c=>Math.max(c-1,0)):b(o.length-1);break;case"Home":h&&(k.preventDefault(),$(0));break;case"End":h&&(k.preventDefault(),$(o.length-1));break;case"Enter":case" ":k.preventDefault(),h?E>=0&&(r==null||r(o[E].value),W(!0)):b();break;case"Escape":h&&(k.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},M=o.find(k=>k.value===t),H=l==="xs"?D[1]:l==="small"?D[2]:D[3],X=h&&e.jsx("div",{ref:I,role:"listbox","aria-labelledby":s?g:void 0,tabIndex:-1,className:["ds-select-dropdown",`ds-select-dropdown--${l}`,`ds-select-dropdown--${S}`,u&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:v,children:o.map((k,c)=>e.jsx("button",{id:`${P}-opt-${c}`,type:"button",role:"option",tabIndex:-1,"aria-selected":t===k.value,className:["ds-select-option",`ds-select-option--${l}`,t===k.value&&"ds-select-option--selected",c===E&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{r==null||r(k.value),W(!0)},children:k.label},k.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${p?"ds-select-wrapper--disabled":""}`,children:[s&&e.jsx("label",{id:g,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:z,children:e.jsxs("button",{ref:V,type:"button",id:P,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&E>=0?`${P}-opt-${E}`:void 0,"aria-labelledby":s?g:void 0,"aria-invalid":n?"true":"false","aria-describedby":O,className:`ds-select-trigger ds-select-trigger--${l} ${n?"ds-select-trigger--error":""}`,onClick:()=>{p||(h?W():b())},onKeyDown:T,disabled:p,...m,children:[e.jsx("span",{className:M?"":"ds-select-placeholder",children:(M==null?void 0:M.label)||a}),e.jsx(N.ChevronDown,{size:H,strokeWidth:1.5,className:`ds-select-icon ${h&&S==="down"?"ds-select-icon--open":""} ${h&&S==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),n&&e.jsx("span",{id:O,className:"ds-select-error",role:"alert",children:n}),typeof document<"u"&&ue.createPortal(X,document.body)]})}function Xe({label:s,value:t=0,onChange:r,min:o=0,max:a=100,step:n=1,size:i="m",disabled:l=!1,hint:p,error:d,...m}){const h=()=>{if(l)return;const S=Math.min(Number(t)+n,a);r==null||r(S)},x=()=>{if(l)return;const S=Math.max(Number(t)-n,o);r==null||r(S)},u=S=>{if(l)return;const B=S.target.value;if(B===""){r==null||r(o);return}const E=Number(B);if(!isNaN(E)){const $=Math.min(Math.max(E,o),a);r==null||r($)}},j=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",d&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),v=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),A=i==="xs"?D[1]:i==="small"?D[2]:D[3];return e.jsxs("div",{className:j,children:[s&&e.jsx("label",{className:"ds-stepper-label",children:s}),e.jsxs("div",{className:v,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:l||t<=o,"aria-label":"Decrease",children:e.jsx(N.Minus,{size:A,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:u,min:o,max:a,step:n,disabled:l,...m}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:h,disabled:l||t>=a,"aria-label":"Increase",children:e.jsx(N.Plus,{size:A,strokeWidth:1.5})})]}),p&&!d&&e.jsx("div",{className:"ds-stepper-hint",children:p}),d&&e.jsx("div",{className:"ds-stepper-error",children:d})]})}function Ke({children:s,padding:t="m",variant:r="info",hover:o=!1,onClick:a,href:n,disabled:i=!1,...l}){const d=(o?"interactive":r)==="interactive"||a||n,m=["ds-card",`ds-card--${t}`,d&&"ds-card--interactive"].filter(Boolean).join(" ");if(n){const u=j=>{if(i){j.preventDefault();return}j.metaKey||j.ctrlKey||j.button===1||(j.preventDefault(),a==null||a(j))};return e.jsx("a",{className:m,href:i?void 0:n,onClick:u,"aria-disabled":i?"true":void 0,...l,children:s})}const h=d&&a?"button":"div",x=d&&a?{type:"button",onClick:a,disabled:i}:{};return e.jsx(h,{className:m,role:d&&!a?"article":void 0,...x,...l,children:s})}function Ge({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function Je({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function Ze({children:s,...t}){return e.jsx("h3",{className:"ds-h3",...t,children:s})}function Qe({children:s,...t}){return e.jsx("h4",{className:"ds-h4",...t,children:s})}function es({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...r,children:s})}function Ae({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...r,children:s})}function ve({children:s,secondary:t=!1,...r}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...r,children:s})}function ee({children:s,variant:t="default",size:r="m",role:o,...a}){const n=["ds-badge",`ds-badge--${t}`,`ds-badge--${r}`].filter(Boolean).join(" "),i=o||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:n,role:i,...a,children:s})}const ss={info:N.Info,success:N.CheckCircle,warning:N.AlertTriangle,error:N.XCircle};function ts({children:s,variant:t="info",title:r,onClose:o,role:a,...n}){const i=ss[t],l=a||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${r?"":"ds-alert--no-title"}`,role:l,...n,children:[i&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(i,{size:D[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})]}),o&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:o,"aria-label":"Close alert",children:e.jsx(N.X,{size:D[3],strokeWidth:1.5})})]})}const rs=200;function ns({children:s,title:t,onClose:r,size:o="m",...a}){const n=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),d=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},rs))};f.useEffect(()=>{const u=v=>{v.key==="Escape"&&d()},j=v=>{n.current&&!n.current.contains(v.target)&&d()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",j),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",j)}},[r,l]);const m=f.Children.toArray(s),h=m.find(u=>(u==null?void 0:u.type)===xe),x=m.filter(u=>(u==null?void 0:u.type)!==xe);return e.jsx("div",{className:["ds-modal-overlay",l&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("div",{className:`ds-modal ds-modal--${o}`,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[(t||r)&&e.jsxs("div",{className:"ds-modal__header",children:[t&&e.jsx("h3",{id:i,className:"ds-modal__title",children:t}),r&&e.jsx(ie,{variant:"ghost",size:"small",icon:e.jsx(N.X,{size:D[2],strokeWidth:1.5}),onClick:d,"aria-label":"Close modal"})]}),e.jsx("div",{className:"ds-modal__body",children:x}),h]})})}function xe({children:s}){return e.jsx("div",{className:"ds-modal__footer",children:s})}function De({children:s,title:t="Code",defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="s",className:i="",...l}){const[p,d]=f.useState(r),m=o!==void 0,h=m?o:p,x=()=>{m?a==null||a(!o):d(j=>!j)},u=["ds-code-accordion",`ds-code-accordion--${n}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:u,...l,children:[e.jsxs("button",{type:"button",className:"ds-code-accordion__header",onClick:x,"aria-expanded":h,children:[e.jsx("span",{className:"ds-code-accordion__title",children:t}),e.jsx(N.ChevronDown,{size:D[2],strokeWidth:1.5,className:`ds-code-accordion__icon ${h?"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",children:e.jsx("code",{children:s})})})})]})}function as({children:s,block:t=!1,collapsible:r=!1,title:o="Code",defaultExpanded:a=!1,...n}){return t?r?e.jsx(De,{title:o,defaultExpanded:a,...n,children:s}):e.jsx("pre",{className:"ds-code-block",...n,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...n,children:s})}function os({href:s,children:t,onClick:r,target:o,rel:a,...n}){const l=o==="_blank"?a?`${a} noopener noreferrer`:"noopener noreferrer":a;return e.jsx("a",{href:s,className:"ds-link",onClick:r,target:o,rel:l,...n,children:t})}function is({children:s,size:t="m",variant:r="ghost",...o}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...o,children:f.Children.map(s,a=>f.isValidElement(a)?f.cloneElement(a,{size:t,variant:r}):a)})}function ls({children:s,selected:t=!1,onClick:r,size:o="m",variant:a="ghost",disabled:n=!1,icon:i,href:l,...p}){const d=i&&!s,m=["ds-tab",`ds-tab--${o}`,`ds-tab--${a}`,t&&"ds-tab--selected",d&&"ds-tab--icon-only"].filter(Boolean).join(" "),h=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),s]});if(l){const x=u=>{if(n){u.preventDefault();return}u.metaKey||u.ctrlKey||u.button===1||(u.preventDefault(),r==null||r(u))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":n?"true":void 0,className:m,href:n?void 0:l,onClick:x,...p,children:h})}return e.jsx("button",{role:"tab","aria-selected":t,className:m,onClick:r,disabled:n,...p,children:h})}function cs({options:s,value:t,onChange:r,size:o="m",disabled:a=!1}){const n=f.useRef(null),i=f.useRef(null),[l,p]=f.useState(!1),d=f.useRef(!1),m=f.useRef(null),h=f.useRef(null),x=()=>{if(!n.current)return;const u=n.current.querySelector(`[data-value="${t}"]`);if(!u)return;const j=n.current.getBoundingClientRect(),v=u.getBoundingClientRect(),A=v.left-j.left,S=v.width;i.current?(i.current.style.transition=d.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=A+"px",i.current.style.width=S+"px",d.current=!1):(p(!0),requestAnimationFrame(()=>{if(!i.current||!n.current)return;const B=n.current.querySelector(`[data-value="${t}"]`);if(!B)return;const E=n.current.getBoundingClientRect(),$=B.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=$.left-E.left+"px",i.current.style.width=$.width+"px"}))};return h.current=x,f.useLayoutEffect(()=>{const u=m.current!==t;m.current=t,d.current=l&&u,x()}),f.useEffect(()=>{if(!n.current)return;const u=new ResizeObserver(()=>{d.current=!1,h.current()});return u.observe(n.current),()=>u.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${o}`,a&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:n,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(u=>e.jsxs("button",{type:"button","data-value":u.value,className:["ds-seg__btn",t===u.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!a&&r(u.value),"aria-pressed":t===u.value,disabled:a,children:[u.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:u.icon}),u.label]},u.value))]})}function fe({children:s,title:t,defaultExpanded:r=!1,expanded:o,onToggle:a,padding:n="m",...i}){const[l,p]=f.useState(r),d=o!==void 0,m=d?o:l,h=()=>{d?a==null||a(!o):p(u=>!u)},x=["ds-accordion",`ds-accordion--${n}`,m&&"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":m,children:[e.jsx("span",{className:"ds-accordion__title",children:t}),e.jsx(N.ChevronDown,{size:D[2],strokeWidth:1.5,className:`ds-accordion__icon ${m?"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:s})})})]})}const te=8,oe=8;function ds(s,t,r){const o=window.innerWidth;let a,n;switch(s){case"top":a=t.top-r.height-te,n=t.left+t.width/2-r.width/2;break;case"bottom":a=t.bottom+te,n=t.left+t.width/2-r.width/2;break;case"left":a=t.top+t.height/2-r.height/2,n=t.left-r.width-te;break;case"right":a=t.top+t.height/2-r.height/2,n=t.right+te;break;default:a=t.bottom+te,n=t.left}const i=Math.max(oe,Math.min(o-r.width-oe,n)),l=n-i;return{top:a,left:i,arrowOffset:l}}function us(s,t,r){const o=window.innerWidth,a=window.innerHeight;if(s.top>=t+te+oe)return"top";if(a-s.bottom>=t+te+oe)return"bottom";if(o-s.right>=r+te+oe)return"right";if(s.left>=r+te+oe)return"left";const n=Math.max(s.top,a-s.bottom,s.left,o-s.right);return n===s.top?"top":n===a-s.bottom?"bottom":n===o-s.right?"right":"left"}function fs({children:s,content:t,position:r,...o}){const[a,n]=f.useState(!1),[i,l]=f.useState({visibility:"hidden"}),[p,d]=f.useState(r||"top"),m=f.useRef(null),h=f.useRef(null),x=f.useRef(!1),u=()=>{if(!m.current||!h.current)return;const v=m.current.getBoundingClientRect(),A=h.current.getBoundingClientRect(),S=r||us(v,A.height,A.width),{top:B,left:E,arrowOffset:$}=ds(S,v,A);d(S),l({position:"fixed",top:B,left:E,visibility:"visible","--arrow-offset":`${$}px`})};if(f.useEffect(()=>{if(!a)return;l({position:"fixed",visibility:"hidden"});const v=requestAnimationFrame(u);return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{cancelAnimationFrame(v),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[a,r]),f.useEffect(()=>{if(!a)return;const v=A=>{m.current&&!m.current.contains(A.target)&&n(!1)};return document.addEventListener("touchstart",v),()=>document.removeEventListener("touchstart",v)},[a]),!t)return s;const j=a&&e.jsx("div",{ref:h,className:`ds-tooltip ds-tooltip--${p}`,role:"tooltip",style:i,children:t});return e.jsxs("div",{ref:m,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||n(!0)},onMouseLeave:()=>{x.current||n(!1)},onTouchStart:()=>{x.current=!0,n(v=>!v)},...o,children:[s,typeof document<"u"&&ue.createPortal(j,document.body)]})}function ms({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const l=n||`toggle-${f.useId()}`,p=["ds-toggle",`ds-toggle--${r}`,o&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:p,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:s,onChange:d=>t==null?void 0:t(d.target.checked),disabled:o,...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 ps({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,id:n,...i}){const l=n||`checkbox-${f.useId()}`,p=["ds-checkbox",`ds-checkbox--${r}`,o&&"ds-checkbox--disabled"].filter(Boolean).join(" "),d=r==="xs"?10:r==="small"?14:r==="large"?20:16;return e.jsxs("label",{className:p,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:s,onChange:m=>t==null?void 0:t(m.target.checked),disabled:o,...i}),e.jsx("span",{className:"ds-checkbox__box",children:s&&e.jsx(N.Check,{size:d,strokeWidth:2.5,className:"ds-checkbox__icon"})}),a&&e.jsx("span",{className:"ds-checkbox__label",children:a})]})}function hs({checked:s=!1,onChange:t,size:r="m",disabled:o=!1,label:a,name:n,value:i,id:l,...p}){const d=l||`radio-${f.useId()}`,m=["ds-radio",`ds-radio--${r}`,o&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,htmlFor:d,children:[e.jsx("input",{type:"radio",id:d,className:"ds-radio__input",checked:s,onChange:h=>t==null?void 0:t(h.target.checked),disabled:o,name:n,value:i,...p}),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 Ie({width:s,height:t,shape:r="rect",aspectRatio:o,className:a="",style:n={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${r}`,a].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:o,...n},"aria-hidden":"true",...i})}function xs({lines:s=1,lastLineWidth:t="70%",gap:r,className:o="",style:a={},...n}){return e.jsx("span",{className:["ds-skeleton-text",o].filter(Boolean).join(" "),style:{gap:r,...a},"aria-hidden":"true",...n,children:Array.from({length:s},(i,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===s-1&&s>1?{width:t}:void 0},l))})}Ie.Text=xs;function bs(s){let t=2166136261;for(let r=0;r<s.length;r++)t^=s.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t%360}function js(s){if(!s)return"";const t=s.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():s[0].toUpperCase()}function _s({seed:s,icon:t,src:r,size:o=32,className:a="",style:n={},...i}){const l=bs(s??""),[p,d]=f.useState(!1),m=t??e.jsx("span",{className:"ds-avatar__initials",children:js(s)});return e.jsx("div",{className:["ds-avatar",a].filter(Boolean).join(" "),style:{width:o,height:o,"--ds-avatar-h":l,...n},"aria-hidden":"true",...i,children:r&&!p?e.jsx("img",{src:r,alt:"",onError:()=>d(!0)}):m})}function vs({children:s,size:t="compact",stickyTop:r,maxHeight:o,className:a="",style:n={},...i}){const l={...o?{maxHeight:o}:{},...r!==void 0?{"--ds-table-sticky-top":typeof r=="number"?`${r}px`:r}:{},...n};return e.jsx("div",{className:["ds-table-wrap",o?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${t}`,a].filter(Boolean).join(" "),...i,children:s})})}function ws({children:s,...t}){return e.jsx("thead",{...t,children:s})}function Ns({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function gs({children:s,interactive:t,selected:r,subheader:o,exiting:a,updated:n,className:i="",onClick:l,...p}){return e.jsx("tr",{className:["ds-table-row",t||l?"ds-table-row--interactive":"",r?"ds-table-row--selected":"",o?"ds-table-row--subheader":"",a?"ds-table-row--exiting":"",n?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...p,children:s})}function ys({children:s,colSpan:t=999,...r}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...r,children:e.jsx("td",{colSpan:t,children:s})})}function ks({children:s,align:t="left",sortDir:r,onSort:o,width:a,className:n="",style:i={},...l}){const p=!!o||r!==void 0,d=r==="asc"?N.ChevronUp:r==="desc"?N.ChevronDown:N.ChevronsUpDown;return e.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",r?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",n].filter(Boolean).join(" "),onClick:o,style:{width:a,...i},...l,children:p?e.jsxs("span",{className:"ds-th__inner",children:[s,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(d,{size:11,strokeWidth:2.5})})]}):s})}function Es({children:s,align:t="left",secondary:r,muted:o,truncate:a,nowrap:n,className:i="",...l}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",r?"ds-table-cell--secondary":"",o?"ds-table-cell--muted":"",a?"ds-table-cell--truncate":"",n?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:s})}function Ts({icon:s,title:t,description:r,action:o,size:a="m",className:n="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${a}`,n].filter(Boolean).join(" "),...i,children:[s&&e.jsx("div",{className:"ds-empty-state__icon",children:s}),e.jsx("div",{className:"ds-empty-state__title",children:t}),r&&e.jsx("div",{className:"ds-empty-state__description",children:r}),o&&e.jsx("div",{className:"ds-empty-state__action",children:o})]})}function $s({label:s,hint:t,error:r,required:o=!1,disabled:a=!1,htmlFor:n,children:i,className:l="",style:p,...d}){const m=f.useId(),h=n??m,x=`${h}-hint`,u=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":r?"error":void 0,"data-required":o?"":void 0,"data-disabled":a?"":void 0,style:p,...d,children:[s&&e.jsx("label",{className:"ds-field-label",htmlFor:h,children:s}),e.jsx("div",{className:"ds-field-control",children:i}),t&&!r&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),r&&e.jsx("p",{className:"ds-field-error",id:u,role:"alert",children:r})]})}function Rs({label:s,value:t,delta:r,size:o="m",inline:a=!1,className:n="",style:i,...l}){const p=r!=null&&r.startsWith("+")?"up":r!=null&&r.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${o}`,a&&"ds-stat--inline",n].filter(Boolean).join(" "),style:i,...l,children:[s&&e.jsx("span",{className:"ds-stat-label",children:s}),t!=null&&e.jsx("span",{className:"ds-stat-value",children:t}),r!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${p}`,children:r})]})}function Ss({children:s,separator:t="/","aria-label":r="Breadcrumb",className:o="",style:a,...n}){const i=f.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${o?` ${o}`:""}`,"aria-label":r,style:a,...n,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:i.map((l,p)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[l,p<i.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:t})]},p))})})}function As({page:s,total:t,onChange:r,siblings:o=1,"aria-label":a="Pagination",className:n="",style:i,...l}){const p=Ds(s,t,o);return e.jsxs("nav",{className:`ds-pagination${n?` ${n}`:""}`,"aria-label":a,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(N.ChevronLeft,{size:16})}),p.map((d,m)=>d==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${m}`):e.jsx("button",{className:`ds-pagination-page${d===s?" ds-pagination-page--current":""}`,onClick:()=>d!==s&&(r==null?void 0:r(d)),"aria-current":d===s?"page":void 0,"aria-label":`Page ${d}`,children:d},d)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>r==null?void 0:r(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(N.ChevronRight,{size:16})})]})}function Ds(s,t,r){if(t<=7)return Array.from({length:t},(i,l)=>l+1);const o=Math.max(2,s-r),a=Math.min(t-1,s+r),n=[1];o>2&&n.push("…");for(let i=o;i<=a;i++)n.push(i);return a<t-1&&n.push("…"),n.push(t),n}const Is=200;function Bs({children:s,title:t,onClose:r,side:o="right",...a}){const n=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),d=()=>{!r||l||(p(!0),setTimeout(()=>{p(!1),r()},Is))};f.useEffect(()=>{const u=v=>{v.key==="Escape"&&d()},j=v=>{n.current&&!n.current.contains(v.target)&&d()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",j),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",j)}},[r,l]);const m=f.Children.toArray(s),h=m.find(u=>(u==null?void 0:u.type)===be),x=m.filter(u=>(u==null?void 0:u.type)!==be);return e.jsx("div",{className:["ds-drawer-overlay",l&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...a,children:e.jsxs("aside",{className:["ds-drawer",l&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":o,ref:n,role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[e.jsxs("header",{className:"ds-drawer-header",children:[t&&e.jsx("h3",{id:i,className:"ds-drawer-title",children:t}),r&&e.jsx("button",{className:"ds-drawer-close",onClick:d,"aria-label":"Close drawer",children:e.jsx(N.X,{size:D[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body",children:x}),h]})})}function be({children:s}){return e.jsx("footer",{className:"ds-drawer-footer",children:s})}const Ps={info:N.Info,success:N.CheckCircle,warning:N.AlertTriangle,error:N.XCircle};function Ms({children:s,variant:t="info",action:r,onAction:o,onDismiss:a,role:n,...i}){const l=Ps[t],p=n||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${t}`,role:p,...i,children:[l&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(l,{size:D[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:s}),r&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:o,children:r}),a&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:a,"aria-label":"Dismiss",children:e.jsx(N.X,{size:D[2],strokeWidth:1.5})})]})}function Ls({trigger:s,items:t=[],open:r,onOpenChange:o,align:a="left",className:n="",style:i,...l}){const[p,d]=f.useState(!1),[m,h]=f.useState(!1),x=r!==void 0,u=x?r:p,j=f.useRef(null),v=f.useRef(null),A=f.useRef(null),S=f.useRef(null),[B,E]=f.useState({}),$=f.useRef(null),z=150,I=()=>{if(x)o==null||o(!1);else{if(m)return;h(!0),$.current=setTimeout(()=>{d(!1),h(!1)},z)}},V=()=>{const b=!u;x?o==null||o(b):b?(clearTimeout($.current),h(!1),d(!0)):I()},Y=()=>{u||(x?o==null||o(!0):(clearTimeout($.current),h(!1),d(!0)))};f.useEffect(()=>()=>clearTimeout($.current),[]),f.useEffect(()=>{if(!u)return;const b=300,w=()=>{var X;const T=(X=j.current)==null?void 0:X.getBoundingClientRect();if(!T)return;const M=window.innerHeight-T.bottom,H=M<b+8&&T.top>M;E(a==="right"?H?{bottom:window.innerHeight-T.top+4,top:"auto",right:window.innerWidth-T.right}:{top:T.bottom+4,bottom:"auto",right:window.innerWidth-T.right}:H?{bottom:window.innerHeight-T.top+4,top:"auto",left:T.left}:{top:T.bottom+4,bottom:"auto",left:T.left})};return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[u,a]);const P=()=>{var w;const b=(w=A.current)==null?void 0:w.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');b==null||b.focus()};f.useEffect(()=>{if(!u)return;const b=T=>{var M,H;!((M=j.current)!=null&&M.contains(T.target))&&!((H=v.current)!=null&&H.contains(T.target))&&I()},w=T=>{T.key==="Escape"&&(I(),P())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[u]),f.useEffect(()=>{if(!u||!S.current||!v.current)return;const b=g(),w=S.current==="last"?b[b.length-1]:b[0];w==null||w.focus(),S.current=null},[u]);const g=()=>v.current?[...v.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],O=b=>{var w,T;if(b.key==="ArrowDown")b.preventDefault(),u?(w=g()[0])==null||w.focus():(S.current="first",Y());else if(b.key==="ArrowUp")if(b.preventDefault(),!u)S.current="last",Y();else{const M=g();(T=M[M.length-1])==null||T.focus()}},q=b=>{var M,H,X,k;const w=g(),T=w.findIndex(c=>c===document.activeElement);switch(b.key){case"ArrowDown":b.preventDefault(),(M=w[Math.min(T+1,w.length-1)])==null||M.focus();break;case"ArrowUp":b.preventDefault(),T<=0?P():(H=w[T-1])==null||H.focus();break;case"Home":b.preventDefault(),(X=w[0])==null||X.focus();break;case"End":b.preventDefault(),(k=w[w.length-1])==null||k.focus();break;case"Tab":I();break}},W=u&&e.jsx("div",{ref:v,role:"menu",className:["ds-dropdown__menu",`ds-dropdown__menu--${a}`,m&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:B,onKeyDown:q,children:t.map((b,w)=>{if(b.separator)return e.jsx("div",{className:"ds-dropdown__separator"},w);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})]},w);const T=!!b.href,M=T?"a":"button",H=T?{href:b.disabled?void 0:b.href,"aria-disabled":b.disabled?"true":void 0}:{type:"button",disabled:b.disabled};return e.jsxs(M,{role:"menuitem",className:["ds-dropdown__item",b.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...H,onClick:()=>{var X;(X=b.onClick)==null||X.call(b),I()},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})]},w)})});return e.jsxs("div",{ref:j,className:["ds-dropdown",n].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:A,className:"ds-dropdown__trigger",onClick:V,onKeyDown:O,children:s}),typeof document<"u"&&ue.createPortal(W,document.body)]})}function zs({value:s=0,size:t="m",variant:r="default",showValue:o=!1,min:a=2,animate:n=!0}){const i=Math.min(100,Math.max(0,s)),l=Math.max(a,i),p=r==="auto"?i>=70?"success":i>=50?"warning":"danger":r;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!n&&"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--${p}`,style:{width:`${l}%`}})}),o&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const Fs=s=>1-Math.pow(1-s,3),Cs=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Be(s,{duration:t=600}={}){const[r,o]=f.useState(s),a=f.useRef(s),n=f.useRef(null);return f.useEffect(()=>{if(Cs()){o(s),a.current=s;return}const i=a.current,l=s-i;if(l===0)return;let p=null;const d=m=>{p||(p=m);const h=Math.min((m-p)/t,1);o(i+l*Fs(h)),h<1?n.current=requestAnimationFrame(d):a.current=s};return n.current=requestAnimationFrame(d),()=>cancelAnimationFrame(n.current)},[s,t]),r}function Os({value:s,duration:t=600,decimals:r=0,prefix:o="",suffix:a=""}){const i=Be(s,{duration:t}).toFixed(r);return`${o}${i}${a}`}function Pe({threshold:s=.1,rootMargin:t="0px",once:r=!1}={}){const o=f.useRef(null),[a,n]=f.useState(!1);return f.useEffect(()=>{const i=o.current;if(!i)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(n(!0),r&&l.disconnect()):r||n(!1)},{threshold:s,rootMargin:t});return l.observe(i),()=>l.disconnect()},[s,t,r]),{ref:o,inView:a}}function Ws({children:s,as:t="div",once:r=!1,threshold:o=.1,rootMargin:a="0px",onEnter:n,onLeave:i,...l}){const{ref:p,inView:d}=Pe({threshold:o,rootMargin:a,once:r}),m=f.useRef(!1);return f.useEffect(()=>{d&&!m.current&&(n==null||n()),!d&&m.current&&(i==null||i()),m.current=d},[d]),e.jsx(t,{ref:p,...l,children:typeof s=="function"?s(d):s})}const ke={default:N.Info,success:N.CheckCircle,warning:N.AlertTriangle,error:N.XCircle};let le=[];const je=new Set;function Me(){je.forEach(s=>s([...le]))}function Us(s){le=[...le,s],Me()}function Vs(s){le=le.filter(t=>t.id!==s),Me()}function Hs(){const s=(t,r={})=>{Us({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...r})};return s.success=(t,r)=>s(t,{...r,type:"success"}),s.error=(t,r)=>s(t,{...r,type:"error"}),s.warning=(t,r)=>s(t,{...r,type:"warning"}),{toast:s}}function Ys({data:s,onDismiss:t}){const[r,o]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>(requestAnimationFrame(()=>o(!0)),s.duration>0&&(a.current=setTimeout(()=>n(),s.duration)),()=>clearTimeout(a.current)),[]);function n(){o(!1),setTimeout(()=>t(s.id),250)}const i=ke[s.type]??ke.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${s.type}`,r&&"ds-toast--visible"].filter(Boolean).join(" "),role:s.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(i,{size:D[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:s.message}),e.jsx("button",{className:"ds-toast__close",onClick:n,"aria-label":"Закрыть",children:e.jsx(N.X,{size:D[3],strokeWidth:1.5})})]})}function qs({position:s="bottom-right"}){const[t,r]=f.useState(()=>[...le]);return f.useEffect(()=>(je.add(r),()=>je.delete(r)),[]),!t.length||typeof document>"u"?null:ue.createPortal(e.jsx("div",{className:["ds-toast-container",`ds-toast-container--${s}`].join(" "),children:t.map(o=>e.jsx(Ys,{data:o,onDismiss:Vs},o.id))}),document.body)}const Xs={running:e.jsx(ee,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(ee,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ee,{size:"xs",variant:"error",children:"Error"})};function Ks({label:s,status:t="idle",icon:r,badge:o,defaultExpanded:a=!1,expanded:n,onToggle:i,children:l,className:p="",...d}){const m=e.jsxs("span",{className:"ds-tool-card__title-row",children:[r&&e.jsx("span",{className:"ds-tool-card__icon",children:r}),e.jsx("span",{className:"ds-tool-card__label",children:s}),Xs[t],o]});return e.jsx("div",{className:["ds-tool-card",p].filter(Boolean).join(" "),...d,children:e.jsx(fe,{title:m,padding:"s",defaultExpanded:a,expanded:n,onToggle:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})})}function Le({text:s,size:t="xs",timeout:r=2e3,"aria-label":o="Copy to clipboard",...a}){const[n,i]=f.useState(!1),l=()=>{navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),r)})};return e.jsx(ie,{variant:"ghost",size:t,icon:n?e.jsx(N.Check,{size:D[1],strokeWidth:1.5}):e.jsx(N.Copy,{size:D[1],strokeWidth:1.5}),"aria-label":o,onClick:l,...a})}function Gs({content:s,streaming:t=!1,...r}){const[o,a]=f.useState(t);return f.useEffect(()=>{a(!!t)},[t]),e.jsx(fe,{expanded:o,onToggle:a,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(N.Brain,{size:D[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Ae,{secondary:!0,children:"Thinking"})]}),...r,children:e.jsxs(ve,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[s,t&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function Js({count:s,current:t=0,done:r=[],onChange:o,showCounter:a=!0,className:n="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",n].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:s},(p,d)=>{const m=d===t,h=r.includes(d)&&!m,x=o&&(d<=t||r.includes(d)),u=["ds-step-indicator__dot",m&&"ds-step-indicator__dot--active",h&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:u,role:"tab","aria-selected":m,"aria-label":`Step ${d+1}`,disabled:!x||d===t,onClick:()=>o==null?void 0:o(d),children:h?e.jsx(N.Check,{size:8,strokeWidth:3}):null},d)})}),a&&e.jsxs(ve,{secondary:!0,className:"ds-step-indicator__counter",children:[t+1," / ",s]})]})}function Zs({content:s,isStreaming:t=!1,cursor:r="line",onChunk:o,className:a="",...n}){const i=f.useRef(s);return f.useEffect(()=>{s!==i.current&&(o==null||o(s),i.current=s)},[s,o]),e.jsxs("span",{className:["ds-streaming-text",a].filter(Boolean).join(" "),...n,children:[s,t&&r!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${r}`,"aria-hidden":"true"})]})}function Qs({role:s="assistant",header:t,footer:r,attachments:o,isStreaming:a=!1,children:n,className:i="",...l}){const p=["ds-chat-message",`ds-chat-message--${s}`,a&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return s==="system"?e.jsx("div",{className:p,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:n})}):s==="user"?e.jsxs("div",{className:p,...l,children:[o&&e.jsx("div",{className:"ds-chat-message__attachments",children:o}),e.jsx("div",{className:"ds-chat-message__bubble",children:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]}):e.jsxs("div",{className:p,...l,children:[t&&e.jsx("div",{className:"ds-chat-message__header",children:t}),o&&e.jsx("div",{className:"ds-chat-message__attachments",children:o}),e.jsx("div",{className:"ds-chat-message__body",children:n}),r&&e.jsx("div",{className:"ds-chat-message__footer",children:r})]})}function et(s,{containerRef:t,smartPause:r=!0}={}){const o=f.useRef(!1),a=f.useRef(0);f.useEffect(()=>{const n=t==null?void 0:t.current;if(!n)return;const i=()=>{const l=n.scrollHeight-n.scrollTop-n.clientHeight<64;!l&&n.scrollTop<a.current&&(o.current=!0),l&&(o.current=!1),a.current=n.scrollTop};return n.addEventListener("scroll",i,{passive:!0}),()=>n.removeEventListener("scroll",i)},[t]),f.useEffect(()=>{const n=t==null?void 0:t.current;n&&(r&&o.current||(n.scrollTop=n.scrollHeight))},s)}function ze({prompts:s,enabled:t,typingSpeed:r=38,erasingSpeed:o=18,holdTime:a=2200,betweenTime:n=380,manualPauseMs:i=5e3}){const[l,p]=f.useState(0),[d,m]=f.useState(""),h=f.useRef("typing"),x=f.useRef(0),u=f.useRef(0),j=f.useRef(null),v=f.useRef(0);f.useEffect(()=>{u.current=l},[l]),f.useEffect(()=>{if(j.current&&(clearTimeout(j.current),j.current=null),!t||s.length===0){m(""),x.current=0,h.current="typing";return}const $=()=>{const z=Date.now();if(v.current>z){j.current=setTimeout($,v.current-z);return}const I=s[u.current%s.length]??"";h.current==="typing"?(x.current+=1,m(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",j.current=setTimeout($,a)):j.current=setTimeout($,r+Math.random()*28)):h.current==="holding"?(h.current="erasing",j.current=setTimeout($,o)):(x.current=Math.max(0,x.current-1),m(I.slice(0,x.current)),x.current<=0?(h.current="typing",u.current=(u.current+1)%s.length,p(u.current),j.current=setTimeout($,n)):j.current=setTimeout($,o))};return j.current=setTimeout($,260),()=>{j.current&&clearTimeout(j.current)}},[t,s,r,o,a,n]);const A=$=>{if(s.length===0)return;const z=($%s.length+s.length)%s.length,I=s[z];u.current=z,x.current=I.length,h.current="holding",v.current=Date.now()+i,p(z),m(I)},S=()=>A(u.current+1),B=()=>A(u.current-1),E=s[l%s.length]??"";return{displayed:d,currentPrompt:E,index:l,next:S,prev:B}}let st=0;function tt({value:s="",onChange:t,onSubmit:r,onStop:o,onKeyDown:a,loading:n=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:p,attachments:d,images:m,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:u,onRemoveImage:j,acceptImage:v,acceptFile:A,maxImages:S,maxImageSize:B,leftSlot:E,rightSlot:$,className:z="",...I}){const V=f.useRef(null),Y=f.useRef(null),P=f.useRef(0),[g,O]=f.useState(!1),[q,W]=f.useState([]),b=_=>{const R=++st;W(U=>[...U,{id:R,msg:_}]),setTimeout(()=>W(U=>U.filter(K=>K.id!==R)),6e3)},w=_=>W(R=>R.filter(U=>U.id!==_)),T=_=>_.type.startsWith("image/"),M=()=>!0,H=v??T,X=A??M,k=_=>{const R=[],U=[],K=[],G=[];let Z=0,ae=S!=null?S-((m==null?void 0:m.length)??0):1/0;for(const Q of _)H(Q)?B&&Q.size>B?K.push(Q.name):ae>0?(R.push(Q),ae--):Z++:X(Q)?U.push(Q):G.push(Q.name);return{imageFiles:R,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}},c=_=>{const{imageFiles:R,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}=k(_);K.length&&b(`File${K.length>1?"s":""} too large${B?` (max ${B/1024/1024}MB)`:""}: ${K.join(", ")}`),G.length&&b(`Skipped unsupported file${G.length>1?"s":""}: ${G.join(", ")}`),Z&&b(`Max ${S} images per message`),x&&R.length&&x(R);const ae=U.concat(x?[]:R);h&&ae.length&&h(ae)};f.useEffect(()=>{const _=Y.current;_&&(_.style.height="auto",_.style.height=`${Math.min(_.scrollHeight,200)}px`)},[s]),f.useEffect(()=>{const _=R=>{var K,G,Z;if(n||i)return;const U=(K=R.target)==null?void 0:K.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(G=R.target)!=null&&G.isContentEditable||R.ctrlKey||R.metaKey||R.altKey||R.key.length!==1&&R.key!=="Backspace"&&R.key!=="Delete"||(Z=Y.current)==null||Z.focus()};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n,i]);const y=_=>{_.preventDefault(),P.current++,_.dataTransfer.types.includes("Files")&&O(!0)},L=_=>{_.preventDefault(),P.current--,P.current===0&&O(!1)},F=_=>_.preventDefault(),se=_=>{_.preventDefault(),P.current=0,O(!1);const R=Array.from(_.dataTransfer.files);R.length&&c(R)},re=_=>{const R=Array.from(_.target.files||[]);V.current&&(V.current.value=""),R.length&&c(R)},C=_=>{var Q;if(!x)return;const R=(Q=_.clipboardData)==null?void 0:Q.items;if(!R)return;const U=[];for(const Oe of R){const Ne=Oe.getAsFile();Ne&&U.push(Ne)}if(U.length===0)return;const{imageFiles:K,tooLarge:G,skipped:Z,limitExceeded:ae}=k(U);G.length&&b(`File${G.length>1?"s":""} too large: ${G.join(", ")}`),Z.length&&b(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),ae&&b(`Max ${S} images per message`),K.length&&(_.preventDefault(),x(K))},J=!n&&!i&&!!(p!=null&&p.length)&&s.length===0,ne=ze({prompts:p??[],enabled:J}),me=_=>{if(J){if(_.key==="ArrowDown"||_.key==="ArrowRight"){_.preventDefault(),ne.next();return}if(_.key==="ArrowUp"||_.key==="ArrowLeft"){_.preventDefault(),ne.prev();return}if(_.key==="Tab"&&!_.shiftKey){_.preventDefault(),t==null||t(ne.currentPrompt);return}}a==null||a(_)},Ce=(s.trim()||(m==null?void 0:m.length)>0||(d==null?void 0:d.length)>0)&&!i,we=h||x;return e.jsxs("div",{className:["ds-prompt-input",z].filter(Boolean).join(" "),...I,children:[we&&e.jsx("input",{ref:V,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:re}),e.jsxs("div",{className:["ds-prompt-input__box",g&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:y,onDragLeave:L,onDragOver:F,onDrop:se,children:[g&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:Y,value:s,onChange:_=>t==null?void 0:t(_.target.value),onKeyDown:me,onPaste:C,placeholder:J?"":l,disabled:n||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:ne.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),m&&m.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:m.map((_,R)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:_.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>j==null?void 0:j(R),"aria-label":"Remove image",type:"button",children:e.jsx(N.X,{size:12,strokeWidth:2})})]},R))}),q.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:q.map(_=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:_.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>w(_.id),"aria-label":"Dismiss",children:e.jsx(N.X,{size:D[1],strokeWidth:1.5})})]},_.id))}),d&&d.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:d.map((_,R)=>e.jsx(ee,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[_.uploading?e.jsx(N.Loader,{size:D[1],strokeWidth:1.5,className:"spin"}):e.jsx(N.Paperclip,{size:D[1],strokeWidth:1.5}),_.filename,_.uploading?e.jsx("span",{className:"ds-prompt-input__uploading",children:"Uploading..."}):e.jsx("button",{type:"button",className:"ds-prompt-input__remove-btn",onClick:()=>u==null?void 0:u(R),children:e.jsx(N.X,{size:D[1],strokeWidth:1.5})})]})},R))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[we&&e.jsx(ie,{variant:"ghost",size:"xs",icon:e.jsx(N.Paperclip,{size:D[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var _;return(_=V.current)==null?void 0:_.click()}}),E,$,e.jsx("div",{className:"ds-prompt-input__spacer"}),n?e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(N.Square,{size:D[2],strokeWidth:1.5}),onClick:o,"aria-label":"Stop"}):e.jsx(ie,{variant:"primary",size:"xs",icon:e.jsx(N.ArrowUp,{size:D[2],strokeWidth:1.5}),onClick:r,disabled:!Ce,"aria-label":"Send"})]})]})]})}const Ee={fast:0,standard:1,premium:2},Te={fast:"data-5",standard:"data-3",premium:"data-6"};function rt({models:s=[],value:t,onChange:r,size:o="xs",minTier:a,showAutoOption:n=!1,groupByTier:i=!0,className:l="",...p}){const[d,m]=f.useState(!1),h=f.useRef(null),x=f.useRef(null),u=f.useRef(null),[j,v]=f.useState({}),A=s.filter(g=>!a||g.name==="auto"?!0:(Ee[g.tier]??1)>=(Ee[a]??1)),S=A.find(g=>g.name==="auto"),B=A.filter(g=>g.name!=="auto"),E=s.find(g=>g.name===t),z=new Set(B.map(g=>g.tier).filter(Boolean)).size>1;f.useEffect(()=>{if(!d)return;const g=320,O=()=>{var M;const b=(M=x.current)==null?void 0:M.getBoundingClientRect();if(!b)return;const w=window.innerHeight-b.bottom,T=w<g+8&&b.top>w;v({position:"fixed",zIndex:"var(--z-dropdown, 500)",right:window.innerWidth-b.right,...T?{bottom:window.innerHeight-b.top+4,top:"auto"}:{top:b.bottom+4,bottom:"auto"}})};O(),window.addEventListener("scroll",O,!0),window.addEventListener("resize",O);const q=b=>{var w,T;!((w=h.current)!=null&&w.contains(b.target))&&!((T=u.current)!=null&&T.contains(b.target))&&m(!1)},W=b=>{b.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",W),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O),document.removeEventListener("mousedown",q),document.removeEventListener("keydown",W)}},[d]);const I=g=>{r==null||r(g),m(!1)},V=g=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",g.name===t&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I(g.name),children:[g.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:g.icon}):e.jsx(N.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:g.displayName||g.name}),z&&g.tier&&e.jsx(ee,{size:"xs",variant:Te[g.tier]||"default",children:g.tier})]},g.name),Y=()=>!i||!z?B.map(V):["fast","standard","premium"].flatMap(g=>{const O=B.filter(q=>q.tier===g);return O.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":g,children:g.charAt(0).toUpperCase()+g.slice(1)},`lbl-${g}`),...O.map(V)]:[]}),P=d&&e.jsxs("div",{ref:u,className:"ds-model-picker__menu",style:j,children:[n&&S&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",t==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(N.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)"})]}),B.length>0&&e.jsx("div",{className:"ds-model-picker__separator"})]}),Y()]});return e.jsxs("div",{ref:h,className:["ds-model-picker",l].filter(Boolean).join(" "),...p,children:[e.jsxs("button",{ref:x,type:"button",className:"ds-model-picker__trigger",onClick:()=>m(g=>!g),"aria-haspopup":"listbox","aria-expanded":d,children:[E!=null&&E.icon?e.jsx("span",{children:E.icon}):e.jsx(N.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(E==null?void 0:E.displayName)||(E==null?void 0:E.name)||t}),z&&(E==null?void 0:E.tier)&&e.jsx(ee,{size:"xs",variant:Te[E.tier]||"default",children:E.tier})]}),typeof document<"u"&&ue.createPortal(P,document.body)]})}const nt=({filename:s,pages:t})=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:s}),t.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:_e(t)})]});function _e(s){return s!=null&&s.length?"p. "+s.join(", "):null}function at(s){const t=new Map;for(const r of s)t.has(r.filename)||t.set(r.filename,{filename:r.filename,url:r.url,items:[]}),t.get(r.filename).items.push(r);return[...t.values()]}function ot({sources:s=[],layout:t="list",title:r="Sources",maxVisible:o=5,onSourceClick:a}){const[n,i]=f.useState(!1),l=at(s),p=l.length>o,d=n?l:l.slice(0,o),m=s.some(x=>x.snippet),h=["ds-sources-panel",t==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return t==="compact"?e.jsxs("div",{className:h,children:[d.map(x=>{const u=x.items.map(v=>v.page).filter(Boolean),j=!!a;return e.jsxs("div",{className:`ds-sources-panel__compact-row${j?" ds-sources-panel__compact-row--clickable":""}`,onClick:j?()=>a(x.items[0]):void 0,children:[e.jsx(N.FileText,{size:D[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),u.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:_e(u)})]},x.filename)}),p&&!n&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]}):e.jsxs("div",{className:h,children:[r&&e.jsx("div",{className:"ds-sources-panel__title",children:r}),d.map(x=>{const u=x.items.map(v=>v.page).filter(Boolean),j=!!a;return m?e.jsx(fe,{title:e.jsx(nt,{filename:x.filename,pages:u}),padding:"s",children:x.items.map((v,A)=>e.jsx("div",{className:`ds-sources-panel__snippet${j?" ds-sources-panel__snippet--clickable":""}`,onClick:j?()=>a(v):void 0,children:v.snippet??`p. ${v.page}`},A))},x.filename):e.jsxs("div",{className:`ds-sources-panel__row${j?" ds-sources-panel__row--clickable":""}`,onClick:j?()=>a(x.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),u.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:_e(u)})]},x.filename)}),p&&!n&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-o," more sources"]})]})}function $e(s){return s>=1e6?(s/1e6).toFixed(1).replace(/\.0$/,"")+"M":s>=1e3?(s/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(s)}function it({used:s,limit:t,size:r="s",showCount:o=!0,showPercent:a=!1,warningThreshold:n=.8,errorThreshold:i=1}){const l=t>0?s/t:0,p=Math.min(l*100,100),d=l>=i?"error":l>=n?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${r}`,role:"meter","aria-valuenow":s,"aria-valuemax":t,children:[e.jsx("div",{className:"ds-token-counter__track",children:e.jsx("div",{className:`ds-token-counter__fill ds-token-counter__fill--${d}`,style:{width:`${p}%`}})}),(o||a)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${d}`,children:[o&&e.jsxs("span",{children:[$e(s)," / ",$e(t)," tokens"]}),a&&e.jsxs("span",{children:[Math.round(l*100),"%"]})]})]})}const Re=5;function lt(s){return s<.34?"low":s<.67?"medium":"high"}function ct({value:s=0,size:t="xs",showLabel:r="none",layout:o="inline"}){const a=Math.max(0,Math.min(1,s)),n=Math.round(a*Re),i=lt(a);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${t}`,`ds-confidence-bar--${i}`,o==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:Re},(l,p)=>e.jsx("div",{className:`ds-confidence-bar__seg${p<n?" ds-confidence-bar__seg--filled":""}`},p))}),r==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const dt={add:"+",remove:"-",context:" "};function pe({line:s,lineNumbers:t}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${s.type}`,children:[t&&s.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:s.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:dt[s.type]}),e.jsx("span",{className:"ds-diff-view__text",children:s.text})]})}function ut({lines:s=[],layout:t="inline",wordWrap:r=!1,lineNumbers:o=!0,maxHeight:a,title:n}){const i=["ds-diff-view",`ds-diff-view--${t}`,r&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=a?{maxHeight:a,overflowY:"auto"}:void 0;if(t==="split"){const p=s.filter(m=>m.type==="remove"||m.type==="context"),d=s.filter(m=>m.type==="add"||m.type==="context");return e.jsxs("div",{className:i,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsxs("div",{className:"ds-diff-view__body",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col",children:p.map((m,h)=>e.jsx(pe,{line:m,lineNumbers:o},h))}),e.jsx("div",{className:"ds-diff-view__split-col",children:d.map((m,h)=>e.jsx(pe,{line:m,lineNumbers:o},h))})]})]})}return e.jsxs("div",{className:i,children:[n&&e.jsx("div",{className:"ds-diff-view__title",children:n}),e.jsx("div",{className:"ds-diff-view__body",style:l,children:s.map((p,d)=>e.jsx(pe,{line:p,lineNumbers:o},d))})]})}const ft={running:e.jsx(ee,{size:"xs",variant:"info",children:"Running…"}),success:e.jsx(ee,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ee,{size:"xs",variant:"error",children:"Error"})};function mt({label:s,status:t="idle",icon:r,badge:o,className:a="",...n}){return e.jsxs("div",{className:["ds-tool-bubble",a].filter(Boolean).join(" "),...n,children:[r&&e.jsx("span",{className:"ds-tool-bubble__icon",children:r}),e.jsx("span",{className:"ds-tool-bubble__label",children:s}),ft[t],o]})}function Fe({value:s="idle",onLike:t,onDislike:r,className:o="",...a}){const n=s!=="idle";return e.jsxs("div",{className:["ds-message-feedback",n&&"ds-message-feedback--voted",o].filter(Boolean).join(" "),...a,children:[(!n||s==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:t,disabled:n,"aria-label":"Like","aria-pressed":s==="liked",children:e.jsx(N.ThumbsUp,{size:D[1],strokeWidth:1.5,fill:s==="liked"?"currentColor":"none"})}),(!n||s==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:r,disabled:n,"aria-label":"Dislike","aria-pressed":s==="disliked",children:e.jsx(N.ThumbsDown,{size:D[1],strokeWidth:1.5,fill:s==="disliked"?"currentColor":"none"})})]})}function pt(s){const t=s instanceof Date?s:new Date(s);if(isNaN(t))return null;const r=new Date,o=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),a=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=new Date(a-864e5);if(t>=a)return o;if(t>=n)return`Yesterday ${o}`;const i=t.getDate(),l=t.toLocaleString([],{month:"short"});return`${i} ${l} ${o}`}function ht({role:s="assistant",text:t,timestamp:r,feedbackValue:o="idle",onLike:a,onDislike:n,className:i="",...l}){const p=s==="assistant"&&(a||n),d=!!t,m=r?pt(r):null;return!p&&!d&&!m?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${s}`,i].filter(Boolean).join(" "),...l,children:[s==="user"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp",children:m}),p&&e.jsx(Fe,{value:o,onLike:a,onDislike:n}),d&&e.jsx(Le,{text:t}),s==="assistant"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp",children:m})]})}exports.Accordion=fe;exports.Alert=ts;exports.AnimatedNumber=Os;exports.Avatar=_s;exports.Badge=ee;exports.Banner=Ms;exports.Breadcrumb=Ss;exports.Button=ie;exports.Card=Ke;exports.ChatMessage=Qs;exports.Checkbox=ps;exports.Code=as;exports.CodeAccordion=De;exports.ConfidenceBar=ct;exports.CopyButton=Le;exports.DiffView=ut;exports.Drawer=Bs;exports.DrawerFooter=be;exports.Dropdown=Ls;exports.EmptyState=Ts;exports.FormField=$s;exports.H1=Ge;exports.H2=Je;exports.H3=Ze;exports.H4=Qe;exports.InView=Ws;exports.Input=He;exports.Link=os;exports.MessageFeedback=Fe;exports.MessageFooter=ht;exports.Modal=ns;exports.ModalFooter=xe;exports.ModelPicker=rt;exports.P1=es;exports.P2=Ae;exports.P3=ve;exports.Pagination=As;exports.ProgressBar=zs;exports.PromptInput=tt;exports.Radio=hs;exports.ReasoningBlock=Gs;exports.SegmentedControl=cs;exports.Select=qe;exports.Skeleton=Ie;exports.SourcesPanel=ot;exports.Spinner=Se;exports.Stat=Rs;exports.StepIndicator=Js;exports.Stepper=Xe;exports.StreamingText=Zs;exports.Tab=ls;exports.Table=vs;exports.TableBody=Ns;exports.TableHead=ws;exports.TableRow=gs;exports.TableSubheaderRow=ys;exports.Tabs=is;exports.Td=Es;exports.Textarea=Ye;exports.Th=ks;exports.ToastContainer=qs;exports.Toggle=ms;exports.TokenCounter=it;exports.ToolCallBubble=mt;exports.ToolCallCard=Ks;exports.Tooltip=fs;exports.iconSizes=D;exports.useAnimatedNumber=Be;exports.useAnimatedPlaceholder=ze;exports.useInView=Pe;exports.useStreamScroll=et;exports.useToast=Hs;
package/dist/index.d.ts CHANGED
@@ -389,6 +389,8 @@ export interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
389
389
  interactive?: boolean;
390
390
  selected?: boolean;
391
391
  subheader?: boolean;
392
+ exiting?: boolean;
393
+ updated?: boolean;
392
394
  onClick?: () => void;
393
395
  }
394
396
 
@@ -620,7 +622,6 @@ export interface ToolCallCardProps extends HTMLAttributes<HTMLDivElement> {
620
622
  defaultExpanded?: boolean;
621
623
  expanded?: boolean;
622
624
  onToggle?: (value: boolean) => void;
623
- padding?: 's' | 'm' | 'l';
624
625
  children?: ReactNode;
625
626
  }
626
627
 
@@ -833,3 +834,39 @@ export interface DiffViewProps {
833
834
  }
834
835
 
835
836
  export declare function DiffView(props: DiffViewProps): JSX.Element;
837
+
838
+ // ─── ToolCallBubble ───────────────────────────────────────────────────────────
839
+
840
+ export interface ToolCallBubbleProps {
841
+ label: string;
842
+ status?: 'idle' | 'running' | 'success' | 'error';
843
+ icon?: ReactNode;
844
+ badge?: ReactNode;
845
+ className?: string;
846
+ }
847
+
848
+ export declare function ToolCallBubble(props: ToolCallBubbleProps): JSX.Element;
849
+
850
+ // ─── MessageFeedback ──────────────────────────────────────────────────────────
851
+
852
+ export interface MessageFeedbackProps {
853
+ value?: 'idle' | 'liked' | 'disliked';
854
+ onLike?: () => void;
855
+ onDislike?: () => void;
856
+ className?: string;
857
+ }
858
+
859
+ export declare function MessageFeedback(props: MessageFeedbackProps): JSX.Element;
860
+
861
+ // ─── MessageFooter ────────────────────────────────────────────────────────────
862
+
863
+ export interface MessageFooterProps extends HTMLAttributes<HTMLDivElement> {
864
+ role?: 'user' | 'assistant';
865
+ text?: string;
866
+ timestamp?: Date | string | number;
867
+ feedbackValue?: 'idle' | 'liked' | 'disliked';
868
+ onLike?: () => void;
869
+ onDislike?: () => void;
870
+ }
871
+
872
+ export declare function MessageFooter(props: MessageFooterProps): JSX.Element | null;