@heroui/agent 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- "use client";import{a as Me,c as W,d as _,e as ce,i as j,j as Ke,l as L,m as Ne}from"./chunk-BBB5EHDN.js";import{b as U}from"./chunk-S6OIAJSC.js";import{a as J}from"./chunk-CR3H7AVI.js";import{useId as qe,useMemo as ae,useState as X}from"react";import{Area as Ue,Bar as je,CartesianGrid as Je,Cell as At,Label as Nt,Line as Ze,Pie as St,PolarAngleAxis as Qe,PolarGrid as kt,PolarRadiusAxis as wt,Radar as _t,RadialBar as Rt,AreaChart as $t,BarChart as Mt,ComposedChart as Kt,LineChart as Lt,PieChart as Pt,RadarChart as Tt,RadialBarChart as Gt,ScatterChart as It,ReferenceLine as Et,ResponsiveContainer as oe,Sankey as Vt,Scatter as Bt,Tooltip as ue,XAxis as Re,YAxis as be,ZAxis as Dt}from"recharts";import{createContext as at,useCallback as rt,useContext as nt,useMemo as it,useState as st}from"react";import{jsx as he,jsxs as lt}from"react/jsx-runtime";var Le=at(null);function Se({children:t,className:e,defaultSelectedKey:r,isDisabled:i=!1,onSelectionChange:n,selectedKey:s,size:h="md",variant:g="default",...m}){let[o,d]=st(r),u=s??o,p=rt(v=>{i||v===u||(s===void 0&&d(v),n?.(v))},[u,i,n,s]),k=it(()=>({isDisabled:i,select:p,selectedKey:u}),[u,i,p]);return he(Le,{value:k,children:he("div",{className:J("aui-segment",e),"data-disabled":i||void 0,"data-size":h,"data-slot":"agent-ui-segment","data-variant":g,role:"group",...m,children:t})})}function Pe({children:t,className:e,disabled:r,id:i,onClick:n,...s}){let h=nt(Le);if(!h)throw new Error("Segment.Item must be rendered inside Segment.");let g=h.isDisabled||r,m=h.selectedKey===i;return lt("button",{"aria-pressed":m,className:J("aui-segment__item",e),"data-selected":m,"data-slot":"agent-ui-segment-item",disabled:g,type:"button",onClick:o=>{n?.(o),o.defaultPrevented||h.select(i)},...s,children:[he("span",{"aria-hidden":"true",className:"aui-segment__indicator"}),he("span",{className:"aui-segment__label",children:t})]})}function Te({className:t,...e}){return he("span",{"aria-hidden":"true",className:J("aui-segment__separator",t),"data-slot":"agent-ui-segment-separator",...e})}var ke=Object.assign(Se,{Item:Pe,Root:Se,Separator:Te});var ot=[4,4,4,4],ut=[4,0,0,4],Ge=[0,0,0,0],Ie=[0,4,4,0],Ee=[4,4,0,0];function we({dataKey:t,horizontal:e,stacked:r,visibleStackKeys:i}){if(!r)return e?Ie:Ee;let n=i.indexOf(t);return n<0?Ge:e&&i.length===1?ot:e&&n===0?ut:e&&n===i.length-1?Ie:!e&&n===i.length-1?Ee:Ge}function Ve(t,{height:e,margins:r,width:i}){if(t.length===0||!mt(i,e,r)||!t.every(bt))return null;let n={bottom:e-r.bottom,height:e-r.top-r.bottom,left:r.left,right:i-r.right,top:r.top,width:i-r.left-r.right};if(n.width<1||n.height<1)return null;let s=Math.min(...t.map(c=>c.low)),h=Math.max(...t.map(c=>c.high)),g=ct(s,h);if(!g)return null;let m=ht(g[0],g[1]),o=[m[0],m.at(-1)],d=o[1]-o[0];if(!Number.isFinite(d)||d<=0)return null;let u=c=>n.top+(o[1]-c)/d*n.height,p=n.width/t.length,k=Math.max(1,Math.min(14,p*.62)),v=t.map((c,y)=>{let A=n.left+p*(y+.5),$=u(c.open),w=u(c.close),S=($+w)/2,f=Math.max(1,Math.abs(w-$)),M=dt(S-f/2,n.top,n.bottom-f);return{body:{height:f,width:k,x:A-k/2,y:M},direction:c.close>c.open?"up":c.close<c.open?"down":"flat",index:y,label:c.label,wick:{bottom:u(c.low),top:u(c.high),x:A},x:A}});return{bounds:n,candles:v,xLabelIndices:gt(t.length,n.width),yDomain:o,yTicks:m.map(c=>({value:c,y:u(c)}))}}function dt(t,e,r){return Math.min(Math.max(t,e),r)}function _e(t){let e=Number(t.toPrecision(12));return Object.is(e,-0)?0:e}function ct(t,e){if(e>t)return[t,e];let r=t===0?1:Math.abs(t)*.05,i=t-r,n=e+r;return Number.isFinite(i)&&Number.isFinite(n)&&n>i?[i,n]:null}function ht(t,e){let r=e-t,i=r/4,n=Math.floor(Math.log10(i)),s=[],h=new Set;for(let g=n-2;g<=n+2;g+=1)for(let m of[1,2,2.5,5,10]){let o=_e(m*10**g);if(!Number.isFinite(o)||o<=0||h.has(o))continue;h.add(o);let d=Math.floor(t/o)*o,u=Math.ceil(e/o)*o,p=Math.round((u-d)/o)+1;if(p<4||p>6)continue;let k=Array.from({length:p},(y,A)=>_e(d+A*o)),v=Math.max(0,u-d-r)/r,c=Math.abs(p-5)*100+v+Math.abs(Math.log10(o/i))*.01;s.push({score:c,ticks:k})}return s.sort((g,m)=>g.score-m.score),s[0]?.ticks??Array.from({length:5},(g,m)=>_e(t+r*m/4))}function gt(t,e){if(t===1)return[0];let r=Math.min(t,6,Math.max(2,Math.floor(e/72)+1));return r===t?Array.from({length:t},(i,n)=>n):Array.from({length:r},(i,n)=>Math.round(n*(t-1)/(r-1)))}function mt(t,e,r){return Number.isFinite(t)&&t>0&&Number.isFinite(e)&&e>0&&Object.values(r).every(i=>Number.isFinite(i)&&i>=0)}function bt(t){return[t.open,t.high,t.low,t.close].every(Number.isFinite)&&t.high>=Math.max(t.open,t.close,t.low)&&t.low<=Math.min(t.open,t.close,t.high)}function Be(t,e,r){if(![t,e,r].every(Number.isFinite)||e===r)return 0;let i=(t-e)/(r-e);return Math.min(1,Math.max(0,i))}function De(t){let{centerX:e,centerY:r,count:i,endAngle:n=405,height:s,max:h,min:g,notchLength:m,notchWidth:o,padding:d=0,radius:u,startAngle:p=135,value:k,width:v}=t;if(!Oe(v,s)||!He(i)||!ft(e,r,m,o,u)||![n,d,p].every(Number.isFinite)||d<0||m!==void 0&&m<=0||o!==void 0&&o<=0||u!==void 0&&u<=0)return null;let c=e??v/2,y=r??s/2;if(c<0||c>v||y<0||y>s)return null;let A=Math.min(c,v-c,y,s-y)-d;if(A<=0)return null;let $=Math.min(u??A,A),w=Math.min(m??Math.max(2,$*.16),$),S=Math.min(o??Math.max(1,$*.035),$*2);if(w<=0||S<=0)return null;let f=ie(c,y),M=Be(k,g,h),b=Array.from({length:i},(I,F)=>{let V=i===1?.5:F/(i-1),x=(F+1)/i,K=p+(n-p)*V,G=K*Math.PI/180,P=Math.cos(G),B=Math.sin(G),R=-B,E=P,H=$-w,T=S/2,D=ie(c+P*H,y+B*H),Y=ie(c+P*$,y+B*$),ne=ie(D.x-R*T,D.y-E*T),ee=ie(Y.x-R*T,Y.y-E*T),xe=ie(Y.x+R*T,Y.y+E*T),le=ie(D.x+R*T,D.y+E*T);return{active:M>=x,angle:O(K,1e6),index:F,inner:D,outer:Y,path:`M ${me(ne)} L ${me(ee)} L ${me(xe)} L ${me(le)} Z`,position:O(V,1e6),threshold:O(x,1e6)}});return{center:f,notchLength:O(w),notchWidth:O(S),notches:b,progress:M,radius:O($)}}function Fe(t){let{count:e,gap:r=2,height:i,inset:n=0,max:s,min:h,orientation:g="horizontal",value:m,width:o}=t;if(!Oe(o,i)||!He(e)||![r,n].every(Number.isFinite)||r<0||n<0)return null;let d=i-n*2,u=o-n*2;if(d<=0||u<=0)return null;let v=((g==="horizontal"?u:d)-r*(e-1))/e;if(!Number.isFinite(v)||v<=0)return null;let c=Be(m,h,s);return{notches:Array.from({length:e},(A,$)=>{let w=($+1)/e;return g==="horizontal"?{active:c>=w,height:O(d),index:$,threshold:O(w,1e6),width:O(v),x:O(n+$*(v+r)),y:O(n)}:{active:c>=w,height:O(v),index:$,threshold:O(w,1e6),width:O(u),x:O(n),y:O(i-n-v-$*(v+r))}}),orientation:g,progress:c}}function ft(...t){return t.every(e=>e===void 0||Number.isFinite(e))}function ie(t,e){return{x:O(t),y:O(e)}}function me(t){return`${t.x} ${t.y}`}function O(t,e=1e3){let r=Math.round(t*e)/e;return Object.is(r,-0)?0:r}function Oe(t,e){return[t,e].every(Number.isFinite)&&t>0&&e>0}function He(t){return Number.isInteger(t)&&t>=1&&t<=512}function Ye(t,e){if(!t)return[];let r=We(t,new Set),i=se(e.innerRadius,0),n=se(e.outerRadius,0),s=xt(e.maxDepth),h=se(e.startAngle,-90),g=se(e.endAngle,h+360),m=Math.min(g-h,360);if(!r||r.value<=0||s===0||i<0||n<=i||m<=1e-6)return[];let o=ze(r.children,1,s);if(o===0)return[];let d={arcs:[],centerX:se(e.centerX,0),centerY:se(e.centerY,0),gapAngle:Math.max(0,se(e.gapAngle,0)),innerRadius:i,maxDepth:s,ringWidth:(n-i)/o};return Xe(r.children,h,h+m,1,[r.id],d),d.arcs}function We(t,e){if(e.has(t))return null;e.add(t);let r=Array.isArray(t.children)?t.children:[],i=r.map(s=>We(s,e)).filter(s=>s!==null);e.delete(t);let n=r.length>0?i.reduce((s,h)=>s+h.value,0):Ct(t.value);return{children:i,id:t.id,label:t.label,value:n}}function ze(t,e,r){if(e>r)return 0;let i=0;for(let n of t)n.value<=0||(i=Math.max(i,e),e<r&&(i=Math.max(i,ze(n.children,e+1,r))));return i}function Xe(t,e,r,i,n,s){if(i>s.maxDepth)return;let h=t.filter(o=>o.value>0),g=h.reduce((o,d)=>o+d.value,0);if(g<=0)return;let m=e;for(let[o,d]of h.entries()){let u=o===h.length-1?r:m+(r-e)*d.value/g,[p,k]=yt(m,u,s.gapAngle),v=s.innerRadius+(i-1)*s.ringWidth,c=v+s.ringWidth,y=[...n,d.id];s.arcs.push({d:pt({centerX:s.centerX,centerY:s.centerY,endAngle:k,innerRadius:v,outerRadius:c,startAngle:p}),depth:i,endAngle:k,id:d.id,innerRadius:v,label:d.label,outerRadius:c,path:y,startAngle:p,value:d.value}),Xe(d.children,m,u,i+1,y,s),m=u}}function yt(t,e,r){let i=e-t,n=Math.min(r,Math.max(0,i-1e-6));return[t+n/2,e-n/2]}function pt(t){let e=t.endAngle-t.startAngle;if(e>=360-1e-6)return vt(t);let r=te(t,t.outerRadius,t.startAngle),i=te(t,t.outerRadius,t.endAngle),n=e>180?1:0,s=`M ${q(r)} A ${z(t.outerRadius)} ${z(t.outerRadius)} 0 ${n} 1 ${q(i)}`;if(t.innerRadius<=0)return`${s} L ${z(t.centerX)} ${z(t.centerY)} Z`;let h=te(t,t.innerRadius,t.endAngle),g=te(t,t.innerRadius,t.startAngle);return`${s} L ${q(h)} A ${z(t.innerRadius)} ${z(t.innerRadius)} 0 ${n} 0 ${q(g)} Z`}function vt(t){let e=t.startAngle+180,r=te(t,t.outerRadius,t.startAngle),i=te(t,t.outerRadius,e),n=`M ${q(r)} A ${z(t.outerRadius)} ${z(t.outerRadius)} 0 0 1 ${q(i)} A ${z(t.outerRadius)} ${z(t.outerRadius)} 0 0 1 ${q(r)}`;if(t.innerRadius<=0)return`${n} Z`;let s=te(t,t.innerRadius,t.startAngle),h=te(t,t.innerRadius,e);return`${n} L ${q(s)} A ${z(t.innerRadius)} ${z(t.innerRadius)} 0 0 0 ${q(h)} A ${z(t.innerRadius)} ${z(t.innerRadius)} 0 0 0 ${q(s)} Z`}function te(t,e,r){let i=r*Math.PI/180;return{x:t.centerX+Math.cos(i)*e,y:t.centerY+Math.sin(i)*e}}function q(t){return`${z(t.x)} ${z(t.y)}`}function z(t){let e=Math.round(t*1e6)/1e6;return String(Object.is(e,-0)?0:e)}function se(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function Ct(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:0}function xt(t){return t===void 0||t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Number.isFinite(t)?Math.max(0,Math.floor(t)):0}import{Fragment as fe,jsx as a,jsxs as C}from"react/jsx-runtime";function ye(t,e,r){return r<1?null:t==="Home"?0:t==="End"?r-1:t==="ArrowRight"||t==="ArrowDown"?(e+1)%r:t==="ArrowLeft"||t==="ArrowUp"?(e-1+r)%r:null}function pe(t,e,r){let n=t.currentTarget.ownerSVGElement?.querySelectorAll(`[data-slot="${e}"]`)?.item(r);n&&typeof n.focus=="function"&&n.focus()}function Q({activeKeys:t,ariaLabel:e,items:r,onToggle:i}){let n=i!=null&&r.length>1,s=r.some(h=>h.value!=null);return a("div",{"aria-label":e,className:J("aui-legend",s?"aui-legend--values":void 0),"data-slot":"agent-ui-chart-legend",role:n?"group":"list",children:r.map(h=>{let g=C(fe,{children:[a("span",{className:"aui-legend__dot","data-slot":"agent-ui-chart-legend-indicator",style:{backgroundColor:h.color}}),a("span",{className:"aui-legend__label",children:h.label}),h.value!=null?a("span",{className:"aui-legend__value",children:h.value}):null]});return n?a("button",{"aria-pressed":t?.has(h.id)??!0,className:"aui-legend__button","data-slot":"agent-ui-chart-legend-item",type:"button",onClick:()=>i(h.id),children:g},h.id):a("span",{className:"aui-legend__item","data-slot":"agent-ui-chart-legend-item",role:"listitem",children:g},h.id)})})}function et({className:t,id:e,items:r,label:i,placement:n,style:s,visuallyHiddenFromAssistiveTechnology:h}){return C("div",{"aria-hidden":h||void 0,className:J("aui-chart-tooltip",t),"data-placement":n,"data-slot":"agent-ui-chart-tooltip",id:e,role:"tooltip",style:s,children:[i!==void 0&&i!==""?a("div",{className:"aui-chart-tooltip__header","data-slot":"agent-ui-chart-tooltip-header",children:i}):null,r.map(g=>C("div",{className:"aui-chart-tooltip__item","data-slot":"agent-ui-chart-tooltip-item",children:[a("span",{className:"aui-chart-tooltip__indicator","data-slot":"agent-ui-chart-tooltip-indicator",style:{backgroundColor:g.color}}),a("span",{className:"aui-chart-tooltip__label","data-slot":"agent-ui-chart-tooltip-label",children:g.label}),a("span",{className:"aui-chart-tooltip__value","data-slot":"agent-ui-chart-tooltip-value",children:g.value})]},g.id))]})}function de({active:t,indicatorColor:e,label:r,payload:i,series:n}){return!t||!i?.length?null:a(et,{label:r,items:i.map((s,h)=>{let g=n?.find(m=>m.dataKey===s.dataKey)?.format;return{color:e?.(s,h)??s.color??s.payload?.fill??s.fill??s.stroke??Ne(h),id:String(s.dataKey??s.name??`series-${h}`),label:s.name??s.dataKey,value:typeof s.value=="number"?_(s.value,g):s.value}})})}function ve({state:t}){return t?a(et,{visuallyHiddenFromAssistiveTechnology:!0,className:"aui-chart-tooltip--floating",items:t.items,label:t.label,placement:t.placement,style:{left:t.anchorX,top:t.anchorY}}):null}function re(t,e,r){let i=t.currentTarget.ownerSVGElement,n=i?.parentElement;if(!i||!n)return{...r,anchorX:0,anchorY:0,placement:"bottom"};let s=n.getBoundingClientRect(),h=s.width/2,g=s.height/2,m=typeof i.getScreenCTM=="function"?i.getScreenCTM():null;if(m)h=m.a*e.x+m.c*e.y+m.e-s.left,g=m.b*e.x+m.d*e.y+m.f-s.top;else{let d=i.getBoundingClientRect(),u=i.getAttribute("viewBox")?.trim().split(/[ ,]+/).map(Number);if(u?.length===4&&u.every(Number.isFinite)&&u[2]>0&&u[3]>0&&d.width>0&&d.height>0){let p=Math.min(d.width/u[2],d.height/u[3]),k=u[2]*p,v=u[3]*p;h=d.left-s.left+(d.width-k)/2+(e.x-u[0])*p,g=d.top-s.top+(d.height-v)/2+(e.y-u[1])*p}}let o=Math.min(95,s.width/2);return h=Math.min(Math.max(h,o),Math.max(o,s.width-o)),g=Math.min(Math.max(g,0),s.height),{...r,anchorX:h,anchorY:g,placement:g<92?"bottom":"top"}}function Ft({color:t,cx:e,cy:r,index:i,lastIndex:n}){return i!==n||e===void 0||r===void 0?null:C("g",{"aria-hidden":"true","data-slot":"agent-ui-chart-live-point",children:[a("circle",{className:"aui-chart-live-point__pulse",cx:e,cy:r,fill:t,r:"7"}),a("circle",{className:"aui-chart-live-point__core",cx:e,cy:r,fill:t,r:"3.5"})]})}function Ot(t,e){let r=Number(typeof e=="number"?e:e??NaN);return Number.isInteger(r)?t[r]:void 0}function Ce({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,type:s,viewAction:h}){let g=qe().replaceAll(":",""),[m,o]=X(()=>new Set),d=e.ranges??[],u=d.find(l=>l.id===e.defaultRangeId)?.id??d.at(-1)?.id,[p,k]=X(u),v=d.find(l=>l.id===p)??d.find(l=>l.id===u),c=ae(()=>new Set(e.series.map(l=>l.dataKey)),[e.series]),y=ae(()=>{let l=new Set([...m].filter(N=>c.has(N)));return l.size<e.series.length?l:new Set},[e.series.length,m,c]),A=ae(()=>e.data.map(l=>Object.fromEntries(Object.entries(l).map(([N,Z])=>[N,typeof Z=="number"||typeof Z=="string"?Z:String(Z??"")]))),[e.data]),$=v?.maxItems?A.slice(-v.maxItems):A,w=e.kind==="line-chart"&&e.mode==="live"?$.slice(-(e.windowSize??30)):$,S=e.series[0],f=(()=>{if(!e.showSummary||!S||w.length===0)return null;let l=Number(w[0]?.[S.dataKey]),N=Number(w.at(-1)?.[S.dataKey]);return!Number.isFinite(l)||!Number.isFinite(N)?null:{change:l===0?void 0:(N-l)/Math.abs(l)*100,format:S.format&&S.format.style!=="percent"?{...S.format,compact:!1}:S.format,label:S.label,value:N}})(),M=s==="bar"&&e.kind==="bar-chart"&&e.layout==="horizontal",b=e.kind==="composed-chart",I=e.series.filter(l=>!y.has(l.dataKey)).map(l=>l.dataKey),F=b?e.series.filter(l=>l.type==="bar"&&l.stacked&&!y.has(l.dataKey)).map(l=>l.dataKey):[],V=b?e.series.find(l=>l.axis!=="right")?.format:e.series[0]?.format,x=b?e.series.find(l=>l.axis==="right")?.format:void 0,K=b&&e.series.some(l=>l.axis==="right"),G=(l,N=V)=>N?_(l,N):ce(l),P=e.kind==="line-chart"?e.mode??"standard":"standard",B=e.kind==="line-chart"?e.baseline??0:0,R=S?w.flatMap(l=>{let N=Number(l[S.dataKey]);return Number.isFinite(N)?[N]:[]}):[],E=Math.min(B,...R),H=Math.max(B,...R),T=H===E?50:(H-B)/(H-E)*100,D=L(e.kind==="line-chart"?e.positiveColor??"success":"success",0),Y=L(e.kind==="line-chart"?e.negativeColor??"danger":"danger",1),ne=P==="live"&&S?Number(w.at(-1)?.[S.dataKey]):void 0,ee=new Set(e.series.filter(l=>!y.has(l.dataKey)).map(l=>l.dataKey)),xe=P==="profit-loss"?a(Q,{ariaLabel:"Chart direction",items:[{color:D,id:"positive",label:"Above baseline"},{color:Y,id:"negative",label:"Below baseline"}]}):a(Q,{activeKeys:ee,ariaLabel:"Chart series",items:e.series.map((l,N)=>({color:L(l.color,N),id:l.dataKey,label:l.label})),onToggle:e.series.length>1?l=>o(()=>{let N=new Set(y),Z=e.series.length-N.size;return N.has(l)?N.delete(l):Z>1&&N.add(l),N}):void 0}),le=C(fe,{children:[a(Je,{vertical:!1}),M?C(fe,{children:[a(Re,{tickFormatter:l=>G(l),type:"number"}),a(be,{dataKey:e.xKey,type:"category",width:88})]}):C(fe,{children:[a(Re,{dataKey:e.xKey,interval:"preserveStartEnd",minTickGap:28,tickMargin:10}),a(be,{domain:s==="line"?["auto","auto"]:void 0,tickFormatter:l=>G(l),width:"auto",yAxisId:b?"left":void 0}),K?a(be,{orientation:"right",tickFormatter:l=>G(l,x),width:"auto",yAxisId:"right"}):null]}),a(ue,{isAnimationActive:!1,content:a(de,{series:e.series,indicatorColor:P==="profit-loss"?l=>{let N=Number(l.value);return Number.isFinite(N)?N>=B?D:Y:void 0}:void 0})})]}),ge={data:w,margin:{bottom:2,left:8,right:K?8:12,top:8},...n&&{onClick:l=>{let N=Ot(w,l.activeIndex);N&&n(W(e,N))}}};return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||h?a(j,{component:e,formats:r,viewAction:h,onAction:i}):null,children:[f||d.length>0||P==="live"?C("div",{className:"aui-chart-toolbar","data-slot":"agent-ui-chart-toolbar",children:[f?C("div",{className:"aui-chart-summary","data-slot":"agent-ui-chart-summary",children:[a("span",{className:"aui-chart-summary__label",children:f.label}),C("div",{className:"aui-chart-summary__value-row",children:[a("strong",{className:"aui-chart-summary__value",children:_(f.value,f.format)}),f.change!==void 0?a(Ke,{value:f.change}):null,v?a("span",{className:"aui-chart-summary__range","data-slot":"agent-ui-chart-summary-range",children:v.label}):null]})]}):null,P==="live"?C("span",{className:"aui-chart-live","data-slot":"agent-ui-chart-live",children:[a("span",{"aria-hidden":"true",className:"aui-chart-live__dot"}),"Live",S&&Number.isFinite(ne)?a("span",{className:"aui-chart-accessible-value",children:`Latest ${S.label}: ${_(ne,S.format)}`}):null]}):null,d.length>0?a(ke,{"aria-label":"Chart range",className:"aui-chart-ranges",selectedKey:v?.id,variant:"text",onSelectionChange:k,children:d.map(l=>a(ke.Item,{id:l.id,children:l.label},l.id))}):null]}):null,a("div",{"aria-label":`${e.title} chart`,"data-slot":"agent-ui-chart",role:"img",className:J(`aui-chart aui-chart--${s}`,P==="live"?"aui-chart--live":void 0,P==="profit-loss"?"aui-chart--profit-loss":void 0),children:a(oe,{height:220,width:"100%",children:s==="composed"&&e.kind==="composed-chart"?C(Kt,{accessibilityLayer:!0,...ge,children:[a("defs",{children:e.series.map((l,N)=>C("linearGradient",{id:`${g}-${N}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[a("stop",{offset:"0%",stopColor:L(l.color,N),stopOpacity:.18}),a("stop",{offset:"100%",stopColor:L(l.color,N),stopOpacity:.02})]},l.dataKey))}),le,e.series.map((l,N)=>{let Z=L(l.color,N),Ae=l.axis??"left";return l.type==="area"?a(Ue,{dataKey:l.dataKey,dot:!1,fill:`url(#${g}-${N})`,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stackId:l.stacked?"area-stack":void 0,stroke:Z,strokeWidth:2,type:"monotone",yAxisId:Ae},l.dataKey):l.type==="bar"?a(je,{dataKey:l.dataKey,fill:Z,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stackId:l.stacked?"bar-stack":void 0,yAxisId:Ae,radius:we({dataKey:l.dataKey,horizontal:!1,stacked:!!l.stacked,visibleStackKeys:F})},l.dataKey):a(Ze,{dataKey:l.dataKey,dot:!1,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stroke:Z,strokeWidth:2,type:"monotone",yAxisId:Ae},l.dataKey)})]}):s==="line"?C(Lt,{accessibilityLayer:!0,...ge,children:[P==="profit-loss"&&e.kind==="line-chart"?a("defs",{children:C("linearGradient",{id:`${g}-profit-loss`,x1:"0",x2:"0",y1:"0",y2:"1",children:[a("stop",{offset:`${T}%`,stopColor:D}),a("stop",{offset:`${T}%`,stopColor:Y})]})}):null,le,P==="profit-loss"?a(Et,{stroke:"var(--border)",strokeDasharray:"4 4",y:B}):null,e.series.map((l,N)=>a(Ze,{dataKey:l.dataKey,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,strokeWidth:2,type:"monotone",dot:P==="live"?a(Ft,{color:L(l.color,N),lastIndex:w.length-1}):!1,stroke:P==="profit-loss"?`url(#${g}-profit-loss)`:L(l.color,N)},l.dataKey))]}):s==="area"?C($t,{accessibilityLayer:!0,...ge,children:[a("defs",{children:e.series.map((l,N)=>C("linearGradient",{id:`${g}-${N}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[a("stop",{offset:"0%",stopColor:L(l.color,N),stopOpacity:.2}),a("stop",{offset:"100%",stopColor:L(l.color,N),stopOpacity:.01})]},l.dataKey))}),le,e.series.map((l,N)=>a(Ue,{dataKey:l.dataKey,dot:!1,fill:`url(#${g}-${N})`,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stroke:L(l.color,N),strokeWidth:2,type:"monotone",stackId:e.kind==="area-chart"&&e.stacked?"stack":void 0},l.dataKey))]}):C(Mt,{accessibilityLayer:!0,...ge,layout:M?"vertical":"horizontal",children:[le,e.series.map((l,N)=>a(je,{dataKey:l.dataKey,fill:L(l.color,N),hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,radius:we({dataKey:l.dataKey,horizontal:M,stacked:e.kind==="bar-chart"&&!!e.stacked,visibleStackKeys:I}),stackId:e.kind==="bar-chart"&&e.stacked?"stack":void 0},l.dataKey))]})})}),xe]})}function fa(t){return a(Ce,{...t,type:"line"})}function ya(t){return a(Ce,{...t,type:"area"})}function pa(t){return a(Ce,{...t,type:"bar"})}function va(t){return a(Ce,{...t,type:"composed"})}function tt({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,variant:s,viewAction:h}){let[g,m]=X(()=>new Set),o=ae(()=>new Set(e.data.map(c=>String(c[e.labelKey]??""))),[e.data,e.labelKey]),d=ae(()=>{let c=new Set([...g].filter(y=>o.has(y)));return c.size<e.data.length?c:new Set},[e.data.length,g,o]),u=e.data.flatMap((c,y)=>{let A=String(c[e.labelKey]??"");return d.has(A)?[]:[{color:L(e.colors?.[A],y),name:A,original:c,value:Number(c[e.valueKey]??0)}]}),p=u.reduce((c,y)=>c+y.value,0),k=new Set(e.data.map(c=>String(c[e.labelKey]??"")).filter(c=>!d.has(c))),v=a(Q,{activeKeys:k,ariaLabel:"Chart categories",items:e.data.map((c,y)=>{let A=String(c[e.labelKey]??"");return{color:L(e.colors?.[A],y),id:A,label:A,value:_(Number(c[e.valueKey]??0),e.format)}}),onToggle:c=>m(()=>{let y=new Set(d);return y.has(c)?y.delete(c):y.size<e.data.length-1&&y.add(c),y})});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||h?a(j,{component:e,formats:r,viewAction:h,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} ${s} chart`,className:"aui-chart aui-chart--pie","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:220,width:"100%",children:C(Pt,{accessibilityLayer:!0,children:[C(St,{cx:"50%",cy:"50%",data:u,dataKey:"value",innerRadius:s==="donut"?58:0,isAnimationActive:!1,nameKey:"name",outerRadius:88,paddingAngle:0,strokeWidth:0,onClick:(c,y)=>{let A=u[y]?.original;A&&n?.(W(e,A))},children:[u.map(c=>a(At,{fill:c.color},c.name)),s==="donut"?a(Nt,{className:"aui-donut-total",position:"center",value:_(p,e.format)}):null]}),a(ue,{content:a(de,{series:[{dataKey:"value",format:e.format}]}),isAnimationActive:!1})]})})}),v]})}function Ca(t){return a(tt,{...t,variant:"pie"})}function xa(t){return a(tt,{...t,variant:"donut"})}function Aa({className:t,component:e,exportFormats:r,onAction:i,viewAction:n}){let[s,h]=X(()=>new Set),g=ae(()=>new Set(e.series.map(u=>u.dataKey)),[e.series]),m=ae(()=>{let u=new Set([...s].filter(p=>g.has(p)));return u.size<e.series.length?u:new Set},[e.series.length,s,g]),o=new Set(e.series.filter(u=>!m.has(u.dataKey)).map(u=>u.dataKey)),d=a(Q,{activeKeys:o,ariaLabel:"Chart series",items:e.series.map((u,p)=>({color:L(u.color,p),id:u.dataKey,label:u.label})),onToggle:e.series.length>1?u=>h(()=>{let p=new Set(m),k=e.series.length-p.size;return p.has(u)?p.delete(u):k>1&&p.add(u),p}):void 0});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||n?a(j,{component:e,formats:r,viewAction:n,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} radar chart`,className:"aui-chart aui-chart--radar","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:240,width:"100%",children:C(Tt,{data:e.data,margin:{bottom:8,left:20,right:20,top:8},children:[a(kt,{}),a(Qe,{dataKey:e.angleKey}),a(wt,{axisLine:!1,tick:!1}),e.series.map((u,p)=>m.has(u.dataKey)?null:a(_t,{dataKey:u.dataKey,fill:L(u.color,p),fillOpacity:.12,isAnimationActive:!1,name:u.label,stroke:L(u.color,p),strokeWidth:2},u.dataKey)),a(ue,{content:a(de,{series:e.series}),isAnimationActive:!1})]})})}),d]})}function Na({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let h=e.data.map((m,o)=>({...m,fill:L(e.colors?.[String(m[e.labelKey]??"")],o)})),g=a(Q,{ariaLabel:"Chart categories",items:e.data.map((m,o)=>{let d=String(m[e.labelKey]??"");return{color:L(e.colors?.[d],o),id:`${d}-${o}`,label:d,value:_(Number(m[e.valueKey]??0),e.format)}})});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} radial chart`,className:"aui-chart aui-chart--radial","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:230,width:"100%",children:C(Gt,{cx:"50%",cy:"50%",data:h,endAngle:e.endAngle??-270,innerRadius:"24%",outerRadius:"92%",startAngle:e.startAngle??90,children:[a(Qe,{domain:[0,e.maxValue??"auto"],tick:!1,type:"number"}),a(Rt,{background:!0,dataKey:e.valueKey,isAnimationActive:!1,name:e.labelKey,onClick:m=>n?.(W(e,m))}),a(ue,{isAnimationActive:!1,content:a(de,{series:[{dataKey:e.valueKey,format:e.format}]})})]})})}),g]})}function Sa({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let h=ae(()=>{let o=new Map;for(let d of e.data){let u=e.groupKey?String(d[e.groupKey]??"Other"):e.title,p=o.get(u)??[];p.push(d),o.set(u,p)}return[...o.entries()]},[e.data,e.groupKey,e.title]),g=[{dataKey:e.xKey,format:e.format},{dataKey:e.yKey,format:e.format},...e.sizeKey?[{dataKey:e.sizeKey,format:e.format}]:[]],m=a(Q,{ariaLabel:"Chart groups",items:h.map(([o],d)=>({color:L(e.colors?.[o],d),id:o,label:o}))});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} scatter chart`,className:"aui-chart aui-chart--scatter","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:240,width:"100%",children:C(It,{accessibilityLayer:!0,margin:{bottom:8,left:0,right:8,top:8},children:[a(Je,{}),a(Re,{dataKey:e.xKey,name:e.xKey,tickFormatter:o=>ce(o),type:"number"}),a(be,{dataKey:e.yKey,name:e.yKey,tickFormatter:o=>ce(o),type:"number",width:42}),e.sizeKey?a(Dt,{dataKey:e.sizeKey,range:[48,320],type:"number"}):null,a(ue,{content:a(de,{series:g}),cursor:{strokeDasharray:"4 4"},isAnimationActive:!1}),h.map(([o,d],u)=>a(Bt,{data:d,fill:L(e.colors?.[o],u),isAnimationActive:!1,name:o,onClick:p=>{let k="payload"in p?p.payload:p;n?.(W(e,k))}},o))]})})}),m]})}function ka({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),m=[...new Set(e.data.map(x=>String(x[e.xKey]??"")))],o=[...new Set(e.data.map(x=>String(x[e.yKey]??"")))],d=e.data.map(x=>Number(x[e.valueKey]??0)),u=Math.min(...d),p=Math.max(...d),k=p-u||1,v=420,c=84,y=28,A=8,$=44,w=(v-c-A)/Math.max(1,m.length),S=Math.max(26,Math.min(44,230/Math.max(1,o.length))),f=y+o.length*S+$,M=new Map(e.data.map(x=>[`${String(x[e.xKey]??"")}\0${String(x[e.yKey]??"")}`,x])),b=new Map([...M.keys()].map((x,K)=>[x,K])),I=Math.min(h,Math.max(0,M.size-1)),F=L(e.color,0),V=C("div",{"aria-label":"Heatmap intensity",className:"aui-legend aui-legend--scale","data-slot":"agent-ui-chart-legend",role:"img",children:[a("span",{className:"aui-legend__value",children:_(u,e.format)}),a("span",{className:"aui-legend__scale",style:{background:`linear-gradient(90deg, color-mix(in srgb, ${F} 8%, transparent), ${F})`}}),a("span",{className:"aui-legend__value",children:_(p,e.format)})]});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} heatmap`,className:"aui-chart aui-chart--heatmap","data-slot":"agent-ui-chart",role:n?"group":"img",children:C("svg",{"aria-hidden":n?void 0:!0,preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${v} ${f}`,children:[m.map((x,K)=>a("text",{className:"aui-heatmap__axis",textAnchor:"middle",x:c+K*w+w/2,y:f-14,children:x},x)),o.map((x,K)=>C("g",{children:[a("text",{className:"aui-heatmap__axis",dominantBaseline:"middle",textAnchor:"end",x:c-8,y:y+K*S+S/2,children:x}),m.map((G,P)=>{let B=`${G}\0${x}`,R=M.get(B),E=b.get(B),H=Number(R?.[e.valueKey]??0),T=R?.14+(H-u)/k*.76:.04;return C("g",{className:"aui-heatmap__cell","data-slot":R?"agent-ui-heatmap-cell":void 0,role:R&&n?"button":void 0,tabIndex:R&&n&&E!==void 0?E===I?0:-1:void 0,onClick:()=>{R&&n?.(W(e,R))},onFocus:()=>{E!==void 0&&g(E)},onKeyDown:D=>{if(!R||!n||E===void 0)return;let Y=ye(D.key,E,M.size);if(Y!==null){D.preventDefault(),g(Y),pe(D,"agent-ui-heatmap-cell",Y);return}D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),n(W(e,R)))},children:[a("rect",{fill:F,fillOpacity:T,height:Math.max(1,S-3),rx:6,width:Math.max(1,w-3),x:c+P*w+1.5,y:y+K*S+1.5}),R?a("title",{children:`${x}, ${G}: ${_(H,e.format)}`}):null]},G)})]},x))]})}),V]})}function wa({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),[m,o]=X(null),[d,u]=X(null),p=d??m,k=420,v=260,c=e.data.map(f=>({close:Number(f[e.closeKey]),high:Number(f[e.highKey]),label:String(f[e.xKey]??""),low:Number(f[e.lowKey]),open:Number(f[e.openKey])})),y=Ve(c,{height:v,margins:{bottom:34,left:58,right:8,top:10},width:k}),A=L(e.upColor??"success",0),$=L(e.downColor??"danger",1),w=L("default",2),S=Math.min(h,e.data.length-1);return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[C("div",{"aria-label":`${e.title} candlestick chart`,className:"aui-chart aui-chart--candlestick","data-slot":"agent-ui-chart",role:"group",children:[C("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${k} ${v}`,children:[y?.yTicks.map(f=>C("g",{children:[a("line",{className:"aui-chart-grid-line",x1:y.bounds.left,x2:y.bounds.right,y1:f.y,y2:f.y}),a("text",{className:"aui-chart-axis-label",dominantBaseline:"middle",textAnchor:"end",x:y.bounds.left-9,y:f.y,children:e.format?_(f.value,e.format):ce(f.value)})]},f.value)),y?.candles.map(f=>{let M=e.data[f.index],b=c[f.index],I=f.direction==="up"?A:f.direction==="down"?$:w,F={items:[{color:I,id:"open",label:"Open",value:_(b.open,e.format)},{color:I,id:"high",label:"High",value:_(b.high,e.format)},{color:I,id:"low",label:"Low",value:_(b.low,e.format)},{color:I,id:"close",label:"Close",value:_(b.close,e.format)}],label:f.label};return C("g",{"aria-label":`${f.label}: open ${_(b.open,e.format)}, high ${_(b.high,e.format)}, low ${_(b.low,e.format)}, close ${_(b.close,e.format)}`,className:"aui-chart-mark","data-slot":"agent-ui-candlestick",role:M&&n?"button":"img",tabIndex:f.index===S?0:-1,onBlur:()=>o(null),onPointerLeave:()=>u(null),onClick:M&&n?()=>n(W(e,M)):void 0,onFocus:V=>{g(f.index),o(re(V,{x:f.x,y:Math.min(f.wick.top,f.body.y)},F))},onKeyDown:V=>{let x=ye(V.key,f.index,y.candles.length);if(x!==null){V.preventDefault(),g(x),pe(V,"agent-ui-candlestick",x);return}!M||!n||V.key!=="Enter"&&V.key!==" "||(V.preventDefault(),n(W(e,M)))},onPointerEnter:V=>{u(re(V,{x:f.x,y:Math.min(f.wick.top,f.body.y)},F))},children:[a("line",{stroke:I,strokeWidth:1.5,x1:f.wick.x,x2:f.wick.x,y1:f.wick.top,y2:f.wick.bottom}),a("rect",{fill:I,height:f.body.height,rx:Math.min(2,f.body.width/2),width:f.body.width,x:f.body.x,y:f.body.y})]},`${f.label}-${f.index}`)}),y?.xLabelIndices.map(f=>{let M=y.candles[f];return M?a("text",{className:"aui-chart-axis-label",textAnchor:"middle",x:M.x,y:v-10,children:M.label},`${M.label}-${f}`):null})]}),a(ve,{state:p})]}),a(Q,{ariaLabel:"Price direction",items:[{color:A,id:"up",label:"Close above open"},{color:$,id:"down",label:"Close below open"}]})]})}function _a({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),[m,o]=X(null),[d,u]=X(null),p=d??m,k=640,v=250,c=12,y=238,A=22,$=618,w=(e.orientation??"vertical")==="vertical",S=e.data.map(x=>Math.max(0,Number(x[e.valueKey]??0))),f=Math.max(...S,1),M=S[0]??0,b=Math.min(h,e.data.length-1),I=w?(y-c)/e.data.length:($-A)/e.data.length,F=x=>{let K=(S[x]??0)/f,G=(S[x+1]??S[x]??0)/f;if(w){let T=c+I*x,D=c+I*(x+1)-3,Y=Math.max(8,K*($-A)),ne=Math.max(8,G*($-A)),ee=k/2;return`${ee-Y/2},${T} ${ee+Y/2},${T} ${ee+ne/2},${D} ${ee-ne/2},${D}`}let P=A+I*x,B=A+I*(x+1)-3,R=Math.max(8,K*(y-c)),E=Math.max(8,G*(y-c)),H=v/2;return`${P},${H-R/2} ${B},${H-E/2} ${B},${H+E/2} ${P},${H+R/2}`},V=e.data.map((x,K)=>{let G=String(x[e.labelKey]??""),P=S[K]??0,B=M>0?P/M:0;return{color:L(e.colors?.[G],K),id:`${G}-${K}`,label:G,value:e.showPercentages?`${_(P,e.format)} \xB7 ${_(B,{maximumFractionDigits:1,style:"percent"})}`:_(P,e.format)}});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[C("div",{"aria-label":`${e.title} funnel chart`,"data-slot":"agent-ui-chart",role:"group",className:J("aui-chart aui-chart--funnel",w?"aui-chart--funnel-vertical":"aui-chart--funnel-horizontal"),children:[a("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${k} ${v}`,children:e.data.map((x,K)=>{let G=String(x[e.labelKey]??""),P=L(e.colors?.[G],K),B=S[K]??0,R=M>0?B/M:0,E={items:[{color:P,id:"value",label:"Value",value:_(B,e.format)},...e.showPercentages?[{color:P,id:"conversion",label:"From first stage",value:_(R,{maximumFractionDigits:1,style:"percent"})}]:[]],label:G},H=w?{x:k/2,y:c+I*K}:{x:A+I*(K+.5),y:c};return a("g",{"aria-label":`${G}: ${_(S[K]??0,e.format)}`,className:"aui-chart-mark","data-slot":"agent-ui-funnel-stage",role:n?"button":"img",tabIndex:K===b?0:-1,onBlur:()=>o(null),onPointerLeave:()=>u(null),onClick:n?()=>n(W(e,x)):void 0,onFocus:T=>{g(K),o(re(T,H,E))},onKeyDown:T=>{let D=ye(T.key,K,e.data.length);if(D!==null){T.preventDefault(),g(D),pe(T,"agent-ui-funnel-stage",D);return}n&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),n(W(e,x))))},onPointerEnter:T=>{u(re(T,H,E))},children:a("polygon",{fill:P,points:F(K)})},`${G}-${K}`)})}),a(ve,{state:p})]}),a(Q,{ariaLabel:"Funnel stages",items:V})]})}function Ra({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(null),[m,o]=X(null),d=m??h,{maximum:u,minimum:p}=Me(e),k=e.notches??30,v=L(e.color,0),c=_(e.value,e.format),y={label:e.label,max:u,min:p,value:e.value},A=e.orientation??"arc",$={items:[{color:v,id:"value",label:"Value",value:c},{color:v,id:"range",label:"Range",value:`${_(p,e.format)} \u2013 ${_(u,e.format)}`}],label:e.label},w=A==="arc"?{x:240,y:4}:{x:280,y:34},S={"aria-label":`${e.label}: ${c}`,onBlur:()=>g(null),onClick:n?()=>n(W(e,y)):void 0,onFocus:b=>{g(re(b,w,$))},onKeyDown:b=>{!n||b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),n(W(e,y)))},onPointerEnter:b=>{o(re(b,w,$))},onPointerLeave:()=>o(null),role:n?"button":"img",tabIndex:0},f=A==="arc"?De({centerX:240,centerY:126,count:k,height:240,max:u,min:p,padding:12,radius:104,value:e.value,width:480}):null,M=A==="linear"?Fe({count:k,gap:3,height:24,max:u,min:p,value:e.value,width:520}):null;return a(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:C("div",{"aria-label":`${e.title} gauge chart`,className:`aui-chart aui-chart--gauge aui-chart--gauge-${A}`,"data-slot":"agent-ui-chart",role:"group",children:[A==="arc"?a("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 480 240",children:C("g",{className:"aui-chart-mark","data-slot":"agent-ui-gauge",...S,children:[f?.notches.map(b=>a("path",{className:"aui-gauge__notch",d:b.path,"data-active":b.active,fill:b.active?v:"var(--surface-secondary)"},b.index)),a("text",{className:"aui-gauge__value",textAnchor:"middle",x:"240",y:"126",children:c}),a("text",{className:"aui-gauge__label",textAnchor:"middle",x:"240",y:"150",children:e.label}),a("text",{className:"aui-gauge__bound",textAnchor:"end",x:"154",y:"220",children:_(p,e.format)}),a("text",{className:"aui-gauge__bound",textAnchor:"start",x:"326",y:"220",children:_(u,e.format)})]})}):a("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 560 130",children:C("g",{className:"aui-chart-mark","data-slot":"agent-ui-gauge",...S,children:[a("text",{className:"aui-gauge__label",x:"20",y:"24",children:e.label}),a("text",{className:"aui-gauge__value",textAnchor:"end",x:"540",y:"24",children:c}),M?.notches.map(b=>a("rect",{className:"aui-gauge__notch","data-active":b.active,fill:b.active?v:"var(--surface-secondary)",height:b.height,rx:Math.min(3,b.width/2),width:b.width,x:20+b.x,y:44+b.y},b.index)),a("text",{className:"aui-gauge__bound",x:"20",y:"96",children:_(p,e.format)}),a("text",{className:"aui-gauge__bound",textAnchor:"end",x:"540",y:"96",children:_(u,e.format)})]})}),a(ve,{state:d})]})})}function $e(t){return t.children?.length?t.children.reduce((e,r)=>e+$e(r),0):t.value??0}function $a({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),[m,o]=X(null),[d,u]=X(null),p=d??m,k=360,v=250,c=Ye(e.data,{centerX:k/2,centerY:v/2,gapAngle:1.1,innerRadius:34,maxDepth:4,outerRadius:112}),y=new Map,A=new Map,$=0,w=(b,I=!1)=>{y.set(b.id,b),I||(A.set(b.id,L(b.color,$)),$+=1),b.children?.forEach(F=>w(F))};w(e.data,!0);let S=$e(e.data),f=Math.min(h,Math.max(0,c.length-1)),M=(e.data.children??[]).map(b=>({color:A.get(b.id)??L(b.color,0),id:b.id,label:b.label,value:_($e(b),e.format)}));return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[C("div",{"aria-label":`${e.title} sunburst chart`,className:"aui-chart aui-chart--sunburst","data-slot":"agent-ui-chart",role:"group",children:[C("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${k} ${v}`,children:[c.map((b,I)=>{let F=A.get(b.id)??L(void 0,b.depth),V=b.path.map(R=>y.get(R)?.label??R),x=(b.startAngle+b.endAngle)/2*(Math.PI/180),K=(b.innerRadius+b.outerRadius)/2,G={items:[{color:F,id:"value",label:"Value",value:_(b.value,e.format)},{color:F,id:"share",label:"Share of total",value:_(S>0?b.value/S:0,{maximumFractionDigits:1,style:"percent"})}],label:V.join(" / ")},P={x:k/2+Math.cos(x)*K,y:v/2+Math.sin(x)*K},B={depth:b.depth,id:b.id,label:b.label,path:V.join(" / "),value:b.value};return a("g",{"aria-label":`${V.join(", ")}: ${_(b.value,e.format)}`,className:"aui-chart-mark","data-slot":"agent-ui-sunburst-segment",role:n?"button":"img",tabIndex:I===f?0:-1,onBlur:()=>o(null),onPointerLeave:()=>u(null),onClick:n?()=>n(W(e,B)):void 0,onFocus:R=>{g(I),o(re(R,P,G))},onKeyDown:R=>{let E=ye(R.key,I,c.length);if(E!==null){R.preventDefault(),g(E),pe(R,"agent-ui-sunburst-segment",E);return}n&&(R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),n(W(e,B))))},onPointerEnter:R=>{u(re(R,P,G))},children:a("path",{className:"aui-sunburst__arc",d:b.d,fill:F})},b.id)}),a("text",{className:"aui-sunburst__total",textAnchor:"middle",x:k/2,y:v/2-2,children:_(S,e.format)}),a("text",{className:"aui-sunburst__root",textAnchor:"middle",x:k/2,y:v/2+16,children:e.data.label})]}),a(ve,{state:p})]}),M.length?a(Q,{ariaLabel:"Top-level categories",items:M}):null]})}function Ht({height:t,index:e,payload:r,width:i,x:n,y:s}){return C("g",{children:[a("rect",{className:"aui-sankey__node",fill:Ne(e),height:t,rx:4,width:i,x:n,y:s}),a("text",{className:"aui-sankey__label",dominantBaseline:"middle",x:n+i+7,y:s+t/2,children:r.name})]})}function Yt({chartId:t,index:e,linkWidth:r,payload:i,sourceControlX:n,sourceX:s,sourceY:h,targetControlX:g,targetX:m,targetY:o}){let d=Math.max(1,r)/2,u=`M${s},${h-d} C${n},${h-d} ${g},${o-d} ${m},${o-d} L${m},${o+d} C${g},${o+d} ${n},${h+d} ${s},${h+d} Z`;return C("g",{children:[C("defs",{children:[C("linearGradient",{id:`${t}-link-${e}`,x1:"0",x2:"1",children:[a("stop",{offset:"0%",stopColor:"var(--chart-3, var(--accent))",stopOpacity:.2}),a("stop",{offset:"50%",stopColor:"var(--chart-4, oklch(from var(--accent) calc(l + 0.12) c h))",stopOpacity:.55}),a("stop",{offset:"100%",stopColor:"var(--chart-1, oklch(from var(--accent) calc(l - 0.24) c h))",stopOpacity:.25})]}),a("filter",{height:"180%",id:`${t}-glow-${e}`,width:"180%",x:"-40%",y:"-40%",children:a("feGaussianBlur",{stdDeviation:"2.5"})})]}),a("path",{d:u,fill:`url(#${t}-link-${e})`,filter:`url(#${t}-glow-${e})`,opacity:.35}),a("path",{d:u,fill:`url(#${t}-link-${e})`,opacity:.8}),a("title",{children:`${i.source.name} \u2192 ${i.target.name}: ${i.value}`})]})}function Ma({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let h=qe().replaceAll(":",""),g=new Map(e.nodes.map((o,d)=>[o.id,d])),m={links:e.links.flatMap(o=>{let d=g.get(o.source),u=g.get(o.target);return d===void 0||u===void 0?[]:[{source:d,target:u,value:o.value}]}),nodes:e.nodes.map(o=>({name:o.label}))};return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} sankey chart`,className:"aui-chart aui-chart--sankey aui-sankey","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:260,width:"100%",children:a(Vt,{data:m,link:o=>a(Yt,{...o,chartId:h}),linkCurvature:.55,margin:{bottom:12,left:8,right:92,top:12},node:o=>a(Ht,{...o}),nodePadding:18,nodeWidth:12,onClick:(o,d)=>n?.(W(e,{element:d,index:o.index,value:"payload"in o?o.payload.value:void 0})),children:a(ue,{content:a(de,{series:[{dataKey:"value",format:e.format}]}),isAnimationActive:!1})})})}),a("div",{"aria-label":"Chart encoding",className:"aui-legend","data-slot":"agent-ui-chart-legend",role:"list",children:C("span",{className:"aui-legend__item","data-slot":"agent-ui-chart-legend-item",role:"listitem",children:[a("span",{className:"aui-legend__flow"}),a("span",{className:"aui-legend__label",children:"Flow volume"})]})})]})}export{ya as AreaChartComponentContent,pa as BarChartComponentContent,wa as CandlestickChartComponentContent,va as ComposedChartComponentContent,xa as DonutChartComponentContent,_a as FunnelChartComponentContent,Ra as GaugeChartComponentContent,ka as HeatmapComponentContent,fa as LineChartComponentContent,Ca as PieChartComponentContent,Aa as RadarChartComponentContent,Na as RadialChartComponentContent,Ma as SankeyChartComponentContent,Sa as ScatterChartComponentContent,$a as SunburstChartComponentContent};
@@ -1,2 +0,0 @@
1
- import{b as de,e as ue,f as me}from"./chunk-4JEZZR5J.js";var St="1.0.0-beta.1",pe="https://api.heroui.pro";import{jsx as Ge,jsxs as ze}from"react/jsx-runtime";function Mt({indicator:e,label:t="Loading agent\u2026"}){return ze("div",{"aria-live":"polite",className:"ha-agent-loading",role:"status",children:[e,Ge("span",{children:t})]})}import{jsx as ge,jsxs as Ke}from"react/jsx-runtime";function K({children:e,shortcut:t}){return Ke("span",{"aria-hidden":"true",className:"ha-control-tooltip",children:[ge("span",{children:e}),t?ge("kbd",{className:"ha-control-tooltip__shortcut",children:t}):null]})}import{ChevronsCollapseUpRight as Ye,ChevronsExpandUpRight as qe}from"@gravity-ui/icons";import{useCallback as Ae,useEffect as V,useEffectEvent as je,useLayoutEffect as Ze,useRef as re,useState as $}from"react";function he(e){return`heroui-agent:sidebar-width:${e}`}function ne(e,t){let n=Math.min(720,Math.floor(t*.9)),o=Math.max(n,320);return Math.min(Math.max(Math.round(e),320),o)}function fe(e,t){let n=Number.NaN;try{n=Number(localStorage.getItem(he(e))??Number.NaN)}catch{}return ne(Number.isFinite(n)?n:420,t)}function oe(e,t){try{localStorage.setItem(he(e),String(Math.round(t)))}catch{}}import{jsx as d,jsxs as R}from"react/jsx-runtime";function Je(e,t){return e===!1?!1:e===void 0||e===!0||!(t instanceof Element)?!0:e(t)}function Dt({actionsSlot:e,agentId:t,children:n,defaultExpanded:o=!1,expandable:a=!0,expandedSidebarSlot:b,expandedTitle:w,historySlot:i,keepMounted:c=!1,name:m,onClose:C,onNewConversation:H,open:f,shouldCloseOnInteractOutside:y,showBetaBadge:L=!1,viewMode:p}){let x=re(null),_=re(0),[O,k]=$(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:null),N=je(C),[v,Q]=$(o),F=O!==null,S=O??!1,s=p==="floating",g=!s&&!S,h=S||g&&v,[ee,ce]=$(!1),Le=!S&&a,B=g&&v&&b;return Ze(()=>{let r=window.matchMedia?.("(max-width: 639px)");if(!r)return;let A=()=>k(r.matches);return A(),r.addEventListener?.("change",A),()=>r.removeEventListener?.("change",A)},[]),V(()=>{if(!ee)return;let r=x.current;if(!r)return;let A=()=>ce(!1),E=U=>{let{propertyName:u,target:T}=U;T===r&&(u!=="width"&&u!=="height"||A())},te=window.setTimeout(A,600);return r.addEventListener("transitionend",E),()=>{window.clearTimeout(te),r.removeEventListener("transitionend",E)}},[ee]),V(()=>{if(!f||!F)return;let r=x.current;if(!r)return;let A=document.activeElement instanceof HTMLElement?document.activeElement:null;r.open||(h&&typeof r.showModal=="function"?r.showModal():!h&&typeof r.show=="function"?r.show():r.open=!0);let E;if(h){let u=document.documentElement,T=window.scrollX,I=window.scrollY,W=u.style.overflow,G=document.body.style.overflow,z=document.body.style.position,Fe=document.body.style.top,Be=document.body.style.left,Ue=document.body.style.right,We=document.body.style.width;u.style.overflow="hidden",document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`${-I}px`,document.body.style.left=`${-T}px`,document.body.style.right="0",document.body.style.width="100%",E=()=>{u.style.overflow=W,document.body.style.overflow=G,document.body.style.position=z,document.body.style.top=Fe,document.body.style.left=Be,document.body.style.right=Ue,document.body.style.width=We,window.scrollTo(T,I)}}let te=r.querySelector("button,textarea,input,[tabindex]:not([tabindex='-1'])");r.contains(document.activeElement)||te?.focus();let U=u=>{if(!h&&u.key==="Escape"){if(be(r)){_.current=Date.now(),u.preventDefault(),u.stopPropagation();return}u.preventDefault(),N();return}if(!h||u.key!=="Tab")return;let T=Array.from(r.querySelectorAll("button:not(:disabled),textarea:not(:disabled),input:not(:disabled),[tabindex]:not([tabindex='-1'])"));if(T.length===0)return;let I=T[0],W=T[T.length-1],G=r.getRootNode(),z=G instanceof ShadowRoot?G.activeElement:document.activeElement;u.shiftKey&&z===I?(u.preventDefault(),W.focus()):!u.shiftKey&&z===W&&(u.preventDefault(),I.focus())};return r.addEventListener("keydown",U),()=>{r.removeEventListener("keydown",U),typeof r.close=="function"?r.close():r.open=!1,E?.(),document.activeElement===document.body&&A?.focus()}},[h,f,F]),V(()=>{if(!f||!s||h)return;let r=x.current;if(!r)return;let A=E=>{E.composedPath().includes(r)||Je(y,E.target)&&N()};return document.addEventListener("click",A,!0),()=>document.removeEventListener("click",A,!0)},[h,s,f,y]),!f&&!c?null:R("dialog",{ref:x,"aria-label":m,"aria-modal":h,className:"ha-panel","data-agent-overlay-root":"","data-expanded":!S&&v?"true":void 0,"data-expanded-sidebar":B?"true":void 0,"data-resizing":ee?"true":void 0,hidden:!f,onCancel:r=>{if(r.preventDefault(),Date.now()-_.current<350||be(x.current)){_.current=Date.now();return}C()},children:[g&&!v?d(Qe,{agentId:t,panelRef:x}):null,B?d("aside",{"aria-label":"Chat history",className:"ha-expanded-sidebar",children:b}):null,R("div",{className:"ha-panel-main",children:[R("header",{className:"ha-header",children:[R("div",{className:"ha-header-title",children:[B?d("span",{className:"ha-session-title ha-expanded-chat-title",children:w??m}):i??d("strong",{children:m}),L?d("span",{className:"ha-beta-badge",children:"Beta"}):null]}),R("div",{className:"ha-header-actions",children:[B?null:e??(H?d("button",{"aria-label":"New chat",className:"ha-icon-button ha-new-chat-button",type:"button",onClick:H,children:d(tt,{})}):null),Le?d("button",{"aria-expanded":v,"aria-label":v?"Collapse assistant":"Expand assistant",className:"ha-expand-button ha-icon-button",type:"button",onClick:()=>{ce(!0),Q(r=>!r)},children:v?d(Ye,{"aria-hidden":"true"}):d(qe,{"aria-hidden":"true"})}):null,R("button",{"aria-keyshortcuts":"Escape","aria-label":"Close assistant",className:"ha-close-button ha-icon-button","data-shortcut":"ESC","data-tooltip":"Close assistant",type:"button",onClick:C,children:[d(et,{}),d(K,{shortcut:"ESC",children:"Close assistant"})]})]})]}),n,d("div",{className:"ha-overlay-portal","data-agent-overlay-portal":""})]})]})}function be(e){let t=e?.querySelector(['[data-slot$="-popover"]','[data-slot="agent-ui-image-modal"]','[data-slot="modal-dialog"]',".ha-feedback-popover"].join(","));return t?(t.querySelector('button[aria-label="Dismiss"]')?.click(),!0):!1}function Qe({agentId:e,panelRef:t}){let[n,o]=$(420),a=re(null),b=Ae(i=>{let c=t.current,m=c?.getRootNode();(m instanceof ShadowRoot?m.host:c?.closest("[data-heroui-agent]"))?.style.setProperty("--ha-sidebar-width",`${i}px`),window.innerWidth>=640&&(document.documentElement.style.marginRight=`${Math.min(i,window.innerWidth)}px`),o(i)},[t]);V(()=>{o(fe(e,window.innerWidth))},[e]);let w=Ae((i,c)=>{let m=ne(i,window.innerWidth);return b(m),c&&oe(e,m),m},[b,e]);return d("div",{"aria-label":"Resize assistant panel","aria-orientation":"vertical","aria-valuemax":720,"aria-valuemin":320,"aria-valuenow":n,className:"ha-resize-handle",role:"separator",tabIndex:0,onKeyDown:i=>{let c=i.key==="ArrowLeft"?24:i.key==="ArrowRight"?-24:0;c!==0&&(i.preventDefault(),w(n+c,!0))},onPointerCancel:i=>{let c=a.current;c&&(a.current=null,delete i.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,document.documentElement.style.transition=c.pageTransition,w(c.startWidth,!1))},onPointerDown:i=>{i.button!==0&&i.pointerType==="mouse"||(i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),i.currentTarget.dataset.resizing="true",a.current={currentWidth:n,pageTransition:document.documentElement.style.transition,startWidth:n,startX:i.clientX},document.documentElement.style.transition="none",t.current&&(t.current.dataset.dragResizing="true"))},onPointerMove:i=>{let c=a.current;c&&(c.currentWidth=w(c.startWidth+(c.startX-i.clientX),!1))},onPointerUp:i=>{let c=a.current;c&&(a.current=null,delete i.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,i.currentTarget.releasePointerCapture(i.pointerId),document.documentElement.style.transition=c.pageTransition,oe(e,c.currentWidth))}})}function et(){return d("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:d("path",{d:"m4.25 4.25 9.5 9.5m0-9.5-9.5 9.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.6"})})}function tt(){return d("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:d("path",{d:"M9 4v10M4 9h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.6"})})}function ye(e,{generateConversationTitle:t=!0}={}){let n=performance.now(),o=Date.now(),a=e.trim();return a?{...t?{}:{generateConversationTitle:!1},messageId:crypto.randomUUID(),prompt:a,startedAt:n,startedAtWallClock:o,submitted:!0}:null}var P=new Map,X=new Map,nt=10080*60*1e3,Y=new Map;function ve(e){return`heroui-agent:shell-draft:${e}:composer-draft:v1`}function ae(e,t){try{let n=ve(e);t.trim()?localStorage.setItem(n,JSON.stringify({prompt:t,savedAt:Date.now()})):localStorage.removeItem(n)}catch{}}function ot(e){let t=ve(e);try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&typeof n.prompt=="string"&&n.prompt.trim()&&typeof n.savedAt=="number"&&Date.now()-n.savedAt<=nt)return n.prompt;localStorage.removeItem(t)}catch{}return""}function q(e,t){if(!t.prompt.trim()&&!t.submitted){P.delete(e),ae(e,"");return}P.set(e,t),t.submitted||ae(e,t.prompt)}function ie(e){let t=P.get(e);if(t)return t;let n=ot(e);return n?{prompt:n,submitted:!1}:void 0}function Te(e,t,n){let o=P.get(e);!o?.submitted||o.messageId!==t||o.firstFeedbackPaintedAt!==void 0||P.set(e,{...o,firstFeedbackPaintedAt:n})}function Bt(e){let t=ie(e);return P.delete(e),ae(e,""),t}function D(e,t,n){t?Y.set(e,[n?.selectionStart??0,n?.selectionEnd??0,n?.selectionDirection??"none"]):Y.delete(e)}function we(e,t){let n=Y.get(e);if(!n||!t)return;t.focus({preventScroll:!0});let o=Math.min(n[0],t.value.length),a=Math.min(n[1],t.value.length);t.setSelectionRange(o,a,n[2]),Y.set(e,[o,a,n[2]])}function xe(e,t){return t instanceof Node?e.contains(t)||e.closest(".ha-composer-wrap")?.querySelector(".ha-footnote")?.contains(t)===!0||e.closest(".ha-root")?.querySelector(".ha-overlay-portal")?.contains(t)===!0:!1}function Ut(e,t){t.length===0?X.delete(e):X.set(e,t)}function rt(e){return X.get(e)??[]}function Wt(e){let t=rt(e);return X.delete(e),t}function Se(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function at(e){let t=getComputedStyle(e),n=Number.parseFloat(t.lineHeight);if(Number.isFinite(n)&&n>0)return n;let o=Number.parseFloat(t.fontSize);return Number.isFinite(o)&&o>0?o*1.2:20}function it(e){let t=getComputedStyle(e);return Se(t.paddingTop)+Se(t.paddingBottom)}function st(e){let t=e.style.height,n=e.style.minHeight,o=e.style.maxHeight;e.style.height="0px",e.style.minHeight="0px",e.style.maxHeight="none";let a=e.scrollHeight;return e.style.height=t,e.style.minHeight=n,e.style.maxHeight=o,a}function lt(e){if(e.value.includes(`
2
- `))return!0;if(e.clientWidth===0)return!1;let t=st(e),n=it(e),o=at(e);return Math.max(0,t-n)>o*1.5}function se(e,{hasAttachments:t=!1,maxHeight:n=120}={}){if(!e)return!1;let o=e.value.length>0;return t||o&&lt(e)?(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,n)}px`,!0):(e.style.height="auto",!1)}import{jsx as le,jsxs as Ee}from"react/jsx-runtime";var ct="https://heroui.pro/?utm_source=heroui-agent&utm_medium=referral&utm_campaign=powered-by-hero";function Me(){return Ee("a",{"aria-label":"Powered by HeroUI Pro (opens in a new tab)",className:"ha-powered-by",href:ct,rel:"noopener noreferrer",target:"_blank",children:[le("span",{children:"Powered by"}),Ee("svg",{"aria-hidden":"true",className:"ha-powered-by-logo",fill:"none",viewBox:"0 0 140 44",children:[le("path",{d:"M.678 11.385V24.04c0 .599.307 1.155.813 1.471l8.628 5.396c1.15.719 2.639-.11 2.639-1.47V18.798c0-.612.322-1.18.847-1.491l5.263-3.13v27.267c0 1.355 1.48 2.186 2.63 1.476l8.905-5.497a1.72 1.72 0 0 0 .822-1.476V9.765c0-1.349-1.467-2.18-2.618-1.484l-9.74 5.897V2.556c0-1.345-1.46-2.177-2.61-1.488L1.52 9.897a1.72 1.72 0 0 0-.842 1.488Z",fill:"currentColor"}),le("path",{d:"M63.876 24.071c0-3.59-1.468-5.246-4.405-5.246-3.363 0-5.732 2.255-5.732 7.316v11.595h-6.063V5.528h6.063v11.779c1.468-2.393 3.884-3.59 7.2-3.59 5.637 0 8.953 3.451 8.953 9.25v14.769h-6.016V24.071ZM84.9 38.473c-7.533 0-12.317-4.877-12.317-12.378 0-7.408 4.737-12.378 12.317-12.378 8.195 0 12.648 5.798 11.416 13.942H78.647c.331 3.865 2.605 6.075 6.253 6.075 2.984 0 4.784-1.52 5.258-3.037h6.016c-.947 4.509-5.115 7.776-11.274 7.776ZM78.789 23.657h11.653c-.047-3.175-2.132-5.338-5.685-5.338-3.174 0-5.4 1.84-5.968 5.338ZM99.623 20.344c0-3.82 2.131-5.89 6.205-5.89h7.77v4.97h-7.912v18.312h-6.063V20.344ZM126.863 38.473c-7.674 0-12.553-4.924-12.553-12.378 0-7.454 4.879-12.378 12.553-12.378 7.58 0 12.459 4.924 12.459 12.378 0 7.454-4.88 12.378-12.46 12.378Zm0-5.016c3.79 0 6.3-2.898 6.3-7.362 0-4.463-2.51-7.408-6.3-7.408-3.838 0-6.348 2.945-6.348 7.408 0 4.464 2.51 7.362 6.348 7.362Z",fill:"currentColor"})]})]})}var Ce=new Set(["ask","auto","full"]);function j(e){return Ce.has(e)?e:"auto"}function $t(e,t){return`${e}:permission-mode:${t}:v1`}function Xt(e,t){return`${e}:active-permission-mode:${t}:v1`}function Yt(e){try{let t=localStorage.getItem(e);return t!==null&&Ce.has(t)?j(t):void 0}catch{return}}function qt(e,t){try{localStorage.setItem(e,t)}catch{}}function jt(e){try{localStorage.removeItem(e)}catch{}}function Zt(e,t){let n=j(t);if(n==="auto")return e;let o=n==="ask";return e.map(a=>!!a.needsApproval===o?a:{...a,needsApproval:o})}function ke(e){return`heroui-agent:anonymous:${e}`}function dt(e){return e instanceof Error?e:new Error("Auth token request failed")}var Ne=class{constructor(t,n){this.agentId=t;this.getAuthToken=n}cached=null;failure=null;generation=0;pending=null;clear(){this.generation+=1,this.cached=null,this.failure=null,this.pending=null}reset(){this.clear();try{localStorage.removeItem(ke(this.agentId))}catch{}}async get(){if(this.cached&&this.expiresAt(this.cached)>Date.now()+6e4)return this.cached.token;if(!this.pending&&this.failure&&Date.now()<this.failure.retryAt)throw this.failure.error;let t=this.generation,n=this.pending??this.refresh();this.pending||(this.pending=n);try{let o=await n;return t!==this.generation?this.get():(this.cached=o,this.failure=null,o.token)}catch(o){throw t===this.generation&&(this.failure={error:dt(o),retryAt:Date.now()+5e3}),o}finally{this.pending===n&&(this.pending=null)}}async subjectHash(){let t=await this.get(),n=ut(t),o=typeof n.sub=="string"?n.sub:"anonymous",a=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${this.agentId}:${o}`));return Array.from(new Uint8Array(a),b=>b.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=ke(this.agentId);try{let n=localStorage.getItem(t);if(n)return n;let o=crypto.randomUUID();return localStorage.setItem(t,o),o}catch{return crypto.randomUUID()}}expiresAt(t){return t.expiresAt}async refresh(){let t=await this.getAuthToken({agentId:this.agentId,anonymousId:this.anonymousId()});if(!t||typeof t.token!="string"||!t.token.trim()||typeof t.expiresAt!="number"||!Number.isFinite(t.expiresAt)||t.expiresAt<=0)throw new Error("Auth token callback returned invalid data");return{expiresAt:t.expiresAt,token:t.token}}};function ut(e){try{let t=e.split(".")[1];if(!t)return{};let n=t.replace(/-/g,"+").replace(/_/g,"/"),o=n.padEnd(Math.ceil(n.length/4)*4,"=");return JSON.parse(atob(o))}catch{return{}}}var mt={"application/json":"json","application/pdf":"pdf","image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","text/csv":"csv","text/markdown":"md","text/plain":"txt","text/tab-separated-values":"tsv"},Z=Object.freeze(Object.keys(mt)),en=Z.join(","),pt=new Set(Z);function Re(e){return pt.has(e.trim().toLowerCase())}import{useId as gt}from"react";import{jsx as Pe,jsxs as ht}from"react/jsx-runtime";function He({children:e,className:t,...n}){let o=`ha-shimmer-${gt().replaceAll(":","")}`,a={"--_ha-firefox-mask":`-moz-element(#${o})`};return ht("span",{...n,className:`ha-shimmer${t?` ${t}`:""}`,children:[Pe("span",{className:"ha-shimmer__text",id:o,children:e}),Pe("span",{inert:!0,"aria-hidden":"true",className:"ha-shimmer__highlight",style:a,children:e})]})}import{useEffect as ft,useLayoutEffect as _e,useRef as At,useState as J}from"react";import{Fragment as Oe,jsx as l,jsxs as M}from"react/jsx-runtime";function mn({agentId:e,composerConnecting:t=!1,composerControlsAvailable:n,composerControlsRevealed:o,composerEndSlot:a,composerFooterSlot:b,composerStartSlot:w,greeting:i,onComposerControlsReveal:c,onIntent:m,placeholder:C,suggestedPrompts:H}){let[f]=J(()=>ie(e)),[y,L]=J(()=>f?.submitted?"":f?.prompt??""),[p,x]=J(()=>f?.submitted?f:null),[_,O]=J(!1),k=At(null),N=n??!!(w||a),v=o??(N&&_),Q=s=>{D(e,!0,s.currentTarget),O(N),N&&c?.(),m()},F=s=>{let g=s.currentTarget.querySelector(".ha-composer");g&&xe(g,s.relatedTarget)||(O(!1),D(e,!1))};_e(()=>{we(e,k.current),se(k.current)},[e]),ft(()=>{p||q(e,{prompt:y,submitted:!1})},[y,e,p]),_e(()=>{if(!p)return;let s=requestAnimationFrame(g=>{Te(e,p.messageId,g)});return()=>cancelAnimationFrame(s)},[e,p]);let S=(s,g=!0)=>{if(p)return;let h=ye(s,{generateConversationTitle:g});h&&(x(h),L(""),k.current.style.height="auto",q(e,h),m())};return M(Oe,{children:[l("div",{className:"ha-conversation",children:l("div",{"aria-live":"polite",className:"ha-messages",role:"log",children:p?M(Oe,{children:[l("div",{className:"ha-message","data-role":"user",children:l("div",{className:"ha-bubble",children:l("div",{className:"ha-message-content",children:l("p",{className:"ha-message-text",children:p.prompt})})})}),l("div",{className:"ha-message","data-role":"assistant","data-stream-anchor":"true","data-turn-feedback-id":p.messageId,children:l("div",{className:"ha-message-body",children:l("div",{"aria-label":"Working on your request\u2026",className:"ha-progress ha-activity-status ha-progress-shimmer",role:"status",children:l(He,{"aria-hidden":"true",children:"Thinking\u2026"})})})})]}):M("div",{className:"ha-empty",children:[l("h2",{children:i}),l("p",{children:"Live answers with charts, metrics, and tables."})]})})}),M("form",{className:"ha-composer-wrap",onBlur:F,onSubmit:s=>{s.preventDefault(),S(y)},children:[!p&&H.length>0?l("div",{"aria-label":"Suggested prompts",className:"ha-suggestions",role:"group",children:H.map(s=>M("button",{className:"ha-suggestion",type:"button",onClick:()=>S(s,!1),children:[l("span",{children:s}),l(yt,{})]},s))}):null,M("div",{className:"@container ha-composer","data-connecting":t||void 0,"data-controls-revealed":v||void 0,children:[w,l("textarea",{ref:k,"aria-label":"Message the assistant",placeholder:C,readOnly:!!p,rows:1,value:y,onFocus:Q,onSelect:s=>D(e,!0,s.currentTarget),onChange:s=>{let g=s.currentTarget.value;q(e,{prompt:g,submitted:!1}),D(e,!0,s.currentTarget),L(g),se(s.currentTarget),m()},onKeyDown:s=>{s.key!=="Enter"||s.shiftKey||(s.preventDefault(),S(y))}}),a,M("button",{"aria-label":"Send message",className:"ha-send",disabled:!y.trim()||!!p,type:"submit",children:[l(bt,{}),l(K,{shortcut:"\u21B5",children:"Send message"})]})]}),l("div",{className:"ha-composer-footer","data-revealed":!!b||void 0,children:l("div",{className:"ha-composer-footer-content",children:b})}),l(Me,{})]})]})}function bt(){return l("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:l("path",{d:"M9 14.5V3.5m0 0L4.5 8M9 3.5 13.5 8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function yt(){return l("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",children:l("path",{d:"M5 11 11 5m0 0H6m5 0v5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}var vt={animation:"fadeIn",duration:160,easing:"ease-out",sep:"word",stagger:18};function Ie(e){return typeof e=="number"?Number.isFinite(e)?`${Math.round(e)}px`:void 0:e?.trim()||void 0}function Tt(e){let t=Ie(e?.initialWidth),n=Ie(e?.initialHeight);return{...t?{"--ha-panel-width":t}:{},...n?{"--ha-panel-height":n}:{}}}function De(e){return e===void 0||!Number.isFinite(e)?24:Math.min(Math.max(Math.round(e),0),200)}function wt(e){if(!(e===void 0||!Number.isFinite(e)))return Math.min(Math.max(Math.round(e),0),2147483647)}function xt(e){if(e===void 0)return[...Z];if(e===!1||!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!="string")continue;let o=n.trim().toLowerCase();Re(o)&&t.add(o)}return[...t]}function yn(e){if(typeof e.agentId!="string"||!e.agentId.trim())throw new Error("HeroUI Agent agentId is required");if(typeof e.getAuthToken!="function")throw new Error("HeroUI Agent getAuthToken is required");let t=xt(e.composer?.attachments),n=typeof e.composer?.disclaimer=="string"&&e.composer.disclaimer.trim().slice(0,240)||void 0,o=wt(e.appearance?.zIndex);return{apiBaseUrl:(e._api?.baseUrl??pe).replace(/\/$/,""),colorScheme:e.appearance?.theme?.colorScheme??"system",componentExportFormats:e.componentExports===!1?[]:e.componentExports??["csv","svg","png"],composerAttachmentAccept:t.join(","),composerAttachmentContentTypes:t,composerControlsAvailable:t.length>0||e.permissions?.showPicker===!0&&!!e.tools?.length||e.composer?.modelPicker===!0||(e.composer?.dictation??!0),composerDefaultModel:e.composer?.defaultModel,composerDictation:e.composer?.dictation??!0,designTheme:de(e.appearance?.theme?.designTheme),...n?{composerDisclaimer:n}:{},agentId:e.agentId,...e.appearance?.shouldCloseOnInteractOutside!==void 0?{shouldCloseOnInteractOutside:e.appearance.shouldCloseOnInteractOutside}:{},composerModelPicker:e.composer?.modelPicker??!1,composerPlaceholder:e.composer?.placeholder?.trim().slice(0,120)||"Ask anything\u2026",context:e.context,getAuthToken:e.getAuthToken,greeting:e.startScreen?.greeting?.trim().slice(0,120)||"Ask about your data",launcherPosition:e.appearance?.launcher?.position??"bottom-right",markdownAnimation:e.markdown?.animated??vt,markdownCaret:e.markdown?.caret??"block",markdownPlugins:e.markdown?.plugins,messageActions:e.responseActions===!1?[]:e.responseActions??["copy","feedback","retry"],onFeedback:e.onFeedback,panelExpandable:e.appearance?.panel?.expandable??!0,panelExpanded:e.appearance?.panel?.expanded??!1,panelStyle:Tt(e.appearance?.panel),permissionDefaultMode:j(e.permissions?.defaultMode),permissionShowPicker:e.permissions?.showPicker===!0,preload:e.preload??!0,reopenOnRefresh:e.reopenOnRefresh??!1,showBetaBadge:e.showBetaBadge??!1,showLauncher:e.showLauncher??!0,startNewConversationOnOpen:e.startNewConversationOnOpen??!1,suggestedPromptShortcuts:e.startScreen?.promptShortcuts??!1,...e.appearance?.launcher?.icon?.trim()?{launcherIcon:e.appearance.launcher.icon.trim()}:{},...e.appearance?.launcher?.style?{launcherStyle:e.appearance.launcher.style}:{},...e.appearance?.launcher?.offset?{launcherOffset:{x:De(e.appearance.launcher.offset.x),y:De(e.appearance.launcher.offset.y)}}:{},imageSearch:(e.capabilities?.webSearch??!1)&&(e.capabilities?.imageSearch??!0),newsSearch:(e.capabilities?.webSearch??!1)&&(e.capabilities?.newsSearch??!1),suggestedPrompts:e.startScreen?.prompts?.map(a=>a.trim()).filter(Boolean).slice(0,5),themeStyle:{...me(e.appearance?.theme),...ue(e.appearance?.launcher?.background)},tools:e.tools??[],viewMode:e.appearance?.viewMode??"floating",webSearch:e.capabilities?.webSearch??!1,...o!==void 0?{zIndex:o}:{}}}export{Ne as a,St as b,pe as c,Mt as d,K as e,fe as f,Dt as g,mt as h,Z as i,Re as j,ye as k,q as l,ie as m,Bt as n,D as o,we as p,xe as q,Ut as r,rt as s,Wt as t,se as u,Me as v,He as w,mn as x,$t as y,Xt as z,Yt as A,qt as B,jt as C,Zt as D,vt as E,yn as F};
@@ -1 +0,0 @@
1
- import{a as c}from"./chunk-CR3H7AVI.js";import{createContext as N,useContext as g}from"react";import{jsx as e,jsxs as i}from"react/jsx-runtime";var u=N(void 0);function v({children:a,variant:t}){return e(u,{value:t,children:a})}function h({actions:a,children:t,className:r,"data-component-kind":p,description:n,footer:o,legend:l,title:d,variant:m}){let C=g(u),s=d!=null||n!=null||l!=null||a!=null,f=C??m??"surface";return i("section",{className:c("aui-card",r),"data-component-kind":p,"data-has-footer":o!=null,"data-has-header":s,"data-slot":"agent-ui-card","data-variant":f,children:[s?i("header",{className:"aui-card__header","data-has-actions":a!=null,"data-slot":"agent-ui-card-header",children:[i("span",{className:"aui-card__heading","data-slot":"agent-ui-card-heading",children:[d!=null?e("span",{className:"aui-card__title","data-slot":"agent-ui-card-title",children:d}):null,n!=null?e("span",{className:"aui-card__description","data-slot":"agent-ui-card-description",children:n}):null]}),a!=null?e("span",{className:"aui-card__actions","data-slot":"agent-ui-card-actions",children:a}):null,l]}):null,e("div",{className:"aui-card__content","data-slot":"agent-ui-card-content",children:t}),o!=null?e("footer",{className:"aui-card__footer","data-slot":"agent-ui-card-footer",children:o}):null]})}function k(a){if(!a)return;let t=a.closest("[data-agent-overlay-root], dialog");if(t)return t.querySelector("[data-agent-overlay-portal]")??t;let r=a.getRootNode();return typeof ShadowRoot<"u"&&r instanceof ShadowRoot?r:void 0}export{v as a,h as b,k as c};
@@ -1,2 +0,0 @@
1
- import{F as rn,a as ze,c as qe,d as je,f as fe,g as Ke,j as Je,k as Ze,l as en,o as me,q as nn,r as tn,x as on}from"./chunk-5RHO3S5E.js";import{a as Xe}from"./chunk-6ZJJN322.js";import{d as Ye,e as Qe}from"./chunk-UHHKMESI.js";import{useCallback as b,useEffect as C,useEffectEvent as yt,useLayoutEffect as kn,useMemo as Ce,useRef as E,useState as p,useSyncExternalStore as Tn}from"react";import{createRoot as wt}from"react-dom/client";import{SparklesFill as Jn}from"@gravity-ui/icons";import{jsx as Xn}from"react/jsx-runtime";function sn(e){return Xn(Jn,{...e})}import{jsx as pe}from"react/jsx-runtime";function Yn(e){return/\.svg(?:[?#]|$)/i.test(e)||/^data:image\/svg\+xml[;,]/i.test(e)}function an(e){return`url("${e.replace(/["\\\n\r]/g,encodeURIComponent)}")`}function cn({icon:e}){return e?Yn(e)?pe("span",{"aria-hidden":"true",className:"ha-launcher__icon ha-launcher__icon--tinted",style:{WebkitMaskImage:an(e),maskImage:an(e)}}):pe("img",{alt:"",className:"ha-launcher__icon",src:e}):pe(sn,{})}function ln(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function un(e,n){if(n===void 0)return e;if(!ln(e)||!ln(n))return n;let t={...e};for(let[r,a]of Object.entries(n))a!==void 0&&(t[r]=r in e?un(e[r],a):a);return t}function dn(e,n){if(!e)return n;let t={appearance:e.appearance,capabilities:e.capabilities,composer:e.composer,markdown:e.markdown,permissions:e.permissions,responseActions:e.responseActions,showBetaBadge:e.showBetaBadge,startScreen:e.startScreen},r=un(t,{appearance:n.appearance,capabilities:n.capabilities,composer:n.composer,markdown:n.markdown?{...n.markdown,plugins:void 0}:void 0,permissions:n.permissions,responseActions:n.responseActions,showBetaBadge:n.showBetaBadge,startScreen:n.startScreen});return{...n,...r}}function fn(e){return!!e.appearance?.theme?.typography?.fontFamily?.trim()}var mn=1,c=Symbol("invalid");function G(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function k(e){if(e!==void 0)return typeof e=="string"?e:c}function S(e){if(e!==void 0)return typeof e=="boolean"?e:c}function ge(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)?e:c}function M(e){return n=>{if(n!==void 0)return typeof n=="string"&&e.includes(n)?n:c}}function pn(e){if(e===void 0)return;if(typeof e=="string")return e;if(!G(e))return c;let n=k(e.dark),t=k(e.light);return n===c||t===c?c:{...n===void 0?{}:{dark:n},...t===void 0?{}:{light:t}}}function Qn(e){if(e===void 0)return;if(!G(e))return c;let n={};for(let[t,r]of Object.entries(e)){if(typeof r!="string")return c;n[t]=r}return n}function Zn(e){if(e!==void 0)return!Array.isArray(e)||e.some(n=>typeof n!="string")?c:e}function w(e,n){if(e===void 0||!G(e))return c;let t={};for(let[r,a]of Object.entries(n)){let l=a(e[r]);if(l===c)return c;l!==void 0&&(t[r]=l)}return t}function v(e){return e===c?void 0:e}var et=["accent","background","foreground","overlay","surface","surfaceSecondary","tooltip"];function nt(e){return w(e,{launcher:n=>n===void 0?void 0:w(n,{background:pn,icon:k,position:M(["bottom-left","bottom-right"]),style:Qn}),panel:n=>n===void 0?void 0:w(n,{expandable:S,expanded:S,initialHeight:t=>t===void 0||typeof t=="string"?t:ge(t),initialWidth:t=>t===void 0||typeof t=="string"?t:ge(t)}),theme:n=>n===void 0?void 0:w(n,{colorScheme:M(["dark","light","system"]),colors:t=>t===void 0?void 0:w(t,Object.fromEntries(et.map(r=>[r,pn]))),designTheme:M(["base","brutalism","glass","mouve"]),radius:M(["pill","round","sharp","soft"]),typography:t=>t===void 0?void 0:w(t,{baseSize:ge,fontFamily:k})}),viewMode:M(["floating","sidebar"])})}function tt(e){return w(e,{attachments:n=>{if(n===void 0||n===!1)return n;if(!Array.isArray(n))return c;let t=n.filter(r=>typeof r=="string"&&Je(r));return t.length===n.length?t:c},defaultModel:k,dictation:S,disclaimer:n=>n===!1?!1:k(n),modelPicker:S,placeholder:k})}function ot(e){return w(e,{animated:n=>{if(n===void 0||n===!1)return n;if(!G(n))return c;let t=M(["blurIn","fadeIn","slideUp"])(n.animation);return t===c||t===void 0?c:{...n,animation:t}},caret:n=>n===!1?!1:M(["block","circle"])(n)})}function rt(e){if(e===void 0||e===!1)return e;if(!Array.isArray(e))return c;let n=["copy","feedback","retry"],t=e.filter(r=>typeof r=="string"&&n.includes(r));return t.length===e.length?t:c}function Z(e){if(!G(e)||e.version!==mn)return null;let n=e.revision;if(typeof n!="string"||!n)return null;let t=v(nt(e.appearance)),r=v(w(e.capabilities,{imageSearch:S,newsSearch:S,webSearch:S})),a=v(tt(e.composer)),l=v(ot(e.markdown)),f=v(w(e.permissions,{defaultMode:M(["ask","auto","full"]),showPicker:S})),u=v(rt(e.responseActions)),m=v(S(e.showBetaBadge)),I=v(w(e.startScreen,{greeting:k,promptShortcuts:S,prompts:Zn})),h=v(w(e.webfont,{familyName:N=>typeof N=="string"&&N?N:c,fontFaceUrl:k,stylesheetUrl:k}));return{...t?{appearance:t}:{},...r?{capabilities:r}:{},...a?{composer:a}:{},...l?{markdown:l}:{},...f?{permissions:f}:{},...u===void 0?{}:{responseActions:u},...m===void 0?{}:{showBetaBadge:m},...I?{startScreen:I}:{},...h?{webfont:h}:{},revision:n,version:mn}}function he(e){return`heroui-agent:config:${e}`}var gn=1;function hn(e){try{let n=window.localStorage.getItem(he(e));if(!n)return null;let t=JSON.parse(n);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let a=t;if(a.cacheVersion===gn&&typeof a.cachedAt=="number"&&Number.isFinite(a.cachedAt)){let l=Z(a.config);return l?{cachedAt:a.cachedAt,config:l,legacy:!1}:null}}let r=Z(t);return r?{cachedAt:0,config:r,legacy:!0}:null}catch{return null}}function ye(e,n,t=Date.now()){try{let r={cacheVersion:gn,cachedAt:t,config:n};window.localStorage.setItem(he(e),JSON.stringify(r))}catch{}}function yn(e){try{window.localStorage.removeItem(he(e))}catch{}}async function wn(e,n,t={}){try{let r=await fetch(`${e}/v1/agents/${encodeURIComponent(n)}/appearance`,{headers:t.revision?{"If-None-Match":`"${t.revision}"`}:{},...t.signal?{signal:t.signal}:{}});if(r.status===304)return{status:"not-modified"};if(r.status===404||r.status===410)return{status:"missing"};if(!r.ok)return{status:"unavailable"};let a=Z(await r.json());return a?{config:a,status:"ok"}:{status:"unavailable"}}catch{return{status:"unavailable"}}}import{ChevronDown as st,Microphone as it,Plus as at,ShieldCheck as ct}from"@gravity-ui/icons";import{useEffect as lt,useRef as ut}from"react";import{Fragment as Rn,jsx as g,jsxs as we}from"react/jsx-runtime";var dt={ask:"Ask for approval",auto:"Approve for me",full:"Full access"};function Cn({onFileDialogActiveChange:e,onIntent:n,options:t}){return{end:g(mt,{options:t}),footer:t.composerDisclaimer?g("p",{className:"ha-footnote",children:Xe(t.composerDisclaimer)}):null,start:t.composerAttachmentContentTypes.length>0?g(ft,{accept:t.composerAttachmentAccept,agentId:t.agentId,onFileDialogActiveChange:e,onIntent:n}):null}}function ft({accept:e,agentId:n,onFileDialogActiveChange:t,onIntent:r}){let a=ut(null);return lt(()=>{let l=a.current,f,u=()=>t(!1),m=()=>{f=window.setTimeout(u,0)};return l?.addEventListener("cancel",u),window.addEventListener("focus",m),()=>{l?.removeEventListener("cancel",u),window.removeEventListener("focus",m),window.clearTimeout(f)}},[t]),we(Rn,{children:[g("input",{ref:a,multiple:!0,accept:e,"aria-label":"Choose files to attach",className:"ha-file-input",type:"file",onChange:l=>{tn(n,Array.from(l.currentTarget.files??[])),l.currentTarget.value="",t(!1),r()}}),g("button",{"aria-label":"Attach files",className:"ha-attach",type:"button",onClick:()=>{t(!0),a.current?.click()},children:g(at,{"aria-hidden":"true"})})]})}function mt({options:e}){let n=e.composerDefaultModel??Ye,t=Qe.find(r=>r.id===n)?.label??n;return we(Rn,{children:[e.permissionShowPicker&&e.tools.length>0?g(bn,{icon:g(ct,{"aria-hidden":"true",className:"aui-permission-picker__trigger-icon"}),kind:"permission",label:dt[e.permissionDefaultMode],tone:e.permissionDefaultMode==="full"?"warning":void 0}):null,e.composerModelPicker?g(bn,{kind:"model",label:t}):null,e.composerDictation?g("button",{disabled:!0,"aria-label":"Dictate message",className:"ha-dictation",type:"button",children:g(it,{"aria-hidden":"true"})}):null]})}function bn({icon:e,kind:n,label:t,tone:r}){let a=`aui-${n}-picker`;return g("div",{className:`${a} ha-${n}-picker`,"data-tone":r,children:we("button",{disabled:!0,"aria-label":n==="model"?"AI model":"Tool permissions",className:`${a}__trigger ha-shell-picker-trigger`,type:"button",children:[e,g("span",{className:`${a}__value`,children:t}),g(st,{"aria-hidden":"true",className:`${a}__indicator`})]})})}var pt=[".woff2",".woff",".ttf",".otf",".eot"];function gt(e){return`heroui-agent-font-${e.familyName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}function ht(e){let n=e.includes(":vf@")||e.includes("-wght-")||e.includes("-opsz-");return e.endsWith(".woff")?"woff":e.endsWith(".ttf")?"truetype":e.endsWith(".otf")?"opentype":n?"woff2-variations":"woff2"}function An(e,n){try{let t=new URL(e);if(t.protocol!=="https:")return!1;if(!n)return!0;let r=t.pathname.toLowerCase();return pt.some(a=>r.endsWith(a))}catch{return!1}}function Sn(e){if(!e||typeof document>"u")return()=>{};let n=gt(e);if(document.getElementById(n))return()=>{};if(e.stylesheetUrl&&An(e.stylesheetUrl,!1)){let t=document.createElement("link");return t.id=n,t.rel="stylesheet",t.href=e.stylesheetUrl,document.head.append(t),()=>t.remove()}if(e.fontFaceUrl&&An(e.fontFaceUrl,!0)){let t=document.createElement("style"),r=e.fontFaceUrl.includes(":vf@")||e.fontFaceUrl.includes("-wght-")||e.fontFaceUrl.includes("-opsz-");return t.id=n,t.textContent=["@font-face {",` font-family: '${e.familyName.replaceAll("'","")}';`," font-style: normal;"," font-display: swap;",` font-weight: ${r?"100 900":"400"};`,` src: url(${e.fontFaceUrl}) format('${ht(e.fontFaceUrl)}');`,"}"].join(`
2
- `),document.head.append(t),()=>t.remove()}return()=>{}}import{Fragment as On,jsx as P,jsxs as Nn}from"react/jsx-runtime";var bt=600,Ct=5*6e4,Rt="heroui-agent:open:";function Re(e){return`${Rt}${e}`}function At(e){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Re(e))==="true"}catch{return!1}}function be(e,n){try{n?window.sessionStorage.setItem(Re(e),"true"):window.sessionStorage.removeItem(Re(e))}catch{}}var In;function vn(){return In??=import(/* webpackPrefetch: true */"./embed-runtime-FP77ORXA.js").then(e=>e.default),In}var D=new Map,Ae=new Set;function Mn(e){return e?D.get(e):[...D.values()][D.size-1]}function En(){for(let e of Ae)e()}function St(e){return Ae.add(e),()=>Ae.delete(e)}function kt(e){let n=window.matchMedia?.("(prefers-color-scheme: dark)");return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}function It(){return window.matchMedia?.("(prefers-color-scheme: dark)").matches===!0}function L(e,n,...t){let r=Mn(e);if(!r){console.warn("HeroUI Agent is not mounted yet. Add <HeroUIAgent /> to your layout.");return}let a=r[n];a(...t)}function vt(e,n,t){let[r]=p(()=>!t||typeof window>"u"?null:hn(e)),[a,l]=p(()=>{if(!t)return{config:null,presentationReady:!0};let f=r?Date.now()-r.cachedAt:Number.POSITIVE_INFINITY,u=r!==null&&!r.legacy&&f>=0&&f<=Ct;return{config:u?r.config:null,presentationReady:u}});return C(()=>{if(!t)return;let f=new AbortController,u=!0,m=h=>{l(N=>N.presentationReady?N:{config:h,presentationReady:!0})},I=window.setTimeout(()=>{u&&(f.abort(),m(r?.config??null))},bt);return wn(n,e,{...r?.config.revision?{revision:r.config.revision}:{},signal:f.signal}).then(h=>{if(!(!u||f.signal.aborted)){if(h.status==="ok"){ye(e,h.config),m(h.config);return}if(h.status==="not-modified"){r&&ye(e,r.config),m(r?.config??null);return}if(h.status==="missing"){yn(e),m(null);return}m(r?.config??null)}}).finally(()=>{!u||f.signal.aborted||window.clearTimeout(I)}),()=>{u=!1,f.abort(),window.clearTimeout(I)}},[n,r,t,e]),t?a:{config:null,presentationReady:!0}}function co(e){let n=b(()=>Mn(e)?.ready??!1,[e]),t=Tn(St,n,()=>!1);return Ce(()=>({hide:()=>L(e,"hide"),newConversation:r=>L(e,"newConversation",r),preload:()=>L(e,"preload"),ready:t,refreshAuth:()=>L(e,"refreshAuth"),show:()=>L(e,"show"),shutdown:()=>L(e,"shutdown"),toggle:()=>L(e,"toggle")}),[e,t])}function lo(e){let n=`${e.agentId}\0${e._api?.baseUrl??""}\0${e.remoteConfig!==!1}`;return P(Et,{...e},n)}function Et(e){let{_api:n,agentId:t,appearance:r,capabilities:a,componentExports:l,composer:f,context:u,getAuthToken:m,markdown:I,onFeedback:h,onReady:N,permissions:Pn,preload:_n,remoteConfig:xn=!0,reopenOnRefresh:Se,responseActions:Un,showLauncher:Ln,startNewConversationOnOpen:Fn,startScreen:$n,tools:ke}=e,z=I?.plugins,ee=r?.shouldCloseOnInteractOutside,Hn=(n?.baseUrl??qe).replace(/\/$/,""),{config:Ie,presentationReady:F}=vt(t,Hn,xn),ve=JSON.stringify({_api:n,appearance:r?{...r,shouldCloseOnInteractOutside:void 0}:void 0,capabilities:a,componentExports:l,composer:f,markdown:I?{...I,plugins:void 0}:void 0,permissions:Pn,preload:_n,remote:Ie,reopenOnRefresh:Se,responseActions:Un,showLauncher:Ln,startNewConversationOnOpen:Fn,startScreen:$n}),o=Ce(()=>{let{remote:s,...i}=JSON.parse(ve),d=dn(s,{...i,agentId:t,getAuthToken:m,...ee!==void 0?{appearance:{...i.appearance,shouldCloseOnInteractOutside:ee}}:{}});return rn({...d,context:u,markdown:d.markdown?{...d.markdown,plugins:z}:z?{plugins:z}:void 0,onFeedback:h,tools:ke})},[u,m,z,h,t,ve,ee,ke]),q=Ce(()=>new ze(t,m),[t,m]),Ee=fn(e),Ne=Ie?.webfont;C(()=>{if(!Ee)return Sn(Ne)},[Ee,Ne]);let[j]=p(()=>Se===!0&&At(t)),[ne,V]=p(j),[_,Bn]=p(1),[Oe,Te]=p(1),[Me,Pe]=p(!1),[K,Dn]=p(j||o.startNewConversationOnOpen?null:void 0),[O,Vn]=p(null),[J,Wn]=p(null),[_e,Gn]=p(!1),[te,oe]=p(!1),[zn,xe]=p(null),re=E(1),Ue=E(null),se=E(!1),ie=E(null),Le=E(null),$=E(j),ae=E(null),X=E(null),ce=E([]),qn=Tn(kt,It,()=>!1),le=o.designTheme==="base"?null:`${o.designTheme}-${o.colorScheme==="system"?qn?"dark":"light":o.colorScheme}`,x=F&&zn===_&&J!==null,y=F&&ne,[Y,jn]=p(j||o.preload),R=b(()=>jn(!0),[]),[W,H]=p(!1),[Fe,$e]=p(!1),ue=b(()=>H(!0),[]);C(()=>{if(!W||!O)return;let s=()=>{queueMicrotask(()=>{let i=O.querySelector(".ha-composer:not([hidden] *)");i&&nn(i,document.activeElement)||H(!1)})};return O.addEventListener("focusout",s),()=>O.removeEventListener("focusout",s)},[W,O]),C(()=>{Y&&q.get().catch(()=>{})},[Y,q]),C(()=>{o.reopenOnRefresh?be(o.agentId,ne):be(o.agentId,!1)},[ne,o.agentId,o.reopenOnRefresh]),C(()=>{if(!Y)return;if(!F){vn().catch(()=>{});return}let s=!0;return vn().then(i=>{s&&Wn(()=>i)}).catch(()=>{}),()=>{s=!1}},[F,Y]),C(()=>{if(!y||o.viewMode!=="sidebar"||window.innerWidth<640)return;let s=document.documentElement,i=s.style.marginRight,d=s.style.transition,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=Math.min(fe(o.agentId,window.innerWidth),window.innerWidth);return A||(s.style.transition=[d,"margin-right .28s cubic-bezier(.2,.8,.2,1)"].filter(Boolean).join(", ")),s.style.marginRight=`${de}px`,()=>{s.style.marginRight=i,window.setTimeout(()=>{s.style.transition=d},300)}},[y,o.agentId,o.viewMode]),C(()=>{let s=document.createElement("div"),i=document.createElement("div");s.dataset.herouiAgent=o.agentId,i.className="ha-root",ae.current=s,ie.current=i,X.current=wt(i),s.append(i),document.body.append(s);let d=!0;return queueMicrotask(()=>{d&&Vn(i)}),()=>{d=!1,me(o.agentId,!1);let A=X.current;ie.current=null,ae.current=null,X.current=null,ce.current=[],queueMicrotask(()=>{A?.unmount(),s.remove()})}},[o.agentId]),kn(()=>{let s=ie.current,i=ae.current;if(!s||!i)return;s.className=le?`ha-root ${le}`:"ha-root",s.dataset.theme=o.colorScheme,s.dataset.viewMode=o.viewMode,s.dataset.position=o.launcherPosition,i.dataset.open=y?"true":"false",i.dataset.viewMode=o.viewMode,i.dataset.position=o.launcherPosition,o.zIndex===void 0?i.style.removeProperty("--ha-z-index"):i.style.setProperty("--ha-z-index",String(o.zIndex)),o.launcherOffset?(i.style.setProperty("--ha-launcher-x",`${o.launcherOffset.x}px`),i.style.setProperty("--ha-launcher-y",`${o.launcherOffset.y}px`)):(i.style.removeProperty("--ha-launcher-x"),i.style.removeProperty("--ha-launcher-y")),o.viewMode==="sidebar"&&i.style.setProperty("--ha-sidebar-width",`${fe(o.agentId,window.innerWidth)}px`);let d={...o.themeStyle,...o.panelStyle};for(let A of ce.current)A in d||s.style.removeProperty(A);for(let[A,de]of Object.entries(d))s.style.setProperty(A,de);ce.current=Object.keys(d)},[le,y,o.colorScheme,o.agentId,o.launcherOffset,o.launcherPosition,o.panelStyle,o.themeStyle,o.viewMode,o.zIndex,O]);let T=b(s=>{me(o.agentId,!1),$e(!1),xe(null),Dn(s);let i=re.current+1;re.current=i,Bn(i)},[o.agentId]),He=b(s=>{re.current===s&&(Gn(!0),xe(s))},[]),Kn=yt(()=>N?.());C(()=>{!x||Le.current===_||(Le.current=_,Kn())},[_,x]);let U=b(()=>{$.current=!1,se.current=!0,V(!1),H(!1),T(o.startNewConversationOnOpen?null:void 0)},[o.startNewConversationOnOpen,T]);C(()=>{y||!x||!se.current||(se.current=!1,requestAnimationFrame(()=>Ue.current?.focus()))},[y,x]);let B=b(()=>{$.current=!0,V(!0),R()},[R]),Be=R,Q=b(s=>{let i=s?Ze(s):null;i&&en(o.agentId,i),$.current=!0,V(!0),H(!1),R(),T(null)},[o.agentId,T,R]),De=b(s=>{$.current=!0,V(!0),H(!1),R(),T(s)},[T,R]),Ve=b(()=>{y||$.current?U():B()},[U,y,B]),We=b(()=>{oe(!1),Pe(!1),Te(s=>s+1)},[]),Ge=b(()=>{let s=[`heroui-agent:anonymous:${o.agentId}`,`heroui-agent:conversation:${o.agentId}:`,`heroui-agent:history:${o.agentId}:`];for(let i=localStorage.length-1;i>=0;i-=1){let d=localStorage.key(i);d&&s.some(A=>d.startsWith(A))&&localStorage.removeItem(d)}$.current=!1,oe(!1),V(!1),H(!1),be(o.agentId,!1),Pe(!0),Te(i=>i+1),T(),window.setTimeout(()=>{import("./composer-draft-NSKK65F3.js").then(({clearAgentComposerDraftsForProject:i})=>i(o.agentId)).catch(()=>{})},0)},[o.agentId,T]);return C(()=>{let s={hide:U,newConversation:Q,preload:Be,ready:x,refreshAuth:We,show:B,shutdown:Ge,toggle:Ve};return D.set(o.agentId,s),En(),()=>{D.get(o.agentId)===s&&(D.delete(o.agentId),En())}},[U,Q,o.agentId,Be,x,We,B,Ge,Ve]),kn(()=>{let s=X.current;if(!O||!s)return;let i=Cn({onFileDialogActiveChange:$e,onIntent:R,options:o});s.render(Nn(On,{children:[F&&o.showLauncher&&!y?Nn("button",{ref:Ue,"aria-expanded":!1,"aria-haspopup":"dialog",className:"ha-launcher",style:o.launcherStyle,type:"button","aria-label":te?"Open data assistant, unread messages":"Open data assistant",onClick:B,children:[P(cn,{icon:o.launcherIcon}),te?P("span",{"aria-hidden":"true",className:"ha-launcher__unread"}):null]}):null,J&&!Fe?P(J,{composerControlsRevealed:W,conversationEpoch:_,identityEpoch:Oe,identityReset:Me,open:y,options:o,requestedConversationId:K,shellComposerEndSlot:i.end,shellComposerFooterSlot:i.footer,showReadyLoader:!_e&&K!==null,tokenManager:q,onClose:U,onComposerControlsReveal:ue,onNewConversation:Q,onReady:He,onSelectConversation:De,onUnreadChange:oe}):P(Ke,{agentId:o.agentId,shouldCloseOnInteractOutside:o.shouldCloseOnInteractOutside,defaultExpanded:o.panelExpanded,expandable:o.panelExpandable,historySlot:P(On,{}),name:"Data assistant",open:y,showBetaBadge:o.showBetaBadge,viewMode:o.viewMode,onClose:U,children:K===null?P(on,{composerConnecting:!0,agentId:o.agentId,composerControlsAvailable:o.composerControlsAvailable,composerControlsRevealed:W,composerEndSlot:i.end,composerFooterSlot:i.footer,composerStartSlot:i.start,greeting:o.greeting,placeholder:o.composerPlaceholder,suggestedPrompts:o.suggestedPrompts??[],onComposerControlsReveal:ue,onIntent:R},`shell-${_}`):P(je,{})})]}))},[J,W,Fe,_,He,te,_e,U,Oe,Me,y,Q,o,O,x,F,K,R,ue,De,B,q]),null}export{co as a,lo as b};
@@ -1 +0,0 @@
1
- import{a as oo,b as se,c as A,d as Ae,f as no,g as ro,h as io,i as so,j as Qe,k as lo}from"./chunk-BBB5EHDN.js";import{b as po,c as pa}from"./chunk-HCLXS4HQ.js";import{a as fe,b as It,c as ao,d as At}from"./chunk-CLHBM3HQ.js";import{a as be,b as k,c as ie}from"./chunk-S6OIAJSC.js";import{a as b}from"./chunk-CR3H7AVI.js";import{a as Je}from"./chunk-6ZJJN322.js";import{z as a}from"zod";var oi=["activity","alert","briefcase","calendar","chart","check","clock","code","credit-card","database","device-desktop","device-mobile","document","dollar","flag","globe","heart","home","info","lightning","location","mail","percent","person","question","receipt","rocket","route","search","shopping-bag","speedometer","star","tag","target","users"],ni=["clear","partly-cloudy","cloudy","fog","drizzle","rain","snow","thunderstorm","windy","unknown"],ri=a.string().trim().min(1).max(120),f=a.string().trim().min(1).max(320),Be=a.string().trim().min(1).max(1e4),D=a.string().trim().min(1).max(80),_=a.string().trim().min(1).max(100),ze=a.string().regex(/^\d{4}-\d{2}-\d{2}$/),ca=a.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/),ii=a.union([a.string().max(500),a.number(),a.boolean(),a.null()]),Re=a.record(a.string().max(80),ii),w=a.object({description:f.optional(),id:_,title:ri}),Ca=a.enum(["outline","plain","surface","surface-secondary","surface-tertiary","widget"]).describe("Card hierarchy: surface for the primary standalone group; surface-secondary for supporting information; surface-tertiary for one featured or emphasized group; outline for equal peers and comparisons; plain for a structural section already separated by surrounding layout; widget for a compact interactive group with actions or controls."),si=a.enum(["compact","details","media"]).describe("Record information layout: details for a full labeled fact set; compact for a brief summary or repeated peer cards; media for an image-led product, place, person, or event and only when an image is available."),oe=a.discriminatedUnion("style",[a.object({compact:a.boolean().optional(),style:a.literal("number")}),a.object({maximumFractionDigits:a.number().int().min(0).max(4).optional(),style:a.literal("percent")}),a.object({compact:a.boolean().optional(),currency:a.string().regex(/^[A-Z]{3}$/),style:a.literal("currency")})]),ye=a.enum(["accent","chart-1","chart-2","chart-3","chart-4","chart-5","danger","default","success","warning"]),uo=a.record(a.string().trim().min(1).max(80),ye).refine(t=>Object.keys(t).length<=50,"At most 50 category colors are allowed"),fa=a.object({color:ye.optional(),dataKey:D,format:oe.optional(),label:f}),li=fa.extend({axis:a.enum(["left","right"]).optional(),stacked:a.boolean().optional(),type:a.enum(["area","bar","line"])}),di=a.object({id:_,label:f,maxItems:a.number().int().min(1).max(200).optional()}),Ft=w.extend({data:a.array(Re).min(1).max(200),defaultRangeId:_.optional(),ranges:a.array(di).min(2).max(8).optional(),series:a.array(fa).min(1).max(5),showSummary:a.boolean().optional(),xKey:D}),Mt=w.extend({colors:uo.optional(),data:a.array(Re).min(1).max(50),format:oe.optional(),labelKey:D,valueKey:D}),pi=w.extend({colors:uo.optional(),data:a.array(Re).min(1).max(200),format:oe.optional(),groupKey:D.optional(),kind:a.literal("scatter-chart"),labelKey:D.optional(),sizeKey:D.optional(),xKey:D,yKey:D}),ci=w.extend({color:ye.optional(),data:a.array(Re).min(1).max(400),format:oe.optional(),kind:a.literal("heatmap"),valueKey:D,xKey:D,yKey:D}),mi=Ft.extend({baseline:a.number().finite().optional(),kind:a.literal("line-chart"),mode:a.enum(["live","profit-loss","standard"]).optional(),negativeColor:ye.optional(),positiveColor:ye.optional(),windowSize:a.number().int().min(2).max(200).optional()}).superRefine((t,e)=>{(t.mode==="live"||t.mode==="profit-loss")&&t.series.length!==1&&e.addIssue({code:"custom",message:`${t.mode} line charts require exactly one series`,path:["series"]})}),ui=w.extend({closeKey:D,data:a.array(Re).min(1).max(200),downColor:ye.optional(),format:oe.optional(),highKey:D,kind:a.literal("candlestick-chart"),lowKey:D,openKey:D,upColor:ye.optional(),xKey:D}).superRefine((t,e)=>{for(let[o,r]of t.data.entries()){let n=r[t.openKey],s=r[t.highKey],d=r[t.lowKey],m=r[t.closeKey];if([n,s,d,m].some(v=>typeof v!="number"||!Number.isFinite(v))){e.addIssue({code:"custom",message:"Every candlestick row needs finite open, high, low, and close values",path:["data",o]});continue}let y=n,h=s,u=d,g=m;(u>Math.min(y,g)||h<Math.max(y,g)||u>h)&&e.addIssue({code:"custom",message:"Candlestick low/high values must contain the open and close values",path:["data",o]})}}),gi=Mt.extend({data:a.array(Re).min(2).max(20),kind:a.literal("funnel-chart"),orientation:a.enum(["horizontal","vertical"]).optional(),showPercentages:a.boolean().optional()}).superRefine((t,e)=>{let o=t.data.map((r,n)=>{let s=r[t.valueKey];return typeof s!="number"||!Number.isFinite(s)||s<0?(e.addIssue({code:"custom",message:"Every funnel stage needs a finite, non-negative value",path:["data",n,t.valueKey]}),0):s});o.some(r=>r>0)||e.addIssue({code:"custom",message:"A funnel needs at least one stage above zero",path:["data"]}),(o[0]??0)<=0&&e.addIssue({code:"custom",message:"A funnel's first stage must be above zero",path:["data",0,t.valueKey]});for(let r=1;r<o.length;r+=1)(o[r]??0)>(o[r-1]??0)&&e.addIssue({code:"custom",message:"Funnel stages must not increase",path:["data",r,t.valueKey]})}),Ci=w.extend({color:ye.optional(),format:oe.optional(),kind:a.literal("gauge-chart"),label:f,max:a.number().finite().optional(),min:a.number().finite().optional(),notches:a.number().int().min(6).max(60).optional(),orientation:a.enum(["arc","linear"]).optional(),value:a.number().finite()}).superRefine((t,e)=>{let{maximum:o,minimum:r}=oo(t);o<=r?e.addIssue({code:"custom",message:"Gauge max must be greater than min",path:["max"]}):(t.value<r||t.value>o)&&e.addIssue({code:"custom",message:"Gauge value must be within its min/max range",path:["value"]})}),go=a.lazy(()=>a.object({children:a.array(go).min(1).max(12).optional(),color:ye.optional(),id:_,label:f,value:a.number().finite().positive().optional()}).superRefine((t,e)=>{t.children?.length&&t.value!==void 0&&e.addIssue({code:"custom",message:"Sunburst branch values are derived from their children",path:["value"]}),!t.children?.length&&t.value===void 0&&e.addIssue({code:"custom",message:"Every sunburst leaf needs a positive value",path:["value"]})})),hi=w.extend({data:go,format:oe.optional(),kind:a.literal("sunburst-chart")}).superRefine((t,e)=>{let o=new Set,r=0,n=0,s=(d,m)=>{r+=1,n=Math.max(n,m),o.has(d.id)&&e.addIssue({code:"custom",message:`Duplicate sunburst node id "${d.id}"`}),o.add(d.id),d.children?.forEach(l=>s(l,m+1))};t.data.children?.length||e.addIssue({code:"custom",message:"A sunburst root needs at least one child",path:["data","children"]}),s(t.data,0),r>60&&e.addIssue({code:"custom",message:"Sunburst charts allow at most 60 nodes"}),n>4&&e.addIssue({code:"custom",message:"Sunburst charts allow at most four nested levels"})}),Rt=a.object({label:f,value:D}),fi=a.object({end:ze,start:ze}).refine(t=>t.start<=t.end,"The start date must not be after the end date"),le={description:f.optional(),label:f,name:D,required:a.boolean().optional()},bi=a.discriminatedUnion("kind",[a.object({...le,defaultValue:a.string().max(500).optional(),inputType:a.enum(["email","number","password","search","tel","text","url"]).optional(),kind:a.literal("input"),placeholder:a.string().max(160).optional()}),a.object({...le,defaultValue:a.string().max(2e3).optional(),kind:a.literal("textarea"),placeholder:a.string().max(160).optional(),rows:a.number().int().min(2).max(12).optional()}),a.object({...le,defaultValue:D.optional(),kind:a.literal("select"),options:a.array(Rt).min(1).max(30),placeholder:a.string().max(160).optional()}),a.object({...le,defaultValue:D.optional(),kind:a.literal("radio-group"),options:a.array(Rt).min(1).max(12),placeholder:a.string().max(160).optional()}),a.object({...le,defaultValue:a.array(D).max(20).optional(),kind:a.literal("checkbox-group"),options:a.array(Rt).min(1).max(20)}),a.object({...le,defaultValue:a.array(D).max(50).optional(),kind:a.literal("combobox"),options:a.array(Rt.extend({description:a.string().trim().min(1).max(120).optional()})).min(1).max(200).describe("Prefer this over select once there are more options than someone would scan \u2014 it filters as they type. Values must be unique."),placeholder:a.string().max(160).optional(),selectionMode:a.enum(["multiple","single"]).optional()}).superRefine((t,e)=>{let o=new Set(t.options.map(r=>r.value));o.size!==t.options.length&&e.addIssue({code:"custom",message:"Combobox option values must be unique",path:["options"]}),(t.selectionMode??"single")==="single"&&(t.defaultValue?.length??0)>1&&e.addIssue({code:"custom",message:"A single-selection combobox takes at most one default value",path:["defaultValue"]}),t.defaultValue?.some(r=>!o.has(r))&&e.addIssue({code:"custom",message:"Every combobox default value must be one of the options",path:["defaultValue"]})}),a.object({...le,defaultValue:a.number().optional(),kind:a.literal("slider"),max:a.number(),min:a.number(),step:a.number().positive().optional()}),a.object({...le,defaultValue:a.number().optional(),format:oe.optional(),kind:a.literal("number"),max:a.number().optional(),min:a.number().optional(),placeholder:a.string().max(160).optional(),step:a.number().positive().optional()}),a.object({...le,defaultValue:a.boolean().optional(),kind:a.literal("switch")}),a.object({...le,defaultValue:ze.optional(),kind:a.literal("date-picker"),max:ze.optional(),min:ze.optional()}),a.object({...le,defaultValue:fi.optional(),kind:a.literal("date-range-picker"),max:ze.optional(),min:ze.optional()}),a.object({...le,defaultValue:ca.optional(),hourCycle:a.union([a.literal(12),a.literal(24)]).optional(),kind:a.literal("time-field"),max:ca.optional(),min:ca.optional()})]),ba=a.enum(["danger","outline","primary","secondary","tertiary"]),Se=a.enum(oi),Co=a.object({arguments:a.record(a.string().max(80),a.unknown()).refine(t=>JSON.stringify(t).length<=4096,"Tool call arguments must serialize to at most 4KB of JSON"),name:a.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/)}),ae=a.object({id:_,label:f,prompt:a.string().trim().min(1).max(2e3).optional(),toolCall:Co.optional(),variant:ba.optional()}),ho=a.object({latitude:a.number().finite().min(-85.051129).max(85.051129),longitude:a.number().finite().min(-180).max(180)}),ha=a.string().trim().min(1).max(2e3).refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},{message:"URL must use HTTP or HTTPS and cannot include credentials"}),yi=a.string().trim().min(1).max(2e3).refine(t=>{try{let e=new URL(t);return["http:","https:","mailto:","tel:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},{message:"Link must use HTTP, HTTPS, mailto, or tel and cannot include credentials"}),Lt={id:_,label:f,variant:ba.optional()},xi=a.string().trim().min(5).max(2e3).refine(t=>/^tel:\+?[0-9().\-\s]+$/.test(t)&&/\d/.test(t.slice(4)),"Phone links must use the tel: scheme and contain a phone number"),wi=a.discriminatedUnion("kind",[a.object({...Lt,href:xi,kind:a.literal("call")}),a.object({...Lt,href:ha,kind:a.literal("directions")}),a.object({...Lt,href:yi,kind:a.literal("other")}),a.object({...Lt,href:ha,kind:a.literal("website")})]),vi=ho.extend({actions:a.array(wi).max(4).optional(),address:f.optional(),category:a.string().trim().min(1).max(100).optional(),id:_,images:a.array(a.object({alt:f,src:ha})).max(4).optional().describe("Prefer one representative image per location when a trusted tool or web image search returns one. The first image becomes the result-card thumbnail; initials are the fallback."),notes:a.string().trim().min(1).max(2e3).optional(),rating:a.number().finite().min(0).max(5).optional(),relevance:a.number().finite().min(0).max(1).optional(),reviewCount:a.number().int().nonnegative().max(1e9).optional(),title:f}),mt=a.string().trim().min(1).max(2e3).refine(t=>{if(t.startsWith("/"))return!t.startsWith("//");try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},{message:"Image sources must be HTTP(S) URLs or root-relative paths"}),pe=a.object({alt:f,src:mt.refine(t=>!t.split(/[?#]/,1)[0]?.toLowerCase().endsWith(".svg"),"Response-composition images must be raster images")}),ya=a.string().regex(/^[A-Z]{3}$/),ki=a.object({amount:a.number().finite().nonnegative().max(1e9),currency:ya}),ma=a.enum(ni),co=a.enum(["celsius","fahrenheit"]),mo=a.object({label:f,status:f.optional(),time:a.string().trim().min(1).max(80)}),We=a.enum(["accent","danger","default","muted","success","warning"]),Si=a.object({actions:a.array(ae).max(3).optional(),badge:a.object({label:f,tone:We.optional()}).optional(),description:f.optional(),id:_,image:a.object({alt:f,src:mt}),meta:a.string().trim().min(1).max(160).optional(),name:f,price:a.object({amount:a.number().finite().nonnegative().max(1e9),currency:ya.optional()}),rating:a.object({count:a.number().int().nonnegative().max(1e9).optional(),value:a.number().finite().min(0).max(5)}).optional()}),Ni=a.enum(["accent","danger","default","success","warning"]),Pi=a.object({description:f.optional(),format:oe.optional(),id:_,label:f,max:a.number().optional(),min:a.number().optional(),tone:Ni.optional(),value:a.number()}).superRefine((t,e)=>{let o=t.min??0,r=t.max??(t.format?.style==="percent"?1:100);r<=o&&e.addIssue({code:"custom",message:"Meter max must be greater than min"}),(t.value<o||t.value>r)&&e.addIssue({code:"custom",message:"Meter value must be within its min/max range"})}),p={accordion:w.extend({kind:a.literal("accordion"),sections:a.array(a.object({content:Be,defaultOpen:a.boolean().optional(),id:_,title:f})).min(1).max(12)}),actions:w.extend({actions:a.array(ae).min(1).max(8),kind:a.literal("action-group"),orientation:a.enum(["horizontal","vertical"]).optional()}),area:Ft.extend({kind:a.literal("area-chart"),stacked:a.boolean().optional()}),bar:Ft.extend({kind:a.literal("bar-chart"),layout:a.enum(["horizontal","vertical"]).optional(),stacked:a.boolean().optional()}),callout:w.extend({content:Be,icon:Se.optional(),kind:a.literal("callout"),tone:a.enum(["accent","danger","neutral","success","warning"]).optional()}),candlestick:ui,channelMessage:w.extend({attachments:a.array(a.object({id:_,image:pe.optional(),name:f})).max(8).optional(),author:a.object({image:pe.optional(),name:f}),channel:f,content:Be,kind:a.literal("channel-message"),timestamp:a.string().trim().min(1).max(80)}),code:w.extend({code:a.string().min(1).max(2e4),kind:a.literal("code-block"),language:a.string().trim().max(40).optional()}),comparison:w.extend({items:a.array(a.object({change:a.number().optional(),format:oe.optional(),label:f,note:a.string().trim().max(180).optional(),value:a.number()})).min(1).max(12),kind:a.literal("comparison-list")}),composed:Ft.extend({kind:a.literal("composed-chart"),series:a.array(li).min(2).max(5)}),createEvent:w.extend({actions:a.array(ae).max(2).optional(),date:a.object({day:a.number().int().min(1).max(31),weekday:a.string().trim().min(1).max(20)}),events:a.array(a.object({id:_,status:a.enum(["existing","proposed"]).optional(),time:a.string().trim().min(1).max(80),title:f,tone:We.optional()})).min(1).max(12),kind:a.literal("create-event")}),diagram:w.extend({chart:a.string().trim().min(1).max(4e3).describe('Mermaid source. Pick the diagram type from the relationship: "flowchart LR" for a process or decision path, "sequenceDiagram" for an exchange between parties over time, "erDiagram" for how records relate, "stateDiagram-v2" for the states something moves between. Example: "flowchart LR\\n A[Order placed] --> B{In stock?}\\n B -- yes --> C[Ship]\\n B -- no --> D[Backorder]". Never include HTML, script tags, or click directives.'),kind:a.literal("diagram")}).superRefine((t,e)=>{/<\s*script|javascript:|^\s*click\s+\S/im.test(t.chart)&&e.addIssue({code:"custom",message:"Diagram source cannot contain HTML, script URLs, or click directives",path:["chart"]})}),donut:Mt.extend({kind:a.literal("donut-chart")}),enableNotification:w.extend({actions:a.tuple([ae,ae]),kind:a.literal("enable-notification")}),eventSession:w.extend({action:ae.optional(),eyebrow:a.string().trim().min(1).max(100).optional(),kind:a.literal("event-session"),location:f,speakers:a.array(a.object({image:pe.optional(),name:f,role:f})).max(8),time:a.string().trim().min(1).max(80)}),flightTracker:w.extend({airline:a.object({logo:pe.optional(),name:f}),date:a.string().trim().min(1).max(80),destination:mo,flightNumber:a.string().trim().min(1).max(40),kind:a.literal("flight-tracker"),origin:mo,progress:a.number().finite().min(0).max(100).optional()}),followup:w.extend({kind:a.literal("followup"),prompts:a.array(a.object({id:_,label:f,prompt:Be})).min(1).max(8)}),form:w.extend({actions:a.array(ae).min(1).max(4),fields:a.array(bi).min(1).max(20),kind:a.literal("form")}),funnel:gi,gauge:Ci,heatmap:ci,image:w.extend({images:a.array(a.object({alt:f,aspectRatio:a.enum(["landscape","portrait","square","wide"]).optional(),caption:f.optional(),src:mt})).min(1).max(6),kind:a.literal("image"),variant:a.enum(["grid","horizontal"]).optional().describe("Use horizontal for a swipeable gallery in narrow chat interfaces.")}),kpiGrid:w.extend({kind:a.literal("kpi-grid"),metrics:a.array(a.object({change:a.number().optional(),color:ye.optional(),format:oe.optional(),icon:Se.optional(),label:f,trend:a.array(a.number().finite()).min(2).max(60).describe("The values behind this KPI, oldest to newest, drawn as a sparkline. The last point should agree with value."),value:a.number()})).min(1).max(4)}),line:mi,list:w.extend({items:a.array(a.object({checked:a.boolean().optional(),children:a.array(f).max(8).optional(),id:_,text:f})).min(1).max(30),kind:a.literal("list"),style:a.enum(["bulleted","checklist","numbered"]).optional()}),listBlock:w.extend({items:a.array(a.object({description:f.optional(),icon:Se.optional(),id:_,imageAlt:f.optional(),imageUrl:mt.optional(),meta:a.string().trim().max(100).optional(),rating:a.number().min(0).max(5).optional(),title:f})).min(1).max(20),kind:a.literal("list-block")}),map:w.extend({initialLocationId:_.optional(),kind:a.literal("map"),locations:a.array(vi).min(1).max(12),viewport:a.object({center:ho,zoom:a.number().int().min(1).max(18)}).optional()}).superRefine((t,e)=>{let o=new Set;for(let[r,n]of t.locations.entries()){o.has(n.id)&&e.addIssue({code:"custom",message:`Duplicate map location id "${n.id}"`,path:["locations",r,"id"]}),o.add(n.id);let s=new Set;for(let[d,m]of(n.actions??[]).entries())s.has(m.id)&&e.addIssue({code:"custom",message:`Duplicate action id "${m.id}" for map location "${n.id}"`,path:["locations",r,"actions",d,"id"]}),s.add(m.id)}t.initialLocationId&&!o.has(t.initialLocationId)&&e.addIssue({code:"custom",message:"The initial map location must reference one of the locations",path:["initialLocationId"]})}).describe("A ranked, map-synchronized set of places or professionals. Coordinates and listing facts must come from tools or user data; never invent them."),meterList:w.extend({items:a.array(Pi).min(1).max(8),kind:a.literal("meter-list")}),metricGrid:w.extend({kind:a.literal("metric-grid"),metrics:a.array(a.object({change:a.number().optional(),format:oe.optional(),icon:Se.optional(),label:f,value:a.number()})).min(1).max(4)}),pie:Mt.extend({kind:a.literal("pie-chart")}),playerCard:w.extend({backgroundImage:pe.optional(),jerseyNumber:a.string().trim().min(1).max(20).optional(),kind:a.literal("player-card"),playerName:f,stats:a.array(a.object({label:a.string().trim().min(1).max(40),value:a.union([a.string().trim().min(1).max(80),a.number().finite()])})).min(1).max(8)}),playlist:w.extend({actions:a.array(ae).max(2).optional(),cover:pe.optional(),kind:a.literal("playlist"),tracks:a.array(a.object({action:ae.optional(),artist:f,id:_,image:pe.optional(),title:f})).min(1).max(20)}),productCard:w.extend({actions:a.array(ae).max(3).optional(),kind:a.literal("product-card"),products:a.array(Si).min(1).max(8),variant:Ca.optional()}).superRefine((t,e)=>{let o=new Set;for(let[r,n]of t.products.entries())o.has(n.id)&&e.addIssue({code:"custom",message:`Duplicate product id "${n.id}"`,path:["products",r,"id"]}),o.add(n.id)}).describe("A commerce product presentation: one product renders an image-led spotlight, several render a store-style grid. Product facts (id, name, image, price, rating, availability) must come from tools or user data; never invent them."),purchaseComplete:w.extend({action:ae.optional(),details:a.array(a.object({label:f,value:f})).max(8),kind:a.literal("purchase-complete"),paid:ki.optional(),product:a.object({description:f.optional(),image:pe.optional(),name:f})}),purchaseItems:w.extend({actions:a.array(ae).max(3).optional(),currency:ya,items:a.array(a.object({description:f.optional(),id:_,image:pe.optional(),name:f,price:a.number().finite().nonnegative().max(1e9).optional(),quantity:a.number().int().positive().max(1e4).optional()})).min(1).max(20),kind:a.literal("purchase-items"),totals:a.array(a.object({amount:a.number().finite().nonnegative().max(1e9),emphasis:a.boolean().optional(),label:f})).min(1).max(8)}),radar:w.extend({angleKey:D,data:a.array(Re).min(3).max(50),kind:a.literal("radar-chart"),series:a.array(fa).min(1).max(5)}),radial:Mt.extend({endAngle:a.number().min(-360).max(360).optional(),kind:a.literal("radial-chart"),maxValue:a.number().positive().optional(),startAngle:a.number().min(-360).max(360).optional()}),recordCard:w.extend({actions:a.array(ae).max(4).optional(),eyebrow:a.string().trim().max(100).optional(),fields:a.array(a.object({icon:Se.optional(),label:f,tone:We.optional(),value:a.string().trim().min(1).max(500)})).max(12),image:a.object({alt:f,src:mt}).optional(),kind:a.literal("record-card"),layout:si.optional(),status:a.object({label:f,tone:We.optional()}).optional(),variant:Ca.optional()}).superRefine((t,e)=>{t.layout==="media"&&!t.image&&e.addIssue({code:"custom",message:"The media record layout requires an image",path:["image"]}),t.layout==="compact"&&t.fields.length>4&&e.addIssue({code:"custom",message:"The compact record layout supports at most four fields",path:["fields"]})}),rideStatus:w.extend({driver:a.object({image:pe.optional(),name:f}),eta:a.string().trim().min(1).max(80),kind:a.literal("ride-status"),pickup:f}),sankey:w.extend({format:oe.optional(),kind:a.literal("sankey-chart"),links:a.array(a.object({source:_,target:_,value:a.number().positive()})).min(1).max(100),nodes:a.array(a.object({id:_,label:f})).min(2).max(40)}),scatter:pi,steps:w.extend({kind:a.literal("steps"),steps:a.array(a.object({content:f.optional(),icon:Se.optional(),id:_,image:pe.optional().describe("A representative raster image for this step. Prefer this over icon for place itineraries when a trusted image URL is available."),meta:a.string().trim().max(100).optional(),progress:a.number().min(0).max(100).optional(),status:a.enum(["blocked","cancelled","completed","failed","in-progress","pending","complete","current","upcoming"]).optional(),timestamp:a.string().trim().max(100).optional(),title:f})).min(1).max(12),variant:a.enum(["steps","timeline"]).optional()}),sunburst:hi,switches:w.extend({items:a.array(a.object({defaultSelected:a.boolean().optional(),description:f.optional(),id:_,label:f})).min(1).max(20),kind:a.literal("switch-group")}),table:w.extend({columns:a.array(a.object({format:oe.optional(),key:D,label:f})).min(1).max(12),filterable:a.boolean().optional(),kind:a.literal("data-table"),rows:a.array(Re).max(200),variant:a.enum(["primary","secondary"]).optional()}),tabs:w.extend({defaultValue:_.optional(),kind:a.literal("tabs"),tabs:a.array(a.union([a.object({children:a.never().optional(),content:Be,id:_,label:f}),a.object({children:a.array(a.lazy(()=>ka)).min(1).max(12),content:a.never().optional(),id:_,label:f})])).min(1).max(10),variant:a.enum(["primary","secondary"]).optional()}),tags:w.extend({kind:a.literal("tag-list"),tags:a.array(f).min(1).max(30)}),text:w.extend({content:Be,kind:a.literal("text"),variant:a.enum(["card","clear"]).optional()}),toggles:w.extend({defaultValue:a.array(_).max(12).optional(),items:a.array(a.object({id:_,label:f})).min(1).max(12),kind:a.literal("toggle-group"),selectionMode:a.enum(["multiple","single"]).optional()}),viewEvent:w.extend({date:a.string().trim().min(1).max(80),kind:a.literal("view-event"),time:a.string().trim().min(1).max(80),tone:We.optional()}),weatherCurrent:w.extend({condition:ma,details:a.array(a.object({label:f,value:f})).max(6).optional(),kind:a.literal("weather-current"),location:f,temperature:a.number().finite().min(-150).max(150),unit:co}),weatherForecast:w.extend({condition:ma,forecast:a.array(a.object({condition:ma,label:a.string().trim().min(1).max(40),temperature:a.number().finite().min(-150).max(150)})).min(2).max(10),high:a.number().finite().min(-150).max(150),kind:a.literal("weather-forecast"),location:f,low:a.number().finite().min(-150).max(150),unit:co})},Vi=p.metricGrid,_i=p.kpiGrid,Ti=p.line,Ii=p.area,Ai=p.bar,Ri=p.composed,Li=p.pie,Fi=p.donut,Mi=p.radar,Di=p.radial,Bi=p.sankey,zi=p.scatter,Wi=p.heatmap,Ei=p.candlestick,Gi=p.funnel,Ui=p.gauge,Hi=p.sunburst,Zi=p.table,$i=p.comparison,Ki=p.meterList,Oi=p.form,ji=p.text,qi=p.callout,Yi=p.image,Xi=p.map,Ji=p.tags,Qi=p.list,es=p.listBlock,ts=p.accordion,as=p.steps,os=p.code,ns=p.diagram,Ip=p.tabs.superRefine($o),rs=p.actions,is=p.followup,ss=p.switches,ls=p.toggles,ds=p.recordCard,ps=p.productCard,cs=p.flightTracker,ms=p.createEvent,us=p.playlist,gs=p.rideStatus,Cs=p.purchaseItems,hs=p.channelMessage,fs=p.purchaseComplete,bs=p.playerCard,ys=p.viewEvent,xs=p.eventSession,ws=p.enableNotification,vs=p.weatherForecast,ks=p.weatherCurrent,Ss=a.discriminatedUnion("kind",[p.metricGrid,p.kpiGrid,p.line,p.area,p.bar,p.composed,p.pie,p.donut,p.radar,p.radial,p.sankey,p.scatter,p.heatmap,p.candlestick,p.funnel,p.gauge,p.sunburst,p.table,p.comparison,p.meterList]),fo=w.extend({defaultValue:_.optional(),kind:a.literal("product-signals"),tabs:a.array(a.object({component:Ss,id:_,label:f})).min(2).max(4)}),Ns=fo.superRefine((t,e)=>{let o=new Set;for(let[r,n]of t.tabs.entries())o.has(n.id)&&e.addIssue({code:"custom",message:`Duplicate product signal tab id "${n.id}"`,path:["tabs",r,"id"]}),o.add(n.id);t.defaultValue&&!o.has(t.defaultValue)&&e.addIssue({code:"custom",message:"The default product signal must reference one of the tabs",path:["defaultValue"]})}),Ps=a.discriminatedUnion("kind",[p.metricGrid,p.kpiGrid,p.line,p.area,p.bar,p.composed,p.pie,p.donut,p.radar,p.radial,p.sankey,p.scatter,p.heatmap,p.candlestick,p.funnel,p.gauge,p.sunburst,p.table,p.comparison,p.meterList,p.form,p.text,p.callout,p.image,p.map,p.tags,p.list,p.listBlock,p.accordion,p.steps,p.code,p.diagram,p.tabs,p.actions,p.followup,p.switches,p.toggles,p.recordCard,p.productCard,p.flightTracker,p.createEvent,p.playlist,p.rideStatus,p.purchaseItems,p.channelMessage,p.purchaseComplete,p.playerCard,p.viewEvent,p.eventSession,p.enableNotification,p.weatherForecast,p.weatherCurrent]);function Vs(t){if(!t)return;let e=new Set;for(let o of t){if(e.has(o.id))return o.id;e.add(o.id)}}var xa=a.union([Ps,Ns]).superRefine((t,e)=>{let o=[];switch(t.kind){case"channel-message":o.push({items:t.attachments,path:"attachments"});break;case"create-event":o.push({items:t.events,path:"events"}),o.push({items:t.actions,path:"actions"});break;case"enable-notification":o.push({items:t.actions,path:"actions"});break;case"playlist":o.push({items:t.tracks,path:"tracks"}),o.push({items:t.actions,path:"actions"});break;case"purchase-items":o.push({items:t.items,path:"items"}),o.push({items:t.actions,path:"actions"});break;case"tabs":{$o(t,e);break}default:break}for(let r of o){let n=Vs(r.items);n&&e.addIssue({code:"custom",message:`Duplicate ${r.path} id "${n}"`,path:[r.path]})}}),bo=w.extend({children:a.array(xa).min(1).max(4),kind:a.literal("dashboard"),layout:a.enum(["chart-table","grid","metrics-chart","stack"])}),_s=bo,yo=a.union([xa,_s]),Ap=a.object({component:yo}),ua=6,Ee=48,Ts=new Set(["card","col","grid","item-card","item-card-group","row"]);function xo(t){return Ts.has(t.kind)}function wo(t){return t.kind==="item-card"?[...t.left??[],...t.middle,...t.right??[]]:t.children}var ce=a.object({id:_}),wa=a.enum(["lg","md","none","sm"]),vo=a.enum(["center","end","start","stretch"]),ko=a.enum(["between","center","end","start"]),Dt=a.array(a.lazy(()=>ka)).min(1).max(Ee),So=ce.extend({kind:a.literal("spacer"),size:a.enum(["auto","lg","md","sm"]).optional()}),No=ce.extend({kind:a.literal("divider")}),Po=ce.extend({icon:Se.optional(),kind:a.literal("heading"),level:a.union([a.literal(1),a.literal(2),a.literal(3),a.literal(4)]).optional(),text:f}),Vo=ce.extend({icon:Se.optional(),kind:a.literal("button"),label:f,prompt:a.string().trim().min(1).max(2e3).optional(),toolCall:Co.optional(),variant:ba.optional()}).refine(t=>!!(t.prompt??t.toolCall),{message:"Buttons need a prompt or a toolCall to do something when pressed"}),_o=ce.extend({kind:a.literal("badge"),label:f,tone:We.optional(),variant:a.enum(["soft","solid"]).optional()}),To=ce.extend({kind:a.literal("icon"),name:Se,size:a.enum(["lg","md","sm"]).optional(),tone:We.optional()}),Io=ce.extend({count:a.number().int().nonnegative().max(1e9).optional(),kind:a.literal("rating"),value:a.number().finite().min(0).max(5)}),Ao=ce.extend({kind:a.literal("progress"),label:f.optional(),value:a.number().finite().min(0).max(100)}),Ro=a.enum(["default","outline","secondary","tertiary","transparent"]),ga=a.lazy(()=>ka),Lo=w.extend({action:ae.optional().describe("Makes the whole row pressable. Omit when a slot contains its own button or other interactive control."),isDisabled:a.boolean().optional(),isSelected:a.boolean().optional(),kind:a.literal("item-card"),left:a.array(ga).min(1).max(4).optional().describe("Leading slot. Prefer one icon node or a compact visual."),middle:a.array(ga).min(1).max(8).describe("Primary flexible slot. Prefer a level-4 heading followed by a clear text node for a title and description."),right:a.array(ga).min(1).max(4).optional().describe("Trailing slot. Prefer a badge, short value, icon, or button."),variant:Ro.optional()}),Is=new Set(["accordion","action-group","button","followup","form","map","switch-group","tabs","toggle-group"]);function Fo(t){for(let e of t)if(Is.has(e.kind)||xo(e)&&Fo(wo(e)))return!0;return!1}var va=Lo.superRefine((t,e)=>{t.action&&Fo([...t.left??[],...t.middle,...t.right??[]])&&e.addIssue({code:"custom",message:"A pressable item-card cannot contain buttons or other interactive descendants. Remove action from the card or move the nested control outside it."})}),Mo=w.extend({children:a.array(va).min(1).max(12),columns:a.union([a.literal(2),a.literal(3)]).optional(),kind:a.literal("item-card-group"),layout:a.enum(["grid","list"]).optional(),showHeader:a.boolean().optional(),variant:Ro.optional()}),Do=Mo.superRefine((t,e)=>{t.columns&&t.layout!=="grid"&&e.addIssue({code:"custom",message:"Item-card group columns only apply when layout is grid.",path:["columns"]})}),Bo=ce.extend({align:vo.optional(),children:Dt,gap:wa.optional(),justify:ko.optional(),kind:a.literal("row")}),zo=ce.extend({align:vo.optional(),children:Dt,gap:wa.optional(),justify:ko.optional(),kind:a.literal("col")}),Wo=ce.extend({children:Dt,columns:a.union([a.literal(1),a.literal(2),a.literal(3),a.literal(4)]),gap:wa.optional(),kind:a.literal("grid")}),Eo=w.extend({children:Dt,kind:a.literal("card"),variant:Ca.optional()}),Go=Bo,Uo=zo,Ho=Wo,Zo=Eo,ka=a.union([xa,So,No,Po,Vo,_o,To,Io,Ao,Go,Uo,Ho,Zo,va,Do]);function As(t,e){Fs(t,e)}function Rs(t,e){let o=t.tabs.flatMap(r=>r.children??[]);o.length!==0&&Ko(o,e,t.id,2,1)}function $o(t,e){let o=new Set;for(let[r,n]of t.tabs.entries())o.has(n.id)&&e.addIssue({code:"custom",message:`Duplicate tab id "${n.id}"`,path:["tabs",r,"id"]}),o.add(n.id);t.defaultValue&&!o.has(t.defaultValue)&&e.addIssue({code:"custom",message:"The default tab must reference one of the tabs",path:["defaultValue"]}),Rs(t,e)}function Ls(t){return xo(t)?wo(t):t.kind==="tabs"?t.tabs.flatMap(e=>e.children??[]):[]}function Ko(t,e,o,r=1,n=0){let s=new Set,d=n,m=n>0?r-1:0;o&&s.add(o);let l=(y,h)=>{if(d+=1,m=Math.max(m,h),s.has(y.id)&&e.addIssue({code:"custom",message:`Duplicate component id "${y.id}" in the composed UI tree. Every node needs a unique id.`}),s.add(y.id),!(h>ua))for(let u of Ls(y))l(u,h+1)};for(let y of t)l(y,r);m>ua&&e.addIssue({code:"custom",message:`Composed UI trees can nest at most ${ua} levels deep.`}),d>Ee&&e.addIssue({code:"custom",message:`Composed UI trees can contain at most ${Ee} components.`})}function Fs(t,e){Ko([t],e)}var Oo=a.union([Go,Uo,Ho,Zo,va,Do]).superRefine(As),jo=a.union([yo,Oo]),Rp=a.object({component:Oo}),ke=t=>a.array(a.unknown()).min(1).max(t).describe("Child nodes. Each is any catalog component; look its kind up separately."),Lp={accordion:ts,"action-group":rs,"area-chart":Ii,badge:_o,"bar-chart":Ai,button:Vo,callout:qi,"candlestick-chart":Ei,card:Eo.extend({children:ke(Ee)}),"channel-message":hs,"code-block":os,col:zo.extend({children:ke(Ee)}),"comparison-list":$i,"composed-chart":Ri,"create-event":ms,dashboard:bo.extend({children:ke(4)}),"data-table":Zi,diagram:ns,divider:No,"donut-chart":Fi,"enable-notification":ws,"event-session":xs,"flight-tracker":cs,followup:is,form:Oi,"funnel-chart":Gi,"gauge-chart":Ui,grid:Wo.extend({children:ke(Ee)}),heading:Po,heatmap:Wi,icon:To,image:Yi,"item-card":Lo.extend({left:ke(4).optional().describe("Leading slot nodes."),middle:ke(8).describe("Primary flexible slot nodes."),right:ke(4).optional().describe("Trailing slot nodes.")}),"item-card-group":Mo.extend({children:a.array(a.unknown()).min(1).max(12).describe("One to twelve item-card children. Look up item-card for each child's schema.")}),"kpi-grid":_i,"line-chart":Ti,list:Qi,"list-block":es,map:Xi,"meter-list":Ki,"metric-grid":Vi,"pie-chart":Li,"player-card":bs,playlist:us,"product-card":ps,"product-signals":fo.extend({tabs:a.array(a.object({component:a.unknown().describe("One analytical component: metric-grid, kpi-grid, any chart, data-table, comparison-list, or meter-list. Look its kind up separately."),id:_,label:f})).min(2).max(4)}),progress:Ao,"purchase-complete":fs,"purchase-items":Cs,"radar-chart":Mi,"radial-chart":Di,rating:Io,"record-card":ds,"ride-status":gs,row:Bo.extend({children:ke(Ee)}),"sankey-chart":Bi,"scatter-chart":zi,spacer:So,steps:as,"sunburst-chart":Hi,"switch-group":ss,tabs:w.extend({defaultValue:_.optional(),kind:a.literal("tabs"),tabs:a.array(a.union([a.object({content:Be,id:_,label:f}),a.object({children:ke(12).describe("Rich panel nodes rendered as one vertical stack. Look up every child kind separately."),id:_,label:f})])).min(1).max(10),variant:a.enum(["primary","secondary"]).optional()}),"tag-list":Ji,text:ji,"toggle-group":ls,"view-event":ys,"weather-current":ks,"weather-forecast":vs};import{jsx as Ge,jsxs as Ms}from"react/jsx-runtime";function qo({className:t,component:e,onAction:o,onSelect:r}){return Ge(k,{className:t,description:e.description,title:e.title,children:Ge("div",{className:"aui-actions","data-orientation":e.orientation??"horizontal","data-slot":"agent-ui-actions",children:e.actions.map(n=>Ge(fe,{variant:n.variant,onClick:()=>{let s=se(e.id,n);s&&o?o(s):r?.(A(e,n))},children:n.label},n.id))})})}function Yo({className:t,component:e,onAction:o,onSelect:r}){return Ge(k,{className:t,description:e.description,title:e.title,children:Ge(It,{className:"aui-followup","data-slot":"agent-ui-followup",children:e.prompts.map(n=>Ms("button",{"data-slot":"agent-ui-followup-item",type:"button",onClick:()=>{o?o({componentId:e.id,label:n.label,prompt:n.prompt,type:"followup"}):r?.(A(e,n))},children:[Ge("span",{"data-slot":"agent-ui-followup-label",children:n.label}),Ge("span",{"aria-hidden":"true","data-slot":"agent-ui-followup-indicator",children:"\u2197"})]},n.id))})})}import{Suspense as Es,lazy as X,useState as Gs}from"react";import{jsx as et,jsxs as Bs}from"react/jsx-runtime";function Ds(t){return t==="dashboard"||t==="product-signals"||t==="card"||t==="col"||t==="grid"||t==="item-card"||t==="item-card-group"||t==="row"?"dashboard":t==="metric-grid"||t==="kpi-grid"?"metrics":t==="map"?"map":t==="data-table"?"table":t==="record-card"||t==="channel-message"||t==="create-event"||t==="enable-notification"||t==="event-session"||t==="flight-tracker"||t==="player-card"||t==="playlist"||t==="purchase-complete"||t==="purchase-items"||t==="ride-status"||t==="view-event"||t==="weather-current"||t==="weather-forecast"?"record":"chart"}function Sa({className:t,kind:e,title:o}){let r=Ds(e);return Bs("section",{"aria-busy":"true","aria-label":o?`Loading ${o}`:"Loading data view",className:b("aui-skeleton",t),"data-component-kind":e,"data-skeleton-category":r,"data-slot":"agent-ui-skeleton",role:"status",children:[et("div",{className:"aui-skeleton__header","data-slot":"agent-ui-skeleton-header"}),et("div",{className:"aui-skeleton__content","data-slot":"agent-ui-skeleton-content",children:r==="metrics"||r==="dashboard"?Array.from({length:r==="dashboard"?2:4},(n,s)=>et("span",{className:"aui-skeleton__panel"},s)):r==="table"||r==="record"?Array.from({length:r==="table"?5:4},(n,s)=>et("span",{className:"aui-skeleton__row"},s)):et("span",{className:"aui-skeleton__chart"})}),et("span",{className:"aui-sr-only","data-slot":"agent-ui-skeleton-label",children:"Loading data view\u2026"})]})}import{ChevronUp as zs}from"@gravity-ui/icons";import{SearchField as ut}from"@heroui/react";import{useMemo as Na,useState as Xo}from"react";import{jsx as j,jsxs as Bt}from"react/jsx-runtime";function Ws({children:t,inherit:e}){return e?t:j(be,{variant:"plain",children:t})}function zt({className:t,component:e,exportFormats:o,inheritCardVariant:r,onAction:n,onSelect:s,viewAction:d}){let[m,l]=Xo(""),[y,h]=Xo(null),u=Na(()=>new Set(e.columns.map(V=>V.key)),[e]),g=y&&u.has(y.key)?y:null,v=Na(()=>{let V=new Map;return e.rows.map(K=>{let $=JSON.stringify(K),ve=V.get($)??0;return V.set($,ve+1),{key:`${$}:${ve}`,row:K}})},[e.rows]),P=Na(()=>{let V=e.filterable?m.trim().toLowerCase():"",K=V?v.filter(({row:$})=>Object.values($).some(ve=>String(ve??"").toLowerCase().includes(V))):v;return g?K.toSorted(({row:$},{row:ve})=>{let Vt=String($[g.key]??"").localeCompare(String(ve[g.key]??""),"en",{numeric:!0});return g.direction==="asc"?Vt:-Vt}):K},[g,e.filterable,m,v]),G=V=>s?.(A(e,V)),R=o?.filter(V=>V==="csv")??[];return j(Ws,{inherit:r,children:Bt(k,{className:t,description:e.description,title:e.title,actions:j(so,{component:e,formats:R,viewAction:d,copyAction:()=>{io({...e,rows:P.map(({row:V})=>V)},"text").catch(()=>{})},onAction:n}),children:[e.filterable?j("div",{className:"aui-table__tools","data-slot":"agent-ui-table-tools",children:j(ut,{fullWidth:!0,"aria-label":`Filter ${e.title}`,name:`filter-${e.id}`,value:m,variant:"secondary",onChange:l,children:Bt(ut.Group,{children:[j(ut.SearchIcon,{}),j(ut.Input,{"data-slot":"agent-ui-table-filter",placeholder:"Filter rows\u2026"}),j(ut.ClearButton,{})]})})}):null,j("div",{className:"aui-table__scroll","data-slot":"agent-ui-table-scroll","data-variant":e.variant??"primary",children:Bt("table",{className:"aui-table","data-slot":"agent-ui-data-table",children:[j("thead",{"data-slot":"agent-ui-table-head",children:j("tr",{children:e.columns.map(V=>j("th",{scope:"col","aria-sort":g?.key===V.key?g.direction==="asc"?"ascending":"descending":"none",children:Bt("button",{className:"aui-table__sort","data-slot":"agent-ui-table-sort",type:"button",onClick:()=>h(K=>({direction:K?.key===V.key&&K.direction==="asc"?"desc":"asc",key:V.key})),children:[V.label,g?.key===V.key?j(zs,{"aria-hidden":"true",className:"aui-table__sort-indicator","data-slot":"agent-ui-table-sort-indicator","data-direction":g.direction==="asc"?"ascending":"descending"}):null]})},V.key))})}),j("tbody",{"data-slot":"agent-ui-table-body",children:P.length>0?P.map(({key:V,row:K})=>j("tr",{className:"aui-table__row","data-interactive":s?"true":void 0,"data-slot":"agent-ui-table-row",tabIndex:s?0:void 0,onClick:s?()=>G(K):void 0,onKeyDown:$=>{s&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),G(K))},children:e.columns.map($=>j("td",{"data-slot":"agent-ui-table-cell",children:no(K[$.key],$.format)},$.key))},V)):j("tr",{children:j("td",{className:"aui-table__empty",colSpan:e.columns.length,"data-slot":"agent-ui-table-empty",children:"No matching rows"})})})]})})]})})}import{Fragment as ol,jsx as T,jsxs as Jo}from"react/jsx-runtime";var Us=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.LineChartComponentContent}))),Hs=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.BarChartComponentContent}))),Zs=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.AreaChartComponentContent}))),$s=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.ComposedChartComponentContent}))),Ks=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.PieChartComponentContent}))),Os=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.DonutChartComponentContent}))),js=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.RadarChartComponentContent}))),qs=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.RadialChartComponentContent}))),Ys=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.SankeyChartComponentContent}))),Xs=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.ScatterChartComponentContent}))),Js=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.HeatmapComponentContent}))),Qs=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.CandlestickChartComponentContent}))),el=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.FunnelChartComponentContent}))),tl=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.GaugeChartComponentContent}))),al=X(()=>import("./chart-content-BBHQVMP4.js").then(t=>({default:t.SunburstChartComponentContent})));function Qo(t){return T(J,{props:t,renderChart:e=>T(Us,{...e})})}function en(t){return T(J,{props:t,renderChart:e=>T(Hs,{...e})})}function tn(t){return T(J,{props:t,renderChart:e=>T(Zs,{...e})})}function an(t){return T(J,{props:t,renderChart:e=>T($s,{...e})})}function on(t){return T(J,{props:t,renderChart:e=>T(Ks,{...e})})}function nn(t){return T(J,{props:t,renderChart:e=>T(Os,{...e})})}function rn(t){return T(J,{props:t,renderChart:e=>T(js,{...e})})}function sn(t){return T(J,{props:t,renderChart:e=>T(qs,{...e})})}function ln(t){return T(J,{props:t,renderChart:e=>T(Ys,{...e})})}function dn(t){return T(J,{props:t,renderChart:e=>T(Xs,{...e})})}function pn(t){return T(J,{props:t,renderChart:e=>T(Js,{...e})})}function cn(t){return T(J,{props:t,renderChart:e=>T(Qs,{...e})})}function mn(t){return T(J,{props:t,renderChart:e=>T(el,{...e})})}function un(t){return T(J,{props:t,renderChart:e=>T(tl,{...e})})}function gn(t){return T(J,{props:t,renderChart:e=>T(al,{...e})})}function J({props:t,renderChart:e}){let[o,r]=Gs("chart"),n={label:o==="chart"?"View as table":"View as chart",onAction:()=>r(d=>d==="chart"?"table":"chart"),target:o==="chart"?"table":"chart"},s=o==="table"?T(zt,{...t,inheritCardVariant:!0,component:ro(t.component),exportFormats:t.exportFormats?.filter(d=>d==="csv"),viewAction:n}):T(Es,{fallback:T(Sa,{className:t.className,kind:t.component.kind,title:t.component.title}),children:e({...t,viewAction:n})});return Jo(ol,{children:[s,Jo("span",{"aria-live":"polite",className:"aui-sr-only",children:["Showing ",t.component.title," as ",o]})]})}import{jsx as Le,jsxs as nl}from"react/jsx-runtime";function Cn({className:t,component:e,onSelect:o}){return Le(be,{variant:"plain",children:Le(k,{className:t,description:e.description,title:e.title,children:Le("div",{className:"aui-comparison","data-slot":"agent-ui-comparison-list",children:e.items.map(r=>nl("button",{className:"aui-comparison__item","data-slot":"agent-ui-comparison-item",type:"button",onClick:()=>o?.(A(e,r)),children:[Le("span",{className:"aui-comparison__label","data-slot":"agent-ui-comparison-label",children:r.label}),Le("span",{className:"aui-comparison__value","data-slot":"agent-ui-comparison-value",children:Ae(r.value,r.format)}),r.note?Le("span",{className:"aui-comparison__note","data-slot":"agent-ui-comparison-note",children:r.note}):Le("span",{}),r.change!==void 0?Le(Qe,{slot:"agent-ui-comparison-change",value:r.change}):null]},r.label))})})})}import{jsx as hn}from"react/jsx-runtime";function fn({children:t,className:e,component:o}){return hn(k,{className:e,description:o.description,title:o.title,children:hn("div",{className:"aui-dashboard","data-layout":o.layout,"data-slot":"agent-ui-dashboard",children:t})})}import{Briefcase as rl,Calendar as il,ChartBar as sl,CircleCheck as ll,CircleDollar as dl,CircleExclamation as pl,CircleInfo as cl,CircleQuestion as ml,Clock as ul,Code as gl,CreditCard as Cl,Database as hl,Display as fl,Envelope as bl,FileText as yl,Flag as xl,Globe as wl,Heart as vl,House as kl,Magnifier as Sl,MapPin as Nl,Percent as Pl,Person as Vl,Persons as _l,Pulse as Tl,Receipt as Il,Rocket as Al,Route as Rl,ShoppingBag as Ll,Smartphone as Fl,Speedometer as Ml,Star as Dl,Tag as Bl,Target as zl,Thunderbolt as Wl}from"@gravity-ui/icons";import{jsx as Gl}from"react/jsx-runtime";var El={activity:Tl,alert:pl,briefcase:rl,calendar:il,chart:sl,check:ll,clock:ul,code:gl,"credit-card":Cl,database:hl,"device-desktop":fl,"device-mobile":Fl,document:yl,dollar:dl,flag:xl,globe:wl,heart:vl,home:kl,info:cl,lightning:Wl,location:Nl,mail:bl,percent:Pl,person:Vl,question:ml,receipt:Il,rocket:Al,route:Rl,search:Sl,"shopping-bag":Ll,speedometer:Ml,star:Dl,tag:Bl,target:zl,users:_l};function q({name:t,...e}){let o=El[t];return Gl(o,{...e,"aria-hidden":"true","data-icon":t,focusable:"false"})}import{useId as Hl}from"react";var Wt={height:40,width:100},bn=3;function Ul(t,e){let o=[];for(let n=0;n<t.length-1;n+=1)o.push((t[n+1]-t[n])/e);let r=[o[0]??0];for(let n=1;n<t.length-1;n+=1){let s=o[n-1],d=o[n];r.push(s*d<=0?0:(s+d)/2)}r.push(o[o.length-1]??0);for(let n=0;n<o.length;n+=1){let s=o[n];if(s===0){r[n]=0,r[n+1]=0;continue}let d=r[n]/s,m=r[n+1]/s,l=d*d+m*m;if(l>9){let y=3/Math.sqrt(l);r[n]=y*d*s,r[n+1]=y*m*s}}return r}function yn(t){let e=t.filter(R=>Number.isFinite(R));if(e.length<2)return null;let{height:o,width:r}=Wt,n=bn,s=o-bn,d=Math.min(...e),l=Math.max(...e)-d,y=r/(e.length-1),h=R=>R*y,u=R=>l===0?o/2:s-(R-d)/l*(s-n),g=e.map(u),v=Ul(g,y),P=[`M ${Fe(h(0))} ${Fe(g[0])}`];for(let R=0;R<e.length-1;R+=1){let V=y/3;P.push(`C ${Fe(h(R)+V)} ${Fe(g[R]+v[R]*V)} ${Fe(h(R+1)-V)} ${Fe(g[R+1]-v[R+1]*V)} ${Fe(h(R+1))} ${Fe(g[R+1])}`)}let G=P.join(" ");return{area:`${G} V ${o} H 0 Z`,line:G}}function Fe(t){return Math.round(t*100)/100}import{jsx as gt,jsxs as xn}from"react/jsx-runtime";function wn({color:t,values:e}){let o=Hl(),r=yn(e);return r?xn("svg",{"aria-hidden":"true",className:"aui-sparkline","data-slot":"agent-ui-sparkline",preserveAspectRatio:"none",viewBox:`0 0 ${Wt.width} ${Wt.height}`,children:[gt("defs",{children:xn("linearGradient",{id:o,x1:"0",x2:"0",y1:"0",y2:"1",children:[gt("stop",{offset:"0%",stopColor:t,stopOpacity:.22}),gt("stop",{offset:"100%",stopColor:t,stopOpacity:.02})]})}),gt("path",{className:"aui-sparkline__area",d:r.area,fill:`url(#${o})`}),gt("path",{className:"aui-sparkline__line",d:r.line,fill:"none",stroke:t,strokeLinecap:"round",strokeWidth:1.75,vectorEffect:"non-scaling-stroke"})]}):null}import{jsx as Ne,jsxs as Et}from"react/jsx-runtime";function vn({className:t,component:e}){return Ne(k,{className:t,description:e.description,title:e.title,variant:"outline",children:Ne("div",{className:"aui-kpi-grid","data-slot":"agent-ui-kpi-grid",children:e.metrics.map(o=>Et("article",{className:"aui-kpi aui-kpi--chart","data-slot":"agent-ui-kpi",children:[Et("header",{className:"aui-kpi__header","data-slot":"agent-ui-kpi-header",children:[Ne("span",{className:"aui-kpi__title","data-slot":"agent-ui-kpi-title",children:o.label}),o.icon?Ne("span",{className:"aui-kpi__icon","data-slot":"agent-ui-kpi-icon",children:Ne(q,{name:o.icon})}):null]}),Et("div",{className:"aui-kpi__body","data-slot":"agent-ui-kpi-body",children:[Et("div",{className:"aui-kpi__metric","data-slot":"agent-ui-kpi-metric",children:[Ne("p",{className:"aui-kpi__value","data-slot":"agent-ui-kpi-value",children:Ae(o.value,o.format)}),o.change!==void 0?Ne(Qe,{slot:"agent-ui-kpi-change",value:o.change}):null]}),Ne("div",{className:"aui-kpi__chart","data-slot":"agent-ui-kpi-chart",children:Ne(wn,{color:lo[o.color??"accent"],values:o.trend})})]})]},o.label))})})}import{Description as Zl,Label as $l,Meter as Gt}from"@heroui/react";import{jsx as Ue,jsxs as Kl}from"react/jsx-runtime";function kn({className:t,component:e}){return Ue(k,{className:t,description:e.description,title:e.title,variant:"outline",children:Ue("div",{className:"aui-meter-list","data-slot":"agent-ui-meter-list",children:e.items.map(o=>{let r=o.min??0,n=o.max??(o.format?.style==="percent"?1:100);return Kl(Gt,{"aria-label":o.label,className:"aui-meter-list__item",color:o.tone??"accent","data-slot":"agent-ui-meter",maxValue:n,minValue:r,size:"sm",value:o.value,valueLabel:Ae(o.value,o.format),children:[Ue($l,{"data-slot":"agent-ui-meter-label",children:o.label}),Ue(Gt.Output,{"data-slot":"agent-ui-meter-output"}),Ue(Gt.Track,{"data-slot":"agent-ui-meter-track",children:Ue(Gt.Fill,{})}),o.description?Ue(Zl,{"data-slot":"agent-ui-meter-description",children:o.description}):null]},o.id)})})})}import{jsx as He,jsxs as Pa}from"react/jsx-runtime";function Sn({className:t,component:e}){return He(k,{className:t,description:e.description,title:e.title,variant:"outline",children:He("div",{className:"aui-metric-grid","data-slot":"agent-ui-metric-grid",children:e.metrics.map(o=>Pa("article",{className:"aui-kpi","data-slot":"agent-ui-kpi",children:[Pa("header",{className:"aui-kpi__header","data-slot":"agent-ui-kpi-header",children:[He("span",{className:"aui-kpi__title","data-slot":"agent-ui-kpi-title",children:o.label}),o.icon?He("span",{className:"aui-kpi__icon","data-slot":"agent-ui-kpi-icon",children:He(q,{name:o.icon})}):null]}),Pa("div",{className:"aui-kpi__content","data-slot":"agent-ui-kpi-content",children:[He("p",{className:"aui-kpi__value","data-slot":"agent-ui-kpi-value",children:Ae(o.value,o.format)}),o.change!==void 0?He(Qe,{slot:"agent-ui-kpi-change",value:o.change}):null]})]},o.label))})})}import{Accordion as Ze,Checkbox as Ht,Description as Mn,Label as Dn,Modal as de,ProgressBar as Zt,Tabs as tt,Tag as id,TagGroup as Fn}from"@heroui/react";import{useCallback as $t,useMemo as sd,useState as ft}from"react";import{ArrowRotateLeft as Yl,Minus as Xl,Plus as Jl}from"@gravity-ui/icons";import{Button as Ut,Modal as Ct,Separator as Vn,Tooltip as Me}from"@heroui/react";import{useCallback as Ql,useEffect as ed,useId as td,useLayoutEffect as ad,useRef as _a,useState as ht}from"react";var Nn="Inter, ui-sans-serif, system-ui, sans-serif";function Ol(t){let e=t??(typeof document>"u"?null:document.body);return e&&getComputedStyle(e).fontFamily.trim()||Nn}async function jl(){let t=(await import("mermaid")).default;return t.initialize({securityLevel:"strict",startOnLoad:!1,theme:"base"}),t}var Va=null;function ql(){return Va??=jl().catch(t=>{throw Va=null,t}),Va}async function Pn(t){let e=await ql();return e.initialize({themeVariables:{fontFamily:Ol(t),fontSize:"13px"}}),e}import{jsx as L,jsxs as Pe}from"react/jsx-runtime";var _n=.5,Tn=4,In=.25;function od(){return L("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:L("path",{d:"M9.5 2.5H13v3.5M6.5 13.5H3V10M13 2.5l-4 4M3 13.5l4-4",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function An(t,e,o,r){let[n,s]=ht(null),[d,m]=ht(!1),l=_a(null);return ed(()=>{if(!o)return;let y=!1;async function h(){try{let u=await Pn(r?.current??l.current);await u.parse(t);let{svg:g}=await u.render(e,t,l.current??void 0);if(y)return;m(!1),s({key:t,markup:g})}catch{if(y)return;s(null),m(!0)}}return h(),()=>{y=!0}},[t,o,r,e]),{container:l,failed:d,markup:n?.key===t?n.markup:null}}function Rn({markup:t,pendingRef:e,scale:o}){let r=_a(null);return ad(()=>{let n=r.current;if(!(!n||!t))return n.replaceChildren(ao(t)),()=>n.replaceChildren()},[t]),t?L("div",{ref:r,className:"aui-diagram__surface","data-slot":"agent-ui-diagram-surface",role:"img",style:o===void 0?void 0:{"--aui-diagram-scale":o}}):L("div",{ref:e,className:"aui-diagram__surface","data-pending":"true"})}function Ln({chart:t,title:e}){let o=td().replace(/[^a-zA-Z0-9]/g,""),r=_a(null),n=An(t,`aui-diagram-${o}`,!0,r),[s,d]=ht(!1),m=An(t,`aui-diagram-modal-${o}`,s,r),[l,y]=ht(1),[h,u]=ht(),g=Ql(P=>{r.current=P,u(ie(P))},[]),v=P=>y(G=>Math.min(Tn,Math.max(_n,G+P)));return n.failed?L(At,{code:t,language:"mermaid"}):Pe("div",{ref:g,className:"aui-diagram","data-slot":"agent-ui-diagram",children:[L(Rn,{markup:n.markup,pendingRef:n.container}),n.markup?Pe(Ct,{isOpen:s,onOpenChange:P=>{d(P),P||y(1)},children:[L(Ut,{isIconOnly:!0,"aria-label":"Expand diagram",className:"aui-diagram__expand","data-slot":"agent-ui-diagram-expand",size:"sm",variant:"ghost",onPress:()=>d(!0),children:L(od,{})}),L(Ct.Backdrop,{className:"aui-diagram-modal__backdrop",UNSTABLE_portalContainer:h,variant:"blur",children:L(Ct.Container,{className:"aui-diagram-modal__container",placement:"center",children:Pe(Ct.Dialog,{"aria-label":e?`${e} diagram`:"Diagram",className:"aui-diagram-modal__dialog","data-slot":"agent-ui-diagram-modal",children:[L("div",{className:"aui-diagram-modal__controls",children:Pe("div",{"aria-label":"Diagram zoom controls",className:"aui-diagram-modal__control-group",role:"toolbar",children:[Pe(Me,{delay:0,children:[L(Ut,{isIconOnly:!0,"aria-label":"Zoom out",isDisabled:l<=_n,size:"sm",variant:"ghost",onPress:()=>v(-In),children:L(Xl,{})}),L(Me.Content,{placement:"top",children:"Zoom out"})]}),Pe(Me,{delay:0,children:[L(Ut,{isIconOnly:!0,"aria-label":"Zoom in",isDisabled:l>=Tn,size:"sm",variant:"ghost",onPress:()=>v(In),children:L(Jl,{})}),L(Me.Content,{placement:"top",children:"Zoom in"})]}),Pe("output",{"aria-label":`Zoom level: ${Math.round(l*100)}%`,className:"aui-diagram-modal__zoom-level",children:[Math.round(l*100),"%"]}),L(Vn,{className:"aui-diagram-modal__separator",orientation:"vertical"}),Pe(Me,{delay:0,children:[L(Ut,{isIconOnly:!0,"aria-label":"Reset zoom",isDisabled:l===1,size:"sm",variant:"ghost",onPress:()=>y(1),children:L(Yl,{})}),L(Me.Content,{placement:"top",children:"Reset zoom"})]}),L(Vn,{className:"aui-diagram-modal__separator",orientation:"vertical"}),Pe(Me,{delay:0,children:[L(Ct.CloseTrigger,{className:"aui-diagram-modal__close"}),L(Me.Content,{placement:"top",children:"Close"})]})]})}),L("div",{className:"aui-diagram-modal__viewport",children:L(Rn,{markup:m.markup,pendingRef:m.container,scale:l})})]})})})]}):null]})}import{Picture as nd}from"@gravity-ui/icons";import{useState as rd}from"react";import{jsx as Ta}from"react/jsx-runtime";function me({alt:t="",className:e,decoding:o,loading:r,onError:n,onLoadFailure:s,referrerPolicy:d,sizes:m,src:l,srcSet:y,...h}){let[u,g]=rd();return!l||u===l?Ta("span",{...h,"aria-hidden":t?void 0:!0,"aria-label":t||void 0,className:b("aui-image-fallback",e),"data-slot":"agent-ui-image-fallback",role:t?"img":void 0,children:Ta(nd,{"aria-hidden":"true"})}):Ta("img",{...h,alt:t,className:e,decoding:o,loading:r,referrerPolicy:d,sizes:m,src:l,srcSet:y,onError:v=>{g(l),typeof l=="string"&&s?.(l),n?.(v)}})}import{Fragment as dd,jsx as C,jsxs as Z}from"react/jsx-runtime";function Bn({className:t,component:e}){return e.variant==="clear"?C("div",{"aria-label":e.title,className:b("aui-prose",t),"data-slot":"agent-ui-text","data-variant":"clear",children:Je(e.content)}):C(k,{className:t,description:e.description,title:e.title,children:C("div",{className:"aui-prose","data-slot":"agent-ui-text","data-variant":"card",children:Je(e.content)})})}function zn({className:t,component:e}){return C(k,{className:t,description:e.description,title:e.title,children:Z("div",{className:"aui-callout","data-has-icon":e.icon?"true":void 0,"data-slot":"agent-ui-callout","data-tone":e.tone??"neutral",children:[e.icon?C(q,{className:"aui-callout__icon","data-slot":"agent-ui-callout-icon",name:e.icon}):C("span",{"aria-hidden":"true",className:"aui-callout__indicator","data-slot":"agent-ui-callout-indicator"}),C("p",{"data-slot":"agent-ui-callout-content",children:Je(e.content)})]})})}function Wn({className:t,component:e,onSelect:o}){let r=e.variant??"grid",[n,s]=ft(),[d,m]=ft(()=>new Set),l=$t(u=>{s(ie(u))},[]),y=$t(u=>{m(g=>{if(g.has(u))return g;let v=new Set(g);return v.add(u),v})},[]),h=e.images.map(u=>{let g=d.has(u.src),v=Z(dd,{children:[C("span",{className:"aui-image__frame","data-slot":"agent-ui-image-frame",children:C(me,{alt:u.alt,"data-aspect-ratio":u.aspectRatio??"landscape","data-slot":"agent-ui-image",loading:"lazy",src:g?void 0:u.src,onLoadFailure:y})}),u.caption?C("span",{className:"aui-image__caption","data-slot":"agent-ui-image-caption",children:u.caption}):null]});return g?C("span",{className:"aui-image","data-failed":"true","data-slot":"agent-ui-image-item",children:v},u.src):Z(de,{children:[C(de.Trigger,{"aria-label":`Open ${u.alt}`,className:"aui-image","data-slot":"agent-ui-image-item",onClick:()=>o?.(A(e,u)),children:v}),C(de.Backdrop,{className:"aui-image-modal__backdrop",UNSTABLE_portalContainer:n,variant:"blur",children:C(de.Container,{className:"aui-image-modal__container",placement:"center",children:Z(de.Dialog,{"aria-label":u.alt,className:"aui-image-modal__dialog","data-slot":"agent-ui-image-modal",children:[C(de.CloseTrigger,{className:"aui-image-modal__close"}),C("img",{alt:u.alt,className:"aui-image-modal__image",src:u.src})]})})})]},u.src)});return C(k,{className:t,description:e.description,title:e.title,children:C("div",{ref:l,className:"aui-images-container","data-layout":r,children:r==="horizontal"?C(It,{"aria-label":`${e.title} gallery`,className:"aui-images","data-count":e.images.length,"data-layout":r,role:"region",size:24,tabIndex:0,children:h}):C("div",{className:"aui-images","data-count":e.images.length,"data-layout":r,"data-slot":"agent-ui-images",children:h})})})}function En({className:t,component:e,onSelect:o}){return C(k,{className:t,description:e.description,title:e.title,children:C(Fn,{"aria-label":e.title,className:"aui-tags","data-slot":"agent-ui-tags",selectionMode:"single",size:"sm",onSelectionChange:r=>{let n=[...r][0];typeof n=="string"&&o?.(A(e,{tag:n}))},children:C(Fn.List,{children:e.tags.map(r=>C(id,{className:"aui-tag","data-slot":"agent-ui-tag",id:r,children:r},r))})})})}function Gn({className:t,component:e}){let o=e.style??"bulleted";return C(k,{className:t,description:e.description,title:e.title,children:C("ul",{"aria-label":e.title,className:"aui-list","data-slot":"agent-ui-list","data-style":o,children:e.items.map((r,n)=>Z("li",{className:"aui-list__item","data-slot":"agent-ui-list-item",children:[o==="checklist"?C(Ht,{isReadOnly:!0,"aria-label":r.text,className:"aui-list__checkbox","data-slot":"agent-ui-list-check",isSelected:r.checked??!1,variant:"secondary",children:C(Ht.Content,{children:C(Ht.Control,{children:C(Ht.Indicator,{})})})}):C("span",{"aria-hidden":"true",className:"aui-list__marker","data-slot":"agent-ui-list-marker",children:o==="numbered"?`${n+1}.`:"\u2022"}),Z("span",{className:"aui-list__body","data-slot":"agent-ui-list-content",children:[C(Dn,{"data-slot":"agent-ui-list-label",children:r.text}),r.children?.length?C("span",{className:"aui-list__children","data-slot":"agent-ui-list-children",children:r.children.map(s=>C(Mn,{"data-slot":"agent-ui-list-child",children:s},s))}):null]})]},r.id))})})}function ld(t){return/^\+/.test(t)?"success":/^[-−]\S/.test(t)?"danger":"neutral"}function Un({className:t,component:e}){return C(k,{className:t,description:e.description,title:e.title,variant:"outline",children:C("ul",{"aria-label":e.title,className:"aui-list-block","data-slot":"agent-ui-list-block",children:e.items.map(o=>Z("li",{className:"aui-list-block__item","data-slot":"agent-ui-list-block-item",children:[o.imageUrl?C(me,{alt:o.imageAlt??"",className:"aui-list-block__image","data-slot":"agent-ui-list-block-image",loading:"lazy",src:o.imageUrl}):C("span",{"aria-hidden":"true",className:"aui-list-block__glyph","data-slot":"agent-ui-list-block-glyph",children:o.icon?C(q,{"data-slot":"agent-ui-list-block-icon",name:o.icon}):o.title.trim().charAt(0).toUpperCase()}),Z("span",{className:"aui-list-block__body","data-slot":"agent-ui-list-block-content",children:[C(Dn,{className:"aui-list-block__title","data-slot":"agent-ui-list-block-title",children:o.title}),o.description?C(Mn,{className:"aui-list-block__description","data-slot":"agent-ui-list-block-description",children:o.description}):null]}),o.meta||o.rating!==void 0?Z("span",{className:"aui-list-block__footer","data-slot":"agent-ui-list-block-footer",children:[o.meta?C("span",{className:"aui-list-block__meta","data-slot":"agent-ui-list-block-meta","data-tone":ld(o.meta),children:o.meta}):null,o.meta&&o.rating!==void 0?C("span",{"aria-hidden":"true",className:"aui-list-block__meta-separator",children:"\xB7"}):null,o.rating!==void 0?Z("span",{"aria-label":`${o.rating} out of 5 stars`,className:"aui-list-block__rating","data-slot":"agent-ui-list-block-rating",children:[Z("span",{"aria-hidden":"true",children:[o.rating,"/5"]}),C(q,{"aria-hidden":"true",className:"aui-list-block__rating-icon","data-slot":"agent-ui-list-block-rating-icon",name:"star"})]}):null]}):null]},o.id))})})}function Hn({className:t,component:e}){return C(k,{className:t,description:e.description,title:e.title,children:C(Ze,{allowsMultipleExpanded:!0,className:"aui-accordion","data-slot":"agent-ui-accordion",defaultExpandedKeys:e.sections.filter(o=>o.defaultOpen).map(o=>o.id),children:e.sections.map(o=>Z(Ze.Item,{"data-slot":"agent-ui-accordion-item",id:o.id,children:[C(Ze.Heading,{children:Z(Ze.Trigger,{"data-slot":"agent-ui-accordion-trigger",children:[o.title,C(Ze.Indicator,{"data-slot":"agent-ui-accordion-indicator"})]})}),C(Ze.Panel,{"data-slot":"agent-ui-accordion-panel",children:C(Ze.Body,{children:o.content})})]},o.id))})})}function Zn({className:t,component:e,onSelect:o}){let[r,n]=ft(),[s,d]=ft(()=>new Set),m=e.steps.some(u=>u.icon),l=e.steps.some(u=>u.image),y=$t(u=>{n(ie(u))},[]),h=$t(u=>{d(g=>{if(g.has(u))return g;let v=new Set(g);return v.add(u),v})},[]);return C(k,{className:t,description:e.description,title:e.title,children:C("ol",{ref:y,className:"aui-steps","data-has-icons":m||void 0,"data-has-images":l||void 0,"data-slot":"agent-ui-steps","data-variant":e.variant??"steps",children:e.steps.map((u,g)=>{let v=u.status==="complete"?"completed":u.status==="current"?"in-progress":u.status==="upcoming"?"pending":u.status??"pending",P=u.image?s.has(u.image.src):!1,G=C("span",{className:"aui-steps__marker","data-slot":"agent-ui-step-indicator",children:e.variant==="timeline"?u.icon?C(q,{"aria-hidden":"true","data-slot":"agent-ui-step-icon",name:u.icon}):null:v==="completed"?C("svg",{"aria-hidden":"true","data-slot":"agent-ui-step-checkmark",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",viewBox:"0 0 24 24",children:C("polyline",{points:"20 6 9 17 4 12"})}):v==="failed"?C("span",{"aria-hidden":"true",children:"\xD7"}):v==="blocked"?C("span",{"aria-hidden":"true",children:"!"}):v==="cancelled"?C("span",{"aria-hidden":"true",children:"\u2013"}):u.icon?C(q,{"aria-hidden":"true","data-slot":"agent-ui-step-icon",name:u.icon}):g+1});return C("li",{"data-has-image":u.image?"true":void 0,"data-slot":"agent-ui-step","data-status":v,children:Z("div",{className:"aui-steps__row",children:[u.image?P?C("span",{className:"aui-steps__image-marker","data-failed":"true","data-slot":"agent-ui-step-image-marker",children:C(me,{alt:u.image.alt,className:"aui-steps__image","data-slot":"agent-ui-step-image"})}):Z(de,{children:[C(de.Trigger,{"aria-label":`Open ${u.image.alt}`,className:"aui-steps__image-marker","data-slot":"agent-ui-step-image-trigger",onClick:()=>o?.(A(e,u)),children:C(me,{alt:u.image.alt,className:"aui-steps__image","data-slot":"agent-ui-step-image",loading:"lazy",src:u.image.src,onLoadFailure:h})}),C(de.Backdrop,{className:"aui-image-modal__backdrop",UNSTABLE_portalContainer:r,variant:"blur",children:C(de.Container,{className:"aui-image-modal__container",placement:"center",children:Z(de.Dialog,{"aria-label":u.image.alt,className:"aui-image-modal__dialog","data-slot":"agent-ui-image-modal",children:[C(de.CloseTrigger,{className:"aui-image-modal__close"}),C(me,{alt:u.image.alt,className:"aui-image-modal__image",src:u.image.src})]})})})]}):G,C("button",{className:"aui-steps__content-action","data-slot":"agent-ui-step-action",type:"button",onClick:()=>o?.(A(e,u)),children:Z("span",{"data-slot":"agent-ui-step-content",children:[u.timestamp||u.meta?C("span",{className:"aui-steps__meta","data-slot":"agent-ui-step-meta",children:[u.timestamp,u.meta].filter(Boolean).join(" \xB7 ")}):null,C("strong",{"data-slot":"agent-ui-step-title",children:u.title}),u.content?C("small",{"data-slot":"agent-ui-step-description",children:u.content}):null,u.progress!==void 0?Z(Zt,{"aria-label":`${u.title} progress`,className:"aui-steps__progress",size:"sm",value:u.progress,color:v==="failed"?"danger":v==="blocked"?"warning":"accent",children:[C(Zt.Output,{}),C(Zt.Track,{children:C(Zt.Fill,{})})]}):null]})})]})},u.id)})})})}function $n({className:t,component:e}){return C(k,{className:t,description:e.description,title:e.title,children:C(At,{code:e.code,language:e.language})})}function Kn({className:t,component:e}){return C(k,{className:t,description:e.description,title:e.title,children:C(Ln,{chart:e.chart,title:e.title})})}function On({className:t,component:e,onSelect:o,renderPanel:r}){let n=sd(()=>new Set(e.tabs.map(l=>l.id)),[e.tabs]),[s,d]=ft(e.defaultValue??e.tabs[0]?.id??""),m=n.has(s)?s:e.defaultValue??e.tabs[0]?.id??"";return C(k,{className:t,description:e.description,title:e.title,children:C("div",{className:"aui-tabs","data-slot":"agent-ui-tabs",children:Z(tt,{selectedKey:m,variant:e.variant,onSelectionChange:l=>{let y=String(l),h=e.tabs.find(u=>u.id===y);d(y),h&&o?.(A(e,h))},children:[C(tt.ListContainer,{children:C(tt.List,{"aria-label":e.title,children:e.tabs.map(l=>Z(tt.Tab,{id:l.id,children:[l.label,C(tt.Indicator,{})]},l.id))})}),e.tabs.map(l=>C(tt.Panel,{className:"aui-tabs__panel","data-content":l.children?"rich":"text",id:l.id,children:l.children?C("div",{className:"aui-tabs__panel-content",children:r?.(l.children)??null}):l.content},l.id))]})})})}import{Fragment as cd,jsx as $e,jsxs as Ia}from"react/jsx-runtime";function pd({left:t,middle:e,right:o}){return Ia(cd,{children:[t?$e("div",{className:"item-card__icon","data-slot":"item-card-icon",children:t}):null,$e("div",{className:"item-card__content","data-slot":"item-card-content",children:e}),o?$e("div",{className:"item-card__action","data-slot":"item-card-action",children:o}):null]})}function jn({className:t,component:e,left:o,middle:r,onAction:n,onSelect:s,right:d}){let m=pd({left:o,middle:r,right:d}),l=b("item-card",`item-card--${e.variant??"default"}`,"aui-item-card",t),y={"aria-label":e.title,className:l,"data-component-kind":e.kind,"data-disabled":e.isDisabled||void 0,"data-selected":e.isSelected||void 0};if(!e.action)return $e("div",{"data-slot":"item-card",...y,children:m});let h=e.action;return $e("button",{...y,"aria-pressed":e.isSelected||void 0,"data-slot":"item-card",disabled:e.isDisabled,type:"button",onClick:()=>{if(e.isDisabled)return;let u=se(e.id,h);u&&n?n(u):s?.(A(e,{actionId:h.id,itemId:e.id}))},children:m})}function qn({children:t,className:e,component:o}){let r=o.layout==="grid"&&o.columns?{"--item-card-group-columns":o.columns}:void 0;return Ia("div",{"aria-label":o.title,"data-component-kind":o.kind,"data-slot":"item-card-group",role:"group",style:r,className:b("item-card-group",`item-card-group--${o.layout??"list"}`,`item-card-group--${o.variant??"default"}`,"aui-item-card-group",e),children:[o.showHeader?Ia("div",{className:"item-card-group__header","data-slot":"item-card-group-header",children:[$e("h3",{className:"item-card-group__title","data-slot":"item-card-group-title",children:o.title}),o.description?$e("p",{className:"item-card-group__description","data-slot":"item-card-group-description",children:o.description}):null]}):null,t]})}import{Children as hd}from"react";import{Picture as md}from"@gravity-ui/icons";import{useState as ud}from"react";import{jsx as Q}from"react/jsx-runtime";var gd={center:"center",end:"flex-end",start:"flex-start",stretch:"stretch"},Cd={between:"space-between",center:"center",end:"flex-end",start:"flex-start"};function ot(t){return typeof t=="number"?`${t}px`:t}function at(t){return t===void 0?void 0:`calc(var(--spacing) * ${t})`}function Yn(t){return typeof t=="number"?{padding:at(t)}:t?{paddingBottom:at(t.bottom??t.y),paddingLeft:at(t.left??t.x),paddingRight:at(t.right??t.x),paddingTop:at(t.top??t.y)}:{}}function Aa({align:t,background:e,flex:o,gap:r,height:n,justify:s,minHeight:d,minWidth:m,padding:l,radius:y,style:h,width:u,...g}){return{elementProps:g,style:{alignItems:t?gd[t]:void 0,background:e,flex:o,gap:at(r),height:ot(n),justifyContent:s?Cd[s]:void 0,minHeight:ot(d),minWidth:ot(m),width:ot(u),...Yn(l),...h}}}function Xn({background:t,className:e,padding:o,size:r="md",style:n,theme:s="light",...d}){return Q("section",{"data-size":r,"data-theme":s,style:{background:t,...Yn(o),...n},className:b("aui-widget-card",s==="dark"?"dark":void 0,e),...d})}function Kt({className:t,radius:e,...o}){let{elementProps:r,style:n}=Aa(o);return Q("div",{className:b("aui-widget-row",t),"data-radius":e,style:n,...r})}function Ot({className:t,radius:e,...o}){let{elementProps:r,style:n}=Aa(o);return Q("div",{className:b("aui-widget-col",t),"data-radius":e,style:n,...r})}function Jn({className:t,radius:e,...o}){let{elementProps:r,style:n}=Aa(o);return Q("div",{className:b("aui-widget-box",t),"data-radius":e,style:n,...r})}function jt({className:t}){return Q("span",{"aria-hidden":"true",className:b("aui-widget-spacer",t)})}function bt({className:t,flush:e=!1}){return Q("hr",{className:b("aui-widget-divider",t),"data-flush":e||void 0})}function Ra({align:t,color:e="default",maxLines:o,size:r,style:n,truncate:s,value:d,weight:m,...l}){return{elementProps:l,visualProps:{"data-align":t,"data-color":e,"data-max-lines":o,"data-size":r,"data-truncate":s||void 0,"data-weight":m,style:{...n,WebkitLineClamp:o}}}}function Qn({children:t,className:e,value:o,...r}){let{elementProps:n,visualProps:s}=Ra(r);return Q("span",{className:b("aui-widget-text",e),...s,...n,children:o??t})}function er({children:t,className:e,value:o,...r}){let{elementProps:n,visualProps:s}=Ra(r);return Q("h3",{className:b("aui-widget-title",e),...s,...n,children:o??t})}function qt({children:t,className:e,value:o,...r}){let{elementProps:n,visualProps:s}=Ra(r);return Q("span",{className:b("aui-widget-caption",e),...s,...n,children:o??t})}function Ve({alt:t="",className:e,fit:o="cover",flush:r,frame:n,height:s,onError:d,radius:m,size:l,src:y,style:h,width:u,...g}){let[v,P]=ud(),G={"data-flush":r||void 0,"data-frame":n||void 0,"data-radius":m,style:{height:ot(l??s),objectFit:o,width:ot(l??u),...h}};return!y||v===y?Q("span",{"aria-hidden":t?void 0:!0,"aria-label":t||void 0,className:b("aui-widget-image","aui-image-fallback",e),"data-slot":"agent-ui-image-fallback",role:t?"img":void 0,...G,children:Q(md,{"aria-hidden":"true"})}):Q("img",{alt:t,className:b("aui-widget-image",e),src:y,onError:R=>{P(y),d?.(R)},...G,...g})}function tr({children:t,className:e,size:o}){return Q("span",{className:b("aui-widget-icon",e),style:o!==void 0?{height:o,width:o}:void 0,children:t})}function ar({className:t,...e}){return Q("div",{className:b("aui-widget-actions",t),...e})}function or(t){return Q(fe,{...t})}import{jsx as De}from"react/jsx-runtime";function La({children:t,className:e,component:o}){return De("div",{className:b("aui-row",e),"data-align":o.align,"data-gap":o.gap,"data-justify":o.justify,"data-slot":"agent-ui-row",children:t})}function Fa({children:t,className:e,component:o}){return De("div",{className:b("aui-col",e),"data-align":o.align,"data-gap":o.gap,"data-justify":o.justify,"data-slot":"agent-ui-col",children:t})}function Ma({children:t,className:e,component:o}){let r=o.columns===1&&o.children.length>1&&o.children.every(s=>s.kind==="record-card"),n=r?hd.toArray(t).flatMap((s,d)=>d===0?[s]:[De(bt,{className:"aui-record-list__divider"},`${o.id}-record-divider-${o.children[d]?.id}`),s]):t;return De("div",{className:b("aui-grid",e),"data-columns":o.columns,"data-gap":o.gap,"data-presentation":r?"record-list":void 0,"data-slot":"agent-ui-grid",children:n})}function Da({children:t,className:e,component:o}){return De(k,{className:e,description:o.description,title:o.title,variant:o.variant,children:De("div",{className:"aui-card-stack","data-slot":"agent-ui-card-stack",children:t})})}function Ba({className:t,component:e}){return De("span",{"aria-hidden":"true",className:b("aui-spacer",t),"data-size":e.size??"auto","data-slot":"agent-ui-spacer"})}function za({className:t}){return De(bt,{className:t})}import{ChevronLeft as xd,ChevronRight as wd,MapPin as vd,StarFill as lr}from"@gravity-ui/icons";import{Modal as Xt}from"@heroui/react";import{AnimatePresence as nr,LazyMotion as kd,domAnimation as Sd,m as Nd,useIsPresent as Pd,useReducedMotion as Vd}from"motion/react";import{Suspense as _d,forwardRef as Td,lazy as Id,useCallback as _e,useEffect as rr,useId as Ad,useMemo as dr,useRef as Wa,useState as nt}from"react";import{createContext as fd,useContext as bd}from"react";var yd=fd(void 0);function Yt(){return bd(yd)}import{Fragment as $d,jsx as x,jsxs as E}from"react/jsx-runtime";var Rd=new Intl.NumberFormat(void 0,{maximumFractionDigits:1,minimumFractionDigits:1}),ir=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),Ld={duration:.32,ease:[.22,1,.36,1]},Fd={duration:0},Md={center:{opacity:1,transform:"translateX(0px)"},enter:t=>({opacity:0,transform:`translateX(${t*24}px)`}),exit:t=>({opacity:0,transform:`translateX(${t*-24}px)`})},Dd={center:{opacity:1,transform:"translateX(0px)"},enter:t=>({opacity:0,transform:`translateX(${t*32}px)`}),exit:t=>({opacity:0,transform:`translateX(${t*-32}px)`})},Bd=Id(async()=>({default:(await import("./interactive-map-surface-WC2LPCR7.js")).InteractiveMapSurface}));function Jt(t){return Rd.format(t)}function pr(t){return t.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toLocaleUpperCase()??"").join("")}function zd(){return typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0}function Wd({className:t,location:e}){let o=e.images?.[0],[r,n]=nt();return!o||r===o.src?x("span",{"aria-hidden":"true",className:b(t,"aui-map__image-fallback"),children:pr(e.title)}):x(Ve,{alt:o.alt,className:t,decoding:"async",loading:"lazy",referrerPolicy:"no-referrer",src:o.src,onError:()=>n(o.src)})}function Ed(t){return t?.split(",").at(-1)?.trim()}var sr=Td(function({children:e,className:o,direction:r,transition:n,variants:s},d){let m=Pd();return x(Nd.div,{ref:d,animate:"center","aria-hidden":m?void 0:!0,className:o,custom:r,"data-direction":r,exit:"exit",inert:m?void 0:!0,initial:"enter",transition:n,variants:s,children:e})});function cr({location:t,showCategory:e=!0}){let o=t.rating===void 0?void 0:`${Jt(t.rating)} out of 5${t.reviewCount===void 0?"":`, ${ir.format(t.reviewCount)} reviews`}`;return E("span",{className:"aui-map__metadata","data-slot":"agent-ui-map-location-metadata",children:[t.rating!==void 0?E("span",{"aria-label":o,className:"aui-map__rating",children:[x("span",{"aria-hidden":"true",children:Jt(t.rating)}),x(lr,{"aria-hidden":"true"})]}):null,t.reviewCount!==void 0?E("span",{"aria-hidden":"true",children:[ir.format(t.reviewCount)," reviews"]}):null,e&&t.category?E($d,{children:[x("span",{"aria-hidden":"true",className:"aui-map__metadata-separator",children:"\xB7"}),x("span",{children:t.category})]}):null]})}function Gd({component:t,onSelect:e,selectedLocationId:o}){let r=Yt(),n=po(t,r?.maxZoom),s=dr(()=>new Map(t.locations.map(d=>[d.id,d])),[t.locations]);return E("div",{"aria-label":`${t.title} map with ${t.locations.length} locations`,className:"aui-map__surface","data-renderer":"host-tiles","data-slot":"agent-ui-map-surface",role:"region",children:[E("svg",{"aria-hidden":"true",className:"aui-map__fallback",preserveAspectRatio:"none",viewBox:"0 0 800 520",children:[x("path",{d:"M-40 430C130 270 210 310 360 190S590 35 850 110"}),x("path",{d:"M-20 120C180 210 255 150 405 265S650 470 830 390"}),x("path",{d:"M80 -30C125 120 250 205 220 560"}),x("path",{d:"M590 -30C520 120 530 290 690 560"})]}),r?x("div",{"aria-hidden":"true",className:"aui-map__tiles",children:n.tiles.map(d=>{let m;try{m=r.getTileUrl({x:d.xIndex,y:d.yIndex,zoom:d.zoom})}catch{m=void 0}return m?x("img",{alt:"",className:"aui-map__tile",decoding:"async",draggable:!1,loading:"eager",referrerPolicy:"no-referrer",src:m,style:{left:`calc(50% + ${d.x}px)`,top:`calc(var(--map-center-y) + ${d.y}px)`},onError:l=>{l.currentTarget.hidden=!0}},d.key):null})}):null,x("div",{className:"aui-map__markers","data-slot":"agent-ui-map-markers",children:n.points.map((d,m)=>{let l=s.get(d.id);if(!l)return null;let y=l.id===o,h=l.rating!==void 0?Jt(l.rating):l.relevance!==void 0?`${Math.round(l.relevance*100)}%`:String(m+1),u=`Select ${l.title} on map${l.rating===void 0?"":`, rated ${Jt(l.rating)} out of 5`}`;return E("button",{"aria-label":u,"aria-pressed":y,className:"aui-map__marker","data-renderer":"host-tiles","data-selected":y,"data-slot":"agent-ui-map-marker",type:"button",style:{"--map-marker-x":`${d.x}px`,"--map-marker-y":`${d.y}px`},onClick:()=>e(l),children:[x(lr,{"aria-hidden":"true"}),x("span",{children:h})]},l.id)})}),x("span",{className:"aui-map__attribution","data-slot":"agent-ui-map-attribution",children:r?.attribution??"Location preview"})]})}function Ud(t){return Yt()?x(Gd,{...t}):x(_d,{fallback:x("div",{"aria-label":"Loading interactive map",className:"aui-map__surface aui-map__surface--loading","data-slot":"agent-ui-map-surface",role:"status",children:x("span",{})}),children:x(Bd,{...t})})}function Hd({location:t,onKeyDown:e,onOpen:o,selected:r,setRef:n}){let s=Ed(t.address),d=[t.category,s].filter(Boolean).join(" \xB7 ");return E("button",{ref:n,"aria-current":r?"true":void 0,"aria-label":`Open details for ${t.title}`,className:"aui-map__result","data-selected":r,"data-slot":"agent-ui-map-result",type:"button",onClick:o,onKeyDown:e,children:[x(Wd,{className:"aui-map__result-image",location:t}),E("span",{className:"aui-map__result-content",children:[x("span",{className:"aui-map__result-title",children:t.title}),d?x("span",{className:"aui-map__result-subtitle",children:d}):null,x(cr,{location:t,showCategory:!1})]}),t.relevance!==void 0?x("span",{className:"aui-map__result-aside",children:E("span",{className:"aui-map__relevance","data-slot":"agent-ui-map-relevance",children:[Math.round(t.relevance*100),"% match"]})}):null]})}function Zd({component:t,currentIndex:e,direction:o,headingId:r,location:n,onNavigate:s}){let d=Yt(),m=Vd(),l=n.images?.[0],[y,h]=nt(),u=l&&l.src!==y,g=m?0:o,v=m?Fd:Ld;return x(kd,{features:Sd,children:E("div",{className:"aui-map-detail__content",children:[x("div",{className:"aui-map-detail__hero","data-has-image":!!u,children:x(nr,{custom:g,initial:!1,mode:"popLayout",children:E(sr,{className:"aui-map-detail__hero-slide",direction:g,transition:v,variants:Md,children:[u?x(Ve,{alt:l.alt,decoding:"async",referrerPolicy:"no-referrer",src:l.src,onError:()=>h(l.src)}):x("span",{"aria-hidden":"true",className:"aui-map-detail__hero-fallback",children:pr(n.title)}),n.images&&n.images.length>1?E("span",{className:"aui-map-detail__image-count",children:[x("span",{"aria-hidden":"true",children:"\u25A7"})," ",n.images.length]}):null]},n.id)})}),x(Xt.CloseTrigger,{"aria-label":"Close location details",className:"aui-map-detail__close"}),x(nr,{custom:g,initial:!1,mode:"popLayout",children:E(sr,{className:"aui-map-detail__body",direction:g,transition:v,variants:Dd,children:[E("div",{className:"aui-map-detail__heading",children:[x("h2",{id:r,children:n.title}),x(cr,{location:n}),n.address?x("p",{className:"aui-map-detail__address",children:n.address}):null]}),n.actions?.length?x("div",{className:"aui-map-detail__actions","data-slot":"agent-ui-map-detail-actions",children:n.actions.map((P,G)=>{let R=P.href.startsWith("http://")||P.href.startsWith("https://");return x("a",{className:"aui-button","data-size":"md","data-variant":P.variant??(G===0?"primary":"outline"),href:P.href,referrerPolicy:R?"no-referrer":void 0,rel:R?"noopener noreferrer":void 0,target:R?"_blank":void 0,children:P.label},P.id)})}):null,n.notes?E("section",{className:"aui-map-detail__notes","data-slot":"agent-ui-map-detail-notes",children:[x("span",{children:"Notes"}),x("p",{children:Je(n.notes)})]}):null]},n.id)}),E("footer",{className:"aui-map-detail__footer",children:[x("span",{className:"aui-map-detail__provider",children:d?.attribution??"OpenStreetMap \xB7 CARTO"}),E("div",{className:"aui-map-detail__navigation",children:[x("button",{"aria-label":"Previous location",disabled:e===0,type:"button",onClick:()=>s(e-1),children:x(xd,{"aria-hidden":"true"})}),E("span",{"aria-live":"polite",children:[e+1," of ",t.locations.length]}),x("button",{"aria-label":"Next location",disabled:e===t.locations.length-1,type:"button",onClick:()=>s(e+1),children:x(wd,{"aria-hidden":"true"})})]})]})]})})}function mr({className:t,component:e,onSelect:o}){let[r,n]=nt(()=>pa(e)),[s,d]=nt(!1),[m,l]=nt(1),[y,h]=nt(),u=Ad(),g=Wa(new Map),v=Wa(void 0),P=Wa(r),G=dr(()=>new Map(e.locations.map(S=>[S.id,S])),[e.locations]),R=pa(e),V=G.has(r)?r:R,K=Math.max(0,e.locations.findIndex(S=>S.id===V)),$=e.locations[K],ve=`${u}-${$.id}`;rr(()=>{P.current=V},[V]),rr(()=>()=>{v.current!==void 0&&window.clearTimeout(v.current)},[]);let Vt=_e(S=>{h(ie(S))},[]),_t=_e(S=>{o?.(A(e,{...S}))},[e,o]),Tt=_e((S,O=!1)=>{typeof window>"u"||window.requestAnimationFrame(()=>{let U=g.current.get(S);U?.scrollIntoView?.({behavior:zd()?"auto":"smooth",block:"nearest",inline:"center"}),O&&U?.focus()})},[]),Ye=_e((S,O={})=>{P.current=S.id,n(S.id),_t(S),O.scroll!==!1&&Tt(S.id,O.focus),O.openDetails&&d(!0)},[_t,Tt]),Ya=_e((S,O=!1)=>{let U=e.locations[S];U&&Ye(U,{focus:O,scroll:!0})},[e.locations,Ye]),Xr=_e((S,O)=>{let U;S.key==="ArrowLeft"&&(U=Math.max(0,O-1)),S.key==="ArrowRight"&&(U=Math.min(e.locations.length-1,O+1)),S.key==="Home"&&(U=0),S.key==="End"&&(U=e.locations.length-1),!(U===void 0||U===O)&&(S.preventDefault(),Ya(U,!0))},[e.locations.length,Ya]),Jr=_e(S=>{let O=S.currentTarget;v.current!==void 0&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{let U=O.getBoundingClientRect(),ai=U.left+U.width/2,Xe,Xa=Number.POSITIVE_INFINITY;for(let Ja of e.locations){let Qa=g.current.get(Ja.id);if(!Qa)continue;let eo=Qa.getBoundingClientRect(),to=Math.abs(eo.left+eo.width/2-ai);to<Xa&&(Xa=to,Xe=Ja)}Xe&&Xe.id!==P.current&&(P.current=Xe.id,n(Xe.id),_t(Xe))},120)},[e.locations,_t]),Qr=_e(S=>{d(S),S||Tt(P.current,!0)},[Tt]),ei=_e(S=>{let O=e.locations[S];O&&(l(S<K?-1:1),Ye(O,{scroll:!0}))},[K,e.locations,Ye]),ti=E("span",{className:"aui-map__card-title",children:[x(vd,{"aria-hidden":"true"}),x("span",{children:e.title})]});return x(k,{className:b("aui-map-card",t),description:e.description,title:ti,children:E("div",{ref:Vt,className:"aui-map","data-slot":"agent-ui-map",children:[x(Ud,{component:e,selectedLocationId:V,onSelect:S=>Ye(S,{scroll:!0})}),x("div",{className:"aui-map__rail","data-slot":"agent-ui-map-results",onScroll:Jr,children:x("ul",{"aria-label":`${e.title} results`,children:e.locations.map((S,O)=>x("li",{children:x(Hd,{location:S,selected:S.id===V,setRef:U=>{U?g.current.set(S.id,U):g.current.delete(S.id)},onKeyDown:U=>Xr(U,O),onOpen:()=>Ye(S,{openDetails:!0,scroll:!1})})},S.id))})}),E("span",{"aria-live":"polite",className:"aui-map__live-region",children:["Result ",K+1," of ",e.locations.length,", ",$.title]}),x(Xt.Backdrop,{className:"aui-map-detail__backdrop",isOpen:s,UNSTABLE_portalContainer:y,variant:"blur",onOpenChange:Qr,children:x(Xt.Container,{className:"aui-map-detail__container",placement:"center",size:"cover",children:x(Xt.Dialog,{"aria-labelledby":ve,className:"aui-map-detail__dialog","data-slot":"agent-ui-map-detail",children:x(Zd,{component:e,currentIndex:K,direction:m,headingId:ve,location:$,onNavigate:ei})})})})]})})}import{Modal as rt}from"@heroui/react";import{useCallback as Od,useState as Cr}from"react";import{StarFill as Kd}from"@gravity-ui/icons";import{jsx as yt,jsxs as Ea}from"react/jsx-runtime";var ur=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),gr=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Qt({className:t,count:e,value:o}){let r=Math.min(Math.max(o,0),5),n=`Rated ${ur.format(r)} out of 5${e===void 0?"":`, ${gr.format(e)} reviews`}`,s=Array.from({length:5},(d,m)=>yt(Kd,{"aria-hidden":"true"},m));return Ea("span",{"aria-label":n,className:b("aui-rating",t),"data-slot":"agent-ui-rating",role:"img",children:[Ea("span",{"aria-hidden":"true",className:"aui-rating__stars",children:[yt("span",{className:"aui-rating__track",children:s}),yt("span",{className:"aui-rating__fill",style:{width:`${r/5*100}%`},children:yt("span",{className:"aui-rating__track",children:s})})]}),yt("span",{"aria-hidden":"true",className:"aui-rating__value",children:ur.format(r)}),e===void 0?null:Ea("span",{"aria-hidden":"true",className:"aui-rating__count",children:["(",gr.format(e),")"]})]})}import{jsx as H,jsxs as it}from"react/jsx-runtime";var hr=new Map;function jd(t){let e=t.currency??"USD",o=hr.get(e);return o||(o=new Intl.NumberFormat(void 0,{currency:e,style:"currency"}),hr.set(e,o)),o.format(t.amount)}function br({actions:t,component:e,onAction:o,onSelect:r}){return H("span",{className:"aui-product__actions","data-slot":"agent-ui-product-actions",children:t.map(n=>H(fe,{variant:n.variant,onClick:()=>{let s=se(e.id,n);s&&o?o(s):r?.(A(e,n))},children:n.label},n.id))})}function fr({component:t,layout:e,onAction:o,onSelect:r,product:n}){let[s,d]=Cr(),[m,l]=Cr(!1),y=Od(u=>{d(ie(u))},[]),h=n.badge?H("span",{className:"aui-product__badge","data-slot":"agent-ui-product-badge","data-tone":n.badge.tone??"default",children:n.badge.label}):null;return it("article",{className:"aui-product","data-layout":e,"data-slot":"agent-ui-product",children:[m?it("span",{className:"aui-product__media","data-slot":"agent-ui-product-media",children:[H(me,{alt:n.image.alt,className:"aui-product__image",src:void 0}),h]}):it(rt,{children:[it(rt.Trigger,{ref:y,"aria-label":`Open ${n.image.alt}`,className:"aui-product__media","data-slot":"agent-ui-product-media",children:[H(me,{alt:n.image.alt,className:"aui-product__image",loading:"lazy",src:n.image.src,onLoadFailure:()=>l(!0)}),h]}),H(rt.Backdrop,{className:"aui-image-modal__backdrop",UNSTABLE_portalContainer:s,variant:"blur",children:H(rt.Container,{className:"aui-image-modal__container",placement:"center",children:it(rt.Dialog,{"aria-label":n.image.alt,className:"aui-image-modal__dialog","data-slot":"agent-ui-image-modal",children:[H(rt.CloseTrigger,{className:"aui-image-modal__close"}),H("img",{alt:n.image.alt,className:"aui-image-modal__image",src:n.image.src})]})})})]}),it("span",{className:"aui-product__header",children:[n.meta?H("span",{className:"aui-product__meta",children:n.meta}):null,H("span",{className:"aui-product__price","data-slot":"agent-ui-product-price",children:jd(n.price)})]}),H("span",{className:"aui-product__name","data-slot":"agent-ui-product-name",children:n.name}),n.rating?H(Qt,{className:"aui-product__rating",count:n.rating.count,value:n.rating.value}):null,n.description?H("span",{className:"aui-product__description",children:n.description}):null,n.actions?.length?H(br,{actions:n.actions,component:t,onAction:o,onSelect:r}):null]})}function yr({className:t,component:e,onAction:o,onSelect:r}){let n=e.products.length===1?"spotlight":"grid",s=e.actions?.length?H("div",{className:"aui-product-card__footer","data-slot":"agent-ui-product-card-footer",children:H(br,{actions:e.actions,component:e,onAction:o,onSelect:r})}):null;return H(k,{className:b("aui-product-card",`aui-product-card--${n}`,t),description:e.description,footer:s,title:e.title,variant:e.variant,children:n==="spotlight"?H(fr,{component:e,layout:"spotlight",product:e.products[0],onAction:o,onSelect:r}):H("div",{className:"aui-product-card__grid","data-slot":"agent-ui-product-card-grid",children:e.products.map(d=>H(fr,{component:e,layout:"grid",product:d,onAction:o,onSelect:r},d.id))})})}import{Modal as st}from"@heroui/react";import{useCallback as qd,useState as xr}from"react";import{Fragment as Yd,jsx as Y,jsxs as Ke}from"react/jsx-runtime";function wr({className:t,component:e,onAction:o,onSelect:r}){let n=e.layout??"details",[s,d]=xr(),[m,l]=xr(!1),y=qd(g=>{d(ie(g))},[]),h=e.status?Y("span",{className:"aui-record__status","data-slot":"agent-ui-record-status","data-tone":e.status.tone??"default",children:e.status.label}):null,u=e.actions?.length?Y("div",{className:"aui-record__actions","data-slot":"agent-ui-record-actions",children:e.actions.map(g=>Y(fe,{variant:g.variant,onClick:()=>{let v=se(e.id,g);v&&o?o(v):r?.(A(e,g))},children:g.label},g.id))}):null;return Y(k,{actions:n==="compact"?h:void 0,className:b("aui-record-card",`aui-record-card--${n}`,t),description:e.description,footer:u,title:e.title,variant:e.variant,children:Ke(Ot,{className:"aui-record",gap:n==="compact"?3:4,children:[n==="media"&&e.image&&m?Y(Ve,{alt:e.image.alt,className:"aui-record__media",radius:"xl",src:void 0,width:"100%"}):null,n==="media"&&e.image&&!m?Ke(st,{children:[Y(st.Trigger,{ref:y,"aria-label":`Open ${e.image.alt}`,className:"aui-record__media-trigger","data-slot":"agent-ui-record-media-trigger",children:Y(Ve,{alt:e.image.alt,className:"aui-record__media",loading:"lazy",radius:"xl",src:e.image.src,width:"100%",onError:()=>l(!0)})}),Y(st.Backdrop,{className:"aui-image-modal__backdrop",UNSTABLE_portalContainer:s,variant:"blur",children:Y(st.Container,{className:"aui-image-modal__container",placement:"center",children:Ke(st.Dialog,{"aria-label":e.image.alt,className:"aui-image-modal__dialog","data-slot":"agent-ui-image-modal",children:[Y(st.CloseTrigger,{className:"aui-image-modal__close"}),Y("img",{alt:e.image.alt,className:"aui-image-modal__image",src:e.image.src})]})})})]}):null,e.image&&n!=="media"||e.eyebrow||h&&n!=="compact"?Ke(Kt,{align:"center",gap:3,children:[e.image&&n!=="media"?Y(Ve,{frame:!0,alt:e.image.alt,radius:"xl",size:48,src:e.image.src}):null,e.eyebrow?Y(qt,{className:"aui-record__eyebrow",value:e.eyebrow}):null,h&&n!=="compact"?Ke(Yd,{children:[Y(jt,{}),h]}):null]}):null,e.fields.length>0?Y("dl",{className:"aui-record__fields","data-slot":"agent-ui-record-fields",children:e.fields.map(g=>Ke("div",{"data-slot":"agent-ui-record-field",children:[Ke("dt",{children:[g.icon?Y(q,{"data-slot":"agent-ui-record-field-icon",name:g.icon}):null,g.label]}),Y("dd",{"data-tone":g.tone??"default",children:g.value})]},g.label))}):null]})})}var vr={Actions:ar,Box:Jn,Button:or,Caption:qt,Card:Xn,Col:Ot,Divider:bt,Icon:tr,Image:Ve,Row:Kt,Spacer:jt,Text:Qn,Title:er},i=vr;var kr=new Map;function ea(t,e){let o=kr.get(e);return o||(o=new Intl.NumberFormat(void 0,{currency:e,style:"currency"}),kr.set(e,o)),o.format(t)}import{jsx as ta}from"react/jsx-runtime";function ue({action:t,component:e,onAction:o,onSelect:r}){return ta(i.Button,{variant:t.variant,onClick:()=>{let n=se(e.id,t);n&&o?o(n):r?.(A(e,{actionId:t.id}))},children:t.label})}function lt({name:t,src:e}){return e?ta(i.Image,{frame:!0,alt:t,radius:"full",size:44,src:e}):ta(i.Box,{align:"center",className:"aui-composition-avatar",height:44,justify:"center",radius:"full",width:44,children:ta(i.Text,{value:t.slice(0,1).toUpperCase(),weight:"semibold"})})}import{jsx as z,jsxs as Te}from"react/jsx-runtime";function Ga({emphasis:t,label:e,value:o}){return Te(i.Row,{children:[z(i.Text,{value:e,weight:t?"semibold":"normal"}),z(i.Spacer,{}),z(i.Text,{value:o,weight:t?"semibold":"normal"})]})}function Sr({className:t,component:e,onAction:o,onSelect:r}){return Te(i.Card,{className:b("aui-composition-card aui-purchase-items",t),"data-component-kind":e.kind,size:"sm",children:[z(i.Col,{gap:3,children:e.items.map(n=>Te(i.Row,{align:"center",gap:3,children:[n.image?z(i.Image,{alt:n.image.alt,radius:"xl",size:48,src:n.image.src}):null,Te(i.Col,{flex:1,gap:0,children:[z(i.Text,{value:n.name,weight:"semibold"}),n.description?z(i.Caption,{value:n.description}):null]}),n.quantity&&n.quantity>1?z(i.Caption,{value:`\xD7${n.quantity}`}):null,n.price!==void 0?z(i.Text,{value:ea(n.price,e.currency)}):null]},n.id))}),z(i.Divider,{flush:!0}),z(i.Col,{gap:1,children:e.totals.map(n=>z(Ga,{emphasis:n.emphasis,label:n.label,value:ea(n.amount,e.currency)},n.label))}),e.actions?.length?z(i.Actions,{children:e.actions.map(n=>z(ue,{action:n,component:e,onAction:o,onSelect:r},n.id))}):null]})}function Nr({className:t,component:e,onAction:o,onSelect:r}){return Te(i.Card,{className:b("aui-composition-card aui-purchase-complete",t),"data-component-kind":e.kind,size:"sm",children:[Te(i.Row,{align:"center",gap:2,children:[z("span",{"aria-hidden":"true",className:"aui-purchase-complete__check",children:"\u2713"}),z(i.Text,{color:"success",value:e.title,weight:"medium"})]}),z(i.Divider,{flush:!0}),Te(i.Row,{gap:3,children:[e.product.image?z(i.Image,{alt:e.product.image.alt,fit:"contain",radius:"xl",size:80,src:e.product.image.src}):null,Te(i.Col,{gap:1,children:[z(i.Title,{value:e.product.name}),e.product.description?z(i.Caption,{value:e.product.description}):null]})]}),Te(i.Col,{gap:2,children:[e.details.map(n=>z(Ga,{label:n.label,value:n.value},n.label)),e.paid?z(Ga,{emphasis:!0,label:"Paid",value:ea(e.paid.amount,e.paid.currency)}):null]}),e.action?z(ue,{action:e.action,component:e,onAction:o,onSelect:r}):null]})}import{jsx as F,jsxs as ne}from"react/jsx-runtime";function Pr({className:t,component:e,onAction:o,onSelect:r}){return ne(i.Card,{className:b("aui-composition-card aui-create-event",t),"data-component-kind":e.kind,size:"md",children:[ne(i.Row,{align:"start",gap:4,children:[ne(i.Col,{align:"center",gap:0,width:64,children:[F(i.Caption,{value:e.date.weekday}),F(i.Title,{size:"3xl",value:e.date.day,weight:"normal"})]}),F(i.Col,{flex:1,gap:2,children:e.events.map(n=>ne(i.Row,{align:"center",className:"aui-create-event__item","data-status":n.status??"existing","data-tone":n.tone??"default",gap:3,padding:{x:3,y:2.5},radius:"xl",children:[F("span",{className:"aui-create-event__marker"}),ne(i.Col,{gap:0,children:[F(i.Text,{value:n.title,weight:"semibold"}),F(i.Caption,{value:n.time})]})]},n.id))})]}),e.actions?.length?F(i.Actions,{children:e.actions.map(n=>F(ue,{action:n,component:e,onAction:o,onSelect:r},n.id))}):null]})}function Vr({className:t,component:e}){return F(i.Card,{className:b("aui-composition-card aui-view-event",t),"data-component-kind":e.kind,size:"sm",children:ne(i.Row,{align:"stretch",gap:3,children:[F("span",{className:"aui-view-event__marker","data-tone":e.tone??"accent"}),ne(i.Col,{flex:1,gap:1,children:[ne(i.Row,{children:[F(i.Caption,{value:e.date}),F(i.Spacer,{}),F(i.Text,{color:"accent",size:"sm",value:e.time})]}),F(i.Title,{value:e.title})]})]})})}function _r({className:t,component:e,onAction:o,onSelect:r}){return ne(i.Card,{className:b("aui-composition-card aui-event-session",t),"data-component-kind":e.kind,size:"md",children:[ne(i.Col,{gap:1,children:[e.eyebrow?F(i.Caption,{color:"warning",value:e.eyebrow}):null,F(i.Title,{value:e.title}),e.description?F(i.Caption,{value:e.description}):null]}),F(i.Divider,{flush:!0}),ne(i.Row,{align:"center",gap:3,children:[F("span",{"aria-hidden":"true",className:"aui-event-session__pin",children:"\u25CF"}),ne(i.Col,{gap:0,children:[F(i.Text,{value:e.location,weight:"semibold"}),F(i.Caption,{value:e.time})]}),F(i.Spacer,{}),e.action?F(ue,{action:e.action,component:e,onAction:o,onSelect:r}):null]}),e.speakers.map(n=>ne(i.Row,{align:"center",gap:3,children:[F(lt,{name:n.name,src:n.image?.src}),ne(i.Col,{gap:0,children:[F(i.Text,{value:n.name,weight:"semibold"}),F(i.Caption,{value:n.role})]})]},`${n.name}-${n.role}`))]})}import{jsx as B,jsxs as ge}from"react/jsx-runtime";function Tr({className:t,component:e,onAction:o,onSelect:r}){return ge(i.Card,{className:b("aui-composition-card aui-playlist",t),"data-component-kind":e.kind,size:"sm",children:[e.cover?B(i.Image,{alt:e.cover.alt,height:132,radius:"xl",src:e.cover.src,width:"100%"}):null,B(i.Col,{gap:3,children:e.tracks.map((n,s)=>ge(i.Row,{align:"center",gap:3,children:[B(i.Caption,{value:s+1}),n.image?B(i.Image,{alt:n.image.alt,radius:"xl",size:44,src:n.image.src}):null,ge(i.Col,{flex:1,gap:0,children:[B(i.Text,{value:n.title,weight:"semibold"}),B(i.Caption,{value:n.artist})]}),n.action?B(ue,{action:n.action,component:e,onAction:o,onSelect:r}):null]},n.id))}),e.actions?.length?B(i.Actions,{children:e.actions.map(n=>B(ue,{action:n,component:e,onAction:o,onSelect:r},n.id))}):null]})}function Ir({className:t,component:e}){return ge(i.Card,{className:b("aui-composition-card aui-channel-message",t),"data-component-kind":e.kind,size:"md",children:[ge(i.Row,{children:[B(i.Text,{value:e.channel,weight:"medium"}),B(i.Spacer,{}),B(i.Caption,{value:e.timestamp})]}),B(i.Divider,{flush:!0}),ge(i.Row,{align:"start",gap:4,children:[B(lt,{name:e.author.name,src:e.author.image?.src}),ge(i.Col,{flex:1,gap:2,children:[B(i.Text,{value:e.author.name,weight:"semibold"}),B("p",{className:"aui-channel-message__content",children:e.content}),e.attachments?.length?B(i.Row,{className:"aui-channel-message__attachments",gap:2,children:e.attachments.map(o=>o.image?B(i.Image,{alt:o.image.alt,radius:"lg",size:64,src:o.image.src,title:o.name},o.id):B(i.Image,{alt:o.name,className:"aui-channel-message__file",radius:"lg",size:64,title:o.name},o.id))}):null]})]})]})}function Ar({className:t,component:e}){return ge(i.Card,{className:b("aui-composition-card aui-player-card",t),"data-component-kind":e.kind,padding:8,size:"md",theme:"dark",children:[e.backgroundImage?B(i.Image,{alt:e.backgroundImage.alt,className:"aui-player-card__background",src:e.backgroundImage.src}):null,ge(i.Row,{align:"center",className:"aui-player-card__content",children:[B(i.Box,{minHeight:160,width:"40%"}),ge(i.Col,{flex:"auto",gap:3,children:[B(i.Title,{color:"white",size:"xl",value:`${e.playerName}${e.jerseyNumber?` (#${e.jerseyNumber})`:""}`,weight:"normal"}),B(i.Row,{className:"aui-player-card__stats",children:e.stats.map(o=>ge(i.Col,{flex:1,gap:0,children:[B(i.Text,{value:o.value,weight:"semibold"}),B(i.Caption,{color:"white",value:o.label})]},o.label))})]})]})]})}import{jsx as xt,jsxs as Rr}from"react/jsx-runtime";function Lr({className:t,component:e,onAction:o,onSelect:r}){return Rr(i.Card,{className:b("aui-composition-card aui-enable-notification",t),"data-component-kind":e.kind,size:"sm",children:[Rr(i.Col,{align:"center",gap:3,padding:3,children:[xt("span",{"aria-hidden":"true",className:"aui-enable-notification__icon",children:"\u2713"}),xt(i.Title,{align:"center",value:e.title}),e.description?xt(i.Caption,{value:e.description}):null]}),xt(i.Row,{className:"aui-enable-notification__actions",children:e.actions.map(n=>xt(ue,{action:n,component:e,onAction:o,onSelect:r},n.id))})]})}import{Tabs as dt}from"@heroui/react";import{jsx as wt,jsxs as Fr}from"react/jsx-runtime";function Mr({className:t,component:e,renderPanel:o}){return wt(k,{className:b("aui-product-signals",t),"data-component-kind":e.kind,description:e.description,title:e.title,children:Fr(dt,{defaultSelectedKey:e.defaultValue??e.tabs[0]?.id,variant:"secondary",children:[wt(dt.ListContainer,{children:wt(dt.List,{"aria-label":`${e.title} views`,children:e.tabs.map(r=>Fr(dt.Tab,{id:r.id,children:[r.label,wt(dt.Indicator,{})]},r.id))})}),e.tabs.map(r=>wt(dt.Panel,{className:"aui-product-signals__panel",id:r.id,children:o(r.component)},r.id))]})})}import{jsx as W,jsxs as Ce}from"react/jsx-runtime";function Dr({className:t,component:e}){return Ce(i.Card,{className:b("aui-composition-card aui-flight-tracker",t),"data-component-kind":e.kind,size:"md",theme:"dark",children:[Ce(i.Row,{align:"center",gap:2,children:[e.airline.logo?W(i.Box,{align:"center",className:"aui-flight-tracker__logo",height:28,justify:"center",radius:"full",width:28,children:W(i.Image,{alt:e.airline.logo.alt,fit:"contain",size:18,src:e.airline.logo.src})}):null,W(i.Text,{value:e.flightNumber,weight:"semibold"}),W(i.Spacer,{}),W(i.Caption,{color:"white",value:e.date})]}),W(i.Divider,{flush:!0}),Ce(i.Col,{gap:3,children:[Ce(i.Row,{align:"center",children:[W(i.Text,{size:"lg",value:e.origin.label}),W(i.Spacer,{}),W(i.Text,{size:"lg",value:e.destination.label})]}),W("div",{"aria-label":`${e.progress??0}% complete`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":e.progress??0,className:"aui-flight-tracker__progress",role:"progressbar",children:W("span",{style:{width:`${e.progress??0}%`}})}),Ce(i.Row,{align:"center",children:[Ce(i.Col,{gap:0,children:[W(i.Text,{value:e.origin.time}),e.origin.status?W(i.Caption,{color:"white",value:e.origin.status}):null]}),W(i.Spacer,{}),Ce(i.Col,{align:"end",gap:0,children:[W(i.Text,{value:e.destination.time}),e.destination.status?W(i.Caption,{color:"white",value:e.destination.status}):null]})]})]})]})}function Br({className:t,component:e}){return Ce(i.Card,{className:b("aui-composition-card aui-ride-status",t),"data-component-kind":e.kind,size:"sm",children:[W(i.Title,{size:"xl",value:e.eta}),Ce(i.Row,{align:"center",gap:3,children:[Ce(i.Col,{gap:0,children:[W(i.Caption,{value:"Pick up"}),W(i.Text,{truncate:!0,value:e.pickup})]}),W(i.Spacer,{}),Ce(i.Col,{align:"end",gap:0,children:[W(i.Caption,{value:"Driver"}),W(i.Text,{value:e.driver.name})]}),W(lt,{name:e.driver.name,src:e.driver.image?.src})]})]})}import{useState as Xd}from"react";import{Fragment as je,jsx as N,jsxs as re}from"react/jsx-runtime";function Oe(){return N("path",{d:"M13.2 25.5h20.6a6.7 6.7 0 0 0 .2-13.4 10.2 10.2 0 0 0-19.2-2.4 8 8 0 0 0-1.6 15.8Z",fill:"currentColor",opacity:".94"})}function zr({small:t=!1}){return re("g",{transform:t?"translate(-5 -5) scale(.72)":void 0,children:[N("circle",{cx:"24",cy:"20",fill:"currentColor",r:"7"}),N("path",{d:"M24 5v5m0 20v5M9 20h5m20 0h5M13.4 9.4l3.5 3.5m14.2 14.2 3.5 3.5m0-21.2-3.5 3.5M16.9 27.1l-3.5 3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.4"})]})}var Jd={clear:N(zr,{}),cloudy:N(Oe,{}),drizzle:re(je,{children:[N(Oe,{}),N("path",{d:"m17 30-2 4m9-4-2 4m9-4-2 4",stroke:"currentColor",strokeLinecap:"round"})]}),fog:re(je,{children:[N(Oe,{}),N("path",{d:"M10 31h27M13 36h21",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]}),"partly-cloudy":re(je,{children:[N(zr,{small:!0}),N(Oe,{})]}),rain:re(je,{children:[N(Oe,{}),N("path",{d:"m16 30-3 6m11-6-3 6m11-6-3 6",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]}),snow:re(je,{children:[N(Oe,{}),N("path",{d:"M16 32h.1m8-.1h.1m8 .1h.1",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"4"})]}),thunderstorm:re(je,{children:[N(Oe,{}),N("path",{d:"m25 28-5 8h5l-2 6 8-10h-5l3-4Z",fill:"currentColor"})]}),unknown:re(je,{children:[N("circle",{cx:"24",cy:"24",fill:"none",r:"15",stroke:"currentColor",strokeWidth:"2"}),N("path",{d:"M20 19a4 4 0 1 1 5 3.9c-1.6.5-2 1.4-2 3.1m0 5h.1",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.4"})]}),windy:N("path",{d:"M7 17h24a4 4 0 1 0-4-4m-20 9h31a4 4 0 1 1-4 4M7 28h17",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.5"})},Qd={clear:"https://cdn.openai.com/API/storybook/mostly-sunny.png",cloudy:"https://cdn.openai.com/API/storybook/mixed-sun.png",drizzle:"https://cdn.openai.com/API/storybook/rain.png",fog:"https://cdn.openai.com/API/storybook/windy.png","partly-cloudy":"https://cdn.openai.com/API/storybook/mixed-sun.png",rain:"https://cdn.openai.com/API/storybook/rain.png",thunderstorm:"https://cdn.openai.com/API/storybook/rain.png",windy:"https://cdn.openai.com/API/storybook/windy.png"};function Ua({condition:t,size:e=48}){let o=Qd[t],[r,n]=Xd(),s=t.replaceAll("-"," ");return o&&o!==r?N(me,{alt:s,className:"aui-weather-icon",decoding:"async",height:e,loading:"lazy",src:o,width:e,onLoadFailure:n}):N("svg",{"aria-label":s,className:"aui-weather-icon",height:e,role:"img",viewBox:"0 0 48 48",width:e,children:Jd[t]})}function aa(t,e){return`${Math.round(t)}\xB0${e==="fahrenheit"?"F":"C"}`}function Wr({className:t,component:e}){return N(i.Card,{"data-component-kind":e.kind,padding:{x:4,y:8},size:"sm",theme:"dark",className:b("aui-composition-card aui-weather-card aui-weather-current",t),children:re(i.Col,{align:"center",gap:4,children:[re(i.Row,{align:"center",gap:3,children:[N(Ua,{condition:e.condition,size:58}),N(i.Title,{color:"white",size:"3xl",value:aa(e.temperature,e.unit),weight:"normal"})]}),N(i.Caption,{color:"white",size:"lg",value:e.location}),e.description?N(i.Text,{align:"center",color:"white",value:e.description}):null,e.details?.length?N(i.Row,{className:"aui-weather-current__details",gap:3,children:e.details.map(o=>re(i.Col,{align:"center",gap:0,children:[N(i.Caption,{color:"white",value:o.label}),N(i.Text,{color:"white",value:o.value,weight:"semibold"})]},o.label))}):null]})})}function Er({className:t,component:e}){return N(i.Card,{"data-component-kind":e.kind,padding:8,size:"sm",theme:"dark",className:b("aui-composition-card aui-weather-card aui-weather-forecast",t),children:re(i.Col,{align:"center",gap:3,children:[N(Ua,{condition:e.condition,size:60}),re(i.Row,{align:"center",gap:2,children:[N(i.Title,{color:"white",size:"2xl",value:aa(e.low,e.unit),weight:"normal"}),N(i.Title,{color:"white",size:"2xl",value:aa(e.high,e.unit),weight:"normal"})]}),N(i.Caption,{color:"white",value:e.location}),e.description?N(i.Text,{align:"center",color:"white",value:e.description}):null,N(i.Row,{className:"aui-weather-forecast__days",gap:4,children:e.forecast.map(o=>re(i.Col,{align:"center",gap:1,children:[N(i.Caption,{truncate:!0,className:"aui-weather-forecast__day-label",color:"white",title:o.label,value:o.label}),N(Ua,{condition:o.condition,size:40}),N(i.Text,{color:"white",value:aa(o.temperature,e.unit)})]},o.label))})]})})}import{Button as ep,Calendar as ee,Checkbox as oa,CheckboxGroup as tp,ComboBox as na,DateField as xe,DatePicker as ra,DateRangePicker as vt,Description as ap,Form as op,Input as Hr,Label as we,ListBox as pt,NumberField as kt,Radio as ia,RadioGroup as np,RangeCalendar as te,Select as St,Slider as Nt,Switch as sa,Tag as Gr,TagGroup as Ur,TextArea as rp,TextField as ip,TimeField as la}from"@heroui/react";import{parseDate as sp,parseTime as lp}from"@internationalized/date";import{useCallback as dp,useRef as Za,useState as ct}from"react";import{jsx as c,jsxs as I}from"react/jsx-runtime";function pp(t){return t.kind==="checkbox-group"||t.kind==="combobox"?t.defaultValue??[]:t.kind==="slider"?t.defaultValue??t.min:t.kind==="number"?t.defaultValue??t.min??0:t.kind==="switch"?t.defaultValue??!1:t.kind==="date-range-picker"?t.defaultValue??{end:"",start:""}:t.defaultValue??""}function qe(t){if(!t)return null;try{return sp(t)}catch{return null}}function Ha(t){if(!t)return null;try{return lp(t)}catch{return null}}function cp(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=qe(t.start),o=qe(t.end);return e&&o?{end:o,start:e}:null}function mp(t){if(t)return t.style==="currency"?{currency:t.currency,notation:t.compact?"compact":"standard",style:"currency"}:t.style==="percent"?{maximumFractionDigits:t.maximumFractionDigits,style:"percent"}:{notation:t.compact?"compact":"standard",style:"decimal"}}function up(){return I(ee,{"aria-label":"Choose date",children:[I(ee.Header,{children:[I(ee.YearPickerTrigger,{children:[c(ee.YearPickerTriggerHeading,{}),c(ee.YearPickerTriggerIndicator,{})]}),c(ee.NavButton,{slot:"previous"}),c(ee.NavButton,{slot:"next"})]}),I(ee.Grid,{children:[c(ee.GridHeader,{children:t=>c(ee.HeaderCell,{children:t})}),c(ee.GridBody,{children:t=>c(ee.Cell,{date:t})})]}),c(ee.YearPickerGrid,{children:c(ee.YearPickerGridBody,{children:({year:t})=>c(ee.YearPickerCell,{year:t})})})]})}function gp({label:t}){return I(te,{"aria-label":t,children:[I(te.Header,{children:[I(te.YearPickerTrigger,{children:[c(te.YearPickerTriggerHeading,{}),c(te.YearPickerTriggerIndicator,{})]}),c(te.NavButton,{slot:"previous"}),c(te.NavButton,{slot:"next"})]}),I(te.Grid,{children:[c(te.GridHeader,{children:e=>c(te.HeaderCell,{children:e})}),c(te.GridBody,{children:e=>c(te.Cell,{date:e})})]}),c(te.YearPickerGrid,{children:c(te.YearPickerGridBody,{children:({year:e})=>c(te.YearPickerCell,{year:e})})})]})}function $a({className:t,component:e,onAction:o,onSelect:r}){let[n,s]=ct({}),[d,m]=ct(),l=dp(g=>{m(ie(g))},[]),y=g=>n[g.name]??pp(g),h=(g,v)=>{s(P=>({...P,[g.name]:v}))},u=()=>Object.fromEntries(e.fields.map(g=>[g.name,y(g)]));return c(k,{className:t,description:e.description,title:e.title,children:I(op,{ref:l,"aria-label":e.title,className:"aui-form","data-slot":"agent-ui-form",onSubmit:g=>{g.preventDefault();let P=g.nativeEvent.submitter?.value??e.actions[0]?.id,G=e.actions.find(V=>V.id===P),R=u();G&&o?o({actionId:G.id,componentId:e.id,componentTitle:e.title,label:G.label,prompt:G.prompt,type:"submit",values:R}):r?.(A(e,{actionId:P,values:R}))},children:[e.fields.map(g=>c(Cp,{field:g,portalContainer:d,value:y(g),onChange:v=>h(g,v)},g.name)),c("div",{className:"aui-actions","data-slot":"agent-ui-form-actions",children:e.actions.map(g=>c(ep,{className:"aui-form-action","data-slot":"agent-ui-action-button",size:"sm",type:"submit",value:g.id,variant:g.variant??"secondary",children:g.label},g.id))})]})})}function he({children:t}){return t?c(ap,{"data-slot":"agent-ui-field-description",children:t}):null}function Cp({field:t,onChange:e,portalContainer:o,value:r}){if(t.kind==="select")return c(fp,{field:t,portalContainer:o,value:String(r),onChange:e});if(t.kind==="radio-group")return I(np,{isRequired:t.required,name:t.name,value:String(r),variant:"secondary",onChange:e,children:[c(we,{children:t.label}),c(he,{children:t.description}),t.options.map(n=>c(ia,{value:n.value,children:I(ia.Content,{children:[c(ia.Control,{children:c(ia.Indicator,{})}),n.label]})},n.value))]});if(t.kind==="combobox")return c(hp,{field:t,portalContainer:o,value:Array.isArray(r)?r:[],onChange:e});if(t.kind==="checkbox-group"){let n=Array.isArray(r)?r:[];return I(tp,{isRequired:t.required,name:t.name,value:n,variant:"secondary",onChange:e,children:[c(we,{children:t.label}),c(he,{children:t.description}),t.options.map(s=>c(oa,{value:s.value,children:I(oa.Content,{children:[c(oa.Control,{children:c(oa.Indicator,{})}),s.label]})},s.value))]})}return t.kind==="slider"?I(Nt,{maxValue:t.max,minValue:t.min,step:t.step,value:Number(r),onChange:n=>e(Array.isArray(n)?n[0]??t.min:n),children:[c(we,{children:t.label}),c(Nt.Output,{}),I(Nt.Track,{children:[c(Nt.Fill,{}),c(Nt.Thumb,{})]}),c(he,{children:t.description})]}):t.kind==="number"?I(kt,{fullWidth:!0,formatOptions:mp(t.format),isRequired:t.required,maxValue:t.max,minValue:t.min,name:t.name,step:t.step,value:Number(r),variant:"secondary",onChange:n=>e(n??t.min??0),children:[c(we,{children:t.label}),I(kt.Group,{children:[c(kt.DecrementButton,{}),c(kt.Input,{placeholder:t.placeholder}),c(kt.IncrementButton,{})]}),c(he,{children:t.description})]}):t.kind==="switch"?I(sa,{isRequired:t.required,isSelected:!!r,name:t.name,onChange:e,children:[I(sa.Content,{children:[c(sa.Control,{children:c(sa.Thumb,{})}),t.label]}),c(he,{children:t.description})]}):t.kind==="date-picker"?c(bp,{field:t,portalContainer:o,value:String(r),onChange:e}):t.kind==="date-range-picker"?c(yp,{field:t,portalContainer:o,value:r,onChange:e}):t.kind==="time-field"?I(la,{hourCycle:t.hourCycle,isRequired:t.required,maxValue:Ha(t.max),minValue:Ha(t.min),name:t.name,value:Ha(String(r)),onChange:n=>e(n?.toString()??""),children:[c(we,{children:t.label}),c(la.Group,{fullWidth:!0,variant:"secondary",children:c(la.Input,{children:n=>c(la.Segment,{segment:n})})}),c(he,{children:t.description})]}):I(ip,{fullWidth:!0,isRequired:t.required,name:t.name,type:t.kind==="input"?t.inputType??"text":"text",value:String(r),variant:"secondary",onChange:e,children:[c(we,{children:t.label}),t.kind==="textarea"?c(rp,{placeholder:t.placeholder,rows:t.rows??4}):c(Hr,{placeholder:t.placeholder}),c(he,{children:t.description})]})}function hp({field:t,onChange:e,portalContainer:o,value:r}){let n=(t.selectionMode??"single")==="multiple",s=new Map(t.options.map(h=>[h.value,h.label])),d=n?t.options.filter(h=>!r.includes(h.value)):t.options,[m,l]=ct(n?"":s.get(r[0]??"")??""),y=h=>{if(h===null){n||e([]);return}if(n){l(""),e(r.includes(h)?r:[...r,h]);return}l(s.get(h)??""),e([h])};return I("div",{className:"aui-combobox",children:[I(na,{allowsEmptyCollection:!0,fullWidth:!0,inputValue:m,isRequired:!!t.required&&r.length===0,selectedKey:n?null:r[0]??null,variant:"secondary",onInputChange:l,onSelectionChange:h=>y(h===null?null:String(h)),children:[c(we,{children:t.label}),I(na.InputGroup,{children:[c(Hr,{placeholder:t.placeholder??"Search options\u2026"}),c(na.Trigger,{})]}),c(na.Popover,{UNSTABLE_portalContainer:o,children:c(pt,{renderEmptyState:()=>c("span",{className:"aui-combobox__empty",children:"No matches"}),children:d.map(h=>I(pt.Item,{id:h.value,textValue:h.label,children:[h.label,c(pt.ItemIndicator,{})]},h.value))})}),c(he,{children:t.description})]}),n&&r.length>0?c(Ur,{"aria-label":`${t.label} selection`,className:"aui-combobox__selection",onRemove:h=>e(r.filter(u=>!h.has(u))),children:c(Ur.List,{children:r.map(h=>I(Gr,{id:h,textValue:s.get(h)??h,children:[s.get(h)??h,c(Gr.RemoveButton,{})]},h))})}):null,r.map(h=>c("input",{name:t.name,type:"hidden",value:h},h))]})}function fp({field:t,onChange:e,portalContainer:o,value:r}){let[n,s]=ct(!1),d=Za(0),m=l=>{!l&&Date.now()-d.current<350||s(l)};return I(St,{fullWidth:!0,isOpen:n,isRequired:t.required,name:t.name,placeholder:t.placeholder??"Select an option",value:r||null,variant:"secondary",onOpenChange:m,onChange:l=>{e(l==null?"":String(l)),s(!1)},children:[c(we,{children:t.label}),I(St.Trigger,{onPointerDown:()=>{d.current=Date.now()},children:[c(St.Value,{}),c(St.Indicator,{})]}),c(St.Popover,{UNSTABLE_portalContainer:o,children:c(pt,{children:t.options.map(l=>I(pt.Item,{id:l.value,textValue:l.label,children:[l.label,c(pt.ItemIndicator,{})]},l.value))})}),c(he,{children:t.description})]})}function bp({field:t,onChange:e,portalContainer:o,value:r}){let[n,s]=ct(!1),d=Za(0),m=l=>{!l&&Date.now()-d.current<350||s(l)};return I(ra,{isOpen:n,isRequired:t.required,maxValue:qe(t.max),minValue:qe(t.min),name:t.name,value:qe(r),onOpenChange:m,onChange:l=>{e(l?.toString()??""),s(!1)},children:[c(we,{children:t.label}),I(xe.Group,{fullWidth:!0,variant:"secondary",children:[c(xe.Input,{children:l=>c(xe.Segment,{segment:l})}),c(xe.Suffix,{children:c(ra.Trigger,{onPointerDown:()=>{d.current=Date.now()},children:c(ra.TriggerIndicator,{})})})]}),c(he,{children:t.description}),c(ra.Popover,{UNSTABLE_portalContainer:o,children:c(up,{})})]})}function yp({field:t,onChange:e,portalContainer:o,value:r}){let[n,s]=ct(!1),d=Za(0),m=l=>{!l&&Date.now()-d.current<350||s(l)};return I(vt,{endName:`${t.name}.end`,isOpen:n,isRequired:t.required,maxValue:qe(t.max),minValue:qe(t.min),startName:`${t.name}.start`,value:cp(r),onOpenChange:m,onChange:l=>{e({end:l?.end.toString()??"",start:l?.start.toString()??""}),s(!1)},children:[c(we,{children:t.label}),I(xe.Group,{fullWidth:!0,variant:"secondary",children:[c(xe.Input,{slot:"start",children:l=>c(xe.Segment,{segment:l})}),c(vt.RangeSeparator,{}),c(xe.Input,{slot:"end",children:l=>c(xe.Segment,{segment:l})}),c(xe.Suffix,{children:c(vt.Trigger,{onPointerDown:()=>{d.current=Date.now()},children:c(vt.TriggerIndicator,{})})})]}),c(he,{children:t.description}),c(vt.Popover,{UNSTABLE_portalContainer:o,children:c(gp,{label:`Choose ${t.label.toLowerCase()}`})})]})}import{useMemo as xp,useState as wp}from"react";import{jsx as Pt,jsxs as Zr}from"react/jsx-runtime";function Ka({className:t,component:e,onSelect:o}){let r=xp(()=>Object.fromEntries(e.items.map(d=>[d.id,d.defaultSelected??!1])),[e.items]),[n,s]=wp({});return Pt(k,{className:t,description:e.description,title:e.title,children:Pt("div",{className:"aui-switch-group","data-slot":"agent-ui-switch-group",children:e.items.map(d=>{let m=n[d.id]??r[d.id]??!1;return Zr("label",{"data-slot":"agent-ui-switch-item",children:[Pt("input",{checked:m,"data-slot":"agent-ui-switch-control",role:"switch",type:"checkbox",onChange:l=>{let y=l.currentTarget.checked;s(h=>({...h,[d.id]:y})),o?.(A(e,{id:d.id,selected:y}))}}),Zr("span",{"data-slot":"agent-ui-switch-content",children:[Pt("strong",{"data-slot":"agent-ui-switch-label",children:d.label}),d.description?Pt("small",{"data-slot":"agent-ui-switch-description",children:d.description}):null]})]},d.id)})})})}import{useMemo as vp,useState as kp}from"react";import{jsx as Oa}from"react/jsx-runtime";function ja({className:t,component:e,onSelect:o}){let r=vp(()=>new Set(e.items.map(m=>m.id)),[e.items]),[n,s]=kp(()=>new Set(e.defaultValue??[])),d=new Set([...n].filter(m=>r.has(m)));return Oa(k,{className:t,description:e.description,title:e.title,children:Oa("div",{className:"aui-toggle-group","data-slot":"agent-ui-toggle-group",children:e.items.map(m=>Oa("button",{"aria-pressed":d.has(m.id),"data-slot":"agent-ui-toggle-item",type:"button",onClick:()=>{let l=new Set(d);e.selectionMode==="multiple"?l.has(m.id)?l.delete(m.id):l.add(m.id):(l.clear(),l.add(m.id)),s(l),o?.(A(e,{selected:[...l]}))},children:m.label},m.id))})})}import{createElement as Sp}from"react";import{jsx as Ie,jsxs as da}from"react/jsx-runtime";var Np=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function $r({className:t,component:e}){let o=e.level??2;return Sp(`h${o}`,{className:b("aui-heading",t),"data-level":o,"data-slot":"agent-ui-heading"},e.icon?Ie(q,{"aria-hidden":"true",className:"aui-heading__icon","data-slot":"agent-ui-heading-icon",name:e.icon}):null,e.text)}function Kr({className:t,component:e,onAction:o,onSelect:r}){return da(fe,{className:b("aui-button-primitive",t),"data-slot":"agent-ui-button",variant:e.variant,onClick:()=>{let n=se(e.id,{id:e.id,label:e.label,prompt:e.prompt,toolCall:e.toolCall,variant:e.variant});n&&o?o(n):r?.(A({id:e.id,title:e.label},e))},children:[e.icon?Ie(q,{"aria-hidden":"true",name:e.icon}):null,e.label]})}function Or({className:t,component:e}){return Ie("span",{className:b("aui-badge",t),"data-slot":"agent-ui-badge","data-tone":e.tone??"default","data-variant":e.variant??"soft",children:e.label})}function jr({className:t,component:e}){return Ie("span",{className:b("aui-icon",t),"data-size":e.size??"md","data-slot":"agent-ui-icon","data-tone":e.tone??"default",children:Ie(q,{"aria-hidden":"true",name:e.name})})}function qr({className:t,component:e}){return Ie(Qt,{className:t,count:e.count,value:e.value})}function Yr({className:t,component:e}){let o=Math.min(Math.max(e.value,0),100);return da("span",{"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":o,className:b("aui-progress",t),"data-slot":"agent-ui-progress",role:"progressbar",...e.label?{"aria-label":e.label}:{},children:[e.label?da("span",{className:"aui-progress__header",children:[Ie("span",{className:"aui-progress__label",children:e.label}),da("span",{className:"aui-progress__value",children:[Np.format(o),"%"]})]}):null,Ie("span",{className:"aui-progress__track",children:Ie("span",{className:"aui-progress__fill",style:{width:`${o}%`}})})]})}import{jsx as M}from"react/jsx-runtime";function Pp({cardVariant:t,className:e,component:o,exportFormats:r,onAction:n,onSelect:s}){let d=jo.safeParse(o);if(!d.success)return null;let m=M(qa,{className:b("aui-component",e),exportFormats:r,node:d.data,onAction:n,onSelect:s});return t?M(be,{variant:t,children:m}):m}var Vp={accordion:Hn,"action-group":qo,"area-chart":tn,"bar-chart":en,callout:zn,"candlestick-chart":cn,"channel-message":Ir,"code-block":$n,"comparison-list":Cn,"composed-chart":an,"create-event":Pr,"data-table":zt,diagram:Kn,"donut-chart":nn,"enable-notification":Lr,"event-session":_r,"flight-tracker":Dr,followup:Yo,form:$a,"funnel-chart":mn,"gauge-chart":un,heatmap:pn,image:Wn,"kpi-grid":vn,"line-chart":Qo,list:Gn,"list-block":Un,map:mr,"meter-list":kn,"metric-grid":Sn,"pie-chart":on,"player-card":Ar,playlist:Tr,"product-card":yr,"purchase-complete":Nr,"purchase-items":Sr,"radar-chart":rn,"radial-chart":sn,"record-card":wr,"ride-status":Br,"sankey-chart":ln,"scatter-chart":dn,steps:Zn,"sunburst-chart":gn,"switch-group":Ka,"tag-list":En,text:Bn,"toggle-group":ja,"view-event":Vr,"weather-current":Wr,"weather-forecast":Er};function qa({className:t,exportFormats:e,node:o,onAction:r,onSelect:n}){let s={exportFormats:e,onAction:r,onSelect:n},d=m=>m.map(l=>M(qa,{...s,node:l},l.id));switch(o.kind){case"item-card":return M(jn,{className:t,component:o,left:o.left?d(o.left):void 0,middle:d(o.middle),right:o.right?d(o.right):void 0,onAction:r,onSelect:n});case"item-card-group":return M(qn,{className:t,component:o,children:d(o.children)});case"product-signals":return M(Mr,{className:t,component:o,renderPanel:m=>M(be,{variant:"plain",children:M(qa,{...s,node:m})})});case"tabs":return M(On,{className:t,component:o,renderPanel:m=>M(be,{variant:"plain",children:d(m)}),onSelect:n});case"dashboard":return M(fn,{className:t,component:o,children:M(be,{variant:"plain",children:d(o.children)})});case"card":return M(Da,{className:t,component:o,children:M(be,{variant:"plain",children:d(o.children)})});case"row":return M(La,{className:t,component:o,children:d(o.children)});case"col":return M(Fa,{className:t,component:o,children:d(o.children)});case"grid":return M(Ma,{className:t,component:o,children:d(o.children)});case"spacer":return M(Ba,{className:t,component:o});case"divider":return M(za,{className:t,component:o});case"heading":return M($r,{className:t,component:o});case"button":return M(Kr,{className:t,component:o,onAction:r,onSelect:n});case"badge":return M(Or,{className:t,component:o});case"icon":return M(jr,{className:t,component:o});case"rating":return M(qr,{className:t,component:o});case"progress":return M(Yr,{className:t,component:o});default:{let m=Vp[o.kind];return M(m,{...s,className:t,component:o})}}}export{Pp as ComponentRenderer,Sa as ComponentSkeleton};