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