@progress/kendo-react-conversational-ui 14.5.0-develop.8 → 15.0.0-develop.1

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.
Files changed (40) hide show
  1. package/README.md +4 -4
  2. package/ai-prompt/AIPrompt.d.ts +6 -0
  3. package/ai-prompt/AIPrompt.js +1 -1
  4. package/ai-prompt/AIPrompt.mjs +40 -38
  5. package/ai-prompt/AIPromptContent.js +1 -1
  6. package/ai-prompt/AIPromptContent.mjs +5 -5
  7. package/ai-prompt/views/AIPromptOutputView.js +1 -1
  8. package/ai-prompt/views/AIPromptOutputView.mjs +6 -6
  9. package/chat/ChatPropsAndState.d.ts +17 -0
  10. package/chat/components/Chat.js +1 -1
  11. package/chat/components/Chat.mjs +222 -220
  12. package/chat/components/ChatMessage.js +1 -1
  13. package/chat/components/ChatMessage.mjs +133 -117
  14. package/chat/components/Header.js +1 -1
  15. package/chat/components/Header.mjs +1 -1
  16. package/chat/components/NewMessage.js +1 -1
  17. package/chat/components/NewMessage.mjs +49 -48
  18. package/chat/components/Notification.js +1 -1
  19. package/chat/components/Notification.mjs +1 -1
  20. package/chat/components/elements/FileBox.js +1 -1
  21. package/chat/components/elements/FileBox.mjs +10 -9
  22. package/chat/components/elements/PinnedMessage.js +1 -1
  23. package/chat/components/elements/PinnedMessage.mjs +14 -13
  24. package/chat/hooks/useEndlessScroll.js +1 -1
  25. package/chat/hooks/useEndlessScroll.mjs +103 -101
  26. package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
  27. package/inline-ai-prompt/InlineAIPrompt.js +1 -1
  28. package/inline-ai-prompt/InlineAIPrompt.mjs +10 -10
  29. package/inline-ai-prompt/InlineAIPromptInput.js +1 -1
  30. package/inline-ai-prompt/InlineAIPromptInput.mjs +1 -1
  31. package/messages/index.d.ts +5 -0
  32. package/messages/index.js +1 -1
  33. package/messages/index.mjs +12 -10
  34. package/package-metadata.js +1 -1
  35. package/package-metadata.mjs +2 -2
  36. package/package.json +17 -12
  37. package/prompt-box/FileBox.js +1 -1
  38. package/prompt-box/FileBox.mjs +21 -20
  39. package/prompt-box/PromptBox.js +1 -1
  40. package/prompt-box/PromptBox.mjs +148 -150
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react"),g=require("@progress/kendo-react-common"),D=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),ne=require("@progress/kendo-react-layout"),i=require("../utils.js"),Ee=require("./ChatContext.js"),xe=require("./elements/FileBox.js"),le=require("@progress/kendo-react-intl"),l=require("../../messages/index.js");function Ie(u){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const e in u)if(e!=="default"){const d=Object.getOwnPropertyDescriptor(u,e);Object.defineProperty(r,e,d.get?d:{enumerable:!0,get:()=>u[e]})}}return r.default=u,Object.freeze(r)}const s=Ie(ye),oe=s.forwardRef((u,r)=>{const{item:e,template:d,contentTemplate:F,onRequestSelection:C,tabIndex:ce=-1,dateFormat:H="g",selected:c,allowMessageCollapse:y,messageToolbarActions:E,messageContextMenuActions:x,fileActions:U,isSender:I}=u,{setReplyToMessage:w,messages:X,repliedToMessages:A,user:b,onToolbarAction:R,onContextMenuAction:L,onFileAction:Y,onDownload:m,onResendMessage:q,setShowCopyNotification:M,statusTemplate:O,timestampVisibility:h="onFocus",onReferencedMessageClick:v}=Ee.useChatContext(),[G,V]=s.useState(!1),[J,z]=s.useState(!1),[T,ie]=s.useState(!0),[re,Q]=s.useState(!1),o=le.useLocalization(),Z=le.useInternationalization(),$=s.useRef({left:0,top:0}),N=s.useCallback(()=>{e!=null&&e.text&&i.copyToClipboard(e.text),M&&(M(!0),setTimeout(()=>{M(!1)},3e3))},[e,M]),j=s.useCallback(t=>{t.stopPropagation(),ie(a=>!a)},[]),ue=s.useCallback(()=>{Q(!1)},[]),de=s.useCallback(t=>{(t.key==="Tab"||t.key==="Enter"||t.key===" "||t.key==="ArrowUp"||t.key==="ArrowDown")&&Q(!0)},[]),B=s.useRef(null);s.useEffect(()=>{c&&B.current&&B.current.focus()},[c]);const P=s.useCallback(t=>{$.current={left:t.pageX,top:t.pageY},t.preventDefault(),z(!0),V(!0)},[]),ee=s.useCallback(()=>{z(!1),V(!1)},[]),S=s.useCallback((t,a)=>t.isDeleted?i.getDeletedMessageText(a,o):t.text?t.text:"",[o]),te=s.useCallback(t=>{var a;(a=t.item)!=null&&a.text&&(t.item.data.id==="copy"&&!e.isDeleted?N():t.item.data.id==="reply"&&w(e),L&&L(t.item.data,t,e)),z(!1),V(!1)},[e,L,w,N]),se=s.useCallback(()=>{if(e.replyToId){const t=i.getMessageById(X,e.replyToId)||(A?i.getMessageById(A,e.replyToId):void 0);if(t){const a=n=>{n.preventDefault(),n.stopPropagation(),v==null||v(t.id)};return s.createElement("div",{className:g.classNames("k-message-reference",i.isAuthor(b,t)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:a},s.createElement("div",{className:"k-message-reference-content"},i.convertTextToLinkedContent(S(t,i.isAuthor(b,t)))))}}return null},[e.replyToId,X,A,b,S,v]),K=s.useCallback(()=>{const t=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],a=x?[...t.map(n=>x.find(k=>k.id===n.id)||n),...x.filter(n=>!t.some(p=>p.id===n.id))]:t;return s.createElement(ne.ContextMenu,{onSelect:te,onClose:ee,vertical:!0,show:G,offset:$.current},a.map(n=>n.id==="delete"&&!I?null:s.createElement(ne.MenuItem,{key:n.id,text:n.label,icon:n.icon,svgIcon:n.svgIcon,data:n})))},[x,te,ee,G,I]),ae=s.useCallback(()=>e.files&&e.files.length>1?s.createElement("div",{className:"k-chat-download-button-wrapper"},s.createElement(D.Button,{className:"k-chat-download-button",fillMode:"flat",svgIcon:f.downloadLightIcon,size:"small",onClick:t=>{t.stopPropagation(),m&&m(e.files,e)},"aria-label":o.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},s.createElement("span",{className:"k-button-text"},o.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[e,m,o]),me=s.useCallback(()=>{if(e.typing)return s.createElement("div",{className:"k-chat-bubble k-bubble"},s.createElement("div",{className:"k-bubble-content"},s.createElement("div",{className:"k-typing-indicator"},s.createElement("span",null),s.createElement("span",null),s.createElement("span",null))));if(d){const t=d;return s.createElement(s.Fragment,null,s.createElement(t,{item:e}),K())}else if(e.text||e.files&&e.files.length>0)return s.createElement(s.Fragment,null,s.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":y,"k-expanded":y&&T,"k-selected":c,"k-active":J}),onClick:()=>C(c?void 0:e.selectionIndex),onContextMenu:P},s.createElement("div",{className:"k-bubble-content"},F?s.createElement(F,{item:e}):s.createElement(s.Fragment,null,(e.text||e.isDeleted||e.replyToId)&&s.createElement("span",{className:"k-chat-bubble-text"},!e.isDeleted&&se(),i.convertTextToLinkedContent(S(e,i.isAuthor(b,e)))),e.files&&e.files.length>0&&s.createElement(xe,{files:e.files,message:e,onFileAction:Y,onDownload:t=>m==null?void 0:m(t,e),renderInTextarea:!1,fileActions:U}),ae())),y&&s.createElement("span",{className:"k-bubble-expandable-indicator",onClick:j,role:"button","aria-label":T?o.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):o.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),j(t))}},s.createElement(g.IconWrap,{icon:T?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),K());return null},[e,d,F,y,T,c,J,C,P,se,S,b,Y,U,ae,j,o,K,m]),ge=s.useCallback(()=>{let t=null;if(e.timestamp){const a=h==="onFocus"&&c;h==="hidden"||(t=s.createElement("time",{className:"k-message-time","aria-hidden":!a},Z.formatDate(e.timestamp,H)))}return t},[e.timestamp,c,H,h,Z]),fe=s.useCallback(()=>{if(!e.status)return null;let t;if(O)t=s.createElement(O,{item:e});else{const a=typeof e.status=="object"&&e.status!==null;let n,p,k;if(a){const _=e.status;n=_.text,p=_.icon,k=_.svgIcon}else n=e.status;let W=null;p?W=s.createElement(g.Icon,{name:p,size:"xsmall"}):k&&(W=s.createElement(g.IconWrap,{icon:k,size:"xsmall"})),t=s.createElement(s.Fragment,null,W,n)}return s.createElement("span",{className:"k-message-status"},t)},[e,O]),pe=s.useCallback(()=>{let t=null;if(e.isFailed){const a=o.toLanguageString(l.messageFailed,l.messages[l.messageFailed]);t=s.createElement("span",{className:"k-message-failed-content"},s.createElement(g.IconWrap,{icon:f.warningTriangleIcon,size:"xsmall"}),s.createElement("span",{className:"k-message-failed-text"},a))}return t},[e,o]),be=s.useCallback(()=>{let t=null;if(e.isFailed){const a=o.toLanguageString(l.retryMessage,l.messages[l.retryMessage]);t=s.createElement(D.Button,{fillMode:"clear",size:"small",className:"k-resend-button",svgIcon:f.arrowRotateCwOutlineIcon,"aria-label":a,title:a,onClick:n=>{n.stopPropagation(),q&&q({message:e,syntheticEvent:n,nativeEvent:n.nativeEvent,target:n.target})}})}return t},[e,o,q]),ke=s.useCallback(()=>g.classNames({"k-focus":c,"k-message-removed":e.isDeleted,"k-message-failed":e.isFailed},"k-message"),[c,e.isDeleted,e.isFailed]),Ce=s.useCallback(()=>E&&E.length>0&&s.createElement(D.Toolbar,{className:"k-chat-message-toolbar",fillMode:"flat"},E.map(t=>t.id==="delete"&&!I?null:s.createElement(D.Button,{key:t.id,fillMode:"flat",className:"k-toolbar-button",icon:t.icon,svgIcon:t.svgIcon,onClick:a=>{a.stopPropagation(),t.id==="copy"&&!e.isDeleted?N():t.id==="reply"&&w(e),R&&R(t,a,e)},onMouseDown:a=>a.preventDefault()}))),[N,I,e,E,R,w]);return s.createElement("div",{key:e.id,"data-message-id":e.id,className:ke(),tabIndex:ce,onMouseDown:ue,onKeyDown:de,onFocus:t=>{re&&C(e.selectionIndex)},ref:t=>{B.current=t,typeof r=="function"?r(t):r&&(r.current=t)},onContextMenu:d?P:void 0},be(),me(),(e.status||e.timestamp&&h!=="hidden"||e.isFailed)&&s.createElement("div",{className:"k-message-info"},fe(),ge(),pe()),Ce())});oe.displayName="ChatMessage";exports.ChatMessage=oe;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react"),g=require("@progress/kendo-react-common"),S=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),ne=require("@progress/kendo-react-layout"),c=require("../utils.js"),Ee=require("./ChatContext.js"),xe=require("./elements/FileBox.js"),le=require("@progress/kendo-react-intl"),l=require("../../messages/index.js");function Ie(i){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const u=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(r,e,u.get?u:{enumerable:!0,get:()=>i[e]})}}return r.default=i,Object.freeze(r)}const a=Ie(ye),oe=a.forwardRef((i,r)=>{const{item:e,template:u,contentTemplate:D,onRequestSelection:C,tabIndex:ce=-1,dateFormat:H="g",selected:d,allowMessageCollapse:y,messageToolbarActions:E,messageContextMenuActions:x,fileActions:U,isSender:I}=i,{setReplyToMessage:M,messages:X,repliedToMessages:A,user:b,onToolbarAction:F,onContextMenuAction:R,onFileAction:Y,onDownload:m,onResendMessage:L,setShowCopyNotification:w,statusTemplate:q,timestampVisibility:z="onFocus",onReferencedMessageClick:T}=Ee.useChatContext(),[G,O]=a.useState(!1),[J,V]=a.useState(!1),[h,re]=a.useState(!0),[ie,Q]=a.useState(!1),o=le.useLocalization(),Z=le.useInternationalization(),$=a.useRef({left:0,top:0}),v=a.useCallback(()=>{e!=null&&e.text&&c.copyToClipboard(e.text),w&&(w(!0),setTimeout(()=>{w(!1)},3e3))},[e,w]),j=a.useCallback(t=>{t.stopPropagation(),re(s=>!s)},[]),ue=a.useCallback(()=>{Q(!1)},[]),de=a.useCallback(t=>{(t.key==="Tab"||t.key==="Enter"||t.key===" "||t.key==="ArrowUp"||t.key==="ArrowDown")&&Q(!0)},[]),B=a.useRef(null);a.useEffect(()=>{d&&B.current&&B.current.focus()},[d]);const P=a.useCallback(t=>{$.current={left:t.pageX,top:t.pageY},t.preventDefault(),V(!0),O(!0)},[]),ee=a.useCallback(()=>{V(!1),O(!1)},[]),N=a.useCallback((t,s)=>t.isDeleted?c.getDeletedMessageText(s,o):t.text?t.text:"",[o]),te=a.useCallback(t=>{var s;(s=t.item)!=null&&s.text&&(t.item.data.id==="copy"&&!e.isDeleted?v():t.item.data.id==="reply"&&M(e),R&&R(t.item.data,t,e)),V(!1),O(!1)},[e,R,M,v]),ae=a.useCallback(()=>{if(e.replyToId){const t=c.getMessageById(X,e.replyToId)||(A?c.getMessageById(A,e.replyToId):void 0);if(t){const s=n=>{n.preventDefault(),n.stopPropagation(),T==null||T(t.id)};return a.createElement("div",{className:g.classNames("k-message-reference",c.isAuthor(b,t)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:s},a.createElement("div",{className:"k-message-reference-content"},c.convertTextToLinkedContent(N(t,c.isAuthor(b,t)))))}}return null},[e.replyToId,X,A,b,N,T]),K=a.useCallback(()=>{const t=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],s=x?[...t.map(n=>x.find(k=>k.id===n.id)||n),...x.filter(n=>!t.some(p=>p.id===n.id))]:t;return a.createElement(ne.ContextMenu,{onSelect:te,onClose:ee,vertical:!0,show:G,offset:$.current},s.map(n=>n.id==="delete"&&!I?null:a.createElement(ne.MenuItem,{key:n.id,text:n.label,icon:n.icon,svgIcon:n.svgIcon,data:n})))},[x,te,ee,G,I]),se=a.useCallback(()=>e.files&&e.files.length>1?a.createElement("div",{className:"k-chat-download-button-wrapper"},a.createElement(S.Button,{className:"k-chat-download-button",fillMode:"flat",svgIcon:f.downloadIcon,size:"small",onClick:t=>{t.stopPropagation(),m&&m(e.files,e)},"aria-label":o.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},a.createElement("span",{className:"k-button-text"},o.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[e,m,o]),me=a.useCallback(()=>{if(e.typing)return a.createElement("div",{className:"k-chat-bubble k-bubble"},a.createElement("div",{className:"k-bubble-content"},a.createElement("div",{className:"k-typing-indicator"},a.createElement("span",null),a.createElement("span",null),a.createElement("span",null))));if(u){const t=u;return a.createElement(a.Fragment,null,a.createElement(t,{item:e}),K())}else if(e.text||e.files&&e.files.length>0)return a.createElement(a.Fragment,null,a.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":y,"k-expanded":y&&h,"k-selected":d,"k-active":J}),onClick:()=>C(d?void 0:e.selectionIndex),onContextMenu:P},a.createElement("div",{className:"k-bubble-content"},D?a.createElement(D,{item:e}):a.createElement(a.Fragment,null,(e.text||e.isDeleted||e.replyToId)&&a.createElement("span",{className:"k-chat-bubble-text"},!e.isDeleted&&ae(),c.convertTextToLinkedContent(N(e,c.isAuthor(b,e)))),e.files&&e.files.length>0&&a.createElement(xe,{files:e.files,message:e,onFileAction:Y,onDownload:t=>m==null?void 0:m(t,e),renderInTextarea:!1,fileActions:U}),se())),y&&a.createElement("span",{className:"k-bubble-expandable-indicator",onClick:j,role:"button","aria-label":h?o.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):o.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),j(t))}},a.createElement(g.IconWrap,{icon:h?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),K());return null},[e,u,D,y,h,d,J,C,P,ae,N,b,Y,U,se,j,o,K,m]),ge=a.useCallback(()=>{let t=null;return e.timestamp&&(z==="hidden"||(t=a.createElement("time",{className:"k-message-time"},Z.formatDate(e.timestamp,H)))),t},[e.timestamp,H,z,Z]),fe=a.useCallback(()=>{if(!e.status)return null;let t;if(q)t=a.createElement(q,{item:e});else{const s=typeof e.status=="object"&&e.status!==null;let n,p,k;if(s){const _=e.status;n=_.text,p=_.icon,k=_.svgIcon}else n=e.status;let W=null;p?W=a.createElement(g.Icon,{name:p,size:"xsmall"}):k&&(W=a.createElement(g.IconWrap,{icon:k,size:"xsmall"})),t=a.createElement(a.Fragment,null,W,n)}return a.createElement("span",{className:"k-message-status"},t)},[e,q]),pe=a.useCallback(()=>{let t=null;if(e.isFailed){const s=o.toLanguageString(l.messageFailed,l.messages[l.messageFailed]);t=a.createElement("span",{className:"k-message-failed-content"},a.createElement(g.IconWrap,{icon:f.warningTriangleIcon,size:"xsmall"}),a.createElement("span",{className:"k-message-failed-text"},s))}return t},[e,o]),be=a.useCallback(()=>{let t=null;if(e.isFailed){const s=o.toLanguageString(l.retryMessage,l.messages[l.retryMessage]);t=a.createElement(S.Button,{fillMode:"clear",size:"xs",className:"k-resend-button",svgIcon:f.arrowRotateCwIcon,"aria-label":s,title:s,onClick:n=>{n.stopPropagation(),L&&L({message:e,syntheticEvent:n,nativeEvent:n.nativeEvent,target:n.target})}})}return t},[e,o,L]),ke=a.useCallback(()=>g.classNames({"k-focus":d,"k-message-removed":e.isDeleted,"k-message-failed":e.isFailed},"k-message"),[d,e.isDeleted,e.isFailed]),Ce=a.useCallback(()=>E&&E.length>0&&a.createElement(S.Toolbar,{className:"k-chat-message-toolbar",fillMode:"flat",ariaLabel:o.toLanguageString(l.chatMessageToolbar,l.messages[l.chatMessageToolbar])},E.map(t=>t.id==="delete"&&!I?null:a.createElement(S.Button,{key:t.id,fillMode:"flat",className:"k-toolbar-button",icon:t.icon,svgIcon:t.svgIcon,"aria-label":t.label,onClick:s=>{s.stopPropagation(),t.id==="copy"&&!e.isDeleted?v():t.id==="reply"&&M(e),F&&F(t,s,e)},onMouseDown:s=>s.preventDefault()}))),[v,I,e,o,E,F,M]);return a.createElement("div",{key:e.id,"data-message-id":e.id,className:ke(),tabIndex:ce,onMouseDown:ue,onKeyDown:de,onFocus:t=>{ie&&C(e.selectionIndex)},ref:t=>{B.current=t,typeof r=="function"?r(t):r&&(r.current=t)},onContextMenu:u?P:void 0},be(),me(),(e.status||e.timestamp&&z!=="hidden"||e.isFailed)&&a.createElement("div",{className:"k-message-info"},fe(),ge(),pe()),Ce())});oe.displayName="ChatMessage";exports.ChatMessage=oe;
@@ -6,116 +6,116 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as t from "react";
9
- import { classNames as B, IconWrap as j, Icon as he } from "@progress/kendo-react-common";
10
- import { Button as W, Toolbar as ve } from "@progress/kendo-react-buttons";
11
- import { undoIcon as Te, copyIcon as Me, downloadLightIcon as Ne, chevronUpIcon as De, chevronDownIcon as Se, warningTriangleIcon as Fe, arrowRotateCwOutlineIcon as Ae } from "@progress/kendo-svg-icons";
12
- import { ContextMenu as Re, MenuItem as Ve } from "@progress/kendo-react-layout";
13
- import { copyToClipboard as Le, getDeletedMessageText as ze, getMessageById as se, isAuthor as H, convertTextToLinkedContent as ne } from "../utils.mjs";
14
- import { useChatContext as Ke } from "./ChatContext.mjs";
15
- import Oe from "./elements/FileBox.mjs";
16
- import { useLocalization as Pe, useInternationalization as Be } from "@progress/kendo-react-intl";
17
- import { downloadAllFiles as le, messages as c, downloadAll as oe, collapseMessage as ie, expandMessage as re, messageFailed as ce, retryMessage as ue } from "../../messages/index.mjs";
18
- const je = t.forwardRef(
19
- (me, d) => {
9
+ import { classNames as O, IconWrap as j, Icon as ve } from "@progress/kendo-react-common";
10
+ import { Button as W, Toolbar as he } from "@progress/kendo-react-buttons";
11
+ import { undoIcon as Me, copyIcon as Ne, downloadIcon as De, chevronUpIcon as Se, chevronDownIcon as Fe, warningTriangleIcon as Ae, arrowRotateCwIcon as Re } from "@progress/kendo-svg-icons";
12
+ import { ContextMenu as Le, MenuItem as Ve } from "@progress/kendo-react-layout";
13
+ import { copyToClipboard as ze, getDeletedMessageText as Ke, getMessageById as se, isAuthor as H, convertTextToLinkedContent as ne } from "../utils.mjs";
14
+ import { useChatContext as Pe } from "./ChatContext.mjs";
15
+ import Be from "./elements/FileBox.mjs";
16
+ import { useLocalization as Oe, useInternationalization as je } from "@progress/kendo-react-intl";
17
+ import { downloadAllFiles as le, messages as r, downloadAll as oe, collapseMessage as ie, expandMessage as re, messageFailed as ce, retryMessage as ue, chatMessageToolbar as me } from "../../messages/index.mjs";
18
+ const We = t.forwardRef(
19
+ (de, d) => {
20
20
  const {
21
21
  item: a,
22
22
  template: f,
23
- contentTemplate: T,
24
- onRequestSelection: p,
25
- tabIndex: de = -1,
23
+ contentTemplate: v,
24
+ onRequestSelection: g,
25
+ tabIndex: fe = -1,
26
26
  dateFormat: U = "g",
27
27
  selected: o,
28
- allowMessageCollapse: g,
28
+ allowMessageCollapse: p,
29
29
  messageToolbarActions: b,
30
30
  messageContextMenuActions: k,
31
31
  fileActions: q,
32
32
  isSender: C
33
- } = me, {
33
+ } = de, {
34
34
  setReplyToMessage: E,
35
35
  messages: X,
36
- repliedToMessages: M,
36
+ repliedToMessages: h,
37
37
  user: u,
38
- onToolbarAction: N,
39
- onContextMenuAction: D,
38
+ onToolbarAction: M,
39
+ onContextMenuAction: N,
40
40
  onFileAction: Y,
41
41
  onDownload: i,
42
- onResendMessage: S,
43
- setShowCopyNotification: y,
44
- statusTemplate: F,
45
- timestampVisibility: x = "onFocus",
46
- onReferencedMessageClick: I
47
- } = Ke(), [$, A] = t.useState(!1), [G, R] = t.useState(!1), [w, fe] = t.useState(!0), [pe, J] = t.useState(!1), l = Pe(), Q = Be(), Z = t.useRef({ left: 0, top: 0 }), h = t.useCallback(() => {
48
- a != null && a.text && Le(a.text), y && (y(!0), setTimeout(() => {
49
- y(!1);
42
+ onResendMessage: D,
43
+ setShowCopyNotification: x,
44
+ statusTemplate: S,
45
+ timestampVisibility: F = "onFocus",
46
+ onReferencedMessageClick: y
47
+ } = Pe(), [$, A] = t.useState(!1), [G, R] = t.useState(!1), [I, ge] = t.useState(!0), [pe, J] = t.useState(!1), l = Oe(), Q = je(), Z = t.useRef({ left: 0, top: 0 }), w = t.useCallback(() => {
48
+ a != null && a.text && ze(a.text), x && (x(!0), setTimeout(() => {
49
+ x(!1);
50
50
  }, 3e3));
51
- }, [a, y]), V = t.useCallback((e) => {
52
- e.stopPropagation(), fe((s) => !s);
53
- }, []), ge = t.useCallback(() => {
51
+ }, [a, x]), L = t.useCallback((e) => {
52
+ e.stopPropagation(), ge((s) => !s);
53
+ }, []), be = t.useCallback(() => {
54
54
  J(!1);
55
- }, []), be = t.useCallback((e) => {
55
+ }, []), ke = t.useCallback((e) => {
56
56
  (e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && J(!0);
57
- }, []), L = t.useRef(null);
57
+ }, []), V = t.useRef(null);
58
58
  t.useEffect(() => {
59
- o && L.current && L.current.focus();
59
+ o && V.current && V.current.focus();
60
60
  }, [o]);
61
61
  const z = t.useCallback((e) => {
62
62
  Z.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), R(!0), A(!0);
63
63
  }, []), _ = t.useCallback(() => {
64
64
  R(!1), A(!1);
65
- }, []), v = t.useCallback(
66
- (e, s) => e.isDeleted ? ze(s, l) : e.text ? e.text : "",
65
+ }, []), T = t.useCallback(
66
+ (e, s) => e.isDeleted ? Ke(s, l) : e.text ? e.text : "",
67
67
  [l]
68
68
  ), ee = t.useCallback(
69
69
  (e) => {
70
70
  var s;
71
- (s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? h() : e.item.data.id === "reply" && E(a), D && D(e.item.data, e, a)), R(!1), A(!1);
71
+ (s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? w() : e.item.data.id === "reply" && E(a), N && N(e.item.data, e, a)), R(!1), A(!1);
72
72
  },
73
- [a, D, E, h]
73
+ [a, N, E, w]
74
74
  ), te = t.useCallback(() => {
75
75
  if (a.replyToId) {
76
- const e = se(X, a.replyToId) || (M ? se(M, a.replyToId) : void 0);
76
+ const e = se(X, a.replyToId) || (h ? se(h, a.replyToId) : void 0);
77
77
  if (e) {
78
78
  const s = (n) => {
79
- n.preventDefault(), n.stopPropagation(), I == null || I(e.id);
79
+ n.preventDefault(), n.stopPropagation(), y == null || y(e.id);
80
80
  };
81
81
  return /* @__PURE__ */ t.createElement(
82
82
  "div",
83
83
  {
84
- className: B(
84
+ className: O(
85
85
  "k-message-reference",
86
86
  H(u, e) ? "k-message-reference-sender" : "k-message-reference-receiver"
87
87
  ),
88
88
  onClick: s
89
89
  },
90
90
  /* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, ne(
91
- v(e, H(u, e))
91
+ T(e, H(u, e))
92
92
  ))
93
93
  );
94
94
  }
95
95
  }
96
96
  return null;
97
- }, [a.replyToId, X, M, u, v, I]), K = t.useCallback(() => {
97
+ }, [a.replyToId, X, h, u, T, y]), K = t.useCallback(() => {
98
98
  const e = [
99
99
  {
100
100
  id: "reply",
101
101
  label: "Reply",
102
- svgIcon: Te
102
+ svgIcon: Me
103
103
  },
104
104
  {
105
105
  id: "copy",
106
106
  label: "Copy",
107
- svgIcon: Me
107
+ svgIcon: Ne
108
108
  }
109
109
  ], s = k ? [
110
110
  ...e.map((n) => k.find(
111
111
  (m) => m.id === n.id
112
112
  ) || n),
113
113
  ...k.filter(
114
- (n) => !e.some((r) => r.id === n.id)
114
+ (n) => !e.some((c) => c.id === n.id)
115
115
  )
116
116
  ] : e;
117
117
  return /* @__PURE__ */ t.createElement(
118
- Re,
118
+ Le,
119
119
  {
120
120
  onSelect: ee,
121
121
  onClose: _,
@@ -141,18 +141,18 @@ const je = t.forwardRef(
141
141
  {
142
142
  className: "k-chat-download-button",
143
143
  fillMode: "flat",
144
- svgIcon: Ne,
144
+ svgIcon: De,
145
145
  size: "small",
146
146
  onClick: (e) => {
147
147
  e.stopPropagation(), i && i(a.files, a);
148
148
  },
149
149
  "aria-label": l.toLanguageString(
150
150
  le,
151
- c[le]
151
+ r[le]
152
152
  )
153
153
  },
154
- /* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, l.toLanguageString(oe, c[oe]))
155
- )) : null, [a, i, l]), ke = t.useCallback(() => {
154
+ /* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, l.toLanguageString(oe, r[oe]))
155
+ )) : null, [a, i, l]), Ce = t.useCallback(() => {
156
156
  if (a.typing)
157
157
  return /* @__PURE__ */ t.createElement("div", { className: "k-chat-bubble k-bubble" }, /* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, /* @__PURE__ */ t.createElement("div", { className: "k-typing-indicator" }, /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null))));
158
158
  if (f) {
@@ -162,19 +162,19 @@ const je = t.forwardRef(
162
162
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
163
163
  "div",
164
164
  {
165
- className: B("k-chat-bubble", "k-bubble", {
166
- "k-bubble-expandable": g,
167
- "k-expanded": g && w,
165
+ className: O("k-chat-bubble", "k-bubble", {
166
+ "k-bubble-expandable": p,
167
+ "k-expanded": p && I,
168
168
  "k-selected": o,
169
169
  "k-active": G
170
170
  }),
171
- onClick: () => p(o ? void 0 : a.selectionIndex),
171
+ onClick: () => g(o ? void 0 : a.selectionIndex),
172
172
  onContextMenu: z
173
173
  },
174
- /* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, T ? /* @__PURE__ */ t.createElement(T, { item: a }) : /* @__PURE__ */ t.createElement(t.Fragment, null, (a.text || a.isDeleted || a.replyToId) && /* @__PURE__ */ t.createElement("span", { className: "k-chat-bubble-text" }, !a.isDeleted && te(), ne(
175
- v(a, H(u, a))
174
+ /* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, v ? /* @__PURE__ */ t.createElement(v, { item: a }) : /* @__PURE__ */ t.createElement(t.Fragment, null, (a.text || a.isDeleted || a.replyToId) && /* @__PURE__ */ t.createElement("span", { className: "k-chat-bubble-text" }, !a.isDeleted && te(), ne(
175
+ T(a, H(u, a))
176
176
  )), a.files && a.files.length > 0 && /* @__PURE__ */ t.createElement(
177
- Oe,
177
+ Be,
178
178
  {
179
179
  files: a.files,
180
180
  message: a,
@@ -184,101 +184,97 @@ const je = t.forwardRef(
184
184
  fileActions: q
185
185
  }
186
186
  ), ae())),
187
- g && /* @__PURE__ */ t.createElement(
187
+ p && /* @__PURE__ */ t.createElement(
188
188
  "span",
189
189
  {
190
190
  className: "k-bubble-expandable-indicator",
191
- onClick: V,
191
+ onClick: L,
192
192
  role: "button",
193
- "aria-label": w ? l.toLanguageString(
193
+ "aria-label": I ? l.toLanguageString(
194
194
  ie,
195
- c[ie]
195
+ r[ie]
196
196
  ) : l.toLanguageString(
197
197
  re,
198
- c[re]
198
+ r[re]
199
199
  ),
200
200
  tabIndex: 0,
201
201
  onKeyDown: (e) => {
202
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), V(e));
202
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), L(e));
203
203
  }
204
204
  },
205
- /* @__PURE__ */ t.createElement(j, { icon: w ? De : Se, size: "medium" })
205
+ /* @__PURE__ */ t.createElement(j, { icon: I ? Se : Fe, size: "medium" })
206
206
  )
207
207
  ), K());
208
208
  return null;
209
209
  }, [
210
210
  a,
211
211
  f,
212
- T,
213
- g,
214
- w,
212
+ v,
213
+ p,
214
+ I,
215
215
  o,
216
216
  G,
217
- p,
217
+ g,
218
218
  z,
219
219
  te,
220
- v,
220
+ T,
221
221
  u,
222
222
  Y,
223
223
  q,
224
224
  ae,
225
- V,
225
+ L,
226
226
  l,
227
227
  K,
228
228
  i
229
- ]), Ce = t.useCallback(() => {
229
+ ]), Ee = t.useCallback(() => {
230
230
  let e = null;
231
- if (a.timestamp) {
232
- const s = x === "onFocus" && o;
233
- x === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !s }, Q.formatDate(a.timestamp, U)));
234
- }
235
- return e;
236
- }, [a.timestamp, o, U, x, Q]), Ee = t.useCallback(() => {
231
+ return a.timestamp && (F === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time" }, Q.formatDate(a.timestamp, U)))), e;
232
+ }, [a.timestamp, U, F, Q]), xe = t.useCallback(() => {
237
233
  if (!a.status)
238
234
  return null;
239
235
  let e;
240
- if (F)
241
- e = t.createElement(F, { item: a });
236
+ if (S)
237
+ e = t.createElement(S, { item: a });
242
238
  else {
243
239
  const s = typeof a.status == "object" && a.status !== null;
244
- let n, r, m;
240
+ let n, c, m;
245
241
  if (s) {
246
- const P = a.status;
247
- n = P.text, r = P.icon, m = P.svgIcon;
242
+ const B = a.status;
243
+ n = B.text, c = B.icon, m = B.svgIcon;
248
244
  } else
249
245
  n = a.status;
250
- let O = null;
251
- r ? O = /* @__PURE__ */ t.createElement(he, { name: r, size: "xsmall" }) : m && (O = /* @__PURE__ */ t.createElement(j, { icon: m, size: "xsmall" })), e = /* @__PURE__ */ t.createElement(t.Fragment, null, O, n);
246
+ let P = null;
247
+ c ? P = /* @__PURE__ */ t.createElement(ve, { name: c, size: "xsmall" }) : m && (P = /* @__PURE__ */ t.createElement(j, { icon: m, size: "xsmall" })), e = /* @__PURE__ */ t.createElement(t.Fragment, null, P, n);
252
248
  }
253
249
  return /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, e);
254
- }, [a, F]), ye = t.useCallback(() => {
250
+ }, [a, S]), ye = t.useCallback(() => {
255
251
  let e = null;
256
252
  if (a.isFailed) {
257
253
  const s = l.toLanguageString(
258
254
  ce,
259
- c[ce]
255
+ r[ce]
260
256
  );
261
- e = /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-content" }, /* @__PURE__ */ t.createElement(j, { icon: Fe, size: "xsmall" }), /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-text" }, s));
257
+ e = /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-content" }, /* @__PURE__ */ t.createElement(j, { icon: Ae, size: "xsmall" }), /* @__PURE__ */ t.createElement("span", { className: "k-message-failed-text" }, s));
262
258
  }
263
259
  return e;
264
- }, [a, l]), xe = t.useCallback(() => {
260
+ }, [a, l]), Ie = t.useCallback(() => {
265
261
  let e = null;
266
262
  if (a.isFailed) {
267
263
  const s = l.toLanguageString(
268
264
  ue,
269
- c[ue]
265
+ r[ue]
270
266
  );
271
267
  e = /* @__PURE__ */ t.createElement(
272
268
  W,
273
269
  {
274
270
  fillMode: "clear",
275
- size: "small",
271
+ size: "xs",
276
272
  className: "k-resend-button",
277
- svgIcon: Ae,
273
+ svgIcon: Re,
278
274
  "aria-label": s,
279
275
  title: s,
280
276
  onClick: (n) => {
281
- n.stopPropagation(), S && S({
277
+ n.stopPropagation(), D && D({
282
278
  message: a,
283
279
  syntheticEvent: n,
284
280
  nativeEvent: n.nativeEvent,
@@ -289,52 +285,72 @@ const je = t.forwardRef(
289
285
  );
290
286
  }
291
287
  return e;
292
- }, [a, l, S]), Ie = t.useCallback(() => B(
288
+ }, [a, l, D]), we = t.useCallback(() => O(
293
289
  {
294
290
  "k-focus": o,
295
291
  "k-message-removed": a.isDeleted,
296
292
  "k-message-failed": a.isFailed
297
293
  },
298
294
  "k-message"
299
- ), [o, a.isDeleted, a.isFailed]), we = t.useCallback(() => b && b.length > 0 && /* @__PURE__ */ t.createElement(ve, { className: "k-chat-message-toolbar", fillMode: "flat" }, b.map((e) => e.id === "delete" && !C ? null : /* @__PURE__ */ t.createElement(
300
- W,
295
+ ), [o, a.isDeleted, a.isFailed]), Te = t.useCallback(() => b && b.length > 0 && /* @__PURE__ */ t.createElement(
296
+ he,
301
297
  {
302
- key: e.id,
298
+ className: "k-chat-message-toolbar",
303
299
  fillMode: "flat",
304
- className: "k-toolbar-button",
305
- icon: e.icon,
306
- svgIcon: e.svgIcon,
307
- onClick: (s) => {
308
- s.stopPropagation(), e.id === "copy" && !a.isDeleted ? h() : e.id === "reply" && E(a), N && N(e, s, a);
309
- },
310
- onMouseDown: (s) => s.preventDefault()
311
- }
312
- ))), [h, C, a, b, N, E]);
300
+ ariaLabel: l.toLanguageString(
301
+ me,
302
+ r[me]
303
+ )
304
+ },
305
+ b.map((e) => e.id === "delete" && !C ? null : /* @__PURE__ */ t.createElement(
306
+ W,
307
+ {
308
+ key: e.id,
309
+ fillMode: "flat",
310
+ className: "k-toolbar-button",
311
+ icon: e.icon,
312
+ svgIcon: e.svgIcon,
313
+ "aria-label": e.label,
314
+ onClick: (s) => {
315
+ s.stopPropagation(), e.id === "copy" && !a.isDeleted ? w() : e.id === "reply" && E(a), M && M(e, s, a);
316
+ },
317
+ onMouseDown: (s) => s.preventDefault()
318
+ }
319
+ ))
320
+ ), [
321
+ w,
322
+ C,
323
+ a,
324
+ l,
325
+ b,
326
+ M,
327
+ E
328
+ ]);
313
329
  return /* @__PURE__ */ t.createElement(
314
330
  "div",
315
331
  {
316
332
  key: a.id,
317
333
  "data-message-id": a.id,
318
- className: Ie(),
319
- tabIndex: de,
320
- onMouseDown: ge,
321
- onKeyDown: be,
334
+ className: we(),
335
+ tabIndex: fe,
336
+ onMouseDown: be,
337
+ onKeyDown: ke,
322
338
  onFocus: (e) => {
323
- pe && p(a.selectionIndex);
339
+ pe && g(a.selectionIndex);
324
340
  },
325
341
  ref: (e) => {
326
- L.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
342
+ V.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
327
343
  },
328
344
  onContextMenu: f ? z : void 0
329
345
  },
330
- xe(),
331
- ke(),
332
- (a.status || a.timestamp && x !== "hidden" || a.isFailed) && /* @__PURE__ */ t.createElement("div", { className: "k-message-info" }, Ee(), Ce(), ye()),
333
- we()
346
+ Ie(),
347
+ Ce(),
348
+ (a.status || a.timestamp && F !== "hidden" || a.isFailed) && /* @__PURE__ */ t.createElement("div", { className: "k-message-info" }, xe(), Ee(), ye()),
349
+ Te()
334
350
  );
335
351
  }
336
352
  );
337
- je.displayName = "ChatMessage";
353
+ We.displayName = "ChatMessage";
338
354
  export {
339
- je as ChatMessage
355
+ We as ChatMessage
340
356
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";const n=require("react"),a=require("@progress/kendo-react-buttons");function o(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const s=o(n),u=e=>s.createElement(a.Toolbar,{className:"k-chat-header"},e.children);module.exports=u;
8
+ "use strict";const n=require("react"),a=require("@progress/kendo-react-buttons");function o(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const s=o(n),l=e=>s.createElement(a.Toolbar,{className:"k-chat-header",size:"small"},e.children);module.exports=l;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import * as a from "react";
9
9
  import { Toolbar as r } from "@progress/kendo-react-buttons";
10
- const o = (e) => /* @__PURE__ */ a.createElement(r, { className: "k-chat-header" }, e.children);
10
+ const o = (e) => /* @__PURE__ */ a.createElement(r, { className: "k-chat-header", size: "small" }, e.children);
11
11
  export {
12
12
  o as default
13
13
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";const Z=require("@progress/kendo-react-common"),$=require("react"),ee=require("@progress/kendo-react-buttons"),te=require("./SuggestionsGroup.js"),ne=require("@progress/kendo-svg-icons"),ae=require("./ChatContext.js"),oe=require("@progress/kendo-react-intl"),H=require("../utils.js"),n=require("../../messages/index.js"),re=require("../../prompt-box/PromptBoxUploadButton.js"),se=require("../../prompt-box/PromptBox.js");function le(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(c,r,i.get?i:{enumerable:!0,get:()=>l[r]})}}return c.default=l,Object.freeze(c)}const t=le($),_=t.memo(({affixProps:l,uploadConfig:c,localizationService:r,onFilesSelect:i,onFileRemove:C})=>{const k=typeof c=="object"?c:{};return c!==!1?t.createElement(re.PromptBoxUploadButton,{...l.uploadButtonProps,fillMode:"clear","aria-label":r.toLanguageString(n.attachFile,n.messages[n.attachFile]),title:r.toLanguageString(n.attachFile,n.messages[n.attachFile]),...k,onSelectAttachments:i,onRemoveAttachment:C}):null});_.displayName="UploadButtonAffix";const J=t.forwardRef((l,c)=>{const{onSendMessage:r,isDirectionRightToLeft:i,placeholder:C,MessageBox:k,suggestions:b,onSuggestionClick:K,inputValue:E,onInputValueChange:f,suggestionTemplate:Q,sendButtonConfig:A,onInputClick:F,suggestionsLayout:W,dir:X,messageBoxSettings:e,loading:M}=l,{replyToMessage:u,setReplyToMessage:y,user:x,speechToTextConfig:P,uploadConfig:S}=ae.useChatContext(),[Y,I]=t.useState(""),[w,v]=t.useState([]),T=t.useRef(null),o=oe.useLocalization(),m=E!==void 0,R=m?E:Y,p=t.useCallback(()=>{T.current!==null&&T.current.focus()},[]);t.useEffect(()=>{u&&p()},[u,p]);const L=t.useCallback(a=>{if(a.preventDefault(),r){const h={id:"",author:x,text:R||"",timestamp:new Date,replyToId:u?u.id:void 0,files:w.map(g=>({name:g.name,size:g.size,type:g.extension,rawFile:g.getRawFile?g.getRawFile():g}))};y(null),r(h,a),v([]),m||I(""),f&&f(""),p()}},[r,R,x,u,w,y,f,p,m]);t.useImperativeHandle(c,()=>({focusInput:p}),[p]);const q=t.useCallback(a=>{v(s=>s.filter(h=>h.name!==a))},[]),N=t.useCallback((a,s)=>a.isDeleted?H.getDeletedMessageText(s,o):a.text,[o]),D=t.useCallback(()=>{if(u){const a=H.isAuthor(x,u);return t.createElement("div",{className:Z.classNames("k-message-reference",a?"k-message-reference-sender":"k-message-reference-receiver")},t.createElement("div",{className:"k-message-reference-content"},N(u,a)),t.createElement("span",{className:"k-spacer"}),t.createElement(ee.Button,{fillMode:"flat",svgIcon:ne.xMarkSmOutlineIcon,onClick:()=>y(null),"aria-label":o.toLanguageString(n.closeReply,n.messages[n.closeReply]),title:o.toLanguageString(n.closeReply,n.messages[n.closeReply])}))}return null},[u,x,N,y,o]),j=t.useCallback(a=>{try{const s=Array.from(a.allFiles);v(s)}catch{}},[]),B=t.useCallback(a=>{const s=a.value;m||I(s),f&&f(s||"")},[m,f]),G=t.useCallback(a=>{L(a.syntheticEvent)},[L]),d=t.useCallback(a=>a?typeof a=="function"?a():a:null,[]),O=t.useCallback(a=>t.createElement(t.Fragment,null,t.createElement(_,{affixProps:a,uploadConfig:S,localizationService:o,onFilesSelect:j,onFileRemove:q}),d(e==null?void 0:e.startAffix)),[S,o,j,q,e==null?void 0:e.startAffix,d]),U=t.useCallback(()=>d(e==null?void 0:e.endAffix),[e==null?void 0:e.endAffix,d]),V=t.useCallback(()=>d(e==null?void 0:e.topAffix),[e==null?void 0:e.topAffix,d]),z=t.useMemo(()=>{const a=typeof A=="object"?A:{},h=A!==!1?{"aria-label":M?o.toLanguageString(n.chatStopGenerating,n.messages[n.chatStopGenerating]):o.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),title:M?o.toLanguageString(n.chatStopGenerating,n.messages[n.chatStopGenerating]):o.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),dir:i?"rtl":void 0,...a}:!1;return t.createElement(se.PromptBox,{header:D(),ref:T,placeholder:C,value:R,onChange:B,onPromptAction:G,mode:(e==null?void 0:e.mode)||"multi",rows:(e==null?void 0:e.rows)||2,maxTextAreaHeight:(e==null?void 0:e.maxTextAreaHeight)||"110",loading:M,speechToTextButtonConfig:P,actionButtonConfig:h,attachments:w,startAffix:O,endAffix:e!=null&&e.endAffix?U:void 0,topAffix:e!=null&&e.topAffix?V:void 0,inputAttributes:{onClick:F,"aria-label":o.toLanguageString(n.newMessageMessageInput,n.messages[n.newMessageMessageInput])}})},[C,R,B,G,e,M,P,A,w,D,O,U,V,o,i,F]);return t.createElement("div",{className:"k-message-box-wrapper"},b&&b.length>0&&t.createElement(te.SuggestionGroup,{onSuggestionClick:K,suggestions:b,suggestionTemplate:Q,suggestionsLayout:W,dir:X}),k?t.createElement(k,{messageInput:z}):z)});J.displayName="NewMessage";module.exports=J;
8
+ "use strict";const Z=require("@progress/kendo-react-common"),$=require("react"),ee=require("@progress/kendo-react-buttons"),te=require("./SuggestionsGroup.js"),ne=require("@progress/kendo-svg-icons"),ae=require("./ChatContext.js"),oe=require("@progress/kendo-react-intl"),H=require("../utils.js"),n=require("../../messages/index.js"),re=require("../../prompt-box/PromptBoxUploadButton.js"),se=require("../../prompt-box/PromptBox.js");function le(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(c,r,i.get?i:{enumerable:!0,get:()=>l[r]})}}return c.default=l,Object.freeze(c)}const t=le($),_=t.memo(({affixProps:l,uploadConfig:c,localizationService:r,onFilesSelect:i,onFileRemove:h})=>{const k=typeof c=="object"?c:{};return c!==!1?t.createElement(re.PromptBoxUploadButton,{...l.uploadButtonProps,fillMode:"clear","aria-label":r.toLanguageString(n.attachFile,n.messages[n.attachFile]),title:r.toLanguageString(n.attachFile,n.messages[n.attachFile]),...k,onSelectAttachments:i,onRemoveAttachment:h}):null});_.displayName="UploadButtonAffix";const J=t.forwardRef((l,c)=>{const{onSendMessage:r,isDirectionRightToLeft:i,placeholder:h,MessageBox:k,suggestions:b,onSuggestionClick:K,inputValue:E,onInputValueChange:f,suggestionTemplate:Q,sendButtonConfig:A,onInputClick:F,suggestionsLayout:W,dir:X,messageBoxSettings:e,loading:x}=l,{replyToMessage:u,setReplyToMessage:y,user:M,speechToTextConfig:P,uploadConfig:I}=ae.useChatContext(),[Y,L]=t.useState(""),[w,v]=t.useState([]),T=t.useRef(null),o=oe.useLocalization(),m=E!==void 0,R=m?E:Y,p=t.useCallback(()=>{T.current!==null&&T.current.focus()},[]);t.useEffect(()=>{u&&p()},[u,p]);const S=t.useCallback(a=>{if(a.preventDefault(),r){const C={id:"",author:M,text:R||"",timestamp:new Date,replyToId:u?u.id:void 0,files:w.map(g=>({name:g.name,size:g.size,type:g.extension,rawFile:g.getRawFile?g.getRawFile():g}))};y(null),r(C,a),v([]),m||L(""),f&&f(""),p()}},[r,R,M,u,w,y,f,p,m]);t.useImperativeHandle(c,()=>({focusInput:p}),[p]);const q=t.useCallback(a=>{v(s=>s.filter(C=>C.name!==a))},[]),N=t.useCallback((a,s)=>a.isDeleted?H.getDeletedMessageText(s,o):a.text,[o]),D=t.useCallback(()=>{if(u){const a=H.isAuthor(M,u);return t.createElement("div",{className:Z.classNames("k-message-reference",a?"k-message-reference-sender":"k-message-reference-receiver")},t.createElement("div",{className:"k-message-reference-content"},N(u,a)),t.createElement("span",{className:"k-spacer"}),t.createElement(ee.Button,{fillMode:"flat",size:"xs",svgIcon:ne.xCircleIcon,onClick:()=>y(null),"aria-label":o.toLanguageString(n.closeReply,n.messages[n.closeReply]),title:o.toLanguageString(n.closeReply,n.messages[n.closeReply])}))}return null},[u,M,N,y,o]),j=t.useCallback(a=>{try{const s=Array.from(a.allFiles);v(s)}catch{}},[]),B=t.useCallback(a=>{const s=a.value;m||L(s),f&&f(s||"")},[m,f]),G=t.useCallback(a=>{S(a.syntheticEvent)},[S]),d=t.useCallback(a=>a?typeof a=="function"?a():a:null,[]),U=t.useCallback(a=>t.createElement(t.Fragment,null,t.createElement(_,{affixProps:a,uploadConfig:I,localizationService:o,onFilesSelect:j,onFileRemove:q}),d(e==null?void 0:e.startAffix)),[I,o,j,q,e==null?void 0:e.startAffix,d]),V=t.useCallback(()=>d(e==null?void 0:e.endAffix),[e==null?void 0:e.endAffix,d]),z=t.useCallback(()=>d(e==null?void 0:e.topAffix),[e==null?void 0:e.topAffix,d]),O=t.useMemo(()=>{const a=typeof A=="object"?A:{},C=A!==!1?{"aria-label":x?o.toLanguageString(n.chatStopGenerating,n.messages[n.chatStopGenerating]):o.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),title:x?o.toLanguageString(n.chatStopGenerating,n.messages[n.chatStopGenerating]):o.toLanguageString(n.newMessageSendButton,n.messages[n.newMessageSendButton]),dir:i?"rtl":void 0,...a}:!1;return t.createElement(se.PromptBox,{header:D(),ref:T,placeholder:h,value:R,onChange:B,onPromptAction:G,mode:(e==null?void 0:e.mode)||"multi",rows:(e==null?void 0:e.rows)||2,maxTextAreaHeight:(e==null?void 0:e.maxTextAreaHeight)||"110",loading:x,speechToTextButtonConfig:P,actionButtonConfig:C,attachments:w,startAffix:U,endAffix:e!=null&&e.endAffix?V:void 0,topAffix:e!=null&&e.topAffix?z:void 0,inputAttributes:{onClick:F,"aria-label":o.toLanguageString(n.newMessageMessageInput,n.messages[n.newMessageMessageInput])}})},[h,R,B,G,e,x,P,A,w,D,U,V,z,o,i,F]);return t.createElement("div",{className:"k-message-box-wrapper"},b&&b.length>0&&t.createElement(te.SuggestionGroup,{onSuggestionClick:K,suggestions:b,suggestionTemplate:Q,suggestionsLayout:W,dir:X}),k?t.createElement(k,{messageInput:O}):O)});J.displayName="NewMessage";module.exports=J;