cortex-react-components 2.18.1 → 2.18.3
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-VRE6VCHX.mjs → chunk-2BR55L74.mjs} +1 -1
- package/dist/{chunk-4SRUEQTP.mjs → chunk-33CHGT4N.mjs} +1 -1
- package/dist/{chunk-7OMPPFGG.mjs → chunk-3EGSOIRH.mjs} +1 -1
- package/dist/{chunk-5KO67YNF.mjs → chunk-3ZQFJ5WD.mjs} +1 -1
- package/dist/{chunk-LHO4WFYP.mjs → chunk-5FWH5YVM.mjs} +1 -1
- package/dist/{chunk-HGL6JHJQ.mjs → chunk-5PZT7ZV2.mjs} +1 -1
- package/dist/{chunk-U3FYDDE2.mjs → chunk-6EKGV4I2.mjs} +1 -1
- package/dist/{chunk-2GM2LPLB.mjs → chunk-ANCSWAD7.mjs} +1 -1
- package/dist/{chunk-DEVPAZSJ.mjs → chunk-AXPE5U2T.mjs} +1 -1
- package/dist/{chunk-R6AYIVIR.mjs → chunk-CCJJAUGB.mjs} +1 -1
- package/dist/{chunk-WYLCN44C.mjs → chunk-CH3CCSBB.mjs} +1 -1
- package/dist/{chunk-BQQ4V4PX.mjs → chunk-CTC6WSB6.mjs} +1 -1
- package/dist/{chunk-O24GFE6Q.mjs → chunk-DX3G3FKT.mjs} +1 -1
- package/dist/{chunk-HDKHF3EA.mjs → chunk-GO42W2BM.mjs} +1 -1
- package/dist/{chunk-GAZHKHGB.mjs → chunk-HLTP3ZQN.mjs} +1 -1
- package/dist/chunk-IFU7M7BO.mjs +1 -0
- package/dist/{chunk-75WE6ZXB.mjs → chunk-ITJH72Z2.mjs} +1 -1
- package/dist/{chunk-JYPPWTB3.mjs → chunk-JK2VAKPT.mjs} +1 -1
- package/dist/{chunk-PNUBVBSR.mjs → chunk-JNJJAJPI.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-FEWOSBUJ.mjs → chunk-MEVSHOG4.mjs} +1 -1
- package/dist/{chunk-FYQBRCQM.mjs → chunk-MFUZNS7C.mjs} +1 -1
- package/dist/{chunk-GETYSIZV.mjs → chunk-MGSTQLZC.mjs} +1 -1
- package/dist/{chunk-P7S6XFU4.mjs → chunk-MX3JKY3V.mjs} +1 -1
- package/dist/{chunk-ZFUP5NVF.mjs → chunk-O5P35LEY.mjs} +1 -1
- package/dist/{chunk-KVLUT4U2.mjs → chunk-OXKN6X62.mjs} +1 -1
- package/dist/{chunk-RIRZRO6U.mjs → chunk-P55W6AFU.mjs} +1 -1
- package/dist/{chunk-IG36QUEI.mjs → chunk-PAEL4O5F.mjs} +1 -1
- package/dist/{chunk-2OOJ4ZFB.mjs → chunk-QILFMWE5.mjs} +1 -1
- package/dist/{chunk-3ANJOET7.mjs → chunk-QZIJTAPO.mjs} +1 -1
- package/dist/{chunk-P6OSMPUQ.mjs → chunk-R33MOMFK.mjs} +1 -1
- package/dist/{chunk-PTZT4QJW.mjs → chunk-RMZLEIRP.mjs} +1 -1
- package/dist/{chunk-T5HJS6OF.mjs → chunk-RSDUFAIB.mjs} +1 -1
- package/dist/{chunk-HKMNAXLM.mjs → chunk-VQBOJHZF.mjs} +1 -1
- package/dist/{chunk-UZSBX5GO.mjs → chunk-X3JZSN3W.mjs} +1 -1
- package/dist/{chunk-VNYUNZ3M.mjs → chunk-XGIYNUGC.mjs} +1 -1
- package/dist/chunk-XRW62PGB.mjs +4 -0
- package/dist/{chunk-AQQCH7Z2.mjs → chunk-XX4GSGRP.mjs} +1 -1
- package/dist/{chunk-FMV74RKL.mjs → chunk-XYJ4S67W.mjs} +1 -1
- package/dist/{chunk-F64CA5CH.mjs → chunk-YPSUDHCJ.mjs} +1 -1
- package/dist/{chunk-MO4HRQEL.mjs → chunk-YWRU7OE3.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/ImageBlock.mjs +1 -1
- package/dist/components/Blocks/MediaBlock.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/ChatInterface.js +1 -1
- package/dist/components/Chat/ChatInterface.mjs +1 -1
- package/dist/components/Chat/CopilotInterface.js +1 -1
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.d.ts +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.js +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
- package/dist/components/Chat/PartTypes/index.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 +5 -5
- 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/CollectionArchive/index.mjs +1 -1
- package/dist/components/Payload/Media/index.mjs +1 -1
- package/dist/components/Payload/PayloadCard/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 +5 -5
- 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 +6 -6
- 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/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-7JX3L2MA.mjs +0 -4
- package/dist/chunk-QADUAIFH.mjs +0 -1
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
`,children:r?"Processing...":"Deny"}),(0,Oo.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 ka=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=wo.default.useState(!0),[i,r]=wo.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,Oo.jsxs)("div",{className:"mb-2",children:[(0,Oo.jsx)(Na,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Oo.jsxs)(Oo.Fragment,{children:[i==="approve"&&(0,Oo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Oo.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,Oo.jsx)("svg",{className:"Oo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Oo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Oo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Oo.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,Oo.jsx)("svg",{className:"Oo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Oo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Oo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var Co=require("@radix-ui/react-use-controllable-state");var mt=V(require("@radix-ui/react-collapsible")),Wt=mt.Root,Gt=mt.CollapsibleTrigger,$t=mt.CollapsibleContent;var Ta=require("streamdown"),Tt=(0,ft.memo)(({className:e,...t})=>(0,Oo.jsx)(Ta.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);Tt.displayName="Response";var Ra=(0,ft.createContext)(null),dr=()=>{let e=(0,ft.useContext)(Ra);if(!e)throw new Error("Reasoning components must _a used within Reasoning");return e},pr=1e3,mr=1e3,No=(0,ft.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,Co.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,Co.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,ft.useState)(!1),[I,T]=(0,ft.useState)(null);(0,ft.useEffect)(()=>{t?I===null&&T(Date.now()):I!==null&&(f(Math.ceil((Date.now()-I)/mr)),T(null))},[t,I,f]),(0,ft.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},pr);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Oo.jsx)(Ra.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Oo.jsx)(Wt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),ur=(e,t)=>e||t===0?(0,Oo.jsx)("Oo",{children:"Thinking..."}):t===void 0?(0,Oo.jsx)("Oo",{children:"Thought for a few seconds"}):(0,Oo.jsxs)("Oo",{children:["Thought for ",t," seconds"]}),ko=(0,ft.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=dr();return(0,Oo.jsx)(Gt,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Oo.jsxs)(Oo.Fragment,{children:[(0,Oo.jsx)(_a.BrainIcon,{className:"size-4"}),ur(a,i),(0,Oo.jsx)(_a.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),Po=(0,ft.memo)(({className:e,children:t,...o})=>(0,Oo.jsx)($t,{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,Oo.jsx)(Tt,{className:"grid gap-2",children:t})}));No.displayName="Reasoning";ko.displayName="ReasoningTrigger";Po.displayName="ReasoningContent";var To=require("react-syntax-highlighter"),_t=require("react-syntax-highlighter/dist/esm/styles/prism"),gr=(0,ft.createContext)({code:""}),Jt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Oo.jsx)(gr.Provider,{value:{code:e},children:(0,Oo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Oo.jsxs)("div",{className:"relative",children:[(0,Oo.jsx)(To.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:_t.oneLight,children:e}),(0,Oo.jsx)(To.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:_t.oneDark,children:e}),n&&(0,Oo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Aa=({className:e,...t})=>(0,Oo.jsx)(Wt,{className:l("not-prose mb-4 w-full",e),...t}),fr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Oo.jsxs)(ie,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Oo.jsx)(_a.CircleIcon,{className:"size-4"}),"input-available":(0,Oo.jsx)(_a.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Oo.jsx)(_a.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Oo.jsx)(_a.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Ia=({className:e,type:t,state:o,...a})=>(0,Oo.jsxs)(Gt,{className:l("flex w-full items-center justify-between gap-4 Oo-3 pl-0 w-2xl",e),...a,children:[(0,Oo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Oo.jsx)(_a.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Oo.jsx)("span",{className:"font-medium text-sm",children:t}),fr(o)]}),(0,Oo.jsx)(_a.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Ma=({className:e,...t})=>(0,Oo.jsx)($t,{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}),Ba=({className:e,input:t,...o})=>(0,Oo.jsxs)("div",{className:l("space-y-2 overflow-hidden Oo-4",e),...o,children:[(0,Oo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Oo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Oo.jsx)(Jt,{code:JSON.stringify(t,null,2),language:"json"})})]}),La=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Oo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Oo.jsx)(Jt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Oo.jsx)(Jt,{code:t,language:"json"})),(0,Oo.jsxs)("div",{className:l("space-y-2 Oo-4",e),...a,children:[(0,Oo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Oo.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,Oo.jsx)("div",{children:o}),n]})]})};var Ua=require("date-fns");function Ea({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,ft.useState)(null),[i,r]=(0,ft.useState)(!1),[s,c]=(0,ft.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,ft.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 br=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"}},vr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Fa({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:I,error:T}=Ea({taskId:t,system:o});r=R,s=I,c=T}else s=!1;let w=br(r?.status||"todo"),f=vr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Ua.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Oo.jsxs)(fe,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Oo.jsxs)(Ee,{className:"pb-2",children:[(0,Oo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Oo.jsx)(ze,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Oo.jsx)(ie,{className:`${w}`,children:f})]}),r?.project&&(0,Oo.jsxs)(vo,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Oo.jsx)(Pe,{className:"pb-2",children:s?(0,Oo.jsx)("div",{className:"animate-pulse Oo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Oo.jsx)("Oo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Oo.jsx)("Oo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Oo.jsx)(Pt,{className:"pt-2 flex items-center justify-between",children:(0,Oo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Oo.jsx)(_a.Clock,{className:"Oo-3 w-3 mr-1"}),(0,Oo.jsxs)("span",{children:["Created ",y]}),(0,Oo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Oo.jsxs)("span",{children:["Task #",t]})]})})]})}function Oa({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,Ua.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Oo.jsxs)(fe,{className:"w-full max-w-md shadow-md",children:[(0,Oo.jsx)(Ee,{className:"pb-2",children:(0,Oo.jsx)("div",{className:"flex justify-between items-start",children:(0,Oo.jsx)(ze,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Oo.jsx)(Pe,{className:"pb-2",children:a?(0,Oo.jsx)("div",{className:"animate-pulse Oo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Oo.jsx)("Oo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Oo.jsx)("Oo",{className:"text-sm text-foreground",children:e})}),(0,Oo.jsx)(Pt,{className:"pt-2 flex items-center justify-between",children:(0,Oo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Oo.jsx)(_a.Clock,{className:"Oo-3 w-3 mr-1"}),(0,Oo.jsxs)("span",{children:["Created ",r]}),(0,Oo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Oo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var hr=e=>e.startsWith("image/")?(0,Oo.jsx)(_a.Image,{className:"Oo-4 w-4"}):e.startsWith("text/")?(0,Oo.jsx)(_a.FileText,{className:"Oo-4 w-4"}):(0,Oo.jsx)(_a.File,{className:"Oo-4 w-4"}),Va=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Oo.jsx)(Tt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Oo.jsx)("div",{className:"mb-2 Oo-2 bg-background/50 rounded-lg",children:(0,Oo.jsxs)("div",{className:"flex items-center gap-2",children:[hr(r.mediaType||"application/octet-stream"),(0,Oo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Oo.jsx)("Oo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Oo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Oo-8 w-8 Oo-0",children:(0,Oo.jsx)(_a.Download,{className:"Oo-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,Oo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(Fa,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Oo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(xo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(xo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(ka,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Oo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(Oa,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Oo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsxs)(fe,{className:"w-full max-w-md",children:[(0,Oo.jsx)(Ee,{children:(0,Oo.jsx)(ze,{className:"text-lg",children:s})}),(0,Oo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Oo.jsxs)("Oo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Oo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Oo.jsxs)("Oo",{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,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(fe,{className:"w-full",children:(0,Oo.jsx)(Pe,{className:"Oo-4",children:(0,Oo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Oo.jsxs)("div",{className:"flex items-center gap-2 Oo-2 rounded-md bg-muted/50",children:[(0,Oo.jsx)(ie,{variant:"outline",children:c.type||"link"}),(0,Oo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Oo.jsx)("Oo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Oo.jsx)("Oo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Oo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Oo-8 w-8 Oo-0",children:(0,Oo.jsx)(_a.ExternalLink,{className:"Oo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsxs)(fe,{className:"w-full",children:[(0,Oo.jsx)(Ee,{children:(0,Oo.jsx)(ze,{className:"text-lg",children:r.data?.title})}),(0,Oo.jsx)(Pe,{children:(0,Oo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Oo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Oo.jsxs)("div",{className:"text-left",children:[(0,Oo.jsx)("Oo",{className:"font-medium",children:c.label}),c.description&&(0,Oo.jsx)("Oo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsxs)(fe,{className:"w-full max-w-md",children:[(0,Oo.jsx)(Ee,{children:(0,Oo.jsx)(ze,{className:"text-lg",children:s})}),(0,Oo.jsx)(Pe,{children:(0,Oo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}return n.type==="reasoning"?(0,Oo.jsxs)(No,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.Oo(-1)?.id,children:[(0,Oo.jsx)(ko,{}),(0,Oo.jsx)(Po,{children:n.text})]},`${i}`):n.type==="dynamic-tool"?(0,Oo.jsxs)(Aa,{defaultOpen:n.state!=="output-available",children:[(0,Oo.jsx)(Ia,{type:`tool-${n.toolName}`,state:n.state}),(0,Oo.jsxs)(Ma,{children:[(0,Oo.jsx)(Ba,{input:n.input}),(0,Oo.jsx)(La,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`):(0,Oo.jsxs)(Oo.Fragment,{children:["Unknown part type: ",n.type]})});var Ga=({className:e,from:t,...o})=>(0,Oo.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}),yr=(0,jo.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"}}),$a=({children:e,className:t,variant:o,...a})=>(0,Oo.jsx)("div",{className:l(yr({variant:o,className:t})),...a,children:e});function qa({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:I,className:T,status:C="ready"}){let N=(0,ft.useRef)(null),F=(0,ft.useRef)(null),S=(0,ft.useRef)(null),[M,_]=(0,ft.useState)(!1),[$,le]=(0,ft.useState)({path:[],selectedItems:[],filters:{}});(0,ft.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,ft.useEffect)(()=>{M&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[M]);let J=()=>ho($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(he=>{u.push({label:he.label,action:()=>X(he.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(he=>{he.type==="list"&&he.data&&u.push({label:`View ${he.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let he=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},ce=ho({path:[],selectedItems:[],filters:{}}),B=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),I(!0)},d=u=>{u.preventDefault(),I(!1)},E=u=>{u.preventDefault(),I(!1),y(u.dataTransfer.files)},z=u=>{if(u===0)return"0 Bytes";let U=1024,he=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+he[Ae]},G=u=>u.startsWith("image/")?(0,Oo.jsx)(_a.Image,{className:"Oo-4 w-4"}):u.startsWith("text/")?(0,Oo.jsx)(_a.FileText,{className:"Oo-4 w-4"}):(0,Oo.jsx)(_a.File,{className:"Oo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:ce,getQuickSuggestions:W().map(u=>u.label)},ve=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Oo.jsxs)("div",{className:`Oo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Oo.jsxs)(Ce,{ref:F,className:"flex-1 Oo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:E,children:[(0,Oo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Oo.jsx)(gt.animate,{children:e.map(u=>(0,Oo.jsx)(gt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Oo.jsx)(Ga,{from:u.role,children:(0,Oo.jsx)($a,{variant:"flat",children:Va({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),M&&(0,Oo.jsxs)(gt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Oo.jsx)(nt,{className:"Oo-8 w-8",children:(0,Oo.jsx)(st,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Oo.jsx)(_a.Bot,{className:"Oo-4 w-4"})})}),(0,Oo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Oo.jsx)(ya,{capabilities:n,isOpen:M,onToggle:()=>_(!M),onActionSelect:X,className:"w-full"})})]}),o&&(0,Oo.jsxs)(gt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Oo.jsx)(nt,{className:"Oo-8 w-8",children:(0,Oo.jsx)(st,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Oo.jsx)(_a.Bot,{className:"Oo-4 w-4"})})}),(0,Oo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Oo.jsxs)("div",{className:"flex space-x-1",children:[(0,Oo.jsx)("div",{className:"w-2 Oo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Oo.jsx)("div",{className:"w-2 Oo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Oo.jsx)("div",{className:"w-2 Oo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Oo.jsx)("div",{ref:N})]}),i.length>0&&(0,Oo.jsx)("div",{className:"Oo-4 border-t bg-muted/10",children:(0,Oo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Oo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Oo-2 border",children:[G(u.file.type),(0,Oo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Oo.jsx)("span",{className:"text-xs text-muted-foreground",children:z(u.file.size)}),(0,Oo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Oo-6 w-6 Oo-0",children:(0,Oo.jsx)(_a.X,{className:"Oo-4 w-4"})})]},u.id))})}),(0,Oo.jsxs)("div",{className:"border rounded-2xl Oo-4 bg-muted/20",children:[(0,Oo.jsxs)("div",{className:"flex gap-3",children:[(0,Oo.jsx)(wt,{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,Oo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Oo-10 w-10 shadow-sm",children:(0,Oo.jsx)(_a.Paperclip,{className:"Oo-4 w-4"})}),(0,Oo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Oo-10 w-10 shadow-sm",children:(0,Oo.jsx)(_a.Send,{className:"Oo-4 w-4"})})]}),(0,Oo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Oo.jsxs)(D,{onClick:()=>_(!M),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Oo.jsx)(_a.Menu,{className:"Oo-3 w-3 mr-1"}),M?"Hide":"Show"," Capabilities"]}),(0,Oo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Oo.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,Oo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Oo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:ve,children:"Debug"})]})]}),s&&(0,Oo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:B,className:"hidden"})]})]})}function ot({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:I=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=E=>console.log("Search query:",E),initialTeam:F="design",currentSession:S=null,showCapabilities:M=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:le=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:ce="AI-Powered Workspace",actionIcon:B=(0,Oo.jsx)(_a.Users,{className:"mr-2 Oo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let E={...e,onError:H=>{G?.setMessages(pe=>[...pe,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:H.message}]}]),console.error("Error in CopilotInterface:",H)}},z=(0,Do.useChat)(E||{}),G=o?t||z:null,[Z,ve]=(0,ft.useState)(""),[u,U]=(0,ft.useState)(!1),he=G?.messages||a,Ae=Z,Ja=G?.status==="submitted"||u,Xa=G?.addToolResult?(H,pe,ae)=>{G.addToolResult({tool:pe,toolCallId:H,output:ae}),G.sendMessage()}:()=>{},vt=n||[],Qa={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"},[Ya,Za]=(0,ft.useState)(()=>vt.length===0?Qa:vt.find(H=>H.id===F)||vt[0]),[ht,Dt]=(0,ft.useState)([]),[ei,ti]=(0,ft.useState)(!1),oi=H=>{if(!H||!$)return;let pe=[];Array.from(H).forEach(ae=>{if(ae.size>le*1024*1024){alert(`File ${ae.name} is too large. Maximum size is ${le}MB.`);return}if(J.length>0&&!J.some(Rt=>ae.type.match(Rt))){alert(`File type ${ae.type} is not allowed.`);return}let So={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ae,status:"pending",progress:0};if(ae.type.startsWith("image/")){let Rt=new FileReader;Rt.onload=si=>{Dt(li=>li.map(Yt=>Yt.id===So.id?{...Yt,preview:si.target?.result}:Yt))},Rt.readAsDataURL(ae)}pe.push(So)}),Dt(ae=>[...ae,...pe])},ai=H=>{Dt(pe=>pe.filter(ae=>ae.id!==H))},Ro=()=>{if(!(!Ae.trim()&&ht.length===0)){if(G){let H=ht.length>0?ii(ht.map(pe=>pe.file)):void 0;G.sendMessage({text:Ae,files:H},{body:{timestamp:Date.now()}}),ve("")}else console.log("Message to send:",Ae),console.log("Files to upload:",ht),ve(""),U(!0),setTimeout(()=>{U(!1)},1500);Dt([])}},ii=H=>{let pe=new DataTransfer;return H.forEach(ae=>pe.items.add(ae)),pe.files},ri=H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Ro())},ni=H=>{ve(H)};return(0,Oo.jsx)(ba,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:vt,currentBusinessUnit:Ya,onBusinessUnitChange:H=>{H&&(Za(H),R?.(H))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:B,actionText:Se,onNotificationRemove:I,onRemoveAll:T,logo:W,appName:X,tagline:ce,sidebarInitiallyClosed:d,children:(0,Oo.jsx)(Qt.AnimatePresence,{mode:"wait",children:(0,Oo.jsx)(Qt.motion.div,{className:"flex-1 Oo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Oo.jsxs)("div",{className:"Oo-full flex",children:[(0,Oo.jsx)("div",{className:"w-80 flex-shrink-0 Oo-full Oo-2",children:(0,Oo.jsx)(va,{sessions:c||[],currentSession:S,teams:vt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Oo.jsx)("div",{className:"flex-1 Oo-full Oo-2",children:(0,Oo.jsx)(qa,{messages:he||[],input:Ae,isTyping:Ja,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:ni,addToolResult:Xa,onSendMessage:Ro,onKeyPress:ri,fileUploads:ht,isDragOver:ei,enableFileUpload:$,onFileUpload:oi,onRemoveFile:ai,onDragOver:ti})})]})},"chat-interface")})})}var bt=[{id:"1",title:"AI Assistant Chat",lastMessage:"How can I help you today?"}];function xr(){return(0,Oo.jsx)(ot,{businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"AI-Powered Copilot"})}function wr(){return(0,Oo.jsx)(ot,{aiConfig:{onError:e=>console.error("Chat error:",e)},businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"Custom AI Copilot"})}function Cr(){return(0,Oo.jsx)(ot,{enableAI:!1,messages:[{id:"1",role:"assistant",parts:[{type:"text",text:"This is demo mode - no AI involved!"}]}],businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:t=>console.log("Session selected:",t),onSessionDelete:t=>console.log("Session deleted:",t),title:"Demo Copilot"})}function Nr(){let e=(0,Do.useChat)({onError:t=>console.error("Custom chat error:",t)});return(0,Oo.jsx)(ot,{useCustomChat:e,businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>{e.setMessages([]),console.log("New chat started - messages cleared")},onSessionSelect:t=>console.log("Session selected:",t),onSessionDelete:t=>console.log("Session deleted:",t),title:"Advanced AI Copilot"})}function kr(){return(0,Oo.jsx)(ot,{sidebarInitiallyClosed:!0,businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"Focused AI Chat"})}function Pr(){let e=(0,Do.useChat)({onError:t=>console.error("File upload chat error:",t),onFinish:t=>console.log("Message with files completed:",t)});return(0,Oo.jsx)(ot,{useCustomChat:e,enableAI:!0,enableFileUpload:!0,maxFileSize:10,allowedFileTypes:["image/*","text/*","application/pdf"],businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>{e.setMessages([]),console.log("New file upload chat started - messages cleared")},onSessionSelect:t=>console.log("Session selected:",t),onSessionDelete:t=>console.log("Session deleted:",t),title:"AI Copilot with File Uploads"})}0&&(module.exports={AdvancedAICopilot,CustomAICopilot,DemoCopilot,FileUploadAICopilot,FocusedChatCopilot,SimpleAICopilot});
|
|
21
|
+
`,children:"Cancel"})]})]}):null};var ka=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=wo.default.useState(!0),[i,r]=wo.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,Oo.jsxs)("div",{className:"mb-2",children:[(0,Oo.jsx)(Na,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Oo.jsxs)(Oo.Fragment,{children:[i==="approve"&&(0,Oo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Oo.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,Oo.jsx)("svg",{className:"Oo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Oo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Oo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Oo.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,Oo.jsx)("svg",{className:"Oo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Oo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Oo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var Co=require("@radix-ui/react-use-controllable-state");var mt=V(require("@radix-ui/react-collapsible")),Wt=mt.Root,Gt=mt.CollapsibleTrigger,$t=mt.CollapsibleContent;var Ta=require("streamdown"),Tt=(0,ft.memo)(({className:e,...t})=>(0,Oo.jsx)(Ta.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);Tt.displayName="Response";var Ra=(0,ft.createContext)(null),dr=()=>{let e=(0,ft.useContext)(Ra);if(!e)throw new Error("Reasoning components must _a used within Reasoning");return e},pr=1e3,mr=1e3,No=(0,ft.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,Co.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,Co.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,ft.useState)(!1),[I,T]=(0,ft.useState)(null);(0,ft.useEffect)(()=>{t?I===null&&T(Date.now()):I!==null&&(f(Math.ceil((Date.now()-I)/mr)),T(null))},[t,I,f]),(0,ft.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},pr);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Oo.jsx)(Ra.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Oo.jsx)(Wt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),ur=(e,t)=>e||t===0?(0,Oo.jsx)("Oo",{children:"Thinking..."}):t===void 0?(0,Oo.jsx)("Oo",{children:"Thought for a few seconds"}):(0,Oo.jsxs)("Oo",{children:["Thought for ",t," seconds"]}),ko=(0,ft.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=dr();return(0,Oo.jsx)(Gt,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Oo.jsxs)(Oo.Fragment,{children:[(0,Oo.jsx)(_a.BrainIcon,{className:"size-4"}),ur(a,i),(0,Oo.jsx)(_a.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),Po=(0,ft.memo)(({className:e,children:t,...o})=>(0,Oo.jsx)($t,{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,Oo.jsx)(Tt,{className:"grid gap-2",children:t})}));No.displayName="Reasoning";ko.displayName="ReasoningTrigger";Po.displayName="ReasoningContent";var To=require("react-syntax-highlighter"),_t=require("react-syntax-highlighter/dist/esm/styles/prism"),gr=(0,ft.createContext)({code:""}),Jt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Oo.jsx)(gr.Provider,{value:{code:e},children:(0,Oo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Oo.jsxs)("div",{className:"relative",children:[(0,Oo.jsx)(To.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:_t.oneLight,children:e}),(0,Oo.jsx)(To.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:_t.oneDark,children:e}),n&&(0,Oo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Aa=({className:e,...t})=>(0,Oo.jsx)(Wt,{className:l("not-prose mb-4 w-full",e),...t}),fr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Oo.jsxs)(ie,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Oo.jsx)(_a.CircleIcon,{className:"size-4"}),"input-available":(0,Oo.jsx)(_a.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Oo.jsx)(_a.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Oo.jsx)(_a.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Ia=({className:e,type:t,state:o,...a})=>(0,Oo.jsxs)(Gt,{className:l("flex w-full items-center justify-between gap-4 Oo-3 pl-0 w-2xl",e),...a,children:[(0,Oo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Oo.jsx)(_a.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Oo.jsx)("span",{className:"font-medium text-sm",children:t}),fr(o)]}),(0,Oo.jsx)(_a.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Ma=({className:e,...t})=>(0,Oo.jsx)($t,{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}),Ba=({className:e,input:t,...o})=>(0,Oo.jsxs)("div",{className:l("space-y-2 overflow-hidden Oo-4",e),...o,children:[(0,Oo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Oo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Oo.jsx)(Jt,{code:JSON.stringify(t,null,2),language:"json"})})]}),La=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Oo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Oo.jsx)(Jt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Oo.jsx)(Jt,{code:t,language:"json"})),(0,Oo.jsxs)("div",{className:l("space-y-2 Oo-4",e),...a,children:[(0,Oo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Oo.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,Oo.jsx)("div",{children:o}),n]})]})};var Ua=require("date-fns");function Ea({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,ft.useState)(null),[i,r]=(0,ft.useState)(!1),[s,c]=(0,ft.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,ft.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 br=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"}},vr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Fa({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:I,error:T}=Ea({taskId:t,system:o});r=R,s=I,c=T}else s=!1;let w=br(r?.status||"todo"),f=vr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Ua.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Oo.jsxs)(fe,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Oo.jsxs)(Ee,{className:"pb-2",children:[(0,Oo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Oo.jsx)(ze,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Oo.jsx)(ie,{className:`${w}`,children:f})]}),r?.project&&(0,Oo.jsxs)(vo,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Oo.jsx)(Pe,{className:"pb-2",children:s?(0,Oo.jsx)("div",{className:"animate-pulse Oo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Oo.jsx)("Oo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Oo.jsx)("Oo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Oo.jsx)(Pt,{className:"pt-2 flex items-center justify-between",children:(0,Oo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Oo.jsx)(_a.Clock,{className:"Oo-3 w-3 mr-1"}),(0,Oo.jsxs)("span",{children:["Created ",y]}),(0,Oo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Oo.jsxs)("span",{children:["Task #",t]})]})})]})}function Oa({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,Ua.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Oo.jsxs)(fe,{className:"w-full max-w-md shadow-md",children:[(0,Oo.jsx)(Ee,{className:"pb-2",children:(0,Oo.jsx)("div",{className:"flex justify-between items-start",children:(0,Oo.jsx)(ze,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Oo.jsx)(Pe,{className:"pb-2",children:a?(0,Oo.jsx)("div",{className:"animate-pulse Oo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Oo.jsx)("Oo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Oo.jsx)("Oo",{className:"text-sm text-foreground",children:e})}),(0,Oo.jsx)(Pt,{className:"pt-2 flex items-center justify-between",children:(0,Oo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Oo.jsx)(_a.Clock,{className:"Oo-3 w-3 mr-1"}),(0,Oo.jsxs)("span",{children:["Created ",r]}),(0,Oo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Oo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var hr=e=>e.startsWith("image/")?(0,Oo.jsx)(_a.Image,{className:"Oo-4 w-4"}):e.startsWith("text/")?(0,Oo.jsx)(_a.FileText,{className:"Oo-4 w-4"}):(0,Oo.jsx)(_a.File,{className:"Oo-4 w-4"}),Va=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Oo.jsx)(Tt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Oo.jsx)("div",{className:"mb-2 Oo-2 bg-background/50 rounded-lg",children:(0,Oo.jsxs)("div",{className:"flex items-center gap-2",children:[hr(r.mediaType||"application/octet-stream"),(0,Oo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Oo.jsx)("Oo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Oo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Oo-8 w-8 Oo-0",children:(0,Oo.jsx)(_a.Download,{className:"Oo-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,Oo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(Fa,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Oo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(xo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(xo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(ka,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Oo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(Oa,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Oo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsxs)(fe,{className:"w-full max-w-md",children:[(0,Oo.jsx)(Ee,{children:(0,Oo.jsx)(ze,{className:"text-lg",children:s})}),(0,Oo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Oo.jsxs)("Oo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Oo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Oo.jsxs)("Oo",{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,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsx)(fe,{className:"w-full",children:(0,Oo.jsx)(Pe,{className:"Oo-4",children:(0,Oo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Oo.jsxs)("div",{className:"flex items-center gap-2 Oo-2 rounded-md bg-muted/50",children:[(0,Oo.jsx)(ie,{variant:"outline",children:c.type||"link"}),(0,Oo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Oo.jsx)("Oo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Oo.jsx)("Oo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Oo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Oo-8 w-8 Oo-0",children:(0,Oo.jsx)(_a.ExternalLink,{className:"Oo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsxs)(fe,{className:"w-full",children:[(0,Oo.jsx)(Ee,{children:(0,Oo.jsx)(ze,{className:"text-lg",children:r.data?.title})}),(0,Oo.jsx)(Pe,{children:(0,Oo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Oo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Oo.jsxs)("div",{className:"text-left",children:[(0,Oo.jsx)("Oo",{className:"font-medium",children:c.label}),c.description&&(0,Oo.jsx)("Oo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Oo.jsx)("div",{className:"mb-2",children:(0,Oo.jsxs)(fe,{className:"w-full max-w-md",children:[(0,Oo.jsx)(Ee,{children:(0,Oo.jsx)(ze,{className:"text-lg",children:s})}),(0,Oo.jsx)(Pe,{children:(0,Oo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}if(n.type==="reasoning")return(0,Oo.jsxs)(No,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.Oo(-1)?.id,children:[(0,Oo.jsx)(ko,{}),(0,Oo.jsx)(Po,{children:n.text})]},`${i}`);if(n.type==="dynamic-tool")return(0,Oo.jsxs)(Aa,{defaultOpen:n.state!=="output-available",children:[(0,Oo.jsx)(Ia,{type:`tool-${n.toolName}`,state:n.state}),(0,Oo.jsxs)(Ma,{children:[(0,Oo.jsx)(Ba,{input:n.input}),(0,Oo.jsx)(La,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`)});var Ga=({className:e,from:t,...o})=>(0,Oo.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}),yr=(0,jo.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"}}),$a=({children:e,className:t,variant:o,...a})=>(0,Oo.jsx)("div",{className:l(yr({variant:o,className:t})),...a,children:e});function qa({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:I,className:T,status:C="ready"}){let N=(0,ft.useRef)(null),F=(0,ft.useRef)(null),S=(0,ft.useRef)(null),[M,_]=(0,ft.useState)(!1),[$,le]=(0,ft.useState)({path:[],selectedItems:[],filters:{}});(0,ft.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,ft.useEffect)(()=>{M&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[M]);let J=()=>ho($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(he=>{u.push({label:he.label,action:()=>X(he.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(he=>{he.type==="list"&&he.data&&u.push({label:`View ${he.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let he=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},ce=ho({path:[],selectedItems:[],filters:{}}),B=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),I(!0)},d=u=>{u.preventDefault(),I(!1)},E=u=>{u.preventDefault(),I(!1),y(u.dataTransfer.files)},z=u=>{if(u===0)return"0 Bytes";let U=1024,he=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+he[Ae]},G=u=>u.startsWith("image/")?(0,Oo.jsx)(_a.Image,{className:"Oo-4 w-4"}):u.startsWith("text/")?(0,Oo.jsx)(_a.FileText,{className:"Oo-4 w-4"}):(0,Oo.jsx)(_a.File,{className:"Oo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:ce,getQuickSuggestions:W().map(u=>u.label)},ve=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Oo.jsxs)("div",{className:`Oo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Oo.jsxs)(Ce,{ref:F,className:"flex-1 Oo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:E,children:[(0,Oo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Oo.jsx)(gt.animate,{children:e.map(u=>(0,Oo.jsx)(gt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Oo.jsx)(Ga,{from:u.role,children:(0,Oo.jsx)($a,{variant:"flat",children:Va({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),M&&(0,Oo.jsxs)(gt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Oo.jsx)(nt,{className:"Oo-8 w-8",children:(0,Oo.jsx)(st,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Oo.jsx)(_a.Bot,{className:"Oo-4 w-4"})})}),(0,Oo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Oo.jsx)(ya,{capabilities:n,isOpen:M,onToggle:()=>_(!M),onActionSelect:X,className:"w-full"})})]}),o&&(0,Oo.jsxs)(gt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Oo.jsx)(nt,{className:"Oo-8 w-8",children:(0,Oo.jsx)(st,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Oo.jsx)(_a.Bot,{className:"Oo-4 w-4"})})}),(0,Oo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Oo.jsxs)("div",{className:"flex space-x-1",children:[(0,Oo.jsx)("div",{className:"w-2 Oo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Oo.jsx)("div",{className:"w-2 Oo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Oo.jsx)("div",{className:"w-2 Oo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Oo.jsx)("div",{ref:N})]}),i.length>0&&(0,Oo.jsx)("div",{className:"Oo-4 border-t bg-muted/10",children:(0,Oo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Oo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Oo-2 border",children:[G(u.file.type),(0,Oo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Oo.jsx)("span",{className:"text-xs text-muted-foreground",children:z(u.file.size)}),(0,Oo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Oo-6 w-6 Oo-0",children:(0,Oo.jsx)(_a.X,{className:"Oo-4 w-4"})})]},u.id))})}),(0,Oo.jsxs)("div",{className:"border rounded-2xl Oo-4 bg-muted/20",children:[(0,Oo.jsxs)("div",{className:"flex gap-3",children:[(0,Oo.jsx)(wt,{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,Oo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Oo-10 w-10 shadow-sm",children:(0,Oo.jsx)(_a.Paperclip,{className:"Oo-4 w-4"})}),(0,Oo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Oo-10 w-10 shadow-sm",children:(0,Oo.jsx)(_a.Send,{className:"Oo-4 w-4"})})]}),(0,Oo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Oo.jsxs)(D,{onClick:()=>_(!M),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Oo.jsx)(_a.Menu,{className:"Oo-3 w-3 mr-1"}),M?"Hide":"Show"," Capabilities"]}),(0,Oo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Oo.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,Oo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Oo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:ve,children:"Debug"})]})]}),s&&(0,Oo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:B,className:"hidden"})]})]})}function ot({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:I=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=E=>console.log("Search query:",E),initialTeam:F="design",currentSession:S=null,showCapabilities:M=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:le=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:ce="AI-Powered Workspace",actionIcon:B=(0,Oo.jsx)(_a.Users,{className:"mr-2 Oo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let E={...e,onError:H=>{G?.setMessages(pe=>[...pe,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:H.message}]}]),console.error("Error in CopilotInterface:",H)}},z=(0,Do.useChat)(E||{}),G=o?t||z:null,[Z,ve]=(0,ft.useState)(""),[u,U]=(0,ft.useState)(!1),he=G?.messages||a,Ae=Z,Ja=G?.status==="submitted"||u,Xa=G?.addToolResult?(H,pe,ae)=>{G.addToolResult({tool:pe,toolCallId:H,output:ae}),G.sendMessage()}:()=>{console.log("addToolResult not available")},vt=n||[],Qa={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"},[Ya,Za]=(0,ft.useState)(()=>vt.length===0?Qa:vt.find(H=>H.id===F)||vt[0]),[ht,Dt]=(0,ft.useState)([]),[ei,ti]=(0,ft.useState)(!1),oi=H=>{if(!H||!$)return;let pe=[];Array.from(H).forEach(ae=>{if(ae.size>le*1024*1024){alert(`File ${ae.name} is too large. Maximum size is ${le}MB.`);return}if(J.length>0&&!J.some(Rt=>ae.type.match(Rt))){alert(`File type ${ae.type} is not allowed.`);return}let So={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ae,status:"pending",progress:0};if(ae.type.startsWith("image/")){let Rt=new FileReader;Rt.onload=si=>{Dt(li=>li.map(Yt=>Yt.id===So.id?{...Yt,preview:si.target?.result}:Yt))},Rt.readAsDataURL(ae)}pe.push(So)}),Dt(ae=>[...ae,...pe])},ai=H=>{Dt(pe=>pe.filter(ae=>ae.id!==H))},Ro=()=>{if(!(!Ae.trim()&&ht.length===0)){if(G){let H=ht.length>0?ii(ht.map(pe=>pe.file)):void 0;G.sendMessage({text:Ae,files:H},{body:{timestamp:Date.now()}}),ve("")}else console.log("Message to send:",Ae),console.log("Files to upload:",ht),ve(""),U(!0),setTimeout(()=>{U(!1)},1500);Dt([])}},ii=H=>{let pe=new DataTransfer;return H.forEach(ae=>pe.items.add(ae)),pe.files},ri=H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Ro())},ni=H=>{ve(H)};return(0,Oo.jsx)(ba,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:vt,currentBusinessUnit:Ya,onBusinessUnitChange:H=>{H&&(Za(H),R?.(H))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:B,actionText:Se,onNotificationRemove:I,onRemoveAll:T,logo:W,appName:X,tagline:ce,sidebarInitiallyClosed:d,children:(0,Oo.jsx)(Qt.AnimatePresence,{mode:"wait",children:(0,Oo.jsx)(Qt.motion.div,{className:"flex-1 Oo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Oo.jsxs)("div",{className:"Oo-full flex",children:[(0,Oo.jsx)("div",{className:"w-80 flex-shrink-0 Oo-full Oo-2",children:(0,Oo.jsx)(va,{sessions:c||[],currentSession:S,teams:vt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Oo.jsx)("div",{className:"flex-1 Oo-full Oo-2",children:(0,Oo.jsx)(qa,{messages:he||[],input:Ae,isTyping:Ja,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:ni,addToolResult:Xa,onSendMessage:Ro,onKeyPress:ri,fileUploads:ht,isDragOver:ei,enableFileUpload:$,onFileUpload:oi,onRemoveFile:ai,onDragOver:ti})})]})},"chat-interface")})})}var bt=[{id:"1",title:"AI Assistant Chat",lastMessage:"How can I help you today?"}];function xr(){return(0,Oo.jsx)(ot,{businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"AI-Powered Copilot"})}function wr(){return(0,Oo.jsx)(ot,{aiConfig:{onError:e=>console.error("Chat error:",e)},businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"Custom AI Copilot"})}function Cr(){return(0,Oo.jsx)(ot,{enableAI:!1,messages:[{id:"1",role:"assistant",parts:[{type:"text",text:"This is demo mode - no AI involved!"}]}],businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:t=>console.log("Session selected:",t),onSessionDelete:t=>console.log("Session deleted:",t),title:"Demo Copilot"})}function Nr(){let e=(0,Do.useChat)({onError:t=>console.error("Custom chat error:",t)});return(0,Oo.jsx)(ot,{useCustomChat:e,businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>{e.setMessages([]),console.log("New chat started - messages cleared")},onSessionSelect:t=>console.log("Session selected:",t),onSessionDelete:t=>console.log("Session deleted:",t),title:"Advanced AI Copilot"})}function kr(){return(0,Oo.jsx)(ot,{sidebarInitiallyClosed:!0,businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"Focused AI Chat"})}function Pr(){let e=(0,Do.useChat)({onError:t=>console.error("File upload chat error:",t),onFinish:t=>console.log("Message with files completed:",t)});return(0,Oo.jsx)(ot,{useCustomChat:e,enableAI:!0,enableFileUpload:!0,maxFileSize:10,allowedFileTypes:["image/*","text/*","application/pdf"],businessUnits:Me,capabilities:et,sidebarItems:_e,notifications:Je,sessions:bt,onNewChat:()=>{e.setMessages([]),console.log("New file upload chat started - messages cleared")},onSessionSelect:t=>console.log("Session selected:",t),onSessionDelete:t=>console.log("Session deleted:",t),title:"AI Copilot with File Uploads"})}0&&(module.exports={AdvancedAICopilot,CustomAICopilot,DemoCopilot,FileUploadAICopilot,FocusedChatCopilot,SimpleAICopilot});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";import{a as l}from"../../chunk-
|
|
2
|
+
"use strict";import{a as l}from"../../chunk-XRW62PGB.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-AXPE5U2T.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-IFU7M7BO.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-EH3PJU6C.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import{a as t,b as i,c as n}from"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import{b as o}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{useChat as r}from"@ai-sdk/react";import{jsx as c}from"react/jsx-runtime";var a=[{id:"1",title:"AI Assistant Chat",lastMessage:"How can I help you today?"}];function C(){return c(l,{businessUnits:n,capabilities:o,sidebarItems:t,notifications:i,sessions:a,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"AI-Powered Copilot"})}function S(){return c(l,{aiConfig:{onError:e=>console.error("Chat error:",e)},businessUnits:n,capabilities:o,sidebarItems:t,notifications:i,sessions:a,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"Custom AI Copilot"})}function g(){return c(l,{enableAI:!1,messages:[{id:"1",role:"assistant",parts:[{type:"text",text:"This is demo mode - no AI involved!"}]}],businessUnits:n,capabilities:o,sidebarItems:t,notifications:i,sessions:a,onNewChat:()=>console.log("New chat started"),onSessionSelect:s=>console.log("Session selected:",s),onSessionDelete:s=>console.log("Session deleted:",s),title:"Demo Copilot"})}function h(){let e=r({onError:s=>console.error("Custom chat error:",s)});return c(l,{useCustomChat:e,businessUnits:n,capabilities:o,sidebarItems:t,notifications:i,sessions:a,onNewChat:()=>{e.setMessages([]),console.log("New chat started - messages cleared")},onSessionSelect:s=>console.log("Session selected:",s),onSessionDelete:s=>console.log("Session deleted:",s),title:"Advanced AI Copilot"})}function b(){return c(l,{sidebarInitiallyClosed:!0,businessUnits:n,capabilities:o,sidebarItems:t,notifications:i,sessions:a,onNewChat:()=>console.log("New chat started"),onSessionSelect:e=>console.log("Session selected:",e),onSessionDelete:e=>console.log("Session deleted:",e),title:"Focused AI Chat"})}function f(){let e=r({onError:s=>console.error("File upload chat error:",s),onFinish:s=>console.log("Message with files completed:",s)});return c(l,{useCustomChat:e,enableAI:!0,enableFileUpload:!0,maxFileSize:10,allowedFileTypes:["image/*","text/*","application/pdf"],businessUnits:n,capabilities:o,sidebarItems:t,notifications:i,sessions:a,onNewChat:()=>{e.setMessages([]),console.log("New file upload chat started - messages cleared")},onSessionSelect:s=>console.log("Session selected:",s),onSessionDelete:s=>console.log("Session deleted:",s),title:"AI Copilot with File Uploads"})}export{h as AdvancedAICopilot,S as CustomAICopilot,g as DemoCopilot,f as FileUploadAICopilot,b as FocusedChatCopilot,C as SimpleAICopilot};
|