cortex-react-components 2.18.1 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3DZFESHK.mjs → chunk-2E7GRMZB.mjs} +1 -1
- package/dist/{chunk-7OMPPFGG.mjs → chunk-2WP44BWJ.mjs} +1 -1
- package/dist/{chunk-HDKHF3EA.mjs → chunk-4BKAUTKL.mjs} +1 -1
- package/dist/{chunk-GETYSIZV.mjs → chunk-4OROP5TC.mjs} +1 -1
- package/dist/{chunk-HHPTGV4F.mjs → chunk-4RET4JGB.mjs} +1 -1
- package/dist/{chunk-LHO4WFYP.mjs → chunk-5FWH5YVM.mjs} +1 -1
- package/dist/{chunk-2GM2LPLB.mjs → chunk-5GV4XVLP.mjs} +1 -1
- package/dist/{chunk-HGL6JHJQ.mjs → chunk-5PZT7ZV2.mjs} +1 -1
- package/dist/{chunk-5KO67YNF.mjs → chunk-5RKIC5BC.mjs} +1 -1
- package/dist/{chunk-R6AYIVIR.mjs → chunk-64ODZI5O.mjs} +1 -1
- package/dist/{chunk-F64CA5CH.mjs → chunk-7CY3QPBJ.mjs} +1 -1
- package/dist/{chunk-2OOJ4ZFB.mjs → chunk-DAAAZF3S.mjs} +1 -1
- package/dist/{chunk-U3FYDDE2.mjs → chunk-DEO6EQJR.mjs} +1 -1
- package/dist/{chunk-3ANJOET7.mjs → chunk-DOPDVMNN.mjs} +1 -1
- package/dist/chunk-ENBMBLW4.mjs +4 -0
- package/dist/{chunk-WYLCN44C.mjs → chunk-GBKD2LF4.mjs} +1 -1
- package/dist/{chunk-FEWOSBUJ.mjs → chunk-GYLFNLRD.mjs} +1 -1
- package/dist/{chunk-QAJBJFRP.mjs → chunk-HNHUOQGZ.mjs} +1 -1
- package/dist/{chunk-FMV74RKL.mjs → chunk-HPTE7BNH.mjs} +1 -1
- package/dist/{chunk-75WE6ZXB.mjs → chunk-ITJH72Z2.mjs} +1 -1
- package/dist/{chunk-JYPPWTB3.mjs → chunk-JK2VAKPT.mjs} +1 -1
- package/dist/{chunk-5NIEZE7A.mjs → chunk-KBEXWUKI.mjs} +1 -1
- package/dist/{chunk-WUA65ZZB.mjs → chunk-L3BLBPSR.mjs} +1 -1
- package/dist/{chunk-4DR4ILAP.mjs → chunk-LYQOKIQY.mjs} +1 -1
- package/dist/{chunk-P7S6XFU4.mjs → chunk-MX3JKY3V.mjs} +1 -1
- package/dist/{chunk-P6OSMPUQ.mjs → chunk-N6J2WFC4.mjs} +1 -1
- package/dist/{chunk-PTJVI53B.mjs → chunk-NN4QIXZ2.mjs} +1 -1
- package/dist/{chunk-KVLUT4U2.mjs → chunk-O2RJFVGE.mjs} +1 -1
- package/dist/{chunk-ZFUP5NVF.mjs → chunk-O5P35LEY.mjs} +1 -1
- package/dist/{chunk-O24GFE6Q.mjs → chunk-ONZ32NDG.mjs} +1 -1
- package/dist/{chunk-FYQBRCQM.mjs → chunk-PC2PZNJ6.mjs} +1 -1
- package/dist/{chunk-BQQ4V4PX.mjs → chunk-QUOSFCS5.mjs} +1 -1
- package/dist/{chunk-PTZT4QJW.mjs → chunk-RZM6JZBZ.mjs} +1 -1
- package/dist/{chunk-HKMNAXLM.mjs → chunk-SJON62H2.mjs} +1 -1
- package/dist/{chunk-IG36QUEI.mjs → chunk-SWEGT5SP.mjs} +1 -1
- package/dist/{chunk-SRUG246N.mjs → chunk-TXVA6XJT.mjs} +1 -1
- package/dist/{chunk-4SRUEQTP.mjs → chunk-WC7IAORY.mjs} +1 -1
- package/dist/{chunk-AQQCH7Z2.mjs → chunk-XX4GSGRP.mjs} +1 -1
- package/dist/{chunk-GAZHKHGB.mjs → chunk-YTCTK24K.mjs} +1 -1
- package/dist/{chunk-PNUBVBSR.mjs → chunk-ZIZENXBP.mjs} +1 -1
- package/dist/{chunk-MO4HRQEL.mjs → chunk-ZKOJRF5P.mjs} +1 -1
- package/dist/components/Blocks/Banner.mjs +1 -1
- package/dist/components/Blocks/CallToAction.mjs +1 -1
- package/dist/components/Blocks/CollapsibleArea.mjs +1 -1
- package/dist/components/Blocks/Content.mjs +1 -1
- package/dist/components/Blocks/FeaturesBlock.mjs +1 -1
- package/dist/components/Blocks/RelatedPosts.mjs +1 -1
- package/dist/components/Blocks/RenderBlocks.mjs +1 -1
- package/dist/components/Blocks/ReusableContentBlock.mjs +1 -1
- package/dist/components/Blocks/index.mjs +1 -1
- package/dist/components/Cards/ContentCard.mjs +1 -1
- package/dist/components/Cards/FeatureCard.mjs +1 -1
- package/dist/components/Cards/index.mjs +1 -1
- package/dist/components/Chat/CopilotInterface.js +1 -1
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/demo-long-messages.js +1 -1
- package/dist/components/Chat/demo-long-messages.mjs +1 -1
- package/dist/components/Chat/demo-tests.js +1 -1
- package/dist/components/Chat/demo-tests.mjs +1 -1
- package/dist/components/Chat/demo.js +1 -1
- package/dist/components/Chat/demo.mjs +1 -1
- package/dist/components/Chat/example-usage.js +1 -1
- package/dist/components/Chat/example-usage.mjs +1 -1
- package/dist/components/Chat/example-with-vercel-ai.js +1 -1
- package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
- package/dist/components/Chat/index.js +1 -1
- package/dist/components/Chat/index.mjs +1 -1
- package/dist/components/DigitalColleagues/AppSidebarLeft.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/Views/index.mjs +1 -1
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/AppSidebarLeft.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +1 -1
- package/dist/components/Foundary/Knowledge/add-team-context.mjs +1 -1
- package/dist/components/Foundary/MainPage.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/RichText/index.mjs +1 -1
- package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +1 -1
- package/dist/components/Foundary/Views/KnowledgeView.mjs +1 -1
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/document-edit.mjs +1 -1
- package/dist/components/Foundary/document-preview-examples.mjs +1 -1
- package/dist/components/Foundary/document-preview.mjs +1 -1
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/Foundary/knowledge-browser.mjs +1 -1
- package/dist/components/HeaderFooter/Header.mjs +1 -1
- package/dist/components/HeaderFooter/HeaderDesktop.mjs +1 -1
- package/dist/components/HeaderFooter/SectionHeading.mjs +1 -1
- package/dist/components/HeaderFooter/VideoHeader.mjs +1 -1
- package/dist/components/HeaderFooter/index.mjs +1 -1
- package/dist/components/Heros/HighImpact/index.mjs +1 -1
- package/dist/components/Heros/LowImpact/index.mjs +1 -1
- package/dist/components/Heros/MediumImpact/index.mjs +1 -1
- package/dist/components/Heros/PostHero/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/SectionHero/index.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/Layouts/OutputHeaderFooter.mjs +1 -1
- package/dist/components/Layouts/Print.mjs +1 -1
- package/dist/components/Layouts/SlideShow.mjs +1 -1
- package/dist/components/Layouts/index.mjs +1 -1
- package/dist/components/Menus/SidebarLeft.mjs +1 -1
- package/dist/components/Menus/SidebarRight.mjs +1 -1
- package/dist/components/Menus/index.mjs +1 -1
- package/dist/components/Other/index.mjs +1 -1
- package/dist/components/Payload/RichText/index.mjs +1 -1
- package/dist/components/Payload/RichText/serialize.mjs +1 -1
- package/dist/components/Payload/index.mjs +1 -1
- package/dist/components/Projects/KanbanBoardView.mjs +1 -1
- package/dist/components/Projects/ProjectPage.mjs +1 -1
- package/dist/components/Projects/ProjectView.mjs +1 -1
- package/dist/components/Projects/index.mjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/ui/index.mjs +1 -1
- package/dist/components/ui/sidebar.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/Documentation.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/Intranet.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/AboutSection.mjs +1 -1
- package/dist/sections/BlogDetail.mjs +1 -1
- package/dist/sections/BlogList.mjs +1 -1
- package/dist/sections/BlogListSection.mjs +1 -1
- package/dist/sections/ContactSection.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/PricingSection.mjs +1 -1
- package/dist/sections/ServiceDetail.mjs +1 -1
- package/dist/sections/ServiceDetailSection.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/form/index.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-7JX3L2MA.mjs +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"../../chunk-
|
|
1
|
+
import{g as a}from"../../chunk-PC2PZNJ6.mjs";import"../../chunk-O5BAW5XQ.mjs";import"../../chunk-2QZUKVBA.mjs";import"../../chunk-TXVA6XJT.mjs";import"../../chunk-JYL3XIJX.mjs";import"../../chunk-4CU7D3X2.mjs";import"../../chunk-LVK4QE5D.mjs";import"../../chunk-NSMXJCXE.mjs";import"../../chunk-LKGCU7H6.mjs";import"../../chunk-5WV5ZFEP.mjs";import"../../chunk-KX2NCNCS.mjs";import"../../chunk-LEC6GEWS.mjs";import"../../chunk-UZSBX5GO.mjs";import"../../chunk-VNYUNZ3M.mjs";import"../../chunk-VRE6VCHX.mjs";import"../../chunk-KFCSVEI6.mjs";import"../../chunk-TEB67NCD.mjs";import"../../chunk-LXZAOORS.mjs";import"../../chunk-MGYV46AJ.mjs";import"../../chunk-CGDLOY7W.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-BG7QXNV5.mjs";import"../../chunk-BVFUCOCP.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-WISCWNL2.mjs";import"../../chunk-FVM5SQT2.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as FeatureCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a,h as i}from"../../chunk-
|
|
1
|
+
import{g as a,h as i}from"../../chunk-PC2PZNJ6.mjs";import"../../chunk-O5BAW5XQ.mjs";import"../../chunk-2QZUKVBA.mjs";import"../../chunk-TXVA6XJT.mjs";import"../../chunk-JYL3XIJX.mjs";import"../../chunk-4CU7D3X2.mjs";import"../../chunk-LVK4QE5D.mjs";import{a as f}from"../../chunk-NSMXJCXE.mjs";import{a as h}from"../../chunk-LKGCU7H6.mjs";import{a as e}from"../../chunk-5WV5ZFEP.mjs";import{a as g}from"../../chunk-KX2NCNCS.mjs";import{a as d}from"../../chunk-LEC6GEWS.mjs";import"../../chunk-UZSBX5GO.mjs";import"../../chunk-VNYUNZ3M.mjs";import"../../chunk-VRE6VCHX.mjs";import"../../chunk-KFCSVEI6.mjs";import"../../chunk-TEB67NCD.mjs";import"../../chunk-LXZAOORS.mjs";import"../../chunk-MGYV46AJ.mjs";import"../../chunk-CGDLOY7W.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-ZUA4KNIR.mjs";import{a as b}from"../../chunk-BG7QXNV5.mjs";import{a as c}from"../../chunk-BVFUCOCP.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-WISCWNL2.mjs";import"../../chunk-FVM5SQT2.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-YEKQJ4YC.mjs";export{i as ContentCard,b as CustomerCard,c as EventCard,a as FeatureCard,h as Hero,e as Image,g as PricingCard,d as ProjectCard,f as ServiceCard};
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
`,children:r?"Processing...":"Deny"}),(0,Bo.jsx)("button",{onClick:w,disabled:r,className:`
|
|
19
19
|
px-4 py-2 text-white border-none rounded text-sm
|
|
20
20
|
${r?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
|
|
21
|
-
`,children:"Cancel"})]})]}):null};var va=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=go.default.useState(!0),[i,r]=go.default.useState(null),s=()=>{o(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},c=()=>{o(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,Bo.jsxs)("div",{className:"mb-2",children:[(0,Bo.jsx)(ba,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Bo.jsxs)(Bo.Fragment,{children:[i==="approve"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var fo=require("@radix-ui/react-use-controllable-state");var nt=V(require("@radix-ui/react-collapsible")),zt=nt.Root,Ut=nt.CollapsibleTrigger,Ft=nt.CollapsibleContent;var ya=require("streamdown"),yt=(0,ct.memo)(({className:e,...t})=>(0,Bo.jsx)(ya.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);yt.displayName="Response";var wa=(0,ct.createContext)(null),ar=()=>{let e=(0,ct.useContext)(wa);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},ir=1e3,rr=1e3,bo=(0,ct.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,fo.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,fo.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,ct.useState)(!1),[A,T]=(0,ct.useState)(null);(0,ct.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/rr)),T(null))},[t,A,f]),(0,ct.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},ir);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Bo.jsx)(wa.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Bo.jsx)(zt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),nr=(e,t)=>e||t===0?(0,Bo.jsx)("Bo",{children:"Thinking..."}):t===void 0?(0,Bo.jsx)("Bo",{children:"Thought for a few seconds"}):(0,Bo.jsxs)("Bo",{children:["Thought for ",t," seconds"]}),vo=(0,ct.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=ar();return(0,Bo.jsx)(Ut,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(Oa.BrainIcon,{className:"size-4"}),nr(a,i),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),ho=(0,ct.memo)(({className:e,children:t,...o})=>(0,Bo.jsx)(Ft,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Bo.jsx)(yt,{className:"grid gap-2",children:t})}));bo.displayName="Reasoning";vo.displayName="ReasoningTrigger";ho.displayName="ReasoningContent";var yo=require("react-syntax-highlighter"),Ot=require("react-syntax-highlighter/dist/esm/styles/prism"),sr=(0,ct.createContext)({code:""}),Vt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Bo.jsx)(sr.Provider,{value:{code:e},children:(0,Bo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(yo.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneLight,children:e}),(0,Bo.jsx)(yo.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneDark,children:e}),n&&(0,Bo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Na=({className:e,...t})=>(0,Bo.jsx)(zt,{className:l("not-prose mb-4 w-full",e),...t}),lr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Bo.jsxs)(ae,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Bo.jsx)(Oa.CircleIcon,{className:"size-4"}),"input-available":(0,Bo.jsx)(Oa.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Bo.jsx)(Oa.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Bo.jsx)(Oa.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},ka=({className:e,type:t,state:o,...a})=>(0,Bo.jsxs)(Ut,{className:l("flex w-full items-center justify-between gap-4 Bo-3 pl-0 w-2xl",e),...a,children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(Oa.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Bo.jsx)("span",{className:"font-medium text-sm",children:t}),lr(o)]}),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Pa=({className:e,...t})=>(0,Bo.jsx)(Ft,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ta=({className:e,input:t,...o})=>(0,Bo.jsxs)("div",{className:l("space-y-2 overflow-hidden Bo-4",e),...o,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Bo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Da=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Bo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Bo.jsx)(Vt,{code:t,language:"json"})),(0,Bo.jsxs)("div",{className:l("space-y-2 Bo-4",e),...a,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Bo.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Bo.jsx)("div",{children:o}),n]})]})};var Aa=require("date-fns");function Ra({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,ct.useState)(null),[i,r]=(0,ct.useState)(!1),[s,c]=(0,ct.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let R=await y.json();n(R)}catch(y){console.error("Error fetching task:",y),c(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,ct.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:a,loading:i,error:s}}var cr=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},dr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Ma({data:e}){let{id:t,system:o,fetchLatest:a,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,c=i,m=a!==void 0?a:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:m,taskData:r,error:c}),m){let{task:R,loading:A,error:T}=Ra({taskId:t,system:o});r=R,s=A,c=T}else s=!1;let w=cr(r?.status||"todo"),f=dr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Aa.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Bo.jsxs)(Le,{className:"pb-2",children:[(0,Bo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Bo.jsx)(ae,{className:`${w}`,children:f})]}),r?.project&&(0,Bo.jsxs)(co,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Bo.jsx)(Pe,{className:"pb-2",children:s?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",y]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",t]})]})})]})}function La({artefact:e,taskId:t,taskData:o,loading:a=!1,error:n=null}){let i=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Aa.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:"w-full max-w-md shadow-md",children:[(0,Bo.jsx)(Le,{className:"pb-2",children:(0,Bo.jsx)("div",{className:"flex justify-between items-start",children:(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Bo.jsx)(Pe,{className:"pb-2",children:a?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:e})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",r]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var pr=e=>e.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):e.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Ea=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Bo.jsx)(yt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Bo.jsx)("div",{className:"mb-2 Bo-2 bg-background/50 rounded-lg",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[pr(r.mediaType||"application/octet-stream"),(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.Download,{className:"Bo-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Ma,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(La,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Bo.jsxs)("Bo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Bo.jsxs)("Bo",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(ge,{className:"w-full",children:(0,Bo.jsx)(Pe,{className:"Bo-4",children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 Bo-2 rounded-md bg-muted/50",children:[(0,Bo.jsx)(ae,{variant:"outline",children:c.type||"link"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.ExternalLink,{className:"Bo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:r.data?.title})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Bo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Bo.jsxs)("div",{className:"text-left",children:[(0,Bo.jsx)("Bo",{className:"font-medium",children:c.label}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,Bo.jsxs)(bo,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.at(-1)?.id,children:[(0,Bo.jsx)(vo,{}),(0,Bo.jsx)(ho,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,Bo.jsxs)(Na,{defaultOpen:n.state!=="output-available",children:[(0,Bo.jsx)(ka,{type:`tool-${n.toolName}`,state:n.state}),(0,Bo.jsxs)(Pa,{children:[(0,Bo.jsx)(Ta,{input:n.input}),(0,Bo.jsx)(Da,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,Bo.jsxs)(Bo.Fragment,{children:["Unknown part type: ",n.type]})});var Ua=({className:e,from:t,...o})=>(0,Bo.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),mr=(0,Io.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),Fa=({children:e,className:t,variant:o,...a})=>(0,Bo.jsx)("div",{className:l(mr({variant:o,className:t})),...a,children:e});function ja({messages:e,input:t,isTyping:o=!1,currentSessionTitle:a,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:c,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:R,onDragOver:A,className:T,status:C="ready"}){let N=(0,ct.useRef)(null),F=(0,ct.useRef)(null),S=(0,ct.useRef)(null),[M,_]=(0,ct.useState)(!1),[$,se]=(0,ct.useState)({path:[],selectedItems:[],filters:{}});(0,ct.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,ct.useEffect)(()=>{M&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[M]);let J=()=>po($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(ve=>{u.push({label:ve.label,action:()=>X(ve.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(ve=>{ve.type==="list"&&ve.data&&u.push({label:`View ${ve.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let ve=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},le=po({path:[],selectedItems:[],filters:{}}),I=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),A(!0)},d=u=>{u.preventDefault(),A(!1)},L=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let U=1024,ve=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+ve[Ae]},G=u=>u.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):u.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Bo.jsxs)("div",{className:`Bo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Bo.jsxs)(Ce,{ref:F,className:"flex-1 Bo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:L,children:[(0,Bo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Bo.jsx)(lt.animate,{children:e.map(u=>(0,Bo.jsx)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Bo.jsx)(Ua,{from:u.role,children:(0,Bo.jsx)(Fa,{variant:"flat",children:Ea({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),M&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsx)(ma,{capabilities:n,isOpen:M,onToggle:()=>_(!M),onActionSelect:X,className:"w-full"})})]}),o&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex space-x-1",children:[(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Bo.jsx)("div",{ref:N})]}),i.length>0&&(0,Bo.jsx)("div",{className:"Bo-4 border-t bg-muted/10",children:(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Bo-2 border",children:[G(u.file.type),(0,Bo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Bo-6 w-6 Bo-0",children:(0,Bo.jsx)(Oa.X,{className:"Bo-4 w-4"})})]},u.id))})}),(0,Bo.jsxs)("div",{className:"border rounded-2xl Bo-4 bg-muted/20",children:[(0,Bo.jsxs)("div",{className:"flex gap-3",children:[(0,Bo.jsx)(gt,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),s&&(0,Bo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Paperclip,{className:"Bo-4 w-4"})}),(0,Bo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Send,{className:"Bo-4 w-4"})})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Bo.jsxs)(D,{onClick:()=>_(!M),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Bo.jsx)(Oa.Menu,{className:"Bo-3 w-3 mr-1"}),M?"Hide":"Show"," Capabilities"]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Bo.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>X(u.id,$),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,U)=>(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,Bo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:I,className:"hidden"})]})]})}function ur({aiConfig:e,useCustomChat:t,enableAI:o=!0,messages:a=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:c=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=L=>console.log("Search query:",L),initialTeam:F="design",currentSession:S=null,showCapabilities:M=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:I=(0,Bo.jsx)(Oa.Users,{className:"mr-2 Bo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let L={...e,onError:j=>{G?.setMessages(de=>[...de,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:j.message}]}]),console.error("Error in CopilotInterface:",j)}},E=(0,Ha.useChat)(L||{}),G=o?t||E:null,[Z,be]=(0,ct.useState)(""),[u,U]=(0,ct.useState)(!1),ve=G?.messages||a,Ae=Z,Va=G?.status==="submitted"||u,Wa=G?.addToolResult?(j,de,oe)=>{G.addToolResult({tool:de,toolCallId:j,output:oe}),G.sendMessage()}:()=>{},dt=n||[],Ga={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[$a,qa]=(0,ct.useState)(()=>dt.length===0?Ga:dt.find(j=>j.id===F)||dt[0]),[pt,xt]=(0,ct.useState)([]),[Ka,_a]=(0,ct.useState)(!1),Ja=j=>{if(!j||!$)return;let de=[];Array.from(j).forEach(oe=>{if(oe.size>se*1024*1024){alert(`File ${oe.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(wt=>oe.type.match(wt))){alert(`File type ${oe.type} is not allowed.`);return}let wo={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:oe,status:"pending",progress:0};if(oe.type.startsWith("image/")){let wt=new FileReader;wt.onload=ei=>{xt(ti=>ti.map($t=>$t.id===wo.id?{...$t,preview:ei.target?.result}:$t))},wt.readAsDataURL(oe)}de.push(wo)}),xt(oe=>[...oe,...de])},Xa=j=>{xt(de=>de.filter(oe=>oe.id!==j))},xo=()=>{if(!(!Ae.trim()&&pt.length===0)){if(G){let j=pt.length>0?Qa(pt.map(de=>de.file)):void 0;G.sendMessage({text:Ae,files:j},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ae),console.log("Files to upload:",pt),be(""),U(!0),setTimeout(()=>{U(!1)},1500);xt([])}},Qa=j=>{let de=new DataTransfer;return j.forEach(oe=>de.items.add(oe)),de.files},Ya=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),xo())},Za=j=>{be(j)};return(0,Bo.jsx)(ca,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:dt,currentBusinessUnit:$a,onBusinessUnitChange:j=>{j&&(qa(j),R?.(j))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:I,actionText:Se,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:X,tagline:le,sidebarInitiallyClosed:d,children:(0,Bo.jsx)(Gt.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Gt.motion.div,{className:"flex-1 Bo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:"Bo-full flex",children:[(0,Bo.jsx)("div",{className:"w-80 flex-shrink-0 Bo-full Bo-2",children:(0,Bo.jsx)(da,{sessions:c||[],currentSession:S,teams:dt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Bo.jsx)("div",{className:"flex-1 Bo-full Bo-2",children:(0,Bo.jsx)(ja,{messages:ve||[],input:Ae,isTyping:Va,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:Za,addToolResult:Wa,onSendMessage:xo,onKeyPress:Ya,fileUploads:pt,isDragOver:Ka,enableFileUpload:$,onFileUpload:Ja,onRemoveFile:Xa,onDragOver:_a})})]})},"chat-interface")})})}0&&(module.exports={CopilotInterface});
|
|
21
|
+
`,children:"Cancel"})]})]}):null};var va=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=go.default.useState(!0),[i,r]=go.default.useState(null),s=()=>{o(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},c=()=>{o(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,Bo.jsxs)("div",{className:"mb-2",children:[(0,Bo.jsx)(ba,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Bo.jsxs)(Bo.Fragment,{children:[i==="approve"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var fo=require("@radix-ui/react-use-controllable-state");var nt=V(require("@radix-ui/react-collapsible")),zt=nt.Root,Ut=nt.CollapsibleTrigger,Ft=nt.CollapsibleContent;var ya=require("streamdown"),yt=(0,ct.memo)(({className:e,...t})=>(0,Bo.jsx)(ya.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);yt.displayName="Response";var wa=(0,ct.createContext)(null),ar=()=>{let e=(0,ct.useContext)(wa);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},ir=1e3,rr=1e3,bo=(0,ct.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,fo.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,fo.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,ct.useState)(!1),[A,T]=(0,ct.useState)(null);(0,ct.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/rr)),T(null))},[t,A,f]),(0,ct.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},ir);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Bo.jsx)(wa.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Bo.jsx)(zt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),nr=(e,t)=>e||t===0?(0,Bo.jsx)("Bo",{children:"Thinking..."}):t===void 0?(0,Bo.jsx)("Bo",{children:"Thought for a few seconds"}):(0,Bo.jsxs)("Bo",{children:["Thought for ",t," seconds"]}),vo=(0,ct.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=ar();return(0,Bo.jsx)(Ut,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(Oa.BrainIcon,{className:"size-4"}),nr(a,i),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),ho=(0,ct.memo)(({className:e,children:t,...o})=>(0,Bo.jsx)(Ft,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Bo.jsx)(yt,{className:"grid gap-2",children:t})}));bo.displayName="Reasoning";vo.displayName="ReasoningTrigger";ho.displayName="ReasoningContent";var yo=require("react-syntax-highlighter"),Ot=require("react-syntax-highlighter/dist/esm/styles/prism"),sr=(0,ct.createContext)({code:""}),Vt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Bo.jsx)(sr.Provider,{value:{code:e},children:(0,Bo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(yo.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneLight,children:e}),(0,Bo.jsx)(yo.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneDark,children:e}),n&&(0,Bo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Na=({className:e,...t})=>(0,Bo.jsx)(zt,{className:l("not-prose mb-4 w-full",e),...t}),lr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Bo.jsxs)(ae,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Bo.jsx)(Oa.CircleIcon,{className:"size-4"}),"input-available":(0,Bo.jsx)(Oa.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Bo.jsx)(Oa.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Bo.jsx)(Oa.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},ka=({className:e,type:t,state:o,...a})=>(0,Bo.jsxs)(Ut,{className:l("flex w-full items-center justify-between gap-4 Bo-3 pl-0 w-2xl",e),...a,children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(Oa.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Bo.jsx)("span",{className:"font-medium text-sm",children:t}),lr(o)]}),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Pa=({className:e,...t})=>(0,Bo.jsx)(Ft,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ta=({className:e,input:t,...o})=>(0,Bo.jsxs)("div",{className:l("space-y-2 overflow-hidden Bo-4",e),...o,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Bo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Da=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Bo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Bo.jsx)(Vt,{code:t,language:"json"})),(0,Bo.jsxs)("div",{className:l("space-y-2 Bo-4",e),...a,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Bo.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Bo.jsx)("div",{children:o}),n]})]})};var Aa=require("date-fns");function Ra({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,ct.useState)(null),[i,r]=(0,ct.useState)(!1),[s,c]=(0,ct.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let R=await y.json();n(R)}catch(y){console.error("Error fetching task:",y),c(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,ct.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:a,loading:i,error:s}}var cr=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},dr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Ma({data:e}){let{id:t,system:o,fetchLatest:a,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,c=i,m=a!==void 0?a:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:m,taskData:r,error:c}),m){let{task:R,loading:A,error:T}=Ra({taskId:t,system:o});r=R,s=A,c=T}else s=!1;let w=cr(r?.status||"todo"),f=dr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Aa.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Bo.jsxs)(Le,{className:"pb-2",children:[(0,Bo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Bo.jsx)(ae,{className:`${w}`,children:f})]}),r?.project&&(0,Bo.jsxs)(co,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Bo.jsx)(Pe,{className:"pb-2",children:s?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",y]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",t]})]})})]})}function La({artefact:e,taskId:t,taskData:o,loading:a=!1,error:n=null}){let i=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Aa.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:"w-full max-w-md shadow-md",children:[(0,Bo.jsx)(Le,{className:"pb-2",children:(0,Bo.jsx)("div",{className:"flex justify-between items-start",children:(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Bo.jsx)(Pe,{className:"pb-2",children:a?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:e})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",r]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var pr=e=>e.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):e.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Ea=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Bo.jsx)(yt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Bo.jsx)("div",{className:"mb-2 Bo-2 bg-background/50 rounded-lg",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[pr(r.mediaType||"application/octet-stream"),(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.Download,{className:"Bo-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Ma,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(La,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Bo.jsxs)("Bo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Bo.jsxs)("Bo",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(ge,{className:"w-full",children:(0,Bo.jsx)(Pe,{className:"Bo-4",children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 Bo-2 rounded-md bg-muted/50",children:[(0,Bo.jsx)(ae,{variant:"outline",children:c.type||"link"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.ExternalLink,{className:"Bo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:r.data?.title})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Bo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Bo.jsxs)("div",{className:"text-left",children:[(0,Bo.jsx)("Bo",{className:"font-medium",children:c.label}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,Bo.jsxs)(bo,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.at(-1)?.id,children:[(0,Bo.jsx)(vo,{}),(0,Bo.jsx)(ho,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,Bo.jsxs)(Na,{defaultOpen:n.state!=="output-available",children:[(0,Bo.jsx)(ka,{type:`tool-${n.toolName}`,state:n.state}),(0,Bo.jsxs)(Pa,{children:[(0,Bo.jsx)(Ta,{input:n.input}),(0,Bo.jsx)(Da,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,Bo.jsxs)(Bo.Fragment,{children:["Unknown part type: ",n.type]})});var Ua=({className:e,from:t,...o})=>(0,Bo.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),mr=(0,Io.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),Fa=({children:e,className:t,variant:o,...a})=>(0,Bo.jsx)("div",{className:l(mr({variant:o,className:t})),...a,children:e});function ja({messages:e,input:t,isTyping:o=!1,currentSessionTitle:a,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:c,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:R,onDragOver:A,className:T,status:C="ready"}){let N=(0,ct.useRef)(null),F=(0,ct.useRef)(null),S=(0,ct.useRef)(null),[M,_]=(0,ct.useState)(!1),[$,se]=(0,ct.useState)({path:[],selectedItems:[],filters:{}});(0,ct.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,ct.useEffect)(()=>{M&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[M]);let J=()=>po($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(ve=>{u.push({label:ve.label,action:()=>X(ve.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(ve=>{ve.type==="list"&&ve.data&&u.push({label:`View ${ve.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let ve=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},le=po({path:[],selectedItems:[],filters:{}}),I=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),A(!0)},d=u=>{u.preventDefault(),A(!1)},L=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let U=1024,ve=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+ve[Ae]},G=u=>u.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):u.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Bo.jsxs)("div",{className:`Bo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Bo.jsxs)(Ce,{ref:F,className:"flex-1 Bo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:L,children:[(0,Bo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Bo.jsx)(lt.animate,{children:e.map(u=>(0,Bo.jsx)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Bo.jsx)(Ua,{from:u.role,children:(0,Bo.jsx)(Fa,{variant:"flat",children:Ea({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),M&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsx)(ma,{capabilities:n,isOpen:M,onToggle:()=>_(!M),onActionSelect:X,className:"w-full"})})]}),o&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex space-x-1",children:[(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Bo.jsx)("div",{ref:N})]}),i.length>0&&(0,Bo.jsx)("div",{className:"Bo-4 border-t bg-muted/10",children:(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Bo-2 border",children:[G(u.file.type),(0,Bo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Bo-6 w-6 Bo-0",children:(0,Bo.jsx)(Oa.X,{className:"Bo-4 w-4"})})]},u.id))})}),(0,Bo.jsxs)("div",{className:"border rounded-2xl Bo-4 bg-muted/20",children:[(0,Bo.jsxs)("div",{className:"flex gap-3",children:[(0,Bo.jsx)(gt,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),s&&(0,Bo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Paperclip,{className:"Bo-4 w-4"})}),(0,Bo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Send,{className:"Bo-4 w-4"})})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Bo.jsxs)(D,{onClick:()=>_(!M),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Bo.jsx)(Oa.Menu,{className:"Bo-3 w-3 mr-1"}),M?"Hide":"Show"," Capabilities"]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Bo.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>X(u.id,$),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,U)=>(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,Bo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:I,className:"hidden"})]})]})}function ur({aiConfig:e,useCustomChat:t,enableAI:o=!0,messages:a=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:c=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=L=>console.log("Search query:",L),initialTeam:F="design",currentSession:S=null,showCapabilities:M=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:I=(0,Bo.jsx)(Oa.Users,{className:"mr-2 Bo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let L={...e,onError:j=>{G?.setMessages(de=>[...de,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:j.message}]}]),console.error("Error in CopilotInterface:",j)}},E=(0,Ha.useChat)(L||{}),G=o?t||E:null,[Z,be]=(0,ct.useState)(""),[u,U]=(0,ct.useState)(!1),ve=G?.messages||a,Ae=Z,Va=G?.status==="submitted"||u,Wa=G?.addToolResult?(j,de,oe)=>{G.addToolResult({tool:de,toolCallId:j,output:oe}),G.sendMessage()}:()=>{console.log("addToolResult not available")},dt=n||[],Ga={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[$a,qa]=(0,ct.useState)(()=>dt.length===0?Ga:dt.find(j=>j.id===F)||dt[0]),[pt,xt]=(0,ct.useState)([]),[Ka,_a]=(0,ct.useState)(!1),Ja=j=>{if(!j||!$)return;let de=[];Array.from(j).forEach(oe=>{if(oe.size>se*1024*1024){alert(`File ${oe.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(wt=>oe.type.match(wt))){alert(`File type ${oe.type} is not allowed.`);return}let wo={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:oe,status:"pending",progress:0};if(oe.type.startsWith("image/")){let wt=new FileReader;wt.onload=ei=>{xt(ti=>ti.map($t=>$t.id===wo.id?{...$t,preview:ei.target?.result}:$t))},wt.readAsDataURL(oe)}de.push(wo)}),xt(oe=>[...oe,...de])},Xa=j=>{xt(de=>de.filter(oe=>oe.id!==j))},xo=()=>{if(!(!Ae.trim()&&pt.length===0)){if(G){let j=pt.length>0?Qa(pt.map(de=>de.file)):void 0;G.sendMessage({text:Ae,files:j},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ae),console.log("Files to upload:",pt),be(""),U(!0),setTimeout(()=>{U(!1)},1500);xt([])}},Qa=j=>{let de=new DataTransfer;return j.forEach(oe=>de.items.add(oe)),de.files},Ya=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),xo())},Za=j=>{be(j)};return(0,Bo.jsx)(ca,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:dt,currentBusinessUnit:$a,onBusinessUnitChange:j=>{j&&(qa(j),R?.(j))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:I,actionText:Se,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:X,tagline:le,sidebarInitiallyClosed:d,children:(0,Bo.jsx)(Gt.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Gt.motion.div,{className:"flex-1 Bo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:"Bo-full flex",children:[(0,Bo.jsx)("div",{className:"w-80 flex-shrink-0 Bo-full Bo-2",children:(0,Bo.jsx)(da,{sessions:c||[],currentSession:S,teams:dt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Bo.jsx)("div",{className:"flex-1 Bo-full Bo-2",children:(0,Bo.jsx)(ja,{messages:ve||[],input:Ae,isTyping:Va,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:Za,addToolResult:Wa,onSendMessage:xo,onKeyPress:Ya,fileUploads:pt,isDragOver:Ka,enableFileUpload:$,onFileUpload:Ja,onRemoveFile:Xa,onDragOver:_a})})]})},"chat-interface")})})}0&&(module.exports={CopilotInterface});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";import{a}from"../../chunk-
|
|
2
|
+
"use strict";import{a}from"../../chunk-ENBMBLW4.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-DEVPAZSJ.mjs";import"../../chunk-QADUAIFH.mjs";import"../../chunk-EH3PJU6C.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import"../../chunk-Q2DPE66H.mjs";import"../../chunk-INCYANPB.mjs";import"../../chunk-RLVKIMGU.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-FLHDNCNY.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as CopilotInterface};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
`,children:r?"Processing...":"Deny"}),(0,Lo.jsx)("button",{onClick:w,disabled:r,className:`
|
|
19
19
|
px-4 py-2 text-white border-none rounded text-sm
|
|
20
20
|
${r?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
|
|
21
|
-
`,children:"Cancel"})]})]}):null};var ya=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=go.default.useState(!0),[i,r]=go.default.useState(null),s=()=>{o(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},c=()=>{o(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,Lo.jsxs)("div",{className:"mb-2",children:[(0,Lo.jsx)(ha,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Lo.jsxs)(Lo.Fragment,{children:[i==="approve"&&(0,Lo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Lo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Lo.jsx)("svg",{className:"Lo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Lo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Lo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Lo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Lo.jsx)("svg",{className:"Lo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Lo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Lo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var fo=require("@radix-ui/react-use-controllable-state");var nt=V(require("@radix-ui/react-collapsible")),zt=nt.Root,Ut=nt.CollapsibleTrigger,Ft=nt.CollapsibleContent;var wa=require("streamdown"),yt=(0,qa.memo)(({className:e,...t})=>(0,Lo.jsx)(wa.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);yt.displayName="Response";var Na=(0,qa.createContext)(null),lr=()=>{let e=(0,qa.useContext)(Na);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},cr=1e3,dr=1e3,bo=(0,qa.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,fo.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,fo.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,qa.useState)(!1),[A,T]=(0,qa.useState)(null);(0,qa.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/dr)),T(null))},[t,A,f]),(0,qa.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},cr);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Lo.jsx)(Na.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Lo.jsx)(zt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),pr=(e,t)=>e||t===0?(0,Lo.jsx)("Lo",{children:"Thinking..."}):t===void 0?(0,Lo.jsx)("Lo",{children:"Thought for a few seconds"}):(0,Lo.jsxs)("Lo",{children:["Thought for ",t," seconds"]}),vo=(0,qa.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=lr();return(0,Lo.jsx)(Ut,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Lo.jsxs)(Lo.Fragment,{children:[(0,Lo.jsx)(Wa.BrainIcon,{className:"size-4"}),pr(a,i),(0,Lo.jsx)(Wa.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),ho=(0,qa.memo)(({className:e,children:t,...o})=>(0,Lo.jsx)(Ft,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Lo.jsx)(yt,{className:"grid gap-2",children:t})}));bo.displayName="Reasoning";vo.displayName="ReasoningTrigger";ho.displayName="ReasoningContent";var yo=require("react-syntax-highlighter"),Ot=require("react-syntax-highlighter/dist/esm/styles/prism"),mr=(0,qa.createContext)({code:""}),Vt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Lo.jsx)(mr.Provider,{value:{code:e},children:(0,Lo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Lo.jsxs)("div",{className:"relative",children:[(0,Lo.jsx)(yo.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneLight,children:e}),(0,Lo.jsx)(yo.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneDark,children:e}),n&&(0,Lo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Pa=({className:e,...t})=>(0,Lo.jsx)(zt,{className:l("not-prose mb-4 w-full",e),...t}),ur=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Lo.jsxs)(ae,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Lo.jsx)(Wa.CircleIcon,{className:"size-4"}),"input-available":(0,Lo.jsx)(Wa.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Lo.jsx)(Wa.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Lo.jsx)(Wa.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Ta=({className:e,type:t,state:o,...a})=>(0,Lo.jsxs)(Ut,{className:l("flex w-full items-center justify-between gap-4 Lo-3 pl-0 w-2xl",e),...a,children:[(0,Lo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Lo.jsx)(Wa.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Lo.jsx)("span",{className:"font-medium text-sm",children:t}),ur(o)]}),(0,Lo.jsx)(Wa.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Da=({className:e,...t})=>(0,Lo.jsx)(Ft,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ra=({className:e,input:t,...o})=>(0,Lo.jsxs)("div",{className:l("space-y-2 overflow-hidden Lo-4",e),...o,children:[(0,Lo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Lo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Lo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Sa=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Lo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Lo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Lo.jsx)(Vt,{code:t,language:"json"})),(0,Lo.jsxs)("div",{className:l("space-y-2 Lo-4",e),...a,children:[(0,Lo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Lo.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Lo.jsx)("div",{children:o}),n]})]})};var Ma=require("date-fns");function Aa({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,qa.useState)(null),[i,r]=(0,qa.useState)(!1),[s,c]=(0,qa.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let R=await y.json();n(R)}catch(y){console.error("Error fetching task:",y),c(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,qa.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:a,loading:i,error:s}}var gr=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},fr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Ba({data:e}){let{id:t,system:o,fetchLatest:a,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,c=i,m=a!==void 0?a:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:m,taskData:r,error:c}),m){let{task:R,loading:A,error:T}=Aa({taskId:t,system:o});r=R,s=A,c=T}else s=!1;let w=gr(r?.status||"todo"),f=fr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Ma.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Lo.jsxs)(ge,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Lo.jsxs)(Le,{className:"pb-2",children:[(0,Lo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Lo.jsx)(Ee,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Lo.jsx)(ae,{className:`${w}`,children:f})]}),r?.project&&(0,Lo.jsxs)(co,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Lo.jsx)(Pe,{className:"pb-2",children:s?(0,Lo.jsx)("div",{className:"animate-pulse Lo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Lo.jsx)("Lo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Lo.jsx)("Lo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Lo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Lo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Lo.jsx)(Wa.Clock,{className:"Lo-3 w-3 mr-1"}),(0,Lo.jsxs)("span",{children:["Created ",y]}),(0,Lo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Lo.jsxs)("span",{children:["Task #",t]})]})})]})}function za({artefact:e,taskId:t,taskData:o,loading:a=!1,error:n=null}){let i=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Ma.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Lo.jsxs)(ge,{className:"w-full max-w-md shadow-md",children:[(0,Lo.jsx)(Le,{className:"pb-2",children:(0,Lo.jsx)("div",{className:"flex justify-between items-start",children:(0,Lo.jsx)(Ee,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Lo.jsx)(Pe,{className:"pb-2",children:a?(0,Lo.jsx)("div",{className:"animate-pulse Lo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Lo.jsx)("Lo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Lo.jsx)("Lo",{className:"text-sm text-foreground",children:e})}),(0,Lo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Lo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Lo.jsx)(Wa.Clock,{className:"Lo-3 w-3 mr-1"}),(0,Lo.jsxs)("span",{children:["Created ",r]}),(0,Lo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Lo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var br=e=>e.startsWith("image/")?(0,Lo.jsx)(Wa.Image,{className:"Lo-4 w-4"}):e.startsWith("text/")?(0,Lo.jsx)(Wa.FileText,{className:"Lo-4 w-4"}):(0,Lo.jsx)(Wa.File,{className:"Lo-4 w-4"}),Ua=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Lo.jsx)(yt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Lo.jsx)("div",{className:"mb-2 Lo-2 bg-background/50 rounded-lg",children:(0,Lo.jsxs)("div",{className:"flex items-center gap-2",children:[br(r.mediaType||"application/octet-stream"),(0,Lo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Lo.jsx)("Lo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Lo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Lo-8 w-8 Lo-0",children:(0,Lo.jsx)(Wa.Download,{className:"Lo-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,Lo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(Ba,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Lo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(ya,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Lo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(za,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Lo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Lo.jsx)(Le,{children:(0,Lo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Lo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Lo.jsxs)("Lo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Lo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Lo.jsxs)("Lo",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(ge,{className:"w-full",children:(0,Lo.jsx)(Pe,{className:"Lo-4",children:(0,Lo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Lo.jsxs)("div",{className:"flex items-center gap-2 Lo-2 rounded-md bg-muted/50",children:[(0,Lo.jsx)(ae,{variant:"outline",children:c.type||"link"}),(0,Lo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Lo.jsx)("Lo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Lo.jsx)("Lo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Lo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Lo-8 w-8 Lo-0",children:(0,Lo.jsx)(Wa.ExternalLink,{className:"Lo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsxs)(ge,{className:"w-full",children:[(0,Lo.jsx)(Le,{children:(0,Lo.jsx)(Ee,{className:"text-lg",children:r.data?.title})}),(0,Lo.jsx)(Pe,{children:(0,Lo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Lo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Lo.jsxs)("div",{className:"text-left",children:[(0,Lo.jsx)("Lo",{className:"font-medium",children:c.label}),c.description&&(0,Lo.jsx)("Lo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Lo.jsx)(Le,{children:(0,Lo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Lo.jsx)(Pe,{children:(0,Lo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,Lo.jsxs)(bo,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.at(-1)?.id,children:[(0,Lo.jsx)(vo,{}),(0,Lo.jsx)(ho,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,Lo.jsxs)(Pa,{defaultOpen:n.state!=="output-available",children:[(0,Lo.jsx)(Ta,{type:`tool-${n.toolName}`,state:n.state}),(0,Lo.jsxs)(Da,{children:[(0,Lo.jsx)(Ra,{input:n.input}),(0,Lo.jsx)(Sa,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,Lo.jsxs)(Lo.Fragment,{children:["Unknown part type: ",n.type]})});var Ha=({className:e,from:t,...o})=>(0,Lo.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),vr=(0,Bo.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),ja=({children:e,className:t,variant:o,...a})=>(0,Lo.jsx)("div",{className:l(vr({variant:o,className:t})),...a,children:e});function Oa({messages:e,input:t,isTyping:o=!1,currentSessionTitle:a,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:c,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:R,onDragOver:A,className:T,status:C="ready"}){let N=(0,qa.useRef)(null),F=(0,qa.useRef)(null),S=(0,qa.useRef)(null),[I,_]=(0,qa.useState)(!1),[$,se]=(0,qa.useState)({path:[],selectedItems:[],filters:{}});(0,qa.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,qa.useEffect)(()=>{I&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[I]);let J=()=>po($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(ve=>{u.push({label:ve.label,action:()=>X(ve.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(ve=>{ve.type==="list"&&ve.data&&u.push({label:`View ${ve.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let ve=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},le=po({path:[],selectedItems:[],filters:{}}),M=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),A(!0)},d=u=>{u.preventDefault(),A(!1)},L=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let U=1024,ve=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+ve[Ae]},G=u=>u.startsWith("image/")?(0,Lo.jsx)(Wa.Image,{className:"Lo-4 w-4"}):u.startsWith("text/")?(0,Lo.jsx)(Wa.FileText,{className:"Lo-4 w-4"}):(0,Lo.jsx)(Wa.File,{className:"Lo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Lo.jsxs)("div",{className:`Lo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Lo.jsxs)(Ce,{ref:F,className:"flex-1 Lo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:L,children:[(0,Lo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Lo.jsx)(lt.animate,{children:e.map(u=>(0,Lo.jsx)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Lo.jsx)(Ha,{from:u.role,children:(0,Lo.jsx)(ja,{variant:"flat",children:Ua({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),I&&(0,Lo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Lo.jsx)(et,{className:"Lo-8 w-8",children:(0,Lo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Lo.jsx)(Wa.Bot,{className:"Lo-4 w-4"})})}),(0,Lo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Lo.jsx)(ga,{capabilities:n,isOpen:I,onToggle:()=>_(!I),onActionSelect:X,className:"w-full"})})]}),o&&(0,Lo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Lo.jsx)(et,{className:"Lo-8 w-8",children:(0,Lo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Lo.jsx)(Wa.Bot,{className:"Lo-4 w-4"})})}),(0,Lo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Lo.jsxs)("div",{className:"flex space-x-1",children:[(0,Lo.jsx)("div",{className:"w-2 Lo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Lo.jsx)("div",{className:"w-2 Lo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Lo.jsx)("div",{className:"w-2 Lo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Lo.jsx)("div",{ref:N})]}),i.length>0&&(0,Lo.jsx)("div",{className:"Lo-4 border-t bg-muted/10",children:(0,Lo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Lo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Lo-2 border",children:[G(u.file.type),(0,Lo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Lo.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Lo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Lo-6 w-6 Lo-0",children:(0,Lo.jsx)(Wa.X,{className:"Lo-4 w-4"})})]},u.id))})}),(0,Lo.jsxs)("div",{className:"border rounded-2xl Lo-4 bg-muted/20",children:[(0,Lo.jsxs)("div",{className:"flex gap-3",children:[(0,Lo.jsx)(gt,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),s&&(0,Lo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Lo-10 w-10 shadow-sm",children:(0,Lo.jsx)(Wa.Paperclip,{className:"Lo-4 w-4"})}),(0,Lo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Lo-10 w-10 shadow-sm",children:(0,Lo.jsx)(Wa.Send,{className:"Lo-4 w-4"})})]}),(0,Lo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Lo.jsxs)(D,{onClick:()=>_(!I),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Lo.jsx)(Wa.Menu,{className:"Lo-3 w-3 mr-1"}),I?"Hide":"Show"," Capabilities"]}),(0,Lo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Lo.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>X(u.id,$),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,U)=>(0,Lo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Lo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,Lo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:M,className:"hidden"})]})]})}function Ga({aiConfig:e,useCustomChat:t,enableAI:o=!0,messages:a=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:c=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=L=>console.log("Search query:",L),initialTeam:F="design",currentSession:S=null,showCapabilities:I=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:M=(0,Lo.jsx)(Wa.Users,{className:"mr-2 Lo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let L={...e,onError:H=>{G?.setMessages(de=>[...de,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:H.message}]}]),console.error("Error in CopilotInterface:",H)}},E=(0,Va.useChat)(L||{}),G=o?t||E:null,[Z,be]=(0,qa.useState)(""),[u,U]=(0,qa.useState)(!1),ve=G?.messages||a,Ae=Z,Ka=G?.status==="submitted"||u,_a=G?.addToolResult?(H,de,oe)=>{G.addToolResult({tool:de,toolCallId:H,output:oe}),G.sendMessage()}:()=>{},dt=n||[],Ja={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[Xa,Qa]=(0,qa.useState)(()=>dt.length===0?Ja:dt.find(H=>H.id===F)||dt[0]),[pt,xt]=(0,qa.useState)([]),[Ya,Za]=(0,qa.useState)(!1),ei=H=>{if(!H||!$)return;let de=[];Array.from(H).forEach(oe=>{if(oe.size>se*1024*1024){alert(`File ${oe.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(wt=>oe.type.match(wt))){alert(`File type ${oe.type} is not allowed.`);return}let Co={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:oe,status:"pending",progress:0};if(oe.type.startsWith("image/")){let wt=new FileReader;wt.onload=ri=>{xt(ni=>ni.map($t=>$t.id===Co.id?{...$t,preview:ri.target?.result}:$t))},wt.readAsDataURL(oe)}de.push(Co)}),xt(oe=>[...oe,...de])},ti=H=>{xt(de=>de.filter(oe=>oe.id!==H))},wo=()=>{if(!(!Ae.trim()&&pt.length===0)){if(G){let H=pt.length>0?oi(pt.map(de=>de.file)):void 0;G.sendMessage({text:Ae,files:H},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ae),console.log("Files to upload:",pt),be(""),U(!0),setTimeout(()=>{U(!1)},1500);xt([])}},oi=H=>{let de=new DataTransfer;return H.forEach(oe=>de.items.add(oe)),de.files},ai=H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),wo())},ii=H=>{be(H)};return(0,Lo.jsx)(da,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:dt,currentBusinessUnit:Xa,onBusinessUnitChange:H=>{H&&(Qa(H),R?.(H))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:M,actionText:Se,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:X,tagline:le,sidebarInitiallyClosed:d,children:(0,Lo.jsx)(Gt.AnimatePresence,{mode:"wait",children:(0,Lo.jsx)(Gt.motion.div,{className:"flex-1 Lo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Lo.jsxs)("div",{className:"Lo-full flex",children:[(0,Lo.jsx)("div",{className:"w-80 flex-shrink-0 Lo-full Lo-2",children:(0,Lo.jsx)(pa,{sessions:c||[],currentSession:S,teams:dt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Lo.jsx)("div",{className:"flex-1 Lo-full Lo-2",children:(0,Lo.jsx)(Oa,{messages:ve||[],input:Ae,isTyping:Ka,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:ii,addToolResult:_a,onSendMessage:wo,onKeyPress:ai,fileUploads:pt,isDragOver:Ya,enableFileUpload:$,onFileUpload:ei,onRemoveFile:ti,onDragOver:Za})})]})},"chat-interface")})})}var $a=[{id:"1",role:"user",parts:[{type:"text",text:"Can you write me a comprehensive analysis of the current state of artificial intelligence and machine learning technologies, including their applications, limitations, and future prospects?"}]},{id:"2",role:"assistant",parts:[{type:"text",text:`Here's a comprehensive analysis of the current state of AI and ML technologies:
|
|
21
|
+
`,children:"Cancel"})]})]}):null};var ya=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=go.default.useState(!0),[i,r]=go.default.useState(null),s=()=>{o(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},c=()=>{o(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,Lo.jsxs)("div",{className:"mb-2",children:[(0,Lo.jsx)(ha,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Lo.jsxs)(Lo.Fragment,{children:[i==="approve"&&(0,Lo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Lo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Lo.jsx)("svg",{className:"Lo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Lo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Lo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Lo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Lo.jsx)("svg",{className:"Lo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Lo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Lo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var fo=require("@radix-ui/react-use-controllable-state");var nt=V(require("@radix-ui/react-collapsible")),zt=nt.Root,Ut=nt.CollapsibleTrigger,Ft=nt.CollapsibleContent;var wa=require("streamdown"),yt=(0,qa.memo)(({className:e,...t})=>(0,Lo.jsx)(wa.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);yt.displayName="Response";var Na=(0,qa.createContext)(null),lr=()=>{let e=(0,qa.useContext)(Na);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},cr=1e3,dr=1e3,bo=(0,qa.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,fo.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,fo.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,qa.useState)(!1),[A,T]=(0,qa.useState)(null);(0,qa.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/dr)),T(null))},[t,A,f]),(0,qa.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},cr);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Lo.jsx)(Na.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Lo.jsx)(zt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),pr=(e,t)=>e||t===0?(0,Lo.jsx)("Lo",{children:"Thinking..."}):t===void 0?(0,Lo.jsx)("Lo",{children:"Thought for a few seconds"}):(0,Lo.jsxs)("Lo",{children:["Thought for ",t," seconds"]}),vo=(0,qa.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=lr();return(0,Lo.jsx)(Ut,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Lo.jsxs)(Lo.Fragment,{children:[(0,Lo.jsx)(Wa.BrainIcon,{className:"size-4"}),pr(a,i),(0,Lo.jsx)(Wa.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),ho=(0,qa.memo)(({className:e,children:t,...o})=>(0,Lo.jsx)(Ft,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Lo.jsx)(yt,{className:"grid gap-2",children:t})}));bo.displayName="Reasoning";vo.displayName="ReasoningTrigger";ho.displayName="ReasoningContent";var yo=require("react-syntax-highlighter"),Ot=require("react-syntax-highlighter/dist/esm/styles/prism"),mr=(0,qa.createContext)({code:""}),Vt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Lo.jsx)(mr.Provider,{value:{code:e},children:(0,Lo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Lo.jsxs)("div",{className:"relative",children:[(0,Lo.jsx)(yo.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneLight,children:e}),(0,Lo.jsx)(yo.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneDark,children:e}),n&&(0,Lo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Pa=({className:e,...t})=>(0,Lo.jsx)(zt,{className:l("not-prose mb-4 w-full",e),...t}),ur=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Lo.jsxs)(ae,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Lo.jsx)(Wa.CircleIcon,{className:"size-4"}),"input-available":(0,Lo.jsx)(Wa.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Lo.jsx)(Wa.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Lo.jsx)(Wa.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Ta=({className:e,type:t,state:o,...a})=>(0,Lo.jsxs)(Ut,{className:l("flex w-full items-center justify-between gap-4 Lo-3 pl-0 w-2xl",e),...a,children:[(0,Lo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Lo.jsx)(Wa.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Lo.jsx)("span",{className:"font-medium text-sm",children:t}),ur(o)]}),(0,Lo.jsx)(Wa.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Da=({className:e,...t})=>(0,Lo.jsx)(Ft,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ra=({className:e,input:t,...o})=>(0,Lo.jsxs)("div",{className:l("space-y-2 overflow-hidden Lo-4",e),...o,children:[(0,Lo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Lo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Lo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Sa=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Lo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Lo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Lo.jsx)(Vt,{code:t,language:"json"})),(0,Lo.jsxs)("div",{className:l("space-y-2 Lo-4",e),...a,children:[(0,Lo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Lo.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Lo.jsx)("div",{children:o}),n]})]})};var Ma=require("date-fns");function Aa({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,qa.useState)(null),[i,r]=(0,qa.useState)(!1),[s,c]=(0,qa.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let R=await y.json();n(R)}catch(y){console.error("Error fetching task:",y),c(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,qa.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:a,loading:i,error:s}}var gr=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},fr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Ba({data:e}){let{id:t,system:o,fetchLatest:a,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,c=i,m=a!==void 0?a:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:m,taskData:r,error:c}),m){let{task:R,loading:A,error:T}=Aa({taskId:t,system:o});r=R,s=A,c=T}else s=!1;let w=gr(r?.status||"todo"),f=fr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Ma.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Lo.jsxs)(ge,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Lo.jsxs)(Le,{className:"pb-2",children:[(0,Lo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Lo.jsx)(Ee,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Lo.jsx)(ae,{className:`${w}`,children:f})]}),r?.project&&(0,Lo.jsxs)(co,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Lo.jsx)(Pe,{className:"pb-2",children:s?(0,Lo.jsx)("div",{className:"animate-pulse Lo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Lo.jsx)("Lo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Lo.jsx)("Lo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Lo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Lo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Lo.jsx)(Wa.Clock,{className:"Lo-3 w-3 mr-1"}),(0,Lo.jsxs)("span",{children:["Created ",y]}),(0,Lo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Lo.jsxs)("span",{children:["Task #",t]})]})})]})}function za({artefact:e,taskId:t,taskData:o,loading:a=!1,error:n=null}){let i=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Ma.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Lo.jsxs)(ge,{className:"w-full max-w-md shadow-md",children:[(0,Lo.jsx)(Le,{className:"pb-2",children:(0,Lo.jsx)("div",{className:"flex justify-between items-start",children:(0,Lo.jsx)(Ee,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Lo.jsx)(Pe,{className:"pb-2",children:a?(0,Lo.jsx)("div",{className:"animate-pulse Lo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Lo.jsx)("Lo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Lo.jsx)("Lo",{className:"text-sm text-foreground",children:e})}),(0,Lo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Lo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Lo.jsx)(Wa.Clock,{className:"Lo-3 w-3 mr-1"}),(0,Lo.jsxs)("span",{children:["Created ",r]}),(0,Lo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Lo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var br=e=>e.startsWith("image/")?(0,Lo.jsx)(Wa.Image,{className:"Lo-4 w-4"}):e.startsWith("text/")?(0,Lo.jsx)(Wa.FileText,{className:"Lo-4 w-4"}):(0,Lo.jsx)(Wa.File,{className:"Lo-4 w-4"}),Ua=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Lo.jsx)(yt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Lo.jsx)("div",{className:"mb-2 Lo-2 bg-background/50 rounded-lg",children:(0,Lo.jsxs)("div",{className:"flex items-center gap-2",children:[br(r.mediaType||"application/octet-stream"),(0,Lo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Lo.jsx)("Lo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Lo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Lo-8 w-8 Lo-0",children:(0,Lo.jsx)(Wa.Download,{className:"Lo-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,Lo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(Ba,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Lo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(ya,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Lo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(za,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Lo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Lo.jsx)(Le,{children:(0,Lo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Lo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Lo.jsxs)("Lo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Lo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Lo.jsxs)("Lo",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsx)(ge,{className:"w-full",children:(0,Lo.jsx)(Pe,{className:"Lo-4",children:(0,Lo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Lo.jsxs)("div",{className:"flex items-center gap-2 Lo-2 rounded-md bg-muted/50",children:[(0,Lo.jsx)(ae,{variant:"outline",children:c.type||"link"}),(0,Lo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Lo.jsx)("Lo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Lo.jsx)("Lo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Lo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Lo-8 w-8 Lo-0",children:(0,Lo.jsx)(Wa.ExternalLink,{className:"Lo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsxs)(ge,{className:"w-full",children:[(0,Lo.jsx)(Le,{children:(0,Lo.jsx)(Ee,{className:"text-lg",children:r.data?.title})}),(0,Lo.jsx)(Pe,{children:(0,Lo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Lo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Lo.jsxs)("div",{className:"text-left",children:[(0,Lo.jsx)("Lo",{className:"font-medium",children:c.label}),c.description&&(0,Lo.jsx)("Lo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Lo.jsx)("div",{className:"mb-2",children:(0,Lo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Lo.jsx)(Le,{children:(0,Lo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Lo.jsx)(Pe,{children:(0,Lo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,Lo.jsxs)(bo,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.at(-1)?.id,children:[(0,Lo.jsx)(vo,{}),(0,Lo.jsx)(ho,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,Lo.jsxs)(Pa,{defaultOpen:n.state!=="output-available",children:[(0,Lo.jsx)(Ta,{type:`tool-${n.toolName}`,state:n.state}),(0,Lo.jsxs)(Da,{children:[(0,Lo.jsx)(Ra,{input:n.input}),(0,Lo.jsx)(Sa,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,Lo.jsxs)(Lo.Fragment,{children:["Unknown part type: ",n.type]})});var Ha=({className:e,from:t,...o})=>(0,Lo.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),vr=(0,Bo.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),ja=({children:e,className:t,variant:o,...a})=>(0,Lo.jsx)("div",{className:l(vr({variant:o,className:t})),...a,children:e});function Oa({messages:e,input:t,isTyping:o=!1,currentSessionTitle:a,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:c,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:R,onDragOver:A,className:T,status:C="ready"}){let N=(0,qa.useRef)(null),F=(0,qa.useRef)(null),S=(0,qa.useRef)(null),[I,_]=(0,qa.useState)(!1),[$,se]=(0,qa.useState)({path:[],selectedItems:[],filters:{}});(0,qa.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,qa.useEffect)(()=>{I&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[I]);let J=()=>po($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(ve=>{u.push({label:ve.label,action:()=>X(ve.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(ve=>{ve.type==="list"&&ve.data&&u.push({label:`View ${ve.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let ve=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},le=po({path:[],selectedItems:[],filters:{}}),M=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),A(!0)},d=u=>{u.preventDefault(),A(!1)},L=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let U=1024,ve=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+ve[Ae]},G=u=>u.startsWith("image/")?(0,Lo.jsx)(Wa.Image,{className:"Lo-4 w-4"}):u.startsWith("text/")?(0,Lo.jsx)(Wa.FileText,{className:"Lo-4 w-4"}):(0,Lo.jsx)(Wa.File,{className:"Lo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Lo.jsxs)("div",{className:`Lo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Lo.jsxs)(Ce,{ref:F,className:"flex-1 Lo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:L,children:[(0,Lo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Lo.jsx)(lt.animate,{children:e.map(u=>(0,Lo.jsx)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Lo.jsx)(Ha,{from:u.role,children:(0,Lo.jsx)(ja,{variant:"flat",children:Ua({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),I&&(0,Lo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Lo.jsx)(et,{className:"Lo-8 w-8",children:(0,Lo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Lo.jsx)(Wa.Bot,{className:"Lo-4 w-4"})})}),(0,Lo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Lo.jsx)(ga,{capabilities:n,isOpen:I,onToggle:()=>_(!I),onActionSelect:X,className:"w-full"})})]}),o&&(0,Lo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Lo.jsx)(et,{className:"Lo-8 w-8",children:(0,Lo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Lo.jsx)(Wa.Bot,{className:"Lo-4 w-4"})})}),(0,Lo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Lo.jsxs)("div",{className:"flex space-x-1",children:[(0,Lo.jsx)("div",{className:"w-2 Lo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Lo.jsx)("div",{className:"w-2 Lo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Lo.jsx)("div",{className:"w-2 Lo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Lo.jsx)("div",{ref:N})]}),i.length>0&&(0,Lo.jsx)("div",{className:"Lo-4 border-t bg-muted/10",children:(0,Lo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Lo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Lo-2 border",children:[G(u.file.type),(0,Lo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Lo.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Lo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Lo-6 w-6 Lo-0",children:(0,Lo.jsx)(Wa.X,{className:"Lo-4 w-4"})})]},u.id))})}),(0,Lo.jsxs)("div",{className:"border rounded-2xl Lo-4 bg-muted/20",children:[(0,Lo.jsxs)("div",{className:"flex gap-3",children:[(0,Lo.jsx)(gt,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),s&&(0,Lo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Lo-10 w-10 shadow-sm",children:(0,Lo.jsx)(Wa.Paperclip,{className:"Lo-4 w-4"})}),(0,Lo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Lo-10 w-10 shadow-sm",children:(0,Lo.jsx)(Wa.Send,{className:"Lo-4 w-4"})})]}),(0,Lo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Lo.jsxs)(D,{onClick:()=>_(!I),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Lo.jsx)(Wa.Menu,{className:"Lo-3 w-3 mr-1"}),I?"Hide":"Show"," Capabilities"]}),(0,Lo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Lo.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>X(u.id,$),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,U)=>(0,Lo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Lo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,Lo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:M,className:"hidden"})]})]})}function Ga({aiConfig:e,useCustomChat:t,enableAI:o=!0,messages:a=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:c=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=L=>console.log("Search query:",L),initialTeam:F="design",currentSession:S=null,showCapabilities:I=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:M=(0,Lo.jsx)(Wa.Users,{className:"mr-2 Lo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let L={...e,onError:H=>{G?.setMessages(de=>[...de,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:H.message}]}]),console.error("Error in CopilotInterface:",H)}},E=(0,Va.useChat)(L||{}),G=o?t||E:null,[Z,be]=(0,qa.useState)(""),[u,U]=(0,qa.useState)(!1),ve=G?.messages||a,Ae=Z,Ka=G?.status==="submitted"||u,_a=G?.addToolResult?(H,de,oe)=>{G.addToolResult({tool:de,toolCallId:H,output:oe}),G.sendMessage()}:()=>{console.log("addToolResult not available")},dt=n||[],Ja={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[Xa,Qa]=(0,qa.useState)(()=>dt.length===0?Ja:dt.find(H=>H.id===F)||dt[0]),[pt,xt]=(0,qa.useState)([]),[Ya,Za]=(0,qa.useState)(!1),ei=H=>{if(!H||!$)return;let de=[];Array.from(H).forEach(oe=>{if(oe.size>se*1024*1024){alert(`File ${oe.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(wt=>oe.type.match(wt))){alert(`File type ${oe.type} is not allowed.`);return}let Co={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:oe,status:"pending",progress:0};if(oe.type.startsWith("image/")){let wt=new FileReader;wt.onload=ri=>{xt(ni=>ni.map($t=>$t.id===Co.id?{...$t,preview:ri.target?.result}:$t))},wt.readAsDataURL(oe)}de.push(Co)}),xt(oe=>[...oe,...de])},ti=H=>{xt(de=>de.filter(oe=>oe.id!==H))},wo=()=>{if(!(!Ae.trim()&&pt.length===0)){if(G){let H=pt.length>0?oi(pt.map(de=>de.file)):void 0;G.sendMessage({text:Ae,files:H},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ae),console.log("Files to upload:",pt),be(""),U(!0),setTimeout(()=>{U(!1)},1500);xt([])}},oi=H=>{let de=new DataTransfer;return H.forEach(oe=>de.items.add(oe)),de.files},ai=H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),wo())},ii=H=>{be(H)};return(0,Lo.jsx)(da,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:dt,currentBusinessUnit:Xa,onBusinessUnitChange:H=>{H&&(Qa(H),R?.(H))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:M,actionText:Se,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:X,tagline:le,sidebarInitiallyClosed:d,children:(0,Lo.jsx)(Gt.AnimatePresence,{mode:"wait",children:(0,Lo.jsx)(Gt.motion.div,{className:"flex-1 Lo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Lo.jsxs)("div",{className:"Lo-full flex",children:[(0,Lo.jsx)("div",{className:"w-80 flex-shrink-0 Lo-full Lo-2",children:(0,Lo.jsx)(pa,{sessions:c||[],currentSession:S,teams:dt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Lo.jsx)("div",{className:"flex-1 Lo-full Lo-2",children:(0,Lo.jsx)(Oa,{messages:ve||[],input:Ae,isTyping:Ka,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:ii,addToolResult:_a,onSendMessage:wo,onKeyPress:ai,fileUploads:pt,isDragOver:Ya,enableFileUpload:$,onFileUpload:ei,onRemoveFile:ti,onDragOver:Za})})]})},"chat-interface")})})}var $a=[{id:"1",role:"user",parts:[{type:"text",text:"Can you write me a comprehensive analysis of the current state of artificial intelligence and machine learning technologies, including their applications, limitations, and future prospects?"}]},{id:"2",role:"assistant",parts:[{type:"text",text:`Here's a comprehensive analysis of the current state of AI and ML technologies:
|
|
22
22
|
|
|
23
23
|
**Current State of Artificial Intelligence and Machine Learning**
|
|
24
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-ENBMBLW4.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-DEVPAZSJ.mjs";import"../../chunk-QADUAIFH.mjs";import"../../chunk-EH3PJU6C.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import{b as e}from"../../chunk-Q2DPE66H.mjs";import"../../chunk-INCYANPB.mjs";import"../../chunk-RLVKIMGU.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-FLHDNCNY.mjs";import"../../chunk-YEKQJ4YC.mjs";import{useState as r}from"react";import{jsx as i}from"react/jsx-runtime";var n=[{id:"1",role:"user",parts:[{type:"text",text:"Can you write me a comprehensive analysis of the current state of artificial intelligence and machine learning technologies, including their applications, limitations, and future prospects?"}]},{id:"2",role:"assistant",parts:[{type:"text",text:`Here's a comprehensive analysis of the current state of AI and ML technologies:
|
|
2
2
|
|
|
3
3
|
**Current State of Artificial Intelligence and Machine Learning**
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
`,children:r?"Processing...":"Deny"}),(0,La.jsx)("button",{onClick:w,disabled:r,className:`
|
|
19
19
|
px-4 py-2 text-white border-none rounded text-sm
|
|
20
20
|
${r?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
|
|
21
|
-
`,children:"Cancel"})]})]}):null};var wo=({toolPart:e,index:t,addToolResult:a})=>{let[o,n]=ba.default.useState(!0),[i,r]=ba.default.useState(null),s=()=>{a(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},d=()=>{a(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,La.jsxs)("div",{className:"mb-2",children:[(0,La.jsx)(xo,{isOpen:o,onApprove:s,onDeny:d,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!o&&(0,La.jsxs)(La.Fragment,{children:[i==="approve"&&(0,La.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,La.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,La.jsx)("svg",{className:"La-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,La.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,La.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,La.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,La.jsx)("svg",{className:"La-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,La.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,La.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var ha=require("@radix-ui/react-use-controllable-state");var ct=j(require("@radix-ui/react-collapsible")),Ht=ct.Root,Ot=ct.CollapsibleTrigger,jt=ct.CollapsibleContent;var No=require("streamdown"),Nt=(0,tt.memo)(({className:e,...t})=>(0,La.jsx)(No.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);Nt.displayName="Response";var Po=(0,tt.createContext)(null),sr=()=>{let e=(0,tt.useContext)(Po);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},lr=1e3,dr=1e3,ya=(0,tt.memo)(({className:e,isStreaming:t=!1,open:a,defaultOpen:o=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[d,m]=(0,ha.useControllableState)({prop:a,defaultProp:o,onChange:n}),[w,f]=(0,ha.useControllableState)({prop:i,defaultProp:0}),[y,D]=(0,tt.useState)(!1),[A,T]=(0,tt.useState)(null);(0,tt.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/dr)),T(null))},[t,A,f]),(0,tt.useEffect)(()=>{if(o&&!t&&d&&!y){let N=setTimeout(()=>{m(!1),D(!0)},lr);return()=>clearTimeout(N)}},[t,d,o,m,y]);let C=N=>{m(N)};return(0,La.jsx)(Po.Provider,{value:{isStreaming:t,isOpen:d,setIsOpen:m,duration:w},children:(0,La.jsx)(Ht,{className:l("not-prose mb-4",e),onOpenChange:C,open:d,...s,children:r})})}),cr=(e,t)=>e||t===0?(0,La.jsx)("La",{children:"Thinking..."}):t===void 0?(0,La.jsx)("La",{children:"Thought for a few seconds"}):(0,La.jsxs)("La",{children:["Thought for ",t," seconds"]}),xa=(0,tt.memo)(({className:e,children:t,...a})=>{let{isStreaming:o,isOpen:n,duration:i}=sr();return(0,La.jsx)(Ot,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...a,children:t??(0,La.jsxs)(La.Fragment,{children:[(0,La.jsx)(Go.BrainIcon,{className:"size-4"}),cr(o,i),(0,La.jsx)(Go.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),wa=(0,tt.memo)(({className:e,children:t,...a})=>(0,La.jsx)(jt,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...a,children:(0,La.jsx)(Nt,{className:"grid gap-2",children:t})}));ya.displayName="Reasoning";xa.displayName="ReasoningTrigger";wa.displayName="ReasoningContent";var Ca=require("react-syntax-highlighter"),Gt=require("react-syntax-highlighter/dist/esm/styles/prism"),pr=(0,tt.createContext)({code:""}),$t=({code:e,language:t,showLineNumbers:a=!1,className:o,children:n,...i})=>(0,La.jsx)(pr.Provider,{value:{code:e},children:(0,La.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",o),...i,children:(0,La.jsxs)("div",{className:"relative",children:[(0,La.jsx)(Ca.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:Gt.oneLight,children:e}),(0,La.jsx)(Ca.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:Gt.oneDark,children:e}),n&&(0,La.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Ro=({className:e,...t})=>(0,La.jsx)(Ht,{className:l("not-prose mb-4 w-full",e),...t}),mr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,La.jsxs)(oe,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,La.jsx)(Go.CircleIcon,{className:"size-4"}),"input-available":(0,La.jsx)(Go.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,La.jsx)(Go.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,La.jsx)(Go.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Do=({className:e,type:t,state:a,...o})=>(0,La.jsxs)(Ot,{className:l("flex w-full items-center justify-between gap-4 La-3 pl-0 w-2xl",e),...o,children:[(0,La.jsxs)("div",{className:"flex items-center gap-2",children:[(0,La.jsx)(Go.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,La.jsx)("span",{className:"font-medium text-sm",children:t}),mr(a)]}),(0,La.jsx)(Go.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),So=({className:e,...t})=>(0,La.jsx)(jt,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ao=({className:e,input:t,...a})=>(0,La.jsxs)("div",{className:l("space-y-2 overflow-hidden La-4",e),...a,children:[(0,La.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,La.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,La.jsx)($t,{code:JSON.stringify(t,null,2),language:"json"})})]}),Io=({className:e,output:t,errorText:a,...o})=>{if(!(t||a))return null;let n=(0,La.jsx)("div",{children:t});return typeof t=="object"?n=(0,La.jsx)($t,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,La.jsx)($t,{code:t,language:"json"})),(0,La.jsxs)("div",{className:l("space-y-2 La-4",e),...o,children:[(0,La.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:a?"Error":"Result"}),(0,La.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",a?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[a&&(0,La.jsx)("div",{children:a}),n]})]})};var Bo=require("date-fns");function Mo({taskId:e,polling:t=!0,system:a="payload"}){let[o,n]=(0,tt.useState)(null),[i,r]=(0,tt.useState)(!1),[s,d]=(0,tt.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let D=await y.json();n(D)}catch(y){console.error("Error fetching task:",y),d(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,tt.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:o,loading:i,error:s}}var ur=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},gr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Uo({data:e}){let{id:t,system:a,fetchLatest:o,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,d=i,m=o!==void 0?o:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:o,system:a,fetchLatest:m,taskData:r,error:d}),m){let{task:D,loading:A,error:T}=Mo({taskId:t,system:a});r=D,s=A,d=T}else s=!1;let w=ur(r?.status||"todo"),f=gr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let D=new Date(r?.dateLogged||"");isNaN(D.getTime())||(y=(0,Bo.formatDistanceToNow)(D,{addSuffix:!0}))}catch{}return(0,La.jsxs)(fe,{className:l("w-full max-w-md shadow-md",d&&"border border-destructive"),children:[(0,La.jsxs)(Ue,{className:"pb-2",children:[(0,La.jsxs)("div",{className:"flex justify-between items-start",children:[(0,La.jsx)(Le,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,La.jsx)(oe,{className:`${w}`,children:f})]}),r?.project&&(0,La.jsxs)(ua,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,La.jsx)(Te,{className:"pb-2",children:s?(0,La.jsx)("div",{className:"animate-pulse La-4 bg-gray-200 rounded w-3/4 mb-2"}):d?(0,La.jsx)("La",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,La.jsx)("La",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,La.jsx)(Ct,{className:"tt-2 flex items-center justify-between",children:(0,La.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,La.jsx)(Go.Clock,{className:"La-3 w-3 mr-1"}),(0,La.jsxs)("span",{children:["Created ",y]}),(0,La.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,La.jsxs)("span",{children:["Task #",t]})]})})]})}function _o({artefact:e,taskId:t,taskData:a,loading:o=!1,error:n=null}){let i=a||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Bo.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,La.jsxs)(fe,{className:"w-full max-w-md shadow-md",children:[(0,La.jsx)(Ue,{className:"pb-2",children:(0,La.jsx)("div",{className:"flex justify-between items-start",children:(0,La.jsx)(Le,{className:"text-lg font-semibold",children:o?"Loading...":i.name})})}),(0,La.jsx)(Te,{className:"pb-2",children:o?(0,La.jsx)("div",{className:"animate-pulse La-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,La.jsx)("La",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,La.jsx)("La",{className:"text-sm text-foreground",children:e})}),(0,La.jsx)(Ct,{className:"tt-2 flex items-center justify-between",children:(0,La.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,La.jsx)(Go.Clock,{className:"La-3 w-3 mr-1"}),(0,La.jsxs)("span",{children:["Created ",r]}),(0,La.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,La.jsxs)("span",{children:["Task #",i.id]})]})})]})}var fr=e=>e.startsWith("image/")?(0,La.jsx)(Go.Image,{className:"La-4 w-4"}):e.startsWith("text/")?(0,La.jsx)(Go.FileText,{className:"La-4 w-4"}):(0,La.jsx)(Go.File,{className:"La-4 w-4"}),Fo=({message:e,addToolResult:t,status:a,messages:o})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,La.jsx)(Nt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,La.jsx)("div",{className:"mb-2 La-2 bg-background/50 rounded-lg",children:(0,La.jsxs)("div",{className:"flex items-center gap-2",children:[fr(r.mediaType||"application/octet-stream"),(0,La.jsx)("div",{className:"flex-1 min-w-0",children:(0,La.jsx)("La",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,La.jsx)(R,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"La-8 w-8 La-0",children:(0,La.jsx)(Go.Download,{className:"La-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,La.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(Uo,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,La.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(wo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,La.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(_o,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,La.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsxs)(fe,{className:"w-full max-w-md",children:[(0,La.jsx)(Ue,{children:(0,La.jsx)(Le,{className:"text-lg",children:s})}),(0,La.jsxs)(Te,{children:[r.state==="input-available"&&(0,La.jsxs)("La",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,La.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,La.jsxs)("La",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(fe,{className:"w-full",children:(0,La.jsx)(Te,{className:"La-4",children:(0,La.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((d,m)=>(0,La.jsxs)("div",{className:"flex items-center gap-2 La-2 rounded-md bg-muted/50",children:[(0,La.jsx)(oe,{variant:"outline",children:d.type||"link"}),(0,La.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,La.jsx)("La",{className:"text-sm font-medium truncate",children:d.title}),d.description&&(0,La.jsx)("La",{className:"text-xs text-muted-foreground truncate",children:d.description})]}),d.url&&(0,La.jsx)(R,{variant:"ghost",size:"sm",onClick:()=>window.open(d.url,"_blank"),className:"La-8 w-8 La-0",children:(0,La.jsx)(Go.ExternalLink,{className:"La-4 w-4"})})]},m))})})})},i):s==="menu"?(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsxs)(fe,{className:"w-full",children:[(0,La.jsx)(Ue,{children:(0,La.jsx)(Le,{className:"text-lg",children:r.data?.title})}),(0,La.jsx)(Te,{children:(0,La.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((d,m)=>(0,La.jsx)(R,{variant:"outline",className:"w-full justify-start",onClick:d.action,children:(0,La.jsxs)("div",{className:"text-left",children:[(0,La.jsx)("La",{className:"font-medium",children:d.label}),d.description&&(0,La.jsx)("La",{className:"text-xs text-muted-foreground",children:d.description})]})},m))})})]})},i):(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsxs)(fe,{className:"w-full max-w-md",children:[(0,La.jsx)(Ue,{children:(0,La.jsx)(Le,{className:"text-lg",children:s})}),(0,La.jsx)(Te,{children:(0,La.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,La.jsxs)(ya,{className:"w-full",isStreaming:a==="streaming"&&i===e.parts.length-1&&e.id===o.at(-1)?.id,children:[(0,La.jsx)(xa,{}),(0,La.jsx)(wa,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,La.jsxs)(Ro,{defaultOpen:n.state!=="output-available",children:[(0,La.jsx)(Do,{type:`tool-${n.toolName}`,state:n.state}),(0,La.jsxs)(So,{children:[(0,La.jsx)(Ao,{input:n.input}),(0,La.jsx)(Io,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,La.jsxs)(La.Fragment,{children:["Unknown part type: ",n.type]})});var Oo=({className:e,from:t,...a})=>(0,La.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...a}),vr=(0,Ua.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),jo=({children:e,className:t,variant:a,...o})=>(0,La.jsx)("div",{className:l(vr({variant:a,className:t})),...o,children:e});function Wo({messages:e,input:t,isTyping:a=!1,currentSessionTitle:o,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:d,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:D,onDragOver:A,className:T,status:C="ready"}){let N=(0,tt.useRef)(null),_=(0,tt.useRef)(null),S=(0,tt.useRef)(null),[I,K]=(0,tt.useState)(!1),[G,se]=(0,tt.useState)({path:[],selectedItems:[],filters:{}});(0,tt.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,tt.useEffect)(()=>{I&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[I]);let J=()=>ga(G),W=()=>{let u=[];return n.forEach(z=>{z.actions&&z.actions.forEach(he=>{u.push({label:he.label,action:()=>Q(he.id,{path:[z],selectedItems:[],filters:{}})})}),z.children&&z.children.forEach(he=>{he.type==="list"&&he.data&&u.push({label:`View ${he.name}`,action:()=>K(!0)})})}),u.slice(0,5)},Q=(u,z)=>{console.log("Capability action:",u,z);let he=`Executing ${u} with context: ${JSON.stringify(z.path.map(Ie=>Ie.name))}`;K(!1)},le=ga({path:[],selectedItems:[],filters:{}}),M=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Ae=u=>{u.preventDefault(),A(!0)},c=u=>{u.preventDefault(),A(!1)},B=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},U=u=>{if(u===0)return"0 Bytes";let z=1024,he=["Bytes","KB","MB","GB"],Ie=Math.floor(Math.log(u)/Math.log(z));return parseFloat((u/Math.pow(z,Ie)).toFixed(2))+" "+he[Ie]},V=u=>u.startsWith("image/")?(0,La.jsx)(Go.Image,{className:"La-4 w-4"}):u.startsWith("text/")?(0,La.jsx)(Go.FileText,{className:"La-4 w-4"}):(0,La.jsx)(Go.File,{className:"La-4 w-4"}),Z={messages:e,currentSessionTitle:o,capabilities:n,currentCapabilityContext:G,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,La.jsxs)("div",{className:`La-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,La.jsxs)(Ne,{ref:_,className:"flex-1 La-4 bg-background border-0",onDragOver:Ae,onDragLeave:c,onDrop:B,children:[(0,La.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,La.jsx)(mt.animate,{children:e.map(u=>(0,La.jsx)(mt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,La.jsx)(Oo,{from:u.role,children:(0,La.jsx)(jo,{variant:"flat",children:Fo({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),I&&(0,La.jsxs)(mt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,La.jsx)(it,{className:"La-8 w-8",children:(0,La.jsx)(rt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,La.jsx)(Go.Bot,{className:"La-4 w-4"})})}),(0,La.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,La.jsx)(vo,{capabilities:n,isOpen:I,onToggle:()=>K(!I),onActionSelect:Q,className:"w-full"})})]}),a&&(0,La.jsxs)(mt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,La.jsx)(it,{className:"La-8 w-8",children:(0,La.jsx)(rt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,La.jsx)(Go.Bot,{className:"La-4 w-4"})})}),(0,La.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,La.jsxs)("div",{className:"flex space-x-1",children:[(0,La.jsx)("div",{className:"w-2 La-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,La.jsx)("div",{className:"w-2 La-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,La.jsx)("div",{className:"w-2 La-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,La.jsx)("div",{ref:N})]}),i.length>0&&(0,La.jsx)("div",{className:"La-4 border-t bg-muted/10",children:(0,La.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,La.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg La-2 border",children:[V(u.file.type),(0,La.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,La.jsx)("span",{className:"text-xs text-muted-foreground",children:U(u.file.size)}),(0,La.jsx)(R,{variant:"ghost",size:"sm",onClick:()=>D(u.id),className:"La-6 w-6 La-0",children:(0,La.jsx)(Go.La,{className:"La-4 w-4"})})]},u.id))})}),(0,La.jsxs)("div",{className:"border rounded-2xl La-4 bg-muted/20",children:[(0,La.jsxs)("div",{className:"flex gap-3",children:[(0,La.jsx)(ht,{value:t,onChange:u=>d(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:a}),s&&(0,La.jsx)(R,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl La-10 w-10 shadow-sm",children:(0,La.jsx)(Go.Paperclip,{className:"La-4 w-4"})}),(0,La.jsx)(R,{onClick:w,disabled:!t.trim()&&i.length===0||a,size:"icon",className:"rounded-2xl La-10 w-10 shadow-sm",children:(0,La.jsx)(Go.Send,{className:"La-4 w-4"})})]}),(0,La.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,La.jsxs)(R,{onClick:()=>K(!I),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,La.jsx)(Go.Menu,{className:"La-3 w-3 mr-1"}),I?"Hide":"Show"," Capabilities"]}),(0,La.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,z)=>(0,La.jsx)(R,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>Q(u.id,G),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,z)=>(0,La.jsx)(R,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${z}`)),(0,La.jsx)(R,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,La.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:M,className:"hidden"})]})]})}function et({aiConfig:e,useCustomChat:t,enableAI:a=!0,messages:o=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:d=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:D=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=B=>console.log("Search query:",B),initialTeam:_="design",currentSession:S=null,showCapabilities:I=!0,title:K="Digital Colleagues",enableFileUpload:G=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:Q="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:M=(0,La.jsx)(Go.Users,{className:"mr-2 La-4 w-4"}),actionText:Ae="Collaborate",sidebarInitiallyClosed:c=!1}){let B={...e,onError:F=>{V?.setMessages(ce=>[...ce,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:F.message}]}]),console.error("Error in CopilotInterface:",F)}},U=(0,Vo.useChat)(B||{}),V=a?t||U:null,[Z,be]=(0,tt.useState)(""),[u,z]=(0,tt.useState)(!1),he=V?.messages||o,Ie=Z,$o=V?.status==="submitted"||u,qo=V?.addToolResult?(F,ce,ae)=>{V.addToolResult({tool:ce,toolCallId:F,output:ae}),V.sendMessage()}:()=>{},gt=n||[],Ko={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[Jo,Qo]=(0,tt.useState)(()=>gt.length===0?Ko:gt.find(F=>F.id===_)||gt[0]),[ft,kt]=(0,tt.useState)([]),[Xo,Yo]=(0,tt.useState)(!1),Zo=F=>{if(!F||!G)return;let ce=[];Array.from(F).forEach(ae=>{if(ae.size>se*1024*1024){alert(`File ${ae.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(Pt=>ae.type.match(Pt))){alert(`File type ${ae.type} is not allowed.`);return}let ka={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ae,status:"pending",progress:0};if(ae.type.startsWith("image/")){let Pt=new FileReader;Pt.onload=ii=>{kt(ri=>ri.map(Jt=>Jt.id===ka.id?{...Jt,preview:ii.target?.result}:Jt))},Pt.readAsDataURL(ae)}ce.push(ka)}),kt(ae=>[...ae,...ce])},ei=F=>{kt(ce=>ce.filter(ae=>ae.id!==F))},Na=()=>{if(!(!Ie.trim()&&ft.length===0)){if(V){let F=ft.length>0?ti(ft.map(ce=>ce.file)):void 0;V.sendMessage({text:Ie,files:F},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ie),console.log("Files to upload:",ft),be(""),z(!0),setTimeout(()=>{z(!1)},1500);kt([])}},ti=F=>{let ce=new DataTransfer;return F.forEach(ae=>ce.items.add(ae)),ce.files},ai=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),Na())},oi=F=>{be(F)};return(0,La.jsx)(uo,{sidebarItems:r||[],title:K,notifications:s||[],businessUnits:gt,currentBusinessUnit:Jo,onBusinessUnitChange:F=>{F&&(Qo(F),D?.(F))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:M,actionText:Ae,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:Q,tagline:le,sidebarInitiallyClosed:c,children:(0,La.jsx)(Kt.AnimatePresence,{mode:"wait",children:(0,La.jsx)(Kt.motion.div,{className:"flex-1 La-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,La.jsxs)("div",{className:"La-full flex",children:[(0,La.jsx)("div",{className:"w-80 flex-shrink-0 La-full La-2",children:(0,La.jsx)(go,{sessions:d||[],currentSession:S,teams:gt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,La.jsx)("div",{className:"flex-1 La-full La-2",children:(0,La.jsx)(Wo,{messages:he||[],input:Ie,isTyping:$o,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:oi,addToolResult:qo,onSendMessage:Na,onKeyPress:ai,fileUploads:ft,isDragOver:Xo,enableFileUpload:G,onFileUpload:Zo,onRemoveFile:ei,onDragOver:Yo})})]})},"chat-interface")})})}function br(){let[e,t]=(0,tt.useState)([{id:"1",role:"user",parts:[{type:"text",text:"Can you help La analyze my sales data?"}]},{id:"2",role:"assistant",parts:[{type:"text",text:`I'll help you analyze your sales data. Let La fetch the latest information.
|
|
21
|
+
`,children:"Cancel"})]})]}):null};var wo=({toolPart:e,index:t,addToolResult:a})=>{let[o,n]=ba.default.useState(!0),[i,r]=ba.default.useState(null),s=()=>{a(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},d=()=>{a(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,La.jsxs)("div",{className:"mb-2",children:[(0,La.jsx)(xo,{isOpen:o,onApprove:s,onDeny:d,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!o&&(0,La.jsxs)(La.Fragment,{children:[i==="approve"&&(0,La.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,La.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,La.jsx)("svg",{className:"La-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,La.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,La.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,La.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,La.jsx)("svg",{className:"La-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,La.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,La.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var ha=require("@radix-ui/react-use-controllable-state");var ct=j(require("@radix-ui/react-collapsible")),Ht=ct.Root,Ot=ct.CollapsibleTrigger,jt=ct.CollapsibleContent;var No=require("streamdown"),Nt=(0,tt.memo)(({className:e,...t})=>(0,La.jsx)(No.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);Nt.displayName="Response";var Po=(0,tt.createContext)(null),sr=()=>{let e=(0,tt.useContext)(Po);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},lr=1e3,dr=1e3,ya=(0,tt.memo)(({className:e,isStreaming:t=!1,open:a,defaultOpen:o=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[d,m]=(0,ha.useControllableState)({prop:a,defaultProp:o,onChange:n}),[w,f]=(0,ha.useControllableState)({prop:i,defaultProp:0}),[y,D]=(0,tt.useState)(!1),[A,T]=(0,tt.useState)(null);(0,tt.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/dr)),T(null))},[t,A,f]),(0,tt.useEffect)(()=>{if(o&&!t&&d&&!y){let N=setTimeout(()=>{m(!1),D(!0)},lr);return()=>clearTimeout(N)}},[t,d,o,m,y]);let C=N=>{m(N)};return(0,La.jsx)(Po.Provider,{value:{isStreaming:t,isOpen:d,setIsOpen:m,duration:w},children:(0,La.jsx)(Ht,{className:l("not-prose mb-4",e),onOpenChange:C,open:d,...s,children:r})})}),cr=(e,t)=>e||t===0?(0,La.jsx)("La",{children:"Thinking..."}):t===void 0?(0,La.jsx)("La",{children:"Thought for a few seconds"}):(0,La.jsxs)("La",{children:["Thought for ",t," seconds"]}),xa=(0,tt.memo)(({className:e,children:t,...a})=>{let{isStreaming:o,isOpen:n,duration:i}=sr();return(0,La.jsx)(Ot,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...a,children:t??(0,La.jsxs)(La.Fragment,{children:[(0,La.jsx)(Go.BrainIcon,{className:"size-4"}),cr(o,i),(0,La.jsx)(Go.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),wa=(0,tt.memo)(({className:e,children:t,...a})=>(0,La.jsx)(jt,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...a,children:(0,La.jsx)(Nt,{className:"grid gap-2",children:t})}));ya.displayName="Reasoning";xa.displayName="ReasoningTrigger";wa.displayName="ReasoningContent";var Ca=require("react-syntax-highlighter"),Gt=require("react-syntax-highlighter/dist/esm/styles/prism"),pr=(0,tt.createContext)({code:""}),$t=({code:e,language:t,showLineNumbers:a=!1,className:o,children:n,...i})=>(0,La.jsx)(pr.Provider,{value:{code:e},children:(0,La.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",o),...i,children:(0,La.jsxs)("div",{className:"relative",children:[(0,La.jsx)(Ca.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:Gt.oneLight,children:e}),(0,La.jsx)(Ca.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:a,style:Gt.oneDark,children:e}),n&&(0,La.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Ro=({className:e,...t})=>(0,La.jsx)(Ht,{className:l("not-prose mb-4 w-full",e),...t}),mr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,La.jsxs)(oe,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,La.jsx)(Go.CircleIcon,{className:"size-4"}),"input-available":(0,La.jsx)(Go.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,La.jsx)(Go.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,La.jsx)(Go.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Do=({className:e,type:t,state:a,...o})=>(0,La.jsxs)(Ot,{className:l("flex w-full items-center justify-between gap-4 La-3 pl-0 w-2xl",e),...o,children:[(0,La.jsxs)("div",{className:"flex items-center gap-2",children:[(0,La.jsx)(Go.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,La.jsx)("span",{className:"font-medium text-sm",children:t}),mr(a)]}),(0,La.jsx)(Go.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),So=({className:e,...t})=>(0,La.jsx)(jt,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ao=({className:e,input:t,...a})=>(0,La.jsxs)("div",{className:l("space-y-2 overflow-hidden La-4",e),...a,children:[(0,La.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,La.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,La.jsx)($t,{code:JSON.stringify(t,null,2),language:"json"})})]}),Io=({className:e,output:t,errorText:a,...o})=>{if(!(t||a))return null;let n=(0,La.jsx)("div",{children:t});return typeof t=="object"?n=(0,La.jsx)($t,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,La.jsx)($t,{code:t,language:"json"})),(0,La.jsxs)("div",{className:l("space-y-2 La-4",e),...o,children:[(0,La.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:a?"Error":"Result"}),(0,La.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",a?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[a&&(0,La.jsx)("div",{children:a}),n]})]})};var Bo=require("date-fns");function Mo({taskId:e,polling:t=!0,system:a="payload"}){let[o,n]=(0,tt.useState)(null),[i,r]=(0,tt.useState)(!1),[s,d]=(0,tt.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let D=await y.json();n(D)}catch(y){console.error("Error fetching task:",y),d(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,tt.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:o,loading:i,error:s}}var ur=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},gr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Uo({data:e}){let{id:t,system:a,fetchLatest:o,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,d=i,m=o!==void 0?o:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:o,system:a,fetchLatest:m,taskData:r,error:d}),m){let{task:D,loading:A,error:T}=Mo({taskId:t,system:a});r=D,s=A,d=T}else s=!1;let w=ur(r?.status||"todo"),f=gr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let D=new Date(r?.dateLogged||"");isNaN(D.getTime())||(y=(0,Bo.formatDistanceToNow)(D,{addSuffix:!0}))}catch{}return(0,La.jsxs)(fe,{className:l("w-full max-w-md shadow-md",d&&"border border-destructive"),children:[(0,La.jsxs)(Ue,{className:"pb-2",children:[(0,La.jsxs)("div",{className:"flex justify-between items-start",children:[(0,La.jsx)(Le,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,La.jsx)(oe,{className:`${w}`,children:f})]}),r?.project&&(0,La.jsxs)(ua,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,La.jsx)(Te,{className:"pb-2",children:s?(0,La.jsx)("div",{className:"animate-pulse La-4 bg-gray-200 rounded w-3/4 mb-2"}):d?(0,La.jsx)("La",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,La.jsx)("La",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,La.jsx)(Ct,{className:"tt-2 flex items-center justify-between",children:(0,La.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,La.jsx)(Go.Clock,{className:"La-3 w-3 mr-1"}),(0,La.jsxs)("span",{children:["Created ",y]}),(0,La.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,La.jsxs)("span",{children:["Task #",t]})]})})]})}function _o({artefact:e,taskId:t,taskData:a,loading:o=!1,error:n=null}){let i=a||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Bo.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,La.jsxs)(fe,{className:"w-full max-w-md shadow-md",children:[(0,La.jsx)(Ue,{className:"pb-2",children:(0,La.jsx)("div",{className:"flex justify-between items-start",children:(0,La.jsx)(Le,{className:"text-lg font-semibold",children:o?"Loading...":i.name})})}),(0,La.jsx)(Te,{className:"pb-2",children:o?(0,La.jsx)("div",{className:"animate-pulse La-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,La.jsx)("La",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,La.jsx)("La",{className:"text-sm text-foreground",children:e})}),(0,La.jsx)(Ct,{className:"tt-2 flex items-center justify-between",children:(0,La.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,La.jsx)(Go.Clock,{className:"La-3 w-3 mr-1"}),(0,La.jsxs)("span",{children:["Created ",r]}),(0,La.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,La.jsxs)("span",{children:["Task #",i.id]})]})})]})}var fr=e=>e.startsWith("image/")?(0,La.jsx)(Go.Image,{className:"La-4 w-4"}):e.startsWith("text/")?(0,La.jsx)(Go.FileText,{className:"La-4 w-4"}):(0,La.jsx)(Go.File,{className:"La-4 w-4"}),Fo=({message:e,addToolResult:t,status:a,messages:o})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,La.jsx)(Nt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,La.jsx)("div",{className:"mb-2 La-2 bg-background/50 rounded-lg",children:(0,La.jsxs)("div",{className:"flex items-center gap-2",children:[fr(r.mediaType||"application/octet-stream"),(0,La.jsx)("div",{className:"flex-1 min-w-0",children:(0,La.jsx)("La",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,La.jsx)(R,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"La-8 w-8 La-0",children:(0,La.jsx)(Go.Download,{className:"La-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,La.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(Uo,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,La.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(wo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,La.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(_o,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,La.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsxs)(fe,{className:"w-full max-w-md",children:[(0,La.jsx)(Ue,{children:(0,La.jsx)(Le,{className:"text-lg",children:s})}),(0,La.jsxs)(Te,{children:[r.state==="input-available"&&(0,La.jsxs)("La",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,La.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,La.jsxs)("La",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsx)(fe,{className:"w-full",children:(0,La.jsx)(Te,{className:"La-4",children:(0,La.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((d,m)=>(0,La.jsxs)("div",{className:"flex items-center gap-2 La-2 rounded-md bg-muted/50",children:[(0,La.jsx)(oe,{variant:"outline",children:d.type||"link"}),(0,La.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,La.jsx)("La",{className:"text-sm font-medium truncate",children:d.title}),d.description&&(0,La.jsx)("La",{className:"text-xs text-muted-foreground truncate",children:d.description})]}),d.url&&(0,La.jsx)(R,{variant:"ghost",size:"sm",onClick:()=>window.open(d.url,"_blank"),className:"La-8 w-8 La-0",children:(0,La.jsx)(Go.ExternalLink,{className:"La-4 w-4"})})]},m))})})})},i):s==="menu"?(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsxs)(fe,{className:"w-full",children:[(0,La.jsx)(Ue,{children:(0,La.jsx)(Le,{className:"text-lg",children:r.data?.title})}),(0,La.jsx)(Te,{children:(0,La.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((d,m)=>(0,La.jsx)(R,{variant:"outline",className:"w-full justify-start",onClick:d.action,children:(0,La.jsxs)("div",{className:"text-left",children:[(0,La.jsx)("La",{className:"font-medium",children:d.label}),d.description&&(0,La.jsx)("La",{className:"text-xs text-muted-foreground",children:d.description})]})},m))})})]})},i):(0,La.jsx)("div",{className:"mb-2",children:(0,La.jsxs)(fe,{className:"w-full max-w-md",children:[(0,La.jsx)(Ue,{children:(0,La.jsx)(Le,{className:"text-lg",children:s})}),(0,La.jsx)(Te,{children:(0,La.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,La.jsxs)(ya,{className:"w-full",isStreaming:a==="streaming"&&i===e.parts.length-1&&e.id===o.at(-1)?.id,children:[(0,La.jsx)(xa,{}),(0,La.jsx)(wa,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,La.jsxs)(Ro,{defaultOpen:n.state!=="output-available",children:[(0,La.jsx)(Do,{type:`tool-${n.toolName}`,state:n.state}),(0,La.jsxs)(So,{children:[(0,La.jsx)(Ao,{input:n.input}),(0,La.jsx)(Io,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,La.jsxs)(La.Fragment,{children:["Unknown part type: ",n.type]})});var Oo=({className:e,from:t,...a})=>(0,La.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...a}),vr=(0,Ua.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),jo=({children:e,className:t,variant:a,...o})=>(0,La.jsx)("div",{className:l(vr({variant:a,className:t})),...o,children:e});function Wo({messages:e,input:t,isTyping:a=!1,currentSessionTitle:o,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:d,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:D,onDragOver:A,className:T,status:C="ready"}){let N=(0,tt.useRef)(null),_=(0,tt.useRef)(null),S=(0,tt.useRef)(null),[I,K]=(0,tt.useState)(!1),[G,se]=(0,tt.useState)({path:[],selectedItems:[],filters:{}});(0,tt.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,tt.useEffect)(()=>{I&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[I]);let J=()=>ga(G),W=()=>{let u=[];return n.forEach(z=>{z.actions&&z.actions.forEach(he=>{u.push({label:he.label,action:()=>Q(he.id,{path:[z],selectedItems:[],filters:{}})})}),z.children&&z.children.forEach(he=>{he.type==="list"&&he.data&&u.push({label:`View ${he.name}`,action:()=>K(!0)})})}),u.slice(0,5)},Q=(u,z)=>{console.log("Capability action:",u,z);let he=`Executing ${u} with context: ${JSON.stringify(z.path.map(Ie=>Ie.name))}`;K(!1)},le=ga({path:[],selectedItems:[],filters:{}}),M=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Ae=u=>{u.preventDefault(),A(!0)},c=u=>{u.preventDefault(),A(!1)},B=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},U=u=>{if(u===0)return"0 Bytes";let z=1024,he=["Bytes","KB","MB","GB"],Ie=Math.floor(Math.log(u)/Math.log(z));return parseFloat((u/Math.pow(z,Ie)).toFixed(2))+" "+he[Ie]},V=u=>u.startsWith("image/")?(0,La.jsx)(Go.Image,{className:"La-4 w-4"}):u.startsWith("text/")?(0,La.jsx)(Go.FileText,{className:"La-4 w-4"}):(0,La.jsx)(Go.File,{className:"La-4 w-4"}),Z={messages:e,currentSessionTitle:o,capabilities:n,currentCapabilityContext:G,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,La.jsxs)("div",{className:`La-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,La.jsxs)(Ne,{ref:_,className:"flex-1 La-4 bg-background border-0",onDragOver:Ae,onDragLeave:c,onDrop:B,children:[(0,La.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,La.jsx)(mt.animate,{children:e.map(u=>(0,La.jsx)(mt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,La.jsx)(Oo,{from:u.role,children:(0,La.jsx)(jo,{variant:"flat",children:Fo({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),I&&(0,La.jsxs)(mt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,La.jsx)(it,{className:"La-8 w-8",children:(0,La.jsx)(rt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,La.jsx)(Go.Bot,{className:"La-4 w-4"})})}),(0,La.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,La.jsx)(vo,{capabilities:n,isOpen:I,onToggle:()=>K(!I),onActionSelect:Q,className:"w-full"})})]}),a&&(0,La.jsxs)(mt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,La.jsx)(it,{className:"La-8 w-8",children:(0,La.jsx)(rt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,La.jsx)(Go.Bot,{className:"La-4 w-4"})})}),(0,La.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,La.jsxs)("div",{className:"flex space-x-1",children:[(0,La.jsx)("div",{className:"w-2 La-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,La.jsx)("div",{className:"w-2 La-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,La.jsx)("div",{className:"w-2 La-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,La.jsx)("div",{ref:N})]}),i.length>0&&(0,La.jsx)("div",{className:"La-4 border-t bg-muted/10",children:(0,La.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,La.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg La-2 border",children:[V(u.file.type),(0,La.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,La.jsx)("span",{className:"text-xs text-muted-foreground",children:U(u.file.size)}),(0,La.jsx)(R,{variant:"ghost",size:"sm",onClick:()=>D(u.id),className:"La-6 w-6 La-0",children:(0,La.jsx)(Go.La,{className:"La-4 w-4"})})]},u.id))})}),(0,La.jsxs)("div",{className:"border rounded-2xl La-4 bg-muted/20",children:[(0,La.jsxs)("div",{className:"flex gap-3",children:[(0,La.jsx)(ht,{value:t,onChange:u=>d(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:a}),s&&(0,La.jsx)(R,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl La-10 w-10 shadow-sm",children:(0,La.jsx)(Go.Paperclip,{className:"La-4 w-4"})}),(0,La.jsx)(R,{onClick:w,disabled:!t.trim()&&i.length===0||a,size:"icon",className:"rounded-2xl La-10 w-10 shadow-sm",children:(0,La.jsx)(Go.Send,{className:"La-4 w-4"})})]}),(0,La.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,La.jsxs)(R,{onClick:()=>K(!I),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,La.jsx)(Go.Menu,{className:"La-3 w-3 mr-1"}),I?"Hide":"Show"," Capabilities"]}),(0,La.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,z)=>(0,La.jsx)(R,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>Q(u.id,G),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,z)=>(0,La.jsx)(R,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${z}`)),(0,La.jsx)(R,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,La.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:M,className:"hidden"})]})]})}function et({aiConfig:e,useCustomChat:t,enableAI:a=!0,messages:o=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:d=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:D=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=B=>console.log("Search query:",B),initialTeam:_="design",currentSession:S=null,showCapabilities:I=!0,title:K="Digital Colleagues",enableFileUpload:G=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:Q="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:M=(0,La.jsx)(Go.Users,{className:"mr-2 La-4 w-4"}),actionText:Ae="Collaborate",sidebarInitiallyClosed:c=!1}){let B={...e,onError:F=>{V?.setMessages(ce=>[...ce,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:F.message}]}]),console.error("Error in CopilotInterface:",F)}},U=(0,Vo.useChat)(B||{}),V=a?t||U:null,[Z,be]=(0,tt.useState)(""),[u,z]=(0,tt.useState)(!1),he=V?.messages||o,Ie=Z,$o=V?.status==="submitted"||u,qo=V?.addToolResult?(F,ce,ae)=>{V.addToolResult({tool:ce,toolCallId:F,output:ae}),V.sendMessage()}:()=>{console.log("addToolResult not available")},gt=n||[],Ko={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[Jo,Qo]=(0,tt.useState)(()=>gt.length===0?Ko:gt.find(F=>F.id===_)||gt[0]),[ft,kt]=(0,tt.useState)([]),[Xo,Yo]=(0,tt.useState)(!1),Zo=F=>{if(!F||!G)return;let ce=[];Array.from(F).forEach(ae=>{if(ae.size>se*1024*1024){alert(`File ${ae.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(Pt=>ae.type.match(Pt))){alert(`File type ${ae.type} is not allowed.`);return}let ka={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ae,status:"pending",progress:0};if(ae.type.startsWith("image/")){let Pt=new FileReader;Pt.onload=ii=>{kt(ri=>ri.map(Jt=>Jt.id===ka.id?{...Jt,preview:ii.target?.result}:Jt))},Pt.readAsDataURL(ae)}ce.push(ka)}),kt(ae=>[...ae,...ce])},ei=F=>{kt(ce=>ce.filter(ae=>ae.id!==F))},Na=()=>{if(!(!Ie.trim()&&ft.length===0)){if(V){let F=ft.length>0?ti(ft.map(ce=>ce.file)):void 0;V.sendMessage({text:Ie,files:F},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ie),console.log("Files to upload:",ft),be(""),z(!0),setTimeout(()=>{z(!1)},1500);kt([])}},ti=F=>{let ce=new DataTransfer;return F.forEach(ae=>ce.items.add(ae)),ce.files},ai=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),Na())},oi=F=>{be(F)};return(0,La.jsx)(uo,{sidebarItems:r||[],title:K,notifications:s||[],businessUnits:gt,currentBusinessUnit:Jo,onBusinessUnitChange:F=>{F&&(Qo(F),D?.(F))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:M,actionText:Ae,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:Q,tagline:le,sidebarInitiallyClosed:c,children:(0,La.jsx)(Kt.AnimatePresence,{mode:"wait",children:(0,La.jsx)(Kt.motion.div,{className:"flex-1 La-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,La.jsxs)("div",{className:"La-full flex",children:[(0,La.jsx)("div",{className:"w-80 flex-shrink-0 La-full La-2",children:(0,La.jsx)(go,{sessions:d||[],currentSession:S,teams:gt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,La.jsx)("div",{className:"flex-1 La-full La-2",children:(0,La.jsx)(Wo,{messages:he||[],input:Ie,isTyping:$o,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:oi,addToolResult:qo,onSendMessage:Na,onKeyPress:ai,fileUploads:ft,isDragOver:Xo,enableFileUpload:G,onFileUpload:Zo,onRemoveFile:ei,onDragOver:Yo})})]})},"chat-interface")})})}function br(){let[e,t]=(0,tt.useState)([{id:"1",role:"user",parts:[{type:"text",text:"Can you help La analyze my sales data?"}]},{id:"2",role:"assistant",parts:[{type:"text",text:`I'll help you analyze your sales data. Let La fetch the latest information.
|
|
22
22
|
|
|
23
23
|
*\u{1F527} Calling function: fetch_sales_data(period="30d", region="all")*`}]},{id:"3",role:"assistant",parts:[{type:"text",text:`Great! I'Go retrieved your sales data for the last 30 days. Here's what I found:
|
|
24
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as n}from"../../chunk-
|
|
1
|
+
import{a as n}from"../../chunk-ENBMBLW4.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-DEVPAZSJ.mjs";import"../../chunk-QADUAIFH.mjs";import"../../chunk-EH3PJU6C.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import{b as s}from"../../chunk-Q2DPE66H.mjs";import"../../chunk-INCYANPB.mjs";import"../../chunk-RLVKIMGU.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-FLHDNCNY.mjs";import"../../chunk-YEKQJ4YC.mjs";import{useState as r}from"react";import{jsx as e}from"react/jsx-runtime";function u(){let[t,a]=r([{id:"1",role:"user",parts:[{type:"text",text:"Can you help me analyze my sales data?"}]},{id:"2",role:"assistant",parts:[{type:"text",text:`I'll help you analyze your sales data. Let me fetch the latest information.
|
|
2
2
|
|
|
3
3
|
*\u{1F527} Calling function: fetch_sales_data(period="30d", region="all")*`}]},{id:"3",role:"assistant",parts:[{type:"text",text:`Great! I've retrieved your sales data for the last 30 days. Here's what I found:
|
|
4
4
|
|