@donkit-ai/design-system 1.4.53 → 1.4.54
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 +4 -4
- package/dist/index.d.ts +83 -0
- package/dist/index.es.js +1548 -1308
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),E=require("lucide-react"),fe=require("react-dom"),C={1:16,2:20,3:24,4:28,5:48};var Ne={exports:{}},me={};/**
|
|
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
|
|
9
|
+
*/var $e;function Ge(){if($e)return me;$e=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function n(a,o,r){var i=null;if(r!==void 0&&(i=""+r),o.key!==void 0&&(i=""+o.key),"key"in o){r={};for(var l in o)l!=="key"&&(r[l]=o[l])}else r=o;return o=r.ref,{$$typeof:t,type:a,key:i,ref:o!==void 0?o:null,props:r}}return me.Fragment=s,me.jsx=n,me.jsxs=n,me}var pe={};/**
|
|
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
|
|
17
|
+
*/var Ae;function Je(){return Ae||(Ae=1,process.env.NODE_ENV!=="production"&&function(){function t(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===D?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case w:return"Fragment";case R:return"Profiler";case y:return"StrictMode";case I:return"Suspense";case O:return"SuspenseList";case j:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case b:return"Portal";case T:return m.displayName||"Context";case N:return(m._context.displayName||"Context")+".Consumer";case P:var S=m.render;return m=m.displayName,m||(m=S.displayName||S.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case X:return S=m.displayName||null,S!==null?S:t(m.type)||"Memo";case L:S=m._payload,m=m._init;try{return t(m(S))}catch{}}return null}function s(m){return""+m}function n(m){try{s(m);var S=!1}catch{S=!0}if(S){S=console;var F=S.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return F.call(S,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),s(m)}}function a(m){if(m===w)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===L)return"<...>";try{var S=t(m);return S?"<"+S+">":"<...>"}catch{return"<...>"}}function o(){var m=z.A;return m===null?null:m.getOwner()}function r(){return Error("react-stack-top-frame")}function i(m){if(W.call(m,"key")){var S=Object.getOwnPropertyDescriptor(m,"key").get;if(S&&S.isReactWarning)return!1}return m.key!==void 0}function l(m,S){function F(){A||(A=!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)",S))}F.isReactWarning=!0,Object.defineProperty(m,"key",{get:F,configurable:!0})}function f(){var m=t(this.type);return M[m]||(M[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function u(m,S,F,U,te,ne){var V=F.ref;return m={$$typeof:v,type:m,key:S,props:F,_owner:U},(V!==void 0?V:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:f}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ne}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function p(m,S,F,U,te,ne){var V=S.children;if(V!==void 0)if(U)if(_(V)){for(U=0;U<V.length;U++)h(V[U]);Object.freeze&&Object.freeze(V)}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(V);if(W.call(S,"key")){V=t(m);var J=Object.keys(S).filter(function(be){return be!=="key"});U=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",$[V+U]||(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} />`,M,F,J,F),S[F+M]=!0)}if(F=null,L!==void 0&&(n(L),F=""+L),i(T)&&(n(T.key),F=""+T.key),"key"in T){L={};for(var re in T)re!=="key"&&(L[re]=T[re])}else L=T;return F&&l(L,typeof d=="function"?d.displayName||d.name||"Unknown":d),u(d,F,L,o(),ee,ne)}function h(d){x(d)?d._store&&(d._store.validated=1):typeof d=="object"&&d!==null&&d.$$typeof===z&&(d._payload.status==="fulfilled"?x(d._payload.value)&&d._payload.value._store&&(d._payload.value._store.validated=1):d._store&&(d._store.validated=1))}function x(d){return typeof d=="object"&&d!==null&&d.$$typeof===_}var c=f,_=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),$=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),q=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,v=Array.isArray,E=console.createTask?console.createTask:function(){return null};c={react_stack_bottom_frame:function(d){return d()}};var I,C={},Y=c.react_stack_bottom_frame.bind(c,r)(),H=E(a(r)),S={};ue.Fragment=g,ue.jsx=function(d,T,L){var M=1e4>q.recentlyCreatedOwnerStacks++;return m(d,T,L,!1,M?Error("react-stack-top-frame"):Y,M?E(a(d)):H)},ue.jsxs=function(d,T,L){var M=1e4>q.recentlyCreatedOwnerStacks++;return m(d,T,L,!0,M?Error("react-stack-top-frame"):Y,M?E(a(d)):H)}}()),ue}process.env.NODE_ENV==="production"?xe.exports=Ye():xe.exports=qe();var e=xe.exports;function Ie({size:s="m",color:t="default",className:n="",...a}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${s}`,`ds-spinner--${t}`,n].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...a})}const He={xs:12,s:14,m:16,l:20};function ae({children:s,variant:t="primary",size:n="m",fullWidth:a=!1,icon:o,disabled:r=!1,state:i="idle",onClick:l,type:p="button",href:u,"aria-label":m,className:h="",...x}){const c=o&&!s,_=i==="loading",b=i==="success",g=i==="error",y=_||b||g,R=n==="xs"?"s":"m",N=t==="danger"?"on-accent":"default",$=He[n]??16,P=_?e.jsx(Ie,{size:R,color:N}):b?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(k.Check,{size:$,strokeWidth:2.5})}):g?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(k.X,{size:$,strokeWidth:2.5})}):null,B=["ds-button",`ds-button--${t}`,`ds-button--${n}`,a&&"ds-button--full",c&&"ds-button--icon-only",h].filter(Boolean).join(" "),V=i!=="idle"?i:void 0,X=e.jsxs(e.Fragment,{children:[y?P:o&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:o}),s]});if(u){const z=w=>{if(r||_){w.preventDefault();return}w.metaKey||w.ctrlKey||w.button===1||(w.preventDefault(),l==null||l(w))};return e.jsx("a",{className:B,href:r||_?void 0:u,onClick:z,"aria-label":m,"aria-disabled":r||_?"true":void 0,"aria-busy":_?"true":void 0,"data-state":V,...x,children:X})}return e.jsx("button",{type:p,className:B,disabled:r,onClick:_?void 0:l,"aria-label":m,"aria-busy":_?"true":void 0,"data-state":V,...x,children:X})}function Ke({label:s,error:t,hint:n,fullWidth:a=!0,icon:o,iconRight:r,onIconRightClick:i,size:l="m",disabled:p,id:u,...m}){const h=u||`input-${f.useId()}`,x=n?`${h}-hint`:void 0,c=t?`${h}-error`:void 0,_=c||x;return e.jsxs("div",{className:`ds-input-wrapper ${a?"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:[o&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:o}),e.jsx("input",{id:h,className:`ds-input ds-input--${l} ${o?"ds-input--with-icon":""} ${r?"ds-input--with-icon-right":""} ${t?"ds-input--error":""}`,disabled:p,"aria-invalid":t?"true":"false","aria-describedby":_,...m}),r&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:r})]}),n&&!t&&e.jsx("span",{id:x,className:"ds-input-hint",children:n}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:t&&e.jsx("span",{id:c,className:"ds-input-error",role:"alert",children:t})})})]})}function Ge({label:s,error:t,hint:n,fullWidth:a=!0,size:o="m",disabled:r,id:i,resize:l=!0,rows:p=3,...u}){const m=i||`textarea-${f.useId()}`,h=n?`${m}-hint`:void 0,x=t?`${m}-error`:void 0,c=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${a?"ds-textarea-wrapper--full":""} ${r?"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--${o} ${t?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:r,"aria-invalid":t?"true":"false","aria-describedby":c,rows:p,...u}),n&&!t&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:n}),t&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:t})]})}function Je({label:s,value:t,onChange:n,options:a=[],placeholder:o="Select option",error:r,fullWidth:i=!0,size:l="m",disabled:p=!1,id:u,...m}){const[h,x]=f.useState(!1),[c,_]=f.useState(!1),[b,g]=f.useState({}),[y,R]=f.useState("down"),[N,$]=f.useState(-1),P=f.useRef(null),B=f.useRef(null),V=f.useRef(null),X=f.useRef(null),z=u||`select-${f.useId()}`,w=`${z}-label`,O=r?`${z}-error`:void 0,q=150,W=(S=!1)=>{c||(_(!0),$(-1),X.current=setTimeout(()=>{var d;x(!1),_(!1),S&&((d=V.current)==null||d.focus())},q))},v=S=>{clearTimeout(X.current),_(!1);const d=S!==void 0?S:Math.max(a.findIndex(T=>T.value===t),0);$(d),x(!0)};f.useEffect(()=>()=>clearTimeout(X.current),[]);const E=()=>{var ne;const S=(ne=P.current)==null?void 0:ne.getBoundingClientRect();if(!S)return;const d=window.innerHeight,T=d-S.bottom,L=S.top,ee=T<300&&L>T;R(ee?"up":"down"),g(ee?{bottom:d-S.top+4,left:S.left,width:S.width}:{top:S.bottom+4,left:S.left,width:S.width})};f.useEffect(()=>{if(h)return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[h]),f.useEffect(()=>{const S=d=>{P.current&&!P.current.contains(d.target)&&B.current&&!B.current.contains(d.target)&&W()};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[c]),f.useEffect(()=>{var d;if(!h||N<0||!B.current)return;(d=B.current.querySelectorAll(".ds-select-option")[N])==null||d.scrollIntoView({block:"nearest"})},[N,h]);const I=S=>{switch(S.key){case"ArrowDown":S.preventDefault(),h?$(d=>Math.min(d+1,a.length-1)):v();break;case"ArrowUp":S.preventDefault(),h?$(d=>Math.max(d-1,0)):v(a.length-1);break;case"Home":h&&(S.preventDefault(),$(0));break;case"End":h&&(S.preventDefault(),$(a.length-1));break;case"Enter":case" ":S.preventDefault(),h?N>=0&&(n==null||n(a[N].value),W(!0)):v();break;case"Escape":h&&(S.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},C=a.find(S=>S.value===t),Y=l==="xs"?D[1]:l==="small"?D[2]:D[3],H=h&&e.jsx("div",{ref:B,"data-ds-portal":"",role:"listbox","aria-labelledby":s?w:void 0,tabIndex:-1,className:["ds-select-dropdown ds-scrollable",`ds-select-dropdown--${l}`,`ds-select-dropdown--${y}`,c&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:b,children:a.map((S,d)=>e.jsx("button",{id:`${z}-opt-${d}`,type:"button",role:"option",tabIndex:-1,"aria-selected":t===S.value,className:["ds-select-option",`ds-select-option--${l}`,t===S.value&&"ds-select-option--selected",d===N&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{n==null||n(S.value),W(!0)},children:S.label},S.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:w,className:"ds-select-label",children:s}),e.jsx("div",{className:"ds-select-container",ref:P,children:e.jsxs("button",{ref:V,type:"button",id:z,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&N>=0?`${z}-opt-${N}`:void 0,"aria-labelledby":s?w:void 0,"aria-invalid":r?"true":"false","aria-describedby":O,className:`ds-select-trigger ds-select-trigger--${l} ${r?"ds-select-trigger--error":""}`,onClick:()=>{p||(h?W():v())},onKeyDown:I,disabled:p,...m,children:[e.jsx("span",{className:C?"":"ds-select-placeholder",children:(C==null?void 0:C.label)||o}),e.jsx(k.ChevronDown,{size:Y,strokeWidth:1.5,className:`ds-select-icon ${h&&y==="down"?"ds-select-icon--open":""} ${h&&y==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),r&&e.jsx("span",{id:O,className:"ds-select-error",role:"alert",children:r}),typeof document<"u"&&fe.createPortal(H,document.body)]})}function Ze({label:s,value:t=0,onChange:n,min:a=0,max:o=100,step:r=1,size:i="m",disabled:l=!1,hint:p,error:u,...m}){const h=()=>{if(l)return;const y=Math.min(Number(t)+r,o);n==null||n(y)},x=()=>{if(l)return;const y=Math.max(Number(t)-r,a);n==null||n(y)},c=y=>{if(l)return;const R=y.target.value;if(R===""){n==null||n(a);return}const N=Number(R);if(!isNaN(N)){const $=Math.min(Math.max(N,a),o);n==null||n($)}},_=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",u&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),b=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),g=i==="xs"?D[1]:i==="small"?D[2]:D[3];return e.jsxs("div",{className:_,children:[s&&e.jsx("label",{className:"ds-stepper-label",children:s}),e.jsxs("div",{className:b,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:l||t<=a,"aria-label":"Decrease",children:e.jsx(k.Minus,{size:g,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:t,onChange:c,min:a,max:o,step:r,disabled:l,...m}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:h,disabled:l||t>=o,"aria-label":"Increase",children:e.jsx(k.Plus,{size:g,strokeWidth:1.5})})]}),p&&!u&&e.jsx("div",{className:"ds-stepper-hint",children:p}),u&&e.jsx("div",{className:"ds-stepper-error",children:u})]})}function Qe({children:s,padding:t="m",variant:n="info",hover:a=!1,onClick:o,href:r,disabled:i=!1,...l}){const u=(a?"interactive":n)==="interactive"||o||r,m=["ds-card",`ds-card--${t}`,u&&"ds-card--interactive"].filter(Boolean).join(" ");if(r){const c=_=>{if(i){_.preventDefault();return}_.metaKey||_.ctrlKey||_.button===1||(_.preventDefault(),o==null||o(_))};return e.jsx("a",{className:m,href:i?void 0:r,onClick:c,"aria-disabled":i?"true":void 0,...l,children:s})}const h=u&&o?"button":"div",x=u&&o?{type:"button",onClick:o,disabled:i}:{};return e.jsx(h,{className:m,role:u&&!o?"article":void 0,...x,...l,children:s})}function es({children:s,...t}){return e.jsx("h1",{className:"ds-h1",...t,children:s})}function ss({children:s,...t}){return e.jsx("h2",{className:"ds-h2",...t,children:s})}function ts({children:s,...t}){return e.jsx("h3",{className:"ds-h3",...t,children:s})}function ns({children:s,...t}){return e.jsx("h4",{className:"ds-h4",...t,children:s})}function rs({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p1 ${t?"ds-p1--secondary":""}`,...n,children:s})}function Ae({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p2 ${t?"ds-p2--secondary":""}`,...n,children:s})}function Ne({children:s,secondary:t=!1,...n}){return e.jsx("p",{className:`ds-p3 ${t?"ds-p3--secondary":""}`,...n,children:s})}function te({children:s,variant:t="default",size:n="m",role:a,...o}){const r=["ds-badge",`ds-badge--${t}`,`ds-badge--${n}`].filter(Boolean).join(" "),i=a||(["info","success","warning","error"].includes(t)?"status":void 0);return e.jsx("span",{className:r,role:i,...o,children:s})}const as={info:k.Info,success:k.CheckCircle,warning:k.AlertTriangle,error:k.XCircle};function os({children:s,variant:t="info",title:n,onClose:a,role:o,...r}){const i=as[t],l=o||(t==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${t} ${n?"":"ds-alert--no-title"}`,role:l,...r,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:[n&&e.jsx("div",{className:"ds-alert__title",children:n}),s&&e.jsx("div",{className:"ds-alert__message",children:s})]}),a&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:a,"aria-label":"Close alert",children:e.jsx(k.X,{size:D[3],strokeWidth:1.5})})]})}const is=200;function ls({children:s,title:t,onClose:n,size:a="m",scrollable:o=!1,subHeader:r,...i}){const l=f.useRef(null),p=f.useId(),[u,m]=f.useState(!1),h=()=>{!n||u||(m(!0),setTimeout(()=>{m(!1),n()},is))};f.useEffect(()=>{const b=y=>{y.key==="Escape"&&h()},g=y=>{var N,$,P;const R=(($=(N=y.composedPath)==null?void 0:N.call(y))==null?void 0:$[0])??y.target;l.current&&!l.current.contains(R)&&!((P=R.closest)!=null&&P.call(R,"[data-ds-portal]"))&&h()};return document.addEventListener("keydown",b),document.addEventListener("mousedown",g),()=>{document.removeEventListener("keydown",b),document.removeEventListener("mousedown",g)}},[n,u]);const x=f.Children.toArray(s),c=x.find(b=>(b==null?void 0:b.type)===ie),_=x.filter(b=>(b==null?void 0:b.type)!==ie);return e.jsx("div",{className:["ds-modal-overlay",u&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...i,children:e.jsxs("div",{className:[`ds-modal ds-modal--${a}`,o&&"ds-modal--scrollable"].filter(Boolean).join(" "),ref:l,role:"dialog","aria-modal":"true","aria-labelledby":t?p:void 0,children:[n&&e.jsx(ae,{className:"ds-modal__close",variant:"ghost",size:"small",icon:e.jsx(k.X,{size:D[2],strokeWidth:1.5}),onClick:h,"aria-label":"Close modal"}),(t||r)&&e.jsxs("div",{className:"ds-modal__header",children:[t&&e.jsx("h3",{id:p,className:"ds-modal__title",children:t}),r&&e.jsx("div",{className:"ds-modal__subheader",children:r})]}),e.jsx("div",{className:"ds-modal__body ds-scrollable",children:_}),c]})})}function ie({children:s}){return!s||f.Children.count(s)===0?null:e.jsx("div",{className:"ds-modal__footer",children:s})}const cs=320;function ds({children:s,title:t,onClose:n,subHeader:a,...o}){const r=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),u=()=>{!n||l||(p(!0),setTimeout(()=>{p(!1),n()},cs))};f.useEffect(()=>{const c=b=>{b.key==="Escape"&&u()},_=b=>{var y,R,N;const g=((R=(y=b.composedPath)==null?void 0:y.call(b))==null?void 0:R[0])??b.target;r.current&&!r.current.contains(g)&&!((N=g.closest)!=null&&N.call(g,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",c),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",_)}},[n,l]);const m=f.Children.toArray(s),h=m.find(c=>(c==null?void 0:c.type)===ie),x=m.filter(c=>(c==null?void 0:c.type)!==ie);return e.jsx("div",{className:["ds-bottom-sheet-overlay",l&&"ds-bottom-sheet-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("div",{ref:r,className:["ds-bottom-sheet",l&&"ds-bottom-sheet--closing"].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[e.jsx("div",{className:"ds-bottom-sheet__handle","aria-hidden":"true"}),n&&e.jsx(ae,{className:"ds-bottom-sheet__close",variant:"ghost",size:"small",icon:e.jsx(k.X,{size:D[2],strokeWidth:1.5}),onClick:u,"aria-label":"Close"}),(t||a)&&e.jsxs("div",{className:"ds-bottom-sheet__header",children:[t&&e.jsx("h3",{id:i,className:"ds-bottom-sheet__title",children:t}),a&&e.jsx("div",{className:"ds-bottom-sheet__subheader",children:a})]}),e.jsx("div",{className:"ds-bottom-sheet__body ds-scrollable",children:x}),h]})})}function De({children:s,title:t="Code",defaultExpanded:n=!1,expanded:a,onToggle:o,padding:r="s",className:i="",...l}){const[p,u]=f.useState(n),m=a!==void 0,h=m?a:p,x=()=>{m?o==null||o(!a):u(_=>!_)},c=["ds-code-accordion",`ds-code-accordion--${r}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:c,...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(k.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 ds-scrollable",children:e.jsx("code",{children:s})})})})]})}function us({children:s,block:t=!1,collapsible:n=!1,title:a="Code",defaultExpanded:o=!1,...r}){return t?n?e.jsx(De,{title:a,defaultExpanded:o,...r,children:s}):e.jsx("pre",{className:"ds-code-block ds-scrollable",...r,children:e.jsx("code",{children:s})}):e.jsx("code",{className:"ds-code-inline",...r,children:s})}function fs({href:s,children:t,onClick:n,target:a,rel:o,...r}){const l=a==="_blank"?o?`${o} noopener noreferrer`:"noopener noreferrer":o;return e.jsx("a",{href:s,className:"ds-link",onClick:n,target:a,rel:l,...r,children:t})}function ms({children:s,size:t="m",variant:n="ghost",...a}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...a,children:f.Children.map(s,o=>f.isValidElement(o)?f.cloneElement(o,{size:t,variant:n}):o)})}function ps({children:s,selected:t=!1,onClick:n,size:a="m",variant:o="ghost",disabled:r=!1,icon:i,href:l,...p}){const u=i&&!s,m=["ds-tab",`ds-tab--${a}`,`ds-tab--${o}`,t&&"ds-tab--selected",u&&"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=c=>{if(r){c.preventDefault();return}c.metaKey||c.ctrlKey||c.button===1||(c.preventDefault(),n==null||n(c))};return e.jsx("a",{role:"tab","aria-current":t?"page":void 0,"aria-disabled":r?"true":void 0,className:m,href:r?void 0:l,onClick:x,...p,children:h})}return e.jsx("button",{role:"tab","aria-selected":t,className:m,onClick:n,disabled:r,...p,children:h})}function hs({options:s,value:t,onChange:n,size:a="m",disabled:o=!1}){const r=f.useRef(null),i=f.useRef(null),[l,p]=f.useState(!1),u=f.useRef(!1),m=f.useRef(null),h=f.useRef(null),x=()=>{if(!r.current)return;const c=r.current.querySelector(`[data-value="${t}"]`);if(!c)return;const _=r.current.getBoundingClientRect(),b=c.getBoundingClientRect(),g=b.left-_.left,y=b.width;i.current?(i.current.style.transition=u.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=g+"px",i.current.style.width=y+"px",u.current=!1):(p(!0),requestAnimationFrame(()=>{if(!i.current||!r.current)return;const R=r.current.querySelector(`[data-value="${t}"]`);if(!R)return;const N=r.current.getBoundingClientRect(),$=R.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=$.left-N.left+"px",i.current.style.width=$.width+"px"}))};return h.current=x,f.useLayoutEffect(()=>{const c=m.current!==t;m.current=t,u.current=l&&c,x()}),f.useEffect(()=>{if(!r.current)return;const c=new ResizeObserver(()=>{u.current=!1,h.current()});return c.observe(r.current),()=>c.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${a}`,o&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:r,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),s.map(c=>e.jsxs("button",{type:"button","data-value":c.value,className:["ds-seg__btn",t===c.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!o&&n(c.value),"aria-pressed":t===c.value,disabled:o,children:[c.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:c.icon}),c.label]},c.value))]})}function me({children:s,title:t,defaultExpanded:n=!1,expanded:a,onToggle:o,padding:r="m",...i}){const[l,p]=f.useState(n),u=a!==void 0,m=u?a:l,h=()=>{u?o==null||o(!a):p(c=>!c)},x=["ds-accordion",`ds-accordion--${r}`,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(k.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 se=8,le=8;function xs(s,t,n){const a=window.innerWidth;let o,r;switch(s){case"top":o=t.top-n.height-se,r=t.left+t.width/2-n.width/2;break;case"bottom":o=t.bottom+se,r=t.left+t.width/2-n.width/2;break;case"left":o=t.top+t.height/2-n.height/2,r=t.left-n.width-se;break;case"right":o=t.top+t.height/2-n.height/2,r=t.right+se;break;default:o=t.bottom+se,r=t.left}const i=Math.max(le,Math.min(a-n.width-le,r)),l=r-i;return{top:o,left:i,arrowOffset:l}}function bs(s,t,n){const a=window.innerWidth,o=window.innerHeight;if(s.top>=t+se+le)return"top";if(o-s.bottom>=t+se+le)return"bottom";if(a-s.right>=n+se+le)return"right";if(s.left>=n+se+le)return"left";const r=Math.max(s.top,o-s.bottom,s.left,a-s.right);return r===s.top?"top":r===o-s.bottom?"bottom":r===a-s.right?"right":"left"}function Be({children:s,content:t,position:n,...a}){const[o,r]=f.useState(!1),[i,l]=f.useState({visibility:"hidden"}),[p,u]=f.useState(n||"top"),m=f.useRef(null),h=f.useRef(null),x=f.useRef(!1),c=()=>{if(!m.current||!h.current)return;const b=m.current.getBoundingClientRect(),g=h.current.getBoundingClientRect(),y=n||bs(b,g.height,g.width),{top:R,left:N,arrowOffset:$}=xs(y,b,g);u(y),l({position:"fixed",top:R,left:N,visibility:"visible","--arrow-offset":`${$}px`})};if(f.useEffect(()=>{if(!o)return;l({position:"fixed",visibility:"hidden"});const b=requestAnimationFrame(c);return window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{cancelAnimationFrame(b),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[o,n]),f.useEffect(()=>{if(!o)return;const b=g=>{m.current&&!m.current.contains(g.target)&&r(!1)};return document.addEventListener("touchstart",b),()=>document.removeEventListener("touchstart",b)},[o]),!t)return s;const _=o&&e.jsx("div",{ref:h,"data-ds-portal":"",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||r(!0)},onMouseLeave:()=>{x.current||r(!1)},onTouchStart:()=>{x.current=!0,r(b=>!b)},...a,children:[s,typeof document<"u"&&fe.createPortal(_,document.body)]})}function _s({checked:s=!1,onChange:t,size:n="m",disabled:a=!1,label:o,id:r,...i}){const l=r||`toggle-${f.useId()}`,p=["ds-toggle",`ds-toggle--${n}`,a&&"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:u=>t==null?void 0:t(u.target.checked),disabled:a,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),o&&e.jsx("span",{className:"ds-toggle__label",children:o})]})}function vs({checked:s=!1,onChange:t,size:n="m",disabled:a=!1,label:o,id:r,...i}){const l=r||`checkbox-${f.useId()}`,p=["ds-checkbox",`ds-checkbox--${n}`,a&&"ds-checkbox--disabled"].filter(Boolean).join(" "),u=n==="xs"?10:n==="small"?14:n==="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:a,...i}),e.jsx("span",{className:"ds-checkbox__box",children:s&&e.jsx(k.Check,{size:u,strokeWidth:2.5,className:"ds-checkbox__icon"})}),o&&e.jsx("span",{className:"ds-checkbox__label",children:o})]})}function js({checked:s=!1,onChange:t,size:n="m",disabled:a=!1,label:o,name:r,value:i,id:l,...p}){const u=l||`radio-${f.useId()}`,m=["ds-radio",`ds-radio--${n}`,a&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:m,htmlFor:u,children:[e.jsx("input",{type:"radio",id:u,className:"ds-radio__input",checked:s,onChange:h=>t==null?void 0:t(h.target.checked),disabled:a,name:r,value:i,...p}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),o&&e.jsx("span",{className:"ds-radio__label",children:o})]})}function Pe({width:s,height:t,shape:n="rect",aspectRatio:a,className:o="",style:r={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${n}`,o].filter(Boolean).join(" "),style:{width:s,height:t,aspectRatio:a,...r},"aria-hidden":"true",...i})}function Ns({lines:s=1,lastLineWidth:t="70%",gap:n,className:a="",style:o={},...r}){return e.jsx("span",{className:["ds-skeleton-text",a].filter(Boolean).join(" "),style:{gap:n,...o},"aria-hidden":"true",...r,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))})}Pe.Text=Ns;function ws(s){let t=2166136261;for(let n=0;n<s.length;n++)t^=s.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t%360}function gs(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 ys({seed:s,icon:t,src:n,size:a=32,className:o="",style:r={},...i}){const l=ws(s??""),[p,u]=f.useState(!1),m=t??e.jsx("span",{className:"ds-avatar__initials",children:gs(s)});return e.jsx("div",{className:["ds-avatar",o].filter(Boolean).join(" "),style:{width:a,height:a,"--ds-avatar-h":l,...r},"aria-hidden":"true",...i,children:n&&!p?e.jsx("img",{src:n,alt:"",onError:()=>u(!0)}):m})}function ks({children:s,size:t="compact",stickyTop:n,maxHeight:a,className:o="",style:r={},...i}){const l={...a?{maxHeight:a}:{},...n!==void 0?{"--ds-table-sticky-top":typeof n=="number"?`${n}px`:n}:{},...r};return e.jsx("div",{className:["ds-table-wrap","ds-scrollable",a?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${t}`,o].filter(Boolean).join(" "),...i,children:s})})}function Es({children:s,...t}){return e.jsx("thead",{...t,children:s})}function Ts({children:s,...t}){return e.jsx("tbody",{...t,children:s})}function Rs({children:s,interactive:t,selected:n,subheader:a,exiting:o,updated:r,className:i="",onClick:l,...p}){return e.jsx("tr",{className:["ds-table-row",t||l?"ds-table-row--interactive":"",n?"ds-table-row--selected":"",a?"ds-table-row--subheader":"",o?"ds-table-row--exiting":"",r?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...p,children:s})}function Ss({children:s,colSpan:t=999,...n}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...n,children:e.jsx("td",{colSpan:t,children:s})})}function $s({children:s,align:t="left",sortDir:n,onSort:a,width:o,className:r="",style:i={},...l}){const p=!!a||n!==void 0,u=n==="asc"?k.ChevronUp:n==="desc"?k.ChevronDown:k.ChevronsUpDown;return e.jsx("th",{className:["ds-th",p?"ds-th--sortable":"",n?"ds-th--sorted":"",t!=="left"?`ds-table-cell--${t}`:"",r].filter(Boolean).join(" "),onClick:a,style:{width:o,...i},...l,children:p?e.jsxs("span",{className:"ds-th__inner",children:[s,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(u,{size:11,strokeWidth:2.5})})]}):s})}function Is({children:s,align:t="left",secondary:n,muted:a,truncate:o,nowrap:r,className:i="",...l}){return e.jsx("td",{className:["ds-td",t!=="left"?`ds-table-cell--${t}`:"",n?"ds-table-cell--secondary":"",a?"ds-table-cell--muted":"",o?"ds-table-cell--truncate":"",r?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:s})}function As({icon:s,title:t,description:n,action:a,size:o="m",className:r="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${o}`,r].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}),n&&e.jsx("div",{className:"ds-empty-state__description",children:n}),a&&e.jsx("div",{className:"ds-empty-state__action",children:a})]})}function Ds({label:s,hint:t,error:n,required:a=!1,disabled:o=!1,htmlFor:r,children:i,className:l="",style:p,...u}){const m=f.useId(),h=r??m,x=`${h}-hint`,c=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":n?"error":void 0,"data-required":a?"":void 0,"data-disabled":o?"":void 0,style:p,...u,children:[s&&e.jsx("label",{className:"ds-field-label",htmlFor:h,children:s}),e.jsx("div",{className:"ds-field-control",children:i}),t&&!n&&e.jsx("p",{className:"ds-field-hint",id:x,children:t}),n&&e.jsx("p",{className:"ds-field-error",id:c,role:"alert",children:n})]})}function Bs({label:s,value:t,delta:n,size:a="m",inline:o=!1,className:r="",style:i,...l}){const p=n!=null&&n.startsWith("+")?"up":n!=null&&n.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${a}`,o&&"ds-stat--inline",r].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}),n!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${p}`,children:n})]})}function Ps({children:s,separator:t="/","aria-label":n="Breadcrumb",className:a="",style:o,...r}){const i=f.Children.toArray(s).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${a?` ${a}`:""}`,"aria-label":n,style:o,...r,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 Cs({page:s,total:t,onChange:n,siblings:a=1,"aria-label":o="Pagination",className:r="",style:i,...l}){const p=Ls(s,t,a);return e.jsxs("nav",{className:`ds-pagination${r?` ${r}`:""}`,"aria-label":o,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(s-1),disabled:s<=1,"aria-label":"Previous page",children:e.jsx(k.ChevronLeft,{size:16})}),p.map((u,m)=>u==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${m}`):e.jsx("button",{className:`ds-pagination-page${u===s?" ds-pagination-page--current":""}`,onClick:()=>u!==s&&(n==null?void 0:n(u)),"aria-current":u===s?"page":void 0,"aria-label":`Page ${u}`,children:u},u)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(s+1),disabled:s>=t,"aria-label":"Next page",children:e.jsx(k.ChevronRight,{size:16})})]})}function Ls(s,t,n){if(t<=7)return Array.from({length:t},(i,l)=>l+1);const a=Math.max(2,s-n),o=Math.min(t-1,s+n),r=[1];a>2&&r.push("…");for(let i=a;i<=o;i++)r.push(i);return o<t-1&&r.push("…"),r.push(t),r}const Ms=200;function zs({children:s,title:t,onClose:n,side:a="right",...o}){const r=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),u=()=>{!n||l||(p(!0),setTimeout(()=>{p(!1),n()},Ms))};f.useEffect(()=>{const c=b=>{b.key==="Escape"&&u()},_=b=>{var y,R,N;const g=((R=(y=b.composedPath)==null?void 0:y.call(b))==null?void 0:R[0])??b.target;r.current&&!r.current.contains(g)&&!((N=g.closest)!=null&&N.call(g,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",c),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",_)}},[n,l]);const m=f.Children.toArray(s),h=m.find(c=>(c==null?void 0:c.type)===be),x=m.filter(c=>(c==null?void 0:c.type)!==be);return e.jsx("div",{className:["ds-drawer-overlay",l&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("aside",{className:["ds-drawer",l&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":a,ref:r,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}),n&&e.jsx("button",{className:"ds-drawer-close",onClick:u,"aria-label":"Close drawer",children:e.jsx(k.X,{size:D[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body ds-scrollable",children:x}),h]})})}function be({children:s}){return e.jsx("footer",{className:"ds-drawer-footer",children:s})}const Fs=320;function Os({children:s,title:t,onClose:n,subHeader:a,...o}){const r=f.useRef(null),i=f.useId(),[l,p]=f.useState(!1),u=()=>{!n||l||(p(!0),setTimeout(()=>{p(!1),n()},Fs))};f.useEffect(()=>{const c=b=>{b.key==="Escape"&&u()},_=b=>{var y,R,N;const g=((R=(y=b.composedPath)==null?void 0:y.call(b))==null?void 0:R[0])??b.target;r.current&&!r.current.contains(g)&&!((N=g.closest)!=null&&N.call(g,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",c),document.addEventListener("mousedown",_),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",_)}},[n,l]);const m=f.Children.toArray(s),h=m.find(c=>(c==null?void 0:c.type)===_e||(c==null?void 0:c.type)===ie),x=m.filter(c=>(c==null?void 0:c.type)!==_e&&(c==null?void 0:c.type)!==ie);return e.jsx("div",{className:["ds-side-page-overlay",l&&"ds-side-page-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("div",{ref:r,className:["ds-side-page",l&&"ds-side-page--closing"].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":t?i:void 0,children:[n&&e.jsx(ae,{className:"ds-side-page__close",variant:"ghost",size:"small",icon:e.jsx(k.X,{size:D[2],strokeWidth:1.5}),onClick:u,"aria-label":"Close"}),(t||a)&&e.jsxs("div",{className:"ds-side-page__header",children:[t&&e.jsx("h3",{id:i,className:"ds-side-page__title",children:t}),a&&e.jsx("div",{className:"ds-side-page__subheader",children:a})]}),e.jsx("div",{className:"ds-side-page__body ds-scrollable",children:x}),h]})})}function _e({children:s}){return!s||f.Children.count(s)===0?null:e.jsx("div",{className:"ds-side-page__footer",children:s})}const Ce=f.createContext({collapsed:!1,side:"left"});function Ws({children:s,collapsed:t=!1,side:n="left",className:a="",...o}){const r=["ds-nav-rail",t&&"ds-nav-rail--collapsed",`ds-nav-rail--${n}`,a].filter(Boolean).join(" ");return e.jsx(Ce.Provider,{value:{collapsed:t,side:n},children:e.jsx("nav",{className:r,...o,children:s})})}function Us({icon:s,label:t,selected:n=!1,disabled:a=!1,href:o,onClick:r,count:i,updated:l=!1,open:p=!1,onboarding:u=!1,className:m="",...h}){const{collapsed:x,side:c}=f.useContext(Ce),g={className:["ds-nav-rail__item",m].filter(Boolean).join(" "),onClick:a?void 0:r,"aria-current":n?"page":void 0,"aria-disabled":a?"true":void 0,"aria-label":x?t:void 0,tabIndex:a?-1:void 0,...{"data-selected":n||void 0,"data-disabled":a||void 0,"data-open":p||void 0,"data-onboarding":u||void 0},...h},y=i!=null,R=c==="left"?"right":"left",N=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:s}),!x&&e.jsx("span",{className:"ds-nav-rail__label",children:t}),!x&&l&&e.jsx(te,{size:"xs",variant:"accent",className:"ds-nav-rail__badge-expanded",children:"New"}),!x&&y&&e.jsx("span",{className:["ds-nav-rail__count",i===0&&"ds-nav-rail__count--zero"].filter(Boolean).join(" "),children:i}),x&&l&&!y&&e.jsx("span",{className:"ds-nav-rail__dot","aria-hidden":"true"}),x&&y&&e.jsx(te,{size:"xs",variant:"default",className:"ds-nav-rail__badge-collapsed",children:i})]}),$=o?e.jsx("a",{href:a?void 0:o,...g,children:N}):e.jsx("button",{type:"button",...g,children:N});return x?e.jsx(Be,{content:t,position:R,children:$}):$}const Vs={info:k.Info,success:k.CheckCircle,warning:k.AlertTriangle,error:k.XCircle};function Xs({children:s,variant:t="info",action:n,onAction:a,onDismiss:o,role:r,...i}){const l=Vs[t],p=r||(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}),n&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:a,children:n}),o&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:o,"aria-label":"Dismiss",children:e.jsx(k.X,{size:D[2],strokeWidth:1.5})})]})}function Ys({trigger:s,items:t=[],open:n,onOpenChange:a,align:o="left",className:r="",style:i,...l}){const[p,u]=f.useState(!1),[m,h]=f.useState(!1),x=n!==void 0,c=x?n:p,_=f.useRef(null),b=f.useRef(null),g=f.useRef(null),y=f.useRef(null),[R,N]=f.useState({}),$=f.useRef(null),P=150,B=()=>{if(x)a==null||a(!1);else{if(m)return;h(!0),$.current=setTimeout(()=>{u(!1),h(!1)},P)}},V=()=>{const v=!c;x?a==null||a(v):v?(clearTimeout($.current),h(!1),u(!0)):B()},X=()=>{c||(x?a==null||a(!0):(clearTimeout($.current),h(!1),u(!0)))};f.useEffect(()=>()=>clearTimeout($.current),[]),f.useEffect(()=>{if(!c)return;const v=300,E=()=>{var H;const I=(H=_.current)==null?void 0:H.getBoundingClientRect();if(!I)return;const C=window.innerHeight-I.bottom,Y=C<v+8&&I.top>C;N(o==="right"?Y?{bottom:window.innerHeight-I.top+4,top:"auto",right:window.innerWidth-I.right}:{top:I.bottom+4,bottom:"auto",right:window.innerWidth-I.right}:Y?{bottom:window.innerHeight-I.top+4,top:"auto",left:I.left}:{top:I.bottom+4,bottom:"auto",left:I.left})};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[c,o]);const z=()=>{var E;const v=(E=g.current)==null?void 0:E.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');v==null||v.focus()};f.useEffect(()=>{if(!c)return;const v=I=>{var C,Y;!((C=_.current)!=null&&C.contains(I.target))&&!((Y=b.current)!=null&&Y.contains(I.target))&&B()},E=I=>{I.key==="Escape"&&(B(),z())};return document.addEventListener("mousedown",v),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E)}},[c]),f.useEffect(()=>{if(!c||!y.current||!b.current)return;const v=w(),E=y.current==="last"?v[v.length-1]:v[0];E==null||E.focus(),y.current=null},[c]);const w=()=>b.current?[...b.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],O=v=>{var E,I;if(v.key==="ArrowDown")v.preventDefault(),c?(E=w()[0])==null||E.focus():(y.current="first",X());else if(v.key==="ArrowUp")if(v.preventDefault(),!c)y.current="last",X();else{const C=w();(I=C[C.length-1])==null||I.focus()}},q=v=>{var C,Y,H,S;const E=w(),I=E.findIndex(d=>d===document.activeElement);switch(v.key){case"ArrowDown":v.preventDefault(),(C=E[Math.min(I+1,E.length-1)])==null||C.focus();break;case"ArrowUp":v.preventDefault(),I<=0?z():(Y=E[I-1])==null||Y.focus();break;case"Home":v.preventDefault(),(H=E[0])==null||H.focus();break;case"End":v.preventDefault(),(S=E[E.length-1])==null||S.focus();break;case"Tab":B();break}},W=c&&e.jsx("div",{ref:b,role:"menu","data-ds-portal":"",className:["ds-dropdown__menu",`ds-dropdown__menu--${o}`,m&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:R,onKeyDown:q,children:t.map((v,E)=>{if(v.separator)return e.jsx("div",{className:"ds-dropdown__separator"},E);if(v.type==="section")return e.jsxs("div",{className:"ds-dropdown__section",children:[v.label&&e.jsx("div",{className:"ds-dropdown__section-label",children:v.label}),e.jsx("div",{className:"ds-dropdown__section-content",children:v.content})]},E);const I=!!v.href,C=I?"a":"button",Y=I?{href:v.disabled?void 0:v.href,"aria-disabled":v.disabled?"true":void 0}:{type:"button",disabled:v.disabled};return e.jsxs(C,{role:"menuitem",className:["ds-dropdown__item",v.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...Y,onClick:()=>{var H;(H=v.onClick)==null||H.call(v),B()},children:[v.icon&&e.jsx("span",{className:"ds-dropdown__item-icon",children:v.icon}),e.jsx("span",{className:"ds-dropdown__item-label",children:v.label}),v.shortcut&&e.jsx("span",{className:"ds-dropdown__item-shortcut",children:v.shortcut})]},E)})});return e.jsxs("div",{ref:_,className:["ds-dropdown",r].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:g,className:"ds-dropdown__trigger",onClick:V,onKeyDown:O,children:s}),typeof document<"u"&&fe.createPortal(W,document.body)]})}function qs({value:s=0,size:t="m",variant:n="default",showValue:a=!1,min:o=2,animate:r=!0}){const i=Math.min(100,Math.max(0,s)),l=Math.max(o,i),p=n==="auto"?i>=70?"success":i>=50?"warning":"danger":n;return e.jsxs("div",{className:["ds-progress",`ds-progress--${t}`,!r&&"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}%`}})}),a&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const Hs=s=>1-Math.pow(1-s,3),Ks=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Le(s,{duration:t=600}={}){const[n,a]=f.useState(s),o=f.useRef(s),r=f.useRef(null);return f.useEffect(()=>{if(Ks()){a(s),o.current=s;return}const i=o.current,l=s-i;if(l===0)return;let p=null;const u=m=>{p||(p=m);const h=Math.min((m-p)/t,1);a(i+l*Hs(h)),h<1?r.current=requestAnimationFrame(u):o.current=s};return r.current=requestAnimationFrame(u),()=>cancelAnimationFrame(r.current)},[s,t]),n}function Gs({value:s,duration:t=600,decimals:n=0,prefix:a="",suffix:o=""}){const i=Le(s,{duration:t}).toFixed(n);return`${a}${i}${o}`}function Me({threshold:s=.1,rootMargin:t="0px",once:n=!1}={}){const a=f.useRef(null),[o,r]=f.useState(!1);return f.useEffect(()=>{const i=a.current;if(!i)return;const l=new IntersectionObserver(([p])=>{p.isIntersecting?(r(!0),n&&l.disconnect()):n||r(!1)},{threshold:s,rootMargin:t});return l.observe(i),()=>l.disconnect()},[s,t,n]),{ref:a,inView:o}}function Js({children:s,as:t="div",once:n=!1,threshold:a=.1,rootMargin:o="0px",onEnter:r,onLeave:i,...l}){const{ref:p,inView:u}=Me({threshold:a,rootMargin:o,once:n}),m=f.useRef(!1);return f.useEffect(()=>{u&&!m.current&&(r==null||r()),!u&&m.current&&(i==null||i()),m.current=u},[u]),e.jsx(t,{ref:p,...l,children:typeof s=="function"?s(u):s})}const Ee={default:k.Info,success:k.CheckCircle,warning:k.AlertTriangle,error:k.XCircle};let ce=[];const ve=new Set;function ze(){ve.forEach(s=>s([...ce]))}function Zs(s){ce=[...ce,s],ze()}function Qs(s){ce=ce.filter(t=>t.id!==s),ze()}function et(){const s=(t,n={})=>{Zs({id:`${Date.now()}-${Math.random()}`,message:t,type:"default",duration:4e3,...n})};return s.success=(t,n)=>s(t,{...n,type:"success"}),s.error=(t,n)=>s(t,{...n,type:"error"}),s.warning=(t,n)=>s(t,{...n,type:"warning"}),{toast:s}}function st({data:s,onDismiss:t}){const[n,a]=f.useState(!1),o=f.useRef(null);f.useEffect(()=>(requestAnimationFrame(()=>a(!0)),s.duration>0&&(o.current=setTimeout(()=>r(),s.duration)),()=>clearTimeout(o.current)),[]);function r(){a(!1),setTimeout(()=>t(s.id),250)}const i=Ee[s.type]??Ee.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${s.type}`,n&&"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:r,"aria-label":"Закрыть",children:e.jsx(k.X,{size:D[3],strokeWidth:1.5})})]})}function tt({position:s="bottom-right"}){const[t,n]=f.useState(()=>[...ce]);return f.useEffect(()=>(ve.add(n),()=>ve.delete(n)),[]),!t.length||typeof document>"u"?null:fe.createPortal(e.jsx("div",{"data-ds-portal":"",className:["ds-toast-container",`ds-toast-container--${s}`].join(" "),children:t.map(a=>e.jsx(st,{data:a,onDismiss:Qs},a.id))}),document.body)}const nt={running:e.jsx(te,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(te,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(te,{size:"xs",variant:"error",children:"Error"})};function Fe({label:s,status:t="idle",icon:n,badge:a,defaultExpanded:o=!1,expanded:r,onToggle:i,children:l,className:p="",...u}){const m=t==="running",h=e.jsxs("span",{className:"ds-tool-card__title-row",children:[n&&e.jsx("span",{className:"ds-tool-card__icon",children:n}),e.jsx("span",{className:"ds-tool-card__label",children:s}),nt[t],a]});return l?e.jsx("div",{className:["ds-tool-card",m&&"ds-tool-card--running",p].filter(Boolean).join(" "),...u,children:e.jsx(me,{title:h,padding:"s",defaultExpanded:o,expanded:m?!1:r,onToggle:m?void 0:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})}):e.jsx("div",{className:["ds-tool-card","ds-tool-card--bubble",p].filter(Boolean).join(" "),...u,children:h})}function Oe({text:s,size:t="xs",timeout:n=800,"aria-label":a="Copy to clipboard",...o}){const[r,i]=f.useState(!1),l=p=>{p.currentTarget.blur(),navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),n)})};return e.jsx(ae,{variant:"ghost",size:t,state:r?"success":"idle",icon:e.jsx(k.Copy,{size:D[1],strokeWidth:1.5}),"aria-label":a,onClick:l,...o})}function rt({content:s,streaming:t=!1,...n}){const[a,o]=f.useState(t);return f.useEffect(()=>{o(!!t)},[t]),e.jsx(me,{expanded:a,onToggle:o,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(k.Brain,{size:D[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Ae,{secondary:!0,children:"Thinking"})]}),...n,children:e.jsxs(Ne,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[s,t&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function at({count:s,current:t=0,done:n=[],onChange:a,showCounter:o=!0,className:r="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",r].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:s},(p,u)=>{const m=u===t,h=n.includes(u)&&!m,x=a&&(u<=t||n.includes(u)),c=["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:c,role:"tab","aria-selected":m,"aria-label":`Step ${u+1}`,disabled:!x||u===t,onClick:()=>a==null?void 0:a(u),children:h?e.jsx(k.Check,{size:8,strokeWidth:3}):null},u)})}),o&&e.jsxs(Ne,{secondary:!0,className:"ds-step-indicator__counter",children:[t+1," / ",s]})]})}function ot({content:s,isStreaming:t=!1,cursor:n="line",onChunk:a,className:o="",...r}){const i=f.useRef(s);return f.useEffect(()=>{s!==i.current&&(a==null||a(s),i.current=s)},[s,a]),e.jsxs("span",{className:["ds-streaming-text",o].filter(Boolean).join(" "),...r,children:[s,t&&n!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${n}`,"aria-hidden":"true"})]})}function it({role:s="assistant",header:t,footer:n,attachments:a,isStreaming:o=!1,children:r,className:i="",...l}){const p=["ds-chat-message",`ds-chat-message--${s}`,o&&"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:r})}):s==="user"?e.jsxs("div",{className:p,...l,children:[a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__bubble",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]}):e.jsxs("div",{className:p,...l,children:[t&&e.jsx("div",{className:"ds-chat-message__header",children:t}),a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__body",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]})}function lt(s,{containerRef:t,smartPause:n=!0}={}){const a=f.useRef(!1),o=f.useRef(0);f.useEffect(()=>{const r=t==null?void 0:t.current;if(!r)return;const i=()=>{const l=r.scrollHeight-r.scrollTop-r.clientHeight<64;!l&&r.scrollTop<o.current&&(a.current=!0),l&&(a.current=!1),o.current=r.scrollTop};return r.addEventListener("scroll",i,{passive:!0}),()=>r.removeEventListener("scroll",i)},[t]),f.useEffect(()=>{const r=t==null?void 0:t.current;r&&(n&&a.current||(r.scrollTop=r.scrollHeight))},s)}function We({prompts:s,enabled:t,typingSpeed:n=38,erasingSpeed:a=18,holdTime:o=2200,betweenTime:r=380,manualPauseMs:i=5e3}){const[l,p]=f.useState(0),[u,m]=f.useState(""),h=f.useRef("typing"),x=f.useRef(0),c=f.useRef(0),_=f.useRef(null),b=f.useRef(0);f.useEffect(()=>{c.current=l},[l]),f.useEffect(()=>{if(_.current&&(clearTimeout(_.current),_.current=null),!t||s.length===0){m(""),x.current=0,h.current="typing";return}const $=()=>{const P=Date.now();if(b.current>P){_.current=setTimeout($,b.current-P);return}const B=s[c.current%s.length]??"";h.current==="typing"?(x.current+=1,m(B.slice(0,x.current)),x.current>=B.length?(h.current="holding",_.current=setTimeout($,o)):_.current=setTimeout($,n+Math.random()*28)):h.current==="holding"?(h.current="erasing",_.current=setTimeout($,a)):(x.current=Math.max(0,x.current-1),m(B.slice(0,x.current)),x.current<=0?(h.current="typing",c.current=(c.current+1)%s.length,p(c.current),_.current=setTimeout($,r)):_.current=setTimeout($,a))};return _.current=setTimeout($,260),()=>{_.current&&clearTimeout(_.current)}},[t,s,n,a,o,r]);const g=$=>{if(s.length===0)return;const P=($%s.length+s.length)%s.length,B=s[P];c.current=P,x.current=B.length,h.current="holding",b.current=Date.now()+i,p(P),m(B)},y=()=>g(c.current+1),R=()=>g(c.current-1),N=s[l%s.length]??"";return{displayed:u,currentPrompt:N,index:l,next:y,prev:R}}let ct=0;function dt({value:s="",onChange:t,onSubmit:n,onStop:a,onKeyDown:o,loading:r=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:p,attachments:u,images:m,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:c,onRemoveImage:_,acceptImage:b,acceptFile:g,maxImages:y,maxImageSize:R,leftSlot:N,rightSlot:$,className:P="",...B}){const V=f.useRef(null),X=f.useRef(null),z=f.useRef(0),[w,O]=f.useState(!1),[q,W]=f.useState([]),v=j=>{const A=++ct;W(U=>[...U,{id:A,msg:j}]),setTimeout(()=>W(U=>U.filter(K=>K.id!==A)),6e3)},E=j=>W(A=>A.filter(U=>U.id!==j)),I=j=>j.type.startsWith("image/"),C=()=>!0,Y=b??I,H=g??C,S=j=>{const A=[],U=[],K=[],G=[];let Z=0,oe=y!=null?y-((m==null?void 0:m.length)??0):1/0;for(const Q of j)Y(Q)?R&&Q.size>R?K.push(Q.name):oe>0?(A.push(Q),oe--):Z++:H(Q)?U.push(Q):G.push(Q.name);return{imageFiles:A,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}},d=j=>{const{imageFiles:A,docFiles:U,tooLarge:K,skipped:G,limitExceeded:Z}=S(j);K.length&&v(`File${K.length>1?"s":""} too large${R?` (max ${R/1024/1024}MB)`:""}: ${K.join(", ")}`),G.length&&v(`Skipped unsupported file${G.length>1?"s":""}: ${G.join(", ")}`),Z&&v(`Max ${y} images per message`),x&&A.length&&x(A);const oe=U.concat(x?[]:A);h&&oe.length&&h(oe)};f.useEffect(()=>{const j=X.current;j&&(j.style.height="auto",j.style.height=`${Math.min(j.scrollHeight,200)}px`)},[s]),f.useEffect(()=>{const j=A=>{var K,G,Z;if(r||i)return;const U=(K=A.target)==null?void 0:K.tagName;U==="INPUT"||U==="TEXTAREA"||U==="SELECT"||(G=A.target)!=null&&G.isContentEditable||A.ctrlKey||A.metaKey||A.altKey||A.key.length!==1&&A.key!=="Backspace"&&A.key!=="Delete"||(Z=X.current)==null||Z.focus()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[r,i]);const T=j=>{j.preventDefault(),z.current++,j.dataTransfer.types.includes("Files")&&O(!0)},L=j=>{j.preventDefault(),z.current--,z.current===0&&O(!1)},M=j=>j.preventDefault(),ee=j=>{j.preventDefault(),z.current=0,O(!1);const A=Array.from(j.dataTransfer.files);A.length&&d(A)},ne=j=>{const A=Array.from(j.target.files||[]);V.current&&(V.current.value=""),A.length&&d(A)},F=j=>{var Q;if(!x)return;const A=(Q=j.clipboardData)==null?void 0:Q.items;if(!A)return;const U=[];for(const Xe of A){const ge=Xe.getAsFile();ge&&U.push(ge)}if(U.length===0)return;const{imageFiles:K,tooLarge:G,skipped:Z,limitExceeded:oe}=S(U);G.length&&v(`File${G.length>1?"s":""} too large: ${G.join(", ")}`),Z.length&&v(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),oe&&v(`Max ${y} images per message`),K.length&&(j.preventDefault(),x(K))},J=!r&&!i&&!!(p!=null&&p.length)&&s.length===0,re=We({prompts:p??[],enabled:J}),pe=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}}o==null||o(j)},Ve=(s.trim()||(m==null?void 0:m.length)>0||(u==null?void 0:u.length)>0)&&!i,we=h||x;return e.jsxs("div",{className:["ds-prompt-input",P].filter(Boolean).join(" "),...B,children:[we&&e.jsx("input",{ref:V,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:ne}),e.jsxs("div",{className:["ds-prompt-input__box",w&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:T,onDragLeave:L,onDragOver:M,onDrop:ee,children:[w&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:X,value:s,onChange:j=>t==null?void 0:t(j.target.value),onKeyDown:pe,onPaste:F,placeholder:J?"":l,disabled:r||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: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,A)=>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:_(A),"aria-label":"Remove image",type:"button",children:e.jsx(k.X,{size:12,strokeWidth:2})})]},A))}),q.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:q.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:()=>E(j.id),"aria-label":"Dismiss",children:e.jsx(k.X,{size:D[1],strokeWidth:1.5})})]},j.id))}),u&&u.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:u.map((j,A)=>e.jsx(te,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[j.uploading?e.jsx(k.Loader,{size:D[1],strokeWidth:1.5,className:"spin"}):e.jsx(k.Paperclip,{size:D[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:()=>c==null?void 0:c(A),children:e.jsx(k.X,{size:D[1],strokeWidth:1.5})})]})},A))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[we&&e.jsx(ae,{variant:"ghost",size:"xs",icon:e.jsx(k.Paperclip,{size:D[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var j;return(j=V.current)==null?void 0:j.click()}}),N,$,e.jsx("div",{className:"ds-prompt-input__spacer"}),r?e.jsx(ae,{variant:"primary",size:"xs",icon:e.jsx(k.Square,{size:D[2],strokeWidth:1.5}),onClick:a,"aria-label":"Stop"}):e.jsx(ae,{variant:"primary",size:"xs",icon:e.jsx(k.ArrowUp,{size:D[2],strokeWidth:1.5}),onClick:n,disabled:!Ve,"aria-label":"Send"})]})]})]})}const Te={fast:0,standard:1,premium:2},Re={fast:"data-5",standard:"data-3",premium:"data-6"};function ut({models:s=[],value:t,onChange:n,size:a="xs",minTier:o,showAutoOption:r=!1,groupByTier:i=!0,className:l="",...p}){const[u,m]=f.useState(!1),h=f.useRef(null),x=f.useRef(null),c=f.useRef(null),[_,b]=f.useState({}),g=s.filter(w=>!o||w.name==="auto"?!0:(Te[w.tier]??1)>=(Te[o]??1)),y=g.find(w=>w.name==="auto"),R=g.filter(w=>w.name!=="auto"),N=s.find(w=>w.name===t),P=new Set(R.map(w=>w.tier).filter(Boolean)).size>1;f.useEffect(()=>{if(!u)return;const w=320,O=()=>{var C;const v=(C=x.current)==null?void 0:C.getBoundingClientRect();if(!v)return;const E=window.innerHeight-v.bottom,I=E<w+8&&v.top>E;b({position:"fixed",zIndex:"var(--z-dropdown, 500)",left:v.left,...I?{bottom:window.innerHeight-v.top+4,top:"auto"}:{top:v.bottom+4,bottom:"auto"}})};O(),window.addEventListener("scroll",O,!0),window.addEventListener("resize",O);const q=v=>{var E,I;!((E=h.current)!=null&&E.contains(v.target))&&!((I=c.current)!=null&&I.contains(v.target))&&m(!1)},W=v=>{v.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)}},[u]);const B=w=>{n==null||n(w),m(!1)},V=w=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",w.name===t&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>B(w.name),children:[w.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:w.icon}):e.jsx(k.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:w.displayName||w.name}),P&&w.tier&&e.jsx(te,{size:"xs",variant:Re[w.tier]||"default",children:w.tier})]},w.name),X=()=>!i||!P?R.map(V):["fast","standard","premium"].flatMap(w=>{const O=R.filter(q=>q.tier===w);return O.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":w,children:w.charAt(0).toUpperCase()+w.slice(1)},`lbl-${w}`),...O.map(V)]:[]}),z=u&&e.jsxs("div",{ref:c,className:"ds-model-picker__menu ds-scrollable","data-ds-portal":"",style:_,children:[r&&y&&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:()=>B("auto"),children:[e.jsx(k.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"})]}),X()]});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(w=>!w),"aria-haspopup":"listbox","aria-expanded":u,children:[N!=null&&N.icon?e.jsx("span",{children:N.icon}):e.jsx(k.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(N==null?void 0:N.displayName)||(N==null?void 0:N.name)||t}),P&&(N==null?void 0:N.tier)&&e.jsx(te,{size:"xs",variant:Re[N.tier]||"default",children:N.tier})]}),typeof document<"u"&&fe.createPortal(z,document.body)]})}const ft=({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:je(t)})]});function je(s){return s!=null&&s.length?"p. "+s.join(", "):null}function mt(s){const t=new Map;for(const n of s)t.has(n.filename)||t.set(n.filename,{filename:n.filename,url:n.url,items:[]}),t.get(n.filename).items.push(n);return[...t.values()]}function pt({sources:s=[],layout:t="list",title:n="Sources",maxVisible:a=5,onSourceClick:o}){const[r,i]=f.useState(!1),l=mt(s),p=l.length>a,u=r?l:l.slice(0,a),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:[u.map(x=>{const c=x.items.map(b=>b.page).filter(Boolean),_=!!o;return e.jsxs("div",{className:`ds-sources-panel__compact-row${_?" ds-sources-panel__compact-row--clickable":""}`,onClick:_?()=>o(x.items[0]):void 0,children:[e.jsx(k.FileText,{size:D[1],strokeWidth:1.5,className:"ds-sources-panel__compact-icon"}),e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),c.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(c)})]},x.filename)}),p&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-a," more sources"]})]}):e.jsxs("div",{className:h,children:[n&&e.jsx("div",{className:"ds-sources-panel__title",children:n}),u.map(x=>{const c=x.items.map(b=>b.page).filter(Boolean),_=!!o;return m?e.jsx(me,{title:e.jsx(ft,{filename:x.filename,pages:c}),padding:"s",children:x.items.map((b,g)=>e.jsx("div",{className:`ds-sources-panel__snippet${_?" ds-sources-panel__snippet--clickable":""}`,onClick:_?()=>o(b):void 0,children:b.snippet??`p. ${b.page}`},g))},x.filename):e.jsxs("div",{className:`ds-sources-panel__row${_?" ds-sources-panel__row--clickable":""}`,onClick:_?()=>o(x.items[0]):void 0,children:[e.jsx("span",{className:"ds-sources-panel__filename",children:x.filename}),c.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:je(c)})]},x.filename)}),p&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-a," more sources"]})]})}function Se(s){return s>=1e6?(s/1e6).toFixed(1).replace(/\.0$/,"")+"M":s>=1e3?(s/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(s)}function ht({used:s,limit:t,size:n="s",showCount:a=!0,showPercent:o=!1,warningThreshold:r=.8,errorThreshold:i=1}){const l=t>0?s/t:0,p=Math.min(l*100,100),u=l>=i?"error":l>=r?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${n}`,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--${u}`,style:{width:`${p}%`}})}),(a||o)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${u}`,children:[a&&e.jsxs("span",{children:[Se(s)," / ",Se(t)," tokens"]}),o&&e.jsxs("span",{children:[Math.round(l*100),"%"]})]})]})}const $e=5;function xt(s){return s<.34?"low":s<.67?"medium":"high"}function bt({value:s=0,size:t="xs",showLabel:n="none",layout:a="inline"}){const o=Math.max(0,Math.min(1,s)),r=Math.round(o*$e),i=xt(o);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${t}`,`ds-confidence-bar--${i}`,a==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:$e},(l,p)=>e.jsx("div",{className:`ds-confidence-bar__seg${p<r?" ds-confidence-bar__seg--filled":""}`},p))}),n==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const _t={add:"+",remove:"-",context:" "};function he({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:_t[s.type]}),e.jsx("span",{className:"ds-diff-view__text",children:s.text})]})}function vt({lines:s=[],layout:t="inline",wordWrap:n=!1,lineNumbers:a=!0,maxHeight:o,title:r}){const i=["ds-diff-view",`ds-diff-view--${t}`,n&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=o?{maxHeight:o,overflowY:"auto"}:void 0;if(t==="split"){const p=s.filter(m=>m.type==="remove"||m.type==="context"),u=s.filter(m=>m.type==="add"||m.type==="context");return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsxs("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:p.map((m,h)=>e.jsx(he,{line:m,lineNumbers:a},h))}),e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:u.map((m,h)=>e.jsx(he,{line:m,lineNumbers:a},h))})]})]})}return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsx("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:s.map((p,u)=>e.jsx(he,{line:p,lineNumbers:a},u))})]})}function Ue({value:s="idle",onLike:t,onDislike:n,className:a="",...o}){const r=s!=="idle";return e.jsxs("div",{className:["ds-message-feedback",r&&"ds-message-feedback--voted",a].filter(Boolean).join(" "),...o,children:[(!r||s==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:t,disabled:r,"aria-label":"Like","aria-pressed":s==="liked",children:e.jsx(k.ThumbsUp,{size:D[1],strokeWidth:1.5,fill:s==="liked"?"currentColor":"none"})}),(!r||s==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",s==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:n,disabled:r,"aria-label":"Dislike","aria-pressed":s==="disliked",children:e.jsx(k.ThumbsDown,{size:D[1],strokeWidth:1.5,fill:s==="disliked"?"currentColor":"none"})})]})}function jt(s){const t=s instanceof Date?s:new Date(s);if(isNaN(t))return null;const n=new Date,a=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(o-864e5);if(t>=o)return a;if(t>=r)return`Yesterday ${a}`;const i=t.getDate(),l=t.toLocaleString([],{month:"short"});return`${i} ${l} ${a}`}function Nt({role:s="assistant",text:t,timestamp:n,feedbackValue:a="idle",onLike:o,onDislike:r,className:i="",...l}){const p=s==="assistant"&&(o||r),u=!!t,m=n?jt(n):null;return!p&&!u&&!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 ds-message-action",children:m}),p&&e.jsx(Ue,{className:"ds-message-action",value:a,onLike:o,onDislike:r}),u&&e.jsx(Oe,{className:"ds-message-action",text:t}),s==="assistant"&&m&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:m})]})}function wt({label:s,className:t="",...n}){return e.jsxs("span",{className:["ds-thinking-dot",t].filter(Boolean).join(" "),...n,children:[e.jsx("span",{className:"ds-thinking-dot__pulse"}),s&&e.jsx("span",{className:"ds-thinking-dot__label",children:s})]})}function gt({variant:s="light",glow:t,mask:n=!0,style:a,...o}){const r=s==="dark",i=t??r,l=r?"rgba(255,250,250,0.05)":"var(--color-border-light)",p=r?"rgba(255,250,250,0.025)":"color-mix(in srgb, var(--color-border-light) 50%, transparent)";return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden",zIndex:0,...i&&{background:"radial-gradient(ellipse 1000px 500px at 50% 30%, rgba(234,100,100,0.18), transparent 70%)"},...a},...o,children:e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:[`linear-gradient(${l} 1px, transparent 1px)`,`linear-gradient(90deg, ${l} 1px, transparent 1px)`,`linear-gradient(${p} 1px, transparent 1px)`,`linear-gradient(90deg, ${p} 1px, transparent 1px)`].join(", "),backgroundSize:"80px 80px, 80px 80px, 16px 16px, 16px 16px",backgroundPosition:"-1px -1px, -1px -1px, -1px -1px, -1px -1px",...n&&{WebkitMaskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)",maskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)"}}})})}function yt({children:s,axis:t="y",style:n,className:a="",...o}){const r=t==="x"?{overflowX:"auto",overflowY:"hidden"}:t==="both"?{overflow:"auto"}:{overflowY:"auto",overflowX:"hidden"};return e.jsx("div",{className:`ds-scrollable ${a}`,style:{...r,...n},...o,children:s})}exports.Accordion=me;exports.Alert=os;exports.AnimatedNumber=Gs;exports.Avatar=ys;exports.Badge=te;exports.Banner=Xs;exports.BottomSheet=ds;exports.Breadcrumb=Ps;exports.Button=ae;exports.Card=Qe;exports.ChatMessage=it;exports.Checkbox=vs;exports.Code=us;exports.CodeAccordion=De;exports.ConfidenceBar=bt;exports.CopyButton=Oe;exports.DiffView=vt;exports.Drawer=zs;exports.DrawerFooter=be;exports.Dropdown=Ys;exports.EmptyState=As;exports.EngineerGrid=gt;exports.FormField=Ds;exports.H1=es;exports.H2=ss;exports.H3=ts;exports.H4=ns;exports.InView=Js;exports.Input=Ke;exports.Link=fs;exports.MessageFeedback=Ue;exports.MessageFooter=Nt;exports.Modal=ls;exports.ModalFooter=ie;exports.ModelPicker=ut;exports.NavRail=Ws;exports.NavRailItem=Us;exports.P1=rs;exports.P2=Ae;exports.P3=Ne;exports.Pagination=Cs;exports.ProgressBar=qs;exports.PromptInput=dt;exports.Radio=js;exports.ReasoningBlock=rt;exports.Scrollable=yt;exports.SegmentedControl=hs;exports.Select=Je;exports.SidePage=Os;exports.SidePageFooter=_e;exports.Skeleton=Pe;exports.SourcesPanel=pt;exports.Spinner=Ie;exports.Stat=Bs;exports.StepIndicator=at;exports.Stepper=Ze;exports.StreamingText=ot;exports.Tab=ps;exports.Table=ks;exports.TableBody=Ts;exports.TableHead=Es;exports.TableRow=Rs;exports.TableSubheaderRow=Ss;exports.Tabs=ms;exports.Td=Is;exports.Textarea=Ge;exports.Th=$s;exports.ThinkingDot=wt;exports.ToastContainer=tt;exports.Toggle=_s;exports.TokenCounter=ht;exports.ToolCallBubble=Fe;exports.ToolCallCard=Fe;exports.Tooltip=Be;exports.iconSizes=D;exports.useAnimatedNumber=Le;exports.useAnimatedPlaceholder=We;exports.useInView=Me;exports.useStreamScroll=lt;exports.useToast=et;
|
|
22
|
+
<%s key={someKey} {...props} />`,U,V,J,V),$[V+U]=!0)}if(V=null,F!==void 0&&(n(F),V=""+F),i(S)&&(n(S.key),V=""+S.key),"key"in S){F={};for(var re in S)re!=="key"&&(F[re]=S[re])}else F=S;return V&&l(F,typeof m=="function"?m.displayName||m.name||"Unknown":m),u(m,V,F,o(),te,ne)}function h(m){x(m)?m._store&&(m._store.validated=1):typeof m=="object"&&m!==null&&m.$$typeof===L&&(m._payload.status==="fulfilled"?x(m._payload.value)&&m._payload.value._store&&(m._payload.value._store.validated=1):m._store&&(m._store.validated=1))}function x(m){return typeof m=="object"&&m!==null&&m.$$typeof===v}var d=c,v=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),T=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),z=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,_=Array.isArray,k=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(m){return m()}};var A,M={},H=d.react_stack_bottom_frame.bind(d,r)(),Y=k(a(r)),$={};pe.Fragment=w,pe.jsx=function(m,S,F){var U=1e4>z.recentlyCreatedOwnerStacks++;return p(m,S,F,!1,U?Error("react-stack-top-frame"):H,U?k(a(m)):Y)},pe.jsxs=function(m,S,F){var U=1e4>z.recentlyCreatedOwnerStacks++;return p(m,S,F,!0,U?Error("react-stack-top-frame"):H,U?k(a(m)):Y)}}()),pe}process.env.NODE_ENV==="production"?Ne.exports=Ge():Ne.exports=Je();var e=Ne.exports;function Le({size:t="m",color:s="default",className:n="",...a}){return e.jsx("span",{className:["ds-spinner",`ds-spinner--${t}`,`ds-spinner--${s}`,n].filter(Boolean).join(" "),role:"status","aria-label":"Loading",...a})}const Ze={xs:12,s:14,m:16,l:20};function ee({children:t,variant:s="primary",size:n="m",fullWidth:a=!1,icon:o,disabled:r=!1,state:i="idle",onClick:l,type:f="button",href:u,"aria-label":p,className:h="",...x}){const d=o&&!t,v=i==="loading",b=i==="success",w=i==="error",y=v||b||w,R=n==="xs"?"s":"m",N=s==="danger"?"on-accent":"default",T=Ze[n]??16,P=v?e.jsx(Le,{size:R,color:N}):b?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(E.Check,{size:T,strokeWidth:2.5})}):w?e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:e.jsx(E.X,{size:T,strokeWidth:2.5})}):null,I=["ds-button",`ds-button--${s}`,`ds-button--${n}`,a&&"ds-button--full",d&&"ds-button--icon-only",h].filter(Boolean).join(" "),O=i!=="idle"?i:void 0,X=e.jsxs(e.Fragment,{children:[y?P:o&&e.jsx("span",{className:"ds-button__icon","aria-hidden":"true",children:o}),t]});if(u){const L=j=>{if(r||v){j.preventDefault();return}j.metaKey||j.ctrlKey||j.button===1||(j.preventDefault(),l==null||l(j))};return e.jsx("a",{className:I,href:r||v?void 0:u,onClick:L,"aria-label":p,"aria-disabled":r||v?"true":void 0,"aria-busy":v?"true":void 0,"data-state":O,...x,children:X})}return e.jsx("button",{type:f,className:I,disabled:r,onClick:v?void 0:l,"aria-label":p,"aria-busy":v?"true":void 0,"data-state":O,...x,children:X})}function Qe({label:t,error:s,hint:n,fullWidth:a=!0,icon:o,iconRight:r,onIconRightClick:i,size:l="m",disabled:f,id:u,...p}){const h=u||`input-${c.useId()}`,x=n?`${h}-hint`:void 0,d=s?`${h}-error`:void 0,v=d||x;return e.jsxs("div",{className:`ds-input-wrapper ${a?"ds-input-wrapper--full":""} ${f?"ds-input-wrapper--disabled":""} ${s?"ds-input-wrapper--error":""}`,children:[t&&e.jsx("label",{className:"ds-input-label",htmlFor:h,children:t}),e.jsxs("div",{className:"ds-input-container",children:[o&&e.jsx("span",{className:`ds-input-icon ds-input-icon--${l}`,"aria-hidden":"true",children:o}),e.jsx("input",{id:h,className:`ds-input ds-input--${l} ${o?"ds-input--with-icon":""} ${r?"ds-input--with-icon-right":""} ${s?"ds-input--error":""}`,disabled:f,"aria-invalid":s?"true":"false","aria-describedby":v,...p}),r&&e.jsx("button",{type:"button",className:`ds-input-icon-right ds-input-icon-right--${l}`,onClick:i,tabIndex:-1,"aria-label":"Toggle visibility",children:r})]}),n&&!s&&e.jsx("span",{id:x,className:"ds-input-hint",children:n}),e.jsx("div",{className:"ds-input-error-wrap",children:e.jsx("div",{className:"ds-input-error-inner",children:s&&e.jsx("span",{id:d,className:"ds-input-error",role:"alert",children:s})})})]})}function et({label:t,error:s,hint:n,fullWidth:a=!0,size:o="m",disabled:r,id:i,resize:l=!0,rows:f=3,...u}){const p=i||`textarea-${c.useId()}`,h=n?`${p}-hint`:void 0,x=s?`${p}-error`:void 0,d=x||h;return e.jsxs("div",{className:`ds-textarea-wrapper ${a?"ds-textarea-wrapper--full":""} ${r?"ds-textarea-wrapper--disabled":""}`,children:[t&&e.jsx("label",{className:"ds-textarea-label",htmlFor:p,children:t}),e.jsx("textarea",{id:p,className:`ds-textarea ds-textarea--${o} ${s?"ds-textarea--error":""} ${l?"":"ds-textarea--no-resize"}`,disabled:r,"aria-invalid":s?"true":"false","aria-describedby":d,rows:f,...u}),n&&!s&&e.jsx("span",{id:h,className:"ds-textarea-hint",children:n}),s&&e.jsx("span",{id:x,className:"ds-textarea-error",role:"alert",children:s})]})}function tt({label:t,value:s,onChange:n,options:a=[],placeholder:o="Select option",error:r,fullWidth:i=!0,size:l="m",disabled:f=!1,id:u,...p}){const[h,x]=c.useState(!1),[d,v]=c.useState(!1),[b,w]=c.useState({}),[y,R]=c.useState("down"),[N,T]=c.useState(-1),P=c.useRef(null),I=c.useRef(null),O=c.useRef(null),X=c.useRef(null),L=u||`select-${c.useId()}`,j=`${L}-label`,D=r?`${L}-error`:void 0,z=150,W=($=!1)=>{d||(v(!0),T(-1),X.current=setTimeout(()=>{var m;x(!1),v(!1),$&&((m=O.current)==null||m.focus())},z))},_=$=>{clearTimeout(X.current),v(!1);const m=$!==void 0?$:Math.max(a.findIndex(S=>S.value===s),0);T(m),x(!0)};c.useEffect(()=>()=>clearTimeout(X.current),[]);const k=()=>{var ne;const $=(ne=P.current)==null?void 0:ne.getBoundingClientRect();if(!$)return;const m=window.innerHeight,S=m-$.bottom,F=$.top,te=S<300&&F>S;R(te?"up":"down"),w(te?{bottom:m-$.top+4,left:$.left,width:$.width}:{top:$.bottom+4,left:$.left,width:$.width})};c.useEffect(()=>{if(h)return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[h]),c.useEffect(()=>{const $=m=>{P.current&&!P.current.contains(m.target)&&I.current&&!I.current.contains(m.target)&&W()};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[d]),c.useEffect(()=>{var m;if(!h||N<0||!I.current)return;(m=I.current.querySelectorAll(".ds-select-option")[N])==null||m.scrollIntoView({block:"nearest"})},[N,h]);const A=$=>{switch($.key){case"ArrowDown":$.preventDefault(),h?T(m=>Math.min(m+1,a.length-1)):_();break;case"ArrowUp":$.preventDefault(),h?T(m=>Math.max(m-1,0)):_(a.length-1);break;case"Home":h&&($.preventDefault(),T(0));break;case"End":h&&($.preventDefault(),T(a.length-1));break;case"Enter":case" ":$.preventDefault(),h?N>=0&&(n==null||n(a[N].value),W(!0)):_();break;case"Escape":h&&($.preventDefault(),W(!0));break;case"Tab":h&&W(!1);break}},M=a.find($=>$.value===s),H=l==="xs"?C[1]:l==="small"?C[2]:C[3],Y=h&&e.jsx("div",{ref:I,"data-ds-portal":"",role:"listbox","aria-labelledby":t?j:void 0,tabIndex:-1,className:["ds-select-dropdown ds-scrollable",`ds-select-dropdown--${l}`,`ds-select-dropdown--${y}`,d&&"ds-select-dropdown--closing"].filter(Boolean).join(" "),style:b,children:a.map(($,m)=>e.jsx("button",{id:`${L}-opt-${m}`,type:"button",role:"option",tabIndex:-1,"aria-selected":s===$.value,className:["ds-select-option",`ds-select-option--${l}`,s===$.value&&"ds-select-option--selected",m===N&&"ds-select-option--active"].filter(Boolean).join(" "),onClick:()=>{n==null||n($.value),W(!0)},children:$.label},$.value))});return e.jsxs("div",{className:`ds-select-wrapper ${i?"ds-select-wrapper--full":""} ${f?"ds-select-wrapper--disabled":""}`,children:[t&&e.jsx("label",{id:j,className:"ds-select-label",children:t}),e.jsx("div",{className:"ds-select-container",ref:P,children:e.jsxs("button",{ref:O,type:"button",id:L,role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-activedescendant":h&&N>=0?`${L}-opt-${N}`:void 0,"aria-labelledby":t?j:void 0,"aria-invalid":r?"true":"false","aria-describedby":D,className:`ds-select-trigger ds-select-trigger--${l} ${r?"ds-select-trigger--error":""}`,onClick:()=>{f||(h?W():_())},onKeyDown:A,disabled:f,...p,children:[e.jsx("span",{className:M?"":"ds-select-placeholder",children:(M==null?void 0:M.label)||o}),e.jsx(E.ChevronDown,{size:H,strokeWidth:1.5,className:`ds-select-icon ${h&&y==="down"?"ds-select-icon--open":""} ${h&&y==="up"?"ds-select-icon--up":""}`,"aria-hidden":"true"})]})}),r&&e.jsx("span",{id:D,className:"ds-select-error",role:"alert",children:r}),typeof document<"u"&&fe.createPortal(Y,document.body)]})}function st({label:t,value:s=0,onChange:n,min:a=0,max:o=100,step:r=1,size:i="m",disabled:l=!1,hint:f,error:u,...p}){const h=()=>{if(l)return;const y=Math.min(Number(s)+r,o);n==null||n(y)},x=()=>{if(l)return;const y=Math.max(Number(s)-r,a);n==null||n(y)},d=y=>{if(l)return;const R=y.target.value;if(R===""){n==null||n(a);return}const N=Number(R);if(!isNaN(N)){const T=Math.min(Math.max(N,a),o);n==null||n(T)}},v=["ds-stepper-wrapper",l&&"ds-stepper-wrapper--disabled",u&&"ds-stepper-wrapper--error"].filter(Boolean).join(" "),b=["ds-stepper",`ds-stepper--${i}`,l&&"ds-stepper--disabled"].filter(Boolean).join(" "),w=i==="xs"?C[1]:i==="small"?C[2]:C[3];return e.jsxs("div",{className:v,children:[t&&e.jsx("label",{className:"ds-stepper-label",children:t}),e.jsxs("div",{className:b,children:[e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--minus",onClick:x,disabled:l||s<=a,"aria-label":"Decrease",children:e.jsx(E.Minus,{size:w,strokeWidth:1.5})}),e.jsx("input",{type:"number",className:"ds-stepper-input",value:s,onChange:d,min:a,max:o,step:r,disabled:l,...p}),e.jsx("button",{type:"button",className:"ds-stepper-button ds-stepper-button--plus",onClick:h,disabled:l||s>=o,"aria-label":"Increase",children:e.jsx(E.Plus,{size:w,strokeWidth:1.5})})]}),f&&!u&&e.jsx("div",{className:"ds-stepper-hint",children:f}),u&&e.jsx("div",{className:"ds-stepper-error",children:u})]})}function nt({children:t,padding:s="m",variant:n="info",hover:a=!1,onClick:o,href:r,disabled:i=!1,...l}){const u=(a?"interactive":n)==="interactive"||o||r,p=["ds-card",`ds-card--${s}`,u&&"ds-card--interactive"].filter(Boolean).join(" ");if(r){const d=v=>{if(i){v.preventDefault();return}v.metaKey||v.ctrlKey||v.button===1||(v.preventDefault(),o==null||o(v))};return e.jsx("a",{className:p,href:i?void 0:r,onClick:d,"aria-disabled":i?"true":void 0,...l,children:t})}const h=u&&o?"button":"div",x=u&&o?{type:"button",onClick:o,disabled:i}:{};return e.jsx(h,{className:p,role:u&&!o?"article":void 0,...x,...l,children:t})}function rt({children:t,...s}){return e.jsx("h1",{className:"ds-h1",...s,children:t})}function at({children:t,...s}){return e.jsx("h2",{className:"ds-h2",...s,children:t})}function ot({children:t,...s}){return e.jsx("h3",{className:"ds-h3",...s,children:t})}function it({children:t,...s}){return e.jsx("h4",{className:"ds-h4",...s,children:t})}function lt({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p1 ${s?"ds-p1--secondary":""}`,...n,children:t})}function Me({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p2 ${s?"ds-p2--secondary":""}`,...n,children:t})}function Ee({children:t,secondary:s=!1,...n}){return e.jsx("p",{className:`ds-p3 ${s?"ds-p3--secondary":""}`,...n,children:t})}function ie({children:t,variant:s="default",size:n="m",role:a,...o}){const r=["ds-badge",`ds-badge--${s}`,`ds-badge--${n}`].filter(Boolean).join(" "),i=a||(["info","success","warning","error"].includes(s)?"status":void 0);return e.jsx("span",{className:r,role:i,...o,children:t})}const ct={info:E.Info,success:E.CheckCircle,warning:E.AlertTriangle,error:E.XCircle};function dt({children:t,variant:s="info",title:n,onClose:a,role:o,...r}){const i=ct[s],l=o||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-alert ds-alert--${s} ${n?"":"ds-alert--no-title"}`,role:l,...r,children:[i&&e.jsx("div",{className:"ds-alert__icon",children:e.jsx(i,{size:C[3],strokeWidth:1.5})}),e.jsxs("div",{className:"ds-alert__content",children:[n&&e.jsx("div",{className:"ds-alert__title",children:n}),t&&e.jsx("div",{className:"ds-alert__message",children:t})]}),a&&e.jsx("button",{type:"button",className:"ds-alert__close",onClick:a,"aria-label":"Close alert",children:e.jsx(E.X,{size:C[3],strokeWidth:1.5})})]})}const ut=200;function ft({children:t,title:s,onClose:n,size:a="m",scrollable:o=!1,subHeader:r,...i}){const l=c.useRef(null),f=c.useId(),[u,p]=c.useState(!1),h=()=>{!n||u||(p(!0),setTimeout(()=>{p(!1),n()},ut))};c.useEffect(()=>{const b=y=>{y.key==="Escape"&&h()},w=y=>{var N,T,P;const R=((T=(N=y.composedPath)==null?void 0:N.call(y))==null?void 0:T[0])??y.target;l.current&&!l.current.contains(R)&&!((P=R.closest)!=null&&P.call(R,"[data-ds-portal]"))&&h()};return document.addEventListener("keydown",b),document.addEventListener("mousedown",w),()=>{document.removeEventListener("keydown",b),document.removeEventListener("mousedown",w)}},[n,u]);const x=c.Children.toArray(t),d=x.find(b=>(b==null?void 0:b.type)===ce),v=x.filter(b=>(b==null?void 0:b.type)!==ce);return e.jsx("div",{className:["ds-modal-overlay",u&&"ds-modal-overlay--closing"].filter(Boolean).join(" "),...i,children:e.jsxs("div",{className:[`ds-modal ds-modal--${a}`,o&&"ds-modal--scrollable"].filter(Boolean).join(" "),ref:l,role:"dialog","aria-modal":"true","aria-labelledby":s?f:void 0,children:[n&&e.jsx(ee,{className:"ds-modal__close",variant:"ghost",size:"small",icon:e.jsx(E.X,{size:C[2],strokeWidth:1.5}),onClick:h,"aria-label":"Close modal"}),(s||r)&&e.jsxs("div",{className:"ds-modal__header",children:[s&&e.jsx("h3",{id:f,className:"ds-modal__title",children:s}),r&&e.jsx("div",{className:"ds-modal__subheader",children:r})]}),e.jsx("div",{className:"ds-modal__body ds-scrollable",children:v}),d]})})}function ce({children:t}){return!t||c.Children.count(t)===0?null:e.jsx("div",{className:"ds-modal__footer",children:t})}const mt=320;function pt({children:t,title:s,onClose:n,subHeader:a,...o}){const r=c.useRef(null),i=c.useId(),[l,f]=c.useState(!1),u=()=>{!n||l||(f(!0),setTimeout(()=>{f(!1),n()},mt))};c.useEffect(()=>{const d=b=>{b.key==="Escape"&&u()},v=b=>{var y,R,N;const w=((R=(y=b.composedPath)==null?void 0:y.call(b))==null?void 0:R[0])??b.target;r.current&&!r.current.contains(w)&&!((N=w.closest)!=null&&N.call(w,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",v),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",v)}},[n,l]);const p=c.Children.toArray(t),h=p.find(d=>(d==null?void 0:d.type)===ce),x=p.filter(d=>(d==null?void 0:d.type)!==ce);return e.jsx("div",{className:["ds-bottom-sheet-overlay",l&&"ds-bottom-sheet-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("div",{ref:r,className:["ds-bottom-sheet",l&&"ds-bottom-sheet--closing"].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":s?i:void 0,children:[e.jsx("div",{className:"ds-bottom-sheet__handle","aria-hidden":"true"}),n&&e.jsx(ee,{className:"ds-bottom-sheet__close",variant:"ghost",size:"small",icon:e.jsx(E.X,{size:C[2],strokeWidth:1.5}),onClick:u,"aria-label":"Close"}),(s||a)&&e.jsxs("div",{className:"ds-bottom-sheet__header",children:[s&&e.jsx("h3",{id:i,className:"ds-bottom-sheet__title",children:s}),a&&e.jsx("div",{className:"ds-bottom-sheet__subheader",children:a})]}),e.jsx("div",{className:"ds-bottom-sheet__body ds-scrollable",children:x}),h]})})}function ze({children:t,title:s="Code",defaultExpanded:n=!1,expanded:a,onToggle:o,padding:r="s",className:i="",...l}){const[f,u]=c.useState(n),p=a!==void 0,h=p?a:f,x=()=>{p?o==null||o(!a):u(v=>!v)},d=["ds-code-accordion",`ds-code-accordion--${r}`,h&&"ds-code-accordion--expanded",i].filter(Boolean).join(" ");return e.jsxs("div",{className:d,...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:s}),e.jsx(E.ChevronDown,{size:C[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 ds-scrollable",children:e.jsx("code",{children:t})})})})]})}function ht({children:t,block:s=!1,collapsible:n=!1,title:a="Code",defaultExpanded:o=!1,...r}){return s?n?e.jsx(ze,{title:a,defaultExpanded:o,...r,children:t}):e.jsx("pre",{className:"ds-code-block ds-scrollable",...r,children:e.jsx("code",{children:t})}):e.jsx("code",{className:"ds-code-inline",...r,children:t})}function xt({href:t,children:s,onClick:n,target:a,rel:o,...r}){const l=a==="_blank"?o?`${o} noopener noreferrer`:"noopener noreferrer":o;return e.jsx("a",{href:t,className:"ds-link",onClick:n,target:a,rel:l,...r,children:s})}function vt({children:t,size:s="m",variant:n="ghost",...a}){return e.jsx("div",{className:"ds-tabs",role:"tablist",...a,children:c.Children.map(t,o=>c.isValidElement(o)?c.cloneElement(o,{size:s,variant:n}):o)})}function bt({children:t,selected:s=!1,onClick:n,size:a="m",variant:o="ghost",disabled:r=!1,icon:i,href:l,...f}){const u=i&&!t,p=["ds-tab",`ds-tab--${a}`,`ds-tab--${o}`,s&&"ds-tab--selected",u&&"ds-tab--icon-only"].filter(Boolean).join(" "),h=e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:"ds-tab-icon",children:i}),t]});if(l){const x=d=>{if(r){d.preventDefault();return}d.metaKey||d.ctrlKey||d.button===1||(d.preventDefault(),n==null||n(d))};return e.jsx("a",{role:"tab","aria-current":s?"page":void 0,"aria-disabled":r?"true":void 0,className:p,href:r?void 0:l,onClick:x,...f,children:h})}return e.jsx("button",{role:"tab","aria-selected":s,className:p,onClick:n,disabled:r,...f,children:h})}function _t({options:t,value:s,onChange:n,size:a="m",disabled:o=!1}){const r=c.useRef(null),i=c.useRef(null),[l,f]=c.useState(!1),u=c.useRef(!1),p=c.useRef(null),h=c.useRef(null),x=()=>{if(!r.current)return;const d=r.current.querySelector(`[data-value="${s}"]`);if(!d)return;const v=r.current.getBoundingClientRect(),b=d.getBoundingClientRect(),w=b.left-v.left,y=b.width;i.current?(i.current.style.transition=u.current?"left var(--transition-normal), width var(--transition-normal)":"none",i.current.style.left=w+"px",i.current.style.width=y+"px",u.current=!1):(f(!0),requestAnimationFrame(()=>{if(!i.current||!r.current)return;const R=r.current.querySelector(`[data-value="${s}"]`);if(!R)return;const N=r.current.getBoundingClientRect(),T=R.getBoundingClientRect();i.current.style.transition="none",i.current.style.left=T.left-N.left+"px",i.current.style.width=T.width+"px"}))};return h.current=x,c.useLayoutEffect(()=>{const d=p.current!==s;p.current=s,u.current=l&&d,x()}),c.useEffect(()=>{if(!r.current)return;const d=new ResizeObserver(()=>{u.current=!1,h.current()});return d.observe(r.current),()=>d.disconnect()},[]),e.jsxs("div",{className:["ds-seg",`ds-seg--${a}`,o&&"ds-seg--disabled"].filter(Boolean).join(" "),ref:r,role:"group",children:[l&&e.jsx("div",{ref:i,className:"ds-seg__pill","aria-hidden":"true"}),t.map(d=>e.jsxs("button",{type:"button","data-value":d.value,className:["ds-seg__btn",s===d.value&&"ds-seg__btn--active"].filter(Boolean).join(" "),onClick:()=>!o&&n(d.value),"aria-pressed":s===d.value,disabled:o,children:[d.icon&&e.jsx("span",{className:"ds-seg__btn-icon","aria-hidden":"true",children:d.icon}),d.label]},d.value))]})}function xe({children:t,title:s,defaultExpanded:n=!1,expanded:a,onToggle:o,padding:r="m",...i}){const[l,f]=c.useState(n),u=a!==void 0,p=u?a:l,h=()=>{u?o==null||o(!a):f(d=>!d)},x=["ds-accordion",`ds-accordion--${r}`,p&&"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":p,children:[e.jsx("span",{className:"ds-accordion__title",children:s}),e.jsx(E.ChevronDown,{size:C[2],strokeWidth:1.5,className:`ds-accordion__icon ${p?"ds-accordion__icon--expanded":""}`})]}),e.jsx("div",{className:"ds-accordion__content",children:e.jsx("div",{className:"ds-accordion__content-inner",children:e.jsx("div",{className:"ds-accordion__content-body",children:t})})})]})}const se=8,de=8;function jt(t,s,n){const a=window.innerWidth;let o,r;switch(t){case"top":o=s.top-n.height-se,r=s.left+s.width/2-n.width/2;break;case"bottom":o=s.bottom+se,r=s.left+s.width/2-n.width/2;break;case"left":o=s.top+s.height/2-n.height/2,r=s.left-n.width-se;break;case"right":o=s.top+s.height/2-n.height/2,r=s.right+se;break;default:o=s.bottom+se,r=s.left}const i=Math.max(de,Math.min(a-n.width-de,r)),l=r-i;return{top:o,left:i,arrowOffset:l}}function Nt(t,s,n){const a=window.innerWidth,o=window.innerHeight;if(t.top>=s+se+de)return"top";if(o-t.bottom>=s+se+de)return"bottom";if(a-t.right>=n+se+de)return"right";if(t.left>=n+se+de)return"left";const r=Math.max(t.top,o-t.bottom,t.left,a-t.right);return r===t.top?"top":r===o-t.bottom?"bottom":r===a-t.right?"right":"left"}function Re({children:t,content:s,position:n,...a}){const[o,r]=c.useState(!1),[i,l]=c.useState({visibility:"hidden"}),[f,u]=c.useState(n||"top"),p=c.useRef(null),h=c.useRef(null),x=c.useRef(!1),d=()=>{if(!p.current||!h.current)return;const b=p.current.getBoundingClientRect(),w=h.current.getBoundingClientRect(),y=n||Nt(b,w.height,w.width),{top:R,left:N,arrowOffset:T}=jt(y,b,w);u(y),l({position:"fixed",top:R,left:N,visibility:"visible","--arrow-offset":`${T}px`})};if(c.useEffect(()=>{if(!o)return;l({position:"fixed",visibility:"hidden"});const b=requestAnimationFrame(d);return window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{cancelAnimationFrame(b),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[o,n]),c.useEffect(()=>{if(!o)return;const b=w=>{p.current&&!p.current.contains(w.target)&&r(!1)};return document.addEventListener("touchstart",b),()=>document.removeEventListener("touchstart",b)},[o]),!s)return t;const v=o&&e.jsx("div",{ref:h,"data-ds-portal":"",className:`ds-tooltip ds-tooltip--${f}`,role:"tooltip",style:i,children:s});return e.jsxs("div",{ref:p,className:"ds-tooltip-wrapper",onMouseEnter:()=>{x.current||r(!0)},onMouseLeave:()=>{x.current||r(!1)},onTouchStart:()=>{x.current=!0,r(b=>!b)},...a,children:[t,typeof document<"u"&&fe.createPortal(v,document.body)]})}function gt({checked:t=!1,onChange:s,size:n="m",disabled:a=!1,label:o,id:r,...i}){const l=r||`toggle-${c.useId()}`,f=["ds-toggle",`ds-toggle--${n}`,a&&"ds-toggle--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:f,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-toggle__input",checked:t,onChange:u=>s==null?void 0:s(u.target.checked),disabled:a,...i}),e.jsx("span",{className:"ds-toggle__track",children:e.jsx("span",{className:"ds-toggle__thumb"})}),o&&e.jsx("span",{className:"ds-toggle__label",children:o})]})}function wt({checked:t=!1,onChange:s,size:n="m",disabled:a=!1,label:o,id:r,...i}){const l=r||`checkbox-${c.useId()}`,f=["ds-checkbox",`ds-checkbox--${n}`,a&&"ds-checkbox--disabled"].filter(Boolean).join(" "),u=n==="xs"?10:n==="small"?14:n==="large"?20:16;return e.jsxs("label",{className:f,htmlFor:l,children:[e.jsx("input",{type:"checkbox",id:l,className:"ds-checkbox__input",checked:t,onChange:p=>s==null?void 0:s(p.target.checked),disabled:a,...i}),e.jsx("span",{className:"ds-checkbox__box",children:t&&e.jsx(E.Check,{size:u,strokeWidth:2.5,className:"ds-checkbox__icon"})}),o&&e.jsx("span",{className:"ds-checkbox__label",children:o})]})}function yt({checked:t=!1,onChange:s,size:n="m",disabled:a=!1,label:o,name:r,value:i,id:l,...f}){const u=l||`radio-${c.useId()}`,p=["ds-radio",`ds-radio--${n}`,a&&"ds-radio--disabled"].filter(Boolean).join(" ");return e.jsxs("label",{className:p,htmlFor:u,children:[e.jsx("input",{type:"radio",id:u,className:"ds-radio__input",checked:t,onChange:h=>s==null?void 0:s(h.target.checked),disabled:a,name:r,value:i,...f}),e.jsx("span",{className:"ds-radio__circle",children:e.jsx("span",{className:"ds-radio__dot"})}),o&&e.jsx("span",{className:"ds-radio__label",children:o})]})}function Fe({width:t,height:s,shape:n="rect",aspectRatio:a,className:o="",style:r={},...i}){return e.jsx("span",{className:["ds-skeleton",`ds-skeleton--${n}`,o].filter(Boolean).join(" "),style:{width:t,height:s,aspectRatio:a,...r},"aria-hidden":"true",...i})}function kt({lines:t=1,lastLineWidth:s="70%",gap:n,className:a="",style:o={},...r}){return e.jsx("span",{className:["ds-skeleton-text",a].filter(Boolean).join(" "),style:{gap:n,...o},"aria-hidden":"true",...r,children:Array.from({length:t},(i,l)=>e.jsx("span",{className:"ds-skeleton ds-skeleton--text",style:l===t-1&&t>1?{width:s}:void 0},l))})}Fe.Text=kt;function Et(t){let s=2166136261;for(let n=0;n<t.length;n++)s^=t.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s%360}function Rt(t){if(!t)return"";const s=t.trim().split(/\s+/);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():t[0].toUpperCase()}function Tt({seed:t,icon:s,src:n,size:a=32,className:o="",style:r={},...i}){const l=Et(t??""),[f,u]=c.useState(!1),p=s??e.jsx("span",{className:"ds-avatar__initials",children:Rt(t)});return e.jsx("div",{className:["ds-avatar",o].filter(Boolean).join(" "),style:{width:a,height:a,"--ds-avatar-h":l,...r},"aria-hidden":"true",...i,children:n&&!f?e.jsx("img",{src:n,alt:"",onError:()=>u(!0)}):p})}function St({children:t,size:s="compact",stickyTop:n,maxHeight:a,className:o="",style:r={},...i}){const l={...a?{maxHeight:a}:{},...n!==void 0?{"--ds-table-sticky-top":typeof n=="number"?`${n}px`:n}:{},...r};return e.jsx("div",{className:["ds-table-wrap","ds-scrollable",a?"ds-table-wrap--scroll":""].filter(Boolean).join(" "),style:l,children:e.jsx("table",{className:["ds-table",`ds-table--${s}`,o].filter(Boolean).join(" "),...i,children:t})})}function $t({children:t,...s}){return e.jsx("thead",{...s,children:t})}function At({children:t,...s}){return e.jsx("tbody",{...s,children:t})}function Bt({children:t,interactive:s,selected:n,subheader:a,exiting:o,updated:r,className:i="",onClick:l,...f}){return e.jsx("tr",{className:["ds-table-row",s||l?"ds-table-row--interactive":"",n?"ds-table-row--selected":"",a?"ds-table-row--subheader":"",o?"ds-table-row--exiting":"",r?"ds-table-row--updated":"",i].filter(Boolean).join(" "),onClick:l,...f,children:t})}function Dt({children:t,colSpan:s=999,...n}){return e.jsx("tr",{className:"ds-table-row ds-table-row--subheader",...n,children:e.jsx("td",{colSpan:s,children:t})})}function It({children:t,align:s="left",sortDir:n,onSort:a,width:o,className:r="",style:i={},...l}){const f=!!a||n!==void 0,u=n==="asc"?E.ChevronUp:n==="desc"?E.ChevronDown:E.ChevronsUpDown;return e.jsx("th",{className:["ds-th",f?"ds-th--sortable":"",n?"ds-th--sorted":"",s!=="left"?`ds-table-cell--${s}`:"",r].filter(Boolean).join(" "),onClick:a,style:{width:o,...i},...l,children:f?e.jsxs("span",{className:"ds-th__inner",children:[t,e.jsx("span",{className:"ds-th__sort-icon",children:e.jsx(u,{size:11,strokeWidth:2.5})})]}):t})}function Ct({children:t,align:s="left",secondary:n,muted:a,truncate:o,nowrap:r,className:i="",...l}){return e.jsx("td",{className:["ds-td",s!=="left"?`ds-table-cell--${s}`:"",n?"ds-table-cell--secondary":"",a?"ds-table-cell--muted":"",o?"ds-table-cell--truncate":"",r?"ds-table-cell--nowrap":"",i].filter(Boolean).join(" "),...l,children:t})}function Pt({icon:t,title:s,description:n,action:a,size:o="m",className:r="",...i}){return e.jsxs("div",{className:["ds-empty-state",`ds-empty-state--${o}`,r].filter(Boolean).join(" "),...i,children:[t&&e.jsx("div",{className:"ds-empty-state__icon",children:t}),e.jsx("div",{className:"ds-empty-state__title",children:s}),n&&e.jsx("div",{className:"ds-empty-state__description",children:n}),a&&e.jsx("div",{className:"ds-empty-state__action",children:a})]})}function Lt({label:t,hint:s,error:n,required:a=!1,disabled:o=!1,htmlFor:r,children:i,className:l="",style:f,...u}){const p=c.useId(),h=r??p,x=`${h}-hint`,d=`${h}-error`;return e.jsxs("div",{className:`ds-field${l?` ${l}`:""}`,"data-state":n?"error":void 0,"data-required":a?"":void 0,"data-disabled":o?"":void 0,style:f,...u,children:[t&&e.jsx("label",{className:"ds-field-label",htmlFor:h,children:t}),e.jsx("div",{className:"ds-field-control",children:i}),s&&!n&&e.jsx("p",{className:"ds-field-hint",id:x,children:s}),n&&e.jsx("p",{className:"ds-field-error",id:d,role:"alert",children:n})]})}function Mt({label:t,value:s,delta:n,size:a="m",inline:o=!1,className:r="",style:i,...l}){const f=n!=null&&n.startsWith("+")?"up":n!=null&&n.startsWith("-")?"down":"neutral";return e.jsxs("div",{className:["ds-stat",`ds-stat--${a}`,o&&"ds-stat--inline",r].filter(Boolean).join(" "),style:i,...l,children:[t&&e.jsx("span",{className:"ds-stat-label",children:t}),s!=null&&e.jsx("span",{className:"ds-stat-value",children:s}),n!=null&&e.jsx("span",{className:`ds-stat-delta ds-stat-delta--${f}`,children:n})]})}function zt({children:t,separator:s="/","aria-label":n="Breadcrumb",className:a="",style:o,...r}){const i=c.Children.toArray(t).filter(Boolean);return e.jsx("nav",{className:`ds-breadcrumb${a?` ${a}`:""}`,"aria-label":n,style:o,...r,children:e.jsx("ol",{className:"ds-breadcrumb-list",children:i.map((l,f)=>e.jsxs("li",{className:"ds-breadcrumb-item",children:[l,f<i.length-1&&e.jsx("span",{className:"ds-breadcrumb-sep","aria-hidden":"true",children:s})]},f))})})}function Ft({page:t,total:s,onChange:n,siblings:a=1,"aria-label":o="Pagination",className:r="",style:i,...l}){const f=Ot(t,s,a);return e.jsxs("nav",{className:`ds-pagination${r?` ${r}`:""}`,"aria-label":o,style:i,...l,children:[e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(t-1),disabled:t<=1,"aria-label":"Previous page",children:e.jsx(E.ChevronLeft,{size:16})}),f.map((u,p)=>u==="…"?e.jsx("span",{className:"ds-pagination-gap","aria-hidden":"true",children:"…"},`gap-${p}`):e.jsx("button",{className:`ds-pagination-page${u===t?" ds-pagination-page--current":""}`,onClick:()=>u!==t&&(n==null?void 0:n(u)),"aria-current":u===t?"page":void 0,"aria-label":`Page ${u}`,children:u},u)),e.jsx("button",{className:"ds-pagination-arrow",onClick:()=>n==null?void 0:n(t+1),disabled:t>=s,"aria-label":"Next page",children:e.jsx(E.ChevronRight,{size:16})})]})}function Ot(t,s,n){if(s<=7)return Array.from({length:s},(i,l)=>l+1);const a=Math.max(2,t-n),o=Math.min(s-1,t+n),r=[1];a>2&&r.push("…");for(let i=a;i<=o;i++)r.push(i);return o<s-1&&r.push("…"),r.push(s),r}const Wt=200;function Ut({children:t,title:s,onClose:n,side:a="right",...o}){const r=c.useRef(null),i=c.useId(),[l,f]=c.useState(!1),u=()=>{!n||l||(f(!0),setTimeout(()=>{f(!1),n()},Wt))};c.useEffect(()=>{const d=b=>{b.key==="Escape"&&u()},v=b=>{var y,R,N;const w=((R=(y=b.composedPath)==null?void 0:y.call(b))==null?void 0:R[0])??b.target;r.current&&!r.current.contains(w)&&!((N=w.closest)!=null&&N.call(w,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",v),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",v)}},[n,l]);const p=c.Children.toArray(t),h=p.find(d=>(d==null?void 0:d.type)===ge),x=p.filter(d=>(d==null?void 0:d.type)!==ge);return e.jsx("div",{className:["ds-drawer-overlay",l&&"ds-drawer-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("aside",{className:["ds-drawer",l&&"ds-drawer--closing"].filter(Boolean).join(" "),"data-side":a,ref:r,role:"dialog","aria-modal":"true","aria-labelledby":s?i:void 0,children:[e.jsxs("header",{className:"ds-drawer-header",children:[s&&e.jsx("h3",{id:i,className:"ds-drawer-title",children:s}),n&&e.jsx("button",{className:"ds-drawer-close",onClick:u,"aria-label":"Close drawer",children:e.jsx(E.X,{size:C[2],strokeWidth:1.5})})]}),e.jsx("div",{className:"ds-drawer-body ds-scrollable",children:x}),h]})})}function ge({children:t}){return e.jsx("footer",{className:"ds-drawer-footer",children:t})}const Vt=320;function Xt({children:t,title:s,onClose:n,subHeader:a,...o}){const r=c.useRef(null),i=c.useId(),[l,f]=c.useState(!1),u=()=>{!n||l||(f(!0),setTimeout(()=>{f(!1),n()},Vt))};c.useEffect(()=>{const d=b=>{b.key==="Escape"&&u()},v=b=>{var y,R,N;const w=((R=(y=b.composedPath)==null?void 0:y.call(b))==null?void 0:R[0])??b.target;r.current&&!r.current.contains(w)&&!((N=w.closest)!=null&&N.call(w,"[data-ds-portal]"))&&u()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",v),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",v)}},[n,l]);const p=c.Children.toArray(t),h=p.find(d=>(d==null?void 0:d.type)===we||(d==null?void 0:d.type)===ce),x=p.filter(d=>(d==null?void 0:d.type)!==we&&(d==null?void 0:d.type)!==ce);return e.jsx("div",{className:["ds-side-page-overlay",l&&"ds-side-page-overlay--closing"].filter(Boolean).join(" "),...o,children:e.jsxs("div",{ref:r,className:["ds-side-page",l&&"ds-side-page--closing"].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":s?i:void 0,children:[n&&e.jsx(ee,{className:"ds-side-page__close",variant:"ghost",size:"small",icon:e.jsx(E.X,{size:C[2],strokeWidth:1.5}),onClick:u,"aria-label":"Close"}),(s||a)&&e.jsxs("div",{className:"ds-side-page__header",children:[s&&e.jsx("h3",{id:i,className:"ds-side-page__title",children:s}),a&&e.jsx("div",{className:"ds-side-page__subheader",children:a})]}),e.jsx("div",{className:"ds-side-page__body ds-scrollable",children:x}),h]})})}function we({children:t}){return!t||c.Children.count(t)===0?null:e.jsx("div",{className:"ds-side-page__footer",children:t})}const ve=c.createContext({collapsed:!1,side:"left"});function Ht({children:t,collapsed:s=!1,side:n="left",className:a="",...o}){const r=["ds-nav-rail",s&&"ds-nav-rail--collapsed",`ds-nav-rail--${n}`,a].filter(Boolean).join(" ");return e.jsx(ve.Provider,{value:{collapsed:s,side:n},children:e.jsx("nav",{className:r,...o,children:t})})}function qt({icon:t,label:s,selected:n=!1,disabled:a=!1,href:o,onClick:r,count:i,updated:l=!1,open:f=!1,onboarding:u=!1,className:p="",...h}){const{collapsed:x,side:d}=c.useContext(ve),w={className:["ds-nav-rail__item",p].filter(Boolean).join(" "),onClick:a?void 0:r,"aria-current":n?"page":void 0,"aria-disabled":a?"true":void 0,"aria-label":x?s:void 0,tabIndex:a?-1:void 0,...{"data-selected":n||void 0,"data-disabled":a||void 0,"data-open":f||void 0,"data-onboarding":u||void 0},...h},y=i!=null,R=d==="left"?"right":"left",N=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:t}),!x&&e.jsx("span",{className:"ds-nav-rail__label",children:s}),!x&&l&&e.jsx(ie,{size:"xs",variant:"accent",className:"ds-nav-rail__badge-expanded",children:"New"}),!x&&y&&e.jsx("span",{className:["ds-nav-rail__count",i===0&&"ds-nav-rail__count--zero"].filter(Boolean).join(" "),children:i}),x&&l&&e.jsx("span",{className:"ds-nav-rail__dot","aria-hidden":"true"})]}),T=o?e.jsx("a",{href:a?void 0:o,...w,children:N}):e.jsx("button",{type:"button",...w,children:N});return x?e.jsx(Re,{content:s,position:R,children:T}):T}function Yt({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__body","ds-scrollable",s].filter(Boolean).join(" "),...n,children:t})}function Kt({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__header",s].filter(Boolean).join(" "),...n,children:t})}function Gt({children:t,className:s="",...n}){return e.jsx("div",{className:["ds-nav-rail__footer",s].filter(Boolean).join(" "),...n,children:t})}function Jt({className:t="",...s}){return e.jsx("hr",{className:["ds-nav-rail__divider",t].filter(Boolean).join(" "),...s})}function Zt({children:t,label:s="Recents",defaultOpen:n=!0,className:a="",...o}){const{collapsed:r}=c.useContext(ve),[i,l]=c.useState(n);return e.jsxs("div",{className:["ds-nav-rail__recents",a].filter(Boolean).join(" "),...o,children:[!r&&e.jsxs("button",{type:"button",className:["ds-nav-rail__recents-toggle",!i&&"ds-nav-rail__recents-toggle--closed"].filter(Boolean).join(" "),onClick:()=>l(f=>!f),"aria-expanded":i,children:[e.jsx("span",{className:"ds-nav-rail__recents-label",children:s}),e.jsx(E.ChevronDown,{size:12,strokeWidth:2,className:"ds-nav-rail__recents-chevron","aria-hidden":"true"})]}),(i||r)&&e.jsx("div",{className:"ds-nav-rail__recents-body",children:t})]})}function Qt({avatar:t,label:s,selected:n=!1,disabled:a=!1,href:o,onClick:r,className:i="",...l}){const{collapsed:f,side:u}=c.useContext(ve),x={className:["ds-nav-rail__item","ds-nav-rail__agent",i].filter(Boolean).join(" "),onClick:a?void 0:r,"aria-current":n?"page":void 0,"aria-disabled":a?"true":void 0,tabIndex:a?-1:void 0,...{"data-selected":n||void 0,"data-disabled":a||void 0},...l},d=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"ds-nav-rail__icon","aria-hidden":"true",children:t}),!f&&e.jsx("span",{className:"ds-nav-rail__label",children:s})]}),v=u==="left"?"right":"left",b=o?e.jsx("a",{href:a?void 0:o,...x,children:d}):e.jsx("button",{type:"button",...x,children:d});return f?e.jsx(Re,{content:s,position:v,children:b}):b}const es={info:E.Info,success:E.CheckCircle,warning:E.AlertTriangle,error:E.XCircle};function ts({children:t,variant:s="info",action:n,onAction:a,onDismiss:o,role:r,...i}){const l=es[s],f=r||(s==="error"?"alert":"status");return e.jsxs("div",{className:`ds-banner ds-banner--${s}`,role:f,...i,children:[l&&e.jsx("span",{className:"ds-banner-icon","aria-hidden":"true",children:e.jsx(l,{size:C[2],strokeWidth:1.5})}),e.jsx("span",{className:"ds-banner-text",children:t}),n&&e.jsx("button",{type:"button",className:"ds-banner-action",onClick:a,children:n}),o&&e.jsx("button",{type:"button",className:"ds-banner-dismiss",onClick:o,"aria-label":"Dismiss",children:e.jsx(E.X,{size:C[2],strokeWidth:1.5})})]})}function ss({trigger:t,items:s=[],open:n,onOpenChange:a,align:o="left",className:r="",style:i,...l}){const[f,u]=c.useState(!1),[p,h]=c.useState(!1),x=n!==void 0,d=x?n:f,v=c.useRef(null),b=c.useRef(null),w=c.useRef(null),y=c.useRef(null),[R,N]=c.useState({}),T=c.useRef(null),P=150,I=()=>{if(x)a==null||a(!1);else{if(p)return;h(!0),T.current=setTimeout(()=>{u(!1),h(!1)},P)}},O=()=>{const _=!d;x?a==null||a(_):_?(clearTimeout(T.current),h(!1),u(!0)):I()},X=()=>{d||(x?a==null||a(!0):(clearTimeout(T.current),h(!1),u(!0)))};c.useEffect(()=>()=>clearTimeout(T.current),[]),c.useEffect(()=>{if(!d)return;const _=300,k=()=>{var Y;const A=(Y=v.current)==null?void 0:Y.getBoundingClientRect();if(!A)return;const M=window.innerHeight-A.bottom,H=M<_+8&&A.top>M;N(o==="right"?H?{bottom:window.innerHeight-A.top+4,top:"auto",right:window.innerWidth-A.right}:{top:A.bottom+4,bottom:"auto",right:window.innerWidth-A.right}:H?{bottom:window.innerHeight-A.top+4,top:"auto",left:A.left}:{top:A.bottom+4,bottom:"auto",left:A.left})};return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[d,o]);const L=()=>{var k;const _=(k=w.current)==null?void 0:k.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea');_==null||_.focus()};c.useEffect(()=>{if(!d)return;const _=A=>{var M,H;!((M=v.current)!=null&&M.contains(A.target))&&!((H=b.current)!=null&&H.contains(A.target))&&I()},k=A=>{A.key==="Escape"&&(I(),L())};return document.addEventListener("mousedown",_),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("keydown",k)}},[d]),c.useEffect(()=>{if(!d||!y.current||!b.current)return;const _=j(),k=y.current==="last"?_[_.length-1]:_[0];k==null||k.focus(),y.current=null},[d]);const j=()=>b.current?[...b.current.querySelectorAll('button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])')]:[],D=_=>{var k,A;if(_.key==="ArrowDown")_.preventDefault(),d?(k=j()[0])==null||k.focus():(y.current="first",X());else if(_.key==="ArrowUp")if(_.preventDefault(),!d)y.current="last",X();else{const M=j();(A=M[M.length-1])==null||A.focus()}},z=_=>{var M,H,Y,$;const k=j(),A=k.findIndex(m=>m===document.activeElement);switch(_.key){case"ArrowDown":_.preventDefault(),(M=k[Math.min(A+1,k.length-1)])==null||M.focus();break;case"ArrowUp":_.preventDefault(),A<=0?L():(H=k[A-1])==null||H.focus();break;case"Home":_.preventDefault(),(Y=k[0])==null||Y.focus();break;case"End":_.preventDefault(),($=k[k.length-1])==null||$.focus();break;case"Tab":I();break}},W=d&&e.jsx("div",{ref:b,role:"menu","data-ds-portal":"",className:["ds-dropdown__menu",`ds-dropdown__menu--${o}`,p&&"ds-dropdown__menu--closing"].filter(Boolean).join(" "),style:R,onKeyDown:z,children:s.map((_,k)=>{if(_.separator)return e.jsx("div",{className:"ds-dropdown__separator"},k);if(_.type==="section")return e.jsxs("div",{className:"ds-dropdown__section",children:[_.label&&e.jsx("div",{className:"ds-dropdown__section-label",children:_.label}),e.jsx("div",{className:"ds-dropdown__section-content",children:_.content})]},k);const A=!!_.href,M=A?"a":"button",H=A?{href:_.disabled?void 0:_.href,"aria-disabled":_.disabled?"true":void 0}:{type:"button",disabled:_.disabled};return e.jsxs(M,{role:"menuitem",className:["ds-dropdown__item",_.danger&&"ds-dropdown__item--danger"].filter(Boolean).join(" "),...H,onClick:()=>{var Y;(Y=_.onClick)==null||Y.call(_),I()},children:[_.icon&&e.jsx("span",{className:"ds-dropdown__item-icon",children:_.icon}),e.jsx("span",{className:"ds-dropdown__item-label",children:_.label}),_.shortcut&&e.jsx("span",{className:"ds-dropdown__item-shortcut",children:_.shortcut})]},k)})});return e.jsxs("div",{ref:v,className:["ds-dropdown",r].filter(Boolean).join(" "),style:i,...l,children:[e.jsx("div",{ref:w,className:"ds-dropdown__trigger",onClick:O,onKeyDown:D,children:t}),typeof document<"u"&&fe.createPortal(W,document.body)]})}function ns({value:t=0,size:s="m",variant:n="default",showValue:a=!1,min:o=2,animate:r=!0}){const i=Math.min(100,Math.max(0,t)),l=Math.max(o,i),f=n==="auto"?i>=70?"success":i>=50?"warning":"danger":n;return e.jsxs("div",{className:["ds-progress",`ds-progress--${s}`,!r&&"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--${f}`,style:{width:`${l}%`}})}),a&&e.jsxs("span",{className:"ds-progress__value",children:[Math.round(i),"%"]})]})}const rs=t=>1-Math.pow(1-t,3),as=()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Oe(t,{duration:s=600}={}){const[n,a]=c.useState(t),o=c.useRef(t),r=c.useRef(null);return c.useEffect(()=>{if(as()){a(t),o.current=t;return}const i=o.current,l=t-i;if(l===0)return;let f=null;const u=p=>{f||(f=p);const h=Math.min((p-f)/s,1);a(i+l*rs(h)),h<1?r.current=requestAnimationFrame(u):o.current=t};return r.current=requestAnimationFrame(u),()=>cancelAnimationFrame(r.current)},[t,s]),n}function os({value:t,duration:s=600,decimals:n=0,prefix:a="",suffix:o=""}){const i=Oe(t,{duration:s}).toFixed(n);return`${a}${i}${o}`}function We({threshold:t=.1,rootMargin:s="0px",once:n=!1}={}){const a=c.useRef(null),[o,r]=c.useState(!1);return c.useEffect(()=>{const i=a.current;if(!i)return;const l=new IntersectionObserver(([f])=>{f.isIntersecting?(r(!0),n&&l.disconnect()):n||r(!1)},{threshold:t,rootMargin:s});return l.observe(i),()=>l.disconnect()},[t,s,n]),{ref:a,inView:o}}function is({children:t,as:s="div",once:n=!1,threshold:a=.1,rootMargin:o="0px",onEnter:r,onLeave:i,...l}){const{ref:f,inView:u}=We({threshold:a,rootMargin:o,once:n}),p=c.useRef(!1);return c.useEffect(()=>{u&&!p.current&&(r==null||r()),!u&&p.current&&(i==null||i()),p.current=u},[u]),e.jsx(s,{ref:f,...l,children:typeof t=="function"?t(u):t})}const Be={default:E.Info,success:E.CheckCircle,warning:E.AlertTriangle,error:E.XCircle};let ue=[];const ye=new Set;function Ue(){ye.forEach(t=>t([...ue]))}function ls(t){ue=[...ue,t],Ue()}function cs(t){ue=ue.filter(s=>s.id!==t),Ue()}function ds(){const t=(s,n={})=>{ls({id:`${Date.now()}-${Math.random()}`,message:s,type:"default",duration:4e3,...n})};return t.success=(s,n)=>t(s,{...n,type:"success"}),t.error=(s,n)=>t(s,{...n,type:"error"}),t.warning=(s,n)=>t(s,{...n,type:"warning"}),{toast:t}}function us({data:t,onDismiss:s}){const[n,a]=c.useState(!1),o=c.useRef(null);c.useEffect(()=>(requestAnimationFrame(()=>a(!0)),t.duration>0&&(o.current=setTimeout(()=>r(),t.duration)),()=>clearTimeout(o.current)),[]);function r(){a(!1),setTimeout(()=>s(t.id),250)}const i=Be[t.type]??Be.default;return e.jsxs("div",{className:["ds-toast",`ds-toast--${t.type}`,n&&"ds-toast--visible"].filter(Boolean).join(" "),role:t.type==="error"?"alert":"status","aria-live":"polite",children:[e.jsx("div",{className:"ds-toast__icon",children:e.jsx(i,{size:C[3],strokeWidth:1.5})}),e.jsx("span",{className:"ds-toast__message",children:t.message}),e.jsx("button",{className:"ds-toast__close",onClick:r,"aria-label":"Закрыть",children:e.jsx(E.X,{size:C[3],strokeWidth:1.5})})]})}function fs({position:t="bottom-right"}){const[s,n]=c.useState(()=>[...ue]);return c.useEffect(()=>(ye.add(n),()=>ye.delete(n)),[]),!s.length||typeof document>"u"?null:fe.createPortal(e.jsx("div",{"data-ds-portal":"",className:["ds-toast-container",`ds-toast-container--${t}`].join(" "),children:s.map(a=>e.jsx(us,{data:a,onDismiss:cs},a.id))}),document.body)}const ms={running:e.jsx(ie,{size:"xs",variant:"info",children:"Running..."}),success:e.jsx(ie,{size:"xs",variant:"success",children:"Done"}),error:e.jsx(ie,{size:"xs",variant:"error",children:"Error"})};function Ve({label:t,status:s="idle",icon:n,badge:a,defaultExpanded:o=!1,expanded:r,onToggle:i,children:l,className:f="",...u}){const p=s==="running",h=e.jsxs("span",{className:"ds-tool-card__title-row",children:[n&&e.jsx("span",{className:"ds-tool-card__icon",children:n}),e.jsx("span",{className:"ds-tool-card__label",children:t}),ms[s],a]});return l?e.jsx("div",{className:["ds-tool-card",p&&"ds-tool-card--running",f].filter(Boolean).join(" "),...u,children:e.jsx(xe,{title:h,padding:"s",defaultExpanded:o,expanded:p?!1:r,onToggle:p?void 0:i,children:e.jsx("div",{className:"ds-tool-card__body",children:l})})}):e.jsx("div",{className:["ds-tool-card","ds-tool-card--bubble",f].filter(Boolean).join(" "),...u,children:h})}function Xe({text:t,size:s="xs",timeout:n=800,"aria-label":a="Copy to clipboard",...o}){const[r,i]=c.useState(!1),l=f=>{f.currentTarget.blur(),navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),n)})};return e.jsx(ee,{variant:"ghost",size:s,state:r?"success":"idle",icon:e.jsx(E.Copy,{size:C[1],strokeWidth:1.5}),"aria-label":a,onClick:l,...o})}function ps({content:t,streaming:s=!1,...n}){const[a,o]=c.useState(s);return c.useEffect(()=>{o(!!s)},[s]),e.jsx(xe,{expanded:a,onToggle:o,padding:"s",title:e.jsxs("div",{className:"ds-reasoning__title",children:[e.jsx(E.Brain,{size:C[1],strokeWidth:1.5,className:"ds-reasoning__icon"}),e.jsx(Me,{secondary:!0,children:"Thinking"})]}),...n,children:e.jsxs(Ee,{secondary:!0,style:{whiteSpace:"pre-wrap"},children:[t,s&&e.jsx("span",{className:"ds-cursor ds-cursor--line"})]})})}function hs({count:t,current:s=0,done:n=[],onChange:a,showCounter:o=!0,className:r="","aria-label":i="Steps",...l}){return e.jsxs("div",{className:["ds-step-indicator",r].filter(Boolean).join(" "),...l,children:[e.jsx("div",{className:"ds-step-indicator__dots",role:"tablist","aria-label":i,children:Array.from({length:t},(f,u)=>{const p=u===s,h=n.includes(u)&&!p,x=a&&(u<=s||n.includes(u)),d=["ds-step-indicator__dot",p&&"ds-step-indicator__dot--active",h&&"ds-step-indicator__dot--done"].filter(Boolean).join(" ");return e.jsx("button",{type:"button",className:d,role:"tab","aria-selected":p,"aria-label":`Step ${u+1}`,disabled:!x||u===s,onClick:()=>a==null?void 0:a(u),children:h?e.jsx(E.Check,{size:8,strokeWidth:3}):null},u)})}),o&&e.jsxs(Ee,{secondary:!0,className:"ds-step-indicator__counter",children:[s+1," / ",t]})]})}function xs({content:t,isStreaming:s=!1,cursor:n="line",onChunk:a,className:o="",...r}){const i=c.useRef(t);return c.useEffect(()=>{t!==i.current&&(a==null||a(t),i.current=t)},[t,a]),e.jsxs("span",{className:["ds-streaming-text",o].filter(Boolean).join(" "),...r,children:[t,s&&n!=="none"&&e.jsx("span",{className:`ds-cursor ds-cursor--${n}`,"aria-hidden":"true"})]})}function vs({role:t="assistant",header:s,footer:n,attachments:a,isStreaming:o=!1,children:r,className:i="",...l}){const f=["ds-chat-message",`ds-chat-message--${t}`,o&&"ds-chat-message--streaming",i].filter(Boolean).join(" ");return t==="system"?e.jsx("div",{className:f,...l,children:e.jsx("span",{className:"ds-chat-message__system-label",children:r})}):t==="user"?e.jsxs("div",{className:f,...l,children:[a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__bubble",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]}):e.jsxs("div",{className:f,...l,children:[s&&e.jsx("div",{className:"ds-chat-message__header",children:s}),a&&e.jsx("div",{className:"ds-chat-message__attachments",children:a}),e.jsx("div",{className:"ds-chat-message__body",children:r}),n&&e.jsx("div",{className:"ds-chat-message__footer",children:n})]})}function bs(t,{containerRef:s,smartPause:n=!0}={}){const a=c.useRef(!1),o=c.useRef(0);c.useEffect(()=>{const r=s==null?void 0:s.current;if(!r)return;const i=()=>{const l=r.scrollHeight-r.scrollTop-r.clientHeight<64;!l&&r.scrollTop<o.current&&(a.current=!0),l&&(a.current=!1),o.current=r.scrollTop};return r.addEventListener("scroll",i,{passive:!0}),()=>r.removeEventListener("scroll",i)},[s]),c.useEffect(()=>{const r=s==null?void 0:s.current;r&&(n&&a.current||(r.scrollTop=r.scrollHeight))},t)}function He({prompts:t,enabled:s,typingSpeed:n=38,erasingSpeed:a=18,holdTime:o=2200,betweenTime:r=380,manualPauseMs:i=5e3}){const[l,f]=c.useState(0),[u,p]=c.useState(""),h=c.useRef("typing"),x=c.useRef(0),d=c.useRef(0),v=c.useRef(null),b=c.useRef(0);c.useEffect(()=>{d.current=l},[l]),c.useEffect(()=>{if(v.current&&(clearTimeout(v.current),v.current=null),!s||t.length===0){p(""),x.current=0,h.current="typing";return}const T=()=>{const P=Date.now();if(b.current>P){v.current=setTimeout(T,b.current-P);return}const I=t[d.current%t.length]??"";h.current==="typing"?(x.current+=1,p(I.slice(0,x.current)),x.current>=I.length?(h.current="holding",v.current=setTimeout(T,o)):v.current=setTimeout(T,n+Math.random()*28)):h.current==="holding"?(h.current="erasing",v.current=setTimeout(T,a)):(x.current=Math.max(0,x.current-1),p(I.slice(0,x.current)),x.current<=0?(h.current="typing",d.current=(d.current+1)%t.length,f(d.current),v.current=setTimeout(T,r)):v.current=setTimeout(T,a))};return v.current=setTimeout(T,260),()=>{v.current&&clearTimeout(v.current)}},[s,t,n,a,o,r]);const w=T=>{if(t.length===0)return;const P=(T%t.length+t.length)%t.length,I=t[P];d.current=P,x.current=I.length,h.current="holding",b.current=Date.now()+i,f(P),p(I)},y=()=>w(d.current+1),R=()=>w(d.current-1),N=t[l%t.length]??"";return{displayed:u,currentPrompt:N,index:l,next:y,prev:R}}let _s=0;function js({value:t="",onChange:s,onSubmit:n,onStop:a,onKeyDown:o,loading:r=!1,disabled:i=!1,placeholder:l="Let's get things done...",animatedPlaceholders:f,attachments:u,images:p,onAttachFiles:h,onAttachImages:x,onRemoveAttachment:d,onRemoveImage:v,acceptImage:b,acceptFile:w,maxImages:y,maxImageSize:R,leftSlot:N,rightSlot:T,className:P="",...I}){const O=c.useRef(null),X=c.useRef(null),L=c.useRef(0),[j,D]=c.useState(!1),[z,W]=c.useState([]),_=g=>{const B=++_s;W(q=>[...q,{id:B,msg:g}]),setTimeout(()=>W(q=>q.filter(K=>K.id!==B)),6e3)},k=g=>W(B=>B.filter(q=>q.id!==g)),A=g=>g.type.startsWith("image/"),M=()=>!0,H=b??A,Y=w??M,$=g=>{const B=[],q=[],K=[],G=[];let Z=0,le=y!=null?y-((p==null?void 0:p.length)??0):1/0;for(const Q of g)H(Q)?R&&Q.size>R?K.push(Q.name):le>0?(B.push(Q),le--):Z++:Y(Q)?q.push(Q):G.push(Q.name);return{imageFiles:B,docFiles:q,tooLarge:K,skipped:G,limitExceeded:Z}},m=g=>{const{imageFiles:B,docFiles:q,tooLarge:K,skipped:G,limitExceeded:Z}=$(g);K.length&&_(`File${K.length>1?"s":""} too large${R?` (max ${R/1024/1024}MB)`:""}: ${K.join(", ")}`),G.length&&_(`Skipped unsupported file${G.length>1?"s":""}: ${G.join(", ")}`),Z&&_(`Max ${y} images per message`),x&&B.length&&x(B);const le=q.concat(x?[]:B);h&&le.length&&h(le)};c.useEffect(()=>{const g=X.current;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,200)}px`)},[t]),c.useEffect(()=>{const g=B=>{var K,G,Z;if(r||i)return;const q=(K=B.target)==null?void 0:K.tagName;q==="INPUT"||q==="TEXTAREA"||q==="SELECT"||(G=B.target)!=null&&G.isContentEditable||B.ctrlKey||B.metaKey||B.altKey||B.key.length!==1&&B.key!=="Backspace"&&B.key!=="Delete"||(Z=X.current)==null||Z.focus()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r,i]);const S=g=>{g.preventDefault(),L.current++,g.dataTransfer.types.includes("Files")&&D(!0)},F=g=>{g.preventDefault(),L.current--,L.current===0&&D(!1)},U=g=>g.preventDefault(),te=g=>{g.preventDefault(),L.current=0,D(!1);const B=Array.from(g.dataTransfer.files);B.length&&m(B)},ne=g=>{const B=Array.from(g.target.files||[]);O.current&&(O.current.value=""),B.length&&m(B)},V=g=>{var Q;if(!x)return;const B=(Q=g.clipboardData)==null?void 0:Q.items;if(!B)return;const q=[];for(const Ke of B){const Se=Ke.getAsFile();Se&&q.push(Se)}if(q.length===0)return;const{imageFiles:K,tooLarge:G,skipped:Z,limitExceeded:le}=$(q);G.length&&_(`File${G.length>1?"s":""} too large: ${G.join(", ")}`),Z.length&&_(`Skipped unsupported file${Z.length>1?"s":""}: ${Z.join(", ")}`),le&&_(`Max ${y} images per message`),K.length&&(g.preventDefault(),x(K))},J=!r&&!i&&!!(f!=null&&f.length)&&t.length===0,re=He({prompts:f??[],enabled:J}),be=g=>{if(J){if(g.key==="ArrowDown"||g.key==="ArrowRight"){g.preventDefault(),re.next();return}if(g.key==="ArrowUp"||g.key==="ArrowLeft"){g.preventDefault(),re.prev();return}if(g.key==="Tab"&&!g.shiftKey){g.preventDefault(),s==null||s(re.currentPrompt);return}}o==null||o(g)},Ye=(t.trim()||(p==null?void 0:p.length)>0||(u==null?void 0:u.length)>0)&&!i,Te=h||x;return e.jsxs("div",{className:["ds-prompt-input",P].filter(Boolean).join(" "),...I,children:[Te&&e.jsx("input",{ref:O,type:"file",multiple:!0,accept:"*/*",className:"ds-prompt-input__file-input",onChange:ne}),e.jsxs("div",{className:["ds-prompt-input__box",j&&"ds-prompt-input__box--dragging"].filter(Boolean).join(" "),onDragEnter:S,onDragLeave:F,onDragOver:U,onDrop:te,children:[j&&e.jsx("div",{className:"ds-prompt-input__drag-overlay",children:"Drop files here"}),e.jsx("textarea",{ref:X,value:t,onChange:g=>s==null?void 0:s(g.target.value),onKeyDown:be,onPaste:V,placeholder:J?"":l,disabled:r||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:re.displayed}),e.jsx("span",{className:"ds-prompt-input__anim-cursor"})]}),p&&p.length>0&&e.jsx("div",{className:"ds-prompt-input__images",children:p.map((g,B)=>e.jsxs("div",{className:"ds-prompt-input__image-thumb",children:[e.jsx("img",{src:g.preview,alt:""}),e.jsx("button",{className:"ds-prompt-input__image-remove",onClick:()=>v==null?void 0:v(B),"aria-label":"Remove image",type:"button",children:e.jsx(E.X,{size:12,strokeWidth:2})})]},B))}),z.length>0&&e.jsx("div",{className:"ds-prompt-input__warnings",children:z.map(g=>e.jsxs("div",{className:"ds-prompt-input__warning",role:"alert",children:[e.jsx("span",{children:g.msg}),e.jsx("button",{type:"button",className:"ds-prompt-input__warning-close",onClick:()=>k(g.id),"aria-label":"Dismiss",children:e.jsx(E.X,{size:C[1],strokeWidth:1.5})})]},g.id))}),u&&u.length>0&&e.jsx("div",{className:"ds-prompt-input__attachments",children:u.map((g,B)=>e.jsx(ie,{size:"xs",children:e.jsxs("span",{className:"ds-prompt-input__badge-content",children:[g.uploading?e.jsx(E.Loader,{size:C[1],strokeWidth:1.5,className:"spin"}):e.jsx(E.Paperclip,{size:C[1],strokeWidth:1.5}),g.filename,g.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(B),children:e.jsx(E.X,{size:C[1],strokeWidth:1.5})})]})},B))}),e.jsxs("div",{className:"ds-prompt-input__toolbar",children:[Te&&e.jsx(ee,{variant:"ghost",size:"xs",icon:e.jsx(E.Paperclip,{size:C[2],strokeWidth:1.5}),"aria-label":"Attach files",onClick:()=>{var g;return(g=O.current)==null?void 0:g.click()}}),N,T,e.jsx("div",{className:"ds-prompt-input__spacer"}),r?e.jsx(ee,{variant:"primary",size:"xs",icon:e.jsx(E.Square,{size:C[2],strokeWidth:1.5}),onClick:a,"aria-label":"Stop"}):e.jsx(ee,{variant:"primary",size:"xs",icon:e.jsx(E.ArrowUp,{size:C[2],strokeWidth:1.5}),onClick:n,disabled:!Ye,"aria-label":"Send"})]})]})]})}const De={fast:0,standard:1,premium:2},Ie={fast:"data-5",standard:"data-3",premium:"data-6"};function Ns({models:t=[],value:s,onChange:n,size:a="xs",minTier:o,showAutoOption:r=!1,groupByTier:i=!0,className:l="",...f}){const[u,p]=c.useState(!1),h=c.useRef(null),x=c.useRef(null),d=c.useRef(null),[v,b]=c.useState({}),w=t.filter(j=>!o||j.name==="auto"?!0:(De[j.tier]??1)>=(De[o]??1)),y=w.find(j=>j.name==="auto"),R=w.filter(j=>j.name!=="auto"),N=t.find(j=>j.name===s),P=new Set(R.map(j=>j.tier).filter(Boolean)).size>1;c.useEffect(()=>{if(!u)return;const j=320,D=()=>{var M;const _=(M=x.current)==null?void 0:M.getBoundingClientRect();if(!_)return;const k=window.innerHeight-_.bottom,A=k<j+8&&_.top>k;b({position:"fixed",zIndex:"var(--z-dropdown, 500)",left:_.left,...A?{bottom:window.innerHeight-_.top+4,top:"auto"}:{top:_.bottom+4,bottom:"auto"}})};D(),window.addEventListener("scroll",D,!0),window.addEventListener("resize",D);const z=_=>{var k,A;!((k=h.current)!=null&&k.contains(_.target))&&!((A=d.current)!=null&&A.contains(_.target))&&p(!1)},W=_=>{_.key==="Escape"&&p(!1)};return document.addEventListener("mousedown",z),document.addEventListener("keydown",W),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D),document.removeEventListener("mousedown",z),document.removeEventListener("keydown",W)}},[u]);const I=j=>{n==null||n(j),p(!1)},O=j=>e.jsxs("button",{type:"button",className:["ds-model-picker__item",j.name===s&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I(j.name),children:[j.icon?e.jsx("span",{className:"ds-model-picker__item-icon",children:j.icon}):e.jsx(E.Cpu,{size:12,strokeWidth:1.5,className:"ds-model-picker__item-icon"}),e.jsx("span",{className:"ds-model-picker__item-name",children:j.displayName||j.name}),P&&j.tier&&e.jsx(ie,{size:"xs",variant:Ie[j.tier]||"default",children:j.tier})]},j.name),X=()=>!i||!P?R.map(O):["fast","standard","premium"].flatMap(j=>{const D=R.filter(z=>z.tier===j);return D.length?[e.jsx("div",{className:"ds-model-picker__group-label","data-tier":j,children:j.charAt(0).toUpperCase()+j.slice(1)},`lbl-${j}`),...D.map(O)]:[]}),L=u&&e.jsxs("div",{ref:d,className:"ds-model-picker__menu ds-scrollable","data-ds-portal":"",style:v,children:[r&&y&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:["ds-model-picker__item","ds-model-picker__item--auto",s==="auto"&&"ds-model-picker__item--active"].filter(Boolean).join(" "),onClick:()=>I("auto"),children:[e.jsx(E.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"})]}),X()]});return e.jsxs("div",{ref:h,className:["ds-model-picker",l].filter(Boolean).join(" "),...f,children:[e.jsxs("button",{ref:x,type:"button",className:"ds-model-picker__trigger",onClick:()=>p(j=>!j),"aria-haspopup":"listbox","aria-expanded":u,children:[N!=null&&N.icon?e.jsx("span",{children:N.icon}):e.jsx(E.Cpu,{size:12,strokeWidth:1.5}),e.jsx("span",{className:"ds-model-picker__trigger-name",children:(N==null?void 0:N.displayName)||(N==null?void 0:N.name)||s}),P&&(N==null?void 0:N.tier)&&e.jsx(ie,{size:"xs",variant:Ie[N.tier]||"default",children:N.tier})]}),typeof document<"u"&&fe.createPortal(L,document.body)]})}const gs=({filename:t,pages:s})=>e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",minWidth:0},children:[e.jsx("span",{className:"ds-sources-panel__filename",children:t}),s.length>0&&e.jsx("span",{className:"ds-sources-panel__pages",children:ke(s)})]});function ke(t){return t!=null&&t.length?"p. "+t.join(", "):null}function ws(t){const s=new Map;for(const n of t)s.has(n.filename)||s.set(n.filename,{filename:n.filename,url:n.url,items:[]}),s.get(n.filename).items.push(n);return[...s.values()]}function ys({sources:t=[],layout:s="list",title:n="Sources",maxVisible:a=5,onSourceClick:o}){const[r,i]=c.useState(!1),l=ws(t),f=l.length>a,u=r?l:l.slice(0,a),p=t.some(x=>x.snippet),h=["ds-sources-panel",s==="compact"&&"ds-sources-panel--compact"].filter(Boolean).join(" ");return s==="compact"?e.jsxs("div",{className:h,children:[u.map(x=>{const d=x.items.map(b=>b.page).filter(Boolean),v=!!o;return e.jsxs("div",{className:`ds-sources-panel__compact-row${v?" ds-sources-panel__compact-row--clickable":""}`,onClick:v?()=>o(x.items[0]):void 0,children:[e.jsx(E.FileText,{size:C[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:ke(d)})]},x.filename)}),f&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-a," more sources"]})]}):e.jsxs("div",{className:h,children:[n&&e.jsx("div",{className:"ds-sources-panel__title",children:n}),u.map(x=>{const d=x.items.map(b=>b.page).filter(Boolean),v=!!o;return p?e.jsx(xe,{title:e.jsx(gs,{filename:x.filename,pages:d}),padding:"s",children:x.items.map((b,w)=>e.jsx("div",{className:`ds-sources-panel__snippet${v?" ds-sources-panel__snippet--clickable":""}`,onClick:v?()=>o(b):void 0,children:b.snippet??`p. ${b.page}`},w))},x.filename):e.jsxs("div",{className:`ds-sources-panel__row${v?" ds-sources-panel__row--clickable":""}`,onClick:v?()=>o(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:ke(d)})]},x.filename)}),f&&!r&&e.jsxs("button",{className:"ds-sources-panel__more",onClick:()=>i(!0),children:["+",l.length-a," more sources"]})]})}function Ce(t){return t>=1e6?(t/1e6).toFixed(1).replace(/\.0$/,"")+"M":t>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"K":String(t)}function ks({used:t,limit:s,size:n="s",showCount:a=!0,showPercent:o=!1,warningThreshold:r=.8,errorThreshold:i=1}){const l=s>0?t/s:0,f=Math.min(l*100,100),u=l>=i?"error":l>=r?"warning":"normal";return e.jsxs("div",{className:`ds-token-counter ds-token-counter--${n}`,role:"meter","aria-valuenow":t,"aria-valuemax":s,children:[e.jsx("div",{className:"ds-token-counter__track",children:e.jsx("div",{className:`ds-token-counter__fill ds-token-counter__fill--${u}`,style:{width:`${f}%`}})}),(a||o)&&e.jsxs("div",{className:`ds-token-counter__label ds-token-counter__label--${u}`,children:[a&&e.jsxs("span",{children:[Ce(t)," / ",Ce(s)," tokens"]}),o&&e.jsxs("span",{children:[Math.round(l*100),"%"]})]})]})}const Pe=5;function Es(t){return t<.34?"low":t<.67?"medium":"high"}function Rs({value:t=0,size:s="xs",showLabel:n="none",layout:a="inline"}){const o=Math.max(0,Math.min(1,t)),r=Math.round(o*Pe),i=Es(o);return e.jsxs("div",{className:["ds-confidence-bar",`ds-confidence-bar--${s}`,`ds-confidence-bar--${i}`,a==="block"&&"ds-confidence-bar--block"].filter(Boolean).join(" "),children:[e.jsx("div",{className:"ds-confidence-bar__segments","aria-hidden":"true",children:Array.from({length:Pe},(l,f)=>e.jsx("div",{className:`ds-confidence-bar__seg${f<r?" ds-confidence-bar__seg--filled":""}`},f))}),n==="text"&&e.jsx("span",{className:"ds-confidence-bar__label",children:i})]})}const Ts={add:"+",remove:"-",context:" "};function _e({line:t,lineNumbers:s}){return e.jsxs("div",{className:`ds-diff-view__line ds-diff-view__line--${t.type}`,children:[s&&t.lineNo!=null&&e.jsx("span",{className:"ds-diff-view__lineno",children:t.lineNo}),e.jsx("span",{className:"ds-diff-view__prefix",children:Ts[t.type]}),e.jsx("span",{className:"ds-diff-view__text",children:t.text})]})}function Ss({lines:t=[],layout:s="inline",wordWrap:n=!1,lineNumbers:a=!0,maxHeight:o,title:r}){const i=["ds-diff-view",`ds-diff-view--${s}`,n&&"ds-diff-view--wrap"].filter(Boolean).join(" "),l=o?{maxHeight:o,overflowY:"auto"}:void 0;if(s==="split"){const f=t.filter(p=>p.type==="remove"||p.type==="context"),u=t.filter(p=>p.type==="add"||p.type==="context");return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsxs("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:[e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:f.map((p,h)=>e.jsx(_e,{line:p,lineNumbers:a},h))}),e.jsx("div",{className:"ds-diff-view__split-col ds-scrollable",children:u.map((p,h)=>e.jsx(_e,{line:p,lineNumbers:a},h))})]})]})}return e.jsxs("div",{className:i,children:[r&&e.jsx("div",{className:"ds-diff-view__title",children:r}),e.jsx("div",{className:"ds-diff-view__body ds-scrollable",style:l,children:t.map((f,u)=>e.jsx(_e,{line:f,lineNumbers:a},u))})]})}function qe({value:t="idle",onLike:s,onDislike:n,className:a="",...o}){const r=t!=="idle";return e.jsxs("div",{className:["ds-message-feedback",r&&"ds-message-feedback--voted",a].filter(Boolean).join(" "),...o,children:[(!r||t==="liked")&&e.jsx("button",{className:["ds-message-feedback__btn",t==="liked"&&"ds-message-feedback__btn--liked"].filter(Boolean).join(" "),onClick:s,disabled:r,"aria-label":"Like","aria-pressed":t==="liked",children:e.jsx(E.ThumbsUp,{size:C[1],strokeWidth:1.5,fill:t==="liked"?"currentColor":"none"})}),(!r||t==="disliked")&&e.jsx("button",{className:["ds-message-feedback__btn",t==="disliked"&&"ds-message-feedback__btn--disliked"].filter(Boolean).join(" "),onClick:n,disabled:r,"aria-label":"Dislike","aria-pressed":t==="disliked",children:e.jsx(E.ThumbsDown,{size:C[1],strokeWidth:1.5,fill:t==="disliked"?"currentColor":"none"})})]})}function $s(t){const s=t instanceof Date?t:new Date(t);if(isNaN(s))return null;const n=new Date,a=s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(o-864e5);if(s>=o)return a;if(s>=r)return`Yesterday ${a}`;const i=s.getDate(),l=s.toLocaleString([],{month:"short"});return`${i} ${l} ${a}`}function As({role:t="assistant",text:s,timestamp:n,feedbackValue:a="idle",onLike:o,onDislike:r,className:i="",...l}){const f=t==="assistant"&&(o||r),u=!!s,p=n?$s(n):null;return!f&&!u&&!p?null:e.jsxs("div",{className:["ds-message-footer",`ds-message-footer--${t}`,i].filter(Boolean).join(" "),...l,children:[t==="user"&&p&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:p}),f&&e.jsx(qe,{className:"ds-message-action",value:a,onLike:o,onDislike:r}),u&&e.jsx(Xe,{className:"ds-message-action",text:s}),t==="assistant"&&p&&e.jsx("span",{className:"ds-message-footer__timestamp ds-message-action",children:p})]})}function Bs({label:t,className:s="",...n}){return e.jsxs("span",{className:["ds-thinking-dot",s].filter(Boolean).join(" "),...n,children:[e.jsx("span",{className:"ds-thinking-dot__pulse"}),t&&e.jsx("span",{className:"ds-thinking-dot__label",children:t})]})}function Ds({variant:t="light",glow:s,mask:n=!0,style:a,...o}){const r=t==="dark",i=s??r,l=r?"rgba(255,250,250,0.05)":"var(--color-border-light)",f=r?"rgba(255,250,250,0.025)":"color-mix(in srgb, var(--color-border-light) 50%, transparent)";return e.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"hidden",zIndex:0,...i&&{background:"radial-gradient(ellipse 1000px 500px at 50% 30%, rgba(234,100,100,0.18), transparent 70%)"},...a},...o,children:e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:[`linear-gradient(${l} 1px, transparent 1px)`,`linear-gradient(90deg, ${l} 1px, transparent 1px)`,`linear-gradient(${f} 1px, transparent 1px)`,`linear-gradient(90deg, ${f} 1px, transparent 1px)`].join(", "),backgroundSize:"80px 80px, 80px 80px, 16px 16px, 16px 16px",backgroundPosition:"-1px -1px, -1px -1px, -1px -1px, -1px -1px",...n&&{WebkitMaskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)",maskImage:"radial-gradient(ellipse at center, #000 30%, transparent 85%)"}}})})}function Is({children:t,axis:s="y",style:n,className:a="",...o}){const r=s==="x"?{overflowX:"auto",overflowY:"hidden"}:s==="both"?{overflow:"auto"}:{overflowY:"auto",overflowX:"hidden"};return e.jsx("div",{className:`ds-scrollable ${a}`,style:{...r,...n},...o,children:t})}const je=280,ae=22,oe=8,he=6,Cs=200;function Ps(t){return t?typeof t=="function"?t():typeof t=="string"?document.querySelector(t):null:null}function Ls(t,s,n){const a=window.innerWidth,o=window.innerHeight;if(o-t.bottom>=s+ae+oe)return"bottom";if(t.top>=s+ae+oe)return"top";if(a-t.right>=n+ae+oe)return"right";if(t.left>=n+ae+oe)return"left";const r=Math.max(t.top,o-t.bottom,a-t.right,t.left);return r===o-t.bottom?"bottom":r===t.top?"top":r===a-t.right?"right":"left"}function Ms(t,s,n,a){const o=window.innerWidth,r=window.innerHeight;let i,l;switch(t){case"top":i=s.top-n-ae,l=s.left+s.width/2-a/2;break;case"bottom":i=s.bottom+ae,l=s.left+s.width/2-a/2;break;case"left":i=s.top+s.height/2-n/2,l=s.left-a-ae;break;default:i=s.top+s.height/2-n/2,l=s.right+ae}const f=Math.max(oe,Math.min(o-a-oe,l));return{top:Math.max(oe,Math.min(r-n-oe,i)),left:f,arrowOffset:l-f}}function zs({steps:t,currentStep:s,onNext:n,onBack:a,onSkip:o,onFinish:r,overlay:i=!0,labelNext:l="Next",labelBack:f="Back",labelSkip:u="Skip tour",labelFinish:p="Done"}){const h=c.useRef(null),x=c.useRef(t),d=c.useRef(s);x.current=t,d.current=s;const[v,b]=c.useState(!1),[w,y]=c.useState({position:"fixed",visibility:"hidden",width:je}),[R,N]=c.useState("bottom"),[T,P]=c.useState(null),I=c.useRef(!1),O=t[s],X=s===t.length-1,L=c.useCallback(()=>{const j=x.current[d.current];if(!j||!h.current)return;const D=Ps(j.target);if(!D)return;const z=D.getBoundingClientRect(),_=h.current.getBoundingClientRect().height||160,k=je,A=j.position||Ls(z,_,k),{top:M,left:H,arrowOffset:Y}=Ms(A,z,_,k);N(A),y({position:"fixed",top:M,left:H,width:je,visibility:"visible","--arrow-offset":`${Y}px`}),P({top:z.top-he,left:z.left-he,width:z.width+he*2,height:z.height+he*2})},[]);return c.useEffect(()=>{window.addEventListener("scroll",L,!0),window.addEventListener("resize",L);const j=requestAnimationFrame(()=>{L(),b(!0),I.current=!0});return()=>{cancelAnimationFrame(j),window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)}},[]),c.useEffect(()=>{if(!I.current)return;b(!1);const j=setTimeout(()=>{y(D=>({...D,visibility:"hidden"})),requestAnimationFrame(()=>{L(),b(!0)})},Cs+20);return()=>clearTimeout(j)},[s]),c.useEffect(()=>{v&&h.current&&h.current.focus({preventScroll:!0})},[v]),c.useEffect(()=>{const j=D=>{D.key==="Escape"&&o()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o]),c.useEffect(()=>{if(!v)return;const j=D=>{if(D.key!=="Tab"||!h.current)return;const z=Array.from(h.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'));if(!z.length)return;const W=z[0],_=z[z.length-1];D.shiftKey&&document.activeElement===W?(D.preventDefault(),_.focus()):!D.shiftKey&&document.activeElement===_&&(D.preventDefault(),W.focus())};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[v]),!O||typeof document>"u"?null:fe.createPortal(e.jsxs(e.Fragment,{children:[T&&e.jsx("div",{className:["ds-coachmark__spotlight",i&&"ds-coachmark__spotlight--overlay",v&&"ds-coachmark__spotlight--visible"].filter(Boolean).join(" "),style:T,"aria-hidden":"true"}),e.jsxs("div",{ref:h,"data-ds-portal":"",role:"dialog","aria-modal":"false","aria-live":"polite","aria-label":O.title??`Step ${s+1} of ${t.length}`,className:["ds-coachmark__bubble",`ds-coachmark__bubble--${R}`,v&&"ds-coachmark__bubble--visible"].filter(Boolean).join(" "),style:w,tabIndex:-1,children:[e.jsx("button",{type:"button",className:"ds-coachmark__close",onClick:o,"aria-label":u,children:e.jsx(E.X,{size:16,strokeWidth:2})}),O.title&&e.jsx("div",{className:"ds-coachmark__title",children:O.title}),e.jsx("div",{className:"ds-coachmark__body",children:O.content}),e.jsxs("div",{className:"ds-coachmark__footer",children:[e.jsxs("span",{className:"ds-coachmark__counter",children:[s+1," / ",t.length]}),e.jsxs("div",{className:"ds-coachmark__footer-nav",children:[s>0&&e.jsx(ee,{variant:"secondary",size:"s",onClick:a,children:f}),e.jsx(ee,{variant:"primary",size:"s",onClick:X?r:n,children:X?p:l})]})]})]})]}),document.body)}function Fs(t,s={}){const{storageKey:n}=s,[a,o]=c.useState(0),[r,i]=c.useState(!1),l=()=>n&&typeof localStorage<"u"&&localStorage.getItem(n)==="done",f=c.useCallback(()=>{i(!1),n&&typeof localStorage<"u"&&localStorage.setItem(n,"done")},[n]);return{currentStep:a,isActive:r,start:()=>{l()||(o(0),i(!0))},next:()=>o(u=>Math.min(u+1,t.length-1)),back:()=>o(u=>Math.max(u-1,0)),skip:f,finish:f}}exports.Accordion=xe;exports.Alert=dt;exports.AnimatedNumber=os;exports.Avatar=Tt;exports.Badge=ie;exports.Banner=ts;exports.BottomSheet=pt;exports.Breadcrumb=zt;exports.Button=ee;exports.Card=nt;exports.ChatMessage=vs;exports.Checkbox=wt;exports.Coachmark=zs;exports.Code=ht;exports.CodeAccordion=ze;exports.ConfidenceBar=Rs;exports.CopyButton=Xe;exports.DiffView=Ss;exports.Drawer=Ut;exports.DrawerFooter=ge;exports.Dropdown=ss;exports.EmptyState=Pt;exports.EngineerGrid=Ds;exports.FormField=Lt;exports.H1=rt;exports.H2=at;exports.H3=ot;exports.H4=it;exports.InView=is;exports.Input=Qe;exports.Link=xt;exports.MessageFeedback=qe;exports.MessageFooter=As;exports.Modal=ft;exports.ModalFooter=ce;exports.ModelPicker=Ns;exports.NavRail=Ht;exports.NavRailAgent=Qt;exports.NavRailBody=Yt;exports.NavRailDivider=Jt;exports.NavRailFooter=Gt;exports.NavRailHeader=Kt;exports.NavRailItem=qt;exports.NavRailRecents=Zt;exports.P1=lt;exports.P2=Me;exports.P3=Ee;exports.Pagination=Ft;exports.ProgressBar=ns;exports.PromptInput=js;exports.Radio=yt;exports.ReasoningBlock=ps;exports.Scrollable=Is;exports.SegmentedControl=_t;exports.Select=tt;exports.SidePage=Xt;exports.SidePageFooter=we;exports.Skeleton=Fe;exports.SourcesPanel=ys;exports.Spinner=Le;exports.Stat=Mt;exports.StepIndicator=hs;exports.Stepper=st;exports.StreamingText=xs;exports.Tab=bt;exports.Table=St;exports.TableBody=At;exports.TableHead=$t;exports.TableRow=Bt;exports.TableSubheaderRow=Dt;exports.Tabs=vt;exports.Td=Ct;exports.Textarea=et;exports.Th=It;exports.ThinkingDot=Bs;exports.ToastContainer=fs;exports.Toggle=gt;exports.TokenCounter=ks;exports.ToolCallBubble=Ve;exports.ToolCallCard=Ve;exports.Tooltip=Re;exports.iconSizes=C;exports.useAnimatedNumber=Oe;exports.useAnimatedPlaceholder=He;exports.useCoachmark=Fs;exports.useInView=We;exports.useStreamScroll=bs;exports.useToast=ds;
|
package/dist/index.d.ts
CHANGED
|
@@ -946,3 +946,86 @@ export interface NavRailItemProps {
|
|
|
946
946
|
}
|
|
947
947
|
|
|
948
948
|
export declare function NavRailItem(props: NavRailItemProps): JSX.Element;
|
|
949
|
+
|
|
950
|
+
export interface NavRailBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
951
|
+
children?: ReactNode;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
export declare function NavRailBody(props: NavRailBodyProps): JSX.Element;
|
|
955
|
+
|
|
956
|
+
export interface NavRailHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
957
|
+
children?: ReactNode;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export declare function NavRailHeader(props: NavRailHeaderProps): JSX.Element;
|
|
961
|
+
|
|
962
|
+
export interface NavRailFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
963
|
+
children?: ReactNode;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export declare function NavRailFooter(props: NavRailFooterProps): JSX.Element;
|
|
967
|
+
|
|
968
|
+
export interface NavRailDividerProps extends HTMLAttributes<HTMLHRElement> {}
|
|
969
|
+
|
|
970
|
+
export declare function NavRailDivider(props: NavRailDividerProps): JSX.Element;
|
|
971
|
+
|
|
972
|
+
export interface NavRailRecentsProps extends HTMLAttributes<HTMLDivElement> {
|
|
973
|
+
children?: ReactNode;
|
|
974
|
+
label?: string;
|
|
975
|
+
defaultOpen?: boolean;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
export declare function NavRailRecents(props: NavRailRecentsProps): JSX.Element;
|
|
979
|
+
|
|
980
|
+
export interface NavRailAgentProps {
|
|
981
|
+
avatar: ReactNode;
|
|
982
|
+
label: string;
|
|
983
|
+
selected?: boolean;
|
|
984
|
+
disabled?: boolean;
|
|
985
|
+
href?: string;
|
|
986
|
+
onClick?: (e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
987
|
+
className?: string;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
export declare function NavRailAgent(props: NavRailAgentProps): JSX.Element;
|
|
991
|
+
|
|
992
|
+
// ─── Coachmark ────────────────────────────────────────────────────────────────
|
|
993
|
+
|
|
994
|
+
export interface CoachmarkStep {
|
|
995
|
+
target: string | (() => Element | null);
|
|
996
|
+
title?: string;
|
|
997
|
+
content: ReactNode;
|
|
998
|
+
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export interface CoachmarkProps {
|
|
1002
|
+
steps: CoachmarkStep[];
|
|
1003
|
+
currentStep: number;
|
|
1004
|
+
onNext: () => void;
|
|
1005
|
+
onBack: () => void;
|
|
1006
|
+
onSkip: () => void;
|
|
1007
|
+
onFinish: () => void;
|
|
1008
|
+
overlay?: boolean;
|
|
1009
|
+
labelNext?: string;
|
|
1010
|
+
labelBack?: string;
|
|
1011
|
+
labelSkip?: string;
|
|
1012
|
+
labelFinish?: string;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
export declare function Coachmark(props: CoachmarkProps): JSX.Element | null;
|
|
1016
|
+
|
|
1017
|
+
export interface UseCoachmarkOptions {
|
|
1018
|
+
storageKey?: string;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export interface UseCoachmarkReturn {
|
|
1022
|
+
currentStep: number;
|
|
1023
|
+
isActive: boolean;
|
|
1024
|
+
start: () => void;
|
|
1025
|
+
next: () => void;
|
|
1026
|
+
back: () => void;
|
|
1027
|
+
skip: () => void;
|
|
1028
|
+
finish: () => void;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export declare function useCoachmark(steps: CoachmarkStep[], options?: UseCoachmarkOptions): UseCoachmarkReturn;
|