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