@heroui/agent 0.2.0-beta.11 → 0.2.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/chunk-4JEZZR5J.js +1 -0
- package/dist/chunk-CLHBM3HQ.js +1 -0
- package/dist/chunk-S3NBK5KL.js +2 -0
- package/dist/chunk-UHHKMESI.js +1 -0
- package/dist/chunk-WVP7S2A4.js +2 -0
- package/dist/component-renderer-XOCP6UFF.js +1 -0
- package/dist/contracts.d.ts +10 -8
- package/dist/contracts.js +2 -2
- package/dist/css/index.css +1 -1
- package/dist/embed-runtime-7MSWJUQM.js +5 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/internal/models.js +1 -1
- package/dist/internal/theme.js +1 -1
- package/dist/next.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-2XBFFSW2.js +0 -1
- package/dist/chunk-MXLGM4WV.js +0 -1
- package/dist/chunk-OA3TG5CS.js +0 -1
- package/dist/chunk-QDIT4IVA.js +0 -2
- package/dist/chunk-TV4IIQ5G.js +0 -2
- package/dist/component-renderer-GG6JVRUG.js +0 -1
- package/dist/embed-runtime-RJ7JHMFX.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-beta.13
|
|
4
|
+
|
|
5
|
+
- Apply the configured Design System accent across Agent controls, generated UI, focus states,
|
|
6
|
+
launchers, and user-message bubbles, including when a Pro design theme is active.
|
|
7
|
+
- Keep the host page scrollable when the Agent is open as a floating desktop panel while
|
|
8
|
+
preserving modal scroll locking on mobile and expanded sidebars.
|
|
9
|
+
|
|
10
|
+
## 0.2.0-beta.12
|
|
11
|
+
|
|
12
|
+
- Default the Agent API origin to `https://api.heroui.pro` so embeds and `createAuthToken` reach
|
|
13
|
+
production without an `_api.baseUrl` override.
|
|
14
|
+
- Default the Agent model picker to Gemini 3.7 Flash, and keep retired Gemini 3.5/3.6 Flash ids
|
|
15
|
+
resolving to it.
|
|
16
|
+
- Sanitize generated HTML and SVG markup with DOMPurify before rendering, and keep the sanitizer
|
|
17
|
+
external to the published bundle.
|
|
18
|
+
- Preserve suggested-prompt titles on first-turn submission instead of replacing them with a
|
|
19
|
+
generated conversation title.
|
|
20
|
+
|
|
3
21
|
## 0.2.0-beta.9
|
|
4
22
|
|
|
5
23
|
- Reduce the published JavaScript footprint while preserving ESM code splitting, lazy UI tiers,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var m=["base","brutalism","glass","mouve"];function k(e){return m.includes(e)?e:"base"}var A={accent:"accent",background:"background",foreground:"foreground",overlay:"overlay",surface:"surface",surfaceSecondary:"surface-secondary",tooltip:"tooltip"},p={"--accent":"var(--ha-accent)","--accent-foreground":"var(--ha-accent-foreground)","--accent-hover":"var(--ha-accent)","--field-border-focus":"var(--ha-accent)","--focus":"var(--ha-accent)"},l="oklch(from var(--ha-accent) clamp(0, (0.7 - l) * 1000, 1) 0 h)",d="oklch(from var(--ha-launcher-bg) clamp(0, (0.7 - l) * 1000, 1) 0 h)";function R(e){let r={},o=n(e,"light"),t=n(e,"dark");return o&&(r["--ha-theme-launcher-background-light"]=o,r["--ha-theme-launcher-foreground-light"]=d),t&&(r["--ha-theme-launcher-background-dark"]=t,r["--ha-theme-launcher-foreground-dark"]=d),r}var y="oklch(from var(--ha-card-secondary) calc(l - 0.0151) c h)",T="oklch(from var(--ha-card-secondary) calc(l + 0.017) c h)",u={pill:"0.875rem",round:"0.5rem",sharp:"0.125rem",soft:"0.375rem"},C=12,S=18;function f(e){let r=e?.trim();if(!(!r||r.length>256||/[;{}]/.test(r)))return r}function n(e,r){if(e!==void 0)return f(typeof e=="string"?e:e[r])}function b(e){if(!e)return{};let r={},o=!!(n(e.colors?.accent,"light")||n(e.colors?.accent,"dark"));e.radius&&e.radius in u&&(r["--radius"]=u[e.radius]);let t=f(e.typography?.fontFamily);t&&(r["--ha-font-family"]=t);let a=e.typography?.baseSize;if(typeof a=="number"&&Number.isFinite(a)){let c=Math.min(Math.max(Math.round(a),C),S);r["--ha-font-size"]=`${c}px`}for(let[c,s]of Object.entries(A)){let i=e.colors?.[c],g=n(i,"light"),h=n(i,"dark");g&&(r[`--ha-theme-${s}-light`]=g),h&&(r[`--ha-theme-${s}-dark`]=h)}return o&&Object.assign(r,p),n(e.colors?.accent,"light")&&(r["--ha-theme-accent-foreground-light"]=l),n(e.colors?.accent,"dark")&&(r["--ha-theme-accent-foreground-dark"]=l),n(e.colors?.surfaceSecondary,"light")&&(r["--ha-theme-surface-tertiary-light"]=y),n(e.colors?.surfaceSecondary,"dark")&&(r["--ha-theme-surface-tertiary-dark"]=T),r}export{m as a,k as b,l as c,d,R as e,b as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h}from"./chunk-CR3H7AVI.js";import{useCallback as A,useEffect as C,useRef as f}from"react";import{jsx as R}from"react/jsx-runtime";function E({children:e,className:t,offset:r=0,size:i=32,style:l,...d}){let p=f(null),a=f(null),s=f(null),c=A(()=>{let n=p.current;if(!n)return;let u=n.scrollLeft>r,y=n.scrollLeft+n.clientWidth+r<n.scrollWidth,m=u&&y?"both":u?"left":y?"right":"none";a.current!==m&&(a.current=m,s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null,delete n.dataset.leftScroll,delete n.dataset.rightScroll,delete n.dataset.leftRightScroll,m==="both"?n.dataset.leftRightScroll="true":m!=="none"&&(n.dataset[`${m}Scroll`]="true")}))},[r]);return C(()=>{let n=p.current;if(!n)return;c(),n.addEventListener("scroll",c,{passive:!0});let u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(n),()=>{n.removeEventListener("scroll",c),u?.disconnect(),s.current!==null&&cancelAnimationFrame(s.current),s.current=null,a.current=null}},[c]),R("div",{ref:p,className:h("aui-scroll-shadow",t),"data-slot":"agent-ui-scroll-shadow",style:{"--scroll-shadow-size":`${i}px`,...l},...d,children:e})}import{jsx as H}from"react/jsx-runtime";function J({className:e,size:t="sm",variant:r="secondary",...i}){return H("button",{className:h("aui-button",e),"data-size":t,"data-slot":"agent-ui-action-button","data-variant":r,type:"button",...i})}import{Button as M}from"@heroui/react";import{useEffect as b,useLayoutEffect as x,useRef as w,useState as L}from"react";import v from"dompurify";function S(e){return v.sanitize(e,{RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0}})}function ee(e){return v.sanitize(e,{RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0}})}import{jsx as o,jsxs as g}from"react/jsx-runtime";var N=2e3,k="github-dark",z="github-light",T={bash:()=>import("shiki/langs/bash.mjs"),css:()=>import("shiki/langs/css.mjs"),html:()=>import("shiki/langs/html.mjs"),javascript:()=>import("shiki/langs/javascript.mjs"),json:()=>import("shiki/langs/json.mjs"),jsx:()=>import("shiki/langs/jsx.mjs"),markdown:()=>import("shiki/langs/markdown.mjs"),python:()=>import("shiki/langs/python.mjs"),shellscript:()=>import("shiki/langs/shellscript.mjs"),sql:()=>import("shiki/langs/sql.mjs"),tsx:()=>import("shiki/langs/tsx.mjs"),typescript:()=>import("shiki/langs/typescript.mjs")},_=new Map;function P(e){let t={js:"javascript",md:"markdown",py:"python",sh:"shellscript",shell:"shellscript",ts:"typescript"},r=e.toLowerCase();return r in T?r:t[r]??null}async function B(e){let[{createHighlighterCore:t},{createJavaScriptRegexEngine:r},i,l,d]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript"),import("shiki/themes/github-light.mjs"),import("shiki/themes/github-dark.mjs"),T[e]()]);return t({engine:r(),langs:[d.default],themes:[i.default,l.default]})}async function F(e,t){let r=P(t);if(!r)return null;let i=_.get(r),l=i??B(r);return i||_.set(r,l),(await l).codeToHtml(e,{defaultColor:!1,lang:r,themes:{dark:k,light:z}})}async function D(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select();try{return document.execCommand?.("copy")??!1}catch{return!1}finally{t.remove()}}}function O({html:e}){let t=w(null);return x(()=>{let r=t.current;if(r)return r.replaceChildren(S(e)),()=>r.replaceChildren()},[e]),o("div",{ref:t,className:"aui-code__content","data-slot":"agent-ui-code"})}function V(){return o("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:o("path",{clipRule:"evenodd",d:"M10.218 3.216a.75.75 0 0 0-1.436-.431l-3 10a.75.75 0 0 0 1.436.43zM4.53 4.97a.75.75 0 0 1 0 1.06L2.56 8l1.97 1.97a.75.75 0 0 1-1.06 1.06l-2.5-2.5a.75.75 0 0 1 0-1.06l2.5-2.5a.75.75 0 0 1 1.06 0m6.94 6.06a.75.75 0 0 1 0-1.06L13.44 8l-1.97-1.97a.75.75 0 0 1 1.06-1.06l2.5 2.5a.75.75 0 0 1 0 1.06l-2.5 2.5a.75.75 0 0 1-1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function U(){return o("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:o("path",{clipRule:"evenodd",d:"M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5",fill:"currentColor",fillRule:"evenodd"})})}function G(){return o("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:o("path",{clipRule:"evenodd",d:"M13.488 3.43a.75.75 0 0 1 .081 1.058l-6 7a.75.75 0 0 1-1.1.042l-3.5-3.5A.75.75 0 0 1 4.03 6.97l2.928 2.927 5.473-6.385a.75.75 0 0 1 1.057-.081",fill:"currentColor",fillRule:"evenodd"})})}function ie({code:e,language:t="text"}){let r=`${t}:${e}`,[i,l]=L(null),[d,p]=L(!1),a=w(null);b(()=>{let c=!1;async function n(){try{let u=await F(e,t);c||l(u?{html:u,key:r}:null)}catch{c||l(null)}}return n(),()=>{c=!0}},[e,r,t]),b(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);let s=async()=>{await D(e)&&(p(!0),a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{p(!1),a.current=null},N))};return g("div",{className:"aui-code","data-slot":"agent-ui-code-block",children:[g("header",{className:"aui-code__header","data-slot":"agent-ui-code-header",children:[g("span",{className:"aui-code__language",children:[o(V,{}),o("span",{children:t.toUpperCase()})]}),o(M,{isIconOnly:!0,"aria-label":d?"Code copied":"Copy code",className:"aui-code__copy","data-slot":"agent-ui-code-copy",size:"sm",variant:"ghost",onPress:s,children:g("span",{className:"aui-code__copy-swap","data-copied":d||void 0,"data-slot":"agent-ui-code-copy-icon",children:[o("span",{className:"aui-code__copy-icon aui-code__copy-icon--copy",children:o(U,{})}),o("span",{className:"aui-code__copy-icon aui-code__copy-icon--check",children:o(G,{})})]})})]}),i?.key===r?o(O,{html:i.html}):o("div",{className:"aui-code__content","data-slot":"agent-ui-code",children:o("pre",{children:o("code",{children:e})})})]})}export{J as a,E as b,ee as c,ie as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{E as on,a as qe,c as je,d as ze,f as de,g as Be,j as Ke,k as Qe,l as Ze,o as fe,q as en,r as nn,w as tn}from"./chunk-WVP7S2A4.js";import{a as Je}from"./chunk-6ZJJN322.js";import{d as Xe,e as Ye}from"./chunk-UHHKMESI.js";import{useCallback as C,useEffect as w,useEffectEvent as ht,useLayoutEffect as Sn,useMemo as Ce,useRef as v,useState as p,useSyncExternalStore as Tn}from"react";import{createRoot as yt}from"react-dom/client";import{SparklesFill as Kn}from"@gravity-ui/icons";import{jsx as Jn}from"react/jsx-runtime";function rn(e){return Jn(Kn,{...e})}import{jsx as me}from"react/jsx-runtime";function Xn(e){return/\.svg(?:[?#]|$)/i.test(e)||/^data:image\/svg\+xml[;,]/i.test(e)}function sn(e){return`url("${e.replace(/["\\\n\r]/g,encodeURIComponent)}")`}function an({icon:e}){return e?Xn(e)?me("span",{"aria-hidden":"true",className:"ha-launcher__icon ha-launcher__icon--tinted",style:{WebkitMaskImage:sn(e),maskImage:sn(e)}}):me("img",{alt:"",className:"ha-launcher__icon",src:e}):me(rn,{})}function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ln(e,n){if(n===void 0)return e;if(!cn(e)||!cn(n))return n;let t={...e};for(let[r,a]of Object.entries(n))a!==void 0&&(t[r]=r in e?ln(e[r],a):a);return t}function un(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,startScreen:e.startScreen},r=ln(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,startScreen:n.startScreen});return{...n,...r}}function dn(e){return!!e.appearance?.theme?.typography?.fontFamily?.trim()}var fn=1,c=Symbol("invalid");function G(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e){if(e!==void 0)return typeof e=="string"?e:c}function I(e){if(e!==void 0)return typeof e=="boolean"?e:c}function pe(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 mn(e){if(e===void 0)return;if(typeof e=="string")return e;if(!G(e))return c;let n=S(e.dark),t=S(e.light);return n===c||t===c?c:{...n===void 0?{}:{dark:n},...t===void 0?{}:{light:t}}}function Yn(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 Qn(e){if(e!==void 0)return!Array.isArray(e)||e.some(n=>typeof n!="string")?c:e}function b(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 T(e){return e===c?void 0:e}var Zn=["accent","background","foreground","overlay","surface","surfaceSecondary","tooltip"];function et(e){return b(e,{launcher:n=>n===void 0?void 0:b(n,{background:mn,icon:S,position:M(["bottom-left","bottom-right"]),style:Yn}),panel:n=>n===void 0?void 0:b(n,{expandable:I,expanded:I,initialHeight:t=>t===void 0||typeof t=="string"?t:pe(t),initialWidth:t=>t===void 0||typeof t=="string"?t:pe(t)}),theme:n=>n===void 0?void 0:b(n,{colorScheme:M(["dark","light","system"]),colors:t=>t===void 0?void 0:b(t,Object.fromEntries(Zn.map(r=>[r,mn]))),designTheme:M(["base","brutalism","glass","mouve"]),radius:M(["pill","round","sharp","soft"]),typography:t=>t===void 0?void 0:b(t,{baseSize:pe,fontFamily:S})}),viewMode:M(["floating","sidebar"])})}function nt(e){return b(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"&&Ke(r));return t.length===n.length?t:c},defaultModel:S,dictation:I,disclaimer:n=>n===!1?!1:S(n),modelPicker:I,placeholder:S})}function tt(e){return b(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 ot(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!==fn)return null;let n=e.revision;if(typeof n!="string"||!n)return null;let t=T(et(e.appearance)),r=T(b(e.capabilities,{imageSearch:I,newsSearch:I,webSearch:I})),a=T(nt(e.composer)),l=T(tt(e.markdown)),f=T(b(e.permissions,{defaultMode:M(["ask","auto","full"]),showPicker:I})),u=T(ot(e.responseActions)),m=T(b(e.startScreen,{greeting:S,promptShortcuts:I,prompts:Qn})),k=T(b(e.webfont,{familyName:g=>typeof g=="string"&&g?g:c,fontFaceUrl:S,stylesheetUrl:S}));return{...t?{appearance:t}:{},...r?{capabilities:r}:{},...a?{composer:a}:{},...l?{markdown:l}:{},...f?{permissions:f}:{},...u===void 0?{}:{responseActions:u},...m?{startScreen:m}:{},...k?{webfont:k}:{},revision:n,version:fn}}function ge(e){return`heroui-agent:config:${e}`}var pn=1;function gn(e){try{let n=window.localStorage.getItem(ge(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===pn&&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 he(e,n,t=Date.now()){try{let r={cacheVersion:pn,cachedAt:t,config:n};window.localStorage.setItem(ge(e),JSON.stringify(r))}catch{}}function hn(e){try{window.localStorage.removeItem(ge(e))}catch{}}async function yn(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 rt,Microphone as it,Plus as st,ShieldCheck as at}from"@gravity-ui/icons";import{useEffect as ct,useRef as lt}from"react";import{Fragment as wn,jsx as h,jsxs as ye}from"react/jsx-runtime";var ut={ask:"Ask for approval",auto:"Approve for me",full:"Full access"};function Cn({onFileDialogActiveChange:e,onIntent:n,options:t}){return{end:h(ft,{options:t}),footer:t.composerDisclaimer?h("p",{className:"ha-footnote",children:Je(t.composerDisclaimer)}):null,start:t.composerAttachmentContentTypes.length>0?h(dt,{accept:t.composerAttachmentAccept,agentId:t.agentId,onFileDialogActiveChange:e,onIntent:n}):null}}function dt({accept:e,agentId:n,onFileDialogActiveChange:t,onIntent:r}){let a=lt(null);return ct(()=>{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]),ye(wn,{children:[h("input",{ref:a,multiple:!0,accept:e,"aria-label":"Choose files to attach",className:"ha-file-input",type:"file",onChange:l=>{nn(n,Array.from(l.currentTarget.files??[])),l.currentTarget.value="",t(!1),r()}}),h("button",{"aria-label":"Attach files",className:"ha-attach",type:"button",onClick:()=>{t(!0),a.current?.click()},children:h(st,{"aria-hidden":"true"})})]})}function ft({options:e}){let n=e.composerDefaultModel??Xe,t=Ye.find(r=>r.id===n)?.label??n;return ye(wn,{children:[e.permissionShowPicker&&e.tools.length>0?h(bn,{icon:h(at,{"aria-hidden":"true",className:"aui-permission-picker__trigger-icon"}),kind:"permission",label:ut[e.permissionDefaultMode],tone:e.permissionDefaultMode==="full"?"warning":void 0}):null,e.composerModelPicker?h(bn,{kind:"model",label:t}):null,e.composerDictation?h("button",{disabled:!0,"aria-label":"Dictate message",className:"ha-dictation",type:"button",children:h(it,{"aria-hidden":"true"})}):null]})}function bn({icon:e,kind:n,label:t,tone:r}){let a=`aui-${n}-picker`;return h("div",{className:`${a} ha-${n}-picker`,"data-tone":r,children:ye("button",{disabled:!0,"aria-label":n==="model"?"AI model":"Tool permissions",className:`${a}__trigger ha-shell-picker-trigger`,type:"button",children:[e,h("span",{className:`${a}__value`,children:t}),h(rt,{"aria-hidden":"true",className:`${a}__indicator`})]})})}var mt=[".woff2",".woff",".ttf",".otf",".eot"];function pt(e){return`heroui-agent-font-${e.familyName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}function gt(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 Rn(e,n){try{let t=new URL(e);if(t.protocol!=="https:")return!1;if(!n)return!0;let r=t.pathname.toLowerCase();return mt.some(a=>r.endsWith(a))}catch{return!1}}function An(e){if(!e||typeof document>"u")return()=>{};let n=pt(e);if(document.getElementById(n))return()=>{};if(e.stylesheetUrl&&Rn(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&&Rn(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('${gt(e.fontFaceUrl)}');`,"}"].join(`
|
|
2
|
+
`),document.head.append(t),()=>t.remove()}return()=>{}}import{Fragment as Nn,jsx as O,jsxs as En}from"react/jsx-runtime";var bt=600,Ct=5*6e4,wt="heroui-agent:open:";function we(e){return`${wt}${e}`}function Rt(e){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(we(e))==="true"}catch{return!1}}function be(e,n){try{n?window.sessionStorage.setItem(we(e),"true"):window.sessionStorage.removeItem(we(e))}catch{}}var kn;function In(){return kn??=import(/* webpackPrefetch: true */"./embed-runtime-7MSWJUQM.js").then(e=>e.default),kn}var D=new Map,Re=new Set;function Mn(e){return e?D.get(e):[...D.values()][D.size-1]}function vn(){for(let e of Re)e()}function At(e){return Re.add(e),()=>Re.delete(e)}function St(e){let n=window.matchMedia?.("(prefers-color-scheme: dark)");return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}function kt(){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 It(e,n,t){let[r]=p(()=>!t||typeof window>"u"?null:gn(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 w(()=>{if(!t)return;let f=new AbortController,u=!0,m=g=>{l(q=>q.presentationReady?q:{config:g,presentationReady:!0})},k=window.setTimeout(()=>{u&&(f.abort(),m(r?.config??null))},bt);return yn(n,e,{...r?.config.revision?{revision:r.config.revision}:{},signal:f.signal}).then(g=>{if(!(!u||f.signal.aborted)){if(g.status==="ok"){he(e,g.config),m(g.config);return}if(g.status==="not-modified"){r&&he(e,r.config),m(r?.config??null);return}if(g.status==="missing"){hn(e),m(null);return}m(r?.config??null)}}).finally(()=>{!u||f.signal.aborted||window.clearTimeout(k)}),()=>{u=!1,f.abort(),window.clearTimeout(k)}},[n,r,t,e]),t?a:{config:null,presentationReady:!0}}function ao(e){let n=C(()=>Mn(e)?.ready??!1,[e]),t=Tn(At,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 co(e){let n=`${e.agentId}\0${e._api?.baseUrl??""}\0${e.remoteConfig!==!1}`;return O(vt,{...e},n)}function vt(e){let{_api:n,agentId:t,appearance:r,capabilities:a,componentExports:l,composer:f,context:u,getAuthToken:m,markdown:k,onFeedback:g,onReady:q,permissions:On,preload:Pn,remoteConfig:_n=!0,reopenOnRefresh:Ae,responseActions:Un,showLauncher:Ln,startNewConversationOnOpen:xn,startScreen:Fn,tools:Se}=e,j=k?.plugins,$n=(n?.baseUrl??je).replace(/\/$/,""),{config:ke,presentationReady:x}=It(t,$n,_n),Ie=JSON.stringify({_api:n,appearance:r,capabilities:a,componentExports:l,composer:f,markdown:k?{...k,plugins:void 0}:void 0,permissions:On,preload:Pn,remote:ke,reopenOnRefresh:Ae,responseActions:Un,showLauncher:Ln,startNewConversationOnOpen:xn,startScreen:Fn}),o=Ce(()=>{let{remote:i,...s}=JSON.parse(Ie),d=un(i,{...s,agentId:t,getAuthToken:m});return on({...d,context:u,markdown:d.markdown?{...d.markdown,plugins:j}:j?{plugins:j}:void 0,onFeedback:g,tools:Se})},[u,m,j,g,t,Ie,Se]),z=Ce(()=>new qe(t,m),[t,m]),ve=dn(e),Ee=ke?.webfont;w(()=>{if(!ve)return An(Ee)},[ve,Ee]);let[B]=p(()=>Ae===!0&&Rt(t)),[ee,V]=p(B),[P,Hn]=p(1),[Ne,Te]=p(1),[Me,Oe]=p(!1),[K,Dn]=p(B||o.startNewConversationOnOpen?null:void 0),[E,Vn]=p(null),[J,Wn]=p(null),[Pe,Gn]=p(!1),[ne,te]=p(!1),[qn,_e]=p(null),oe=v(1),Ue=v(null),re=v(!1),ie=v(null),Le=v(null),F=v(B),se=v(null),X=v(null),ae=v([]),jn=Tn(St,kt,()=>!1),ce=o.designTheme==="base"?null:`${o.designTheme}-${o.colorScheme==="system"?jn?"dark":"light":o.colorScheme}`,_=x&&qn===P&&J!==null,y=x&&ee,[Y,zn]=p(B||o.preload),R=C(()=>zn(!0),[]),[W,$]=p(!1),[xe,Fe]=p(!1),le=C(()=>$(!0),[]);w(()=>{if(!W||!E)return;let i=()=>{queueMicrotask(()=>{let s=E.querySelector(".ha-composer:not([hidden] *)");s&&en(s,document.activeElement)||$(!1)})};return E.addEventListener("focusout",i),()=>E.removeEventListener("focusout",i)},[W,E]),w(()=>{Y&&z.get().catch(()=>{})},[Y,z]),w(()=>{o.reopenOnRefresh?be(o.agentId,ee):be(o.agentId,!1)},[ee,o.agentId,o.reopenOnRefresh]),w(()=>{if(!Y)return;if(!x){In().catch(()=>{});return}let i=!0;return In().then(s=>{i&&Wn(()=>s)}).catch(()=>{}),()=>{i=!1}},[x,Y]),w(()=>{if(!y||o.viewMode!=="sidebar"||window.innerWidth<640)return;let i=document.documentElement,s=i.style.marginRight,d=i.style.transition,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ue=Math.min(de(o.agentId,window.innerWidth),window.innerWidth);return A||(i.style.transition=[d,"margin-right .28s cubic-bezier(.2,.8,.2,1)"].filter(Boolean).join(", ")),i.style.marginRight=`${ue}px`,()=>{i.style.marginRight=s,window.setTimeout(()=>{i.style.transition=d},300)}},[y,o.agentId,o.viewMode]),w(()=>{let i=document.createElement("div"),s=document.createElement("div");i.dataset.herouiAgent=o.agentId,s.className="ha-root",se.current=i,ie.current=s,X.current=yt(s),i.append(s),document.body.append(i);let d=!0;return queueMicrotask(()=>{d&&Vn(s)}),()=>{d=!1,fe(o.agentId,!1);let A=X.current;ie.current=null,se.current=null,X.current=null,ae.current=[],queueMicrotask(()=>{A?.unmount(),i.remove()})}},[o.agentId]),Sn(()=>{let i=ie.current,s=se.current;if(!i||!s)return;i.className=ce?`ha-root ${ce}`:"ha-root",i.dataset.theme=o.colorScheme,i.dataset.viewMode=o.viewMode,i.dataset.position=o.launcherPosition,s.dataset.open=y?"true":"false",s.dataset.viewMode=o.viewMode,s.dataset.position=o.launcherPosition,o.launcherOffset?(s.style.setProperty("--ha-launcher-x",`${o.launcherOffset.x}px`),s.style.setProperty("--ha-launcher-y",`${o.launcherOffset.y}px`)):(s.style.removeProperty("--ha-launcher-x"),s.style.removeProperty("--ha-launcher-y")),o.viewMode==="sidebar"&&s.style.setProperty("--ha-sidebar-width",`${de(o.agentId,window.innerWidth)}px`);let d={...o.themeStyle,...o.panelStyle};for(let A of ae.current)A in d||i.style.removeProperty(A);for(let[A,ue]of Object.entries(d))i.style.setProperty(A,ue);ae.current=Object.keys(d)},[ce,y,o.colorScheme,o.agentId,o.launcherOffset,o.launcherPosition,o.panelStyle,o.themeStyle,o.viewMode,E]);let N=C(i=>{fe(o.agentId,!1),Fe(!1),_e(null),Dn(i);let s=oe.current+1;oe.current=s,Hn(s)},[o.agentId]),$e=C(i=>{oe.current===i&&(Gn(!0),_e(i))},[]),Bn=ht(()=>q?.());w(()=>{!_||Le.current===P||(Le.current=P,Bn())},[P,_]);let U=C(()=>{F.current=!1,re.current=!0,V(!1),$(!1),N(o.startNewConversationOnOpen?null:void 0)},[o.startNewConversationOnOpen,N]);w(()=>{y||!_||!re.current||(re.current=!1,requestAnimationFrame(()=>Ue.current?.focus()))},[y,_]);let H=C(()=>{F.current=!0,V(!0),R()},[R]),He=R,Q=C(i=>{let s=i?Qe(i):null;s&&Ze(o.agentId,s),F.current=!0,V(!0),$(!1),R(),N(null)},[o.agentId,N,R]),De=C(i=>{F.current=!0,V(!0),$(!1),R(),N(i)},[N,R]),Ve=C(()=>{y||F.current?U():H()},[U,y,H]),We=C(()=>{te(!1),Oe(!1),Te(i=>i+1)},[]),Ge=C(()=>{let i=[`heroui-agent:anonymous:${o.agentId}`,`heroui-agent:conversation:${o.agentId}:`,`heroui-agent:history:${o.agentId}:`];for(let s=localStorage.length-1;s>=0;s-=1){let d=localStorage.key(s);d&&i.some(A=>d.startsWith(A))&&localStorage.removeItem(d)}F.current=!1,te(!1),V(!1),$(!1),be(o.agentId,!1),Oe(!0),Te(s=>s+1),N(),window.setTimeout(()=>{import("./composer-draft-NSKK65F3.js").then(({clearAgentComposerDraftsForProject:s})=>s(o.agentId)).catch(()=>{})},0)},[o.agentId,N]);return w(()=>{let i={hide:U,newConversation:Q,preload:He,ready:_,refreshAuth:We,show:H,shutdown:Ge,toggle:Ve};return D.set(o.agentId,i),vn(),()=>{D.get(o.agentId)===i&&(D.delete(o.agentId),vn())}},[U,Q,o.agentId,He,_,We,H,Ge,Ve]),Sn(()=>{let i=X.current;if(!E||!i)return;let s=Cn({onFileDialogActiveChange:Fe,onIntent:R,options:o});i.render(En(Nn,{children:[x&&o.showLauncher&&!y?En("button",{ref:Ue,"aria-expanded":!1,"aria-haspopup":"dialog",className:"ha-launcher",style:o.launcherStyle,type:"button","aria-label":ne?"Open data assistant, unread messages":"Open data assistant",onClick:H,children:[O(an,{icon:o.launcherIcon}),ne?O("span",{"aria-hidden":"true",className:"ha-launcher__unread"}):null]}):null,J&&!xe?O(J,{composerControlsRevealed:W,conversationEpoch:P,identityEpoch:Ne,identityReset:Me,open:y,options:o,requestedConversationId:K,shellComposerEndSlot:s.end,shellComposerFooterSlot:s.footer,showReadyLoader:!Pe&&K!==null,tokenManager:z,onClose:U,onComposerControlsReveal:le,onNewConversation:Q,onReady:$e,onSelectConversation:De,onUnreadChange:te}):O(Be,{agentId:o.agentId,defaultExpanded:o.panelExpanded,expandable:o.panelExpandable,historySlot:O(Nn,{}),name:"Data assistant",open:y,viewMode:o.viewMode,onClose:U,children:K===null?O(tn,{composerConnecting:!0,agentId:o.agentId,composerControlsAvailable:o.composerControlsAvailable,composerControlsRevealed:W,composerEndSlot:s.end,composerFooterSlot:s.footer,composerStartSlot:s.start,greeting:o.greeting,placeholder:o.composerPlaceholder,suggestedPrompts:o.suggestedPrompts??[],onComposerControlsReveal:le,onIntent:R},`shell-${P}`):O(ze,{})})]}))},[J,W,xe,P,$e,ne,Pe,U,Ne,Me,y,Q,o,E,_,x,K,R,le,De,H,z]),null}export{ao as a,co as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=["moonshotai/Kimi-K3","openai/gpt-5.6-luna","openai/gpt-5.6-terra","openai/gpt-5.6-sol","google/gemini-3.7-flash","anthropic/claude-sonnet-5","anthropic/claude-opus-4.8"],t={"google/gemini-3.5-flash":"google/gemini-3.7-flash","google/gemini-3.6-flash":"google/gemini-3.7-flash"};function r(e){return t[e]??e}var a="google/gemini-3.7-flash",l=[{description:"Flagship model for coding, reasoning, and knowledge work",id:"moonshotai/Kimi-K3",label:"Kimi K3",provider:"Moonshot AI",tier:"light"},{description:"Fast answers and lightweight agent workflows",id:"openai/gpt-5.6-luna",label:"GPT-5.6 Luna",provider:"OpenAI",tier:"light"},{description:"Balanced reasoning for everyday agent tasks",id:"openai/gpt-5.6-terra",label:"GPT-5.6 Terra",provider:"OpenAI",tier:"codegen"},{description:"Deep reasoning for complex, multi-step analysis",id:"openai/gpt-5.6-sol",label:"GPT-5.6 Sol",provider:"OpenAI",tier:"complex"},{description:"Fast multimodal analysis with a large context window",id:"google/gemini-3.7-flash",label:"Gemini 3.7 Flash",provider:"Google",tier:"light"},{description:"Strong agentic reasoning and polished UI decisions",id:"anthropic/claude-sonnet-5",label:"Claude Sonnet 5",provider:"Anthropic",tier:"codegen"},{description:"Highest-capability Claude for difficult research and analysis",id:"anthropic/claude-opus-4.8",label:"Claude Opus 4.8",provider:"Anthropic",tier:"complex"}],s=new Set(n);function g(e){return typeof e=="string"&&s.has(e)}function d(e){let o=e?r(e):void 0;return l.find(i=>i.id===o)?.tier??"light"}export{n as a,t as b,r as c,a as d,l as e,g as f,d as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as le,e as ce,f as de}from"./chunk-4JEZZR5J.js";var ht="0.2.0-beta.13",ue="https://api.heroui.pro";import{jsx as Fe,jsxs as Ue}from"react/jsx-runtime";function At({indicator:e,label:t="Loading agent\u2026"}){return Ue("div",{"aria-live":"polite",className:"ha-agent-loading",role:"status",children:[e,Fe("span",{children:t})]})}import{jsx as me,jsxs as Be}from"react/jsx-runtime";function z({children:e,shortcut:t}){return Be("span",{"aria-hidden":"true",className:"ha-control-tooltip",children:[me("span",{children:e}),t?me("kbd",{className:"ha-control-tooltip__shortcut",children:t}):null]})}import{ChevronsCollapseUpRight as ze,ChevronsExpandUpRight as Ke}from"@gravity-ui/icons";import{useCallback as he,useEffect as K,useEffectEvent as $e,useLayoutEffect as Xe,useRef as oe,useState as $}from"react";function pe(e){return`heroui-agent:sidebar-width:${e}`}function te(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 ge(e,t){let n=Number.NaN;try{n=Number(localStorage.getItem(pe(e))??Number.NaN)}catch{}return te(Number.isFinite(n)?n:420,t)}function ne(e,t){try{localStorage.setItem(pe(e),String(Math.round(t)))}catch{}}import{jsx as d,jsxs as O}from"react/jsx-runtime";function kt({actionsSlot:e,agentId:t,children:n,defaultExpanded:o=!1,expandable:s=!0,expandedSidebarSlot:b,expandedTitle:T,historySlot:i,keepMounted:c=!1,name:p,onClose:M,onNewConversation:R,open:f,viewMode:w}){let y=oe(null),u=oe(0),[L,Q]=$(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:null),H=$e(M),[h,P]=$(o),F=L!==null,k=L??!1,_=w==="floating",x=!_&&!k,r=k||x&&h,[g,C]=$(!1),_e=!k&&s,U=x&&h&&b;return Xe(()=>{let a=window.matchMedia?.("(max-width: 639px)");if(!a)return;let A=()=>Q(a.matches);return A(),a.addEventListener?.("change",A),()=>a.removeEventListener?.("change",A)},[]),K(()=>{if(!g)return;let a=y.current;if(!a)return;let A=()=>C(!1),E=B=>{let{propertyName:m,target:v}=B;v===a&&(m!=="width"&&m!=="height"||A())},ee=window.setTimeout(A,600);return a.addEventListener("transitionend",E),()=>{window.clearTimeout(ee),a.removeEventListener("transitionend",E)}},[g]),K(()=>{if(!f||!F)return;let a=y.current;if(!a)return;let A=document.activeElement instanceof HTMLElement?document.activeElement:null;a.open||(r&&typeof a.showModal=="function"?a.showModal():!r&&typeof a.show=="function"?a.show():a.open=!0);let E;if(r){let m=document.documentElement,v=window.scrollX,I=window.scrollY,W=m.style.overflow,G=document.body.style.overflow,V=document.body.style.position,Ie=document.body.style.top,Oe=document.body.style.left,De=document.body.style.right,Le=document.body.style.width;m.style.overflow="hidden",document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`${-I}px`,document.body.style.left=`${-v}px`,document.body.style.right="0",document.body.style.width="100%",E=()=>{m.style.overflow=W,document.body.style.overflow=G,document.body.style.position=V,document.body.style.top=Ie,document.body.style.left=Oe,document.body.style.right=De,document.body.style.width=Le,window.scrollTo(v,I)}}let ee=a.querySelector("button,textarea,input,[tabindex]:not([tabindex='-1'])");a.contains(document.activeElement)||ee?.focus();let B=m=>{if(!r&&m.key==="Escape"){if(fe(a)){u.current=Date.now(),m.preventDefault(),m.stopPropagation();return}m.preventDefault(),H();return}if(!r||m.key!=="Tab")return;let v=Array.from(a.querySelectorAll("button:not(:disabled),textarea:not(:disabled),input:not(:disabled),[tabindex]:not([tabindex='-1'])"));if(v.length===0)return;let I=v[0],W=v[v.length-1],G=a.getRootNode(),V=G instanceof ShadowRoot?G.activeElement:document.activeElement;m.shiftKey&&V===I?(m.preventDefault(),W.focus()):!m.shiftKey&&V===W&&(m.preventDefault(),I.focus())};return a.addEventListener("keydown",B),()=>{a.removeEventListener("keydown",B),typeof a.close=="function"?a.close():a.open=!1,E?.(),document.activeElement===document.body&&A?.focus()}},[r,f,F]),K(()=>{if(!f||!_||r)return;let a=y.current;if(!a)return;let A=E=>{E.composedPath().includes(a)||H()};return document.addEventListener("click",A,!0),()=>document.removeEventListener("click",A,!0)},[r,_,f]),!f&&!c?null:O("dialog",{ref:y,"aria-label":p,"aria-modal":r,className:"ha-panel","data-agent-overlay-root":"","data-expanded":!k&&h?"true":void 0,"data-expanded-sidebar":U?"true":void 0,"data-resizing":g?"true":void 0,hidden:!f,onCancel:a=>{if(a.preventDefault(),Date.now()-u.current<350||fe(y.current)){u.current=Date.now();return}M()},children:[x&&!h?d(je,{agentId:t,panelRef:y}):null,U?d("aside",{"aria-label":"Chat history",className:"ha-expanded-sidebar",children:b}):null,O("div",{className:"ha-panel-main",children:[O("header",{className:"ha-header",children:[U?d("span",{className:"ha-session-title ha-expanded-chat-title",children:T??p}):i??d("strong",{children:p}),O("div",{className:"ha-header-actions",children:[U?null:e??(R?d("button",{"aria-label":"New chat",className:"ha-icon-button ha-new-chat-button",type:"button",onClick:R,children:d(Ye,{})}):null),_e?d("button",{"aria-expanded":h,"aria-label":h?"Collapse assistant":"Expand assistant",className:"ha-expand-button ha-icon-button",type:"button",onClick:()=>{C(!0),P(a=>!a)},children:h?d(ze,{"aria-hidden":"true"}):d(Ke,{"aria-hidden":"true"})}):null,O("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:M,children:[d(qe,{}),d(z,{shortcut:"ESC",children:"Close assistant"})]})]})]}),n,d("div",{className:"ha-overlay-portal","data-agent-overlay-portal":""})]})]})}function fe(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 je({agentId:e,panelRef:t}){let[n,o]=$(420),s=oe(null),b=he(i=>{let c=t.current,p=c?.getRootNode();(p instanceof ShadowRoot?p.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]);K(()=>{o(ge(e,window.innerWidth))},[e]);let T=he((i,c)=>{let p=te(i,window.innerWidth);return b(p),c&&ne(e,p),p},[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(),T(n+c,!0))},onPointerCancel:i=>{let c=s.current;c&&(s.current=null,delete i.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,document.documentElement.style.transition=c.pageTransition,T(c.startWidth,!1))},onPointerDown:i=>{i.button!==0&&i.pointerType==="mouse"||(i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),i.currentTarget.dataset.resizing="true",s.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=s.current;c&&(c.currentWidth=T(c.startWidth+(c.startX-i.clientX),!1))},onPointerUp:i=>{let c=s.current;c&&(s.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,ne(e,c.currentWidth))}})}function qe(){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 Ye(){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 Ae(e,{generateConversationTitle:t=!0}={}){let n=performance.now(),o=Date.now(),s=e.trim();return s?{...t?{}:{generateConversationTitle:!1},messageId:crypto.randomUUID(),prompt:s,startedAt:n,startedAtWallClock:o,submitted:!0}:null}var N=new Map,X=new Map,Ze=10080*60*1e3,j=new Map;function be(e){return`heroui-agent:shell-draft:${e}:composer-draft:v1`}function re(e,t){try{let n=be(e);t.trim()?localStorage.setItem(n,JSON.stringify({prompt:t,savedAt:Date.now()})):localStorage.removeItem(n)}catch{}}function Je(e){let t=be(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<=Ze)return n.prompt;localStorage.removeItem(t)}catch{}return""}function q(e,t){if(!t.prompt.trim()&&!t.submitted){N.delete(e),re(e,"");return}N.set(e,t),t.submitted||re(e,t.prompt)}function ae(e){let t=N.get(e);if(t)return t;let n=Je(e);return n?{prompt:n,submitted:!1}:void 0}function ye(e,t,n){let o=N.get(e);!o?.submitted||o.messageId!==t||o.firstFeedbackPaintedAt!==void 0||N.set(e,{...o,firstFeedbackPaintedAt:n})}function Rt(e){let t=ae(e);return N.delete(e),re(e,""),t}function D(e,t,n){t?j.set(e,[n?.selectionStart??0,n?.selectionEnd??0,n?.selectionDirection??"none"]):j.delete(e)}function ve(e,t){let n=j.get(e);if(!n||!t)return;t.focus({preventScroll:!0});let o=Math.min(n[0],t.value.length),s=Math.min(n[1],t.value.length);t.setSelectionRange(o,s,n[2]),j.set(e,[o,s,n[2]])}function Te(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 Ht(e,t){t.length===0?X.delete(e):X.set(e,t)}function Qe(e){return X.get(e)??[]}function Pt(e){let t=Qe(e);return X.delete(e),t}function we(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function et(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 tt(e){let t=getComputedStyle(e);return we(t.paddingTop)+we(t.paddingBottom)}function nt(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 s=e.scrollHeight;return e.style.height=t,e.style.minHeight=n,e.style.maxHeight=o,s}function ot(e){if(e.value.includes(`
|
|
2
|
+
`))return!0;if(e.clientWidth===0)return!1;let t=nt(e),n=tt(e),o=et(e);return Math.max(0,t-n)>o*1.5}function ie(e,{hasAttachments:t=!1,maxHeight:n=120}={}){if(!e)return!1;let o=e.value.length>0;return t||o&&ot(e)?(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,n)}px`,!0):(e.style.height="auto",!1)}import{jsx as se,jsxs as xe}from"react/jsx-runtime";var rt="https://heroui.pro/?utm_source=heroui-agent&utm_medium=referral&utm_campaign=powered-by-hero";function Ee(){return xe("a",{"aria-label":"Powered by HeroUI Pro (opens in a new tab)",className:"ha-powered-by",href:rt,rel:"noopener noreferrer",target:"_blank",children:[se("span",{children:"Powered by"}),xe("svg",{"aria-hidden":"true",className:"ha-powered-by-logo",fill:"none",viewBox:"0 0 140 44",children:[se("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"}),se("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 Se=new Set(["ask","auto","full"]);function Y(e){return Se.has(e)?e:"auto"}function Lt(e,t){return`${e}:permission-mode:${t}:v1`}function Ft(e,t){return`${e}:active-permission-mode:${t}:v1`}function Ut(e){try{let t=localStorage.getItem(e);return t!==null&&Se.has(t)?Y(t):void 0}catch{return}}function Bt(e,t){try{localStorage.setItem(e,t)}catch{}}function Wt(e){try{localStorage.removeItem(e)}catch{}}function Gt(e,t){let n=Y(t);if(n==="auto")return e;let o=n==="ask";return e.map(s=>!!s.needsApproval===o?s:{...s,needsApproval:o})}function Me(e){return`heroui-agent:anonymous:${e}`}var ke=class{constructor(t,n){this.agentId=t;this.getAuthToken=n}cached=null;generation=0;pending=null;clear(){this.generation+=1,this.cached=null,this.pending=null}reset(){this.clear();try{localStorage.removeItem(Me(this.agentId))}catch{}}async get(){if(this.cached&&this.expiresAt(this.cached)>Date.now()+6e4)return this.cached.token;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,o.token)}finally{this.pending===n&&(this.pending=null)}}async subjectHash(){let t=await this.get(),n=at(t),o=typeof n.sub=="string"?n.sub:"anonymous",s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${this.agentId}:${o}`));return Array.from(new Uint8Array(s),b=>b.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=Me(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 at(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 it={"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(it)),Kt=Z.join(","),st=new Set(Z);function Ce(e){return st.has(e.trim().toLowerCase())}import{useEffect as lt,useLayoutEffect as Ne,useRef as ct,useState as J}from"react";import{Fragment as Re,jsx as l,jsxs as S}from"react/jsx-runtime";function Jt({agentId:e,composerConnecting:t=!1,composerControlsAvailable:n,composerControlsRevealed:o,composerEndSlot:s,composerFooterSlot:b,composerStartSlot:T,greeting:i,onComposerControlsReveal:c,onIntent:p,placeholder:M,suggestedPrompts:R}){let[f]=J(()=>ae(e)),[w,y]=J(()=>f?.submitted?"":f?.prompt??""),[u,L]=J(()=>f?.submitted?f:null),[Q,H]=J(!1),h=ct(null),P=n??!!(T||s),F=o??(P&&Q),k=r=>{D(e,!0,r.currentTarget),H(P),P&&c?.(),p()},_=r=>{let g=r.currentTarget.querySelector(".ha-composer");g&&Te(g,r.relatedTarget)||(H(!1),D(e,!1))};Ne(()=>{ve(e,h.current),ie(h.current)},[e]),lt(()=>{u||q(e,{prompt:w,submitted:!1})},[w,e,u]),Ne(()=>{if(!u)return;let r=requestAnimationFrame(g=>{ye(e,u.messageId,g)});return()=>cancelAnimationFrame(r)},[e,u]);let x=(r,g=!0)=>{if(u)return;let C=Ae(r,{generateConversationTitle:g});C&&(L(C),y(""),h.current.style.height="auto",q(e,C),p())};return S(Re,{children:[l("div",{className:"ha-conversation",children:l("div",{"aria-live":"polite",className:"ha-messages",role:"log",children:u?S(Re,{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:u.prompt})})})}),l("div",{className:"ha-message","data-role":"assistant","data-stream-anchor":"true","data-turn-feedback-id":u.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("span",{"aria-hidden":"true",className:"ha-shimmer",children:"Thinking\u2026"})})})})]}):S("div",{className:"ha-empty",children:[l("h2",{children:i}),l("p",{children:"Live answers with charts, metrics, and tables."})]})})}),S("form",{className:"ha-composer-wrap",onBlur:_,onSubmit:r=>{r.preventDefault(),x(w)},children:[!u&&R.length>0?l("div",{"aria-label":"Suggested prompts",className:"ha-suggestions",role:"group",children:R.map(r=>S("button",{className:"ha-suggestion",type:"button",onClick:()=>x(r,!1),children:[l("span",{children:r}),l(ut,{})]},r))}):null,S("div",{className:"@container ha-composer","data-connecting":t||void 0,"data-controls-revealed":F||void 0,children:[T,l("textarea",{ref:h,"aria-label":"Message the assistant",placeholder:M,readOnly:!!u,rows:1,value:w,onFocus:k,onSelect:r=>D(e,!0,r.currentTarget),onChange:r=>{let g=r.currentTarget.value;q(e,{prompt:g,submitted:!1}),D(e,!0,r.currentTarget),y(g),ie(r.currentTarget),p()},onKeyDown:r=>{r.key!=="Enter"||r.shiftKey||(r.preventDefault(),x(w))}}),s,S("button",{"aria-label":"Send message",className:"ha-send",disabled:!w.trim()||!!u,type:"submit",children:[l(dt,{}),l(z,{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(Ee,{})]})]})}function dt(){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 ut(){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 mt={animation:"fadeIn",duration:160,easing:"ease-out",sep:"word",stagger:18};function He(e){return typeof e=="number"?Number.isFinite(e)?`${Math.round(e)}px`:void 0:e?.trim()||void 0}function pt(e){let t=He(e?.initialWidth),n=He(e?.initialHeight);return{...t?{"--ha-panel-width":t}:{},...n?{"--ha-panel-height":n}:{}}}function Pe(e){return e===void 0||!Number.isFinite(e)?24:Math.min(Math.max(Math.round(e),0),200)}function gt(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();Ce(o)&&t.add(o)}return[...t]}function an(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=gt(e.composer?.attachments),n=typeof e.composer?.disclaimer=="string"&&e.composer.disclaimer.trim().slice(0,240)||void 0;return{apiBaseUrl:(e._api?.baseUrl??ue).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:le(e.appearance?.theme?.designTheme),...n?{composerDisclaimer:n}:{},agentId:e.agentId,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??mt,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:pt(e.appearance?.panel),permissionDefaultMode:Y(e.permissions?.defaultMode),permissionShowPicker:e.permissions?.showPicker===!0,preload:e.preload??!0,reopenOnRefresh:e.reopenOnRefresh??!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:Pe(e.appearance.launcher.offset.x),y:Pe(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(o=>o.trim()).filter(Boolean).slice(0,5),themeStyle:{...de(e.appearance?.theme),...ce(e.appearance?.launcher?.background)},tools:e.tools??[],viewMode:e.appearance?.viewMode??"floating",webSearch:e.capabilities?.webSearch??!1}}export{ke as a,ht as b,ue as c,At as d,z as e,ge as f,kt as g,it as h,Z as i,Ce as j,Ae as k,q as l,ae as m,Rt as n,D as o,ve as p,Te as q,Ht as r,Qe as s,Pt as t,ie as u,Ee as v,Jt as w,Lt as x,Ft as y,Ut as z,Bt as A,Wt as B,Gt as C,mt as D,an as E};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|