@miiflow/assistant-ui 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{WelcomeScreen-YsXZsAwZ.d.ts → WelcomeScreen-DAa22X9b.d.ts} +1 -1
- package/dist/{chunk-POKFMILU.js → chunk-IM4WITWJ.js} +9 -11
- package/dist/chunk-IM4WITWJ.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styled/index.d.ts +1 -1
- package/dist/styled/index.js +1 -1
- package/dist/styles-no-preflight.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +9 -18
- package/dist/WelcomeScreen-BiY3uGhp.d.cts +0 -301
- package/dist/avatar-CL1hlGO5.d.cts +0 -109
- package/dist/branding-SzYU4ncD.d.cts +0 -18
- package/dist/chunk-3SEVU272.cjs +0 -2
- package/dist/chunk-3SEVU272.cjs.map +0 -1
- package/dist/chunk-HVCCZKEO.cjs +0 -2
- package/dist/chunk-HVCCZKEO.cjs.map +0 -1
- package/dist/chunk-KSMAVBLY.cjs +0 -2
- package/dist/chunk-KSMAVBLY.cjs.map +0 -1
- package/dist/chunk-POKFMILU.js.map +0 -1
- package/dist/chunk-QGRXQAWZ.cjs +0 -22
- package/dist/chunk-QGRXQAWZ.cjs.map +0 -1
- package/dist/chunk-SFEPMZCU.cjs +0 -2
- package/dist/chunk-SFEPMZCU.cjs.map +0 -1
- package/dist/chunk-TOYU46SZ.cjs +0 -2
- package/dist/chunk-TOYU46SZ.cjs.map +0 -1
- package/dist/chunk-ZKMXEECD.cjs +0 -2
- package/dist/chunk-ZKMXEECD.cjs.map +0 -1
- package/dist/client/index.cjs +0 -9
- package/dist/client/index.cjs.map +0 -1
- package/dist/client/index.d.cts +0 -249
- package/dist/context/index.cjs +0 -2
- package/dist/context/index.cjs.map +0 -1
- package/dist/context/index.d.cts +0 -43
- package/dist/hooks/index.cjs +0 -2
- package/dist/hooks/index.cjs.map +0 -1
- package/dist/hooks/index.d.cts +0 -146
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -157
- package/dist/message-9z0crkf9.d.cts +0 -88
- package/dist/primitives/index.cjs +0 -2
- package/dist/primitives/index.cjs.map +0 -1
- package/dist/primitives/index.d.cts +0 -91
- package/dist/streaming-CF63E6iS.d.cts +0 -426
- package/dist/styled/index.cjs +0 -2
- package/dist/styled/index.cjs.map +0 -1
- package/dist/styled/index.d.cts +0 -477
package/dist/chunk-QGRXQAWZ.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk3SEVU272_cjs=require('./chunk-3SEVU272.cjs'),chunkHVCCZKEO_cjs=require('./chunk-HVCCZKEO.cjs'),chunkTOYU46SZ_cjs=require('./chunk-TOYU46SZ.cjs'),chunkSFEPMZCU_cjs=require('./chunk-SFEPMZCU.cjs'),react=require('react'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),Tr=require('react-markdown'),Er=require('remark-gfm'),reactSyntaxHighlighter=require('react-syntax-highlighter'),prism=require('react-syntax-highlighter/dist/esm/styles/prism'),framerMotion=require('framer-motion'),recharts=require('recharts'),zod=require('zod'),link=require('@lexical/link'),list=require('@lexical/list'),markdown=require('@lexical/markdown'),LexicalComposer=require('@lexical/react/LexicalComposer'),LexicalContentEditable=require('@lexical/react/LexicalContentEditable'),LexicalErrorBoundary=require('@lexical/react/LexicalErrorBoundary'),LexicalHistoryPlugin=require('@lexical/react/LexicalHistoryPlugin'),LexicalListPlugin=require('@lexical/react/LexicalListPlugin'),LexicalRichTextPlugin=require('@lexical/react/LexicalRichTextPlugin'),LexicalOnChangePlugin=require('@lexical/react/LexicalOnChangePlugin'),LexicalAutoFocusPlugin=require('@lexical/react/LexicalAutoFocusPlugin'),richText=require('@lexical/rich-text'),LexicalComposerContext=require('@lexical/react/LexicalComposerContext'),lexical=require('lexical');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Tr__default=/*#__PURE__*/_interopDefault(Tr);var Er__default=/*#__PURE__*/_interopDefault(Er);function i(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function gr(e){return e.startsWith("image/")?lucideReact.Image:e==="application/pdf"||e.startsWith("text/")?lucideReact.FileText:lucideReact.File}function fr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var ya=react.forwardRef(({attachment:e,onRemove:a,removable:r=true,className:t},n)=>{let o=gr(e.mimeType),s=e.mimeType.startsWith("image/");return jsxRuntime.jsxs("div",{ref:n,className:i("relative group","flex items-center gap-2","p-2 rounded-lg","border border-chat-border","bg-chat-panel-bg",t),children:[jsxRuntime.jsx("div",{className:i("w-10 h-10 rounded","flex items-center justify-center","bg-gray-100 dark:bg-gray-800","overflow-hidden flex-shrink-0"),children:s&&e.previewUrl?jsxRuntime.jsx("img",{src:e.previewUrl,alt:e.filename,className:"w-full h-full object-cover"}):jsxRuntime.jsx(o,{className:"w-5 h-5 text-chat-subtle"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium truncate text-chat-text",children:e.filename}),jsxRuntime.jsx("p",{className:"text-xs text-chat-subtle",children:fr(e.size)})]}),r&&a&&jsxRuntime.jsx("button",{type:"button",onClick:a,className:i("absolute -top-1.5 -right-1.5","w-5 h-5 rounded-full","flex items-center justify-center","bg-gray-500 text-white","opacity-0 group-hover:opacity-100","hover:bg-gray-600","transition-opacity duration-200"),"aria-label":`Remove ${e.filename}`,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})});ya.displayName="AttachmentPreview";var hr={sm:"w-6 h-6 text-xs",md:"w-8 h-8 text-sm",lg:"w-10 h-10 text-base"},yr={sm:14,md:16,lg:20};function vr(e,a){let r=yr[a];switch(e){case "assistant":return jsxRuntime.jsx(lucideReact.Bot,{size:r});case "user":return jsxRuntime.jsx(lucideReact.User,{size:r});default:return jsxRuntime.jsx(lucideReact.User,{size:r})}}var Be=react.forwardRef(({name:e,src:a,alt:r,role:t,size:n="md",className:o,...s},l)=>jsxRuntime.jsx(chunk3SEVU272_cjs.l,{ref:l,name:e,src:a,alt:r,role:t,className:i("rounded-full overflow-hidden flex-shrink-0","flex items-center justify-center","font-medium",t==="assistant"?"bg-primary/10 text-primary":"bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300",hr[n],o),fallback:vr(t,n),...s}));Be.displayName="Avatar";var wa=react.forwardRef(({children:e,className:a,...r},t)=>jsxRuntime.jsx("div",{ref:t,className:i("flex flex-col h-full","bg-white dark:bg-gray-900","font-sans text-chat-text",a),...r,children:e}));wa.displayName="ChatContainer";var Nr={small:"w-1.5 h-1.5",medium:"w-2 h-2",large:"w-2.5 h-2.5"},Cr={small:"gap-1",medium:"gap-1.5",large:"gap-2"};function Ke({size:e="medium",className:a}){let r=Nr[e];return jsxRuntime.jsxs("div",{className:i("flex items-center",Cr[e],a),children:[jsxRuntime.jsx("div",{className:i(r,"rounded-full bg-[var(--chat-text-subtle)]","animate-loading-dot animate-loading-dot-1")}),jsxRuntime.jsx("div",{className:i(r,"rounded-full bg-[var(--chat-text-subtle)]","animate-loading-dot animate-loading-dot-2")}),jsxRuntime.jsx("div",{className:i(r,"rounded-full bg-[var(--chat-text-subtle)]","animate-loading-dot animate-loading-dot-3")})]})}var _r={js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",cpp:"cpp",c:"c",cs:"csharp",swift:"swift",kt:"kotlin",php:"php",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",shell:"bash",html:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",graphql:"graphql",dockerfile:"docker",toml:"toml"};function Ir(e){return _r[e.toLowerCase()]||e.toLowerCase()}function _t(e){return e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}function Vr({text:e}){let[a,r]=react.useState(false),t=react.useCallback(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3);}catch{}},[e]);return jsxRuntime.jsxs("button",{onClick:t,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-white/10 transition-colors text-gray-400 hover:text-gray-200","aria-label":a?"Copied":"Copy code",children:[a?jsxRuntime.jsx(lucideReact.Check,{size:14}):jsxRuntime.jsx(lucideReact.Copy,{size:14}),a?"Copied":"Copy"]})}function ne({children:e,className:a,baselineFontSize:r=1,darkCodeTheme:t}){let n=t??(typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches),o=r!==1?{fontSize:`${r}rem`}:void 0;return jsxRuntime.jsx(Tr__default.default,{className:i("chat-prose",a),remarkPlugins:[Er__default.default],components:{h1:({children:s})=>{let l=String(s),c=_t(l);return jsxRuntime.jsxs("h1",{id:c,className:"group text-xl font-semibold mt-4 mb-2 first:mt-0",style:o,children:[s,jsxRuntime.jsx("a",{href:`#${c}`,className:"ml-2 opacity-0 group-hover:opacity-50 transition-opacity","aria-label":"Link to heading",children:jsxRuntime.jsx(lucideReact.Link,{size:16,className:"inline"})})]})},h2:({children:s})=>{let l=String(s),c=_t(l);return jsxRuntime.jsxs("h2",{id:c,className:"group text-lg font-semibold mt-3 mb-2 first:mt-0",style:o,children:[s,jsxRuntime.jsx("a",{href:`#${c}`,className:"ml-2 opacity-0 group-hover:opacity-50 transition-opacity","aria-label":"Link to heading",children:jsxRuntime.jsx(lucideReact.Link,{size:14,className:"inline"})})]})},h3:({children:s})=>{let l=String(s),c=_t(l);return jsxRuntime.jsxs("h3",{id:c,className:"group text-base font-medium mt-2 mb-1 first:mt-0",style:o,children:[s,jsxRuntime.jsx("a",{href:`#${c}`,className:"ml-2 opacity-0 group-hover:opacity-50 transition-opacity","aria-label":"Link to heading",children:jsxRuntime.jsx(lucideReact.Link,{size:12,className:"inline"})})]})},h4:({children:s})=>jsxRuntime.jsx("h4",{className:"text-base font-medium mt-2 mb-1 first:mt-0",style:o,children:s}),p:({children:s})=>jsxRuntime.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed",style:o,children:s}),a:({href:s,children:l})=>jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:opacity-80 transition-opacity",style:o,children:l}),ul:({children:s})=>jsxRuntime.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-1",children:s}),ol:({children:s})=>jsxRuntime.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-1",children:s}),li:({children:s})=>jsxRuntime.jsx("li",{className:"leading-relaxed",style:o,children:s}),blockquote:({children:s})=>jsxRuntime.jsx("blockquote",{className:"border-l-2 border-gray-300 dark:border-gray-600 pl-3 my-2 italic text-chat-subtle",style:o,children:s}),code:({className:s,children:l})=>{let c=/language-(\w+)/.exec(s||""),p=String(l).replace(/\n$/,"");if(!c&&!p.includes(`
|
|
2
|
-
`))return jsxRuntime.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono",style:o,children:l});let x=c?Ir(c[1]):"text";return jsxRuntime.jsxs("div",{className:"relative group my-2 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-gray-800 dark:bg-gray-900 border-b border-gray-700",children:[jsxRuntime.jsx("span",{className:"text-xs font-mono text-gray-400",children:x}),jsxRuntime.jsx(Vr,{text:p})]}),jsxRuntime.jsx(reactSyntaxHighlighter.Prism,{language:x,style:n===false?prism.oneLight:prism.oneDark,customStyle:{margin:0,borderRadius:0,fontSize:"0.8125rem",lineHeight:"1.6"},codeTagProps:{style:{fontFamily:"'Fira Code', 'JetBrains Mono', monospace"}},children:p})]})},pre:({children:s})=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:s}),table:({children:s})=>jsxRuntime.jsx("div",{className:"overflow-x-auto my-2 rounded-lg border border-gray-200 dark:border-gray-700",children:jsxRuntime.jsx("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:s})}),thead:({children:s})=>jsxRuntime.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:s}),th:({children:s})=>jsxRuntime.jsx("th",{className:"px-3 py-2 text-left text-sm font-medium text-gray-700 dark:text-gray-300",style:o,children:s}),td:({children:s})=>jsxRuntime.jsx("td",{className:"px-3 py-2 text-sm text-gray-600 dark:text-gray-400 border-t border-gray-100 dark:border-gray-700",style:o,children:s}),hr:()=>jsxRuntime.jsx("hr",{className:"my-4 border-gray-200 dark:border-gray-700"}),strong:({children:s})=>jsxRuntime.jsx("strong",{className:"font-semibold",children:s}),em:({children:s})=>jsxRuntime.jsx("em",{className:"italic",children:s}),img:({src:s,alt:l})=>jsxRuntime.jsx("img",{src:s,alt:l??"",className:"max-w-full h-auto rounded-lg my-2",loading:"lazy"})},children:e})}function Na(e){switch(e){case "knowledge_base":return {label:"Knowledge Base",color:"#4caf50"};case "api":return {label:"API",color:"#2196f3"};case "system_tool":return {label:"Tool",color:"#ff9800"};case "mcp_tool":return {label:"MCP",color:"#9c27b0"};case "workflow":return {label:"Workflow",color:"#00bcd4"};default:return {label:"Source",color:"#757575"}}}function It({sources:e,className:a}){let[r,t]=react.useState(null);return !e||e.length===0?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:i("flex flex-wrap gap-1.5 mt-2",a),children:e.map(n=>{let o=Na(n.source_type);return jsxRuntime.jsxs("button",{onClick:()=>t(n),className:"inline-flex items-center h-6 px-2 text-[0.75rem] font-medium rounded-full border cursor-pointer transition-colors max-w-[280px] truncate",style:{backgroundColor:o.color+"1a",color:o.color,borderColor:o.color+"40"},children:["[",n.index,"] ",n.title]},n.index)})}),jsxRuntime.jsx(Ca,{source:r,onClose:()=>t(null)})]})}function Ca({source:e,onClose:a}){if(react.useEffect(()=>{if(!e)return;let t=n=>{n.key==="Escape"&&a();};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,a]),!e)return null;let r=Na(e.source_type);return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/50",onClick:a}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.15},className:"relative bg-white dark:bg-gray-900 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold truncate",children:e.title}),jsxRuntime.jsx("span",{className:"text-[0.7rem] px-1.5 py-0.5 rounded font-medium shrink-0",style:{backgroundColor:r.color+"1a",color:r.color},children:r.label})]}),jsxRuntime.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 ml-2",children:jsxRuntime.jsx(lucideReact.X,{size:16})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[jsxRuntime.jsx("span",{className:"text-[0.7rem] px-1.5 py-0.5 rounded border border-gray-200 dark:border-gray-700",children:e.tool_name.replace(/_/g," ")}),e.query&&jsxRuntime.jsxs("span",{className:"text-[0.7rem] px-1.5 py-0.5 rounded border border-gray-200 dark:border-gray-700 max-w-[200px] truncate",title:e.query,children:["Query: ",e.query.slice(0,40),e.query.length>40?"...":""]})]}),e.url&&jsxRuntime.jsx("div",{className:"mb-4",children:jsxRuntime.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-500 hover:underline inline-flex items-center gap-1",children:[e.url.length>80?`${e.url.slice(0,80)}...`:e.url,jsxRuntime.jsx(lucideReact.ExternalLink,{size:12})]})}),e.description&&jsxRuntime.jsx("p",{className:"text-sm text-gray-500 mb-4",children:e.description}),e.full_content?jsxRuntime.jsx("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed p-4 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 max-h-[400px] overflow-auto",children:e.full_content}):e.snippet?jsxRuntime.jsx("div",{className:"whitespace-pre-wrap font-mono text-sm leading-relaxed p-4 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700",children:e.snippet}):jsxRuntime.jsx("p",{className:"text-sm text-gray-400 italic",children:"No content available for this source."})]}),jsxRuntime.jsx("div",{className:"flex justify-end p-3 border-t border-gray-200 dark:border-gray-700",children:jsxRuntime.jsx("button",{onClick:a,className:"px-3 py-1.5 text-sm rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:"Close"})})]})]})})}function Hr({index:e,source:a}){return jsxRuntime.jsx("span",{className:i("inline-flex items-center justify-center min-w-[16px] h-4 rounded-full","bg-blue-500 text-white text-[0.6rem] font-semibold","px-0.5 mx-0.5 align-super",a?.url?"cursor-pointer hover:opacity-85":"cursor-default"),title:a?`${a.title}${a.description?": "+a.description:""}`:void 0,onClick:r=>{a?.url&&(r.stopPropagation(),window.open(a.url,"_blank","noopener,noreferrer"));},children:e})}function Vt({clarification:e,onSubmit:a,onOptionSelect:r,disabled:t=false,loading:n=false,className:o}){let[s,l]=react.useState(""),c=react.useCallback(v=>{v.trim()&&(l(""),a(v.trim()));},[a]),p=v=>{let f=v.target.value;r?.(f),c(f);},b=v=>{v.key==="Enter"&&!v.shiftKey&&s.trim()&&(v.preventDefault(),c(s));},x=e.options&&e.options.length>0,y=e.allowFreeText!==false;return jsxRuntime.jsxs("div",{className:i("mx-4 mb-3 px-4 py-3","bg-orange-50/60 dark:bg-orange-950/20","border-l-[3px] border-orange-400","rounded-r-lg",o),children:[jsxRuntime.jsxs("div",{className:i("flex items-start gap-2",(x||y)&&"mb-2"),children:[jsxRuntime.jsx("span",{className:"text-orange-600 mt-0.5",children:jsxRuntime.jsx(lucideReact.MessageCircle,{size:14})}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:e.question})]}),x&&jsxRuntime.jsx("div",{className:i("ml-5 space-y-1",y&&"mb-2"),children:e.options.map((v,f)=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 py-0.5 cursor-pointer text-sm hover:bg-orange-100/50 dark:hover:bg-orange-900/20 rounded px-1 -mx-1",children:[jsxRuntime.jsx("input",{type:"radio",name:"clarification-option",value:v,onChange:p,disabled:t||n,className:"accent-orange-500 w-3.5 h-3.5"}),v]},f))}),y&&jsxRuntime.jsxs("div",{className:"flex items-center ml-5 bg-white dark:bg-gray-900 rounded border border-orange-200 dark:border-orange-800 px-3 py-1",children:[jsxRuntime.jsx("input",{type:"text",value:s,onChange:v=>l(v.target.value),onKeyDown:b,placeholder:x?"Or type your response...":"Type your response...",disabled:t||n,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-gray-400 disabled:opacity-50"}),jsxRuntime.jsx("button",{onClick:()=>c(s),disabled:!s.trim()||t||n,className:i("p-1 rounded transition-colors",s.trim()?"text-orange-600 hover:text-orange-700":"text-gray-300"),children:jsxRuntime.jsx(lucideReact.Send,{size:16})})]})]})}function Ft({textContent:e,onRegenerate:a,onEdit:r,className:t}){let[n,o]=react.useState(false),s=react.useCallback(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3);}catch{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l),o(true),setTimeout(()=>o(false),2e3);}},[e]);return jsxRuntime.jsxs("div",{className:i("flex items-center gap-1","opacity-0 group-hover:opacity-100 transition-opacity duration-150",t),children:[jsxRuntime.jsx("button",{type:"button",onClick:s,"aria-label":n?"Copied":"Copy message",className:i("flex items-center justify-center","w-7 h-7 rounded-md","text-[var(--chat-text-subtle)] hover:text-[var(--chat-text)]","hover:bg-[var(--chat-panel-bg)]","transition-colors duration-150"),children:n?jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}):jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),jsxRuntime.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}),a&&jsxRuntime.jsx("button",{type:"button",onClick:a,"aria-label":"Regenerate response",className:i("flex items-center justify-center","w-7 h-7 rounded-md","text-[var(--chat-text-subtle)] hover:text-[var(--chat-text)]","hover:bg-[var(--chat-panel-bg)]","transition-colors duration-150"),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),jsxRuntime.jsx("path",{d:"M21 3v5h-5"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),jsxRuntime.jsx("path",{d:"M8 16H3v5"})]})}),r&&jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Edit message",className:i("flex items-center justify-center","w-7 h-7 rounded-md","text-[var(--chat-text-subtle)] hover:text-[var(--chat-text)]","hover:bg-[var(--chat-panel-bg)]","transition-colors duration-150"),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),jsxRuntime.jsx("path",{d:"m15 5 4 4"})]})})]})}function $t({attachments:e,onDownload:a,onPreview:r,className:t}){let[n,o]=react.useState(null);if(!e||e.length===0)return null;let s=c=>{if(a){a(c);return}if(c.url){let p=document.createElement("a");p.href=c.url,p.download=c.filename,p.target="_blank",document.body.appendChild(p),p.click(),document.body.removeChild(p);}},l=c=>{if(r){r(c);return}c.isImage&&c.url&&o(c.url);};return jsxRuntime.jsxs("div",{className:i("flex flex-wrap gap-1.5",t),children:[e.map(c=>jsxRuntime.jsx(on,{attachment:c,onDownload:()=>s(c),onPreview:()=>l(c)},c.id)),n&&jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:()=>o(null),children:[jsxRuntime.jsx("button",{className:"absolute top-4 right-4 p-2 text-white hover:bg-white/20 rounded-full transition-colors",onClick:()=>o(null),"aria-label":"Close",children:jsxRuntime.jsx(lucideReact.X,{size:24})}),jsxRuntime.jsx("img",{src:n,alt:"Preview",className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:c=>c.stopPropagation()})]})]})}function on({attachment:e,onDownload:a,onPreview:r}){let t=e.humanReadableSize||ln(e.size);return jsxRuntime.jsxs("div",{className:i("inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg max-w-full","border border-[var(--chat-border)] bg-[var(--chat-panel-bg)]",e.isImage&&e.url&&"cursor-pointer hover:bg-[var(--chat-border)]/30"),onClick:e.isImage&&e.url?r:void 0,children:[jsxRuntime.jsx(sn,{mimeType:e.mimeType,size:14}),jsxRuntime.jsx("span",{className:"text-xs text-[var(--chat-text)] truncate min-w-0",children:e.filename}),t&&t!=="0 Bytes"&&jsxRuntime.jsx("span",{className:"text-[10px] text-[var(--chat-text-subtle)] flex-shrink-0",children:t}),e.url&&jsxRuntime.jsx("button",{onClick:n=>{n.stopPropagation(),a();},className:"p-0.5 hover:bg-[var(--chat-border)] rounded transition-colors flex-shrink-0","aria-label":"Download",children:jsxRuntime.jsx(lucideReact.Download,{size:12,className:"text-[var(--chat-text-subtle)]"})})]})}function sn({mimeType:e,size:a=14}){return e.startsWith("image/")?jsxRuntime.jsx(lucideReact.Image,{size:a,className:"text-[var(--chat-primary)] flex-shrink-0"}):e.startsWith("video/")?jsxRuntime.jsx(lucideReact.Video,{size:a,className:"text-[var(--chat-primary)] flex-shrink-0"}):e==="application/pdf"?jsxRuntime.jsx(lucideReact.FileText,{size:a,className:"text-red-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.FileIcon,{size:a,className:"text-gray-500 flex-shrink-0"})}function ln(e){if(e===0)return "0 Bytes";let a=1024,r=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(a));return parseFloat((e/Math.pow(a,t)).toFixed(2))+" "+r[t]}var Sa="miiflow-beamer-keyframes";function Re(e){if(typeof document>"u")return;let a=e?.getRootNode?.(),r=a instanceof ShadowRoot?a:document.head;if(r.querySelector(`#${Sa}`))return;let t=document.createElement("style");t.id=Sa,t.textContent="@keyframes beamer{0%{left:-30%}100%{left:100%}}",r.appendChild(t);}var Me={position:"absolute",top:0,left:"-30%",width:"30%",height:"100%",background:"linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.7) 50%, transparent 100%)",animation:"beamer 2s linear infinite",zIndex:1,pointerEvents:"none"};function rt({status:e,size:a=16,className:r}){let t=Math.max(a-4,10);return jsxRuntime.jsxs("div",{className:i("relative flex-shrink-0 flex items-center justify-center",r),style:{width:a,height:a},children:[e==="pending"&&jsxRuntime.jsx(lucideReact.CircleDashed,{size:a,strokeWidth:2,className:"text-[var(--chat-text-subtle)] opacity-40"}),e==="running"&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center",style:{width:a,height:a},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-indigo-500/20 animate-ping",style:{animationDuration:"1.5s"}}),jsxRuntime.jsx("div",{className:"relative rounded-full bg-gradient-to-br from-indigo-500 to-purple-500 p-[2px] animate-pulse-glow",children:jsxRuntime.jsx("div",{className:"rounded-full bg-white dark:bg-gray-900 flex items-center justify-center",style:{width:t,height:t},children:jsxRuntime.jsx(lucideReact.Loader2,{size:t-2,strokeWidth:2.5,className:"text-indigo-500 animate-spin"})})})]}),e==="completed"&&jsxRuntime.jsx("div",{className:"animate-complete-pop",children:jsxRuntime.jsx("div",{className:"rounded-full animate-success-flash",children:jsxRuntime.jsx(lucideReact.CircleCheck,{size:a,strokeWidth:2,className:"text-green-500"})})}),e==="failed"&&jsxRuntime.jsx(lucideReact.CircleX,{size:a,strokeWidth:2,className:"text-red-500"})]})}function Ae({items:e,badgeSize:a=20,className:r}){let t=react.useRef(null);return react.useEffect(()=>{Re(t.current);},[]),e.length===0?null:jsxRuntime.jsx("div",{ref:t,className:i("max-w-full",r),children:jsxRuntime.jsx("div",{className:"flex flex-col",children:e.map((n,o)=>{let s=o===e.length-1,c=(s?null:e[o+1])?.status==="pending",p=n.status==="running"&&!s;return jsxRuntime.jsxs("div",{className:"animate-fade-in",style:{display:"grid",gridTemplateColumns:`${a}px 1fr`,gap:"0.5rem",paddingBottom:s?0:"0.5rem",position:"relative"},children:[jsxRuntime.jsxs("div",{className:"relative flex flex-col items-center flex-shrink-0",style:{paddingTop:"4px"},children:[jsxRuntime.jsx(rt,{status:n.status,size:a}),!s&&(p?jsxRuntime.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-[2px] animate-flow-down",style:{top:a+6,height:`calc(100% - ${a}px + 4px)`,background:`repeating-linear-gradient(
|
|
3
|
-
180deg,
|
|
4
|
-
rgb(99, 102, 241) 0px,
|
|
5
|
-
rgb(99, 102, 241) 4px,
|
|
6
|
-
transparent 4px,
|
|
7
|
-
transparent 8px
|
|
8
|
-
)`,zIndex:1}}):jsxRuntime.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",style:{top:a+6,height:`calc(100% - ${a}px + 4px)`,width:0,borderLeft:"2px",borderStyle:c?"dashed":"solid",borderColor:"var(--chat-border)",zIndex:1}}))]}),jsxRuntime.jsxs("div",{style:{minWidth:0,flex:1,display:"flex",alignItems:"center",position:"relative",overflow:"hidden",borderRadius:4,...n.status==="running"&&{backgroundColor:"rgba(0, 0, 0, 0.02)",padding:"2px 4px"}},children:[n.status==="running"&&jsxRuntime.jsx("div",{style:Me}),n.content]})]},n.id)})})})}function un({status:e,isLast:a=false,badgeSize:r=16,children:t,className:n}){let o=react.useRef(null);react.useEffect(()=>{Re(o.current);},[]);let s=e==="running"&&!a;return jsxRuntime.jsxs("div",{ref:o,className:i("relative flex items-start gap-3 animate-fade-in",!a&&"pb-3",n),children:[jsxRuntime.jsxs("div",{className:"relative flex-shrink-0 pt-0.5",children:[jsxRuntime.jsx(rt,{status:e,size:r}),!a&&(s?jsxRuntime.jsx("div",{className:"absolute w-[2px] animate-flow-down",style:{left:r/2-1,top:r+4,height:"calc(100% + 12px)",background:`repeating-linear-gradient(
|
|
9
|
-
180deg,
|
|
10
|
-
rgb(99, 102, 241) 0px,
|
|
11
|
-
rgb(99, 102, 241) 4px,
|
|
12
|
-
transparent 4px,
|
|
13
|
-
transparent 8px
|
|
14
|
-
)`,zIndex:1}}):jsxRuntime.jsx("div",{className:"absolute bg-[var(--chat-border)] opacity-30",style:{left:r/2-.5,top:r+4,height:"calc(100% + 12px)",width:1,zIndex:1}}))]}),jsxRuntime.jsxs("div",{style:{minWidth:0,flex:1,position:"relative",overflow:"hidden",borderRadius:4,...e==="running"&&{backgroundColor:"rgba(0, 0, 0, 0.02)",padding:"2px 4px"}},children:[e==="running"&&jsxRuntime.jsx("div",{style:Me}),t]})]})}function Wt({event:e,className:a,isRunning:r}){let t=react.useRef(null);if(react.useEffect(()=>{Re(t.current);},[]),e.type==="thinking")return jsxRuntime.jsx("div",{ref:t,className:i("p-1 rounded transition-colors","bg-black/[0.01] hover:bg-black/[0.02]",a),children:jsxRuntime.jsx("div",{className:"text-[var(--chat-text-subtle)] leading-relaxed",children:jsxRuntime.jsx(ne,{className:"text-[14px]",children:e.content})})});if(e.type==="planning")return jsxRuntime.jsx("div",{ref:t,className:i("p-1 rounded transition-colors","bg-black/[0.01] hover:bg-black/[0.02]",a),children:jsxRuntime.jsx("div",{className:"text-[var(--chat-text-subtle)] leading-relaxed",children:jsxRuntime.jsx(ne,{className:"text-[14px]",children:e.content})})});if(e.type==="tool")return jsxRuntime.jsxs("div",{ref:t,className:i("inline-flex items-center gap-1.5",a),style:{position:"relative",overflow:"hidden",borderRadius:4,...r&&{backgroundColor:"rgba(0, 0, 0, 0.02)",padding:"2px 4px"}},children:[r&&jsxRuntime.jsx("div",{style:Me}),jsxRuntime.jsx(lucideReact.Wrench,{size:14,className:"text-black/50 relative z-10 shrink-0"}),jsxRuntime.jsx("span",{className:"text-[14px] text-black/65 relative z-10",children:e.toolDescription||e.toolName})]});if(e.type==="observation"){let n=e.success!==false;return jsxRuntime.jsxs("div",{ref:t,className:i("px-3 py-1.5 rounded max-w-full overflow-auto",n?"bg-green-50 border-l-[3px] border-green-400":"bg-yellow-50 border-l-[3px] border-yellow-400",a),children:[jsxRuntime.jsxs("span",{className:i("text-xs font-semibold uppercase tracking-wide block mb-1",n?"text-green-700":"text-yellow-700"),children:[e.toolName," Result"]}),jsxRuntime.jsx("div",{className:i(n?"text-green-900":"text-yellow-900"),children:jsxRuntime.jsx(ne,{className:"text-[14px]",children:e.content})})]})}return null}var xn=["create_plan","unknown"];function Da(e){return e?xn.includes(e.toLowerCase().trim()):false}function nt(e,a){if(e.toolName&&Da(e.toolName))return null;if(e.type==="thinking")return !e.content||e.content.trim().length===0?null:{id:`thinking-${a}`,type:"thinking",status:"completed",content:e.content};if(e.type==="planning"){if(!e.content||e.content.trim().length===0)return null;let r=e.planData!==void 0||e.content.includes("\u2713 Created plan");return {id:`planning-${a}`,type:"planning",status:r?"completed":"running",content:e.content,isComplete:r}}if(e.type==="tool"){let r=e.status==="executing"?"running":e.status==="completed"?"completed":"pending";return {id:`tool-${a}`,type:"tool",status:r,toolName:e.toolName||"Unknown Tool",toolDescription:e.toolDescription}}return null}function hn(e){let a=[];return e.forEach((r,t)=>{if(r.type==="thought"){let n=r.thought;if(!n||n.trim().length===0)return;a.push({id:`thought-${t}`,type:"thinking",status:"completed",content:n});}else if(r.type==="tool"){let n=r.tool||"Unknown Tool";if(Da(n))return;a.push({id:`tool-${t}`,type:"tool",status:"completed",toolName:n,toolDescription:r.tool_description});}}),a}function Ce({events:e,className:a}){if(e.length===0)return null;let r=e.map(t=>({id:t.id,status:t.status,content:jsxRuntime.jsx(Wt,{event:t,isRunning:t.status==="running"})}));return jsxRuntime.jsx(Ae,{items:r,badgeSize:20,className:a})}function kn(e){let a=[];return e.forEach((r,t)=>{if(r.type==="thinking"){if(!r.content||r.content.trim().length===0)return;a.push({id:`thinking-${t}`,type:"thinking",status:"completed",content:r.content});}else if(r.type==="tool"){let n=r.status==="executing"?"running":r.status==="completed"?"completed":"pending";a.push({id:`tool-${t}`,type:"tool",status:n,toolName:r.toolName||"Unknown Tool",toolDescription:r.toolDescription});}}),a}function Nn({subtask:e,executionChunks:a=[]}){let[r,t]=react.useState(e.status==="running"),n=e.status==="running",o=e.status==="failed",s=e.status==="completed";n&&!r&&t(true);let l=a.length>0,c=kn(a);return jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{onClick:()=>l&&t(!r),className:i("flex items-center gap-2 min-w-0",l&&"cursor-pointer"),children:[jsxRuntime.jsx("span",{className:i("text-sm font-medium truncate",o?"text-red-500":"text-black/85"),children:e.description}),o&&e.error&&jsxRuntime.jsx("span",{className:"text-sm text-red-500 truncate flex-1",children:e.error}),s&&e.execution_time!=null&&e.execution_time>0&&jsxRuntime.jsxs("span",{className:"text-xs text-black/40 shrink-0 tabular-nums",children:[e.execution_time.toFixed(1),"s"]}),l&&jsxRuntime.jsx("span",{className:"text-black/40 shrink-0 flex items-center",children:r?jsxRuntime.jsx(lucideReact.ChevronUp,{size:14}):jsxRuntime.jsx(lucideReact.ChevronDown,{size:14})})]}),l&&r&&jsxRuntime.jsx("div",{className:"mt-2 pl-2",children:jsxRuntime.jsx(Ce,{events:c})})]})}function st({plan:e,streamingChunks:a=[],className:r}){let t=e.subtasks.map(n=>{let o=a.filter(l=>l.subtaskId===n.id),s=n.status==="running"?"running":n.status==="completed"?"completed":n.status==="failed"?"failed":"pending";return {id:String(n.id),status:s,content:jsxRuntime.jsx(Nn,{subtask:n,executionChunks:o})}});return jsxRuntime.jsxs("div",{className:i("space-y-2",r),children:[jsxRuntime.jsx("span",{className:"text-sm text-black/50",children:"Plan:"}),jsxRuntime.jsx(Ae,{items:t,badgeSize:20})]})}function it({chunk:e}){let[a,r]=react.useState(false),t=e.claudeToolData;if(!t)return null;let n=t.status==="pending",o=t.status==="error",s=t.status==="completed",l=()=>n?jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"animate-spin text-gray-400"}):o?jsxRuntime.jsx(lucideReact.XCircle,{size:14,className:"text-red-500"}):jsxRuntime.jsx(lucideReact.CheckCircle2,{size:14,className:"text-green-500"});return jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:[jsxRuntime.jsxs("div",{onClick:()=>r(!a),className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",children:[jsxRuntime.jsx(lucideReact.Wrench,{size:16,className:"text-gray-400 shrink-0"}),jsxRuntime.jsxs("span",{className:"flex-1 text-sm truncate",children:[jsxRuntime.jsx("span",{className:"font-medium",children:(()=>{let p=t.toolName;if(p.startsWith("mcp__")){let b=p.split("__");if(b.length>=3)return `${b[1]}/${b[2]}`}return p})()}),t.toolDescription&&jsxRuntime.jsx("span",{className:"text-gray-400 ml-2",children:t.toolDescription})]}),l(),s&&t.durationMs!=null&&jsxRuntime.jsxs("span",{className:"text-[0.7rem] px-1.5 py-0.5 bg-black/5 dark:bg-white/5 rounded",children:[Math.round(t.durationMs),"ms"]}),jsxRuntime.jsx("span",{className:"p-0.5",children:a?jsxRuntime.jsx(lucideReact.ChevronDown,{size:14}):jsxRuntime.jsx(lucideReact.ChevronRight,{size:14})})]}),a&&jsxRuntime.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 p-3",children:[t.toolInput&&Object.keys(t.toolInput).length>0&&jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("div",{className:"text-[0.75rem] text-gray-400 uppercase tracking-wider mb-1",children:"Input"}),jsxRuntime.jsx("pre",{className:"text-[0.75rem] font-mono bg-gray-100 dark:bg-gray-900 rounded p-2 overflow-auto max-h-[150px] m-0",children:JSON.stringify(t.toolInput,null,2)})]}),o&&jsxRuntime.jsx("p",{className:"text-sm text-red-500 font-mono",children:t.content||"Tool execution failed"}),n&&jsxRuntime.jsx("p",{className:"text-sm text-gray-400 italic",children:"Executing tool..."}),s&&t.content&&!t.isError&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-[0.75rem] text-gray-400 uppercase tracking-wider mb-1",children:"Result"}),jsxRuntime.jsx("pre",{className:"text-[0.75rem] font-mono bg-gray-100 dark:bg-gray-900 rounded p-2 overflow-auto max-h-[200px] whitespace-pre-wrap break-words m-0",children:t.content.length>1500?`${t.content.slice(0,1500)}
|
|
15
|
-
... (truncated)`:t.content})]})]})]})}function lt({chunk:e}){let[a,r]=react.useState(true),t=e.terminalData;if(!t)return null;let n=()=>{switch(t.status){case "running":return jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"animate-spin text-blue-500"});case "completed":return jsxRuntime.jsx(lucideReact.CheckCircle2,{size:14,className:"text-green-500"});case "failed":return jsxRuntime.jsx(lucideReact.XCircle,{size:14,className:"text-red-500"});default:return null}},o=t.status==="running"?"border-blue-500/30":t.status==="failed"?"border-red-500/30":t.exitCode===0?"border-green-500/30":"border-yellow-500/30",s=t.status==="running"?"bg-blue-500/10":t.status==="failed"?"bg-red-500/10":"bg-green-500/10",l=t.status==="running"?"text-blue-500":t.status==="failed"?"text-red-500":"text-green-500",c=p=>p?p<1e3?p+"ms":(p/1e3).toFixed(1)+"s":null;return jsxRuntime.jsxs("div",{className:i("my-1 bg-[#1a1a1a] rounded border",o,"overflow-hidden"),children:[jsxRuntime.jsxs("div",{onClick:()=>r(!a),className:i("flex items-center gap-2 px-3 py-1.5 cursor-pointer",s,"hover:brightness-110"),children:[jsxRuntime.jsx("span",{className:"p-0.5 text-gray-500",children:a?jsxRuntime.jsx(lucideReact.ChevronDown,{size:16}):jsxRuntime.jsx(lucideReact.ChevronRight,{size:16})}),jsxRuntime.jsx(lucideReact.Terminal,{size:16,className:l}),jsxRuntime.jsxs("span",{className:"flex-1 font-mono text-[0.75rem] text-gray-300 truncate",children:[jsxRuntime.jsx("span",{className:"text-gray-500",children:"$ "}),t.command]}),t.durationMs!=null&&jsxRuntime.jsx("span",{className:"text-[0.7rem] text-gray-600",children:c(t.durationMs)}),n(),t.status!=="running"&&t.exitCode!==void 0&&jsxRuntime.jsxs("span",{className:i("text-[0.7rem] font-mono",t.exitCode===0?"text-green-500":"text-red-500"),children:["[",t.exitCode,"]"]})]}),a&&jsxRuntime.jsxs("div",{className:"p-3",children:[t.description&&jsxRuntime.jsx("p",{className:"text-gray-500 text-[0.75rem] italic mb-2",children:t.description}),t.stdout&&jsxRuntime.jsx("pre",{className:i("m-0 p-2 text-[0.7rem] font-mono bg-[#0d0d0d] rounded overflow-auto max-h-[300px]","text-green-400 whitespace-pre-wrap break-words",t.stderr&&"mb-2"),children:t.stdout}),t.stderr&&jsxRuntime.jsx("pre",{className:"m-0 p-2 text-[0.7rem] font-mono bg-red-500/10 rounded border border-red-500/30 overflow-auto max-h-[200px] text-red-400 whitespace-pre-wrap break-words",children:t.stderr}),t.status==="running"&&!t.stdout&&!t.stderr&&jsxRuntime.jsx("p",{className:"text-gray-500 text-[0.75rem] italic",children:"Running..."}),t.status==="completed"&&!t.stdout&&!t.stderr&&t.exitCode===0&&jsxRuntime.jsx("p",{className:"text-gray-600 text-[0.75rem] italic",children:"Command completed with no output"})]})]})}function ct({chunk:e}){let[a,r]=react.useState(false),t=e.fileOperationData;if(!t)return null;let n=t.operation==="read"?jsxRuntime.jsx(lucideReact.Eye,{size:16}):t.operation==="write"?jsxRuntime.jsx(lucideReact.Save,{size:16}):t.operation==="edit"?jsxRuntime.jsx(lucideReact.Pencil,{size:16}):jsxRuntime.jsx(lucideReact.FileText,{size:16}),o=t.operation==="read"?"text-blue-500 border-blue-500":t.operation==="write"?"text-green-500 border-green-500":t.operation==="edit"?"text-yellow-500 border-yellow-500":"text-gray-500 border-gray-500",s=t.operation==="read"?"bg-blue-500/5 hover:bg-blue-500/8":t.operation==="write"?"bg-green-500/5 hover:bg-green-500/8":t.operation==="edit"?"bg-yellow-500/5 hover:bg-yellow-500/8":"bg-gray-500/5",l=t.status==="pending"?jsxRuntime.jsx(lucideReact.Clock,{size:14,className:"text-gray-400"}):t.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{size:14,className:"text-green-500"}):jsxRuntime.jsx(lucideReact.XCircle,{size:14,className:"text-red-500"}),c=t.operation==="read"?"Read":t.operation==="write"?"Write":t.operation==="edit"?"Edit":"File",p=b=>{let x=b.split("/");return x.length<=3?b:".../"+x.slice(-3).join("/")};return jsxRuntime.jsxs("div",{className:i("my-1 border rounded overflow-hidden",o.split(" ")[1]+"/30"),children:[jsxRuntime.jsxs("div",{onClick:()=>r(!a),className:i("flex items-center gap-2 px-3 py-1.5 cursor-pointer",s),children:[jsxRuntime.jsx("span",{className:"p-0.5",children:a?jsxRuntime.jsx(lucideReact.ChevronDown,{size:16}):jsxRuntime.jsx(lucideReact.ChevronRight,{size:16})}),jsxRuntime.jsx("span",{className:o.split(" ")[0],children:n}),jsxRuntime.jsx("span",{className:i("font-medium text-[0.75rem]",o.split(" ")[0]),children:c}),jsxRuntime.jsx("span",{className:"flex-1 font-mono text-[0.75rem] text-gray-500 truncate",children:p(t.filePath)}),t.totalLines!=null&&jsxRuntime.jsxs("span",{className:"text-[0.7rem] text-gray-400",children:[t.totalLines," lines"]}),l]}),a&&jsxRuntime.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-[#1e1e1e]",children:[t.operation==="read"&&t.content&&jsxRuntime.jsx(Xn,{content:t.content}),t.operation==="edit"&&jsxRuntime.jsx(Yn,{oldString:t.oldString,newString:t.newString}),t.operation==="write"&&t.status==="completed"&&jsxRuntime.jsx("p",{className:"text-green-500 text-sm",children:"File written successfully"}),t.error&&jsxRuntime.jsxs("p",{className:"text-red-500 text-sm",children:["Error: ",t.error]})]})]})}function Xn({content:e}){let a=react.useMemo(()=>e.split(`
|
|
16
|
-
`).slice(0,50),[e]),r=e.split(`
|
|
17
|
-
`).length,t=r>50;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("pre",{className:"m-0 p-2 text-[0.75rem] font-mono bg-gray-100 dark:bg-[#1a1a1a] rounded overflow-auto max-h-[300px]",children:a.map((n,o)=>jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx("span",{className:"inline-block w-10 text-right pr-3 mr-3 border-r border-gray-200 dark:border-gray-700 text-gray-400 select-none",children:o+1}),jsxRuntime.jsx("span",{children:n||" "})]},o))}),t&&jsxRuntime.jsxs("p",{className:"text-[0.75rem] text-gray-400 mt-1",children:["... and ",r-50," more lines"]})]})}function Yn({oldString:e,newString:a}){return !e&&!a?jsxRuntime.jsx("p",{className:"text-gray-500 text-sm",children:"No changes to display"}):jsxRuntime.jsxs("div",{className:"flex gap-4",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("span",{className:"text-[0.75rem] font-medium text-red-500 block mb-1",children:"- Removed"}),jsxRuntime.jsx("pre",{className:"m-0 p-2 text-[0.7rem] font-mono bg-red-500/10 rounded border border-red-500/30 overflow-auto max-h-[200px] whitespace-pre-wrap break-words",children:e||"(empty)"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("span",{className:"text-[0.75rem] font-medium text-green-500 block mb-1",children:"+ Added"}),jsxRuntime.jsx("pre",{className:"m-0 p-2 text-[0.7rem] font-mono bg-green-500/10 rounded border border-green-500/30 overflow-auto max-h-[200px] whitespace-pre-wrap break-words",children:a||"(empty)"})]})]})}function pt({chunk:e}){let[a,r]=react.useState(true),t=e.searchResultsData;if(!t)return null;let n=t.tool==="grep",o=n?"text-purple-500":"text-blue-500",s=n?"border-purple-500/30":"border-blue-500/30",l=n?"bg-purple-500/5 hover:bg-purple-500/8":"bg-blue-500/5 hover:bg-blue-500/8",c=n?"bg-purple-500/10 text-purple-500":"bg-blue-500/10 text-blue-500";return jsxRuntime.jsxs("div",{className:i("my-1 border rounded overflow-hidden",s),children:[jsxRuntime.jsxs("div",{onClick:()=>r(!a),className:i("flex items-center gap-2 px-3 py-1.5 cursor-pointer",l),children:[jsxRuntime.jsx("span",{className:"p-0.5",children:a?jsxRuntime.jsx(lucideReact.ChevronDown,{size:16}):jsxRuntime.jsx(lucideReact.ChevronRight,{size:16})}),jsxRuntime.jsx("span",{className:o,children:n?jsxRuntime.jsx(lucideReact.FileSearch,{size:16}):jsxRuntime.jsx(lucideReact.FolderSearch,{size:16})}),jsxRuntime.jsx("span",{className:i("text-[0.7rem] px-1.5 py-0.5 rounded font-medium",c),children:n?"Grep":"Glob"}),jsxRuntime.jsx("span",{className:"flex-1 font-mono text-[0.75rem] text-gray-500 truncate",children:t.pattern}),jsxRuntime.jsxs("span",{className:i("text-[0.7rem] px-1.5 py-0.5 rounded",t.totalCount>0?"bg-green-500/10 text-green-500":"bg-gray-500/10 text-gray-500"),children:[t.totalCount," results"]})]}),a&&jsxRuntime.jsxs("div",{className:"max-h-[300px] overflow-auto",children:[t.results.length>0?jsxRuntime.jsxs("div",{children:[t.results.slice(0,50).map((p,b)=>jsxRuntime.jsx(ro,{result:p,isGrep:n},b)),t.results.length>50&&jsxRuntime.jsx("div",{className:"py-1 px-3",children:jsxRuntime.jsxs("span",{className:"text-[0.75rem] text-gray-400",children:["... and ",t.results.length-50," more results"]})})]}):jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsx("p",{className:"text-gray-500 text-sm",children:"No results found"})}),t.error&&jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("p",{className:"text-red-500 text-sm",children:["Error: ",t.error]})})]})]})}function ro({result:e,isGrep:a}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2 py-1 px-3 border-b border-gray-100 dark:border-gray-800 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[jsxRuntime.jsx(lucideReact.File,{size:14,className:"text-gray-400 mt-0.5 shrink-0"}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-mono text-[0.75rem] truncate",children:(t=>{let n=t.split("/");return n.length<=4?t:".../"+n.slice(-4).join("/")})(e.filePath)}),a&&e.lineNumber!=null&&jsxRuntime.jsxs("span",{className:"font-mono text-[0.7rem] text-blue-500",children:[":",e.lineNumber]})]}),e.snippet&&jsxRuntime.jsx("p",{className:"font-mono text-[0.7rem] text-gray-500 truncate max-w-[400px]",children:e.snippet})]})]})}function dt({chunk:e}){let[a,r]=react.useState(false),t=e.webOperationData;if(!t)return null;let n=t.operation==="search",o=t.status==="pending",s=t.status==="error",l=t.status==="completed",c=()=>o?jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"animate-spin text-gray-400"}):s?jsxRuntime.jsx(lucideReact.XCircle,{size:14,className:"text-red-500"}):jsxRuntime.jsx(lucideReact.CheckCircle2,{size:14,className:"text-green-500"}),b=n?(()=>{if(!t.results||typeof t.results!="string")return [];let x=/\[([^\]]+)\]\(([^)]+)\)/g,y=[],v;for(;(v=x.exec(t.results))!==null;)y.push({title:v[1],url:v[2]});return y})():[];return jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:[jsxRuntime.jsxs("div",{onClick:()=>r(!a),className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",children:[n?jsxRuntime.jsx(lucideReact.Search,{size:16,className:"text-gray-400 shrink-0"}):jsxRuntime.jsx(lucideReact.Globe,{size:16,className:"text-gray-400 shrink-0"}),jsxRuntime.jsx("span",{className:"flex-1 text-sm truncate",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Searching: ",jsxRuntime.jsx("span",{className:"font-medium",children:t.query})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Fetching: ",jsxRuntime.jsx("span",{className:"font-medium",children:t.url})]})}),c(),l&&t.durationMs!=null&&jsxRuntime.jsxs("span",{className:"text-[0.7rem] px-1.5 py-0.5 bg-black/5 dark:bg-white/5 rounded",children:[Math.round(t.durationMs),"ms"]}),jsxRuntime.jsx("span",{className:"p-0.5",children:a?jsxRuntime.jsx(lucideReact.ChevronDown,{size:14}):jsxRuntime.jsx(lucideReact.ChevronRight,{size:14})})]}),a&&jsxRuntime.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 p-3",children:[s&&t.error&&jsxRuntime.jsx("p",{className:"text-sm text-red-500 font-mono",children:t.error}),o&&jsxRuntime.jsx("p",{className:"text-sm text-gray-400 italic",children:n?"Searching the web...":"Fetching content..."}),n&&l&&b.length>0&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"text-[0.75rem] text-gray-400 uppercase tracking-wider",children:[b.length," Results"]}),b.slice(0,5).map((x,y)=>jsxRuntime.jsxs("div",{className:i("flex items-center gap-2 py-1",y<Math.min(b.length,5)-1&&"border-b border-gray-200 dark:border-gray-700"),children:[jsxRuntime.jsx(lucideReact.ExternalLink,{size:12,className:"text-gray-400 shrink-0"}),jsxRuntime.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm truncate hover:underline",children:x.title})]},y)),b.length>5&&jsxRuntime.jsxs("p",{className:"text-[0.75rem] text-gray-400 italic",children:["+",b.length-5," more results"]})]}),n&&l&&b.length===0&&t.results&&jsxRuntime.jsxs("p",{className:"text-sm whitespace-pre-wrap max-h-[200px] overflow-auto",children:[typeof t.results=="string"?t.results.slice(0,1e3):JSON.stringify(t.results,null,2).slice(0,1e3),t.results.length>1e3&&"..."]}),!n&&l&&t.content&&jsxRuntime.jsx("div",{className:"max-h-[300px] overflow-auto bg-gray-100 dark:bg-gray-900 rounded p-2",children:jsxRuntime.jsxs("pre",{className:"text-[0.75rem] font-mono whitespace-pre-wrap break-words m-0",children:[t.content.slice(0,2e3),t.content.length>2e3&&`
|
|
18
|
-
... (truncated)`]})})]})]})}var wo={code_reviewer:"Code Review",researcher:"Research",data_analyst:"Data Analysis",Explore:"Explore",Plan:"Planning",Bash:"Command Execution"};function mt({chunk:e}){let[a,r]=react.useState(true),t=e.subagentData;if(!t)return null;let n=t.status==="running"?jsxRuntime.jsx(lucideReact.Loader2,{size:16,className:"animate-spin text-blue-500"}):t.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{size:16,className:"text-green-500"}):t.status==="failed"?jsxRuntime.jsx(lucideReact.XCircle,{size:16,className:"text-red-500"}):null,o=t.status==="running"?"border-blue-500":t.status==="completed"?"border-green-500":t.status==="failed"?"border-red-500":"border-gray-500",s=t.status==="running"?"bg-blue-500/3":t.status==="completed"?"bg-green-500/3":t.status==="failed"?"bg-red-500/3":"bg-gray-500/3",l=t.status==="running"?"bg-blue-500/10 text-blue-500":t.status==="completed"?"bg-green-500/10 text-green-500":t.status==="failed"?"bg-red-500/10 text-red-500":"bg-gray-500/10 text-gray-500",c=b=>b?b<1e3?b+"ms":(b/1e3).toFixed(1)+"s":null,p=wo[t.subagentType]||t.subagentType;return jsxRuntime.jsxs("div",{className:i("border border-dashed rounded ml-4 my-2 overflow-hidden",o+"/50",s),children:[jsxRuntime.jsxs("div",{onClick:()=>r(!a),className:i("flex items-center gap-2 px-3 py-1.5 cursor-pointer hover:brightness-95"),children:[jsxRuntime.jsx("span",{className:"p-0.5",children:a?jsxRuntime.jsx(lucideReact.ChevronDown,{size:18}):jsxRuntime.jsx(lucideReact.ChevronRight,{size:18})}),jsxRuntime.jsx(lucideReact.GitBranch,{size:16,className:o.replace("border-","text-")}),jsxRuntime.jsx("span",{className:i("text-[0.75rem] px-2 py-0.5 rounded font-medium",l),children:p}),jsxRuntime.jsx("span",{className:"flex-1 text-sm text-gray-500 truncate",children:t.description}),n,t.durationMs!=null&&jsxRuntime.jsx("span",{className:"text-[0.7rem] text-gray-400",children:c(t.durationMs)})]}),a&&jsxRuntime.jsxs("div",{className:"px-4 pb-3",children:[t.nestedChunks&&t.nestedChunks.length>0&&jsxRuntime.jsx("div",{className:"mt-2 space-y-1",children:t.nestedChunks.map((b,x)=>jsxRuntime.jsx(ko,{chunk:b},x))}),t.status==="completed"&&t.result&&jsxRuntime.jsxs("div",{className:"mt-2 p-2 rounded bg-green-500/5 border border-green-500/20",children:[jsxRuntime.jsx("span",{className:"text-[0.75rem] font-medium text-green-500",children:"Result"}),jsxRuntime.jsx("p",{className:"mt-1 text-sm text-gray-500 whitespace-pre-wrap",children:t.result.length>500?t.result.slice(0,500)+"...":t.result})]})]})]})}function ko({chunk:e}){return e.type==="tool"||e.type==="observation"?jsxRuntime.jsxs("div",{className:"py-1 px-2 my-1 rounded bg-blue-500/5 text-[0.75rem]",children:[jsxRuntime.jsxs("span",{className:"font-medium text-blue-500",children:[e.toolName||"Tool",":"]})," ",jsxRuntime.jsxs("span",{className:"text-gray-500",children:[e.content?.slice(0,200)||e.toolDescription||"Executing...",e.content&&e.content.length>200&&"..."]})]}):e.type==="thinking"||e.type==="claude_thinking"?jsxRuntime.jsxs("p",{className:"py-1 text-[0.75rem] text-gray-400 italic",children:[e.content?.slice(0,150),e.content&&e.content.length>150&&"..."]}):null}function Ao(e){let a=react.useRef(null),[r,t]=react.useState(0),n=react.useRef(0);return react.useEffect(()=>{if(e){a.current===null&&(a.current=Date.now());let o=setInterval(()=>{if(a.current!==null){let s=Math.floor((Date.now()-a.current)/1e3);t(s),n.current=s;}},1e3);return ()=>clearInterval(o)}else a.current!==null&&(n.current=Math.floor((Date.now()-a.current)/1e3),t(n.current),a.current=null);},[e]),{display:`${r}`,finalSeconds:n.current}}function Lo(e){return e.some(a=>a.orchestrator==="claude_agent_sdk"||a.type==="subagent"||a.type==="file_operation"||a.type==="terminal"||a.type==="search_results"||a.type==="web_operation"||a.type==="claude_text"||a.type==="claude_thinking")}function _o(e){return e.some(a=>a.type==="wave_start"||a.type==="wave_complete"||a.type==="parallel_subtask_start"||a.type==="parallel_subtask_complete"||a.isParallel)}function Io(e){let a=e.filter(c=>c.type==="wave_start"&&c.waveData);if(a.length===0)return null;let r=a[a.length-1],t=r.waveData?.waveNumber??0,n=r.waveData?.totalWaves??1,o=r.waveData?.parallelCount??0,s=[],l=[];return e.forEach(c=>{if(c.type==="parallel_subtask_start"&&c.waveNumber===t&&c.subtaskId!==void 0&&(l.includes(c.subtaskId)||s.push(c.subtaskId)),c.type==="parallel_subtask_complete"&&c.waveNumber===t&&c.subtaskId!==void 0){l.push(c.subtaskId);let p=s.indexOf(c.subtaskId);p>=0&&s.splice(p,1);}}),{currentWave:t,totalWaves:n,parallelCount:o,activeSubtasks:s,completedSubtasks:l}}function Vo(e){return e.some(a=>a.type==="multi_agent_planning"||a.type==="multi_agent_planning_complete"||a.type==="subagent_start"||a.type==="subagent_complete"||a.type==="subagent_failed"||a.type==="synthesis"||a.isMultiAgent)}function Ia(e){return e.find(r=>(r.type==="multi_agent_planning"||r.type==="multi_agent_planning_complete")&&r.subagentAllocations)?.subagentAllocations||[]}function Va(e){let a=new Map,r=false;Ia(e).forEach(o=>{a.set(o.name,{name:o.name,task:o.query||o.focus,status:"pending"});});let t={pending:0,running:1,completed:2,failed:2};e.forEach(o=>{if(o.subagentInfo?.name){let s=o.subagentInfo.id||o.subagentInfo.name,l=a.get(s);(!l||(t[o.subagentInfo.status]??0)>=(t[l.status]??0))&&a.set(s,o.subagentInfo);}o.type==="synthesis"&&(r=true);});let n=[...a.values()];return {subagents:a,running:n.filter(o=>o.status==="running").length,completed:n.filter(o=>o.status==="completed").length,failed:n.filter(o=>o.status==="failed").length,pending:n.filter(o=>o.status==="pending").length,isSynthesizing:r}}function Fo(e){let a=[];return e.forEach(r=>{r.type==="thought"&&r.thought?a.push({type:"thinking",content:r.thought,subtaskId:r.subtask_id}):r.type==="tool"&&(a.push({type:"tool",content:"",toolName:r.tool||"Unknown Tool",toolDescription:r.tool_description,status:"completed",subtaskId:r.subtask_id}),r.observation&&a.push({type:"observation",content:r.observation,toolName:r.tool||"Unknown Tool",success:true,subtaskId:r.subtask_id}));}),a}function Bo({chunks:e}){let a=Va(e),r=[...a.subagents.values()];if(r.length===0){let n=e.some(s=>s.type==="multi_agent_planning"),o=Ia(e);return o.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"animate-spin text-gray-400"}),jsxRuntime.jsxs("span",{className:"text-sm text-gray-500",children:["Allocating agents: ",o.map(s=>s.name).join(", ")]})]}):n?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"animate-spin text-gray-400"}),jsxRuntime.jsx("span",{className:"text-sm text-gray-500",children:"Planning agent allocation..."})]}):null}let t=r.map((n,o)=>({id:n.id||`agent-${o}`,status:n.status==="running"?"running":n.status==="completed"?"completed":n.status==="failed"?"failed":"pending",content:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n.name}),jsxRuntime.jsx("span",{className:i("text-sm flex-1 truncate",n.status==="failed"?"text-red-500":"text-gray-500"),children:n.status==="failed"&&n.error?n.error:n.task}),n.status==="completed"&&n.executionTime!=null&&jsxRuntime.jsxs("span",{className:"text-xs text-gray-400 shrink-0",children:[n.executionTime.toFixed(1),"s"]})]})}));return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-500",children:a.running===0?"Agents:":"Running agents:"}),jsxRuntime.jsx(Ae,{items:t,badgeSize:16}),a.isSynthesizing&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Sparkle,{size:14,className:"text-gray-500"}),jsxRuntime.jsx("span",{className:"text-sm text-gray-500",children:"Synthesizing results..."})]})]})}function $o({chunks:e}){return jsxRuntime.jsx("div",{className:"space-y-2",children:e.map((a,r)=>a.type==="subagent"&&a.subagentData?jsxRuntime.jsx(mt,{chunk:a},`subagent-${a.subagentData.subagentId}-${r}`):a.type==="file_operation"&&a.fileOperationData?jsxRuntime.jsx(ct,{chunk:a},`file-op-${a.fileOperationData.toolUseId}-${r}`):a.type==="terminal"&&a.terminalData?jsxRuntime.jsx(lt,{chunk:a},`terminal-${a.terminalData.toolUseId}-${r}`):a.type==="search_results"&&a.searchResultsData?jsxRuntime.jsx(pt,{chunk:a},`search-${a.searchResultsData.toolUseId}-${r}`):a.type==="web_operation"&&a.webOperationData?jsxRuntime.jsx(dt,{chunk:a},`web-op-${a.webOperationData.toolUseId}-${r}`):a.claudeToolData?jsxRuntime.jsx(it,{chunk:a},`claude-tool-${a.claudeToolData.toolUseId}-${r}`):null)})}function Aa(e){return e<1?`${Math.round(e*1e3)}ms`:`${e.toFixed(1)}s`}function Ht({isStreaming:e=false,chunks:a=[],plan:r,executionTimeline:t=[],userMessageTimestamp:n,executionTime:o,defaultExpanded:s=false,expanded:l,onExpandedChange:c,className:p}){let[b,x]=react.useState(s),{display:y,finalSeconds:v}=Ao(e),f=react.useRef(null);react.useEffect(()=>{Re(f.current);},[]);let N=chunkHVCCZKEO_cjs.a(f,300),T=l??b,I=react.useCallback(m=>{N(),x(m),c?.(m);},[N,c]),_=react.useMemo(()=>e?a.map((m,w)=>nt(m,w)).filter(m=>m!==null):[],[e,a]),U=react.useMemo(()=>!e&&(t.length>0||a.length>0)?a.map((m,w)=>nt(m,w)).filter(m=>m!==null):[],[e,t,a]),E=react.useMemo(()=>!e&&t.length>0?Fo(t):[],[e,t]),g=react.useMemo(()=>{if(!e)return null;let m=a.find(z=>z.planData!==void 0);if(!m?.planData)return null;let w={...m.planData},S=[...w.subtasks||[]],V=0,k=0;return a.forEach(z=>{if(z.type==="parallel_subtask_start"&&z.subtaskId!==void 0){let Z=S.findIndex(O=>String(O.id)===String(z.subtaskId));Z!==-1&&(S[Z]={...S[Z],status:"running"});}else if(z.type==="parallel_subtask_complete"&&z.subtaskId!==void 0){let Z=S.findIndex(O=>String(O.id)===String(z.subtaskId));if(Z!==-1){let O={...S[Z]};z.parallelSubtaskData?.success===false||z.success===false?(O.status="failed",O.error=z.parallelSubtaskData?.error,k++):(O.status="completed",O.result=z.parallelSubtaskData?.result,O.execution_time=z.parallelSubtaskData?.executionTime,V++),S[Z]=O;}}else if(z.type==="subtask"&&z.subtaskId!==void 0){let Z=S.findIndex(O=>String(O.id)===String(z.subtaskId));if(Z!==-1){let O={...S[Z]};if(z.content.includes("\u2713 Completed"))O.status="completed",z.subtaskData?.execution_time&&(O.execution_time=z.subtaskData.execution_time),V++;else if(z.content.includes("\u2717 Failed")){O.status="failed";let ca=z.content.match(/✗ Failed: (.*)/);ca&&(O.error=ca[1]),k++;}else z.content.includes("\u2192 **Subtask")&&(O.status="running");S[Z]=O;}}}),w.subtasks=S,w.completed_subtasks=V,w.failed_subtasks=k,w.progress_percentage=V/w.total_subtasks*100,w},[e,a]),h=react.useMemo(()=>{if(o&&o>0)return o;if(!e){if(r?.subtasks)return r.subtasks.reduce((m,w)=>m+(w.execution_time||0),0);if(t.length>0){let m=t[t.length-1];if(n&&m.timestamp){let w=m.timestamp-n;if(w>0)return w}if(t.length>1){let w=t[0];if(w.timestamp&&m.timestamp){let S=m.timestamp-w.timestamp;if(S>0)return S}}}}return 0},[e,r,t,n,o]);if(!e){let m=r||t.length>0||a.length>0;if(!m||m&&U.length===0&&!r&&t.length===0)return null}let u=a.length>0?a[a.length-1]:null,R=u?.type==="tool"||!!u?.toolName,C=u?.type==="planning",F=_o(a),G=F?Io(a):null,ve=Lo(a),we=Vo(a),ke=we?Va(a):null,Ve=()=>{if(!e)return h>0?`Thought for ${Aa(h)}`:v>0?`Thought for ${Aa(v)}`:(a.length>0,"Thought for a few seconds");if(we&&ke){let{running:m,completed:w,failed:S,isSynthesizing:V}=ke;if(V)return "Synthesizing results...";if(u?.type==="multi_agent_planning")return "Planning subagent allocation...";if(u?.type==="subagent_start"&&u?.subagentInfo)return `${u.subagentInfo.name}: ${u.subagentInfo.task?.slice(0,30)||"working"}...`;if(u?.type==="subagent_complete"&&u?.subagentInfo)return `${u.subagentInfo.name} complete`;if(u?.type==="subagent_failed"&&u?.subagentInfo)return `${u.subagentInfo.name} failed`;let k=m+w+S;if(m>0)return `${m} subagent${m>1?"s":""} running (${w}/${k} done)`;if(k>0)return `Multi-agent execution (${w}/${k} complete)`}if(ve){if(u?.type==="subagent"&&u?.subagentData)return `${u.subagentData.subagentType}: ${u.subagentData.description}`;if(u?.type==="file_operation"&&u?.fileOperationData){let m=u.fileOperationData.operation,w=u.fileOperationData.filePath.split("/").pop();return `${m==="read"?"Reading":m==="edit"?"Editing":"Writing"} ${w}`}if(u?.type==="terminal"&&u?.terminalData){let m=u.terminalData.command;return m.length>40?`$ ${m.slice(0,37)}...`:`$ ${m}`}if(u?.type==="search_results"&&u?.searchResultsData)return `${u.searchResultsData.tool}: ${u.searchResultsData.pattern}`;if(u?.type==="web_operation"&&u?.webOperationData)return u.webOperationData.operation==="search"?`Searching: ${u.webOperationData.query}`:`Fetching: ${u.webOperationData.url?.slice(0,40)}...`}if(F&&G){let{currentWave:m,totalWaves:w,parallelCount:S,activeSubtasks:V,completedSubtasks:k}=G;if(u?.type==="wave_start")return `Wave ${m+1}/${w}: ${S} parallel subtasks`;if(u?.type==="wave_complete")return `Wave ${m+1} complete (${k.length} done)`;if(u?.type==="parallel_subtask_start"&&u?.parallelSubtaskData?.description){let z=u.parallelSubtaskData.description;return z.length>40?`${z.slice(0,37)}...`:z}return V.length>0?`Wave ${m+1}/${w}: ${V.length} running...`:`Parallel execution (Wave ${m+1}/${w})`}if(u?.toolDescription)return u.toolDescription;if(u?.toolName)return u.toolName;switch(u?.type){case "planning":return "Planning...";case "thinking":return "Thinking...";case "tool":return u.toolName||"Using tool...";case "subtask":return `Executing subtask ${u.subtaskId||""}...`;case "observation":return "Analyzing results...";case "progress":return "Working...";case "wave_start":return "Starting parallel execution...";case "wave_complete":return "Parallel wave complete";case "parallel_subtask_start":return "Running parallel subtask...";case "parallel_subtask_complete":return "Parallel subtask complete";default:return "Thinking..."}},Ee=()=>we?jsxRuntime.jsx(lucideReact.Users,{size:14}):ve?u?.type==="subagent"?jsxRuntime.jsx(lucideReact.GitBranch,{size:14}):u?.type==="file_operation"?jsxRuntime.jsx(lucideReact.FileText,{size:14}):u?.type==="terminal"?jsxRuntime.jsx(lucideReact.Terminal,{size:14}):u?.type==="search_results"?jsxRuntime.jsx(lucideReact.Search,{size:14}):u?.type==="web_operation"?jsxRuntime.jsx(lucideReact.Globe,{size:14}):jsxRuntime.jsx(lucideReact.Sparkle,{size:14}):F?jsxRuntime.jsx(lucideReact.Zap,{size:14}):R?jsxRuntime.jsx(lucideReact.Wrench,{size:14}):C?jsxRuntime.jsx(lucideReact.ListTodo,{size:14}):jsxRuntime.jsx(lucideReact.Sparkle,{size:14}),Ue=m=>m?.subtasks&&m.subtasks.length>=2,de=e?g:r,Fe=Ue(de);return jsxRuntime.jsxs("div",{ref:f,className:i("max-w-full",p),children:[jsxRuntime.jsxs("div",{onClick:()=>I(!T),style:{position:"relative",display:"inline-flex",alignItems:"center",gap:6,padding:"4px 6px",overflow:"hidden",borderRadius:8,cursor:"pointer",transition:"opacity 0.2s",...!e&&{opacity:.6}},children:[e&&jsxRuntime.jsx("div",{style:Me}),jsxRuntime.jsx("span",{className:i("flex items-center text-gray-500"),children:e?Ee():jsxRuntime.jsx(lucideReact.Sparkle,{size:14})}),jsxRuntime.jsx("span",{className:i("text-sm font-normal text-gray-500 text-[var(--chat-text-subtle)]"),children:Ve()}),e&&parseInt(y)>0&&jsxRuntime.jsxs("span",{className:"text-gray-500 font-normal tabular-nums text-sm",children:[y,"s"]})]}),T&&jsxRuntime.jsx("div",{className:"mt-3 animate-fade-in",children:e?we?jsxRuntime.jsx(Bo,{chunks:a}):ve?jsxRuntime.jsx($o,{chunks:a}):Fe&&de?jsxRuntime.jsx(st,{plan:de,streamingChunks:a}):g?.subtasks?.length===1?jsxRuntime.jsx(Ce,{events:_}):g?.subtasks?.length===0?null:jsxRuntime.jsx(Ce,{events:_}):r?r.subtasks?.length===0?null:r.subtasks?.length===1?jsxRuntime.jsx(Ce,{events:U}):jsxRuntime.jsx(st,{plan:r,streamingChunks:E}):jsxRuntime.jsx(Ce,{events:U})})]})}var Xe=react.forwardRef(({content:e,isStreaming:a=false,renderMarkdown:r=true,className:t,baselineFontSize:n,markdownProps:o},s)=>jsxRuntime.jsx(chunk3SEVU272_cjs.m,{ref:s,content:e,isStreaming:a,showCursor:false,className:i("relative",t),children:r?jsxRuntime.jsx(ne,{baselineFontSize:n,...o,children:e}):jsxRuntime.jsx("span",{className:"whitespace-pre-wrap",children:e})}));Xe.displayName="StreamingText";var es={send_message:jsxRuntime.jsx(lucideReact.Send,{size:14}),navigate:jsxRuntime.jsx(lucideReact.Navigation,{size:14}),copy_text:jsxRuntime.jsx(lucideReact.Copy,{size:14}),compose_email:jsxRuntime.jsx(lucideReact.Mail,{size:14}),search_emails:jsxRuntime.jsx(lucideReact.Search,{size:14}),open_modal:jsxRuntime.jsx(lucideReact.ExternalLink,{size:14}),api_call:jsxRuntime.jsx(lucideReact.Zap,{size:14})};function ts(e){return e?es[e]||jsxRuntime.jsx(lucideReact.ArrowRight,{size:14}):jsxRuntime.jsx(lucideReact.ArrowRight,{size:14})}var gt=react.forwardRef(({actions:e,onSelect:a,className:r,showIcons:t=true,disabled:n=false},o)=>{let[s,l]=react.useState(null);if(e.length===0)return null;let c=async(p,b)=>{if(!(!a||s!==null)){l(b);try{await a(p);}finally{l(null);}}};return jsxRuntime.jsx("div",{ref:o,role:"group","aria-label":"Suggested actions",className:i("flex flex-wrap gap-2",r),children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e.map((p,b)=>{let x=s===b,y=n||s!==null;return jsxRuntime.jsxs(framerMotion.motion.button,{type:"button",initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.2,delay:b*.05},disabled:y,onClick:()=>c(p,b),className:i("inline-flex items-center gap-1.5","px-3 py-1.5 rounded-lg","text-sm font-medium","border border-gray-200 dark:border-gray-700","bg-white dark:bg-gray-800","text-gray-700 dark:text-gray-300","opacity-80 hover:opacity-100","hover:border-gray-300 dark:hover:border-gray-600","hover:bg-gray-50 dark:hover:bg-gray-750","hover:-translate-y-px","active:translate-y-0","transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-blue-500/20","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:translate-y-0"),children:[x?jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"animate-spin"}):t&&jsxRuntime.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:ts(p.type)}),p.label]},p.id)})})})});gt.displayName="SuggestedActions";var fs=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#F97316"];function ht({data:e,config:a,isStreaming:r=false}){let{chartType:t,series:n,xAxis:o,yAxis:s}=e,l=a?.colors||fs,c=a?.height||300,p=a?.legend!==false,b=a?.grid!==false,x=a?.tooltip!==false,y=a?.animate!==false&&!r,v=a?.stacked||false,N=(()=>{if(t==="pie")return (n[0]?.data||[]).map((h,u)=>({name:h.name||h.x||`Item ${u+1}`,value:h.value??h.y??0}));let E=new Map;return n.forEach(g=>{g.data.forEach(h=>{let u=h.x??h.name;E.has(u)||E.set(u,{x:u}),E.get(u)[g.name]=h.y??h.value??0;});}),Array.from(E.values())})(),T={data:N,margin:{top:10,right:30,left:0,bottom:0}},I={fontSize:12},_={backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:8};return jsxRuntime.jsx("div",{className:"w-full",style:{height:c},children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:(()=>{switch(t){case "line":return jsxRuntime.jsxs(recharts.LineChart,{...T,children:[b&&jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"x",...I,tickLine:false,padding:{left:10,right:10}}),jsxRuntime.jsx(recharts.YAxis,{...I,tickLine:false,width:40}),x&&jsxRuntime.jsx(recharts.Tooltip,{contentStyle:_}),p&&jsxRuntime.jsx(recharts.Legend,{}),n.map((E,g)=>jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:E.name,stroke:E.color||l[g%l.length],strokeWidth:2,dot:false,activeDot:{r:4},isAnimationActive:y},E.name))]});case "bar":return jsxRuntime.jsxs(recharts.BarChart,{...T,children:[b&&jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"x",...I,tickLine:false,padding:{left:10,right:10}}),jsxRuntime.jsx(recharts.YAxis,{...I,tickLine:false,width:40}),x&&jsxRuntime.jsx(recharts.Tooltip,{contentStyle:_}),p&&jsxRuntime.jsx(recharts.Legend,{}),n.map((E,g)=>jsxRuntime.jsx(recharts.Bar,{dataKey:E.name,fill:E.color||l[g%l.length],stackId:v?"stack":void 0,isAnimationActive:y,radius:[4,4,0,0]},E.name))]});case "area":return jsxRuntime.jsxs(recharts.AreaChart,{...T,children:[b&&jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"x",...I,tickLine:false,padding:{left:10,right:10}}),jsxRuntime.jsx(recharts.YAxis,{...I,tickLine:false,width:40}),x&&jsxRuntime.jsx(recharts.Tooltip,{contentStyle:_}),p&&jsxRuntime.jsx(recharts.Legend,{}),n.map((E,g)=>jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:E.name,stroke:E.color||l[g%l.length],fill:E.color||l[g%l.length],fillOpacity:.3,stackId:v?"stack":void 0,isAnimationActive:y},E.name))]});case "pie":return jsxRuntime.jsxs(recharts.PieChart,{children:[x&&jsxRuntime.jsx(recharts.Tooltip,{contentStyle:_}),p&&jsxRuntime.jsx(recharts.Legend,{}),jsxRuntime.jsx(recharts.Pie,{data:N,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:Math.min(c,300)/3,isAnimationActive:y,label:({name:E,percent:g})=>`${E}: ${((g??0)*100).toFixed(0)}%`,labelLine:false,children:N.map((E,g)=>jsxRuntime.jsx(recharts.Cell,{fill:l[g%l.length]},`cell-${g}`))})]});case "scatter":return jsxRuntime.jsxs(recharts.ScatterChart,{...T,children:[b&&jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"x",type:"number",...I,tickLine:false,name:o?.label,padding:{left:10,right:10}}),jsxRuntime.jsx(recharts.YAxis,{...I,tickLine:false,name:s?.label,width:40}),x&&jsxRuntime.jsx(recharts.Tooltip,{contentStyle:_}),p&&jsxRuntime.jsx(recharts.Legend,{}),n.map((E,g)=>jsxRuntime.jsx(recharts.Scatter,{name:E.name,data:E.data.map(h=>({x:h.x,y:h.y})),fill:E.color||l[g%l.length],isAnimationActive:y},E.name))]});default:return null}})()||jsxRuntime.jsx(jsxRuntime.Fragment,{})})})}var ks={active:"bg-green-100 text-green-700",completed:"bg-green-100 text-green-700",success:"bg-green-100 text-green-700",enabled:"bg-green-100 text-green-700",pending:"bg-yellow-100 text-yellow-700",processing:"bg-yellow-100 text-yellow-700",in_progress:"bg-yellow-100 text-yellow-700",failed:"bg-red-100 text-red-700",error:"bg-red-100 text-red-700",disabled:"bg-red-100 text-red-700",inactive:"bg-gray-100 text-gray-700",draft:"bg-gray-100 text-gray-700"};function Ns(e,a){if(e==null)return jsxRuntime.jsx("span",{className:"text-gray-400",children:"-"});switch(a.type||"string"){case "number":return typeof e=="number"?e.toLocaleString():String(e);case "currency":return typeof e=="number"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e):String(e);case "date":try{return new Date(e).toLocaleDateString()}catch{return String(e)}case "badge":{let t=String(e).toLowerCase().replace(/\s+/g,"_"),n=ks[t]||"bg-gray-100 text-gray-700";return jsxRuntime.jsx("span",{className:i("inline-block px-2 py-0.5 rounded-full text-xs font-medium",n),children:String(e)})}case "link":return jsxRuntime.jsx("a",{href:String(e),target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:String(e)});case "boolean":return e?jsxRuntime.jsx(lucideReact.Check,{size:18,className:"text-green-500"}):jsxRuntime.jsx(lucideReact.X,{size:18,className:"text-gray-400"});case "progress":{let t=typeof e=="number"?e:parseFloat(String(e));return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex-1 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${Math.min(100,Math.max(0,t))}%`}})}),jsxRuntime.jsxs("span",{className:"text-xs text-gray-500",children:[t.toFixed(0),"%"]})]})}default:return String(e)}}function Ba(e,a,r){let t=e[r],n=a[r];return t==null?1:n==null?-1:typeof t=="number"&&typeof n=="number"?n-t:String(n).localeCompare(String(t))}function yt({data:e,config:a}){let{columns:r,rows:t}=e,n=a?.sortable!==false,o=a?.paginated||false,s=a?.pageSize||10,[l,c]=react.useState("asc"),[p,b]=react.useState(r[0]?.key||""),[x,y]=react.useState(0),v=T=>{c(p===T&&l==="asc"?"desc":"asc"),b(T);},f=react.useMemo(()=>{let T=[...t];return n&&p&&T.sort((I,_)=>l==="desc"?Ba(I,_,p):-Ba(I,_,p)),o&&(T=T.slice(x*s,(x+1)*s)),T},[t,l,p,x,s,n,o]),N=Math.ceil(t.length/s);return jsxRuntime.jsxs("div",{className:"w-full overflow-x-auto",children:[jsxRuntime.jsxs("table",{className:"min-w-full text-sm",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsx("tr",{children:r.map(T=>jsxRuntime.jsx("th",{className:i("px-3 py-2 font-semibold bg-gray-50 dark:bg-gray-800 whitespace-nowrap text-left",n&&"cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-700"),style:{width:T.width,textAlign:T.align||"left"},onClick:()=>n&&v(T.key),children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[T.label,n&&p===T.key&&(l==="asc"?jsxRuntime.jsx(lucideReact.ChevronUp,{size:14}):jsxRuntime.jsx(lucideReact.ChevronDown,{size:14}))]})},T.key))})}),jsxRuntime.jsxs("tbody",{children:[f.map((T,I)=>jsxRuntime.jsx("tr",{className:"border-t border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:r.map(_=>jsxRuntime.jsx("td",{className:"px-3 py-2 whitespace-nowrap max-w-[300px] overflow-hidden text-ellipsis",style:{textAlign:_.align||"left"},children:Ns(T[_.key],_)},_.key))},I)),f.length===0&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:r.length,className:"px-3 py-8 text-center text-gray-400",children:"No data available"})})]})]}),o&&t.length>s&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-gray-200 dark:border-gray-700 text-sm",children:[jsxRuntime.jsxs("span",{className:"text-gray-500",children:[x*s+1,"-",Math.min((x+1)*s,t.length)," of ",t.length]}),jsxRuntime.jsxs("div",{className:"flex gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(Math.max(0,x-1)),disabled:x===0,className:"px-2 py-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-30",children:"Prev"}),jsxRuntime.jsx("button",{onClick:()=>y(Math.min(N-1,x+1)),disabled:x>=N-1,className:"px-2 py-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-30",children:"Next"})]})]})]})}function vt({data:e,config:a,onAction:r}){let{subtitle:t,imageUrl:n,sections:o,actions:s}=e,l=a?.collapsible||false,c=a?.initiallyCollapsed||false,[p,b]=react.useState(!c),x=f=>{f.startsWith("http://")||f.startsWith("https://")||f.startsWith("/")?window.open(f,"_blank","noopener,noreferrer"):r?r({type:"card_action",action:f}):window.dispatchEvent(new CustomEvent("visualization-action",{detail:{action:f}}));},y=(f,N)=>jsxRuntime.jsxs("div",{className:i(N<o.length-1&&"mb-4"),children:[f.title&&jsxRuntime.jsx("h4",{className:"font-semibold text-sm mb-2",children:f.title}),f.items&&f.items.length>0&&jsxRuntime.jsx("div",{className:"space-y-1",children:f.items.map((T,I)=>jsxRuntime.jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-500 shrink-0",children:T.label}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-right",children:T.value})]},I))}),f.content&&jsxRuntime.jsx(ne,{children:f.content})]},N),v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n&&jsxRuntime.jsx("img",{src:n,alt:"",className:"w-full h-[140px] object-cover border-b border-gray-200 dark:border-gray-700"}),t&&jsxRuntime.jsx("p",{className:"text-sm text-gray-500 italic mb-4",children:t}),o.map((f,N)=>jsxRuntime.jsxs("div",{children:[y(f,N),N<o.length-1&&jsxRuntime.jsx("hr",{className:"my-4 border-gray-200 dark:border-gray-700"})]},N))]});return jsxRuntime.jsxs("div",{className:"w-full",children:[l&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2 cursor-pointer",onClick:()=>b(!p),children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-500",children:p?"Click to collapse":"Click to expand"}),jsxRuntime.jsx("button",{className:"p-1",children:p?jsxRuntime.jsx(lucideReact.ChevronUp,{size:18}):jsxRuntime.jsx(lucideReact.ChevronDown,{size:18})})]}),(!l||p)&&v,s&&s.length>0&&jsxRuntime.jsx("div",{className:"flex gap-2 mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:s.map((f,N)=>jsxRuntime.jsxs("button",{onClick:()=>x(f.action),className:i("px-3 py-1.5 text-sm rounded-lg transition-colors",f.variant==="primary"?"bg-blue-500 text-white hover:bg-blue-600":f.variant==="text"?"text-blue-500 hover:bg-blue-50":"border border-gray-300 hover:bg-gray-50"),children:[f.label,f.action.startsWith("http")&&jsxRuntime.jsx(lucideReact.ExternalLink,{size:14,className:"inline ml-1"})]},N))})]})}var _s=["#3B82F6","#10B981","#F59E0B","#8B5CF6"];function Is({metric:e,color:a,animate:r}){let t=e.trend==="up"?jsxRuntime.jsx(lucideReact.ArrowUp,{size:16,className:"text-green-500"}):e.trend==="down"?jsxRuntime.jsx(lucideReact.ChevronDown,{size:16,className:"text-red-500"}):e.trend==="neutral"?jsxRuntime.jsx(lucideReact.Circle,{size:14,className:"text-gray-400"}):null,n=e.trend==="up"?"text-green-500":e.trend==="down"?"text-red-500":"text-gray-500",o=e.sparkline?.map((s,l)=>({value:s,idx:l}));return jsxRuntime.jsxs("div",{className:"p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 relative overflow-hidden",children:[o&&o.length>0&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 opacity-30",children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsx(recharts.AreaChart,{data:o,margin:{top:0,right:0,left:0,bottom:0},children:jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"value",stroke:e.color||a,fill:e.color||a,strokeWidth:1,isAnimationActive:r})})})}),jsxRuntime.jsxs("div",{className:"relative z-10",children:[jsxRuntime.jsx("span",{className:"text-xs text-gray-500 font-medium uppercase tracking-wider",children:e.label}),jsxRuntime.jsxs("div",{className:"flex items-baseline gap-1 mt-1",children:[jsxRuntime.jsx("span",{className:"text-2xl font-bold",children:e.value}),e.unit&&jsxRuntime.jsx("span",{className:"text-sm text-gray-500",children:e.unit})]}),(e.trend||e.change)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[t,e.change&&jsxRuntime.jsx("span",{className:i("text-sm font-medium",n),children:e.change}),e.changeLabel&&jsxRuntime.jsx("span",{className:"text-xs text-gray-500",children:e.changeLabel})]})]})]})}function kt({data:e,config:a,isStreaming:r=false}){let{metrics:t,layout:n="row"}=e,o=a?.colors||_s,s=a?.animate!==false&&!r,l=n==="grid";return jsxRuntime.jsx("div",{className:i("w-full",l?"grid grid-cols-1 sm:grid-cols-2 gap-4":"flex gap-4 flex-wrap"),children:t.map((c,p)=>jsxRuntime.jsx("div",{className:i(!l&&"flex-1 min-w-[200px]"),children:jsxRuntime.jsx(Is,{metric:c,color:c.color||o[p%o.length],animate:s})},p))})}var Hs={js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",cpp:"cpp",c:"c",cs:"csharp",sh:"bash",bash:"bash",sql:"sql",html:"html",css:"css",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",graphql:"graphql"};function Nt({data:e}){let{code:a,language:r,lineNumbers:t=true,highlightLines:n=[],startLine:o=1}=e,[s,l]=react.useState(false),c=Hs[r.toLowerCase()]||r.toLowerCase(),p=async()=>{try{await navigator.clipboard.writeText(a),l(!0);}catch{}};return react.useEffect(()=>{if(s){let x=setTimeout(()=>l(false),2e3);return ()=>clearTimeout(x)}},[s]),jsxRuntime.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-gray-800 dark:bg-gray-900 border-b border-gray-700",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.FileText,{size:16,className:"text-gray-400"}),jsxRuntime.jsx("span",{className:"text-xs font-mono text-gray-400 lowercase",children:c})]}),jsxRuntime.jsx("button",{onClick:p,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-white/10 transition-colors text-gray-400 hover:text-gray-200",title:s?"Copied!":"Copy code",children:s?jsxRuntime.jsx(lucideReact.Check,{size:14,className:"text-green-400"}):jsxRuntime.jsx(lucideReact.Copy,{size:14})})]}),jsxRuntime.jsx(reactSyntaxHighlighter.Prism,{language:c,style:prism.oneDark,showLineNumbers:t,startingLineNumber:o,wrapLines:true,lineProps:x=>{let y={};return n.includes(x)&&(y.backgroundColor="rgba(59, 130, 246, 0.1)",y.display="block",y.borderLeft="3px solid #3B82F6",y.paddingLeft="8px",y.marginLeft="-11px"),{style:y}},customStyle:{margin:0,borderRadius:0,fontSize:"0.8125rem",lineHeight:"1.6",background:"#1e1e1e"},codeTagProps:{style:{fontFamily:"'Fira Code', 'JetBrains Mono', monospace"}},children:a.trim()})]})}function Ct({data:e,config:a,isStreaming:r=false,onAction:t}){let{fields:n,submitAction:o}=e,s=a?.submitButtonText||"Submit",l=a?.cancelButtonText||"Cancel",[c,p]=react.useState(()=>{let g={};return n.forEach(h=>{h.defaultValue!==void 0?g[h.name]=h.defaultValue:h.type==="multiselect"?g[h.name]=[]:h.type==="checkbox"?g[h.name]=false:g[h.name]="";}),g}),[b,x]=react.useState({}),[y,v]=react.useState(false),f=(g,h)=>{p(u=>({...u,[g]:h})),b[g]&&x(u=>{let R={...u};return delete R[g],R});},N=()=>{let g={};return n.forEach(h=>{let u=c[h.name];if(h.required&&(u==null||u===""||Array.isArray(u)&&u.length===0)){g[h.name]=`${h.label} is required`;return}if(!(!u&&!h.required)){if(h.validation){let{min:R,max:C,pattern:F,message:G}=h.validation;R!==void 0&&typeof u=="number"&&u<R&&(g[h.name]=G||`Minimum value is ${R}`),C!==void 0&&typeof u=="number"&&u>C&&(g[h.name]=G||`Maximum value is ${C}`),F&&typeof u=="string"&&!new RegExp(F).test(u)&&(g[h.name]=G||"Invalid format");}h.type==="email"&&typeof u=="string"&&u&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)&&(g[h.name]="Invalid email address");}}),x(g),Object.keys(g).length===0},T=g=>{g.preventDefault(),N()&&(t?t({type:"form_submit",action:o||"",data:c}):window.dispatchEvent(new CustomEvent("visualization-form-submit",{detail:{action:o,data:c}})),v(true));},I=()=>{t?t({type:"form_cancel",action:o||""}):window.dispatchEvent(new CustomEvent("visualization-form-cancel",{detail:{action:o}}));};if(y)return jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{className:"text-lg font-semibold text-green-500 mb-1",children:"Form Submitted"}),jsxRuntime.jsx("p",{className:"text-sm text-gray-500",children:"Your response has been recorded."})]});let _="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none transition-colors",U="border-red-500 focus:ring-red-500/20 focus:border-red-500",E=g=>{let h=c[g.name],R=!!b[g.name];switch(g.type){case "text":case "email":case "number":return jsxRuntime.jsx("input",{type:g.type,placeholder:g.placeholder,required:g.required,value:String(h||""),onChange:C=>f(g.name,g.type==="number"?parseFloat(C.target.value)||"":C.target.value),className:i(_,R&&U),min:g.validation?.min,max:g.validation?.max});case "textarea":return jsxRuntime.jsx("textarea",{placeholder:g.placeholder,required:g.required,value:String(h||""),onChange:C=>f(g.name,C.target.value),className:i(_,"min-h-[100px] resize-y",R&&U),rows:4});case "select":return jsxRuntime.jsxs("select",{value:String(h||""),onChange:C=>f(g.name,C.target.value),className:i(_,R&&U),children:[jsxRuntime.jsx("option",{value:"",disabled:true,children:g.placeholder||"Select an option"}),g.options?.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))]});case "multiselect":return jsxRuntime.jsx("select",{multiple:true,value:h||[],onChange:C=>f(g.name,Array.from(C.target.selectedOptions,F=>F.value)),className:i(_,"min-h-[80px]",R&&U),children:g.options?.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))});case "checkbox":return jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:!!h,onChange:C=>f(g.name,C.target.checked),className:"w-4 h-4 accent-blue-500 rounded"}),jsxRuntime.jsx("span",{className:"text-sm",children:g.label})]});case "radio":return jsxRuntime.jsx("div",{className:"space-y-1",children:g.options?.map(C=>jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[jsxRuntime.jsx("input",{type:"radio",name:g.name,value:C.value,checked:h===C.value,onChange:F=>f(g.name,F.target.value),className:"w-3.5 h-3.5 accent-blue-500"}),C.label]},C.value))});case "date":return jsxRuntime.jsx("input",{type:"date",value:String(h||""),onChange:C=>f(g.name,C.target.value),className:i(_,R&&U)});case "datetime":return jsxRuntime.jsx("input",{type:"datetime-local",value:String(h||""),onChange:C=>f(g.name,C.target.value),className:i(_,R&&U)});default:return null}};return jsxRuntime.jsxs("form",{onSubmit:T,className:"space-y-4",children:[n.map(g=>jsxRuntime.jsxs("div",{children:[g.type!=="checkbox"&&jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1",children:[g.label,g.required&&jsxRuntime.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]}),E(g),b[g.name]&&jsxRuntime.jsx("p",{className:"text-xs text-red-500 mt-1",children:b[g.name]})]},g.name)),jsxRuntime.jsxs("div",{className:"flex gap-2 pt-2",children:[jsxRuntime.jsx("button",{type:"submit",disabled:r,className:"px-4 py-2 text-sm rounded-lg bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 transition-colors",children:s}),jsxRuntime.jsx("button",{type:"button",onClick:I,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:l})]})]})}var St=new Map;function Pe(e,a){St.set(e,a);}function zt(e){return St.get(e)}function $a(){return Array.from(St.keys())}Pe("chart",{component:ht});Pe("table",{component:yt});Pe("card",{component:vt});Pe("kpi",{component:kt});Pe("code_preview",{component:Nt});Pe("form",{component:Ct});function Oa(e){for(let[a,r]of Object.entries(e)){let t=St.get(a);t&&(t.schema=r);}}var Us=zod.z.object({name:zod.z.string(),data:zod.z.array(zod.z.union([zod.z.object({x:zod.z.union([zod.z.string(),zod.z.number()]),y:zod.z.number()}),zod.z.object({name:zod.z.string(),value:zod.z.number()})])),color:zod.z.string().optional()}),Wa=zod.z.object({label:zod.z.string().optional(),type:zod.z.enum(["category","number","time"]).optional(),min:zod.z.number().optional(),max:zod.z.number().optional()}),Xt=zod.z.object({chartType:zod.z.enum(["line","bar","pie","area","scatter","composed"]),series:zod.z.array(Us),xAxis:Wa.optional(),yAxis:Wa.optional()}),Ks=zod.z.object({key:zod.z.string(),label:zod.z.string(),type:zod.z.enum(["string","number","currency","date","badge","link","boolean","progress"]).optional(),align:zod.z.enum(["left","center","right"]).optional(),width:zod.z.string().optional()}),Yt=zod.z.object({columns:zod.z.array(Ks),rows:zod.z.array(zod.z.record(zod.z.string(),zod.z.unknown()))}),qs=zod.z.object({title:zod.z.string().optional(),items:zod.z.array(zod.z.object({label:zod.z.string(),value:zod.z.union([zod.z.string(),zod.z.number()])})).optional(),content:zod.z.string().optional()}),Gs=zod.z.object({label:zod.z.string(),action:zod.z.string(),variant:zod.z.enum(["primary","secondary","text"]).optional()}),Zt=zod.z.object({subtitle:zod.z.string().optional(),imageUrl:zod.z.string().optional(),sections:zod.z.array(qs),actions:zod.z.array(Gs).optional()}),Xs=zod.z.object({label:zod.z.string(),value:zod.z.union([zod.z.string(),zod.z.number()]),unit:zod.z.string().optional(),trend:zod.z.enum(["up","down","neutral"]).optional(),change:zod.z.string().optional(),changeLabel:zod.z.string().optional(),sparkline:zod.z.array(zod.z.number()).optional(),color:zod.z.string().optional()}),Jt=zod.z.object({metrics:zod.z.array(Xs),layout:zod.z.enum(["row","grid"]).optional()}),Qt=zod.z.object({code:zod.z.string(),language:zod.z.string(),lineNumbers:zod.z.boolean().optional(),highlightLines:zod.z.array(zod.z.number()).optional(),startLine:zod.z.number().optional()}),Ys=zod.z.object({name:zod.z.string(),type:zod.z.enum(["text","number","email","select","multiselect","checkbox","radio","textarea","date","datetime"]),label:zod.z.string(),required:zod.z.boolean().optional(),placeholder:zod.z.string().optional(),options:zod.z.array(zod.z.object({value:zod.z.string(),label:zod.z.string()})).optional(),defaultValue:zod.z.unknown().optional(),validation:zod.z.object({min:zod.z.number().optional(),max:zod.z.number().optional(),pattern:zod.z.string().optional(),message:zod.z.string().optional()}).optional()}),ea=zod.z.object({fields:zod.z.array(Ys),submitAction:zod.z.string().optional()});Oa({chart:Xt,table:Yt,card:Zt,kpi:Jt,code_preview:Qt,form:ea});function Pt({data:e,isStreaming:a=false,onAction:r}){let{type:t,title:n,description:o,data:s,config:l}=e;return jsxRuntime.jsxs("div",{className:"my-3 overflow-hidden",children:[(n||o)&&jsxRuntime.jsxs("div",{className:"mb-2",children:[n&&jsxRuntime.jsx("p",{className:"text-sm font-semibold",children:n}),o&&jsxRuntime.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:o})]}),jsxRuntime.jsx("div",{children:(()=>{let p=zt(t);if(!p)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 p-4 text-yellow-500",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{size:20}),jsxRuntime.jsxs("span",{className:"text-sm",children:["Unknown visualization type: ",t]})]});if(p.schema){let x=p.schema.safeParse(s);if(!x.success){let y=x.error.issues.slice(0,3);return jsxRuntime.jsxs("div",{className:"p-4 rounded-lg border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-950/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400 mb-2",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{size:18}),jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:["Invalid ",t," visualization data"]})]}),jsxRuntime.jsxs("ul",{className:"text-xs text-red-500 dark:text-red-400 space-y-1 list-disc list-inside",children:[y.map((v,f)=>jsxRuntime.jsxs("li",{children:[v.path.join("."),": ",v.message]},f)),x.error.issues.length>3&&jsxRuntime.jsxs("li",{children:["...and ",x.error.issues.length-3," more"]})]})]})}}let b=p.component;return jsxRuntime.jsx(b,{data:s,config:l,isStreaming:a,onAction:r})})()})]})}var Ua=/\[VIZ:([a-f0-9-]+)\]/gi;function ti(e){let a=[],r=0,t;for(Ua.lastIndex=0;(t=Ua.exec(e))!==null;){if(t.index>r){let n=e.slice(r,t.index);n.trim()&&a.push({type:"text",content:n});}a.push({type:"viz",id:t[1]}),r=t.index+t[0].length;}if(r<e.length){let n=e.slice(r);n.trim()&&a.push({type:"text",content:n});}return a}var Ka=react.forwardRef(({message:e,viewerRole:a="user",className:r,showAvatar:t=true,showTimestamp:n=true,renderMarkdown:o=true,reasoning:s,executionPlan:l,executionTimeline:c,suggestedActions:p,onSuggestedAction:b,reasoningExpanded:x,onReasoningExpandedChange:y,citations:v,visualizations:f,baselineFontSize:N,executionTime:T,pendingClarification:I,onClarificationSubmit:_},U)=>{let g=react.useContext(chunkSFEPMZCU_cjs.a)?.onVisualizationAction,h=(e.participant?.role||"").toLowerCase(),u=(a||"").toLowerCase(),R=h===u,C=h==="assistant",F=e.isStreaming,G=s?.filter(k=>k.type==="thinking"||k.type==="tool"||k.type==="observation"||k.type==="planning"||k.type==="subtask"||k.type==="wave_start"||k.type==="wave_complete"||k.type==="parallel_subtask_start"||k.type==="parallel_subtask_complete"||k.type==="multi_agent_planning"||k.type==="subagent_start"||k.type==="subagent_complete"||k.type==="subagent_failed"||k.type==="synthesis"||k.type==="claude_thinking"||k.type==="subagent"||k.type==="file_operation"||k.type==="terminal"||k.type==="search_results"||k.type==="web_operation"||k.claudeToolData!=null),ve=G&&G.length>0,we=!F&&(l||c&&c.length>0),ke=ve||we,Ve=F&&!e.textContent&&!ke,Ee=e.attachments,Ue=Ee&&Ee.length>0,de=react.useMemo(()=>{if(!f||f.length===0)return null;let k=new Map;return f.forEach(z=>k.set(z.id,z)),k},[f]),Fe=de&&de.size>0,m=react.useMemo(()=>!Fe||!e.textContent?null:ti(e.textContent),[Fe,e.textContent]),w=()=>e.textContent?m&&m.length>0&&de?jsxRuntime.jsx(jsxRuntime.Fragment,{children:m.map((k,z)=>{if(k.type==="text")return F?jsxRuntime.jsx(Xe,{content:k.content,isStreaming:true,baselineFontSize:N},z):jsxRuntime.jsx(ne,{baselineFontSize:N,className:R?"prose-invert":"",children:k.content},z);let Z=de.get(k.id);return Z?jsxRuntime.jsx(Pt,{data:Z,isStreaming:F,onAction:g},`viz-${k.id}`):null})}):F&&o?jsxRuntime.jsx(Xe,{content:e.textContent,isStreaming:true,baselineFontSize:N,className:R?"prose-invert":""}):o?jsxRuntime.jsx(ne,{baselineFontSize:N,className:R?"prose-invert":"",children:e.textContent}):jsxRuntime.jsx("p",{className:"whitespace-pre-wrap",children:e.textContent}):null,S=react.useRef(F);F&&(S.current=true);let V=!F&&!S.current;return jsxRuntime.jsx(chunk3SEVU272_cjs.c,{ref:U,message:e,viewerRole:a,className:i("w-full",V&&"animate-message-in",r),children:jsxRuntime.jsxs("div",{className:i("flex flex-col gap-1 w-full"),"data-is-viewer":R,children:[Ve&&jsxRuntime.jsxs("div",{className:i("flex items-start gap-2 w-full"),children:[t&&!R&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:jsxRuntime.jsx(Be,{name:e.participant?.name,src:e.participant?.avatarUrl,role:e.participant?.role,className:"w-10 h-10 flex-shrink-0"})}),jsxRuntime.jsx("div",{className:"px-4 py-3",children:jsxRuntime.jsx(Ke,{size:"small"})})]}),ke&&C&&jsxRuntime.jsx("div",{className:"w-full max-w-[80%]",children:jsxRuntime.jsx(Ht,{isStreaming:F,chunks:G,plan:l,executionTimeline:c,userMessageTimestamp:e.createdAt?new Date((typeof e.createdAt=="string",e.createdAt)).getTime()/1e3:void 0,executionTime:T,expanded:x,onExpandedChange:y})}),e.textContent&&jsxRuntime.jsxs("div",{className:i("group flex items-start gap-2 w-full",R?"flex-row-reverse":"flex-row"),children:[t&&!R&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:jsxRuntime.jsx(Be,{name:e.participant?.name,src:e.participant?.avatarUrl,role:e.participant?.role,className:"w-10 h-10 flex-shrink-0"})}),jsxRuntime.jsxs("div",{className:i("max-w-[85%]","flex flex-col"),"data-message-role":R?"viewer":"other",children:[jsxRuntime.jsxs("div",{className:i("rounded-2xl",R||t?"px-4 py-3":""),style:{backgroundColor:R?"var(--chat-user-message-bg)":"transparent",color:R?"var(--chat-user-message-text, #ffffff)":"var(--chat-text)"},children:[jsxRuntime.jsx(chunk3SEVU272_cjs.d,{children:w()}),v&&v.length>0&&jsxRuntime.jsx("div",{className:"mt-2 pt-2 border-t border-[var(--chat-border)]",children:jsxRuntime.jsx(It,{sources:v})})]}),Ue&&jsxRuntime.jsx("div",{className:"mt-2",children:jsxRuntime.jsx($t,{attachments:Ee})}),!F&&(n&&e.createdAt||C&&e.textContent)&&jsxRuntime.jsxs("div",{className:i("flex items-center gap-2 mt-1",R&&"flex-row-reverse"),children:[n&&e.createdAt&&jsxRuntime.jsx(ai,{createdAt:typeof e.createdAt=="string"?e.createdAt:e.createdAt.toISOString(),isViewer:R}),C&&e.textContent&&jsxRuntime.jsx(Ft,{textContent:e.textContent})]})]})]}),e.error&&jsxRuntime.jsxs("div",{className:i("flex items-start gap-2 w-full max-w-[85%]","rounded-lg border px-3 py-2 mt-1"),style:{borderColor:"var(--chat-error, #B1001B)",backgroundColor:"color-mix(in srgb, var(--chat-error, #B1001B) 6%, transparent)",color:"var(--chat-error, #B1001B)"},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"flex-shrink-0 mt-0.5",children:[jsxRuntime.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{className:"text-sm",children:e.error.message})]}),!e.textContent&&t&&!R&&ke&&!Ve&&jsxRuntime.jsx("div",{className:"flex items-start gap-2 w-full",children:jsxRuntime.jsx("div",{className:"flex-shrink-0",children:jsxRuntime.jsx(Be,{name:e.participant?.name,src:e.participant?.avatarUrl,role:e.participant?.role,className:"w-10 h-10 flex-shrink-0"})})}),I&&!F&&_&&jsxRuntime.jsx("div",{className:"w-full max-w-[80%]",children:jsxRuntime.jsx(Vt,{clarification:I,onSubmit:_})}),p&&p.length>0&&!F&&jsxRuntime.jsx("div",{className:"w-full max-w-[80%]",children:jsxRuntime.jsx(gt,{actions:p,onSelect:b})})]})})});Ka.displayName="Message";function ai({createdAt:e}){return jsxRuntime.jsx("span",{className:"text-xs text-[var(--chat-text-subtle)]",children:(r=>{try{return new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return ""}})(e)})}var qa=[markdown.BOLD_STAR,markdown.ITALIC_UNDERSCORE,markdown.QUOTE,markdown.ORDERED_LIST,markdown.UNORDERED_LIST],_i={ltr:"ltr",rtl:"rtl",placeholder:"editor-placeholder",paragraph:"editor-paragraph",quote:"editor-quote",text:{}},Ii=100*1024*1024,Vi=["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/svg+xml","image/bmp"],Fi=["application/pdf","text/plain","text/csv","text/markdown","application/json","text/json","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],Bi=["video/mp4","video/webm","video/ogg","video/avi","video/mov","video/wmv","video/flv","video/mkv"],$i=[...Vi,...Fi,...Bi];function Ga(e){if(e===0)return "0 Bytes";let a=1024,r=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(a));return parseFloat((e/Math.pow(a,t)).toFixed(2))+" "+r[t]}function Oi(e,a,r){return e.size>r?`File size (${Ga(e.size)}) exceeds max (${Ga(r)})`:a.includes(e.type)?null:`File type ${e.type||"unknown"} is not allowed`}function Wi({attachments:e,onRemove:a,disabled:r}){return e.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3 pb-0",children:e.map(t=>{let n=t.file.type.startsWith("image/"),o=t.status==="error",s=t.status==="uploading";return jsxRuntime.jsxs("div",{className:i("relative flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs max-w-[200px]",o?"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-zinc-300"),children:[s?jsxRuntime.jsx(lucideReact.Loader2,{size:14,className:"flex-shrink-0 animate-spin"}):o?jsxRuntime.jsx(lucideReact.AlertCircle,{size:14,className:"flex-shrink-0"}):n&&t.previewUrl?jsxRuntime.jsx("img",{src:t.previewUrl,alt:t.file.name,className:"w-5 h-5 rounded object-cover"}):n?jsxRuntime.jsx(lucideReact.Image,{size:14,className:"flex-shrink-0"}):jsxRuntime.jsx(lucideReact.FileText,{size:14,className:"flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",title:o?t.error:t.file.name,children:o?t.error:t.file.name}),!r&&jsxRuntime.jsx("button",{type:"button",onClick:()=>a(t.id),className:"flex-shrink-0 ml-0.5 p-0.5 rounded-full hover:bg-gray-200 dark:hover:bg-zinc-600 transition-colors",children:jsxRuntime.jsx(lucideReact.X,{size:12})})]},t.id)})})}function ji({onSubmit:e,disabled:a}){let[r]=LexicalComposerContext.useLexicalComposerContext();return react.useEffect(()=>r.registerCommand(lexical.KEY_ENTER_COMMAND,t=>!t||t.shiftKey?false:(t.preventDefault(),a||e(),true),lexical.COMMAND_PRIORITY_HIGH),[r,e,a]),null}function Hi({clearRef:e}){let[a]=LexicalComposerContext.useLexicalComposerContext();return react.useEffect(()=>{e.current=()=>{a.update(()=>{let r=lexical.$getRoot();r.clear(),r.append(lexical.$createParagraphNode());});};},[a,e]),null}var Za=react.forwardRef(({onSubmit:e,onAttach:a,onUploadFile:r,onRemoveUploadedAttachment:t,disabled:n=false,supportsAttachments:o=true,allowedFileTypes:s=$i,maxFileSize:l=Ii,placeholder:c="Type a message...",className:p,isSubmitting:b=false},x)=>{let[y,v]=react.useState(""),[f,N]=react.useState([]),[T,I]=react.useState(false),_=react.useRef(null),U=react.useRef(null),E=react.useRef(0),g=n||b,h=f.some(m=>m.status==="uploading"),u=f.filter(m=>m.status==="uploaded"&&m.attachmentId).map(m=>m.attachmentId),R=u.length>0||f.some(m=>m.status==="pending"),C=y.trim().length>0||R,F=react.useCallback(m=>{m.read(()=>{let S=markdown.$convertToMarkdownString(qa).replace(/\n\s*\n\s*\n+/g,`
|
|
19
|
-
|
|
20
|
-
`).replace(/(?<!\n)\n(?!\n)/g,`
|
|
21
|
-
`);v(S);});},[]),G=react.useCallback(async m=>{let w=m.map(S=>{let V=Oi(S,s,l),k={id:`${Date.now()}-${Math.random().toString(36).slice(2,9)}`,file:S,status:V?"error":r?"uploading":"pending",error:V||void 0};return !V&&S.type.startsWith("image/")&&(k.previewUrl=URL.createObjectURL(S)),k});if(N(S=>[...S,...w]),a?.(m),r){for(let S of w)if(S.status==="uploading")try{let V=await r(S.file);N(k=>k.map(z=>z.id===S.id?{...z,status:"uploaded",attachmentId:V}:z));}catch(V){N(k=>k.map(z=>z.id===S.id?{...z,status:"error",error:V instanceof Error?V.message:"Upload failed"}:z));}}},[s,l,r,a]),ve=react.useCallback(async()=>{if(!C||g||h)return;let m=y,w=f.filter(V=>V.status!=="error").map(V=>V.file),S=f;U.current?.(),v(""),N([]);try{r&&u.length>0?await e(m,void 0,u):await e(m,w.length>0?w:void 0);}catch{v(m),N(S);}},[y,f,C,g,h,e,r,u]),we=react.useCallback(m=>{let w=m.target.files;!w||w.length===0||(G(Array.from(w)),m.target.value="");},[G]),ke=react.useCallback(m=>{N(w=>{let S=w.find(V=>V.id===m);return S?.previewUrl&&URL.revokeObjectURL(S.previewUrl),S?.attachmentId&&t&&t(S.attachmentId),w.filter(V=>V.id!==m)});},[t]),Ve=react.useCallback(m=>{m.preventDefault(),m.stopPropagation(),!(!o||b)&&(E.current++,m.dataTransfer.types.includes("Files")&&I(true));},[o,b]),Ee=react.useCallback(m=>{m.preventDefault(),m.stopPropagation(),E.current--,E.current===0&&I(false);},[]),Ue=react.useCallback(m=>{m.preventDefault(),m.stopPropagation();},[]),de=react.useCallback(m=>{if(m.preventDefault(),m.stopPropagation(),E.current=0,I(false),!o||b)return;let w=Array.from(m.dataTransfer.files);w.length>0&&G(w);},[o,b,G]);react.useEffect(()=>()=>{f.forEach(m=>{m.previewUrl&&URL.revokeObjectURL(m.previewUrl);});},[]);let Fe={namespace:"ChatComposer",theme:_i,onError(m){console.error("[ChatComposer]",m);},editorState(){return markdown.$convertFromMarkdownString("",qa)},nodes:[list.ListItemNode,list.ListNode,link.AutoLinkNode,richText.QuoteNode],editable:!b};return jsxRuntime.jsx("div",{ref:x,className:i("flex-shrink-0 px-3 pt-2 pb-3","border-t border-gray-200 dark:border-zinc-700","bg-white/95 dark:bg-zinc-900/95 backdrop-blur-sm",p),onDragEnter:Ve,onDragLeave:Ee,onDragOver:Ue,onDrop:de,children:jsxRuntime.jsxs("div",{className:i("mx-auto max-w-[900px]","rounded-xl","bg-white dark:bg-zinc-800","border border-gray-200 dark:border-zinc-700","shadow-sm","transition-all duration-200","focus-within:shadow-md focus-within:border-gray-300 dark:focus-within:border-zinc-600",T&&"ring-2 ring-blue-400 border-blue-400"),children:[T&&jsxRuntime.jsx("div",{className:"px-3 pt-3 pb-0",children:jsxRuntime.jsx("div",{className:"flex items-center justify-center py-4 rounded-lg border-2 border-dashed border-blue-300 bg-blue-50 dark:bg-blue-900/20 text-blue-500 text-sm",children:"Drop files here"})}),jsxRuntime.jsx(Wi,{attachments:f,onRemove:ke,disabled:b}),jsxRuntime.jsxs("div",{className:i("flex items-center gap-2 p-3",f.length>0&&"pt-1.5"),children:[o&&jsxRuntime.jsx("button",{type:"button",onClick:()=>_.current?.click(),disabled:b,className:i("flex-shrink-0","w-8 h-8 rounded-lg","flex items-center justify-center","border border-gray-200 dark:border-zinc-600","text-gray-500 dark:text-zinc-400","hover:bg-gray-50 dark:hover:bg-zinc-700","disabled:opacity-40 disabled:cursor-not-allowed","transition-colors"),children:jsxRuntime.jsx(lucideReact.Paperclip,{size:16})}),jsxRuntime.jsx("div",{className:"flex-1 min-w-0",children:jsxRuntime.jsx(LexicalComposer.LexicalComposer,{initialConfig:Fe,children:jsxRuntime.jsxs("div",{className:"relative px-1 text-sm",children:[jsxRuntime.jsx(LexicalRichTextPlugin.RichTextPlugin,{contentEditable:jsxRuntime.jsx(LexicalContentEditable.ContentEditable,{className:i("outline-none resize-none","min-h-[24px] max-h-[200px] overflow-y-auto","text-gray-900 dark:text-zinc-100","[&_.editor-paragraph]:my-0","[&_.editor-quote]:ml-0 [&_.editor-quote]:pl-3 [&_.editor-quote]:border-l-4 [&_.editor-quote]:border-gray-300","[&_ul]:pl-4 [&_ol]:pl-4")}),placeholder:jsxRuntime.jsx("span",{className:"absolute top-0 left-1 text-gray-400 dark:text-zinc-500 pointer-events-none select-none",children:c}),ErrorBoundary:LexicalErrorBoundary.LexicalErrorBoundary}),jsxRuntime.jsx(LexicalOnChangePlugin.OnChangePlugin,{onChange:F}),jsxRuntime.jsx(LexicalListPlugin.ListPlugin,{}),jsxRuntime.jsx(LexicalHistoryPlugin.HistoryPlugin,{}),jsxRuntime.jsx(LexicalAutoFocusPlugin.AutoFocusPlugin,{defaultSelection:"rootStart"}),jsxRuntime.jsx(ji,{onSubmit:ve,disabled:g||h}),jsxRuntime.jsx(Hi,{clearRef:U})]})})}),jsxRuntime.jsx("button",{type:"button",onClick:ve,disabled:!C||g||h,className:i("flex-shrink-0","w-9 h-9 rounded-lg","flex items-center justify-center","bg-blue-500 text-white","shadow-sm","hover:bg-blue-600 hover:shadow-md hover:-translate-y-px","active:translate-y-0 active:shadow-sm","disabled:bg-gray-300 dark:disabled:bg-zinc-600 disabled:shadow-none disabled:translate-y-0 disabled:cursor-not-allowed","transition-all duration-200"),children:b||h?jsxRuntime.jsx(lucideReact.Loader2,{size:16,className:"animate-spin"}):jsxRuntime.jsx(lucideReact.ArrowUp,{size:16})})]}),o&&jsxRuntime.jsx("input",{ref:_,type:"file",multiple:true,accept:s.join(","),onChange:we,className:"hidden"})]})})});Za.displayName="MessageComposer";function oa({isAtBottom:e,onScrollToBottom:a,className:r}){return jsxRuntime.jsx("button",{type:"button",onClick:a,"aria-label":"Scroll to bottom",className:i("absolute bottom-4 left-1/2 -translate-x-1/2 z-10","flex items-center justify-center","w-8 h-8 rounded-full","bg-[var(--chat-bg,#ffffff)] border border-[var(--chat-border)]","shadow-subtle hover:shadow-button-hover","text-[var(--chat-text-subtle)] hover:text-[var(--chat-text)]","transition-all duration-200",e?"opacity-0 pointer-events-none translate-y-2":"opacity-100 translate-y-0",r),children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 5v14"}),jsxRuntime.jsx("path",{d:"m19 12-7 7-7-7"})]})})}var Qa=react.forwardRef(({children:e,autoScroll:a=true,showScrollToBottom:r=true,className:t},n)=>{let{containerRef:o,scrollToBottom:s,isAtBottom:l}=chunkTOYU46SZ_cjs.a({enabled:a});return jsxRuntime.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[jsxRuntime.jsx("div",{ref:p=>{o.current=p,typeof n=="function"?n(p):n&&(n.current=p);},className:i("h-full overflow-y-auto","flex flex-col gap-4 p-4","chat-scrollbar",t),children:e}),r&&jsxRuntime.jsx(oa,{isAtBottom:l,onScrollToBottom:()=>s("smooth")})]})});Qa.displayName="MessageList";function Gi({label:e,className:a}){return jsxRuntime.jsxs("div",{className:`flex items-center gap-3 py-6 select-none ${a??""}`,role:"separator",children:[jsxRuntime.jsx("div",{className:"flex-1 h-px bg-[var(--chat-border)]"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-[var(--chat-text-subtle)] whitespace-nowrap",children:e}),jsxRuntime.jsx("div",{className:"flex-1 h-px bg-[var(--chat-border)]"})]})}var tr=react.forwardRef(({className:e},a)=>jsxRuntime.jsx(chunk3SEVU272_cjs.r,{ref:a,className:i("inline-flex items-center gap-1","px-4 py-3",e),children:jsxRuntime.jsx(Ke,{size:"small"})}));tr.displayName="TypingIndicator";function tl({title:e,subtitle:a,logo:r,actions:t,showClose:n,onClose:o,loading:s,className:l,style:c}){let[p,b]=react.useState(false),x=react.useRef(null),y=react.useRef(null);return react.useEffect(()=>{let v=f=>{let N=f.composedPath();x.current&&!N.includes(x.current)&&y.current&&!N.includes(y.current)&&b(false);};if(p)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[p]),jsxRuntime.jsxs("header",{className:i("flex items-center justify-between gap-3","px-4 py-3","border-b border-[var(--chat-border)]","bg-[var(--chat-header-bg,#ffffff)]",l),style:c,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:typeof r=="string"?jsxRuntime.jsx("img",{src:r,alt:"",className:"w-10 h-10 rounded-lg object-contain"}):r}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[s?jsxRuntime.jsx("div",{className:"h-5 w-24 bg-gray-200 rounded animate-pulse"}):jsxRuntime.jsx("h1",{className:"text-lg font-semibold text-[var(--chat-text)] truncate",children:e}),a&&jsxRuntime.jsx("p",{className:"text-sm text-[var(--chat-text-subtle)] truncate",children:a})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t&&t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>b(!p),className:i("p-2 rounded-lg","text-[var(--chat-text-subtle)]","hover:bg-[var(--chat-panel-bg)] hover:text-[var(--chat-text)]","transition-colors duration-200"),"aria-label":"Menu","aria-expanded":p,children:jsxRuntime.jsx(lucideReact.MoreVertical,{size:18})}),p&&jsxRuntime.jsx("div",{ref:x,className:i("absolute right-0 top-full mt-1 z-50","min-w-[180px]","bg-white rounded-lg shadow-lg","border border-[var(--chat-border)]","py-1","animate-fade-in"),children:t.map(v=>jsxRuntime.jsxs("button",{onClick:()=>{v.onClick(),b(false);},disabled:v.disabled,className:i("w-full flex items-center gap-2 px-3 py-2","text-sm text-left","text-[var(--chat-text)]","hover:bg-[var(--chat-panel-bg)]","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors duration-150"),children:[v.icon&&jsxRuntime.jsx("span",{className:"flex-shrink-0 text-[var(--chat-text-subtle)]",children:v.icon}),v.label]},v.id))})]}),n&&o&&jsxRuntime.jsx("button",{onClick:o,className:i("p-2 rounded-lg","text-[var(--chat-text-subtle)]","hover:bg-[var(--chat-panel-bg)] hover:text-[var(--chat-text)]","transition-colors duration-200"),"aria-label":"Close",children:jsxRuntime.jsx(lucideReact.X,{size:18})})]})]})}function al({toolName:e,status:a,description:r,className:t}){return jsxRuntime.jsxs("div",{className:i("relative flex items-center gap-2 py-1 px-2 rounded-md text-sm overflow-hidden",a==="running"&&"animate-shimmer",t),children:[jsxRuntime.jsx(rl,{status:a}),jsxRuntime.jsx("span",{className:"font-medium text-[var(--chat-text)]",children:e}),r&&jsxRuntime.jsx("span",{className:"text-[var(--chat-text-subtle)] truncate",children:r})]})}function rl({status:e}){switch(e){case "running":return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-spin text-[var(--chat-primary)]",children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})});case "complete":return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-[var(--chat-secondary,#56C18A)]",children:[jsxRuntime.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),jsxRuntime.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]});case "failed":return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-[var(--chat-error,#B1001B)]",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]});case "pending":return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-[var(--chat-text-subtle)]",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]})}}var nr=react.forwardRef(({isEmpty:e,header:a,welcomeScreen:r,messageList:t,composer:n,footer:o,className:s},l)=>jsxRuntime.jsx("div",{ref:l,className:i("relative h-full overflow-hidden flex flex-col min-h-0",s),children:jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:e&&r?jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[a,r]},"welcome"):jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[a,jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},className:"flex-1 overflow-hidden flex flex-col min-h-0",children:t}),o,jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.2},children:n})]},"active")})}));nr.displayName="ChatLayout";function pl(e,a=3e3){let[r,t]=react.useState(0),n=react.useRef(null);return react.useEffect(()=>{if(e.length<=1)return;let o=()=>{n.current=setInterval(()=>{t(l=>(l+1)%e.length);},a);},s=()=>{document.visibilityState!=="visible"?n.current&&(clearInterval(n.current),n.current=null):o();};return o(),document.addEventListener("visibilitychange",s),()=>{n.current&&clearInterval(n.current),document.removeEventListener("visibilitychange",s);}},[e,a]),e[r]??""}function dl({placeholder:e,onSubmit:a,disabled:r,supportsAttachments:t}){let[n,o]=react.useState(""),[s,l]=react.useState([]),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{c.current&&(c.current.style.height="auto",c.current.style.height=c.current.scrollHeight+"px");},[n]);let b=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),x());},x=()=>{!n.trim()&&s.length===0||r||(a(n.trim(),s.length>0?s:void 0),o(""),l([]));},y=f=>{f.target.files&&l(N=>[...N,...Array.from(f.target.files)]),f.target.value="";},v=f=>{l(N=>N.filter((T,I)=>I!==f));};return jsxRuntime.jsxs("form",{className:i("w-full relative mx-auto","bg-white dark:bg-zinc-800","rounded-2xl overflow-hidden","shadow-[0_8px_30px_rgba(0,0,0,0.08)]","border border-gray-100 dark:border-zinc-700/50","transition duration-200","focus-within:shadow-[0_8px_30px_rgba(0,0,0,0.12)] focus-within:border-gray-200 dark:focus-within:border-zinc-600"),onSubmit:f=>{f.preventDefault(),x();},children:[s.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 px-4 pt-3",children:s.map((f,N)=>jsxRuntime.jsxs("div",{className:i("flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs","bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-zinc-300"),children:[jsxRuntime.jsx("span",{className:"max-w-[120px] truncate",children:f.name}),jsxRuntime.jsx("button",{type:"button",onClick:()=>v(N),className:"flex-shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-zinc-200",children:jsxRuntime.jsx(lucideReact.X,{size:12})})]},`${f.name}-${N}`))}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[t&&jsxRuntime.jsx("button",{type:"button",onClick:()=>p.current?.click(),disabled:r,className:i("ml-3 flex-shrink-0","w-8 h-8 rounded-lg","flex items-center justify-center","text-gray-400 dark:text-zinc-500","hover:bg-gray-100 dark:hover:bg-zinc-700","hover:text-gray-600 dark:hover:text-zinc-300","disabled:opacity-40 disabled:cursor-not-allowed","transition-colors"),children:jsxRuntime.jsx(lucideReact.Paperclip,{size:16})}),jsxRuntime.jsx("textarea",{ref:c,value:n,onChange:f=>o(f.target.value),onKeyDown:b,disabled:r,rows:1,placeholder:e,className:i("flex-1 text-sm sm:text-base","border-none bg-transparent","text-gray-900 dark:text-white","focus:outline-none focus:ring-0 resize-none","py-4 sm:py-5",t?"pl-1":"pl-4 sm:pl-6","placeholder:text-gray-400 dark:placeholder:text-zinc-500","disabled:opacity-50 disabled:cursor-not-allowed","max-h-[200px] overflow-y-auto")}),jsxRuntime.jsx("button",{type:"submit",disabled:!n.trim()&&s.length===0||!!r,className:i("mr-3 flex-shrink-0","w-9 h-9 rounded-lg","flex items-center justify-center","bg-gray-900 dark:bg-zinc-600 text-white dark:text-zinc-100","shadow-sm","hover:bg-gray-700 dark:hover:bg-zinc-500","hover:shadow-md hover:-translate-y-px","active:translate-y-0 active:shadow-sm","disabled:bg-gray-300 dark:disabled:bg-zinc-700","disabled:text-gray-500 dark:disabled:text-zinc-400","disabled:shadow-none disabled:translate-y-0 disabled:cursor-not-allowed","transition-all duration-200"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]}),t&&jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:y,className:"hidden"})]})}function ml({text:e,onClick:a,index:r}){let t=react.useRef(null),n=react.useRef(typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:false),[o,s]=react.useState(null),l=react.useCallback(p=>{if(n.current)return;let b=p.currentTarget.getBoundingClientRect();s({x:p.clientX-b.left,y:p.clientY-b.top});},[]),c=react.useCallback(()=>{s(null);},[]);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2+r*.1,duration:.4},children:jsxRuntime.jsxs("button",{ref:t,type:"button",onClick:a,onMouseMove:l,onMouseLeave:c,className:i("relative overflow-hidden","w-full text-left","p-3","cursor-pointer","border border-gray-200 dark:border-zinc-700","rounded-lg","transition-all duration-200 ease-out","bg-white dark:bg-zinc-800","hover:border-gray-300 dark:hover:border-zinc-600","hover:bg-gray-50 dark:hover:bg-zinc-750","hover:shadow-sm","active:bg-gray-100 dark:active:bg-zinc-700"),children:[o&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 z-0",style:{background:`radial-gradient(120px circle at ${o.x}px ${o.y}px, var(--chat-halo-primary, rgba(16,105,151,0.06)), transparent)`}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex items-start gap-2.5",children:[jsxRuntime.jsx(lucideReact.MessageCircleQuestion,{size:16,strokeWidth:2,className:"mt-0.5 text-gray-400 dark:text-zinc-500 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm text-gray-600 dark:text-zinc-300 leading-relaxed flex-1",children:e})]})]})})}var sr=react.forwardRef(({placeholders:e=[],suggestions:a=[],onSubmit:r,onSuggestionClick:t,welcomeText:n="How can I help you today?",supportsAttachments:o,composerSlot:s,className:l},c)=>{let p=pl(e),b=react.useCallback(x=>{t?.(x);},[t]);return jsxRuntime.jsxs("div",{ref:c,className:i("relative overflow-hidden","flex-1 flex items-center justify-center","px-4 sm:px-6",l),children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 animate-welcome-halo",style:{background:"radial-gradient(ellipse 60% 50% at 50% 45%, var(--chat-halo-primary, rgba(16,105,151,0.06)), var(--chat-halo-secondary, rgba(86,193,138,0.03)) 60%, transparent 100%)"}}),jsxRuntime.jsxs(framerMotion.motion.div,{layout:true,initial:{scale:.95,y:20,opacity:0},animate:{scale:1,y:0,opacity:1},transition:{type:"spring",stiffness:200,damping:25},className:"relative w-full max-w-[800px] flex flex-col items-center gap-8",children:[n&&jsxRuntime.jsx(framerMotion.motion.h2,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{delay:.1,duration:.4},className:"text-2xl font-semibold text-gray-800 dark:text-gray-300 text-center",children:n}),jsxRuntime.jsx("div",{className:i("w-full rounded-2xl","transition-shadow duration-500","shadow-[0_0_15px_rgba(16,105,151,0.08)]","focus-within:shadow-[0_0_20px_rgba(16,105,151,0.15),0_0_40px_rgba(86,193,138,0.08)]","dark:shadow-[0_0_15px_rgba(255,255,255,0.04)]","dark:focus-within:shadow-[0_0_20px_rgba(255,255,255,0.08),0_0_40px_rgba(255,255,255,0.03)]"),children:s??jsxRuntime.jsx(dl,{placeholder:p,onSubmit:(x,y)=>r?.(x,y),supportsAttachments:o})}),a.length>0&&jsxRuntime.jsx("div",{className:i("grid gap-3 w-full max-w-[900px]","grid-cols-1 sm:grid-cols-[repeat(auto-fit,minmax(250px,1fr))]"),children:a.map((x,y)=>jsxRuntime.jsx(ml,{text:x,onClick:()=>b(x),index:y},y))})]})]})});sr.displayName="WelcomeScreen";exports.$=nr;exports.A=Ht;exports.B=Xe;exports.C=gt;exports.D=ht;exports.E=yt;exports.F=vt;exports.G=kt;exports.H=Nt;exports.I=Ct;exports.J=Pe;exports.K=zt;exports.L=$a;exports.M=Xt;exports.N=Yt;exports.O=Zt;exports.P=Jt;exports.Q=Qt;exports.R=ea;exports.S=Pt;exports.T=Ka;exports.U=Za;exports.V=oa;exports.W=Qa;exports.X=Gi;exports.Y=tr;exports.Z=tl;exports._=al;exports.a=i;exports.aa=sr;exports.b=ya;exports.c=Be;exports.d=wa;exports.e=Ke;exports.f=ne;exports.g=It;exports.h=Ca;exports.i=Hr;exports.j=Vt;exports.k=Ft;exports.l=$t;exports.m=rt;exports.n=Ae;exports.o=un;exports.p=Wt;exports.q=nt;exports.r=hn;exports.s=Ce;exports.t=st;exports.u=it;exports.v=lt;exports.w=ct;exports.x=pt;exports.y=dt;exports.z=mt;//# sourceMappingURL=chunk-QGRXQAWZ.cjs.map
|
|
22
|
-
//# sourceMappingURL=chunk-QGRXQAWZ.cjs.map
|