@progress/kendo-react-conversational-ui 16.3.0-develop.21 → 16.3.0-develop.22
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/chat/components/AttachmentGroup.d.ts +1 -0
- package/chat/components/AttachmentGroup.js +1 -1
- package/chat/components/AttachmentGroup.mjs +48 -48
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +62 -60
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +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
|
|
8
|
+
"use strict";const N=require("react"),i=require("@progress/kendo-react-common"),L=require("@progress/kendo-svg-icons"),O=require("./Attachment.js"),q=require("@progress/kendo-react-buttons"),j=require("../hooks/useScrollWithButtons.js");function A(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const r in a)if(r!=="default"){const u=Object.getOwnPropertyDescriptor(a,r);Object.defineProperty(e,r,u.get?u:{enumerable:!0,get:()=>a[r]})}}return e.default=a,Object.freeze(e)}const n=A(N),P=a=>{const{group:e,itemTemplate:r,selected:u,isLastGroup:B,onRequestSelection:k,dir:D}=a,[l,d]=n.useState(null),h=n.useRef(null);n.useEffect(()=>{!u&&l!==null?d(null):u&&l===null&&d(0)},[u,l]);const o=n.useCallback(t=>t.attachmentLayout!=="list",[]),{canScrollLeft:g,canScrollRight:C,scrollLeft:b,scrollRight:p}=j.useScrollWithButtons(h,{enabled:o(e),dir:D,itemsDependency:e.attachments}),y=n.useCallback(()=>e.attachments?e.attachments.length-1:-1,[e.attachments]),f=n.useCallback((t,s=0)=>{let c=null;return t?l===null?c=s:l<y()&&(c=l+1):l===null?c=0:l>0&&(c=l-1),c!==null&&d(c),c},[l,y]),I=n.useCallback(()=>{k(e.selectionIndex)},[k,e.selectionIndex]),S=n.useCallback(t=>{let s=null,c,m;o(e)?(c=i.Keys.left,m=i.Keys.right):(c=i.Keys.up,m=i.Keys.down),t.keyCode===c?s=f(!1):t.keyCode===m&&(s=f(!0)),s!==null&&(t.preventDefault(),t.stopPropagation())},[f,o,e]),K=n.useCallback(t=>{I(),d(t)},[I]),w=n.useCallback(()=>{let t=null;return o(e)&&g&&(t=n.createElement(q.Button,{icon:"chevron-left",tabIndex:-1,onClick:b,svgIcon:L.chevronLeftIcon})),t},[o,e,g,b]),x=n.useCallback(()=>{let t=null;return o(e)&&C&&(t=n.createElement(q.Button,{icon:"chevron-right",tabIndex:-1,onClick:p,svgIcon:L.chevronRightIcon})),t},[o,e,C,p]),E=n.useCallback(()=>i.classNames({"k-card-list":e.attachmentLayout,"k-card-deck":o(e)}),[e.attachmentLayout,e,o]),R=o(e),v=n.createElement("div",{ref:h,className:E(),onKeyDown:R?void 0:S},e.attachments.map((t,s)=>n.createElement(O,{item:t,template:r,selected:s===l,tabbable:B&&s===l,onClick:()=>K(s),key:t.content})));return R?n.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:S},w(),v,x()):v};module.exports=P;
|
|
@@ -6,61 +6,61 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as l from "react";
|
|
9
|
-
import { Keys as
|
|
10
|
-
import { chevronLeftIcon as
|
|
11
|
-
import
|
|
12
|
-
import { Button as
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
import { Keys as r, classNames as N } from "@progress/kendo-react-common";
|
|
10
|
+
import { chevronLeftIcon as A, chevronRightIcon as q } from "@progress/kendo-svg-icons";
|
|
11
|
+
import G from "./Attachment.mjs";
|
|
12
|
+
import { Button as L } from "@progress/kendo-react-buttons";
|
|
13
|
+
import { useScrollWithButtons as W } from "../hooks/useScrollWithButtons.mjs";
|
|
14
|
+
const H = (v) => {
|
|
15
|
+
const { group: e, itemTemplate: R, selected: i, isLastGroup: x, onRequestSelection: f, dir: w } = v, [n, s] = l.useState(null), d = l.useRef(null);
|
|
15
16
|
l.useEffect(() => {
|
|
16
|
-
!
|
|
17
|
-
}, [
|
|
18
|
-
const
|
|
19
|
-
(e,
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
!i && n !== null ? s(null) : i && n === null && s(0);
|
|
18
|
+
}, [i, n]);
|
|
19
|
+
const o = l.useCallback((t) => t.attachmentLayout !== "list", []), { canScrollLeft: h, canScrollRight: k, scrollLeft: C, scrollRight: p } = W(d, {
|
|
20
|
+
enabled: o(e),
|
|
21
|
+
dir: w,
|
|
22
|
+
itemsDependency: e.attachments
|
|
23
|
+
}), g = l.useCallback(() => e.attachments ? e.attachments.length - 1 : -1, [e.attachments]), u = l.useCallback(
|
|
24
|
+
(t, a = 0) => {
|
|
25
|
+
let c = null;
|
|
26
|
+
return t ? n === null ? c = a : n < g() && (c = n + 1) : n === null ? c = 0 : n > 0 && (c = n - 1), c !== null && s(c), c;
|
|
22
27
|
},
|
|
23
|
-
[n,
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
(
|
|
28
|
-
let
|
|
29
|
-
|
|
28
|
+
[n, g]
|
|
29
|
+
), b = l.useCallback(() => {
|
|
30
|
+
f(e.selectionIndex);
|
|
31
|
+
}, [f, e.selectionIndex]), I = l.useCallback(
|
|
32
|
+
(t) => {
|
|
33
|
+
let a = null, c, m;
|
|
34
|
+
o(e) ? (c = r.left, m = r.right) : (c = r.up, m = r.down), t.keyCode === c ? a = u(!1) : t.keyCode === m && (a = u(!0)), a !== null && (t.preventDefault(), t.stopPropagation());
|
|
30
35
|
},
|
|
31
|
-
[
|
|
32
|
-
),
|
|
33
|
-
(
|
|
34
|
-
|
|
36
|
+
[u, o, e]
|
|
37
|
+
), D = l.useCallback(
|
|
38
|
+
(t) => {
|
|
39
|
+
b(), s(t);
|
|
35
40
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [c, t, n, h, i]), E = l.useCallback(() => B({
|
|
49
|
-
"k-card-list": t.attachmentLayout,
|
|
50
|
-
"k-card-deck": c(t)
|
|
51
|
-
}), [t.attachmentLayout, t, c]), p = c(t), I = /* @__PURE__ */ l.createElement("div", { className: E(), onKeyDown: p ? void 0 : g }, t.attachments.map((e, s) => /* @__PURE__ */ l.createElement(
|
|
52
|
-
N,
|
|
41
|
+
[b]
|
|
42
|
+
), E = l.useCallback(() => {
|
|
43
|
+
let t = null;
|
|
44
|
+
return o(e) && h && (t = /* @__PURE__ */ l.createElement(L, { icon: "chevron-left", tabIndex: -1, onClick: C, svgIcon: A })), t;
|
|
45
|
+
}, [o, e, h, C]), B = l.useCallback(() => {
|
|
46
|
+
let t = null;
|
|
47
|
+
return o(e) && k && (t = /* @__PURE__ */ l.createElement(L, { icon: "chevron-right", tabIndex: -1, onClick: p, svgIcon: q })), t;
|
|
48
|
+
}, [o, e, k, p]), K = l.useCallback(() => N({
|
|
49
|
+
"k-card-list": e.attachmentLayout,
|
|
50
|
+
"k-card-deck": o(e)
|
|
51
|
+
}), [e.attachmentLayout, e, o]), y = o(e), S = /* @__PURE__ */ l.createElement("div", { ref: d, className: K(), onKeyDown: y ? void 0 : I }, e.attachments.map((t, a) => /* @__PURE__ */ l.createElement(
|
|
52
|
+
G,
|
|
53
53
|
{
|
|
54
|
-
item:
|
|
55
|
-
template:
|
|
56
|
-
selected:
|
|
57
|
-
tabbable:
|
|
58
|
-
onClick: () =>
|
|
59
|
-
key:
|
|
54
|
+
item: t,
|
|
55
|
+
template: R,
|
|
56
|
+
selected: a === n,
|
|
57
|
+
tabbable: x && a === n,
|
|
58
|
+
onClick: () => D(a),
|
|
59
|
+
key: t.content
|
|
60
60
|
}
|
|
61
61
|
)));
|
|
62
|
-
return
|
|
62
|
+
return y ? /* @__PURE__ */ l.createElement("div", { className: "k-card-deck-scrollwrap", onKeyDown: I }, E(), S, B()) : S;
|
|
63
63
|
};
|
|
64
64
|
export {
|
|
65
|
-
|
|
65
|
+
H as default
|
|
66
66
|
};
|
package/chat/components/Chat.js
CHANGED
|
@@ -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 i=require("@progress/kendo-react-common"),n=require("prop-types"),Bt=require("react"),Nt=require("@progress/kendo-react-buttons"),Ot=require("@progress/kendo-svg-icons"),Dt=require("../ViewItem.js"),Pt=require("./ActionGroup.js"),jt=require("./AttachmentGroup.js"),Ut=require("./DateMarker.js"),Vt=require("./MessageGroup.js"),zt=require("./NewMessage.js"),Wt=require("./Header.js"),Kt=require("./elements/PinnedMessage.js"),Gt=require("./Notification.js"),Ht=require("./ChatContext.js"),_t=require("./ChatMessage.js"),Ge=require("../../package-metadata.js"),a=require("../../messages/index.js"),$t=require("@progress/kendo-react-intl"),He=require("../utils/fieldMapping.js"),_e=require("../utils/scroll.js"),Jt=require("../utils/messageSettings.js"),Qt=require("../hooks/useEndlessScroll.js");function Xt(u){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const r in u)if(r!=="default"){const k=Object.getOwnPropertyDescriptor(u,r);Object.defineProperty(m,r,k.get?k:{enumerable:!0,get:()=>u[r]})}}return m.default=u,Object.freeze(m)}const t=Xt(Bt),K=t.forwardRef((u,m)=>{const{messages:r=[],messageTemplate:k,messageContentTemplate:G,attachmentTemplate:I,width:$e,height:Je,onSendMessage:v,onSuggestionClick:H,onInputValueChange:_,onActionExecute:B,dir:b,messageBox:Qe,placeholder:Xe,className:$,style:Ye,message:J=_t.ChatMessage,authorId:l,suggestions:Ze,suggestionTemplate:et,suggestionsLayout:tt="scroll",quickActionsLayout:Q="scroll",inputValue:st,headerTemplate:C,noDataTemplate:T,timestampTemplate:X,statusTemplate:Y,userStatusTemplate:Z,allowMessageCollapse:ee,messageToolbarActions:te,messageContextMenuActions:se,fileActions:w,onUnpin:nt,messageWidthMode:ne,showAvatar:oe,showUsername:ae,timestampVisibility:re,authorMessageSettings:le,receiverMessageSettings:ie,onToolbarAction:ce,onContextMenuAction:ue,onFileAction:de,onDownload:ge,speechToTextConfig:me,uploadConfig:fe,sendButtonConfig:ot,messageFilesLayout:pe,scrollToBottomButton:N=!0,autoScrollThreshold:at,textField:he,statusField:Me,authorIdField:ye,authorNameField:Se,authorImageUrlField:be,authorImageAltTextField:Ce,idField:Te,timestampField:ke,filesField:ve,attachmentsField:Re,replyToIdField:Ee,isDeletedField:xe,isPinnedField:we,typingField:Ae,suggestedActionsField:qe,isFailedField:Le,onResendMessage:Fe,messageBoxSettings:rt,loading:lt,scrollMode:it,total:ct,pageSize:ut,startIndex:dt,endIndex:gt,onLoadMoreMessages:mt,pinnedMessages:O,repliedToMessages:Ie,onReferencedMessageClick:ft,...pt}=u,ht=t.useRef(null);i.useWebMcpRegister("chat",ht,u,u.webMcp);const[h,D]=t.useState(null),[P,Mt]=t.useState(!1),[yt,Be]=t.useState(!1),[Ne,Oe]=t.useState(null),[M,De]=t.useState(null),[St,Pe]=t.useState(!1),j=t.useRef(null),je=t.useRef(null),f=t.useRef(null),Ue=t.useRef(null),U=t.useRef(void 0),V=t.useRef(!1),z=t.useRef(null),Ve=t.useRef(""),p=t.useMemo(()=>{if(!r||r.length===0)return[];const s={textField:he,statusField:Me,authorIdField:ye,authorNameField:Se,authorImageUrlField:be,authorImageAltTextField:Ce,idField:Te,timestampField:ke,filesField:ve,attachmentsField:Re,replyToIdField:Ee,isDeletedField:xe,isPinnedField:we,typingField:Ae,suggestedActionsField:qe,isFailedField:Le};return!Object.values(s).some(o=>o!==void 0)&&He.isStandardMessageFormat(r[0])?r.map(o=>({...o,timestamp:o.timestamp?new Date(o.timestamp):o.timestamp})):He.mapDataArrayToMessages(r,s)},[r,he,Me,ye,Se,be,Ce,Te,ke,ve,Re,Ee,xe,we,Ae,qe,Le]);t.useEffect(()=>{if(l===Ve.current&&z.current){De(z.current);return}if(l&&p.length>0){const s=p.find(o=>o.author&&(o.author.id===l||o.author.id===String(l))),e=(s==null?void 0:s.author)||{id:l};z.current=e,Ve.current=l,De(e)}},[l,p]);const{renderedMessages:y,handleScrollToBottom:bt,handleReferencedMessageClick:W,isEndless:Ct,isOnLastBatch:ze,skipAutoScrollRef:Tt}=Qt.useEndlessScroll({scrollMode:it,processedMessages:p,total:ct,pageSize:ut,startIndex:dt,endIndex:gt,onLoadMoreMessages:mt,onReferencedMessageClick:ft,viewItemsWrapperRef:f,authorId:l}),S=t.useMemo(()=>y.length>0?Dt.convertMsgsToViewItems(y):[],[y]),kt=t.useMemo(()=>!i.validatePackage(Ge.packageMetadata,{component:"Chat"}),[]),vt=i.getLicenseMessage(Ge.packageMetadata),We=t.useMemo(()=>{if(O)return O.find(e=>e.isPinned);const s=p.find(e=>e.isPinned);if(s)return s},[p,O]),A=$t.useLocalization();_e.useMessageAutoScroll({viewItemsWrapperRef:f,isKeyboardNavigationActiveRef:V,processedMessages:y,authorId:l,autoScrollThreshold:at,isEndless:Ct,isOnLastBatch:ze,skipAutoScrollRef:Tt});const Rt=_e.useHasScrollbar({elementRef:f}),Et=t.useCallback(()=>{clearTimeout(U.current)},[]),xt=t.useCallback(()=>{U.current=window.setTimeout(()=>{D(null)},0)},[]),q=t.useCallback(s=>{D(s)},[]),wt=t.useCallback(s=>{let e=null;const o=h!==null?h:S.lastSelectionIndex;s.keyCode===i.Keys.up?o===null?e=0:o>0&&(e=o-1):s.keyCode===i.Keys.down?o===null?e=0:o<S.lastSelectionIndex&&(e=o+1):s.keyCode===i.Keys.home?e=0:s.keyCode===i.Keys.end&&(e=S.lastSelectionIndex),e!==null&&(D(e),V.current=!0,s.preventDefault())},[h,S]),Ke=t.useCallback((s,e,o)=>{var d;if(B&&B({action:{value:s.value,title:s.title,type:s.type},syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.currentTarget}),!e.isDefaultPrevented()){switch(s.type){case"reply":v&&v({message:{id:"",author:M,text:s.value,timestamp:new Date},syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.currentTarget});break;case"call":window.open("tel:"+s.value);break;case"openUrl":{const g=i.sanitizeUrl(s.value);g&&window.open(g,"_blank","noopener,noreferrer");break}}(d=Ue.current)==null||d.focusInput()}},[B,v,M]),At=t.useCallback(()=>i.classNames("k-chat",$,{"k-rtl":P}),[$,P]),qt=t.useCallback(()=>{const s=S.length-1;return S.map((e,o)=>{var d,g,R,E,x,L;if(e.type==="date-marker")return t.createElement(Ut,{item:e,key:e.trackBy,timestampTemplate:X});if(e.type==="message-group"){const F={allowMessageCollapse:ee,messageWidthMode:ne,showAvatar:oe,showUsername:ae,messageTemplate:k,messageContentTemplate:G,messageToolbarActions:te,messageContextMenuActions:se,fileActions:w},c=Jt.resolveMessageSettings((d=e.messages)==null?void 0:d[0],l,F,le,ie);return t.createElement(Vt,{group:e,itemTemplate:c.messageTemplate,contentTemplate:c.messageContentTemplate,attachmentTemplate:I,user:M,selectedItemIndex:h,onRequestSelection:q,isLastGroup:o===s,key:(g=e.messages[0].id)!=null?g:e.messages[0].selectionIndex,message:J,allowMessageCollapse:c.allowMessageCollapse,messageToolbarActions:c.messageToolbarActions,messageContextMenuActions:c.messageContextMenuActions,fileActions:c.fileActions,messageWidthMode:c.messageWidthMode,showAvatar:c.showAvatar,showUsername:c.showUsername})}else{if(e.type==="attachment-group")return t.createElement(jt,{group:e,itemTemplate:I,onRequestSelection:q,selected:e.selectionIndex===h,isLastGroup:o===s,key:`att-${(E=(R=e.trackBy)==null?void 0:R.id)!=null?E:e.selectionIndex}`});if(e.type==="action-group")return t.createElement(Pt,{group:e,onActionExecute:Ke,onRequestSelection:q,selected:e.selectionIndex===h,key:`act-${(L=(x=e.trackBy)==null?void 0:x.id)!=null?L:e.selectionIndex}`,quickActionsLayout:Q,dir:b})}return null})},[S,X,k,G,I,M,h,q,J,ee,te,se,w,ne,oe,ae,l,le,ie,Ke,Q,b]),Lt=t.useCallback(()=>C?typeof C=="function"?C():C:null,[C]),Ft=t.useCallback(()=>T?typeof T=="function"?T():T:null,[T]);t.useEffect(()=>{const s=b!==void 0?b==="rtl":j.current&&getComputedStyle(j.current).direction==="rtl";Mt(!!s)},[b]),t.useEffect(()=>()=>{clearTimeout(U.current)},[]),t.useEffect(()=>{if(!N||!f.current)return;let s,e;const o=()=>{s=void 0;const E=f.current;if(!E)return;const{scrollHeight:x,scrollTop:L,clientHeight:F}=E;!(x>F)||x-L-F<=100?(e!==void 0&&(clearTimeout(e),e=void 0),Pe(!1)):e!=null||(e=setTimeout(()=>{e=void 0,Pe(!0)},300))},d=()=>{s===void 0&&(s=requestAnimationFrame(o))},g=f.current;g.addEventListener("scroll",d,{passive:!0});const R=new MutationObserver(d);return R.observe(g,{childList:!0,subtree:!0,characterData:!0}),()=>{g.removeEventListener("scroll",d),R.disconnect(),s!==void 0&&cancelAnimationFrame(s),e!==void 0&&clearTimeout(e)}},[N]);const It=t.useMemo(()=>({replyToMessage:Ne,setReplyToMessage:Oe,messages:p,repliedToMessages:Ie,user:M,internalScrollContainerRef:je,messageListScrollContainerRef:f,onToolbarAction:ce,onContextMenuAction:ue,onFileAction:de,setShowCopyNotification:Be,onDownload:ge,onResendMessage:Fe,fileActions:w,speechToTextConfig:me,uploadConfig:fe,statusTemplate:Y,userStatusTemplate:Z,messageFilesLayout:pe,timestampVisibility:re,onReferencedMessageClick:W}),[Ne,Oe,p,Ie,M,ce,ue,de,Be,ge,Fe,w,me,fe,Y,Z,pe,re,W]);return t.createElement(Ht.default.Provider,{value:It},t.createElement("div",{style:{width:$e,height:Je,position:"relative",overflow:"hidden",...Ye},onKeyDown:wt,className:At(),ref:s=>{j.current=s,je.current=s,typeof m=="function"?m(s):m&&(m.current=s)},...pt},C!==void 0&&t.createElement(Wt,null,Lt()),t.createElement("div",{className:"k-message-list",onBlur:xt,onFocus:Et,role:"log","aria-label":A.toLanguageString(a.ariaLabelMessageList,a.messages[a.ariaLabelMessageList]),"aria-live":"polite",ref:f,style:{scrollBehavior:"auto"}},We&&t.createElement(Kt,{message:We,onUnpin:nt,user:M,onReferencedMessageClick:W}),t.createElement("div",{className:i.classNames("k-message-list-content",{"k-message-list-content-empty":y.length===0})},y.length===0&&T!==void 0&&Ft(),y.length>0&&qt()),N&&(St||!ze)&&t.createElement("div",{className:"k-chat-scroll-to-bottom-container"},t.createElement(Nt.FloatingActionButton,{svgIcon:Ot.arrowDownIcon,size:"small",themeColor:"base",rounded:"full",onClick:bt,"aria-label":A.toLanguageString(a.scrollToBottom,a.messages[a.scrollToBottom]),title:A.toLanguageString(a.scrollToBottom,a.messages[a.scrollToBottom])}))),Rt&&t.createElement("div",{className:"k-separator"}),t.createElement(zt,{onSendMessage:(s,e)=>{v&&v({message:s,syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.currentTarget})},onSuggestionClick:s=>{H&&H(s)},isDirectionRightToLeft:P,ref:Ue,placeholder:Xe,MessageBox:Qe,suggestions:Ze,suggestionTemplate:et,inputValue:st,onInputValueChange:s=>{_&&_(s)},onInputClick:()=>{V.current=!1},sendButtonConfig:ot,suggestionsLayout:tt,dir:b,messageBoxSettings:rt,loading:lt}),t.createElement(Gt,{show:yt,text:A.toLanguageString(a.chatCopyNotification,a.messages[a.chatCopyNotification])}),kt&&t.createElement(i.WatermarkOverlay,{message:vt})))});K.displayName="Chat";K.propTypes={messages:n.arrayOf(n.object),user:n.object,messageTemplate:n.any,messageContentTemplate:n.any,attachmentTemplate:n.any,width:n.oneOfType([n.string,n.number]),style:n.object,onSendMessage:n.func,onActionExecute:n.func,dir:n.string,messageBox:n.any,noDataTemplate:n.oneOfType([n.element,n.func]),suggestionsLayout:n.oneOf(["scroll","wrap","scrollbuttons"]),quickActionsLayout:n.oneOf(["scroll","wrap","scrollbuttons"]),userStatusTemplate:n.elementType,messageFilesLayout:n.oneOf(["vertical","wrap","horizontal"]),showAvatar:n.bool,showUsername:n.bool,authorMessageSettings:n.object,receiverMessageSettings:n.object,scrollMode:n.oneOf(["scrollable","endless"]),total:n.number,pageSize:n.number,startIndex:n.number,endIndex:n.number,onLoadMoreMessages:n.func,pinnedMessages:n.arrayOf(n.object),repliedToMessages:n.arrayOf(n.object),onReferencedMessageClick:n.func};exports.Chat=K;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@progress/kendo-react-common"),n=require("prop-types"),Bt=require("react"),Nt=require("@progress/kendo-react-buttons"),Ot=require("@progress/kendo-svg-icons"),Dt=require("../ViewItem.js"),Pt=require("./ActionGroup.js"),jt=require("./AttachmentGroup.js"),Ut=require("./DateMarker.js"),Vt=require("./MessageGroup.js"),zt=require("./NewMessage.js"),Wt=require("./Header.js"),Kt=require("./elements/PinnedMessage.js"),Gt=require("./Notification.js"),Ht=require("./ChatContext.js"),_t=require("./ChatMessage.js"),Ge=require("../../package-metadata.js"),a=require("../../messages/index.js"),$t=require("@progress/kendo-react-intl"),He=require("../utils/fieldMapping.js"),_e=require("../utils/scroll.js"),Jt=require("../utils/messageSettings.js"),Qt=require("../hooks/useEndlessScroll.js");function Xt(u){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const r in u)if(r!=="default"){const k=Object.getOwnPropertyDescriptor(u,r);Object.defineProperty(m,r,k.get?k:{enumerable:!0,get:()=>u[r]})}}return m.default=u,Object.freeze(m)}const t=Xt(Bt),K=t.forwardRef((u,m)=>{const{messages:r=[],messageTemplate:k,messageContentTemplate:G,attachmentTemplate:B,width:$e,height:Je,onSendMessage:v,onSuggestionClick:H,onInputValueChange:_,onActionExecute:N,dir:b,messageBox:Qe,placeholder:Xe,className:$,style:Ye,message:J=_t.ChatMessage,authorId:l,suggestions:Ze,suggestionTemplate:et,suggestionsLayout:tt="scroll",quickActionsLayout:Q="scroll",inputValue:st,headerTemplate:C,noDataTemplate:T,timestampTemplate:X,statusTemplate:Y,userStatusTemplate:Z,allowMessageCollapse:ee,messageToolbarActions:te,messageContextMenuActions:se,fileActions:A,onUnpin:nt,messageWidthMode:ne,showAvatar:oe,showUsername:ae,timestampVisibility:re,authorMessageSettings:le,receiverMessageSettings:ie,onToolbarAction:ce,onContextMenuAction:ue,onFileAction:de,onDownload:ge,speechToTextConfig:me,uploadConfig:fe,sendButtonConfig:ot,messageFilesLayout:pe,scrollToBottomButton:O=!0,autoScrollThreshold:at,textField:he,statusField:Me,authorIdField:ye,authorNameField:Se,authorImageUrlField:be,authorImageAltTextField:Ce,idField:Te,timestampField:ke,filesField:ve,attachmentsField:Re,replyToIdField:Ee,isDeletedField:xe,isPinnedField:we,typingField:Ae,suggestedActionsField:qe,isFailedField:Le,onResendMessage:Fe,messageBoxSettings:rt,loading:lt,scrollMode:it,total:ct,pageSize:ut,startIndex:dt,endIndex:gt,onLoadMoreMessages:mt,pinnedMessages:D,repliedToMessages:Ie,onReferencedMessageClick:ft,...pt}=u,ht=t.useRef(null);i.useWebMcpRegister("chat",ht,u,u.webMcp);const[h,P]=t.useState(null),[R,Mt]=t.useState(!1),[yt,Be]=t.useState(!1),[Ne,Oe]=t.useState(null),[M,De]=t.useState(null),[St,Pe]=t.useState(!1),j=t.useRef(null),je=t.useRef(null),f=t.useRef(null),Ue=t.useRef(null),U=t.useRef(void 0),V=t.useRef(!1),z=t.useRef(null),Ve=t.useRef(""),p=t.useMemo(()=>{if(!r||r.length===0)return[];const s={textField:he,statusField:Me,authorIdField:ye,authorNameField:Se,authorImageUrlField:be,authorImageAltTextField:Ce,idField:Te,timestampField:ke,filesField:ve,attachmentsField:Re,replyToIdField:Ee,isDeletedField:xe,isPinnedField:we,typingField:Ae,suggestedActionsField:qe,isFailedField:Le};return!Object.values(s).some(o=>o!==void 0)&&He.isStandardMessageFormat(r[0])?r.map(o=>({...o,timestamp:o.timestamp?new Date(o.timestamp):o.timestamp})):He.mapDataArrayToMessages(r,s)},[r,he,Me,ye,Se,be,Ce,Te,ke,ve,Re,Ee,xe,we,Ae,qe,Le]);t.useEffect(()=>{if(l===Ve.current&&z.current){De(z.current);return}if(l&&p.length>0){const s=p.find(o=>o.author&&(o.author.id===l||o.author.id===String(l))),e=(s==null?void 0:s.author)||{id:l};z.current=e,Ve.current=l,De(e)}},[l,p]);const{renderedMessages:y,handleScrollToBottom:bt,handleReferencedMessageClick:W,isEndless:Ct,isOnLastBatch:ze,skipAutoScrollRef:Tt}=Qt.useEndlessScroll({scrollMode:it,processedMessages:p,total:ct,pageSize:ut,startIndex:dt,endIndex:gt,onLoadMoreMessages:mt,onReferencedMessageClick:ft,viewItemsWrapperRef:f,authorId:l}),S=t.useMemo(()=>y.length>0?Dt.convertMsgsToViewItems(y):[],[y]),kt=t.useMemo(()=>!i.validatePackage(Ge.packageMetadata,{component:"Chat"}),[]),vt=i.getLicenseMessage(Ge.packageMetadata),We=t.useMemo(()=>{if(D)return D.find(e=>e.isPinned);const s=p.find(e=>e.isPinned);if(s)return s},[p,D]),q=$t.useLocalization();_e.useMessageAutoScroll({viewItemsWrapperRef:f,isKeyboardNavigationActiveRef:V,processedMessages:y,authorId:l,autoScrollThreshold:at,isEndless:Ct,isOnLastBatch:ze,skipAutoScrollRef:Tt});const Rt=_e.useHasScrollbar({elementRef:f}),Et=t.useCallback(()=>{clearTimeout(U.current)},[]),xt=t.useCallback(()=>{U.current=window.setTimeout(()=>{P(null)},0)},[]),L=t.useCallback(s=>{P(s)},[]),wt=t.useCallback(s=>{let e=null;const o=h!==null?h:S.lastSelectionIndex;s.keyCode===i.Keys.up?o===null?e=0:o>0&&(e=o-1):s.keyCode===i.Keys.down?o===null?e=0:o<S.lastSelectionIndex&&(e=o+1):s.keyCode===i.Keys.home?e=0:s.keyCode===i.Keys.end&&(e=S.lastSelectionIndex),e!==null&&(P(e),V.current=!0,s.preventDefault())},[h,S]),Ke=t.useCallback((s,e,o)=>{var d;if(N&&N({action:{value:s.value,title:s.title,type:s.type},syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.currentTarget}),!e.isDefaultPrevented()){switch(s.type){case"reply":v&&v({message:{id:"",author:M,text:s.value,timestamp:new Date},syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.currentTarget});break;case"call":window.open("tel:"+s.value);break;case"openUrl":{const g=i.sanitizeUrl(s.value);g&&window.open(g,"_blank","noopener,noreferrer");break}}(d=Ue.current)==null||d.focusInput()}},[N,v,M]),At=t.useCallback(()=>i.classNames("k-chat",$,{"k-rtl":R}),[$,R]),qt=t.useCallback(()=>{const s=S.length-1;return S.map((e,o)=>{var d,g,E,x,w,F;if(e.type==="date-marker")return t.createElement(Ut,{item:e,key:e.trackBy,timestampTemplate:X});if(e.type==="message-group"){const I={allowMessageCollapse:ee,messageWidthMode:ne,showAvatar:oe,showUsername:ae,messageTemplate:k,messageContentTemplate:G,messageToolbarActions:te,messageContextMenuActions:se,fileActions:A},c=Jt.resolveMessageSettings((d=e.messages)==null?void 0:d[0],l,I,le,ie);return t.createElement(Vt,{group:e,itemTemplate:c.messageTemplate,contentTemplate:c.messageContentTemplate,attachmentTemplate:B,user:M,selectedItemIndex:h,onRequestSelection:L,isLastGroup:o===s,key:(g=e.messages[0].id)!=null?g:e.messages[0].selectionIndex,message:J,allowMessageCollapse:c.allowMessageCollapse,messageToolbarActions:c.messageToolbarActions,messageContextMenuActions:c.messageContextMenuActions,fileActions:c.fileActions,messageWidthMode:c.messageWidthMode,showAvatar:c.showAvatar,showUsername:c.showUsername})}else{if(e.type==="attachment-group")return t.createElement(jt,{group:e,itemTemplate:B,onRequestSelection:L,selected:e.selectionIndex===h,isLastGroup:o===s,dir:R?"rtl":"ltr",key:`att-${(x=(E=e.trackBy)==null?void 0:E.id)!=null?x:e.selectionIndex}`});if(e.type==="action-group")return t.createElement(Pt,{group:e,onActionExecute:Ke,onRequestSelection:L,selected:e.selectionIndex===h,key:`act-${(F=(w=e.trackBy)==null?void 0:w.id)!=null?F:e.selectionIndex}`,quickActionsLayout:Q,dir:b})}return null})},[S,X,k,G,B,M,h,L,J,ee,te,se,A,ne,oe,ae,l,le,ie,Ke,Q,b,R]),Lt=t.useCallback(()=>C?typeof C=="function"?C():C:null,[C]),Ft=t.useCallback(()=>T?typeof T=="function"?T():T:null,[T]);t.useEffect(()=>{const s=b!==void 0?b==="rtl":j.current&&getComputedStyle(j.current).direction==="rtl";Mt(!!s)},[b]),t.useEffect(()=>()=>{clearTimeout(U.current)},[]),t.useEffect(()=>{if(!O||!f.current)return;let s,e;const o=()=>{s=void 0;const x=f.current;if(!x)return;const{scrollHeight:w,scrollTop:F,clientHeight:I}=x;!(w>I)||w-F-I<=100?(e!==void 0&&(clearTimeout(e),e=void 0),Pe(!1)):e!=null||(e=setTimeout(()=>{e=void 0,Pe(!0)},300))},d=()=>{s===void 0&&(s=requestAnimationFrame(o))},g=f.current;g.addEventListener("scroll",d,{passive:!0});const E=new MutationObserver(d);return E.observe(g,{childList:!0,subtree:!0,characterData:!0}),()=>{g.removeEventListener("scroll",d),E.disconnect(),s!==void 0&&cancelAnimationFrame(s),e!==void 0&&clearTimeout(e)}},[O]);const It=t.useMemo(()=>({replyToMessage:Ne,setReplyToMessage:Oe,messages:p,repliedToMessages:Ie,user:M,internalScrollContainerRef:je,messageListScrollContainerRef:f,onToolbarAction:ce,onContextMenuAction:ue,onFileAction:de,setShowCopyNotification:Be,onDownload:ge,onResendMessage:Fe,fileActions:A,speechToTextConfig:me,uploadConfig:fe,statusTemplate:Y,userStatusTemplate:Z,messageFilesLayout:pe,timestampVisibility:re,onReferencedMessageClick:W}),[Ne,Oe,p,Ie,M,ce,ue,de,Be,ge,Fe,A,me,fe,Y,Z,pe,re,W]);return t.createElement(Ht.default.Provider,{value:It},t.createElement("div",{style:{width:$e,height:Je,position:"relative",overflow:"hidden",...Ye},onKeyDown:wt,className:At(),ref:s=>{j.current=s,je.current=s,typeof m=="function"?m(s):m&&(m.current=s)},...pt},C!==void 0&&t.createElement(Wt,null,Lt()),t.createElement("div",{className:"k-message-list",onBlur:xt,onFocus:Et,role:"log","aria-label":q.toLanguageString(a.ariaLabelMessageList,a.messages[a.ariaLabelMessageList]),"aria-live":"polite",ref:f,style:{scrollBehavior:"auto"}},We&&t.createElement(Kt,{message:We,onUnpin:nt,user:M,onReferencedMessageClick:W}),t.createElement("div",{className:i.classNames("k-message-list-content",{"k-message-list-content-empty":y.length===0})},y.length===0&&T!==void 0&&Ft(),y.length>0&&qt()),O&&(St||!ze)&&t.createElement("div",{className:"k-chat-scroll-to-bottom-container"},t.createElement(Nt.FloatingActionButton,{svgIcon:Ot.arrowDownIcon,size:"small",themeColor:"base",rounded:"full",onClick:bt,"aria-label":q.toLanguageString(a.scrollToBottom,a.messages[a.scrollToBottom]),title:q.toLanguageString(a.scrollToBottom,a.messages[a.scrollToBottom])}))),Rt&&t.createElement("div",{className:"k-separator"}),t.createElement(zt,{onSendMessage:(s,e)=>{v&&v({message:s,syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.currentTarget})},onSuggestionClick:s=>{H&&H(s)},isDirectionRightToLeft:R,ref:Ue,placeholder:Xe,MessageBox:Qe,suggestions:Ze,suggestionTemplate:et,inputValue:st,onInputValueChange:s=>{_&&_(s)},onInputClick:()=>{V.current=!1},sendButtonConfig:ot,suggestionsLayout:tt,dir:b,messageBoxSettings:rt,loading:lt}),t.createElement(Gt,{show:yt,text:q.toLanguageString(a.chatCopyNotification,a.messages[a.chatCopyNotification])}),kt&&t.createElement(i.WatermarkOverlay,{message:vt})))});K.displayName="Chat";K.propTypes={messages:n.arrayOf(n.object),user:n.object,messageTemplate:n.any,messageContentTemplate:n.any,attachmentTemplate:n.any,width:n.oneOfType([n.string,n.number]),style:n.object,onSendMessage:n.func,onActionExecute:n.func,dir:n.string,messageBox:n.any,noDataTemplate:n.oneOfType([n.element,n.func]),suggestionsLayout:n.oneOf(["scroll","wrap","scrollbuttons"]),quickActionsLayout:n.oneOf(["scroll","wrap","scrollbuttons"]),userStatusTemplate:n.elementType,messageFilesLayout:n.oneOf(["vertical","wrap","horizontal"]),showAvatar:n.bool,showUsername:n.bool,authorMessageSettings:n.object,receiverMessageSettings:n.object,scrollMode:n.oneOf(["scrollable","endless"]),total:n.number,pageSize:n.number,startIndex:n.number,endIndex:n.number,onLoadMoreMessages:n.func,pinnedMessages:n.arrayOf(n.object),repliedToMessages:n.arrayOf(n.object),onReferencedMessageClick:n.func};exports.Chat=K;
|
package/chat/components/Chat.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { useWebMcpRegister as Ot, validatePackage as Ut, getLicenseMessage as Pt, Keys as
|
|
8
|
+
import { useWebMcpRegister as Ot, validatePackage as Ut, getLicenseMessage as Pt, Keys as F, sanitizeUrl as jt, classNames as He, WatermarkOverlay as Vt } from "@progress/kendo-react-common";
|
|
9
9
|
import o from "prop-types";
|
|
10
10
|
import * as t from "react";
|
|
11
11
|
import { FloatingActionButton as qt } from "@progress/kendo-react-buttons";
|
|
@@ -22,24 +22,24 @@ import Xt from "./Notification.mjs";
|
|
|
22
22
|
import Yt from "./ChatContext.mjs";
|
|
23
23
|
import { ChatMessage as Zt } from "./ChatMessage.mjs";
|
|
24
24
|
import { packageMetadata as Ke } from "../../package-metadata.mjs";
|
|
25
|
-
import { ariaLabelMessageList as $e, messages as
|
|
25
|
+
import { ariaLabelMessageList as $e, messages as L, scrollToBottom as I, chatCopyNotification as _e } from "../../messages/index.mjs";
|
|
26
26
|
import { useLocalization as es } from "@progress/kendo-react-intl";
|
|
27
27
|
import { isStandardMessageFormat as ts, mapDataArrayToMessages as ss } from "../utils/fieldMapping.mjs";
|
|
28
28
|
import { useMessageAutoScroll as os, useHasScrollbar as ns } from "../utils/scroll.mjs";
|
|
29
29
|
import { resolveMessageSettings as as } from "../utils/messageSettings.mjs";
|
|
30
30
|
import { useEndlessScroll as rs } from "../hooks/useEndlessScroll.mjs";
|
|
31
|
-
const Je = t.forwardRef((
|
|
31
|
+
const Je = t.forwardRef((B, v) => {
|
|
32
32
|
const {
|
|
33
33
|
messages: p = [],
|
|
34
34
|
messageTemplate: G,
|
|
35
35
|
messageContentTemplate: H,
|
|
36
|
-
attachmentTemplate:
|
|
36
|
+
attachmentTemplate: N,
|
|
37
37
|
width: Qe,
|
|
38
38
|
height: Xe,
|
|
39
39
|
onSendMessage: C,
|
|
40
40
|
onSuggestionClick: K,
|
|
41
41
|
onInputValueChange: $,
|
|
42
|
-
onActionExecute:
|
|
42
|
+
onActionExecute: D,
|
|
43
43
|
dir: h,
|
|
44
44
|
messageBox: Ye,
|
|
45
45
|
placeholder: Ze,
|
|
@@ -60,7 +60,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
60
60
|
allowMessageCollapse: ee,
|
|
61
61
|
messageToolbarActions: te,
|
|
62
62
|
messageContextMenuActions: se,
|
|
63
|
-
fileActions:
|
|
63
|
+
fileActions: E,
|
|
64
64
|
onUnpin: at,
|
|
65
65
|
messageWidthMode: oe,
|
|
66
66
|
showAvatar: ne,
|
|
@@ -76,7 +76,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
76
76
|
uploadConfig: fe,
|
|
77
77
|
sendButtonConfig: rt,
|
|
78
78
|
messageFilesLayout: pe,
|
|
79
|
-
scrollToBottomButton:
|
|
79
|
+
scrollToBottomButton: O = !0,
|
|
80
80
|
autoScrollThreshold: lt,
|
|
81
81
|
textField: he,
|
|
82
82
|
statusField: Me,
|
|
@@ -103,13 +103,13 @@ const Je = t.forwardRef((I, k) => {
|
|
|
103
103
|
startIndex: gt,
|
|
104
104
|
endIndex: ft,
|
|
105
105
|
onLoadMoreMessages: pt,
|
|
106
|
-
pinnedMessages:
|
|
106
|
+
pinnedMessages: U,
|
|
107
107
|
repliedToMessages: Be,
|
|
108
108
|
onReferencedMessageClick: ht,
|
|
109
109
|
...Mt
|
|
110
|
-
} =
|
|
111
|
-
Ot("chat", yt,
|
|
112
|
-
const [m,
|
|
110
|
+
} = B, yt = t.useRef(null);
|
|
111
|
+
Ot("chat", yt, B, B.webMcp);
|
|
112
|
+
const [m, P] = t.useState(null), [S, Ct] = t.useState(!1), [St, Ne] = t.useState(!1), [De, Oe] = t.useState(null), [d, Ue] = t.useState(null), [Tt, Pe] = t.useState(!1), j = t.useRef(null), je = t.useRef(null), c = t.useRef(null), Ve = t.useRef(null), V = t.useRef(void 0), q = t.useRef(!1), z = t.useRef(null), qe = t.useRef(""), u = t.useMemo(() => {
|
|
113
113
|
if (!p || p.length === 0)
|
|
114
114
|
return [];
|
|
115
115
|
const s = {
|
|
@@ -184,12 +184,12 @@ const Je = t.forwardRef((I, k) => {
|
|
|
184
184
|
viewItemsWrapperRef: c,
|
|
185
185
|
authorId: a
|
|
186
186
|
}), f = t.useMemo(() => g.length > 0 ? Wt(g) : [], [g]), Et = t.useMemo(() => !Ut(Ke, { component: "Chat" }), []), Rt = Pt(Ke), We = t.useMemo(() => {
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
187
|
+
if (U)
|
|
188
|
+
return U.find((e) => e.isPinned);
|
|
189
189
|
const s = u.find((e) => e.isPinned);
|
|
190
190
|
if (s)
|
|
191
191
|
return s;
|
|
192
|
-
}, [u,
|
|
192
|
+
}, [u, U]), R = es();
|
|
193
193
|
os({
|
|
194
194
|
viewItemsWrapperRef: c,
|
|
195
195
|
isKeyboardNavigationActiveRef: q,
|
|
@@ -204,21 +204,21 @@ const Je = t.forwardRef((I, k) => {
|
|
|
204
204
|
clearTimeout(V.current);
|
|
205
205
|
}, []), wt = t.useCallback(() => {
|
|
206
206
|
V.current = window.setTimeout(() => {
|
|
207
|
-
|
|
207
|
+
P(null);
|
|
208
208
|
}, 0);
|
|
209
|
-
}, []),
|
|
210
|
-
|
|
209
|
+
}, []), x = t.useCallback((s) => {
|
|
210
|
+
P(s);
|
|
211
211
|
}, []), Ft = t.useCallback(
|
|
212
212
|
(s) => {
|
|
213
213
|
let e = null;
|
|
214
214
|
const n = m !== null ? m : f.lastSelectionIndex;
|
|
215
|
-
s.keyCode ===
|
|
215
|
+
s.keyCode === F.up ? n === null ? e = 0 : n > 0 && (e = n - 1) : s.keyCode === F.down ? n === null ? e = 0 : n < f.lastSelectionIndex && (e = n + 1) : s.keyCode === F.home ? e = 0 : s.keyCode === F.end && (e = f.lastSelectionIndex), e !== null && (P(e), q.current = !0, s.preventDefault());
|
|
216
216
|
},
|
|
217
217
|
[m, f]
|
|
218
218
|
), Ge = t.useCallback(
|
|
219
219
|
(s, e, n) => {
|
|
220
220
|
var l;
|
|
221
|
-
if (
|
|
221
|
+
if (D && D({
|
|
222
222
|
action: { value: s.value, title: s.title, type: s.type },
|
|
223
223
|
syntheticEvent: e,
|
|
224
224
|
nativeEvent: e.nativeEvent,
|
|
@@ -250,15 +250,15 @@ const Je = t.forwardRef((I, k) => {
|
|
|
250
250
|
(l = Ve.current) == null || l.focusInput();
|
|
251
251
|
}
|
|
252
252
|
},
|
|
253
|
-
[
|
|
254
|
-
), Lt = t.useCallback(() => He("k-chat", _, { "k-rtl":
|
|
253
|
+
[D, C, d]
|
|
254
|
+
), Lt = t.useCallback(() => He("k-chat", _, { "k-rtl": S }), [_, S]), It = t.useCallback(() => {
|
|
255
255
|
const s = f.length - 1;
|
|
256
256
|
return f.map((e, n) => {
|
|
257
|
-
var l, i,
|
|
257
|
+
var l, i, T, b, k, A;
|
|
258
258
|
if (e.type === "date-marker")
|
|
259
259
|
return /* @__PURE__ */ t.createElement(Kt, { item: e, key: e.trackBy, timestampTemplate: X });
|
|
260
260
|
if (e.type === "message-group") {
|
|
261
|
-
const
|
|
261
|
+
const w = {
|
|
262
262
|
allowMessageCollapse: ee,
|
|
263
263
|
messageWidthMode: oe,
|
|
264
264
|
showAvatar: ne,
|
|
@@ -267,11 +267,11 @@ const Je = t.forwardRef((I, k) => {
|
|
|
267
267
|
messageContentTemplate: H,
|
|
268
268
|
messageToolbarActions: te,
|
|
269
269
|
messageContextMenuActions: se,
|
|
270
|
-
fileActions:
|
|
270
|
+
fileActions: E
|
|
271
271
|
}, r = as(
|
|
272
272
|
(l = e.messages) == null ? void 0 : l[0],
|
|
273
273
|
a,
|
|
274
|
-
|
|
274
|
+
w,
|
|
275
275
|
le,
|
|
276
276
|
ie
|
|
277
277
|
);
|
|
@@ -281,10 +281,10 @@ const Je = t.forwardRef((I, k) => {
|
|
|
281
281
|
group: e,
|
|
282
282
|
itemTemplate: r.messageTemplate,
|
|
283
283
|
contentTemplate: r.messageContentTemplate,
|
|
284
|
-
attachmentTemplate:
|
|
284
|
+
attachmentTemplate: N,
|
|
285
285
|
user: d,
|
|
286
286
|
selectedItemIndex: m,
|
|
287
|
-
onRequestSelection:
|
|
287
|
+
onRequestSelection: x,
|
|
288
288
|
isLastGroup: n === s,
|
|
289
289
|
key: (i = e.messages[0].id) != null ? i : e.messages[0].selectionIndex,
|
|
290
290
|
message: J,
|
|
@@ -303,11 +303,12 @@ const Je = t.forwardRef((I, k) => {
|
|
|
303
303
|
Ht,
|
|
304
304
|
{
|
|
305
305
|
group: e,
|
|
306
|
-
itemTemplate:
|
|
307
|
-
onRequestSelection:
|
|
306
|
+
itemTemplate: N,
|
|
307
|
+
onRequestSelection: x,
|
|
308
308
|
selected: e.selectionIndex === m,
|
|
309
309
|
isLastGroup: n === s,
|
|
310
|
-
|
|
310
|
+
dir: S ? "rtl" : "ltr",
|
|
311
|
+
key: `att-${(b = (T = e.trackBy) == null ? void 0 : T.id) != null ? b : e.selectionIndex}`
|
|
311
312
|
}
|
|
312
313
|
);
|
|
313
314
|
if (e.type === "action-group")
|
|
@@ -316,9 +317,9 @@ const Je = t.forwardRef((I, k) => {
|
|
|
316
317
|
{
|
|
317
318
|
group: e,
|
|
318
319
|
onActionExecute: Ge,
|
|
319
|
-
onRequestSelection:
|
|
320
|
+
onRequestSelection: x,
|
|
320
321
|
selected: e.selectionIndex === m,
|
|
321
|
-
key: `act-${(
|
|
322
|
+
key: `act-${(A = (k = e.trackBy) == null ? void 0 : k.id) != null ? A : e.selectionIndex}`,
|
|
322
323
|
quickActionsLayout: Q,
|
|
323
324
|
dir: h
|
|
324
325
|
}
|
|
@@ -331,15 +332,15 @@ const Je = t.forwardRef((I, k) => {
|
|
|
331
332
|
X,
|
|
332
333
|
G,
|
|
333
334
|
H,
|
|
334
|
-
|
|
335
|
+
N,
|
|
335
336
|
d,
|
|
336
337
|
m,
|
|
337
|
-
|
|
338
|
+
x,
|
|
338
339
|
J,
|
|
339
340
|
ee,
|
|
340
341
|
te,
|
|
341
342
|
se,
|
|
342
|
-
|
|
343
|
+
E,
|
|
343
344
|
oe,
|
|
344
345
|
ne,
|
|
345
346
|
ae,
|
|
@@ -348,7 +349,8 @@ const Je = t.forwardRef((I, k) => {
|
|
|
348
349
|
ie,
|
|
349
350
|
Ge,
|
|
350
351
|
Q,
|
|
351
|
-
h
|
|
352
|
+
h,
|
|
353
|
+
S
|
|
352
354
|
]), Bt = t.useCallback(() => M ? typeof M == "function" ? M() : M : null, [M]), Nt = t.useCallback(() => y ? typeof y == "function" ? y() : y : null, [y]);
|
|
353
355
|
t.useEffect(() => {
|
|
354
356
|
const s = h !== void 0 ? h === "rtl" : j.current && getComputedStyle(j.current).direction === "rtl";
|
|
@@ -356,27 +358,27 @@ const Je = t.forwardRef((I, k) => {
|
|
|
356
358
|
}, [h]), t.useEffect(() => () => {
|
|
357
359
|
clearTimeout(V.current);
|
|
358
360
|
}, []), t.useEffect(() => {
|
|
359
|
-
if (!
|
|
361
|
+
if (!O || !c.current)
|
|
360
362
|
return;
|
|
361
363
|
let s, e;
|
|
362
364
|
const n = () => {
|
|
363
365
|
s = void 0;
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
366
|
+
const b = c.current;
|
|
367
|
+
if (!b)
|
|
366
368
|
return;
|
|
367
|
-
const { scrollHeight:
|
|
368
|
-
!(
|
|
369
|
+
const { scrollHeight: k, scrollTop: A, clientHeight: w } = b;
|
|
370
|
+
!(k > w) || k - A - w <= 100 ? (e !== void 0 && (clearTimeout(e), e = void 0), Pe(!1)) : e != null || (e = setTimeout(() => {
|
|
369
371
|
e = void 0, Pe(!0);
|
|
370
372
|
}, 300));
|
|
371
373
|
}, l = () => {
|
|
372
374
|
s === void 0 && (s = requestAnimationFrame(n));
|
|
373
375
|
}, i = c.current;
|
|
374
376
|
i.addEventListener("scroll", l, { passive: !0 });
|
|
375
|
-
const
|
|
376
|
-
return
|
|
377
|
-
i.removeEventListener("scroll", l),
|
|
377
|
+
const T = new MutationObserver(l);
|
|
378
|
+
return T.observe(i, { childList: !0, subtree: !0, characterData: !0 }), () => {
|
|
379
|
+
i.removeEventListener("scroll", l), T.disconnect(), s !== void 0 && cancelAnimationFrame(s), e !== void 0 && clearTimeout(e);
|
|
378
380
|
};
|
|
379
|
-
}, [
|
|
381
|
+
}, [O]);
|
|
380
382
|
const Dt = t.useMemo(() => ({
|
|
381
383
|
replyToMessage: De,
|
|
382
384
|
setReplyToMessage: Oe,
|
|
@@ -391,7 +393,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
391
393
|
setShowCopyNotification: Ne,
|
|
392
394
|
onDownload: de,
|
|
393
395
|
onResendMessage: Ie,
|
|
394
|
-
fileActions:
|
|
396
|
+
fileActions: E,
|
|
395
397
|
speechToTextConfig: ge,
|
|
396
398
|
uploadConfig: fe,
|
|
397
399
|
statusTemplate: Y,
|
|
@@ -411,7 +413,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
411
413
|
Ne,
|
|
412
414
|
de,
|
|
413
415
|
Ie,
|
|
414
|
-
|
|
416
|
+
E,
|
|
415
417
|
ge,
|
|
416
418
|
fe,
|
|
417
419
|
Y,
|
|
@@ -433,7 +435,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
433
435
|
onKeyDown: Ft,
|
|
434
436
|
className: Lt(),
|
|
435
437
|
ref: (s) => {
|
|
436
|
-
j.current = s, je.current = s, typeof
|
|
438
|
+
j.current = s, je.current = s, typeof v == "function" ? v(s) : v && (v.current = s);
|
|
437
439
|
},
|
|
438
440
|
...Mt
|
|
439
441
|
},
|
|
@@ -445,9 +447,9 @@ const Je = t.forwardRef((I, k) => {
|
|
|
445
447
|
onBlur: wt,
|
|
446
448
|
onFocus: At,
|
|
447
449
|
role: "log",
|
|
448
|
-
"aria-label":
|
|
450
|
+
"aria-label": R.toLanguageString(
|
|
449
451
|
$e,
|
|
450
|
-
|
|
452
|
+
L[$e]
|
|
451
453
|
),
|
|
452
454
|
"aria-live": "polite",
|
|
453
455
|
ref: c,
|
|
@@ -474,7 +476,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
474
476
|
g.length === 0 && y !== void 0 && Nt(),
|
|
475
477
|
g.length > 0 && It()
|
|
476
478
|
),
|
|
477
|
-
|
|
479
|
+
O && (Tt || !ze) && /* @__PURE__ */ t.createElement("div", { className: "k-chat-scroll-to-bottom-container" }, /* @__PURE__ */ t.createElement(
|
|
478
480
|
qt,
|
|
479
481
|
{
|
|
480
482
|
svgIcon: zt,
|
|
@@ -482,13 +484,13 @@ const Je = t.forwardRef((I, k) => {
|
|
|
482
484
|
themeColor: "base",
|
|
483
485
|
rounded: "full",
|
|
484
486
|
onClick: bt,
|
|
485
|
-
"aria-label":
|
|
486
|
-
|
|
487
|
-
|
|
487
|
+
"aria-label": R.toLanguageString(
|
|
488
|
+
I,
|
|
489
|
+
L[I]
|
|
488
490
|
),
|
|
489
|
-
title:
|
|
490
|
-
|
|
491
|
-
|
|
491
|
+
title: R.toLanguageString(
|
|
492
|
+
I,
|
|
493
|
+
L[I]
|
|
492
494
|
)
|
|
493
495
|
}
|
|
494
496
|
))
|
|
@@ -508,7 +510,7 @@ const Je = t.forwardRef((I, k) => {
|
|
|
508
510
|
onSuggestionClick: (s) => {
|
|
509
511
|
K && K(s);
|
|
510
512
|
},
|
|
511
|
-
isDirectionRightToLeft:
|
|
513
|
+
isDirectionRightToLeft: S,
|
|
512
514
|
ref: Ve,
|
|
513
515
|
placeholder: Ze,
|
|
514
516
|
MessageBox: Ye,
|
|
@@ -532,9 +534,9 @@ const Je = t.forwardRef((I, k) => {
|
|
|
532
534
|
Xt,
|
|
533
535
|
{
|
|
534
536
|
show: St,
|
|
535
|
-
text:
|
|
537
|
+
text: R.toLanguageString(
|
|
536
538
|
_e,
|
|
537
|
-
|
|
539
|
+
L[_e]
|
|
538
540
|
)
|
|
539
541
|
}
|
|
540
542
|
),
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-animation"),require("@progress/kendo-react-notification"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-popup"),require("@progress/kendo-react-indicators"),require("@progress/kendo-react-tooltip")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-layout","@progress/kendo-react-intl","prop-types","@progress/kendo-react-upload","@progress/kendo-react-animation","@progress/kendo-react-notification","@progress/kendo-react-inputs","@progress/kendo-react-popup","@progress/kendo-react-indicators","@progress/kendo-react-tooltip"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactLayout,e.KendoReactIntl,e.PropTypes,e.KendoReactUpload,e.KendoReactAnimation,e.KendoReactNotification,e.KendoReactInputs,e.KendoReactPopup,e.KendoReactIndicators,e.KendoReactTooltip)}(this,function(e,t,n,a,l,o,s,r,i,c,u,m,d,p,g){"use strict";function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var h=f(t);const v="newMessage.sendButton",k="newMessage.optionsButton",b="newMessage.messageInput",E="avatar.alt",y="messageList.ariaLabel",C="aIPrompt.noOutputs",x="aIPrompt.cancel",I="aIPrompt.inputPlaceholder",T="chat.senderDeletedMessage",N="chat.receiverDeletedMessage",w="chat.copyNotification",F="chat.downloadAllFiles",S="chat.closeReply",A="chat.collapseMessage",R="chat.expandMessage",M="chat.removeFile",L="chat.fileActions",B="chat.attachFile",D="chat.downloadAll",P="chat.scrollLeft",z="chat.scrollRight",O="chat.scrollToBottom",q="chat.messageFailed",K="chat.retryMessage",H="chat.stopGenerating",U="promptBox.input",$="promptBox.sendButton",V="promptBox.sendButtonText",j="promptBox.attachFile",W="promptBox.removeFile",G="promptBox.stopGenerating",_="promptBox.ariaLabel",Y="promptBox.attachedFiles",J="chat.messageToolbar",X="chat.unpinMessage",Q="chat.messageAttachedFiles",Z="toolCall.state.active",ee="toolCall.state.completed",te="toolCall.state.awaitingApproval",ne="toolCall.state.error",ae="checkpoint.startOver",le="checkpoint.restore",oe="checkpoint.restored",se="checkpoint.redo",re="toolCall.approve",ie="toolCall.reject",ce="citation.previous",ue="citation.next",me={[v]:"Send",[k]:"Options",[b]:"Message",[E]:"Avatar",[y]:"Message list",[x]:"Cancel",[C]:"No output from AI available",[I]:"Ask or generate content with AI ...",[T]:"You removed this message",[N]:"The message was removed by its sender",[w]:"Text copied to clipboard",[F]:"Download all files",[S]:"Close reply",[A]:"Collapse message",[R]:"Expand message",[M]:"Remove file",[L]:"File actions for",[q]:"Failed to send",[K]:"Retry",[H]:"Stop generating",[B]:"Attach file",[D]:"Download all",[P]:"Scroll left",[z]:"Scroll right",[O]:"Scroll to bottom",[U]:"Prompt",[$]:"Send",[V]:"",[j]:"Attach file",[W]:"Remove file",[G]:"Stop generating",[_]:"Prompt box",[Y]:"Attached files",[J]:"Toolbar",[X]:"Unpin message",[Q]:"Attached files",[Z]:"Active",[ee]:"Completed",[te]:"Awaiting Approval",[ne]:"Error",[ae]:"Start Over",[le]:"Restore Checkpoint",[oe]:"Checkpoint Restored",[se]:"Redo",[re]:"Approve",[ie]:"Reject",[ce]:"Previous",[ue]:"Next"},de=(e,t)=>e&&t.author&&e.id===t.author.id,pe=(e,t)=>{const n=t.toLanguageString("chatSender.deletedMessage",me[T]),a=t.toLanguageString("chatReceiver.deletedMessage",me[N]);return e?n:a},ge=(e,t)=>e.find(e=>e.id===t),fe=/(https?:\/\/[^\s]+)/g,he=e=>{if(!e)return[""];const t=e.split(fe),n=[];return t.forEach(e=>{e&&fe.test(e)?(fe.lastIndex=0,n.push(h.createElement("a",{key:e,href:e,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"}},e))):e&&n.push(e)}),n},ve=h.createContext(void 0),ke=()=>{const e=t.useContext(ve);if(void 0===e)throw new Error("useChatContext must be used within a ChatContext.Provider");return e},be=e=>{const{files:t,onFileAction:o,onDownload:r,fileActions:i}=e,{messageFilesLayout:c="vertical"}=ke(),u=s.useLocalization(),m=i||[{id:"download",label:"Download",svgIcon:l.downloadIcon}],d=e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`},p=e=>"."+e.split(".").pop()||"",g=e=>m.length>0&&h.createElement(a.DropDownButton,{fillMode:"flat",size:"xs",svgIcon:l.moreVerticalIcon,onClick:e=>{e.syntheticEvent.stopPropagation()},onItemClick:t=>((e,t)=>{var n,a;null==(a=null==(n=e.syntheticEvent)?void 0:n.stopPropagation)||a.call(n),"download"===e.item.id&&(null==r||r([t])),null==o||o(e.item,e,t)})(t,e),items:m.map(e=>({id:e.id,icon:e.icon,text:e.label,svgIcon:e.svgIcon})),"aria-label":`${u.toLanguageString(L,me[L])} ${e.name}`,title:`${u.toLanguageString(L,me[L])} ${e.name}`}),f=h.useCallback(()=>n.classNames({"k-files-wrap":"wrap"===c,"k-files-vertical":"vertical"===c},"k-file-box-wrapper"),[c]);return h.createElement("ul",{role:"list","aria-label":u.toLanguageString(Q,me[Q]),className:f()},"horizontal"===c?h.createElement("div",{className:"k-files-scroll",role:"presentation"},t.map(e=>h.createElement("li",{key:e.name,className:"k-file-box",role:"listitem","aria-label":[e.name,d(e.size)].filter(Boolean).join(" ")||void 0},h.createElement(n.IconWrap,{size:"xlarge",...n.getFileExtensionIcon(p(e.name))}),h.createElement("div",{className:"k-file-info"},h.createElement("span",{className:"k-file-name"},e.name),h.createElement("span",{className:"k-file-size"},d(e.size))),g(e)))):t.map(e=>h.createElement("li",{key:e.name,className:"k-file-box",role:"listitem","aria-label":[e.name,d(e.size)].filter(Boolean).join(" ")||void 0},h.createElement(n.IconWrap,{size:"xlarge",...n.getFileExtensionIcon(p(e.name))}),h.createElement("div",{className:"k-file-info"},h.createElement("span",{className:"k-file-name"},e.name),h.createElement("span",{className:"k-file-size"},d(e.size))),g(e))))},Ee=h.forwardRef((e,t)=>{const{item:r,template:i,contentTemplate:c,onRequestSelection:u,tabIndex:m=-1,dateFormat:d="g",selected:p,allowMessageCollapse:g,messageToolbarActions:f,messageContextMenuActions:v,fileActions:k,isSender:b}=e,{setReplyToMessage:E,messages:y,repliedToMessages:C,user:x,onToolbarAction:I,onContextMenuAction:T,onFileAction:N,onDownload:w,onResendMessage:S,setShowCopyNotification:M,statusTemplate:L,timestampVisibility:B="onFocus",onReferencedMessageClick:P}=ke(),[z,O]=h.useState(!1),[H,U]=h.useState(!1),[$,V]=h.useState(!0),[j,W]=h.useState(!1),G=s.useLocalization(),_=s.useInternationalization(),Y=h.useRef({left:0,top:0}),X=h.useCallback(()=>{null!=r&&r.text&&(e=>{navigator.clipboard.writeText(e)})(r.text),M&&(M(!0),setTimeout(()=>{M(!1)},3e3))},[r,M]),Q=h.useCallback(e=>{e.stopPropagation(),V(e=>!e)},[]),Z=h.useCallback(()=>{W(!1)},[]),ee=h.useCallback(e=>{("Tab"===e.key||"Enter"===e.key||" "===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)&&W(!0)},[]),te=h.useRef(null);h.useEffect(()=>{p&&te.current&&te.current.focus()},[p]);const ne=h.useCallback(e=>{Y.current={left:e.pageX,top:e.pageY},e.preventDefault(),U(!0),O(!0)},[]),ae=h.useCallback(()=>{U(!1),O(!1)},[]),le=h.useCallback((e,t)=>e.isDeleted?pe(t,G):e.text?e.text:"",[G]),oe=h.useCallback(e=>{var t;null!=(t=e.item)&&t.text&&("copy"!==e.item.data.id||r.isDeleted?"reply"===e.item.data.id&&E(r):X(),T&&T(e.item.data,e,r)),U(!1),O(!1)},[r,T,E,X]),se=h.useCallback(()=>{if(r.replyToId){const e=ge(y,r.replyToId)||(C?ge(C,r.replyToId):void 0);if(e){const t=t=>{t.preventDefault(),t.stopPropagation(),null==P||P(e.id)};return h.createElement("div",{className:n.classNames("k-message-reference",de(x,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:t},h.createElement("div",{className:"k-message-reference-content"},he(le(e,de(x,e)))))}}return null},[r.replyToId,y,C,x,le,P]),re=h.useCallback(()=>{const e=[{id:"reply",label:"Reply",svgIcon:l.undoIcon},{id:"copy",label:"Copy",svgIcon:l.copyIcon}],t=v?[...e.map(e=>v.find(t=>t.id===e.id)||e),...v.filter(t=>!e.some(e=>e.id===t.id))]:e;return h.createElement(o.ContextMenu,{onSelect:oe,onClose:ae,vertical:!0,show:z,offset:Y.current},t.map(e=>"delete"!==e.id||b?h.createElement(o.MenuItem,{key:e.id,text:e.label,icon:e.icon,svgIcon:e.svgIcon,data:e}):null))},[v,oe,ae,z,b]),ie=h.useCallback(()=>r.files&&r.files.length>1?h.createElement("div",{className:"k-chat-download-button-wrapper"},h.createElement(a.Button,{className:"k-chat-download-button",fillMode:"flat",svgIcon:l.downloadIcon,size:"small",onClick:e=>{e.stopPropagation(),w&&w(r.files,r)},"aria-label":G.toLanguageString(F,me[F])},h.createElement("span",{className:"k-button-text"},G.toLanguageString(D,me[D])))):null,[r,w,G]),ce=h.useCallback(()=>{if(r.typing)return h.createElement("div",{className:"k-chat-bubble k-bubble"},h.createElement("div",{className:"k-bubble-content"},h.createElement("div",{className:"k-typing-indicator"},h.createElement("span",null),h.createElement("span",null),h.createElement("span",null))));if(i){const e=i;return h.createElement(h.Fragment,null,h.createElement(e,{item:r}),re())}return r.text||r.files&&r.files.length>0?h.createElement(h.Fragment,null,h.createElement("div",{className:n.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":g,"k-expanded":g&&$,"k-selected":p,"k-active":H}),onClick:()=>u(p?void 0:r.selectionIndex),onContextMenu:ne},h.createElement("div",{className:"k-bubble-content"},c?h.createElement(c,{item:r}):h.createElement(h.Fragment,null,(r.text||r.isDeleted||r.replyToId)&&h.createElement("span",{className:"k-chat-bubble-text"},!r.isDeleted&&se(),he(le(r,de(x,r)))),r.files&&r.files.length>0&&h.createElement(be,{files:r.files,message:r,onFileAction:N,onDownload:e=>null==w?void 0:w(e,r),renderInTextarea:!1,fileActions:k}),ie())),g&&h.createElement("span",{className:"k-bubble-expandable-indicator",onClick:Q,role:"button","aria-label":$?G.toLanguageString(A,me[A]):G.toLanguageString(R,me[R]),tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),Q(e))}},h.createElement(n.IconWrap,{icon:$?l.chevronUpIcon:l.chevronDownIcon}))),re()):null},[r,i,c,g,$,p,H,u,ne,se,le,x,N,k,ie,Q,G,re,w]),ue=h.useCallback(()=>{let e=null;return r.timestamp&&("hidden"===B||(e=h.createElement("time",{className:"k-message-time"},_.formatDate(r.timestamp,d)))),e},[r.timestamp,d,B,_]),fe=h.useCallback(()=>{if(!r.status)return null;let e;if(L)e=h.createElement(L,{item:r});else{let t,a,l;if("object"==typeof r.status&&null!==r.status){const e=r.status;t=e.text,a=e.icon,l=e.svgIcon}else t=r.status;let o=null;a?o=h.createElement(n.Icon,{name:a,size:"xsmall"}):l&&(o=h.createElement(n.IconWrap,{icon:l,size:"xsmall"})),e=h.createElement(h.Fragment,null,o,t)}return h.createElement("span",{className:"k-message-status"},e)},[r,L]),ve=h.useCallback(()=>{let e=null;if(r.isFailed){const t=G.toLanguageString(q,me[q]);e=h.createElement("span",{className:"k-message-failed-content"},h.createElement(n.IconWrap,{icon:l.warningTriangleIcon,size:"xsmall"}),h.createElement("span",{className:"k-message-failed-text"},t))}return e},[r,G]),Ee=h.useCallback(()=>{let e=null;if(r.isFailed){const t=G.toLanguageString(K,me[K]);e=h.createElement(a.Button,{fillMode:"clear",size:"xs",className:"k-resend-button",svgIcon:l.arrowRotateCwIcon,"aria-label":t,title:t,onClick:e=>{e.stopPropagation(),S&&S({message:r,syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.target})}})}return e},[r,G,S]),ye=h.useCallback(()=>n.classNames({"k-focus":p,"k-message-removed":r.isDeleted,"k-message-failed":r.isFailed},"k-message"),[p,r.isDeleted,r.isFailed]),Ce=h.useCallback(()=>f&&f.length>0&&h.createElement(a.Toolbar,{className:"k-chat-message-toolbar",fillMode:"flat",ariaLabel:G.toLanguageString(J,me[J])},f.map(e=>"delete"!==e.id||b?h.createElement(a.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",icon:e.icon,svgIcon:e.svgIcon,"aria-label":e.label,onClick:t=>{t.stopPropagation(),"copy"!==e.id||r.isDeleted?"reply"===e.id&&E(r):X(),I&&I(e,t,r)},onMouseDown:e=>e.preventDefault()}):null)),[X,b,r,G,f,I,E]);return h.createElement("div",{key:r.id,"data-message-id":r.id,className:ye(),tabIndex:m,onMouseDown:Z,onKeyDown:ee,onFocus:e=>{j&&u(r.selectionIndex)},ref:e=>{te.current=e,"function"==typeof t?t(e):t&&(t.current=e)},onContextMenu:i?ne:void 0},Ee(),ce(),(r.status||r.timestamp&&"hidden"!==B||r.isFailed)&&h.createElement("div",{className:"k-message-info"},fe(),ue(),ve()),Ce())});Ee.displayName="ChatMessage";const ye=e=>e[e.length-1],Ce=e=>(t,n,a)=>{const l=a===e-1;return((e,t)=>{const n=t.timestamp,a=ye(e);if(n&&(!a||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(n,a.timestamp))){const t={type:"date-marker",timestamp:n,trackBy:n.getTime()};e.push(t)}})(t,n),((e,t,n)=>{const a=ye(e);let l;t.typing&&!n||(a&&"message-group"===a.type&&(l=a.messages),l&&de(t.author,ye(l))?l.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,n,l),n.attachments&&n.attachments.length>1&&t.push({type:"attachment-group",attachments:n.attachments,attachmentLayout:n.attachmentLayout,timestamp:n.timestamp,trackBy:n}),n.suggestedActions&&l&&t.push({type:"action-group",actions:n.suggestedActions,timestamp:n.timestamp,trackBy:n}),t};const xe=e=>{const{item:t,onActionExecute:a,selected:l}=e,o=h.useRef(null);h.useEffect(()=>{l&&o.current&&o.current.focus()},[l]);const s=h.useCallback(e=>{(e.keyCode===n.Keys.enter||" "===e.key)&&(e.preventDefault(),a(t,e))},[a,t]),r=h.useCallback(()=>n.classNames("k-suggestion k-suggestion-primary",{"k-selected":l},{"k-focus":l}),[l]);return h.createElement("span",{role:"button",className:r(),onClick:e=>a(t,e),ref:o,onKeyDown:s,tabIndex:0,"aria-label":t.title||t.value},t.title||t.value)},Ie=({visible:e,dir:t,canScrollLeft:n,canScrollRight:o,onScrollLeft:r,onScrollRight:i,children:c})=>{const u=s.useLocalization();if(!e)return c;const m=u.toLanguageString(P,me[P]),d=u.toLanguageString(z,me[z]),p="rtl"!==t?m:d,g="rtl"!==t?d:m;return h.createElement("div",{className:"k-suggestion-scrollwrap"},h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:"rtl"===t?l.chevronRightIcon:l.chevronLeftIcon,onClick:r,disabled:!n,"aria-label":p,title:p}),c,h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:"rtl"===t?l.chevronLeftIcon:l.chevronRightIcon,onClick:i,disabled:!o,"aria-label":g,title:g}))},Te=100,Ne=(e,t)=>{const{enabled:n,dir:a,mode:l,itemsDependency:o=[],scrollSpeed:s=Te}=t,[r,i]=h.useState(!1),[c,u]=h.useState(!1),m=h.useCallback(()=>{if(e.current&&n){const{scrollLeft:t,scrollWidth:n,clientWidth:l}=e.current,o="rtl"!==a?t+l>=n-1:l-t>=n-1;i(!(0===t)),u(!o)}},[n,a]),d=h.useCallback(()=>{e.current&&n&&e.current.scrollBy({left:"rtl"!==a?-s:s,behavior:"smooth"})},[n,a,s]),p=h.useCallback(()=>{e.current&&n&&e.current.scrollBy({left:"rtl"!==a?s:-s,behavior:"smooth"})},[n,a,s]);return h.useEffect(()=>{const t=e.current;if(!t||!n)return;m();const a=()=>m();t.addEventListener("scroll",a,{passive:!0});const l=new ResizeObserver(m);return l.observe(t),()=>{t.removeEventListener("scroll",a),l.disconnect()}},[n,m,o.length,l]),h.useLayoutEffect(()=>{n&&m()},[n,a,o]),{canScrollLeft:r,canScrollRight:c,scrollLeft:d,scrollRight:p}},we=e=>{var t,a;const{group:l,onActionExecute:o,selected:s,onRequestSelection:r,quickActionsLayout:i="scroll",dir:c}=e,[u,m]=h.useState(null),d=h.useRef(null),{canScrollLeft:p,canScrollRight:g,scrollLeft:f,scrollRight:v}=Ne(d,{enabled:"scrollbuttons"===i||"scroll"===i,dir:c,mode:i,itemsDependency:l.actions});h.useEffect(()=>{s||null===u?s&&null===u&&m(0):m(null)},[s,u]);const k=h.useCallback(()=>l.actions?l.actions.length-1:-1,[l.actions]),b=h.useCallback((e,t=0)=>{let n=null;return e?null===u?n=t:u<k()&&(n=u+1):null===u?n=0:u>0&&(n=u-1),null!==n&&m(n),n},[u,k]),E=h.useCallback(()=>{r(l.selectionIndex)},[r,l.selectionIndex]),y=h.useCallback(e=>{let t=null;const a=n.Keys.left,l=n.Keys.right;e.keyCode===a?t=b(!1):e.keyCode===l&&(t=b(!0)),null!==t&&(e.preventDefault(),e.stopPropagation())},[b]),C=h.useCallback(()=>n.classNames("k-suggestion-group",{"k-suggestion-group-scrollable":"scroll"===i,"k-suggestion-group-scrollable-start":g&&("scroll"===i||"scrollbuttons"===i),"k-suggestion-group-scrollable-end":p&&("scroll"===i||"scrollbuttons"===i)}),[i,g,p]),x="scroll"===i||"scrollbuttons"===i,I=h.createElement("div",{className:C(),onClick:E,onKeyDown:y,role:"toolbar",tabIndex:0,"aria-label":"Action group"},x?h.createElement("div",{className:"k-suggestions-scroll",ref:d},null==(t=l.actions)?void 0:t.map((e,t)=>h.createElement(xe,{item:e,onActionExecute:o,selected:t===u,key:e.value}))):null==(a=l.actions)?void 0:a.map((e,t)=>h.createElement(xe,{item:e,onActionExecute:o,selected:t===u,key:e.value})));return h.createElement(Ie,{visible:"scrollbuttons"===i,dir:c,canScrollLeft:p,canScrollRight:g,onScrollLeft:f,onScrollRight:v},I)},Fe=e=>{const{item:t,template:a,tabbable:l,onClick:o,selected:s}=e,r=h.useRef(null);h.useEffect(()=>{s&&r.current&&r.current.focus()},[s]);const i=h.useCallback(()=>{if(void 0!==l)return l?0:-1},[l]),c=h.useCallback(()=>n.classNames({"k-selected":s},{"k-focus":s}),[s]),u=h.useCallback(()=>t.title?h.createElement("h5",{className:"k-card-title"},t.title):null,[t.title]),m=h.useCallback(()=>t.subtitle?h.createElement("h6",{className:"k-card-subtitle"},t.subtitle):null,[t.subtitle]),d=h.useCallback(()=>0===t.contentType.indexOf("image/")?h.createElement("img",{src:t.content,alt:t.title||"Attachment",style:{maxHeight:"200px",height:"auto",maxWidth:"200px",width:"auto"}}):t.content,[t.contentType,t.content,t.title]),p=a;return h.createElement("div",{className:c(),tabIndex:i(),onClick:o,ref:r},a?h.createElement(p,{item:t}):h.createElement("div",{className:"k-card"},h.createElement("div",{className:"k-card-body"},u(),m(),d())))},Se=e=>{const{group:t,itemTemplate:o,selected:s,isLastGroup:r,onRequestSelection:i}=e,[c,u]=h.useState(null);h.useEffect(()=>{s||null===c?s&&null===c&&u(0):u(null)},[s,c]);const m=h.useCallback(e=>"list"!==e.attachmentLayout,[]),d=h.useCallback(()=>t.attachments?t.attachments.length-1:-1,[t.attachments]),p=h.useCallback(()=>t.attachments.length-1,[t.attachments]),g=h.useCallback((e,t=0)=>{let n=null;return e?null===c?n=t:c<d()&&(n=c+1):null===c?n=0:c>0&&(n=c-1),null!==n&&u(n),n},[c,d]),f=h.useCallback(()=>{i(t.selectionIndex)},[i,t.selectionIndex]),v=h.useCallback(e=>{let a,l,o=null;m(t)?(a=n.Keys.left,l=n.Keys.right):(a=n.Keys.up,l=n.Keys.down),e.keyCode===a?o=g(!1):e.keyCode===l&&(o=g(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())},[g,m,t]),k=h.useCallback(e=>{f(),u(e)},[f]),b=h.useCallback(e=>{f(),g(e,1)},[f,g]),E=h.useCallback(()=>{let e=null;return m(t)&&c&&(e=h.createElement(a.Button,{icon:"chevron-left",onClick:()=>b(!1),svgIcon:l.chevronLeftIcon})),e},[m,t,c,b]),y=h.useCallback(()=>{let e=null;return m(t)&&c!==p()&&(e=h.createElement(a.Button,{icon:"chevron-right",onClick:()=>b(!0),svgIcon:l.chevronRightIcon})),e},[m,t,c,p,b]),C=h.useCallback(()=>n.classNames({"k-card-list":t.attachmentLayout,"k-card-deck":m(t)}),[t.attachmentLayout,t,m]),x=m(t),I=h.createElement("div",{className:C(),onKeyDown:x?void 0:v},t.attachments.map((e,t)=>h.createElement(Fe,{item:e,template:o,selected:t===c,tabbable:r&&t===c,onClick:()=>k(t),key:e.content})));return x?h.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:v},E(),I,y()):I},Ae=({item:e,timestampTemplate:t})=>{const n=s.useInternationalization(),a=t;return h.createElement("div",{className:"k-timestamp"},a?h.createElement(a,{item:e}):n.formatDate(e.timestamp,"D"))},Re=e=>{const{group:t,user:a,itemTemplate:l,contentTemplate:r,attachmentTemplate:i,onRequestSelection:c,selectedItemIndex:u,isLastGroup:m,message:d,allowMessageCollapse:p,messageToolbarActions:g,messageContextMenuActions:f,fileActions:v,messageWidthMode:k="standard",showAvatar:b=!0,showUsername:y=!0}=e,{userStatusTemplate:C}=ke(),x=s.useLocalization(),I=t.messages.length>0&&de(a,t.messages[0]),{avatarUrl:T,avatarAltText:N,name:w}=t.author,F=h.useMemo(()=>n.classNames("k-message-group",{"k-message-group-sender":I,"k-message-group-receiver":!I,"k-message-group-full-width":"full"===k,"k-no-avatar":!b||!T}),[I,k,b,T]),S=h.useMemo(()=>{const e=t.messages.length-1;return t.messages.map((t,n)=>{const o=[h.createElement(d,{item:t,template:l,contentTemplate:r,selected:t.selectionIndex===u,onRequestSelection:c,tabIndex:n===e&&m?0:-1,key:t.id,allowMessageCollapse:p,messageToolbarActions:g,messageContextMenuActions:f,fileActions:v,isSender:de(a,t)})];return t.attachments&&1===t.attachments.length&&o.push(h.createElement(Fe,{item:t.attachments[0],template:i,selected:!1,key:`att-${t.attachments[0].content}`})),o})},[t.messages,d,l,r,u,c,m,p,g,f,v,a,i]),A=void 0!==N?N:x.toLanguageString(E,me[E]);return h.createElement("div",{className:F},(()=>{if(!b||!T)return;const e=h.createElement(o.Avatar,{type:"image"},h.createElement("img",{src:T,alt:A}));if(C){const n=t.messages[t.messages.length-1];return h.createElement("div",{className:"k-chat-user-status-wrapper"},e,h.createElement("div",{className:"k-chat-user-status"},h.createElement(C,{message:"dataItem"in n?n.dataItem:n})))}return e})(),h.createElement("div",{className:"k-message-group-content"},y&&h.createElement("span",{className:"k-message-author"},w),S))},Me=e=>{const{suggestions:t,onSuggestionClick:a,suggestionsView:l,suggestionTemplate:o,suggestionsLayout:s,dir:r}=e,i=h.useRef(null),{canScrollLeft:c,canScrollRight:u,scrollLeft:m,scrollRight:d}=Ne(i,{enabled:"scrollbuttons"===s||"scroll"===s,dir:r,mode:s,itemsDependency:t}),p=h.useCallback((e,t)=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==a||a(t))},[a]),g=h.useCallback(()=>t.map(e=>o?h.createElement(o,{key:e.id,suggestion:e,onClick:()=>{null==a||a(e)}}):h.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:()=>!e.disabled&&(null==a?void 0:a(e)),onKeyDown:t=>!e.disabled&&p(t,e),key:e.id,title:e.description,className:n.classNames("classic"===l?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)),[t,o,a,l,p]);if(!t||0===t.length)return null;if("classic"===l)return g();const f="scroll"===s||"scrollbuttons"===s,v=h.createElement("div",{role:"group",className:n.classNames("k-suggestion-group",{"k-suggestion-group-scrollable":"scroll"===s,"k-suggestion-group-scrollable-start":u&&("scroll"===s||"scrollbuttons"===s),"k-suggestion-group-scrollable-end":c&&("scroll"===s||"scrollbuttons"===s)})},f?h.createElement("div",{className:"k-suggestions-scroll",ref:i},g()):g());return h.createElement(Ie,{visible:"scrollbuttons"===s,dir:r,canScrollLeft:c,canScrollRight:u,onScrollLeft:m,onScrollRight:d},v)},Le=h.forwardRef(({onFilesAdd:e,files:t=[],restrictions:n,multiple:l=!0,accept:o,uploadRef:s,onSelectAttachments:r,onRemoveAttachment:c,_registerRemoveCallback:u,...m},d)=>{h.useEffect(()=>(u&&c&&u(c),()=>{u&&c&&u(void 0)}),[c,u]);const p=h.useCallback(t=>{e&&e(t),r&&r({selectedFiles:t.affectedFiles,allFiles:t.newState})},[e,r]);return h.createElement(h.Fragment,null,h.createElement(a.Button,{ref:d,...m}),h.createElement(i.Upload,{ref:s,files:t,onAdd:p,autoUpload:!1,restrictions:n,multiple:l,accept:o,className:"k-hidden"}))});Le.displayName="PromptBoxUploadButton";const Be=h.forwardRef((e,t)=>{const{text:n,children:l,...o}=e,s=void 0!==n?n:l,r=""===s||null===s||"boolean"==typeof s?void 0:s;return h.createElement(a.Button,{ref:t,...o},r)});Be.displayName="PromptBoxActionButton";const De=h.forwardRef((e,t)=>h.createElement(a.SpeechToTextButton,{ref:t,...e}));De.displayName="PromptBoxSpeechToTextButton";const Pe=e=>"."+e.split(".").pop()||"",ze=e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`},Oe=({files:e,onRemoveFile:t,header:o})=>{const r=s.useLocalization(),i=h.useRef(null),[c,u]=h.useState(!1),[m,d]=h.useState(!1),p=h.useCallback(()=>{const e=i.current;if(!e)return;const{scrollLeft:t,scrollWidth:n,clientWidth:a}=e,l=t+a>=n-1;d(!(0===t)),u(!l)},[]);if(h.useLayoutEffect(()=>{p()},[e,p]),h.useEffect(()=>{const e=i.current;if(!e)return;const t=()=>p(),n=new ResizeObserver(p);return n.observe(e),e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t),n.disconnect()}},[p,e.length]),0===e.length&&!o)return null;const g=(e=>e?"function"==typeof e?e():e:null)(o),f=e.length>0&&h.createElement("ul",{role:"list","aria-label":r.toLanguageString(Y,me[Y]),className:n.classNames("k-file-box-wrapper",{"k-file-box-wrapper-scrollable-start":c,"k-file-box-wrapper-scrollable-end":m})},h.createElement("div",{className:"k-files-scroll",role:"presentation",ref:i},e.map((e,o)=>h.createElement("li",{key:e.name,className:"k-file-box",role:"listitem",tabIndex:0===o?0:-1,"aria-label":[e.name,ze(e.size)].filter(Boolean).join(" ")||void 0},h.createElement(n.IconWrap,{size:"xlarge",...n.getFileExtensionIcon(Pe(e.name))}),h.createElement("div",{className:"k-file-info"},h.createElement("span",{className:"k-file-name"},e.name),h.createElement("span",{className:"k-file-size"},ze(e.size))),h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:l.xCircleIcon,onClick:n=>{n.stopPropagation(),t(e.name)},"aria-label":`${r.toLanguageString(W,me[W])} ${e.name}`,title:`${r.toLanguageString(W,me[W])} ${e.name}`})))));return h.createElement("div",{className:"k-prompt-box-header"},g,f)},qe=(e,t,n,a)=>{var l;const{text:o,"aria-label":s}=null!=e?e:{text:void 0,"aria-label":void 0},r=t||null!=o?o:a.toLanguageString(V,me[V]),i=""!==r?r:void 0;return{text:i,"aria-label":null!=(l=null!=s?s:t?void 0:i)?l:n}},Ke=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"16.3.0-develop.21",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"}),He="k-prompt-box",Ue={mode:"auto",rows:1,defaultValue:"",disabled:!1,readOnly:!1,loading:!1,uploadButtonConfig:!1,speechToTextButtonConfig:!0,actionButtonConfig:!0},$e=h.forwardRef((e,t)=>{const a=!n.validatePackage(Ke,{component:"PromptBox"}),o=n.getLicenseMessage(Ke),r=s.useLocalization(),i={...Ue,...e},{mode:c=Ue.mode,fillMode:u,rows:m=Ue.rows,maxTextAreaHeight:d,value:p,defaultValue:g=Ue.defaultValue,disabled:f=Ue.disabled,readOnly:v=Ue.readOnly,placeholder:k,title:b,maxLength:E,inputAttributes:y,topAffix:C,startAffix:x,endAffix:I,header:T,onChange:N,onFocus:w,onBlur:F,onPromptAction:S,attachments:A,loading:R=Ue.loading,uploadButtonConfig:M=Ue.uploadButtonConfig,speechToTextButtonConfig:L=Ue.speechToTextButtonConfig,actionButtonConfig:B=Ue.actionButtonConfig,className:D,style:P,...z}=i,O=h.useRef(null),[q,K]=h.useState(g),[H,V]=h.useState([]),[W,_]=h.useState(!1),Y=h.useRef(null),J=h.useRef(null),X=h.useRef(0),Q=h.useRef(0),Z=h.useRef(!1),ee=h.useRef(0),te=h.useRef(0),ne=h.useCallback((e,t)=>e?"function"==typeof e?e(t):e:null,[]),ae=void 0!==p,le=ae?p:q,oe=void 0!==A,se=oe?A:H,re=h.useMemo(()=>!!(null!=le&&le.trim()||se.length>0),[le,se.length]),ie=h.useCallback(()=>{if(!O.current||"single"===c)return;const e=O.current,t=globalThis.getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||20,a=Number.parseFloat(t.paddingTop)||0,l=Number.parseFloat(t.paddingBottom)||0;X.current=e.offsetHeight||n+a+l,Q.current=n*m+a+l,"auto"===c&&!W&&(te.current=e.offsetWidth)},[c,m,W]),ce=h.useCallback(()=>"auto"===c?1:m,[c,m]),ue=h.useCallback(e=>{if(d){const t=Number.parseInt(d,10);if(e>t)return t}return Math.max(Q.current,e)},[d]),de=h.useCallback(e=>{e.style.overflow="hidden",e.style.height=`${X.current}px`;const t=e.scrollHeight,n=ue(t);e.style.height=`${n}px`,d&&t>Number.parseInt(d,10)&&(e.style.overflow="")},[ue,d]),pe=h.useCallback(e=>{e.style.overflow="hidden",e.style.height=`${X.current}px`;const t=e.scrollHeight,n=d?Math.min(t,Number.parseInt(d,10)):t;e.style.height=`${n}px`,d&&t>Number.parseInt(d,10)&&(e.style.overflow="")},[d]),ge=h.useCallback(e=>{if(te.current<=0)return!1;const t=e.style.height,n=e.style.width;e.style.overflow="hidden",e.style.width=`${te.current}px`,e.style.height=`${X.current}px`;const a=e.scrollWidth<=te.current&&e.scrollHeight<=X.current;return e.style.overflow="",e.style.width=n||"",e.style.height=t||"",a},[]),fe=h.useCallback((e,t)=>{if(!Z.current){if((e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&!W)return Z.current=!0,void _(!0);if(W){pe(e);t<ee.current&&ge(e)&&(e.style.height="",Z.current=!0,_(!1))}}},[W,pe,ge]),he=h.useCallback(()=>{var e;if("single"===c||!O.current)return;const t=O.current,n=(null==(e=t.value)?void 0:e.length)||0;"multi"===c?de(t):"auto"===c&&fe(t,n)},[c,de,fe]);h.useEffect(()=>{"single"!==c&&O.current&&ie()},[c,ie]),h.useEffect(()=>{"single"!==c&&O.current&&(ie(),he())},[m,c,ie,he]),h.useEffect(()=>{if("single"!==c&&O.current){const e=(null==le?void 0:le.length)||0;requestAnimationFrame(()=>{if(O.current){const t=O.current;"multi"===c?de(t):"auto"===c&&fe(t,e),ee.current=e}})}},[le,c,de,fe]),h.useEffect(()=>{"auto"===c&&W&&O.current&&requestAnimationFrame(()=>{if(O.current){const e=O.current;pe(e),Z.current=!1}})},[W,c,pe]),h.useEffect(()=>{if("auto"===c&&O.current){const e=O.current;W||(e.style.height="",e.style.overflow="",Z.current=!1)}},[c,W]),h.useEffect(()=>{if("single"===c||!O.current)return;const e=O.current;let t;const n=new ResizeObserver(()=>{clearTimeout(t),t=setTimeout(()=>{O.current&&("auto"===c&&!W&&ie(),he())},50)});return n.observe(e),()=>{n.disconnect(),clearTimeout(t)}},[c,W,ie,he]);const ve=h.useCallback(()=>({focus:()=>{var e;return null==(e=O.current)?void 0:e.focus()},blur:()=>{var e;return null==(e=O.current)?void 0:e.blur()},element:O.current,get value(){return le}}),[le]);h.useImperativeHandle(t,ve);const ke=h.useCallback(e=>{const t=e.target.value;!ae&&!f&&K(t),N&&!f&&n.dispatchEvent(N,e,{...ve(),value:t},{value:t}),"single"!==c&&he()},[K,N,f,ae,ve,c,he]),be=h.useCallback(e=>{w&&!f&&n.dispatchEvent(w,e,ve(),void 0)},[w,f,ve]),Ee=h.useCallback(e=>{F&&!f&&n.dispatchEvent(F,e,ve(),void 0)},[F,f,ve]),ye=h.useCallback(e=>{e.preventDefault()},[]),Ce=h.useCallback(e=>{S&&n.dispatchEvent(S,e,ve(),{value:le,attachments:se}),ae||K(""),oe||V([])},[S,ve,le,se,ae,oe]),xe=h.useCallback(e=>{if("Enter"!==e.key||!e.shiftKey){if("ArrowUp"===e.key||"ArrowDown"===e.key)return void e.stopPropagation();if("Enter"===e.key){if(e.preventDefault(),R)return;re&&Ce(e)}}},[Ce,R,re]),Ie={disabled:f,readOnly:v,placeholder:k,title:b,maxLength:E,"aria-label":r.toLanguageString(U,me[U]),value:le,onKeyDown:xe,...y,onChange:ke,onFocus:be,onBlur:Ee,ref:O},Te=h.useCallback(e=>{var t,a;const{isFinal:l,alternatives:o}=e;if(o.length>0){const e=o[0];if(l){const a=(null==(t=O.current)?void 0:t.value)||"",l=(a?`${a} `:"")+e.transcript;if(ae||K(l),N&&!f){const e={target:O.current,currentTarget:O.current};n.dispatchEvent(N,e,{...ve(),value:l},{value:l})}}}null==(a=O.current)||a.focus()},[ae,N,f,ve]),Ne=h.useCallback(()=>{var e,t;null==(t=null==(e=Y.current)?void 0:e.actionElement)||t.click()},[]),we=h.useCallback(e=>{var t;const n=Array.from(e.affectedFiles),a="object"==typeof M&&M.onSelectAttachments;oe||V(e=>[...e,...n]),a&&a({selectedFiles:e.affectedFiles,allFiles:e.newState}),null==(t=O.current)||t.focus()},[M,oe]),Fe=h.useMemo(()=>({uploadButtonProps:{fillMode:"flat",svgIcon:l.paperclipIcon,size:"small",rounded:"full",onClick:Ne,onFilesAdd:we,files:se,uploadRef:Y,"aria-label":r.toLanguageString(j,me[j]),title:r.toLanguageString(j,me[j]),_registerRemoveCallback:e=>{J.current=e}},speechToTextButtonProps:{fillMode:"flat",size:"small",rounded:"full",onResult:Te},actionButtonProps:{rounded:"full",size:"small",svgIcon:R?l.stopIcon:l.arrowUpIcon,className:R?"k-generating k-active":"",onClick:Ce,onMouseDown:ye,disabled:!R&&!re,"aria-label":R?r.toLanguageString(G,me[G]):r.toLanguageString($,me[$]),title:R?r.toLanguageString(G,me[G]):r.toLanguageString($,me[$]),"aria-live":"polite"}}),[Te,we,se,Ce,ye,R,Ne,r,re]),Se=h.useCallback(e=>{oe||V(t=>t.filter(t=>t.name!==e));const t="object"==typeof M&&M.onRemoveAttachment;t&&(J.current=t),J.current&&J.current(e)},[M,oe]),Ae=()=>{const e=!1!==L,t=!1!==B,n=!1!==M,a="object"==typeof L?L:void 0,l="object"==typeof M?M:{},{restrictions:o,multiple:s=!0,accept:i,onSelectAttachments:c,onRemoveAttachment:u,...m}=l,d={restrictions:o,multiple:s,accept:i},p="object"==typeof B?B:void 0,g=qe(p,R,Fe.actionButtonProps["aria-label"],r),f={...p,...g};return h.createElement(h.Fragment,null,n&&h.createElement(Le,{...Fe.uploadButtonProps,restrictions:d.restrictions,multiple:d.multiple,accept:d.accept,...m}),e&&h.createElement(De,{...Fe.speechToTextButtonProps,...a}),t&&h.createElement(Be,{...Fe.actionButtonProps,...f}))},Re="multi"===c||"auto"===c&&W,Me=!1!==M||!1!==L||!1!==B,Pe=I||Me,ze=x||I||Me;return h.createElement("div",{...z,className:n.classNames(D,"k-input",He,{[`k-input-${u}`]:u,"k-disabled":f,"k-prompt-box-singleline":"single"===c,"k-prompt-box-multiline":Re}),style:P},h.createElement(Oe,{files:se,onRemoveFile:Se,header:T}),"single"===c?h.createElement("div",{className:`${He}-content`},x&&h.createElement("div",{className:`${He}-affix`},ne(x,Fe)),h.createElement("input",{...Ie,className:n.classNames("k-input-inner",`${He}-input`)}),Pe?h.createElement("div",{className:`${He}-affix`},I&&ne(I,Fe),Ae()):null):h.createElement("div",{className:`${He}-content`},"multi"===c&&C&&h.createElement("div",{className:`${He}-affix`},ne(C,Fe)),"auto"===c&&!W&&x&&h.createElement("div",{className:`${He}-affix`},ne(x,Fe)),h.createElement("textarea",{...Ie,className:n.classNames("k-input-inner",`${He}-textarea`),rows:ce(),style:d?{maxHeight:d}:{},"aria-multiline":"true"}),"auto"===c&&!W&&Pe?h.createElement("div",{className:`${He}-affix`},I&&ne(I,Fe),Ae()):null,Re&&ze?h.createElement("div",{className:`${He}-affix`},x&&ne(x,Fe),(x||I)&&h.createElement("div",{className:"k-spacer"}),I&&ne(I,Fe),Ae()):null),a&&h.createElement(n.WatermarkOverlay,{message:o}))});$e.propTypes={value:r.string,defaultValue:r.string,mode:r.oneOf(["single","multi","auto"]),rows:r.number,maxTextAreaHeight:r.string,title:r.string,disabled:r.bool,readOnly:r.bool,placeholder:r.string,maxLength:r.number,inputAttributes:r.object,fillMode:r.oneOf(["solid","flat","outline"]),topAffix:r.oneOfType([r.func,r.element,r.string]),startAffix:r.oneOfType([r.func,r.element,r.string]),endAffix:r.oneOfType([r.func,r.element,r.string]),header:r.oneOfType([r.func,r.element,r.string]),onChange:r.func,onFocus:r.func,onBlur:r.func,loading:r.bool,uploadButtonConfig:r.oneOfType([r.bool,r.object]),speechToTextButtonConfig:r.oneOfType([r.bool,r.object]),actionButtonConfig:r.oneOfType([r.bool,r.object]),attachments:r.array,onPromptAction:r.func,className:r.string,style:r.object},$e.displayName="KendoPromptBox";const Ve=h.memo(({affixProps:e,uploadConfig:t,localizationService:n,onFilesSelect:a,onFileRemove:l})=>{const o="object"==typeof t?t:{};return!1!==t?h.createElement(Le,{...e.uploadButtonProps,fillMode:"clear","aria-label":n.toLanguageString(B,me[B]),title:n.toLanguageString(B,me[B]),...o,onSelectAttachments:a,onRemoveAttachment:l}):null});Ve.displayName="UploadButtonAffix";const je=h.forwardRef((e,t)=>{const{onSendMessage:o,isDirectionRightToLeft:r,placeholder:i,MessageBox:c,suggestions:u,onSuggestionClick:m,inputValue:d,onInputValueChange:p,suggestionTemplate:g,sendButtonConfig:f,onInputClick:k,suggestionsLayout:E,dir:y,messageBoxSettings:C,loading:x}=e,{replyToMessage:I,setReplyToMessage:T,user:N,speechToTextConfig:w,uploadConfig:F}=ke(),[A,R]=h.useState(""),[M,L]=h.useState([]),B=h.useRef(null),D=s.useLocalization(),P=void 0!==d,z=P?d:A,O=h.useCallback(()=>{null!==B.current&&B.current.focus()},[]);h.useEffect(()=>{I&&O()},[I,O]);const q=h.useCallback(e=>{if(e.preventDefault(),o){const t={id:"",author:N,text:z||"",timestamp:new Date,replyToId:I?I.id:void 0,files:M.map(e=>({name:e.name,size:e.size,type:e.extension,rawFile:e.getRawFile?e.getRawFile():e}))};T(null),o(t,e),L([]),P||R(""),p&&p(""),O()}},[o,z,N,I,M,T,p,O,P]);h.useImperativeHandle(t,()=>({focusInput:O}),[O]);const K=h.useCallback(e=>{L(t=>t.filter(t=>t.name!==e))},[]),U=h.useCallback((e,t)=>e.isDeleted?pe(t,D):e.text,[D]),$=h.useCallback(()=>{if(I){const e=de(N,I);return h.createElement("div",{className:n.classNames("k-message-reference",e?"k-message-reference-sender":"k-message-reference-receiver")},h.createElement("div",{className:"k-message-reference-content"},U(I,e)),h.createElement("span",{className:"k-spacer"}),h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:l.xCircleIcon,onClick:()=>T(null),"aria-label":D.toLanguageString(S,me[S]),title:D.toLanguageString(S,me[S])}))}return null},[I,N,U,T,D]),V=h.useCallback(e=>{try{const t=Array.from(e.allFiles);L(t)}catch{}},[]),j=h.useCallback(e=>{const t=e.value;P||R(t),p&&p(t||"")},[P,p]),W=h.useCallback(e=>{q(e.syntheticEvent)},[q]),G=h.useCallback(e=>e?"function"==typeof e?e():e:null,[]),_=h.useCallback(e=>h.createElement(h.Fragment,null,h.createElement(Ve,{affixProps:e,uploadConfig:F,localizationService:D,onFilesSelect:V,onFileRemove:K}),G(null==C?void 0:C.startAffix)),[F,D,V,K,null==C?void 0:C.startAffix,G]),Y=h.useCallback(()=>G(null==C?void 0:C.endAffix),[null==C?void 0:C.endAffix,G]),J=h.useCallback(()=>G(null==C?void 0:C.topAffix),[null==C?void 0:C.topAffix,G]),X=h.useMemo(()=>{const e="object"==typeof f?f:{},t=!1!==f&&{"aria-label":x?D.toLanguageString(H,me[H]):D.toLanguageString(v,me[v]),title:x?D.toLanguageString(H,me[H]):D.toLanguageString(v,me[v]),dir:r?"rtl":void 0,...e};return h.createElement($e,{header:$(),ref:B,placeholder:i,value:z,onChange:j,onPromptAction:W,mode:(null==C?void 0:C.mode)||"multi",rows:(null==C?void 0:C.rows)||2,maxTextAreaHeight:(null==C?void 0:C.maxTextAreaHeight)||"110",loading:x,speechToTextButtonConfig:w,actionButtonConfig:t,attachments:M,startAffix:_,endAffix:null!=C&&C.endAffix?Y:void 0,topAffix:null!=C&&C.topAffix?J:void 0,inputAttributes:{onClick:k,"aria-label":D.toLanguageString(b,me[b])}})},[i,z,j,W,C,x,w,f,M,$,_,Y,J,D,r,k]);return h.createElement("div",{className:"k-message-box-wrapper"},u&&u.length>0&&h.createElement(Me,{onSuggestionClick:m,suggestions:u,suggestionTemplate:g,suggestionsLayout:E,dir:y}),c?h.createElement(c,{messageInput:X}):X)});je.displayName="NewMessage";const We=e=>h.createElement(a.Toolbar,{className:"k-chat-header",size:"small"},e.children),Ge=e=>{const{message:t,onUnpin:o,user:r,onReferencedMessageClick:i}=e,c=s.useLocalization(),u=h.useRef(null),m=r&&de(r,t),d=h.useCallback(e=>{e.preventDefault(),e.stopPropagation(),null==i||i(t.id)},[t.id,i]);return h.createElement("div",{ref:u,className:`k-message-reference ${m?"k-message-reference-sender":"k-message-reference-receiver"} k-message-pinned`,onClick:d},h.createElement(n.IconWrap,{icon:l.pinIcon}),h.createElement("div",{className:"k-message-reference-content"},t.isDeleted?r&&pe(de(r,t),c):t.text),h.createElement("span",{className:"k-spacer"}),h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:l.xCircleIcon,onClick:e=>{e.stopPropagation(),null==o||o(t)},"aria-label":c.toLanguageString("chat.unpinMessage",me["chat.unpinMessage"])}))},_e=e=>{const{show:t,text:n}=e;return h.createElement("div",{style:{position:"absolute",top:"90%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,pointerEvents:t?"auto":"none"}},h.createElement(c.Fade,null,t&&h.createElement(u.Notification,{type:{style:"inverse"},closable:!1},h.createElement("span",null,n))))},Ye={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions",isFailedField:"isFailed"},Je=(e,t={})=>{const n={...Ye,...t};let a,l;a=e.author&&"object"==typeof e.author?{id:e.author.id||e.author[n.authorIdField]||e[n.authorIdField]||"",name:e.author.name||e.author[n.authorNameField]||e[n.authorNameField],avatarUrl:e.author.avatarUrl||e.author[n.authorImageUrlField]||e[n.authorImageUrlField],avatarAltText:e.author.avatarAltText||e.author[n.authorImageAltTextField]||e[n.authorImageAltTextField]}:{id:e[n.authorIdField]||e.authorId||"",name:e[n.authorNameField]||e.authorName,avatarUrl:e[n.authorImageUrlField]||e.authorImageUrl,avatarAltText:e[n.authorImageAltTextField]||e.authorImageAltText},l=e.timestamp?new Date(e.timestamp):e[n.timestampField]?new Date(e[n.timestampField]):new Date;const o={id:void 0!==e.id?e.id:e[n.idField],text:void 0!==e.text?e.text:e[n.textField]||"",author:a,timestamp:l,status:void 0!==e.status?e.status:e[n.statusField],attachments:void 0!==e.attachments?e.attachments:e[n.attachmentsField],attachmentLayout:e.attachmentLayout||"list",suggestedActions:void 0!==e.suggestedActions?e.suggestedActions:e[n.suggestedActionsField],isPinned:void 0!==e.isPinned?e.isPinned:e[n.isPinnedField]||!1,typing:void 0!==e.typing?e.typing:e[n.typingField],files:void 0!==e.files?e.files:e[n.filesField]||[],isFailed:void 0!==e.isFailed?e.isFailed:e[n.isFailedField]||!1};return e.pinnedAt&&(o.pinnedAt=new Date(e.pinnedAt)),e.pinnedBy&&(o.pinnedBy=e.pinnedBy),void 0!==e.replyToId?o.replyToId=e.replyToId:void 0!==e[n.replyToIdField]&&(o.replyToId=e[n.replyToIdField]),void 0!==e.isDeleted?o.isDeleted=e.isDeleted:void 0!==e[n.isDeletedField]&&(o.isDeleted=e[n.isDeletedField]),{...o,dataItem:e}},Xe=(e,t={})=>Array.isArray(e)?e.map(e=>Je(e,t)):[],Qe=e=>e&&void 0!==e.id&&"string"==typeof e.text&&e.author&&"object"==typeof e.author&&void 0!==e.author.id&&(e.timestamp instanceof Date||"string"==typeof e.timestamp||"number"==typeof e.timestamp),Ze=e=>{e.scrollTop=e.scrollHeight-e.clientHeight},et=({viewItemsWrapperRef:e,isKeyboardNavigationActiveRef:t,processedMessages:n,authorId:a,autoScrollThreshold:l,isEndless:o=!1,isOnLastBatch:s=!0,skipAutoScrollRef:r})=>{var i;const c=h.useRef(a),u=h.useRef(l),m=h.useRef(o),d=h.useRef(s);h.useEffect(()=>{c.current=a,u.current=l,m.current=o,d.current=s});const p=h.useRef(!1);h.useEffect(()=>{o||!e.current||0===n.length||p.current||(Ze(e.current),p.current=!0)},[e,o,n.length]);const g=h.useRef(void 0),f=h.useRef(0),v=h.useRef(!0),k=h.useRef(!0),b=h.useRef(!1),E=h.useRef(null),y=(n.length>0?null==(i=n.at(-1))?void 0:i.id:void 0)!==g.current,C=n.length>f.current;if(y||C){const t=e.current;k.current=!t||(e=>{const{scrollHeight:t,scrollTop:n,clientHeight:a}=e;return!(t>a)||t-n-a<=100})(t)}h.useEffect(()=>{var a,l;const o=n.length,s=o>0?null==(a=n[o-1])?void 0:a.id:void 0,i=g.current,p=f.current,h=v.current;if(g.current=s,f.current=o,v.current=!1,0===o)return;const y=e.current;if(!y||t.current)return;if(h||s===i)return void(!m.current&&(h||o>p)&&(Ze(y),b.current=!1,E.current=null));if(m.current&&!d.current)return;if(null!=r&&r.current)return void(r.current=!1);const C=n[o-1];if(void 0!==c.current&&void 0!==(null==(l=null==C?void 0:C.author)?void 0:l.id)&&String(C.author.id)===String(c.current))return y.scrollTo({top:y.scrollHeight-y.clientHeight,behavior:"smooth"}),b.current=!1,void(E.current=null);if(!k.current)return b.current=!1,void(E.current=null);const x=(e=>{const t=e.querySelectorAll(".k-message");return t.length>0?t[t.length-1]:null})(y);if(!x)return;const I=(e=>{const t=e.querySelector(".k-message-pinned");return t?t.offsetHeight:0})(y),T=Math.max(0,y.clientHeight-I),N=((e,t)=>{const n=null!=e?e:"20%";let a;if("number"==typeof n)a=n;else{const e=/^(-?\d+(?:\.\d+)?)%$/.exec(String(n));if(e)a=Number.parseFloat(e[1])/100*t;else{const e=Number.parseFloat(String(n));a=Number.isNaN(e)?.2*t:e}}return Math.min(a,t)})(u.current,T),w=x.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=Math.max(0,w-N-I),S=Math.max(0,y.scrollHeight-y.clientHeight),A=Math.min(F,S);A>y.scrollTop&&y.scrollTo({top:A,behavior:"smooth"}),E.current=F,b.current=!0},[n,e,t]),h.useEffect(()=>{const n=e.current;if(!n)return;let a=n.querySelectorAll(".k-message").length,l=n.scrollHeight,o=n.scrollTop;const s=()=>{const e=n.scrollTop;b.current&&e<o&&(b.current=!1,E.current=null),o=e},r=new MutationObserver(()=>{if(t.current)return;const e=n.querySelectorAll(".k-message").length,s=n.scrollHeight;if(e===a&&s>l&&b.current){const e=s-n.clientHeight,t=E.current,a=null===t?e:Math.min(e,t);a>n.scrollTop&&(n.scrollTop=a),o=n.scrollTop}a=e,l=s});return r.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("scroll",s,{passive:!0}),()=>{r.disconnect(),n.removeEventListener("scroll",s)}},[e,t])},tt=["allowMessageCollapse","messageWidthMode","showAvatar","showUsername","messageTemplate","messageContentTemplate","messageToolbarActions","messageContextMenuActions","fileActions"];function nt(e,t,n,a,l){const o=((e,t)=>{var n,a;return(null==(n=null==e?void 0:e.author)?void 0:n.id)===t||(null==(a=null==e?void 0:e.author)?void 0:a.id)===String(t)})(e,t)?a:l,s={};return tt.forEach(e=>{var t;s[e]=null!=(t=null==o?void 0:o[e])?t:null==n?void 0:n[e]}),s}const at=({scrollMode:e,processedMessages:t,total:n,pageSize:a=50,startIndex:l,endIndex:o,onLoadMoreMessages:s,onReferencedMessageClick:r,viewItemsWrapperRef:i,authorId:c})=>{const u=h.useRef(!1),m="endless"===e,d=null!=n?n:t.length,p=m&&t.length===d&&!u.current,g=m&&(t.length<d||u.current);g&&(u.current=!0);const[f,v]=h.useState(-1),[k,b]=h.useState(-1),E=h.useRef(f),y=h.useRef(k);E.current=f,y.current=k;const C=h.useRef(!1),x=h.useRef(0),I=h.useRef(0),T=h.useRef(0),N=h.useRef(!1),w=h.useRef(d),F=h.useRef(c);F.current=c;const S=h.useRef(!1),A=h.useRef(null),R=h.useRef(!1),M=h.useRef(!1),L=h.useRef(!0),B=h.useRef(d);h.useEffect(()=>{if(p){if(u.current)return void((-1===f||-1===k)&&(v(0),b(t.length)));if(-1===f||-1===k){const e=Math.max(0,t.length-a),n=t.length;v(e),b(n)}else if(k<t.length){const e=w.current;if(y.current>=e)b(t.length);else if(t.length>e&&t.slice(e).some(e=>{var t;return void 0!==(null==(t=e.author)?void 0:t.id)&&String(e.author.id)===String(F.current)})){const e=Math.max(0,t.length-a);v(e),b(t.length),R.current=!0}}w.current=d}},[p,t.length,a,f,k,d]);const D=null!=l?l:0,P=null!=o?o:t.length,z=h.useCallback(()=>{const e=i.current;e&&(x.current=e.scrollHeight,I.current=e.scrollTop,T.current=e.querySelectorAll("[data-message-id]").length)},[i]),O=h.useCallback(e=>{var t,n,a;((e,t,n=0)=>{if(!t)return;const a=t.querySelector(`[data-message-id="${e}"]`);if(!a)return;const l=t.querySelector(".k-message-list");if(l){const e=l.getBoundingClientRect().top,t=a.getBoundingClientRect().top,o=l.scrollTop+(t-e)-n;l.scrollTo({top:o,behavior:"smooth"})}else a.scrollIntoView({behavior:"smooth",block:"start"})})(e,null==(t=i.current)?void 0:t.closest(".k-chat"),(null==(a=null==(n=i.current)?void 0:n.querySelector(".k-message-pinned"))?void 0:a.offsetHeight)||0)},[i]);h.useLayoutEffect(()=>{if(!N.current)return;const e=i.current;if(!e)return void(N.current=!1);if(e.querySelectorAll("[data-message-id]").length<=T.current)return;const t=e.scrollHeight-x.current;t>0&&(e.scrollTop=I.current+t),N.current=!1,C.current=!1}),h.useLayoutEffect(()=>{if(!R.current)return;const e=i.current;e?k>=t.length&&k>0&&(R.current=!1,e.scrollTop=e.scrollHeight-e.clientHeight):R.current=!1});const q=h.useRef(!1);h.useLayoutEffect(()=>{if(!m||q.current)return;const e=i.current;e&&e.querySelector("[data-message-id]")&&(e.scrollTop=e.scrollHeight-e.clientHeight,q.current=!0)}),h.useEffect(()=>{if(!m)return;const e=i.current;if(!e)return;let n=e.scrollTop;const l=()=>{const{scrollTop:l,scrollHeight:o,clientHeight:r}=e,i=l<n,c=l>n;if(n=l,!C.current){if(i&&l<=100)if(p){const e=E.current;if(e>0){const t=Math.max(0,e-a);N.current=!0,z(),v(t),null==s||s({startIndex:t,endIndex:y.current})}}else if(g&&D>0){C.current=!0;const e=Math.max(0,D-a);N.current=!0,z(),null==s||s({startIndex:e,endIndex:P})}if(c&&o-l-r<=100)if(p){const e=y.current;if(e<t.length){const n=Math.min(t.length,e+a);M.current=!0,b(n),null==s||s({startIndex:E.current,endIndex:n})}}else if(g&&P<d){C.current=!0,M.current=!0;const e=Math.min(d,P+a);null==s||s({startIndex:D,endIndex:e})}}};return e.addEventListener("scroll",l,{passive:!0}),()=>e.removeEventListener("scroll",l)},[m,p,g,i,a,t.length,D,P,d,s]),h.useEffect(()=>{var e;const n=P>=d;if(!g)return B.current=d,void(L.current=n);const a=B.current,l=L.current;if(B.current=d,L.current=n,d>a&&!l&&n){const n=t[t.length-1];void 0!==F.current&&void 0!==(null==(e=null==n?void 0:n.author)?void 0:e.id)&&String(n.author.id)===String(F.current)&&(S.current=!0,M.current=!0)}},[g,d,P,t]),h.useEffect(()=>{!g||!S.current||(S.current=!1,C.current=!1,requestAnimationFrame(()=>{const e=i.current;e&&(e.scrollTop=e.scrollHeight-e.clientHeight)}))},[g,t,i]),h.useEffect(()=>{if(!g||null===A.current)return;const e=A.current,t=i.current;t&&t.querySelector(`[data-message-id="${e}"]`)&&(A.current=null,C.current=!1,requestAnimationFrame(()=>{O(e)}))},[g,t,i,O]),h.useEffect(()=>{g&&C.current&&!N.current&&(C.current=!1)},[g,D,P]);const K=h.useMemo(()=>{if(p){const e=Math.max(0,f),n=Math.min(t.length,k);if(e>=n){const e=Math.max(0,t.length-a);return t.slice(e)}return t.slice(e,n)}return t},[p,t,f,k,a]),H=h.useMemo(()=>!m||(p?k>=t.length:P>=d),[m,p,k,t.length,P,d]),U=h.useCallback(()=>{if(!m||H){const e=i.current;return void(e&&e.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:"smooth"}))}if(!C.current)if(p){const e=Math.max(0,t.length-a);v(e),b(t.length),null==s||s({startIndex:e,endIndex:t.length}),requestAnimationFrame(()=>{const e=i.current;e&&(e.scrollTop=e.scrollHeight-e.clientHeight)})}else if(g){S.current=!0,N.current=!1,C.current=!0;const e=Math.max(0,d-a);null==s||s({startIndex:e,endIndex:d})}},[m,p,g,H,t.length,a,d,s,i]),$=h.useCallback(e=>{if(m){if(p){const n=i.current;if(null==n?void 0:n.querySelector(`[data-message-id="${e}"]`))O(e);else{if(C.current)return;const n=t.findIndex(t=>t.id===e||String(t.id)===String(e));if(n>=0){const l=Math.floor(a/2),o=Math.max(0,n-l),s=Math.min(t.length,o+a);C.current=!0,v(o),b(s),requestAnimationFrame(()=>{requestAnimationFrame(()=>{O(e),C.current=!1})})}}}else if(g){const t=i.current;if(null==t?void 0:t.querySelector(`[data-message-id="${e}"]`))O(e);else{if(C.current)return;A.current=e,N.current=!1,C.current=!0}}}else O(e);null==r||r({id:e})},[m,p,g,i,t,a,r,O]);return{renderedMessages:K,handleScrollToBottom:U,handleReferencedMessageClick:$,isEndless:m,isOnLastBatch:H,skipAutoScrollRef:M}},lt=h.forwardRef((e,t)=>{const{messages:o=[],messageTemplate:r,messageContentTemplate:i,attachmentTemplate:c,width:u,height:m,onSendMessage:d,onSuggestionClick:p,onInputValueChange:g,onActionExecute:f,dir:v,messageBox:k,placeholder:b,className:E,style:C,message:x=Ee,authorId:I,suggestions:T,suggestionTemplate:N,suggestionsLayout:F="scroll",quickActionsLayout:S="scroll",inputValue:A,headerTemplate:R,noDataTemplate:M,timestampTemplate:L,statusTemplate:B,userStatusTemplate:D,allowMessageCollapse:P,messageToolbarActions:z,messageContextMenuActions:q,fileActions:K,onUnpin:H,messageWidthMode:U,showAvatar:$,showUsername:V,timestampVisibility:j,authorMessageSettings:W,receiverMessageSettings:G,onToolbarAction:_,onContextMenuAction:Y,onFileAction:J,onDownload:X,speechToTextConfig:Q,uploadConfig:Z,sendButtonConfig:ee,messageFilesLayout:te,scrollToBottomButton:ne=!0,autoScrollThreshold:ae,textField:le,statusField:oe,authorIdField:se,authorNameField:re,authorImageUrlField:ie,authorImageAltTextField:ce,idField:ue,timestampField:de,filesField:pe,attachmentsField:ge,replyToIdField:fe,isDeletedField:he,isPinnedField:ke,typingField:be,suggestedActionsField:ye,isFailedField:xe,onResendMessage:Ie,messageBoxSettings:Te,loading:Ne,scrollMode:Fe,total:Me,pageSize:Le,startIndex:Be,endIndex:De,onLoadMoreMessages:Pe,pinnedMessages:ze,repliedToMessages:Oe,onReferencedMessageClick:qe,...He}=e,Ue=h.useRef(null);n.useWebMcpRegister("chat",Ue,e,e.webMcp);const[$e,Ve]=h.useState(null),[Ye,Je]=h.useState(!1),[Ze,tt]=h.useState(!1),[lt,ot]=h.useState(null),[st,rt]=h.useState(null),[it,ct]=h.useState(!1),ut=h.useRef(null),mt=h.useRef(null),dt=h.useRef(null),pt=h.useRef(null),gt=h.useRef(void 0),ft=h.useRef(!1),ht=h.useRef(null),vt=h.useRef(""),kt=h.useMemo(()=>{if(!o||0===o.length)return[];const e={textField:le,statusField:oe,authorIdField:se,authorNameField:re,authorImageUrlField:ie,authorImageAltTextField:ce,idField:ue,timestampField:de,filesField:pe,attachmentsField:ge,replyToIdField:fe,isDeletedField:he,isPinnedField:ke,typingField:be,suggestedActionsField:ye,isFailedField:xe};return!Object.values(e).some(e=>void 0!==e)&&Qe(o[0])?o.map(e=>({...e,timestamp:e.timestamp?new Date(e.timestamp):e.timestamp})):Xe(o,e)},[o,le,oe,se,re,ie,ce,ue,de,pe,ge,fe,he,ke,be,ye,xe]);h.useEffect(()=>{if(I===vt.current&&ht.current)rt(ht.current);else if(I&&kt.length>0){const e=kt.find(e=>e.author&&(e.author.id===I||e.author.id===String(I))),t=(null==e?void 0:e.author)||{id:I};ht.current=t,vt.current=I,rt(t)}},[I,kt]);const{renderedMessages:bt,handleScrollToBottom:Et,handleReferencedMessageClick:yt,isEndless:Ct,isOnLastBatch:xt,skipAutoScrollRef:It}=at({scrollMode:Fe,processedMessages:kt,total:Me,pageSize:Le,startIndex:Be,endIndex:De,onLoadMoreMessages:Pe,onReferencedMessageClick:qe,viewItemsWrapperRef:dt,authorId:I}),Tt=h.useMemo(()=>bt.length>0?(e=>{const t=e.slice().reduce(Ce(e.length),[]);return function(e){let t=0;e.forEach(e=>{"message-group"===e.type?e.messages.forEach(e=>{e.selectionIndex=t++}):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)}),e.lastSelectionIndex=t-1}(t),t})(bt):[],[bt]),Nt=h.useMemo(()=>!n.validatePackage(Ke,{component:"Chat"}),[]),wt=n.getLicenseMessage(Ke),Ft=h.useMemo(()=>{if(ze)return ze.find(e=>e.isPinned);const e=kt.find(e=>e.isPinned);return e||void 0},[kt,ze]),St=s.useLocalization();et({viewItemsWrapperRef:dt,isKeyboardNavigationActiveRef:ft,processedMessages:bt,authorId:I,autoScrollThreshold:ae,isEndless:Ct,isOnLastBatch:xt,skipAutoScrollRef:It});const At=(({elementRef:e})=>{const[t,n]=h.useState(!1);return h.useEffect(()=>{const t=e.current;if(!t)return;const a=()=>{n(t.scrollHeight>t.clientHeight)};a();const l=new ResizeObserver(a);l.observe(t);const o=new MutationObserver(()=>{requestAnimationFrame(a)});return o.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),o.disconnect()}},[e]),t})({elementRef:dt}),Rt=h.useCallback(()=>{clearTimeout(gt.current)},[]),Mt=h.useCallback(()=>{gt.current=window.setTimeout(()=>{Ve(null)},0)},[]),Lt=h.useCallback(e=>{Ve(e)},[]),Bt=h.useCallback(e=>{let t=null;const a=null!==$e?$e:Tt.lastSelectionIndex;e.keyCode===n.Keys.up?null===a?t=0:a>0&&(t=a-1):e.keyCode===n.Keys.down?null===a?t=0:a<Tt.lastSelectionIndex&&(t=a+1):e.keyCode===n.Keys.home?t=0:e.keyCode===n.Keys.end&&(t=Tt.lastSelectionIndex),null!==t&&(Ve(t),ft.current=!0,e.preventDefault())},[$e,Tt]),Dt=h.useCallback((e,t,a)=>{var l;if(f&&f({action:{value:e.value,title:e.title,type:e.type},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget}),!t.isDefaultPrevented()){switch(e.type){case"reply":d&&d({message:{id:"",author:st,text:e.value,timestamp:new Date},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget});break;case"call":window.open("tel:"+e.value);break;case"openUrl":{const t=n.sanitizeUrl(e.value);t&&window.open(t,"_blank","noopener,noreferrer");break}}null==(l=pt.current)||l.focusInput()}},[f,d,st]),Pt=h.useCallback(()=>n.classNames("k-chat",E,{"k-rtl":Ye}),[E,Ye]),zt=h.useCallback(()=>{const e=Tt.length-1;return Tt.map((t,n)=>{var a,l,o,s,u,m;if("date-marker"===t.type)return h.createElement(Ae,{item:t,key:t.trackBy,timestampTemplate:L});if("message-group"===t.type){const o={allowMessageCollapse:P,messageWidthMode:U,showAvatar:$,showUsername:V,messageTemplate:r,messageContentTemplate:i,messageToolbarActions:z,messageContextMenuActions:q,fileActions:K},s=nt(null==(a=t.messages)?void 0:a[0],I,o,W,G);return h.createElement(Re,{group:t,itemTemplate:s.messageTemplate,contentTemplate:s.messageContentTemplate,attachmentTemplate:c,user:st,selectedItemIndex:$e,onRequestSelection:Lt,isLastGroup:n===e,key:null!=(l=t.messages[0].id)?l:t.messages[0].selectionIndex,message:x,allowMessageCollapse:s.allowMessageCollapse,messageToolbarActions:s.messageToolbarActions,messageContextMenuActions:s.messageContextMenuActions,fileActions:s.fileActions,messageWidthMode:s.messageWidthMode,showAvatar:s.showAvatar,showUsername:s.showUsername})}return"attachment-group"===t.type?h.createElement(Se,{group:t,itemTemplate:c,onRequestSelection:Lt,selected:t.selectionIndex===$e,isLastGroup:n===e,key:`att-${null!=(s=null==(o=t.trackBy)?void 0:o.id)?s:t.selectionIndex}`}):"action-group"===t.type?h.createElement(we,{group:t,onActionExecute:Dt,onRequestSelection:Lt,selected:t.selectionIndex===$e,key:`act-${null!=(m=null==(u=t.trackBy)?void 0:u.id)?m:t.selectionIndex}`,quickActionsLayout:S,dir:v}):null})},[Tt,L,r,i,c,st,$e,Lt,x,P,z,q,K,U,$,V,I,W,G,Dt,S,v]),Ot=h.useCallback(()=>R?"function"==typeof R?R():R:null,[R]),qt=h.useCallback(()=>M?"function"==typeof M?M():M:null,[M]);h.useEffect(()=>{const e=void 0!==v?"rtl"===v:ut.current&&"rtl"===getComputedStyle(ut.current).direction;Je(!!e)},[v]),h.useEffect(()=>()=>{clearTimeout(gt.current)},[]),h.useEffect(()=>{if(!ne||!dt.current)return;let e,t;const n=()=>{e=void 0;const n=dt.current;if(!n)return;const{scrollHeight:a,scrollTop:l,clientHeight:o}=n;!(a>o)||a-l-o<=100?(void 0!==t&&(clearTimeout(t),t=void 0),ct(!1)):null!=t||(t=setTimeout(()=>{t=void 0,ct(!0)},300))},a=()=>{void 0===e&&(e=requestAnimationFrame(n))},l=dt.current;l.addEventListener("scroll",a,{passive:!0});const o=new MutationObserver(a);return o.observe(l,{childList:!0,subtree:!0,characterData:!0}),()=>{l.removeEventListener("scroll",a),o.disconnect(),void 0!==e&&cancelAnimationFrame(e),void 0!==t&&clearTimeout(t)}},[ne]);const Kt=h.useMemo(()=>({replyToMessage:lt,setReplyToMessage:ot,messages:kt,repliedToMessages:Oe,user:st,internalScrollContainerRef:mt,messageListScrollContainerRef:dt,onToolbarAction:_,onContextMenuAction:Y,onFileAction:J,setShowCopyNotification:tt,onDownload:X,onResendMessage:Ie,fileActions:K,speechToTextConfig:Q,uploadConfig:Z,statusTemplate:B,userStatusTemplate:D,messageFilesLayout:te,timestampVisibility:j,onReferencedMessageClick:yt}),[lt,ot,kt,Oe,st,_,Y,J,tt,X,Ie,K,Q,Z,B,D,te,j,yt]);return h.createElement(ve.Provider,{value:Kt},h.createElement("div",{style:{width:u,height:m,position:"relative",overflow:"hidden",...C},onKeyDown:Bt,className:Pt(),ref:e=>{ut.current=e,mt.current=e,"function"==typeof t?t(e):t&&(t.current=e)},...He},void 0!==R&&h.createElement(We,null,Ot()),h.createElement("div",{className:"k-message-list",onBlur:Mt,onFocus:Rt,role:"log","aria-label":St.toLanguageString(y,me[y]),"aria-live":"polite",ref:dt,style:{scrollBehavior:"auto"}},Ft&&h.createElement(Ge,{message:Ft,onUnpin:H,user:st,onReferencedMessageClick:yt}),h.createElement("div",{className:n.classNames("k-message-list-content",{"k-message-list-content-empty":0===bt.length})},0===bt.length&&void 0!==M&&qt(),bt.length>0&&zt()),ne&&(it||!xt)&&h.createElement("div",{className:"k-chat-scroll-to-bottom-container"},h.createElement(a.FloatingActionButton,{svgIcon:l.arrowDownIcon,size:"small",themeColor:"base",rounded:"full",onClick:Et,"aria-label":St.toLanguageString(O,me[O]),title:St.toLanguageString(O,me[O])}))),At&&h.createElement("div",{className:"k-separator"}),h.createElement(je,{onSendMessage:(e,t)=>{d&&d({message:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})},onSuggestionClick:e=>{p&&p(e)},isDirectionRightToLeft:Ye,ref:pt,placeholder:b,MessageBox:k,suggestions:T,suggestionTemplate:N,inputValue:A,onInputValueChange:e=>{g&&g(e)},onInputClick:()=>{ft.current=!1},sendButtonConfig:ee,suggestionsLayout:F,dir:v,messageBoxSettings:Te,loading:Ne}),h.createElement(_e,{show:Ze,text:St.toLanguageString(w,me[w])}),Nt&&h.createElement(n.WatermarkOverlay,{message:wt})))});lt.displayName="Chat",lt.propTypes={messages:r.arrayOf(r.object),user:r.object,messageTemplate:r.any,messageContentTemplate:r.any,attachmentTemplate:r.any,width:r.oneOfType([r.string,r.number]),style:r.object,onSendMessage:r.func,onActionExecute:r.func,dir:r.string,messageBox:r.any,noDataTemplate:r.oneOfType([r.element,r.func]),suggestionsLayout:r.oneOf(["scroll","wrap","scrollbuttons"]),quickActionsLayout:r.oneOf(["scroll","wrap","scrollbuttons"]),userStatusTemplate:r.elementType,messageFilesLayout:r.oneOf(["vertical","wrap","horizontal"]),showAvatar:r.bool,showUsername:r.bool,authorMessageSettings:r.object,receiverMessageSettings:r.object,scrollMode:r.oneOf(["scrollable","endless"]),total:r.number,pageSize:r.number,startIndex:r.number,endIndex:r.number,onLoadMoreMessages:r.func,pinnedMessages:r.arrayOf(r.object),repliedToMessages:r.arrayOf(r.object),onReferencedMessageClick:r.func};const ot=e=>{const{activeView:t,toolbarItems:n,activeViewChange:l}=e;return h.createElement("div",{className:"k-prompt-header"},h.createElement(a.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map(e=>h.isValidElement(e)?e:h.createElement(a.Button,{key:e.name,className:t===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>(e=>{null==l||l.call(null,e)})(e.name)},e.buttonText))))},st={name:"Output view",buttonText:"Output",buttonIcon:l.commentIcon},rt={name:"Commands view",buttonIcon:l.moreHorizontalIcon},it={name:"Prompt view",buttonText:"Ask AI",buttonIcon:l.sparklesIcon},ct=h.createContext([{},()=>{}]),ut=()=>h.useContext(ct),mt=e=>{const{children:t}=e;return h.createElement("div",{className:"k-prompt-footer"},h.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},t))},dt=h.forwardRef((e,t)=>{const{children:n,streaming:o,onCancel:r}=e,i=s.useLocalization().toLanguageString(x,me[x]),[c]=ut(),u=c.activeView===st.name,m=o&&!u,d=h.useCallback(e=>{"Escape"===e.key&&o&&r&&(e.preventDefault(),r())},[o,r]);return h.createElement("div",{className:"k-prompt-content",ref:t,onKeyDown:d},m&&h.createElement(a.FloatingActionButton,{onClick:r,svgIcon:l.stopIcon,icon:"stop",size:"medium",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":i,title:i}),h.createElement("div",{className:"k-prompt-view"},n))});dt.displayName="KendoReactAIPromptContent";const pt=e=>{const[t]=ut();return t.activeView===e.name?e.children:null},gt=e=>{const[t,n]=h.useState(!0),{children:o,title:s}=e;return h.createElement("div",{className:"k-prompt-expander"},h.createElement(a.Button,{"aria-controls":e.id,fillMode:"flat",svgIcon:t?l.chevronUpIcon:l.chevronDownIcon,title:s,onClick:()=>n(!t),"aria-expanded":t},s),t&&h.createElement("div",{id:e.id,className:"k-prompt-expander-content"},o))},ft=e=>null==e?void 0:e.map(e=>h.createElement(o.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&ft(e.children))),ht=({show:e=!1,anchor:t,onOpen:n,onClose:a,animate:l=!0,appendTo:o,popupOptions:s={},children:r,style:i})=>h.createElement(d.Popup,{show:e,anchor:t,style:i,animate:l,appendTo:o,onOpen:n,onClose:a,...s},r),vt=({placeholder:e="Ask or generate content with AI...",promptValue:t,onMenuClick:o,promptInput:s=m.TextArea,generateButton:r,enableSpeechToText:i=!1,streaming:c=!1,commands:u,onPromptRequest:d,onPromptCancel:p})=>{const[g,f]=h.useState(t||""),[v,k]=n.useCustomComponent(r),[b,E]=n.useCustomComponent(s),y=s===m.TextArea||b===m.TextArea,C={svgIcon:c?l.stopIcon:l.paperPlaneIcon,active:(!!c).toString(),title:"Send Button","aria-label":"Send Button",disabled:!g.trim()&&!c,"aria-disabled":!g.trim()&&!c},x={placeholder:e,className:"!k-flex-row",...y?{autoSize:!0}:{},rows:1},I=u&&u.length>0,T=Object.keys(k).length>0?k:C,N=Object.keys(E).length>0?E:x,w=e=>{const{isFinal:t,alternatives:n}=e;if(t&&n.length>0){const e=n[0].transcript,t=(()=>{const t=g,n=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(n?" ":"")+e})();f(t)}},F=()=>{g.trim()&&d&&d(g.trim())};return h.createElement(b,{value:g,onChange:e=>{const t=e.target.value;f(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),F())},prefix:I||i?h.createElement(h.Fragment,null,h.createElement(m.InputPrefix,{className:"!k-align-items-start"},I&&h.createElement(a.Button,{"aria-label":"Commands Button",title:"Commands Button",fillMode:"flat",svgIcon:l.menuIcon,onClick:o}),i&&h.createElement(a.SpeechToTextButton,{fillMode:"flat",..."object"==typeof i?{...i,onResult:i.onResult||w}:{onResult:w}})),h.createElement(m.InputSeparator,null)):void 0,suffix:h.createElement(m.InputSuffix,{className:"!k-align-items-start"},h.createElement(v,{className:n.classNames("k-prompt-send",{"k-generating":c,"k-active":c}),fillMode:"flat",onClick:c?p:F,...T})),...N})},kt=h.forwardRef((e,t)=>{const{svgIcon:a,label:o,labelClassName:s,secondaryLabel:r,linesAdded:i,linesRemoved:c,expandable:u,expanded:m,defaultExpanded:d,completed:p,onExpandedChange:g,headerTemplate:f,bodyTemplate:v,headerExtra:k,className:b,children:E,...y}=e,C=void 0!==m,[x,I]=h.useState(null!=d&&d),T=null!=m?m:x,N=h.useRef(null),w=h.useCallback(e=>{var t;if(!u)return;const n=!T;if(C||I(n),g){const a={expanded:n,syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(t=N.current)?t:e.currentTarget};g(a)}},[u,T,C,g]),F=h.createElement(h.Fragment,null,a&&h.createElement(n.SvgIcon,{icon:a,size:"small",className:"k-agent-step-icon"}),h.createElement("span",{className:"k-agent-step-content"},o&&h.createElement("span",{className:n.classNames("k-agent-step-label",!1===p&&"k-text-shimmer",s)},o),r&&h.createElement(h.Fragment,null,h.createElement("span",{className:"k-agent-step-sep"},"·"),h.createElement("span",{className:"k-agent-step-secondary"},r)),null!=i&&i>0&&h.createElement("span",{className:"k-agent-step-added k-text-success"},"+",i),null!=c&&c>0&&h.createElement("span",{className:"k-agent-step-removed k-text-error"},"-",c),k,u&&h.createElement(n.SvgIcon,{icon:T?l.chevronUpIcon:l.chevronRightIcon,size:"small",className:"k-agent-step-expand"})));let S;return S=f?h.createElement(f,{svgIcon:a,label:o,secondaryLabel:r,headerExtra:k,linesAdded:i,linesRemoved:c,completed:p,expanded:T,expandable:u}):u?h.createElement("button",{ref:N,type:"button",className:"k-agent-step-head","aria-expanded":T,onClick:w},F):h.createElement("div",{className:"k-agent-step-head"},F),h.createElement("div",{ref:t,className:n.classNames("k-agent-step",{"k-agent-completed":p},b),...y},S,T&&E&&(v?h.createElement(v,{expanded:T,completed:p},E):h.createElement("div",{className:"k-agent-step-body"},E)))});kt.displayName="KendoReactAgentStep";const bt=h.forwardRef((e,t)=>{const{svgIcon:a,label:l,labelClassName:o,secondaryLabel:s,linesAdded:r,linesRemoved:i,status:c,statusThemeColor:u,statusSvgIcon:m,completed:d,description:g,contentNode:f,className:v,children:k,...b}=e,E=!0===d,y=!E;return h.createElement("div",{className:n.classNames("k-thought",{"k-thought-completed":E},{"k-thought-active":y},v),ref:t,...b},h.createElement("span",{className:"k-agent-step-icon-col"},a&&h.createElement(n.SvgIcon,{icon:a,size:"small",className:"k-agent-step-icon"})),h.createElement("span",{className:"k-agent-step-content"},null!=f?f:h.createElement(h.Fragment,null,l&&h.createElement("span",{className:n.classNames("k-agent-step-label",y&&"k-text-shimmer",o)},l),g&&h.createElement("span",{className:"k-agent-step-description"},g),s&&h.createElement(h.Fragment,null,h.createElement("span",{className:"k-agent-step-sep"},"·"),h.createElement("span",{className:"k-agent-step-secondary"},s)),null!=r&&r>0&&h.createElement("span",{className:"k-agent-step-added k-text-success"},"+",r),null!=i&&i>0&&h.createElement("span",{className:"k-agent-step-removed k-text-error"},"-",i),c&&h.createElement(p.Badge,{size:"small",themeColor:null!=u?u:"success",rounded:"full"},m&&h.createElement(n.SvgIcon,{icon:m,size:"small"}),c),k&&h.createElement("div",{className:"k-agent-step-body"},k))))});bt.displayName="KendoReactThought";const Et=h.forwardRef((e,t)=>{const{label:a,secondaryLabel:o,svgIcon:s=l.sparklesIcon,completed:r,expanded:i,defaultExpanded:c,expandable:u,thoughts:m=[],linesAdded:d,linesRemoved:p,thoughtTemplate:g,onExpandedChange:f,className:v,...k}=e,b=m.map((e,t)=>h.createElement(bt,{key:t,label:e.label,secondaryLabel:e.secondaryLabel,svgIcon:e.svgIcon,completed:e.completed,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,contentNode:g?h.createElement(g,{thought:e,index:t}):void 0},e.content));return h.createElement(kt,{ref:t,svgIcon:s,label:a,secondaryLabel:o,completed:r,expanded:i,defaultExpanded:c,expandable:u&&m.length>0,linesAdded:d,linesRemoved:p,onExpandedChange:f,className:n.classNames("k-chain-of-thought",v),...k},b)});Et.displayName="KendoReactChainOfThought";const yt=h.forwardRef((e,t)=>{const{visible:l,state:o,template:r,onAction:i,className:c,...u}=e,m=s.useLocalization(),d=h.useRef(null),p=h.useCallback(e=>{var t,n;if(i&&o){const a={action:o,syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(n=null==(t=d.current)?void 0:t.element)?n:e.currentTarget};i(a)}},[i,o]),g=m.toLanguageString(ae,me[ae]),f=m.toLanguageString(le,me[le]),v=m.toLanguageString(oe,me[oe]),k=m.toLanguageString(se,me[se]);let b=null;return"startOver"===o||"restore"===o?b=h.createElement(a.Button,{ref:d,size:"small",fillMode:"flat",onClick:p},"startOver"===o?g:f):"redo"===o&&(b=h.createElement(h.Fragment,null,h.createElement("span",{className:"k-checkpoint-stamp"},v),h.createElement("span",null,"·"),h.createElement(a.Button,{ref:d,size:"small",fillMode:"flat",onClick:p},k))),h.createElement("div",{ref:t,className:n.classNames("k-checkpoint",{"k-checkpoint-visible":!0===l},c),...u},h.createElement("span",{className:"k-checkpoint-line","aria-hidden":"true"}),r?h.createElement(r,{state:o}):b,h.createElement("span",{className:"k-checkpoint-line","aria-hidden":"true"}))});yt.displayName="KendoReactCheckpoint";const Ct=e=>{const{sources:t}=e;return h.createElement(h.Fragment,null,t.map((e,t)=>{const a=n.sanitizeUrl(null==e?void 0:e.url);return h.createElement("div",{className:"k-citation-popover-view",key:t},(null==e?void 0:e.title)&&h.createElement("div",{className:"k-citation-popover-view-title"},e.title),a&&h.createElement("a",{className:"k-citation-popover-view-source",href:a,target:"_blank",rel:"noopener noreferrer"},h.createElement(n.IconWrap,{name:l.globeIcon.name,icon:l.globeIcon}),e.url),(null==e?void 0:e.description)&&h.createElement("span",{className:"k-citation-popover-view-body"},e.description))}))},xt={horizontal:"fit",vertical:"flip"},It=[],Tt=(e,t)=>{if(void 0!==e)return e;const n=t[0];return(e=>{if(!e)return"";try{return new URL(e).hostname}catch{return""}})(null==n?void 0:n.url)||(null==n?void 0:n.title)||""},Nt=h.forwardRef((e,t)=>{const{sources:o=It,label:r,svgIcon:i=l.globeIcon,additionalCount:c,bodyTemplate:u,onOpen:m,showOn:d="hover",className:p,...f}=e,v=s.useLocalization(),[k,b]=h.useState(null),[E,y]=h.useState(!1),[C,x]=h.useState(0),I=h.useRef(o),T=h.useRef(null);o!==I.current&&(I.current=o,x(0));const N=h.useCallback(e=>{var n;const a=null!=(n=null==e?void 0:e.element)?n:null;b(a),"function"==typeof t?t(a):t&&(t.current=a)},[t]),w=h.useCallback(()=>{null!==T.current&&(clearTimeout(T.current),T.current=null)},[]),F=h.useCallback(()=>{w(),T.current=setTimeout(()=>y(!1),150)},[w]);h.useEffect(()=>w,[w]),h.useEffect(()=>{if(!k||0===o.length||"hover"!==d)return;const e=()=>{w(),y(!0)},t=()=>F();return k.addEventListener("mouseenter",e),k.addEventListener("mouseleave",t),()=>{k.removeEventListener("mouseenter",e),k.removeEventListener("mouseleave",t)}},[k,o.length,w,F,d]);const S=h.useCallback((e,t)=>{if(0!==o.length&&(w(),y(!0),m)){const n={sources:o,syntheticEvent:e,nativeEvent:e.nativeEvent,target:t};m(n)}},[o,m,w]),A=h.useCallback(e=>{var t;S(e.syntheticEvent,null!=(t=e.target.element)?t:e.syntheticEvent.currentTarget)},[S]),R=h.useCallback(e=>{var t;"Enter"!==e.syntheticEvent.key&&" "!==e.syntheticEvent.key||(e.syntheticEvent.preventDefault(),S(e.syntheticEvent,null!=(t=e.target.element)?t:e.syntheticEvent.currentTarget))},[S]),M=`k-citation-popover-${n.useId()}`;h.useEffect(()=>{if(!E||"hover"!==d)return;const e=document.getElementById(M);return e?(e.addEventListener("mouseenter",w),e.addEventListener("mouseleave",F),()=>{e.removeEventListener("mouseenter",w),e.removeEventListener("mouseleave",F)}):void 0},[E,M,w,F,d]),h.useEffect(()=>{if(!E||"click"!==d)return;const e=e=>{const t=document.getElementById(M);k&&!k.contains(e.target)&&(!t||!t.contains(e.target))&&y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E,d,k,M]);const L=o.length,B=h.useCallback(()=>x(e=>Math.min(e+1,L-1)),[L]),D=h.useCallback(()=>x(e=>Math.max(e-1,0)),[]),P=[Tt(r,o),c&&o.length>1?"+"+(o.length-1):void 0].filter(Boolean).join(" "),z=null!=u?u:Ct,O=h.createElement(h.Fragment,null,h.createElement("span",{className:"k-citation-pages"},C+1,"/",L),h.createElement(a.ButtonGroup,null,h.createElement(a.Button,{svgIcon:l.arrowLeftIcon,fillMode:"flat",size:"small","aria-label":v.toLanguageString(ce,me[ce]),disabled:C<=0,onClick:D}),h.createElement(a.Button,{svgIcon:l.arrowRightIcon,fillMode:"flat",size:"small","aria-label":v.toLanguageString(ue,me[ue]),disabled:C>=L-1,onClick:B})));return h.createElement(h.Fragment,null,h.createElement(a.Chip,{ref:N,text:P,svgIcon:i,size:"small",fillMode:"outline",rounded:"full",selected:E,onClick:A,onKeyDown:R,className:n.classNames("k-citation",p),...f}),L>0&&h.createElement(g.Popover,{show:E,anchor:k,title:O,collision:xt,callout:!1,margin:{vertical:8,horizontal:0},position:"top",id:M,popoverClass:"k-citation-popover",style:{width:"320px","--kendo-citation-popover-view-current":C+1}},h.createElement(z,{sources:o})))});Nt.displayName="KendoReactCitation";const wt=h.forwardRef((e,t)=>{const{label:a="Reasoning",secondaryLabel:o,svgIcon:s=l.sparklesIcon,completed:r,expanded:i,defaultExpanded:c,expandable:u,contentTemplate:m,onExpandedChange:d,className:p,children:g,...f}=e,v=m?h.createElement(m,null,g):g;return h.createElement(kt,{ref:t,svgIcon:s,label:a,secondaryLabel:o,completed:r,expanded:i,defaultExpanded:c,expandable:u,onExpandedChange:d,className:n.classNames("k-reasoning",p),...f},v)});wt.displayName="KendoReactReasoning";const Ft=e=>"string"==typeof e?e:JSON.stringify(e,null,2),St=e=>h.createElement(h.Fragment,null,h.createElement("div",{className:"k-tool-call-label"},"Parameters"),h.createElement("pre",{className:"k-pre"},h.createElement("code",{className:"k-code"},Ft(e.parameters)))),At=e=>h.createElement(h.Fragment,null,h.createElement("div",{className:"k-tool-call-label"},"Result"),h.createElement("pre",{className:"k-pre"},h.createElement("code",{className:"k-code"},Ft(e.result)))),Rt=e=>e.errorText?h.createElement("div",{className:"k-messagebox k-messagebox-error"},e.errorText):null,Mt={active:"base",completed:"success",awaitingApproval:"warning",error:"error"},Lt={completed:l.checkCircleIcon,awaitingApproval:l.clockIcon,error:l.xCircleIcon},Bt={active:Z,completed:ee,awaitingApproval:te,error:ne},Dt=h.forwardRef((e,t)=>{const{svgIcon:r=l.wrenchIcon,state:i,parameters:c,result:u,errorText:m,approvalText:d,paramsTemplate:g,resultTemplate:f,errorTemplate:v,approvalTemplate:k,onExpandedChange:b,onAction:E,className:y,children:C,...x}=e,I=s.useLocalization(),T=h.useRef(null),N=h.useRef(null),w=null!=i&&"active"!==i,F=null!=i&&"active"!==i&&"awaitingApproval"!==i,S=w?I.toLanguageString(Bt[i],me[Bt[i]]):void 0,A=w?Mt[i]:void 0,R=w?Lt[i]:void 0,M=w&&h.createElement(p.Badge,{size:"small",themeColor:A,rounded:"full",position:null},R&&h.createElement(n.SvgIcon,{icon:R,size:"small"}),h.createElement("span",{className:"k-badge-text"},S)),L="awaitingApproval"===i,B=h.useCallback(e=>{var t,n;if(E){const a={action:"approve",syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(n=null==(t=T.current)?void 0:t.element)?n:e.currentTarget};E(a)}},[E]),D=h.useCallback(e=>{var t,n;if(E){const a={action:"reject",syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(n=null==(t=N.current)?void 0:t.element)?n:e.currentTarget};E(a)}},[E]),P=L&&(k?h.createElement(k,{state:i,approvalText:d}):h.createElement(o.Card,null,d&&h.createElement(o.CardBody,null,d),h.createElement(o.CardActions,{layout:"end"},h.createElement(a.Button,{ref:N,fillMode:"outline",onClick:D},I.toLanguageString(ie,me[ie])),h.createElement(a.Button,{ref:T,themeColor:"primary",onClick:B},I.toLanguageString(re,me[re]))))),z=null!=g?g:St,O=null!=f?f:At,q=null!=v?v:Rt,K=h.createElement(h.Fragment,null,null!=c&&h.createElement(z,{parameters:c}),null!=u&&h.createElement(O,{result:u}),null!=m&&h.createElement(q,{errorText:m}),L?P:C);return h.createElement(kt,{ref:t,svgIcon:r,headerExtra:M,completed:F,onExpandedChange:b,className:n.classNames("k-tool-call",y),...x},K)});Dt.displayName="KendoReactToolCall",e.AIPrompt=e=>{const t=h.useRef(null);n.useWebMcpRegister("aiprompt",t,e,e.webMcp);const a=!n.validatePackage(Ke,{component:"AIPrompt"}),l=n.getLicenseMessage(Ke),{activeView:o,toolbarItems:s,children:r,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u,style:m,dir:d,className:p,streaming:g,loading:f,onCancel:v,promptPlaceholder:k,suggestionsView:b,...E}=e,y=s||[it,st],[C,x]=h.useState({activeView:o}),I={...C,activeView:o,streaming:g,loading:f,suggestionsView:null!=b?b:"classic",promptPlaceholder:k,onCancel:v,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u};return h.createElement(ct.Provider,{value:[I,e=>{x(e)}]},h.createElement("div",{className:n.classNames("k-prompt",p),style:m,dir:d,...E},h.createElement(ot,{activeView:I.activeView,toolbarItems:y,activeViewChange:i}),r,a&&h.createElement(n.WatermarkOverlay,{message:l})))},e.AIPromptCommandsView=e=>{const{commands:t}=e,[n]=ut();return h.createElement(pt,{name:rt.name},h.createElement(dt,{streaming:n.streaming,onCancel:n.onCancel},h.createElement("div",{className:"k-prompt-view"},h.createElement(o.PanelBar,{onSelect:e=>{var t,a,l;const o=null==(a=null==(t=e.target)?void 0:t.props)?void 0:a.data;null!=(l=null==o?void 0:o.children)&&l.length||n.onCommandExecute&&n.onCommandExecute.call(null,o)},selected:""},ft(null!=t?t:[])))))},e.AIPromptContent=dt,e.AIPromptFooter=mt,e.AIPromptOutputView=e=>{const[t,n]=h.useState(""),r=h.useRef(null),[i]=ut(),{outputs:c,showOutputRating:u,outputCard:m}=e,{header:d,body:p,actions:g}=m||{},f=s.useLocalization(),v=f.toLanguageString(x,me[x]),k=(e,t)=>{i.onPromptRequest&&i.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),b()},b=()=>{r&&r.current&&r.current.scrollTo({top:0,behavior:"smooth"})},E=h.createElement(o.Card,null,h.createElement(o.CardHeader,null,h.createElement(o.CardTitle,null,h.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),h.createElement(o.CardSubtitle,null,h.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),h.createElement(o.CardBody,null,h.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),h.createElement(o.CardActions,null,i.streaming&&i.onCancel?h.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",svgIcon:l.stopIcon,title:v,onClick:i.onCancel},v):h.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),y=(e,o)=>g?g(e):o&&i.onCancel?h.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",svgIcon:l.stopIcon,title:v,onClick:i.onCancel},v):h.createElement(h.Fragment,null,h.createElement(a.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:t===e.id?l.checkIcon:l.copyIcon,onClick:()=>(e=>{e.responseContent&&navigator.clipboard.writeText(e.responseContent),n(e.id),setTimeout(()=>{n("")},1e3)})(e)},"Copy"),h.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:l.arrowRotateCwIcon,onClick:()=>(e=>{i.onPromptRequest&&i.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),b()})(e)},"Retry"),u&&h.createElement(h.Fragment,null,h.createElement("span",{className:"k-spacer"}),h.createElement(a.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:l.thumbUpIcon,onClick:()=>k(e,"positive")}),h.createElement(a.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:l.thumbDownIcon,onClick:()=>k(e,"negative")}))),I=null==c?void 0:c.map((e,t)=>{const n=!(!i.streaming||i.loading||0!==t);return h.createElement(o.Card,{key:`${e.id}_${t}`},h.createElement(o.CardHeader,null,d?d(e):h.createElement(h.Fragment,null,e.title&&h.createElement(o.CardTitle,null,e.title),e.subTitle&&h.createElement(o.CardSubtitle,null,e.subTitle))),h.createElement(o.CardBody,null,p?p(e):e.responseContent),h.createElement(o.CardActions,null,y(e,n)))}),T=h.createElement(o.Card,null,h.createElement(o.CardBody,null,f.toLanguageString(C,me[C])));return h.createElement(pt,{name:st.name},h.createElement(dt,{ref:r,streaming:i.streaming,onCancel:i.onCancel},h.createElement("div",{className:"k-card-list"},i.loading&&E,I,(!I||0===I.length)&&!i.loading&&T)))},e.AIPromptView=e=>{var t;const{promptInput:o=m.TextArea,generateButton:r=a.Button,enableSpeechToText:i=!1,promptValue:c,promptSuggestions:u}=e,[d,p]=h.useState(c||""),[g]=ut(),f=s.useLocalization(),[v,k]=n.useCustomComponent(r),[b,E]=n.useCustomComponent(o),y=h.useRef(null);h.useEffect(()=>{var e,t;null!=(t=null==(e=y.current)?void 0:e.element)&&t.current&&requestAnimationFrame(()=>{var e,t;if(null!=(t=null==(e=y.current)?void 0:e.element)&&t.current){const e=y.current.element.current;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}})},[d]);const C={title:"Generate",children:"Generate",svgIcon:l.sparklesIcon},x={placeholder:null!=(t=g.promptPlaceholder)?t:f.toLanguageString(I,me[I]),rows:2},T=Object.keys(k).length>0?k:C,N=Object.keys(E).length>0?E:x,w=e=>{const{isFinal:t,alternatives:n}=e;if(t&&n.length>0){const e=n[0].transcript,t=(()=>{const t=d,n=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(n?" ":"")+e})();p(t)}};let F;return i&&(F="object"==typeof i?{...i,onResult:i.onResult||w}:{onResult:w}),h.createElement(pt,{name:it.name},h.createElement(dt,{streaming:g.streaming,onCancel:g.onCancel},h.createElement(b,{ref:y,value:d,flow:"vertical",textareaStyle:{maxHeight:"110px"},autoSize:!0,suffix:i?h.createElement(h.Fragment,null,h.createElement(m.InputSeparator,{orientation:"horizontal"}),h.createElement(m.InputSuffix,{orientation:"horizontal"},h.createElement(a.SpeechToTextButton,{fillMode:"flat",...F}))):void 0,onChange:e=>{p(e.target.value)},...N}),u&&u.length>0&&h.createElement(gt,{title:"Prompt Suggestions"},h.createElement(Me,{suggestionsView:g.suggestionsView,suggestions:u.map((e,t)=>({id:t,text:e,description:e})),onSuggestionClick:e=>{(e=>{p(e)})(e.text)}}))),h.createElement(mt,null,h.createElement(v,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:()=>{g.onPromptRequest&&g.onPromptRequest.call(null,d),p("")},disabled:!d.trim(),...T},T.children)))},e.AIPromptViewRender=pt,e.ChainOfThought=Et,e.Chat=lt,e.ChatMessage=Ee,e.Checkpoint=yt,e.Citation=Nt,e.DEFAULT_FIELD_MAPPING=Ye,e.HeroCard=e=>{const{imageUrl:t,imageMaxWidth:n,title:l,subtitle:o,actions:s,onActionExecute:r,altText:i}=e,c=h.useCallback((e,t)=>{null==r||r({action:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})},[r]),u=i||l||"";return h.createElement("div",{className:"k-card"},h.createElement("img",{className:"k-card-image",src:t,style:{maxWidth:n},alt:u}),h.createElement("div",{className:"k-card-body"},l&&h.createElement("h5",{className:"k-card-title"},l),o&&h.createElement("h6",{className:"k-card-subtitle"},o)),h.createElement("div",{className:"k-card-actions k-card-actions-vertical"},s.map((e,t)=>h.createElement("span",{className:"k-card-action",key:`action-${t}-${e.title||e.value||t}`},h.createElement(a.Button,{fillMode:"flat",onClick:t=>c(e,t)},e.title)))))},e.InlineAIPrompt=e=>{const t=!n.validatePackage(Ke,{component:"InlineAIPrompt"}),s=n.getLicenseMessage(Ke),{outputs:r=[],outputCard:i,promptInput:c=m.TextArea,generateButton:u=a.Button,promptPlaceholder:d="Ask or generate content with AI...",promptValue:p,onPromptRequest:g,onCopy:f,onDiscard:v,outputActions:k,onOutputAction:b,enableSpeechToText:E=!1,streaming:y,onPromptCancel:C,show:x=!1,anchor:I,width:T,height:N,onOpen:w,onClose:F,animate:S=!0,appendTo:A,commands:R,onCommandExecute:M,style:L,className:B,popupOptions:D={},...P}=e,[z,O]=h.useState(""),[q,K]=h.useState(!1),[H,U]=h.useState({left:0,top:0}),$=h.useRef(null),{body:V,actions:j}=i||{},W=k||[{id:"copy",text:"Copy",svgIcon:l.copyIcon,themeColor:"primary",title:"Copy"},{id:"discard",text:"Discard",svgIcon:l.cancelIcon,themeColor:"base",title:"Discard"}],G=(e,t)=>{switch(e.id){case"copy":(e=>{e.responseContent&&(navigator.clipboard.writeText(e.responseContent),O(e.id),setTimeout(()=>O(""),1e3)),null==f||f(e)})(t);break;case"discard":(e=>{null==v||v(e)})(t);break;default:null==b||b(e,t)}},_=h.useCallback(e=>{"Escape"===e.key&&(y&&C?C():!y&&F&&F({target:null}))},[y,C,F]),Y={...L,...T&&{width:T},...N&&{height:N}},J={...T&&{width:T},...N&&{height:N}},X=h.createElement(h.Fragment,null,h.createElement("div",{className:n.classNames("k-prompt",B),style:Y,onKeyDown:_,...P},h.createElement(dt,{ref:$},r&&r.length>0&&h.createElement("div",{className:"k-card-list"},r.map((e,t)=>h.createElement(o.Card,{key:`${e.id}_${t}`},h.createElement(o.CardBody,null,V?V(e):e.responseContent),h.createElement(o.CardActions,null,j?j(e):h.createElement(h.Fragment,null,W.map(t=>{var n;return t.spacer?h.createElement("span",{key:t.id,className:"k-spacer"}):h.createElement(a.Button,{key:t.id,size:"medium",themeColor:t.themeColor||"primary",fillMode:"flat",rounded:"medium",title:null!=(n=t.title)?n:t.text,svgIcon:"copy"===t.id&&z===e.id?l.checkIcon:t.svgIcon,onClick:()=>G(t,e)},t.text)})))))),h.createElement(vt,{promptValue:p,placeholder:d,onPromptRequest:g,onMenuClick:e=>{if(!$.current)return;const t=$.current.getBoundingClientRect();U({left:t.left,top:t.bottom}),K(!0)},onPromptCancel:C,promptInput:c,generateButton:u,enableSpeechToText:E,streaming:y,commands:R}))),t&&h.createElement(n.WatermarkOverlay,{message:s}));return h.createElement(h.Fragment,null,h.createElement(ht,{show:x,anchor:I,onOpen:w,onClose:F,animate:S,appendTo:A,popupOptions:D,style:J},X),h.createElement(o.ContextMenu,{show:q,offset:H,onClose:()=>{K(!1)},items:(e=>null==e?void 0:e.map(e=>({text:e.text,svgIcon:e.svgIcon,data:e,items:e.children?e.children.map(e=>({text:e.text,data:e})):void 0})))(R),onSelect:e=>{var t,n;const a=null==(t=e.item)?void 0:t.data;a&&(null==(n=a.children)||!n.length)&&(e=>{K(!1),M&&M(e)})(a)}}))},e.PromptBox=$e,e.PromptBoxActionButton=Be,e.PromptBoxSpeechToTextButton=De,e.PromptBoxUploadButton=Le,e.PromptHeader=ot,e.Reasoning=wt,e.SuggestionGroup=Me,e.ToolCall=Dt,e.commandsViewDefaults=rt,e.extractFieldMappingFromProps=e=>({textField:e.textField,statusField:e.statusField,authorIdField:e.authorIdField,authorNameField:e.authorNameField,authorImageUrlField:e.authorImageUrlField,authorImageAltTextField:e.authorImageAltTextField,idField:e.idField,timestampField:e.timestampField,filesField:e.filesField,attachmentsField:e.attachmentsField,replyToIdField:e.replyToIdField,isDeletedField:e.isDeletedField,isPinnedField:e.isPinnedField,typingField:e.typingField,suggestedActionsField:e.suggestedActionsField,isFailedField:e.isFailedField}),e.isStandardMessageFormat=Qe,e.mapDataArrayToMessages=Xe,e.mapDataToMessage=Je,e.mapMessageToCustomFormat=(e,t={})=>{const n={...Ye,...t},a={};return void 0!==e.id&&(a[n.idField]=e.id),void 0!==e.text&&(a[n.textField]=e.text),void 0!==e.status&&(a[n.statusField]=e.status),void 0!==e.isFailed&&(a[n.isFailedField]=e.isFailed),void 0!==e.timestamp&&(a[n.timestampField]=e.timestamp),void 0!==e.attachments&&(a[n.attachmentsField]=e.attachments),void 0!==e.files&&(a[n.filesField]=e.files),void 0!==e.suggestedActions&&(a[n.suggestedActionsField]=e.suggestedActions),void 0!==e.replyToId&&(a[n.replyToIdField]=e.replyToId),void 0!==e.isDeleted&&(a[n.isDeletedField]=e.isDeleted),void 0!==e.isPinned&&(a[n.isPinnedField]=e.isPinned),void 0!==e.typing&&(a[n.typingField]=e.typing),e.author&&(void 0!==e.author.id&&(a[n.authorIdField]=e.author.id),void 0!==e.author.name&&(a[n.authorNameField]=e.author.name),void 0!==e.author.avatarUrl&&(a[n.authorImageUrlField]=e.author.avatarUrl),void 0!==e.author.avatarAltText&&(a[n.authorImageAltTextField]=e.author.avatarAltText)),void 0!==e.pinnedAt&&(a.pinnedAt=e.pinnedAt),void 0!==e.pinnedBy&&(a.pinnedBy=e.pinnedBy),void 0!==e.attachmentLayout&&(a.attachmentLayout=e.attachmentLayout),a},e.outputViewDefaults=st,e.promptViewDefaults=it});
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-animation"),require("@progress/kendo-react-notification"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-popup"),require("@progress/kendo-react-indicators"),require("@progress/kendo-react-tooltip")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-layout","@progress/kendo-react-intl","prop-types","@progress/kendo-react-upload","@progress/kendo-react-animation","@progress/kendo-react-notification","@progress/kendo-react-inputs","@progress/kendo-react-popup","@progress/kendo-react-indicators","@progress/kendo-react-tooltip"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactLayout,e.KendoReactIntl,e.PropTypes,e.KendoReactUpload,e.KendoReactAnimation,e.KendoReactNotification,e.KendoReactInputs,e.KendoReactPopup,e.KendoReactIndicators,e.KendoReactTooltip)}(this,function(e,t,n,a,l,o,s,r,i,c,u,m,d,p,g){"use strict";function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var h=f(t);const v="newMessage.sendButton",k="newMessage.optionsButton",b="newMessage.messageInput",E="avatar.alt",y="messageList.ariaLabel",C="aIPrompt.noOutputs",x="aIPrompt.cancel",I="aIPrompt.inputPlaceholder",T="chat.senderDeletedMessage",N="chat.receiverDeletedMessage",w="chat.copyNotification",F="chat.downloadAllFiles",S="chat.closeReply",R="chat.collapseMessage",A="chat.expandMessage",M="chat.removeFile",L="chat.fileActions",B="chat.attachFile",D="chat.downloadAll",P="chat.scrollLeft",z="chat.scrollRight",O="chat.scrollToBottom",q="chat.messageFailed",K="chat.retryMessage",H="chat.stopGenerating",U="promptBox.input",$="promptBox.sendButton",V="promptBox.sendButtonText",j="promptBox.attachFile",W="promptBox.removeFile",G="promptBox.stopGenerating",_="promptBox.ariaLabel",Y="promptBox.attachedFiles",J="chat.messageToolbar",X="chat.unpinMessage",Q="chat.messageAttachedFiles",Z="toolCall.state.active",ee="toolCall.state.completed",te="toolCall.state.awaitingApproval",ne="toolCall.state.error",ae="checkpoint.startOver",le="checkpoint.restore",oe="checkpoint.restored",se="checkpoint.redo",re="toolCall.approve",ie="toolCall.reject",ce="citation.previous",ue="citation.next",me={[v]:"Send",[k]:"Options",[b]:"Message",[E]:"Avatar",[y]:"Message list",[x]:"Cancel",[C]:"No output from AI available",[I]:"Ask or generate content with AI ...",[T]:"You removed this message",[N]:"The message was removed by its sender",[w]:"Text copied to clipboard",[F]:"Download all files",[S]:"Close reply",[R]:"Collapse message",[A]:"Expand message",[M]:"Remove file",[L]:"File actions for",[q]:"Failed to send",[K]:"Retry",[H]:"Stop generating",[B]:"Attach file",[D]:"Download all",[P]:"Scroll left",[z]:"Scroll right",[O]:"Scroll to bottom",[U]:"Prompt",[$]:"Send",[V]:"",[j]:"Attach file",[W]:"Remove file",[G]:"Stop generating",[_]:"Prompt box",[Y]:"Attached files",[J]:"Toolbar",[X]:"Unpin message",[Q]:"Attached files",[Z]:"Active",[ee]:"Completed",[te]:"Awaiting Approval",[ne]:"Error",[ae]:"Start Over",[le]:"Restore Checkpoint",[oe]:"Checkpoint Restored",[se]:"Redo",[re]:"Approve",[ie]:"Reject",[ce]:"Previous",[ue]:"Next"},de=(e,t)=>e&&t.author&&e.id===t.author.id,pe=(e,t)=>{const n=t.toLanguageString("chatSender.deletedMessage",me[T]),a=t.toLanguageString("chatReceiver.deletedMessage",me[N]);return e?n:a},ge=(e,t)=>e.find(e=>e.id===t),fe=/(https?:\/\/[^\s]+)/g,he=e=>{if(!e)return[""];const t=e.split(fe),n=[];return t.forEach(e=>{e&&fe.test(e)?(fe.lastIndex=0,n.push(h.createElement("a",{key:e,href:e,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"}},e))):e&&n.push(e)}),n},ve=h.createContext(void 0),ke=()=>{const e=t.useContext(ve);if(void 0===e)throw new Error("useChatContext must be used within a ChatContext.Provider");return e},be=e=>{const{files:t,onFileAction:o,onDownload:r,fileActions:i}=e,{messageFilesLayout:c="vertical"}=ke(),u=s.useLocalization(),m=i||[{id:"download",label:"Download",svgIcon:l.downloadIcon}],d=e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`},p=e=>"."+e.split(".").pop()||"",g=e=>m.length>0&&h.createElement(a.DropDownButton,{fillMode:"flat",size:"xs",svgIcon:l.moreVerticalIcon,onClick:e=>{e.syntheticEvent.stopPropagation()},onItemClick:t=>((e,t)=>{var n,a;null==(a=null==(n=e.syntheticEvent)?void 0:n.stopPropagation)||a.call(n),"download"===e.item.id&&(null==r||r([t])),null==o||o(e.item,e,t)})(t,e),items:m.map(e=>({id:e.id,icon:e.icon,text:e.label,svgIcon:e.svgIcon})),"aria-label":`${u.toLanguageString(L,me[L])} ${e.name}`,title:`${u.toLanguageString(L,me[L])} ${e.name}`}),f=h.useCallback(()=>n.classNames({"k-files-wrap":"wrap"===c,"k-files-vertical":"vertical"===c},"k-file-box-wrapper"),[c]);return h.createElement("ul",{role:"list","aria-label":u.toLanguageString(Q,me[Q]),className:f()},"horizontal"===c?h.createElement("div",{className:"k-files-scroll",role:"presentation"},t.map(e=>h.createElement("li",{key:e.name,className:"k-file-box",role:"listitem","aria-label":[e.name,d(e.size)].filter(Boolean).join(" ")||void 0},h.createElement(n.IconWrap,{size:"xlarge",...n.getFileExtensionIcon(p(e.name))}),h.createElement("div",{className:"k-file-info"},h.createElement("span",{className:"k-file-name"},e.name),h.createElement("span",{className:"k-file-size"},d(e.size))),g(e)))):t.map(e=>h.createElement("li",{key:e.name,className:"k-file-box",role:"listitem","aria-label":[e.name,d(e.size)].filter(Boolean).join(" ")||void 0},h.createElement(n.IconWrap,{size:"xlarge",...n.getFileExtensionIcon(p(e.name))}),h.createElement("div",{className:"k-file-info"},h.createElement("span",{className:"k-file-name"},e.name),h.createElement("span",{className:"k-file-size"},d(e.size))),g(e))))},Ee=h.forwardRef((e,t)=>{const{item:r,template:i,contentTemplate:c,onRequestSelection:u,tabIndex:m=-1,dateFormat:d="g",selected:p,allowMessageCollapse:g,messageToolbarActions:f,messageContextMenuActions:v,fileActions:k,isSender:b}=e,{setReplyToMessage:E,messages:y,repliedToMessages:C,user:x,onToolbarAction:I,onContextMenuAction:T,onFileAction:N,onDownload:w,onResendMessage:S,setShowCopyNotification:M,statusTemplate:L,timestampVisibility:B="onFocus",onReferencedMessageClick:P}=ke(),[z,O]=h.useState(!1),[H,U]=h.useState(!1),[$,V]=h.useState(!0),[j,W]=h.useState(!1),G=s.useLocalization(),_=s.useInternationalization(),Y=h.useRef({left:0,top:0}),X=h.useCallback(()=>{null!=r&&r.text&&(e=>{navigator.clipboard.writeText(e)})(r.text),M&&(M(!0),setTimeout(()=>{M(!1)},3e3))},[r,M]),Q=h.useCallback(e=>{e.stopPropagation(),V(e=>!e)},[]),Z=h.useCallback(()=>{W(!1)},[]),ee=h.useCallback(e=>{("Tab"===e.key||"Enter"===e.key||" "===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)&&W(!0)},[]),te=h.useRef(null);h.useEffect(()=>{p&&te.current&&te.current.focus()},[p]);const ne=h.useCallback(e=>{Y.current={left:e.pageX,top:e.pageY},e.preventDefault(),U(!0),O(!0)},[]),ae=h.useCallback(()=>{U(!1),O(!1)},[]),le=h.useCallback((e,t)=>e.isDeleted?pe(t,G):e.text?e.text:"",[G]),oe=h.useCallback(e=>{var t;null!=(t=e.item)&&t.text&&("copy"!==e.item.data.id||r.isDeleted?"reply"===e.item.data.id&&E(r):X(),T&&T(e.item.data,e,r)),U(!1),O(!1)},[r,T,E,X]),se=h.useCallback(()=>{if(r.replyToId){const e=ge(y,r.replyToId)||(C?ge(C,r.replyToId):void 0);if(e){const t=t=>{t.preventDefault(),t.stopPropagation(),null==P||P(e.id)};return h.createElement("div",{className:n.classNames("k-message-reference",de(x,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:t},h.createElement("div",{className:"k-message-reference-content"},he(le(e,de(x,e)))))}}return null},[r.replyToId,y,C,x,le,P]),re=h.useCallback(()=>{const e=[{id:"reply",label:"Reply",svgIcon:l.undoIcon},{id:"copy",label:"Copy",svgIcon:l.copyIcon}],t=v?[...e.map(e=>v.find(t=>t.id===e.id)||e),...v.filter(t=>!e.some(e=>e.id===t.id))]:e;return h.createElement(o.ContextMenu,{onSelect:oe,onClose:ae,vertical:!0,show:z,offset:Y.current},t.map(e=>"delete"!==e.id||b?h.createElement(o.MenuItem,{key:e.id,text:e.label,icon:e.icon,svgIcon:e.svgIcon,data:e}):null))},[v,oe,ae,z,b]),ie=h.useCallback(()=>r.files&&r.files.length>1?h.createElement("div",{className:"k-chat-download-button-wrapper"},h.createElement(a.Button,{className:"k-chat-download-button",fillMode:"flat",svgIcon:l.downloadIcon,size:"small",onClick:e=>{e.stopPropagation(),w&&w(r.files,r)},"aria-label":G.toLanguageString(F,me[F])},h.createElement("span",{className:"k-button-text"},G.toLanguageString(D,me[D])))):null,[r,w,G]),ce=h.useCallback(()=>{if(r.typing)return h.createElement("div",{className:"k-chat-bubble k-bubble"},h.createElement("div",{className:"k-bubble-content"},h.createElement("div",{className:"k-typing-indicator"},h.createElement("span",null),h.createElement("span",null),h.createElement("span",null))));if(i){const e=i;return h.createElement(h.Fragment,null,h.createElement(e,{item:r}),re())}return r.text||r.files&&r.files.length>0?h.createElement(h.Fragment,null,h.createElement("div",{className:n.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":g,"k-expanded":g&&$,"k-selected":p,"k-active":H}),onClick:()=>u(p?void 0:r.selectionIndex),onContextMenu:ne},h.createElement("div",{className:"k-bubble-content"},c?h.createElement(c,{item:r}):h.createElement(h.Fragment,null,(r.text||r.isDeleted||r.replyToId)&&h.createElement("span",{className:"k-chat-bubble-text"},!r.isDeleted&&se(),he(le(r,de(x,r)))),r.files&&r.files.length>0&&h.createElement(be,{files:r.files,message:r,onFileAction:N,onDownload:e=>null==w?void 0:w(e,r),renderInTextarea:!1,fileActions:k}),ie())),g&&h.createElement("span",{className:"k-bubble-expandable-indicator",onClick:Q,role:"button","aria-label":$?G.toLanguageString(R,me[R]):G.toLanguageString(A,me[A]),tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),Q(e))}},h.createElement(n.IconWrap,{icon:$?l.chevronUpIcon:l.chevronDownIcon}))),re()):null},[r,i,c,g,$,p,H,u,ne,se,le,x,N,k,ie,Q,G,re,w]),ue=h.useCallback(()=>{let e=null;return r.timestamp&&("hidden"===B||(e=h.createElement("time",{className:"k-message-time"},_.formatDate(r.timestamp,d)))),e},[r.timestamp,d,B,_]),fe=h.useCallback(()=>{if(!r.status)return null;let e;if(L)e=h.createElement(L,{item:r});else{let t,a,l;if("object"==typeof r.status&&null!==r.status){const e=r.status;t=e.text,a=e.icon,l=e.svgIcon}else t=r.status;let o=null;a?o=h.createElement(n.Icon,{name:a,size:"xsmall"}):l&&(o=h.createElement(n.IconWrap,{icon:l,size:"xsmall"})),e=h.createElement(h.Fragment,null,o,t)}return h.createElement("span",{className:"k-message-status"},e)},[r,L]),ve=h.useCallback(()=>{let e=null;if(r.isFailed){const t=G.toLanguageString(q,me[q]);e=h.createElement("span",{className:"k-message-failed-content"},h.createElement(n.IconWrap,{icon:l.warningTriangleIcon,size:"xsmall"}),h.createElement("span",{className:"k-message-failed-text"},t))}return e},[r,G]),Ee=h.useCallback(()=>{let e=null;if(r.isFailed){const t=G.toLanguageString(K,me[K]);e=h.createElement(a.Button,{fillMode:"clear",size:"xs",className:"k-resend-button",svgIcon:l.arrowRotateCwIcon,"aria-label":t,title:t,onClick:e=>{e.stopPropagation(),S&&S({message:r,syntheticEvent:e,nativeEvent:e.nativeEvent,target:e.target})}})}return e},[r,G,S]),ye=h.useCallback(()=>n.classNames({"k-focus":p,"k-message-removed":r.isDeleted,"k-message-failed":r.isFailed},"k-message"),[p,r.isDeleted,r.isFailed]),Ce=h.useCallback(()=>f&&f.length>0&&h.createElement(a.Toolbar,{className:"k-chat-message-toolbar",fillMode:"flat",ariaLabel:G.toLanguageString(J,me[J])},f.map(e=>"delete"!==e.id||b?h.createElement(a.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",icon:e.icon,svgIcon:e.svgIcon,"aria-label":e.label,onClick:t=>{t.stopPropagation(),"copy"!==e.id||r.isDeleted?"reply"===e.id&&E(r):X(),I&&I(e,t,r)},onMouseDown:e=>e.preventDefault()}):null)),[X,b,r,G,f,I,E]);return h.createElement("div",{key:r.id,"data-message-id":r.id,className:ye(),tabIndex:m,onMouseDown:Z,onKeyDown:ee,onFocus:e=>{j&&u(r.selectionIndex)},ref:e=>{te.current=e,"function"==typeof t?t(e):t&&(t.current=e)},onContextMenu:i?ne:void 0},Ee(),ce(),(r.status||r.timestamp&&"hidden"!==B||r.isFailed)&&h.createElement("div",{className:"k-message-info"},fe(),ue(),ve()),Ce())});Ee.displayName="ChatMessage";const ye=e=>e[e.length-1],Ce=e=>(t,n,a)=>{const l=a===e-1;return((e,t)=>{const n=t.timestamp,a=ye(e);if(n&&(!a||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(n,a.timestamp))){const t={type:"date-marker",timestamp:n,trackBy:n.getTime()};e.push(t)}})(t,n),((e,t,n)=>{const a=ye(e);let l;t.typing&&!n||(a&&"message-group"===a.type&&(l=a.messages),l&&de(t.author,ye(l))?l.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,n,l),n.attachments&&n.attachments.length>1&&t.push({type:"attachment-group",attachments:n.attachments,attachmentLayout:n.attachmentLayout,timestamp:n.timestamp,trackBy:n}),n.suggestedActions&&l&&t.push({type:"action-group",actions:n.suggestedActions,timestamp:n.timestamp,trackBy:n}),t};const xe=e=>{const{item:t,onActionExecute:a,selected:l}=e,o=h.useRef(null);h.useEffect(()=>{l&&o.current&&o.current.focus()},[l]);const s=h.useCallback(e=>{(e.keyCode===n.Keys.enter||" "===e.key)&&(e.preventDefault(),a(t,e))},[a,t]),r=h.useCallback(()=>n.classNames("k-suggestion k-suggestion-primary",{"k-selected":l},{"k-focus":l}),[l]);return h.createElement("span",{role:"button",className:r(),onClick:e=>a(t,e),ref:o,onKeyDown:s,tabIndex:0,"aria-label":t.title||t.value},t.title||t.value)},Ie=({visible:e,dir:t,canScrollLeft:n,canScrollRight:o,onScrollLeft:r,onScrollRight:i,children:c})=>{const u=s.useLocalization();if(!e)return c;const m=u.toLanguageString(P,me[P]),d=u.toLanguageString(z,me[z]),p="rtl"!==t?m:d,g="rtl"!==t?d:m;return h.createElement("div",{className:"k-suggestion-scrollwrap"},h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:"rtl"===t?l.chevronRightIcon:l.chevronLeftIcon,onClick:r,disabled:!n,"aria-label":p,title:p}),c,h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:"rtl"===t?l.chevronLeftIcon:l.chevronRightIcon,onClick:i,disabled:!o,"aria-label":g,title:g}))},Te=100,Ne=(e,t)=>{const{enabled:n,dir:a,mode:l,itemsDependency:o=[],scrollSpeed:s=Te}=t,[r,i]=h.useState(!1),[c,u]=h.useState(!1),m=h.useCallback(()=>{if(e.current&&n){const{scrollLeft:t,scrollWidth:n,clientWidth:l}=e.current,o="rtl"!==a?t+l>=n-1:l-t>=n-1;i(!(0===t)),u(!o)}},[n,a]),d=h.useCallback(()=>{e.current&&n&&e.current.scrollBy({left:"rtl"!==a?-s:s,behavior:"smooth"})},[n,a,s]),p=h.useCallback(()=>{e.current&&n&&e.current.scrollBy({left:"rtl"!==a?s:-s,behavior:"smooth"})},[n,a,s]);return h.useEffect(()=>{const t=e.current;if(!t||!n)return;m();const a=()=>m();t.addEventListener("scroll",a,{passive:!0});const l=new ResizeObserver(m);return l.observe(t),()=>{t.removeEventListener("scroll",a),l.disconnect()}},[n,m,o.length,l]),h.useLayoutEffect(()=>{n&&m()},[n,a,o]),{canScrollLeft:r,canScrollRight:c,scrollLeft:d,scrollRight:p}},we=e=>{var t,a;const{group:l,onActionExecute:o,selected:s,onRequestSelection:r,quickActionsLayout:i="scroll",dir:c}=e,[u,m]=h.useState(null),d=h.useRef(null),{canScrollLeft:p,canScrollRight:g,scrollLeft:f,scrollRight:v}=Ne(d,{enabled:"scrollbuttons"===i||"scroll"===i,dir:c,mode:i,itemsDependency:l.actions});h.useEffect(()=>{s||null===u?s&&null===u&&m(0):m(null)},[s,u]);const k=h.useCallback(()=>l.actions?l.actions.length-1:-1,[l.actions]),b=h.useCallback((e,t=0)=>{let n=null;return e?null===u?n=t:u<k()&&(n=u+1):null===u?n=0:u>0&&(n=u-1),null!==n&&m(n),n},[u,k]),E=h.useCallback(()=>{r(l.selectionIndex)},[r,l.selectionIndex]),y=h.useCallback(e=>{let t=null;const a=n.Keys.left,l=n.Keys.right;e.keyCode===a?t=b(!1):e.keyCode===l&&(t=b(!0)),null!==t&&(e.preventDefault(),e.stopPropagation())},[b]),C=h.useCallback(()=>n.classNames("k-suggestion-group",{"k-suggestion-group-scrollable":"scroll"===i,"k-suggestion-group-scrollable-start":g&&("scroll"===i||"scrollbuttons"===i),"k-suggestion-group-scrollable-end":p&&("scroll"===i||"scrollbuttons"===i)}),[i,g,p]),x="scroll"===i||"scrollbuttons"===i,I=h.createElement("div",{className:C(),onClick:E,onKeyDown:y,role:"toolbar",tabIndex:0,"aria-label":"Action group"},x?h.createElement("div",{className:"k-suggestions-scroll",ref:d},null==(t=l.actions)?void 0:t.map((e,t)=>h.createElement(xe,{item:e,onActionExecute:o,selected:t===u,key:e.value}))):null==(a=l.actions)?void 0:a.map((e,t)=>h.createElement(xe,{item:e,onActionExecute:o,selected:t===u,key:e.value})));return h.createElement(Ie,{visible:"scrollbuttons"===i,dir:c,canScrollLeft:p,canScrollRight:g,onScrollLeft:f,onScrollRight:v},I)},Fe=e=>{const{item:t,template:a,tabbable:l,onClick:o,selected:s}=e,r=h.useRef(null);h.useEffect(()=>{s&&r.current&&r.current.focus()},[s]);const i=h.useCallback(()=>{if(void 0!==l)return l?0:-1},[l]),c=h.useCallback(()=>n.classNames({"k-selected":s},{"k-focus":s}),[s]),u=h.useCallback(()=>t.title?h.createElement("h5",{className:"k-card-title"},t.title):null,[t.title]),m=h.useCallback(()=>t.subtitle?h.createElement("h6",{className:"k-card-subtitle"},t.subtitle):null,[t.subtitle]),d=h.useCallback(()=>0===t.contentType.indexOf("image/")?h.createElement("img",{src:t.content,alt:t.title||"Attachment",style:{maxHeight:"200px",height:"auto",maxWidth:"200px",width:"auto"}}):t.content,[t.contentType,t.content,t.title]),p=a;return h.createElement("div",{className:c(),tabIndex:i(),onClick:o,ref:r},a?h.createElement(p,{item:t}):h.createElement("div",{className:"k-card"},h.createElement("div",{className:"k-card-body"},u(),m(),d())))},Se=e=>{const{group:t,itemTemplate:o,selected:s,isLastGroup:r,onRequestSelection:i,dir:c}=e,[u,m]=h.useState(null),d=h.useRef(null);h.useEffect(()=>{s||null===u?s&&null===u&&m(0):m(null)},[s,u]);const p=h.useCallback(e=>"list"!==e.attachmentLayout,[]),{canScrollLeft:g,canScrollRight:f,scrollLeft:v,scrollRight:k}=Ne(d,{enabled:p(t),dir:c,itemsDependency:t.attachments}),b=h.useCallback(()=>t.attachments?t.attachments.length-1:-1,[t.attachments]),E=h.useCallback((e,t=0)=>{let n=null;return e?null===u?n=t:u<b()&&(n=u+1):null===u?n=0:u>0&&(n=u-1),null!==n&&m(n),n},[u,b]),y=h.useCallback(()=>{i(t.selectionIndex)},[i,t.selectionIndex]),C=h.useCallback(e=>{let a,l,o=null;p(t)?(a=n.Keys.left,l=n.Keys.right):(a=n.Keys.up,l=n.Keys.down),e.keyCode===a?o=E(!1):e.keyCode===l&&(o=E(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())},[E,p,t]),x=h.useCallback(e=>{y(),m(e)},[y]),I=h.useCallback(()=>{let e=null;return p(t)&&g&&(e=h.createElement(a.Button,{icon:"chevron-left",tabIndex:-1,onClick:v,svgIcon:l.chevronLeftIcon})),e},[p,t,g,v]),T=h.useCallback(()=>{let e=null;return p(t)&&f&&(e=h.createElement(a.Button,{icon:"chevron-right",tabIndex:-1,onClick:k,svgIcon:l.chevronRightIcon})),e},[p,t,f,k]),N=h.useCallback(()=>n.classNames({"k-card-list":t.attachmentLayout,"k-card-deck":p(t)}),[t.attachmentLayout,t,p]),w=p(t),F=h.createElement("div",{ref:d,className:N(),onKeyDown:w?void 0:C},t.attachments.map((e,t)=>h.createElement(Fe,{item:e,template:o,selected:t===u,tabbable:r&&t===u,onClick:()=>x(t),key:e.content})));return w?h.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:C},I(),F,T()):F},Re=({item:e,timestampTemplate:t})=>{const n=s.useInternationalization(),a=t;return h.createElement("div",{className:"k-timestamp"},a?h.createElement(a,{item:e}):n.formatDate(e.timestamp,"D"))},Ae=e=>{const{group:t,user:a,itemTemplate:l,contentTemplate:r,attachmentTemplate:i,onRequestSelection:c,selectedItemIndex:u,isLastGroup:m,message:d,allowMessageCollapse:p,messageToolbarActions:g,messageContextMenuActions:f,fileActions:v,messageWidthMode:k="standard",showAvatar:b=!0,showUsername:y=!0}=e,{userStatusTemplate:C}=ke(),x=s.useLocalization(),I=t.messages.length>0&&de(a,t.messages[0]),{avatarUrl:T,avatarAltText:N,name:w}=t.author,F=h.useMemo(()=>n.classNames("k-message-group",{"k-message-group-sender":I,"k-message-group-receiver":!I,"k-message-group-full-width":"full"===k,"k-no-avatar":!b||!T}),[I,k,b,T]),S=h.useMemo(()=>{const e=t.messages.length-1;return t.messages.map((t,n)=>{const o=[h.createElement(d,{item:t,template:l,contentTemplate:r,selected:t.selectionIndex===u,onRequestSelection:c,tabIndex:n===e&&m?0:-1,key:t.id,allowMessageCollapse:p,messageToolbarActions:g,messageContextMenuActions:f,fileActions:v,isSender:de(a,t)})];return t.attachments&&1===t.attachments.length&&o.push(h.createElement(Fe,{item:t.attachments[0],template:i,selected:!1,key:`att-${t.attachments[0].content}`})),o})},[t.messages,d,l,r,u,c,m,p,g,f,v,a,i]),R=void 0!==N?N:x.toLanguageString(E,me[E]);return h.createElement("div",{className:F},(()=>{if(!b||!T)return;const e=h.createElement(o.Avatar,{type:"image"},h.createElement("img",{src:T,alt:R}));if(C){const n=t.messages[t.messages.length-1];return h.createElement("div",{className:"k-chat-user-status-wrapper"},e,h.createElement("div",{className:"k-chat-user-status"},h.createElement(C,{message:"dataItem"in n?n.dataItem:n})))}return e})(),h.createElement("div",{className:"k-message-group-content"},y&&h.createElement("span",{className:"k-message-author"},w),S))},Me=e=>{const{suggestions:t,onSuggestionClick:a,suggestionsView:l,suggestionTemplate:o,suggestionsLayout:s,dir:r}=e,i=h.useRef(null),{canScrollLeft:c,canScrollRight:u,scrollLeft:m,scrollRight:d}=Ne(i,{enabled:"scrollbuttons"===s||"scroll"===s,dir:r,mode:s,itemsDependency:t}),p=h.useCallback((e,t)=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==a||a(t))},[a]),g=h.useCallback(()=>t.map(e=>o?h.createElement(o,{key:e.id,suggestion:e,onClick:()=>{null==a||a(e)}}):h.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:()=>!e.disabled&&(null==a?void 0:a(e)),onKeyDown:t=>!e.disabled&&p(t,e),key:e.id,title:e.description,className:n.classNames("classic"===l?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)),[t,o,a,l,p]);if(!t||0===t.length)return null;if("classic"===l)return g();const f="scroll"===s||"scrollbuttons"===s,v=h.createElement("div",{role:"group",className:n.classNames("k-suggestion-group",{"k-suggestion-group-scrollable":"scroll"===s,"k-suggestion-group-scrollable-start":u&&("scroll"===s||"scrollbuttons"===s),"k-suggestion-group-scrollable-end":c&&("scroll"===s||"scrollbuttons"===s)})},f?h.createElement("div",{className:"k-suggestions-scroll",ref:i},g()):g());return h.createElement(Ie,{visible:"scrollbuttons"===s,dir:r,canScrollLeft:c,canScrollRight:u,onScrollLeft:m,onScrollRight:d},v)},Le=h.forwardRef(({onFilesAdd:e,files:t=[],restrictions:n,multiple:l=!0,accept:o,uploadRef:s,onSelectAttachments:r,onRemoveAttachment:c,_registerRemoveCallback:u,...m},d)=>{h.useEffect(()=>(u&&c&&u(c),()=>{u&&c&&u(void 0)}),[c,u]);const p=h.useCallback(t=>{e&&e(t),r&&r({selectedFiles:t.affectedFiles,allFiles:t.newState})},[e,r]);return h.createElement(h.Fragment,null,h.createElement(a.Button,{ref:d,...m}),h.createElement(i.Upload,{ref:s,files:t,onAdd:p,autoUpload:!1,restrictions:n,multiple:l,accept:o,className:"k-hidden"}))});Le.displayName="PromptBoxUploadButton";const Be=h.forwardRef((e,t)=>{const{text:n,children:l,...o}=e,s=void 0!==n?n:l,r=""===s||null===s||"boolean"==typeof s?void 0:s;return h.createElement(a.Button,{ref:t,...o},r)});Be.displayName="PromptBoxActionButton";const De=h.forwardRef((e,t)=>h.createElement(a.SpeechToTextButton,{ref:t,...e}));De.displayName="PromptBoxSpeechToTextButton";const Pe=e=>"."+e.split(".").pop()||"",ze=e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`},Oe=({files:e,onRemoveFile:t,header:o})=>{const r=s.useLocalization(),i=h.useRef(null),[c,u]=h.useState(!1),[m,d]=h.useState(!1),p=h.useCallback(()=>{const e=i.current;if(!e)return;const{scrollLeft:t,scrollWidth:n,clientWidth:a}=e,l=t+a>=n-1;d(!(0===t)),u(!l)},[]);if(h.useLayoutEffect(()=>{p()},[e,p]),h.useEffect(()=>{const e=i.current;if(!e)return;const t=()=>p(),n=new ResizeObserver(p);return n.observe(e),e.addEventListener("scroll",t,{passive:!0}),()=>{e.removeEventListener("scroll",t),n.disconnect()}},[p,e.length]),0===e.length&&!o)return null;const g=(e=>e?"function"==typeof e?e():e:null)(o),f=e.length>0&&h.createElement("ul",{role:"list","aria-label":r.toLanguageString(Y,me[Y]),className:n.classNames("k-file-box-wrapper",{"k-file-box-wrapper-scrollable-start":c,"k-file-box-wrapper-scrollable-end":m})},h.createElement("div",{className:"k-files-scroll",role:"presentation",ref:i},e.map((e,o)=>h.createElement("li",{key:e.name,className:"k-file-box",role:"listitem",tabIndex:0===o?0:-1,"aria-label":[e.name,ze(e.size)].filter(Boolean).join(" ")||void 0},h.createElement(n.IconWrap,{size:"xlarge",...n.getFileExtensionIcon(Pe(e.name))}),h.createElement("div",{className:"k-file-info"},h.createElement("span",{className:"k-file-name"},e.name),h.createElement("span",{className:"k-file-size"},ze(e.size))),h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:l.xCircleIcon,onClick:n=>{n.stopPropagation(),t(e.name)},"aria-label":`${r.toLanguageString(W,me[W])} ${e.name}`,title:`${r.toLanguageString(W,me[W])} ${e.name}`})))));return h.createElement("div",{className:"k-prompt-box-header"},g,f)},qe=(e,t,n,a)=>{var l;const{text:o,"aria-label":s}=null!=e?e:{text:void 0,"aria-label":void 0},r=t||null!=o?o:a.toLanguageString(V,me[V]),i=""!==r?r:void 0;return{text:i,"aria-label":null!=(l=null!=s?s:t?void 0:i)?l:n}},Ke=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"16.3.0-develop.22",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"}),He="k-prompt-box",Ue={mode:"auto",rows:1,defaultValue:"",disabled:!1,readOnly:!1,loading:!1,uploadButtonConfig:!1,speechToTextButtonConfig:!0,actionButtonConfig:!0},$e=h.forwardRef((e,t)=>{const a=!n.validatePackage(Ke,{component:"PromptBox"}),o=n.getLicenseMessage(Ke),r=s.useLocalization(),i={...Ue,...e},{mode:c=Ue.mode,fillMode:u,rows:m=Ue.rows,maxTextAreaHeight:d,value:p,defaultValue:g=Ue.defaultValue,disabled:f=Ue.disabled,readOnly:v=Ue.readOnly,placeholder:k,title:b,maxLength:E,inputAttributes:y,topAffix:C,startAffix:x,endAffix:I,header:T,onChange:N,onFocus:w,onBlur:F,onPromptAction:S,attachments:R,loading:A=Ue.loading,uploadButtonConfig:M=Ue.uploadButtonConfig,speechToTextButtonConfig:L=Ue.speechToTextButtonConfig,actionButtonConfig:B=Ue.actionButtonConfig,className:D,style:P,...z}=i,O=h.useRef(null),[q,K]=h.useState(g),[H,V]=h.useState([]),[W,_]=h.useState(!1),Y=h.useRef(null),J=h.useRef(null),X=h.useRef(0),Q=h.useRef(0),Z=h.useRef(!1),ee=h.useRef(0),te=h.useRef(0),ne=h.useCallback((e,t)=>e?"function"==typeof e?e(t):e:null,[]),ae=void 0!==p,le=ae?p:q,oe=void 0!==R,se=oe?R:H,re=h.useMemo(()=>!!(null!=le&&le.trim()||se.length>0),[le,se.length]),ie=h.useCallback(()=>{if(!O.current||"single"===c)return;const e=O.current,t=globalThis.getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||20,a=Number.parseFloat(t.paddingTop)||0,l=Number.parseFloat(t.paddingBottom)||0;X.current=e.offsetHeight||n+a+l,Q.current=n*m+a+l,"auto"===c&&!W&&(te.current=e.offsetWidth)},[c,m,W]),ce=h.useCallback(()=>"auto"===c?1:m,[c,m]),ue=h.useCallback(e=>{if(d){const t=Number.parseInt(d,10);if(e>t)return t}return Math.max(Q.current,e)},[d]),de=h.useCallback(e=>{e.style.overflow="hidden",e.style.height=`${X.current}px`;const t=e.scrollHeight,n=ue(t);e.style.height=`${n}px`,d&&t>Number.parseInt(d,10)&&(e.style.overflow="")},[ue,d]),pe=h.useCallback(e=>{e.style.overflow="hidden",e.style.height=`${X.current}px`;const t=e.scrollHeight,n=d?Math.min(t,Number.parseInt(d,10)):t;e.style.height=`${n}px`,d&&t>Number.parseInt(d,10)&&(e.style.overflow="")},[d]),ge=h.useCallback(e=>{if(te.current<=0)return!1;const t=e.style.height,n=e.style.width;e.style.overflow="hidden",e.style.width=`${te.current}px`,e.style.height=`${X.current}px`;const a=e.scrollWidth<=te.current&&e.scrollHeight<=X.current;return e.style.overflow="",e.style.width=n||"",e.style.height=t||"",a},[]),fe=h.useCallback((e,t)=>{if(!Z.current){if((e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&!W)return Z.current=!0,void _(!0);if(W){pe(e);t<ee.current&&ge(e)&&(e.style.height="",Z.current=!0,_(!1))}}},[W,pe,ge]),he=h.useCallback(()=>{var e;if("single"===c||!O.current)return;const t=O.current,n=(null==(e=t.value)?void 0:e.length)||0;"multi"===c?de(t):"auto"===c&&fe(t,n)},[c,de,fe]);h.useEffect(()=>{"single"!==c&&O.current&&ie()},[c,ie]),h.useEffect(()=>{"single"!==c&&O.current&&(ie(),he())},[m,c,ie,he]),h.useEffect(()=>{if("single"!==c&&O.current){const e=(null==le?void 0:le.length)||0;requestAnimationFrame(()=>{if(O.current){const t=O.current;"multi"===c?de(t):"auto"===c&&fe(t,e),ee.current=e}})}},[le,c,de,fe]),h.useEffect(()=>{"auto"===c&&W&&O.current&&requestAnimationFrame(()=>{if(O.current){const e=O.current;pe(e),Z.current=!1}})},[W,c,pe]),h.useEffect(()=>{if("auto"===c&&O.current){const e=O.current;W||(e.style.height="",e.style.overflow="",Z.current=!1)}},[c,W]),h.useEffect(()=>{if("single"===c||!O.current)return;const e=O.current;let t;const n=new ResizeObserver(()=>{clearTimeout(t),t=setTimeout(()=>{O.current&&("auto"===c&&!W&&ie(),he())},50)});return n.observe(e),()=>{n.disconnect(),clearTimeout(t)}},[c,W,ie,he]);const ve=h.useCallback(()=>({focus:()=>{var e;return null==(e=O.current)?void 0:e.focus()},blur:()=>{var e;return null==(e=O.current)?void 0:e.blur()},element:O.current,get value(){return le}}),[le]);h.useImperativeHandle(t,ve);const ke=h.useCallback(e=>{const t=e.target.value;!ae&&!f&&K(t),N&&!f&&n.dispatchEvent(N,e,{...ve(),value:t},{value:t}),"single"!==c&&he()},[K,N,f,ae,ve,c,he]),be=h.useCallback(e=>{w&&!f&&n.dispatchEvent(w,e,ve(),void 0)},[w,f,ve]),Ee=h.useCallback(e=>{F&&!f&&n.dispatchEvent(F,e,ve(),void 0)},[F,f,ve]),ye=h.useCallback(e=>{e.preventDefault()},[]),Ce=h.useCallback(e=>{S&&n.dispatchEvent(S,e,ve(),{value:le,attachments:se}),ae||K(""),oe||V([])},[S,ve,le,se,ae,oe]),xe=h.useCallback(e=>{if("Enter"!==e.key||!e.shiftKey){if("ArrowUp"===e.key||"ArrowDown"===e.key)return void e.stopPropagation();if("Enter"===e.key){if(e.preventDefault(),A)return;re&&Ce(e)}}},[Ce,A,re]),Ie={disabled:f,readOnly:v,placeholder:k,title:b,maxLength:E,"aria-label":r.toLanguageString(U,me[U]),value:le,onKeyDown:xe,...y,onChange:ke,onFocus:be,onBlur:Ee,ref:O},Te=h.useCallback(e=>{var t,a;const{isFinal:l,alternatives:o}=e;if(o.length>0){const e=o[0];if(l){const a=(null==(t=O.current)?void 0:t.value)||"",l=(a?`${a} `:"")+e.transcript;if(ae||K(l),N&&!f){const e={target:O.current,currentTarget:O.current};n.dispatchEvent(N,e,{...ve(),value:l},{value:l})}}}null==(a=O.current)||a.focus()},[ae,N,f,ve]),Ne=h.useCallback(()=>{var e,t;null==(t=null==(e=Y.current)?void 0:e.actionElement)||t.click()},[]),we=h.useCallback(e=>{var t;const n=Array.from(e.affectedFiles),a="object"==typeof M&&M.onSelectAttachments;oe||V(e=>[...e,...n]),a&&a({selectedFiles:e.affectedFiles,allFiles:e.newState}),null==(t=O.current)||t.focus()},[M,oe]),Fe=h.useMemo(()=>({uploadButtonProps:{fillMode:"flat",svgIcon:l.paperclipIcon,size:"small",rounded:"full",onClick:Ne,onFilesAdd:we,files:se,uploadRef:Y,"aria-label":r.toLanguageString(j,me[j]),title:r.toLanguageString(j,me[j]),_registerRemoveCallback:e=>{J.current=e}},speechToTextButtonProps:{fillMode:"flat",size:"small",rounded:"full",onResult:Te},actionButtonProps:{rounded:"full",size:"small",svgIcon:A?l.stopIcon:l.arrowUpIcon,className:A?"k-generating k-active":"",onClick:Ce,onMouseDown:ye,disabled:!A&&!re,"aria-label":A?r.toLanguageString(G,me[G]):r.toLanguageString($,me[$]),title:A?r.toLanguageString(G,me[G]):r.toLanguageString($,me[$]),"aria-live":"polite"}}),[Te,we,se,Ce,ye,A,Ne,r,re]),Se=h.useCallback(e=>{oe||V(t=>t.filter(t=>t.name!==e));const t="object"==typeof M&&M.onRemoveAttachment;t&&(J.current=t),J.current&&J.current(e)},[M,oe]),Re=()=>{const e=!1!==L,t=!1!==B,n=!1!==M,a="object"==typeof L?L:void 0,l="object"==typeof M?M:{},{restrictions:o,multiple:s=!0,accept:i,onSelectAttachments:c,onRemoveAttachment:u,...m}=l,d={restrictions:o,multiple:s,accept:i},p="object"==typeof B?B:void 0,g=qe(p,A,Fe.actionButtonProps["aria-label"],r),f={...p,...g};return h.createElement(h.Fragment,null,n&&h.createElement(Le,{...Fe.uploadButtonProps,restrictions:d.restrictions,multiple:d.multiple,accept:d.accept,...m}),e&&h.createElement(De,{...Fe.speechToTextButtonProps,...a}),t&&h.createElement(Be,{...Fe.actionButtonProps,...f}))},Ae="multi"===c||"auto"===c&&W,Me=!1!==M||!1!==L||!1!==B,Pe=I||Me,ze=x||I||Me;return h.createElement("div",{...z,className:n.classNames(D,"k-input",He,{[`k-input-${u}`]:u,"k-disabled":f,"k-prompt-box-singleline":"single"===c,"k-prompt-box-multiline":Ae}),style:P},h.createElement(Oe,{files:se,onRemoveFile:Se,header:T}),"single"===c?h.createElement("div",{className:`${He}-content`},x&&h.createElement("div",{className:`${He}-affix`},ne(x,Fe)),h.createElement("input",{...Ie,className:n.classNames("k-input-inner",`${He}-input`)}),Pe?h.createElement("div",{className:`${He}-affix`},I&&ne(I,Fe),Re()):null):h.createElement("div",{className:`${He}-content`},"multi"===c&&C&&h.createElement("div",{className:`${He}-affix`},ne(C,Fe)),"auto"===c&&!W&&x&&h.createElement("div",{className:`${He}-affix`},ne(x,Fe)),h.createElement("textarea",{...Ie,className:n.classNames("k-input-inner",`${He}-textarea`),rows:ce(),style:d?{maxHeight:d}:{},"aria-multiline":"true"}),"auto"===c&&!W&&Pe?h.createElement("div",{className:`${He}-affix`},I&&ne(I,Fe),Re()):null,Ae&&ze?h.createElement("div",{className:`${He}-affix`},x&&ne(x,Fe),(x||I)&&h.createElement("div",{className:"k-spacer"}),I&&ne(I,Fe),Re()):null),a&&h.createElement(n.WatermarkOverlay,{message:o}))});$e.propTypes={value:r.string,defaultValue:r.string,mode:r.oneOf(["single","multi","auto"]),rows:r.number,maxTextAreaHeight:r.string,title:r.string,disabled:r.bool,readOnly:r.bool,placeholder:r.string,maxLength:r.number,inputAttributes:r.object,fillMode:r.oneOf(["solid","flat","outline"]),topAffix:r.oneOfType([r.func,r.element,r.string]),startAffix:r.oneOfType([r.func,r.element,r.string]),endAffix:r.oneOfType([r.func,r.element,r.string]),header:r.oneOfType([r.func,r.element,r.string]),onChange:r.func,onFocus:r.func,onBlur:r.func,loading:r.bool,uploadButtonConfig:r.oneOfType([r.bool,r.object]),speechToTextButtonConfig:r.oneOfType([r.bool,r.object]),actionButtonConfig:r.oneOfType([r.bool,r.object]),attachments:r.array,onPromptAction:r.func,className:r.string,style:r.object},$e.displayName="KendoPromptBox";const Ve=h.memo(({affixProps:e,uploadConfig:t,localizationService:n,onFilesSelect:a,onFileRemove:l})=>{const o="object"==typeof t?t:{};return!1!==t?h.createElement(Le,{...e.uploadButtonProps,fillMode:"clear","aria-label":n.toLanguageString(B,me[B]),title:n.toLanguageString(B,me[B]),...o,onSelectAttachments:a,onRemoveAttachment:l}):null});Ve.displayName="UploadButtonAffix";const je=h.forwardRef((e,t)=>{const{onSendMessage:o,isDirectionRightToLeft:r,placeholder:i,MessageBox:c,suggestions:u,onSuggestionClick:m,inputValue:d,onInputValueChange:p,suggestionTemplate:g,sendButtonConfig:f,onInputClick:k,suggestionsLayout:E,dir:y,messageBoxSettings:C,loading:x}=e,{replyToMessage:I,setReplyToMessage:T,user:N,speechToTextConfig:w,uploadConfig:F}=ke(),[R,A]=h.useState(""),[M,L]=h.useState([]),B=h.useRef(null),D=s.useLocalization(),P=void 0!==d,z=P?d:R,O=h.useCallback(()=>{null!==B.current&&B.current.focus()},[]);h.useEffect(()=>{I&&O()},[I,O]);const q=h.useCallback(e=>{if(e.preventDefault(),o){const t={id:"",author:N,text:z||"",timestamp:new Date,replyToId:I?I.id:void 0,files:M.map(e=>({name:e.name,size:e.size,type:e.extension,rawFile:e.getRawFile?e.getRawFile():e}))};T(null),o(t,e),L([]),P||A(""),p&&p(""),O()}},[o,z,N,I,M,T,p,O,P]);h.useImperativeHandle(t,()=>({focusInput:O}),[O]);const K=h.useCallback(e=>{L(t=>t.filter(t=>t.name!==e))},[]),U=h.useCallback((e,t)=>e.isDeleted?pe(t,D):e.text,[D]),$=h.useCallback(()=>{if(I){const e=de(N,I);return h.createElement("div",{className:n.classNames("k-message-reference",e?"k-message-reference-sender":"k-message-reference-receiver")},h.createElement("div",{className:"k-message-reference-content"},U(I,e)),h.createElement("span",{className:"k-spacer"}),h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:l.xCircleIcon,onClick:()=>T(null),"aria-label":D.toLanguageString(S,me[S]),title:D.toLanguageString(S,me[S])}))}return null},[I,N,U,T,D]),V=h.useCallback(e=>{try{const t=Array.from(e.allFiles);L(t)}catch{}},[]),j=h.useCallback(e=>{const t=e.value;P||A(t),p&&p(t||"")},[P,p]),W=h.useCallback(e=>{q(e.syntheticEvent)},[q]),G=h.useCallback(e=>e?"function"==typeof e?e():e:null,[]),_=h.useCallback(e=>h.createElement(h.Fragment,null,h.createElement(Ve,{affixProps:e,uploadConfig:F,localizationService:D,onFilesSelect:V,onFileRemove:K}),G(null==C?void 0:C.startAffix)),[F,D,V,K,null==C?void 0:C.startAffix,G]),Y=h.useCallback(()=>G(null==C?void 0:C.endAffix),[null==C?void 0:C.endAffix,G]),J=h.useCallback(()=>G(null==C?void 0:C.topAffix),[null==C?void 0:C.topAffix,G]),X=h.useMemo(()=>{const e="object"==typeof f?f:{},t=!1!==f&&{"aria-label":x?D.toLanguageString(H,me[H]):D.toLanguageString(v,me[v]),title:x?D.toLanguageString(H,me[H]):D.toLanguageString(v,me[v]),dir:r?"rtl":void 0,...e};return h.createElement($e,{header:$(),ref:B,placeholder:i,value:z,onChange:j,onPromptAction:W,mode:(null==C?void 0:C.mode)||"multi",rows:(null==C?void 0:C.rows)||2,maxTextAreaHeight:(null==C?void 0:C.maxTextAreaHeight)||"110",loading:x,speechToTextButtonConfig:w,actionButtonConfig:t,attachments:M,startAffix:_,endAffix:null!=C&&C.endAffix?Y:void 0,topAffix:null!=C&&C.topAffix?J:void 0,inputAttributes:{onClick:k,"aria-label":D.toLanguageString(b,me[b])}})},[i,z,j,W,C,x,w,f,M,$,_,Y,J,D,r,k]);return h.createElement("div",{className:"k-message-box-wrapper"},u&&u.length>0&&h.createElement(Me,{onSuggestionClick:m,suggestions:u,suggestionTemplate:g,suggestionsLayout:E,dir:y}),c?h.createElement(c,{messageInput:X}):X)});je.displayName="NewMessage";const We=e=>h.createElement(a.Toolbar,{className:"k-chat-header",size:"small"},e.children),Ge=e=>{const{message:t,onUnpin:o,user:r,onReferencedMessageClick:i}=e,c=s.useLocalization(),u=h.useRef(null),m=r&&de(r,t),d=h.useCallback(e=>{e.preventDefault(),e.stopPropagation(),null==i||i(t.id)},[t.id,i]);return h.createElement("div",{ref:u,className:`k-message-reference ${m?"k-message-reference-sender":"k-message-reference-receiver"} k-message-pinned`,onClick:d},h.createElement(n.IconWrap,{icon:l.pinIcon}),h.createElement("div",{className:"k-message-reference-content"},t.isDeleted?r&&pe(de(r,t),c):t.text),h.createElement("span",{className:"k-spacer"}),h.createElement(a.Button,{fillMode:"flat",size:"xs",svgIcon:l.xCircleIcon,onClick:e=>{e.stopPropagation(),null==o||o(t)},"aria-label":c.toLanguageString("chat.unpinMessage",me["chat.unpinMessage"])}))},_e=e=>{const{show:t,text:n}=e;return h.createElement("div",{style:{position:"absolute",top:"90%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,pointerEvents:t?"auto":"none"}},h.createElement(c.Fade,null,t&&h.createElement(u.Notification,{type:{style:"inverse"},closable:!1},h.createElement("span",null,n))))},Ye={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions",isFailedField:"isFailed"},Je=(e,t={})=>{const n={...Ye,...t};let a,l;a=e.author&&"object"==typeof e.author?{id:e.author.id||e.author[n.authorIdField]||e[n.authorIdField]||"",name:e.author.name||e.author[n.authorNameField]||e[n.authorNameField],avatarUrl:e.author.avatarUrl||e.author[n.authorImageUrlField]||e[n.authorImageUrlField],avatarAltText:e.author.avatarAltText||e.author[n.authorImageAltTextField]||e[n.authorImageAltTextField]}:{id:e[n.authorIdField]||e.authorId||"",name:e[n.authorNameField]||e.authorName,avatarUrl:e[n.authorImageUrlField]||e.authorImageUrl,avatarAltText:e[n.authorImageAltTextField]||e.authorImageAltText},l=e.timestamp?new Date(e.timestamp):e[n.timestampField]?new Date(e[n.timestampField]):new Date;const o={id:void 0!==e.id?e.id:e[n.idField],text:void 0!==e.text?e.text:e[n.textField]||"",author:a,timestamp:l,status:void 0!==e.status?e.status:e[n.statusField],attachments:void 0!==e.attachments?e.attachments:e[n.attachmentsField],attachmentLayout:e.attachmentLayout||"list",suggestedActions:void 0!==e.suggestedActions?e.suggestedActions:e[n.suggestedActionsField],isPinned:void 0!==e.isPinned?e.isPinned:e[n.isPinnedField]||!1,typing:void 0!==e.typing?e.typing:e[n.typingField],files:void 0!==e.files?e.files:e[n.filesField]||[],isFailed:void 0!==e.isFailed?e.isFailed:e[n.isFailedField]||!1};return e.pinnedAt&&(o.pinnedAt=new Date(e.pinnedAt)),e.pinnedBy&&(o.pinnedBy=e.pinnedBy),void 0!==e.replyToId?o.replyToId=e.replyToId:void 0!==e[n.replyToIdField]&&(o.replyToId=e[n.replyToIdField]),void 0!==e.isDeleted?o.isDeleted=e.isDeleted:void 0!==e[n.isDeletedField]&&(o.isDeleted=e[n.isDeletedField]),{...o,dataItem:e}},Xe=(e,t={})=>Array.isArray(e)?e.map(e=>Je(e,t)):[],Qe=e=>e&&void 0!==e.id&&"string"==typeof e.text&&e.author&&"object"==typeof e.author&&void 0!==e.author.id&&(e.timestamp instanceof Date||"string"==typeof e.timestamp||"number"==typeof e.timestamp),Ze=e=>{e.scrollTop=e.scrollHeight-e.clientHeight},et=({viewItemsWrapperRef:e,isKeyboardNavigationActiveRef:t,processedMessages:n,authorId:a,autoScrollThreshold:l,isEndless:o=!1,isOnLastBatch:s=!0,skipAutoScrollRef:r})=>{var i;const c=h.useRef(a),u=h.useRef(l),m=h.useRef(o),d=h.useRef(s);h.useEffect(()=>{c.current=a,u.current=l,m.current=o,d.current=s});const p=h.useRef(!1);h.useEffect(()=>{o||!e.current||0===n.length||p.current||(Ze(e.current),p.current=!0)},[e,o,n.length]);const g=h.useRef(void 0),f=h.useRef(0),v=h.useRef(!0),k=h.useRef(!0),b=h.useRef(!1),E=h.useRef(null),y=(n.length>0?null==(i=n.at(-1))?void 0:i.id:void 0)!==g.current,C=n.length>f.current;if(y||C){const t=e.current;k.current=!t||(e=>{const{scrollHeight:t,scrollTop:n,clientHeight:a}=e;return!(t>a)||t-n-a<=100})(t)}h.useEffect(()=>{var a,l;const o=n.length,s=o>0?null==(a=n[o-1])?void 0:a.id:void 0,i=g.current,p=f.current,h=v.current;if(g.current=s,f.current=o,v.current=!1,0===o)return;const y=e.current;if(!y||t.current)return;if(h||s===i)return void(!m.current&&(h||o>p)&&(Ze(y),b.current=!1,E.current=null));if(m.current&&!d.current)return;if(null!=r&&r.current)return void(r.current=!1);const C=n[o-1];if(void 0!==c.current&&void 0!==(null==(l=null==C?void 0:C.author)?void 0:l.id)&&String(C.author.id)===String(c.current))return y.scrollTo({top:y.scrollHeight-y.clientHeight,behavior:"smooth"}),b.current=!1,void(E.current=null);if(!k.current)return b.current=!1,void(E.current=null);const x=(e=>{const t=e.querySelectorAll(".k-message");return t.length>0?t[t.length-1]:null})(y);if(!x)return;const I=(e=>{const t=e.querySelector(".k-message-pinned");return t?t.offsetHeight:0})(y),T=Math.max(0,y.clientHeight-I),N=((e,t)=>{const n=null!=e?e:"20%";let a;if("number"==typeof n)a=n;else{const e=/^(-?\d+(?:\.\d+)?)%$/.exec(String(n));if(e)a=Number.parseFloat(e[1])/100*t;else{const e=Number.parseFloat(String(n));a=Number.isNaN(e)?.2*t:e}}return Math.min(a,t)})(u.current,T),w=x.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=Math.max(0,w-N-I),S=Math.max(0,y.scrollHeight-y.clientHeight),R=Math.min(F,S);R>y.scrollTop&&y.scrollTo({top:R,behavior:"smooth"}),E.current=F,b.current=!0},[n,e,t]),h.useEffect(()=>{const n=e.current;if(!n)return;let a=n.querySelectorAll(".k-message").length,l=n.scrollHeight,o=n.scrollTop;const s=()=>{const e=n.scrollTop;b.current&&e<o&&(b.current=!1,E.current=null),o=e},r=new MutationObserver(()=>{if(t.current)return;const e=n.querySelectorAll(".k-message").length,s=n.scrollHeight;if(e===a&&s>l&&b.current){const e=s-n.clientHeight,t=E.current,a=null===t?e:Math.min(e,t);a>n.scrollTop&&(n.scrollTop=a),o=n.scrollTop}a=e,l=s});return r.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("scroll",s,{passive:!0}),()=>{r.disconnect(),n.removeEventListener("scroll",s)}},[e,t])},tt=["allowMessageCollapse","messageWidthMode","showAvatar","showUsername","messageTemplate","messageContentTemplate","messageToolbarActions","messageContextMenuActions","fileActions"];function nt(e,t,n,a,l){const o=((e,t)=>{var n,a;return(null==(n=null==e?void 0:e.author)?void 0:n.id)===t||(null==(a=null==e?void 0:e.author)?void 0:a.id)===String(t)})(e,t)?a:l,s={};return tt.forEach(e=>{var t;s[e]=null!=(t=null==o?void 0:o[e])?t:null==n?void 0:n[e]}),s}const at=({scrollMode:e,processedMessages:t,total:n,pageSize:a=50,startIndex:l,endIndex:o,onLoadMoreMessages:s,onReferencedMessageClick:r,viewItemsWrapperRef:i,authorId:c})=>{const u=h.useRef(!1),m="endless"===e,d=null!=n?n:t.length,p=m&&t.length===d&&!u.current,g=m&&(t.length<d||u.current);g&&(u.current=!0);const[f,v]=h.useState(-1),[k,b]=h.useState(-1),E=h.useRef(f),y=h.useRef(k);E.current=f,y.current=k;const C=h.useRef(!1),x=h.useRef(0),I=h.useRef(0),T=h.useRef(0),N=h.useRef(!1),w=h.useRef(d),F=h.useRef(c);F.current=c;const S=h.useRef(!1),R=h.useRef(null),A=h.useRef(!1),M=h.useRef(!1),L=h.useRef(!0),B=h.useRef(d);h.useEffect(()=>{if(p){if(u.current)return void((-1===f||-1===k)&&(v(0),b(t.length)));if(-1===f||-1===k){const e=Math.max(0,t.length-a),n=t.length;v(e),b(n)}else if(k<t.length){const e=w.current;if(y.current>=e)b(t.length);else if(t.length>e&&t.slice(e).some(e=>{var t;return void 0!==(null==(t=e.author)?void 0:t.id)&&String(e.author.id)===String(F.current)})){const e=Math.max(0,t.length-a);v(e),b(t.length),A.current=!0}}w.current=d}},[p,t.length,a,f,k,d]);const D=null!=l?l:0,P=null!=o?o:t.length,z=h.useCallback(()=>{const e=i.current;e&&(x.current=e.scrollHeight,I.current=e.scrollTop,T.current=e.querySelectorAll("[data-message-id]").length)},[i]),O=h.useCallback(e=>{var t,n,a;((e,t,n=0)=>{if(!t)return;const a=t.querySelector(`[data-message-id="${e}"]`);if(!a)return;const l=t.querySelector(".k-message-list");if(l){const e=l.getBoundingClientRect().top,t=a.getBoundingClientRect().top,o=l.scrollTop+(t-e)-n;l.scrollTo({top:o,behavior:"smooth"})}else a.scrollIntoView({behavior:"smooth",block:"start"})})(e,null==(t=i.current)?void 0:t.closest(".k-chat"),(null==(a=null==(n=i.current)?void 0:n.querySelector(".k-message-pinned"))?void 0:a.offsetHeight)||0)},[i]);h.useLayoutEffect(()=>{if(!N.current)return;const e=i.current;if(!e)return void(N.current=!1);if(e.querySelectorAll("[data-message-id]").length<=T.current)return;const t=e.scrollHeight-x.current;t>0&&(e.scrollTop=I.current+t),N.current=!1,C.current=!1}),h.useLayoutEffect(()=>{if(!A.current)return;const e=i.current;e?k>=t.length&&k>0&&(A.current=!1,e.scrollTop=e.scrollHeight-e.clientHeight):A.current=!1});const q=h.useRef(!1);h.useLayoutEffect(()=>{if(!m||q.current)return;const e=i.current;e&&e.querySelector("[data-message-id]")&&(e.scrollTop=e.scrollHeight-e.clientHeight,q.current=!0)}),h.useEffect(()=>{if(!m)return;const e=i.current;if(!e)return;let n=e.scrollTop;const l=()=>{const{scrollTop:l,scrollHeight:o,clientHeight:r}=e,i=l<n,c=l>n;if(n=l,!C.current){if(i&&l<=100)if(p){const e=E.current;if(e>0){const t=Math.max(0,e-a);N.current=!0,z(),v(t),null==s||s({startIndex:t,endIndex:y.current})}}else if(g&&D>0){C.current=!0;const e=Math.max(0,D-a);N.current=!0,z(),null==s||s({startIndex:e,endIndex:P})}if(c&&o-l-r<=100)if(p){const e=y.current;if(e<t.length){const n=Math.min(t.length,e+a);M.current=!0,b(n),null==s||s({startIndex:E.current,endIndex:n})}}else if(g&&P<d){C.current=!0,M.current=!0;const e=Math.min(d,P+a);null==s||s({startIndex:D,endIndex:e})}}};return e.addEventListener("scroll",l,{passive:!0}),()=>e.removeEventListener("scroll",l)},[m,p,g,i,a,t.length,D,P,d,s]),h.useEffect(()=>{var e;const n=P>=d;if(!g)return B.current=d,void(L.current=n);const a=B.current,l=L.current;if(B.current=d,L.current=n,d>a&&!l&&n){const n=t[t.length-1];void 0!==F.current&&void 0!==(null==(e=null==n?void 0:n.author)?void 0:e.id)&&String(n.author.id)===String(F.current)&&(S.current=!0,M.current=!0)}},[g,d,P,t]),h.useEffect(()=>{!g||!S.current||(S.current=!1,C.current=!1,requestAnimationFrame(()=>{const e=i.current;e&&(e.scrollTop=e.scrollHeight-e.clientHeight)}))},[g,t,i]),h.useEffect(()=>{if(!g||null===R.current)return;const e=R.current,t=i.current;t&&t.querySelector(`[data-message-id="${e}"]`)&&(R.current=null,C.current=!1,requestAnimationFrame(()=>{O(e)}))},[g,t,i,O]),h.useEffect(()=>{g&&C.current&&!N.current&&(C.current=!1)},[g,D,P]);const K=h.useMemo(()=>{if(p){const e=Math.max(0,f),n=Math.min(t.length,k);if(e>=n){const e=Math.max(0,t.length-a);return t.slice(e)}return t.slice(e,n)}return t},[p,t,f,k,a]),H=h.useMemo(()=>!m||(p?k>=t.length:P>=d),[m,p,k,t.length,P,d]),U=h.useCallback(()=>{if(!m||H){const e=i.current;return void(e&&e.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:"smooth"}))}if(!C.current)if(p){const e=Math.max(0,t.length-a);v(e),b(t.length),null==s||s({startIndex:e,endIndex:t.length}),requestAnimationFrame(()=>{const e=i.current;e&&(e.scrollTop=e.scrollHeight-e.clientHeight)})}else if(g){S.current=!0,N.current=!1,C.current=!0;const e=Math.max(0,d-a);null==s||s({startIndex:e,endIndex:d})}},[m,p,g,H,t.length,a,d,s,i]),$=h.useCallback(e=>{if(m){if(p){const n=i.current;if(null==n?void 0:n.querySelector(`[data-message-id="${e}"]`))O(e);else{if(C.current)return;const n=t.findIndex(t=>t.id===e||String(t.id)===String(e));if(n>=0){const l=Math.floor(a/2),o=Math.max(0,n-l),s=Math.min(t.length,o+a);C.current=!0,v(o),b(s),requestAnimationFrame(()=>{requestAnimationFrame(()=>{O(e),C.current=!1})})}}}else if(g){const t=i.current;if(null==t?void 0:t.querySelector(`[data-message-id="${e}"]`))O(e);else{if(C.current)return;R.current=e,N.current=!1,C.current=!0}}}else O(e);null==r||r({id:e})},[m,p,g,i,t,a,r,O]);return{renderedMessages:K,handleScrollToBottom:U,handleReferencedMessageClick:$,isEndless:m,isOnLastBatch:H,skipAutoScrollRef:M}},lt=h.forwardRef((e,t)=>{const{messages:o=[],messageTemplate:r,messageContentTemplate:i,attachmentTemplate:c,width:u,height:m,onSendMessage:d,onSuggestionClick:p,onInputValueChange:g,onActionExecute:f,dir:v,messageBox:k,placeholder:b,className:E,style:C,message:x=Ee,authorId:I,suggestions:T,suggestionTemplate:N,suggestionsLayout:F="scroll",quickActionsLayout:S="scroll",inputValue:R,headerTemplate:A,noDataTemplate:M,timestampTemplate:L,statusTemplate:B,userStatusTemplate:D,allowMessageCollapse:P,messageToolbarActions:z,messageContextMenuActions:q,fileActions:K,onUnpin:H,messageWidthMode:U,showAvatar:$,showUsername:V,timestampVisibility:j,authorMessageSettings:W,receiverMessageSettings:G,onToolbarAction:_,onContextMenuAction:Y,onFileAction:J,onDownload:X,speechToTextConfig:Q,uploadConfig:Z,sendButtonConfig:ee,messageFilesLayout:te,scrollToBottomButton:ne=!0,autoScrollThreshold:ae,textField:le,statusField:oe,authorIdField:se,authorNameField:re,authorImageUrlField:ie,authorImageAltTextField:ce,idField:ue,timestampField:de,filesField:pe,attachmentsField:ge,replyToIdField:fe,isDeletedField:he,isPinnedField:ke,typingField:be,suggestedActionsField:ye,isFailedField:xe,onResendMessage:Ie,messageBoxSettings:Te,loading:Ne,scrollMode:Fe,total:Me,pageSize:Le,startIndex:Be,endIndex:De,onLoadMoreMessages:Pe,pinnedMessages:ze,repliedToMessages:Oe,onReferencedMessageClick:qe,...He}=e,Ue=h.useRef(null);n.useWebMcpRegister("chat",Ue,e,e.webMcp);const[$e,Ve]=h.useState(null),[Ye,Je]=h.useState(!1),[Ze,tt]=h.useState(!1),[lt,ot]=h.useState(null),[st,rt]=h.useState(null),[it,ct]=h.useState(!1),ut=h.useRef(null),mt=h.useRef(null),dt=h.useRef(null),pt=h.useRef(null),gt=h.useRef(void 0),ft=h.useRef(!1),ht=h.useRef(null),vt=h.useRef(""),kt=h.useMemo(()=>{if(!o||0===o.length)return[];const e={textField:le,statusField:oe,authorIdField:se,authorNameField:re,authorImageUrlField:ie,authorImageAltTextField:ce,idField:ue,timestampField:de,filesField:pe,attachmentsField:ge,replyToIdField:fe,isDeletedField:he,isPinnedField:ke,typingField:be,suggestedActionsField:ye,isFailedField:xe};return!Object.values(e).some(e=>void 0!==e)&&Qe(o[0])?o.map(e=>({...e,timestamp:e.timestamp?new Date(e.timestamp):e.timestamp})):Xe(o,e)},[o,le,oe,se,re,ie,ce,ue,de,pe,ge,fe,he,ke,be,ye,xe]);h.useEffect(()=>{if(I===vt.current&&ht.current)rt(ht.current);else if(I&&kt.length>0){const e=kt.find(e=>e.author&&(e.author.id===I||e.author.id===String(I))),t=(null==e?void 0:e.author)||{id:I};ht.current=t,vt.current=I,rt(t)}},[I,kt]);const{renderedMessages:bt,handleScrollToBottom:Et,handleReferencedMessageClick:yt,isEndless:Ct,isOnLastBatch:xt,skipAutoScrollRef:It}=at({scrollMode:Fe,processedMessages:kt,total:Me,pageSize:Le,startIndex:Be,endIndex:De,onLoadMoreMessages:Pe,onReferencedMessageClick:qe,viewItemsWrapperRef:dt,authorId:I}),Tt=h.useMemo(()=>bt.length>0?(e=>{const t=e.slice().reduce(Ce(e.length),[]);return function(e){let t=0;e.forEach(e=>{"message-group"===e.type?e.messages.forEach(e=>{e.selectionIndex=t++}):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)}),e.lastSelectionIndex=t-1}(t),t})(bt):[],[bt]),Nt=h.useMemo(()=>!n.validatePackage(Ke,{component:"Chat"}),[]),wt=n.getLicenseMessage(Ke),Ft=h.useMemo(()=>{if(ze)return ze.find(e=>e.isPinned);const e=kt.find(e=>e.isPinned);return e||void 0},[kt,ze]),St=s.useLocalization();et({viewItemsWrapperRef:dt,isKeyboardNavigationActiveRef:ft,processedMessages:bt,authorId:I,autoScrollThreshold:ae,isEndless:Ct,isOnLastBatch:xt,skipAutoScrollRef:It});const Rt=(({elementRef:e})=>{const[t,n]=h.useState(!1);return h.useEffect(()=>{const t=e.current;if(!t)return;const a=()=>{n(t.scrollHeight>t.clientHeight)};a();const l=new ResizeObserver(a);l.observe(t);const o=new MutationObserver(()=>{requestAnimationFrame(a)});return o.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),o.disconnect()}},[e]),t})({elementRef:dt}),At=h.useCallback(()=>{clearTimeout(gt.current)},[]),Mt=h.useCallback(()=>{gt.current=window.setTimeout(()=>{Ve(null)},0)},[]),Lt=h.useCallback(e=>{Ve(e)},[]),Bt=h.useCallback(e=>{let t=null;const a=null!==$e?$e:Tt.lastSelectionIndex;e.keyCode===n.Keys.up?null===a?t=0:a>0&&(t=a-1):e.keyCode===n.Keys.down?null===a?t=0:a<Tt.lastSelectionIndex&&(t=a+1):e.keyCode===n.Keys.home?t=0:e.keyCode===n.Keys.end&&(t=Tt.lastSelectionIndex),null!==t&&(Ve(t),ft.current=!0,e.preventDefault())},[$e,Tt]),Dt=h.useCallback((e,t,a)=>{var l;if(f&&f({action:{value:e.value,title:e.title,type:e.type},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget}),!t.isDefaultPrevented()){switch(e.type){case"reply":d&&d({message:{id:"",author:st,text:e.value,timestamp:new Date},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget});break;case"call":window.open("tel:"+e.value);break;case"openUrl":{const t=n.sanitizeUrl(e.value);t&&window.open(t,"_blank","noopener,noreferrer");break}}null==(l=pt.current)||l.focusInput()}},[f,d,st]),Pt=h.useCallback(()=>n.classNames("k-chat",E,{"k-rtl":Ye}),[E,Ye]),zt=h.useCallback(()=>{const e=Tt.length-1;return Tt.map((t,n)=>{var a,l,o,s,u,m;if("date-marker"===t.type)return h.createElement(Re,{item:t,key:t.trackBy,timestampTemplate:L});if("message-group"===t.type){const o={allowMessageCollapse:P,messageWidthMode:U,showAvatar:$,showUsername:V,messageTemplate:r,messageContentTemplate:i,messageToolbarActions:z,messageContextMenuActions:q,fileActions:K},s=nt(null==(a=t.messages)?void 0:a[0],I,o,W,G);return h.createElement(Ae,{group:t,itemTemplate:s.messageTemplate,contentTemplate:s.messageContentTemplate,attachmentTemplate:c,user:st,selectedItemIndex:$e,onRequestSelection:Lt,isLastGroup:n===e,key:null!=(l=t.messages[0].id)?l:t.messages[0].selectionIndex,message:x,allowMessageCollapse:s.allowMessageCollapse,messageToolbarActions:s.messageToolbarActions,messageContextMenuActions:s.messageContextMenuActions,fileActions:s.fileActions,messageWidthMode:s.messageWidthMode,showAvatar:s.showAvatar,showUsername:s.showUsername})}return"attachment-group"===t.type?h.createElement(Se,{group:t,itemTemplate:c,onRequestSelection:Lt,selected:t.selectionIndex===$e,isLastGroup:n===e,dir:Ye?"rtl":"ltr",key:`att-${null!=(s=null==(o=t.trackBy)?void 0:o.id)?s:t.selectionIndex}`}):"action-group"===t.type?h.createElement(we,{group:t,onActionExecute:Dt,onRequestSelection:Lt,selected:t.selectionIndex===$e,key:`act-${null!=(m=null==(u=t.trackBy)?void 0:u.id)?m:t.selectionIndex}`,quickActionsLayout:S,dir:v}):null})},[Tt,L,r,i,c,st,$e,Lt,x,P,z,q,K,U,$,V,I,W,G,Dt,S,v,Ye]),Ot=h.useCallback(()=>A?"function"==typeof A?A():A:null,[A]),qt=h.useCallback(()=>M?"function"==typeof M?M():M:null,[M]);h.useEffect(()=>{const e=void 0!==v?"rtl"===v:ut.current&&"rtl"===getComputedStyle(ut.current).direction;Je(!!e)},[v]),h.useEffect(()=>()=>{clearTimeout(gt.current)},[]),h.useEffect(()=>{if(!ne||!dt.current)return;let e,t;const n=()=>{e=void 0;const n=dt.current;if(!n)return;const{scrollHeight:a,scrollTop:l,clientHeight:o}=n;!(a>o)||a-l-o<=100?(void 0!==t&&(clearTimeout(t),t=void 0),ct(!1)):null!=t||(t=setTimeout(()=>{t=void 0,ct(!0)},300))},a=()=>{void 0===e&&(e=requestAnimationFrame(n))},l=dt.current;l.addEventListener("scroll",a,{passive:!0});const o=new MutationObserver(a);return o.observe(l,{childList:!0,subtree:!0,characterData:!0}),()=>{l.removeEventListener("scroll",a),o.disconnect(),void 0!==e&&cancelAnimationFrame(e),void 0!==t&&clearTimeout(t)}},[ne]);const Kt=h.useMemo(()=>({replyToMessage:lt,setReplyToMessage:ot,messages:kt,repliedToMessages:Oe,user:st,internalScrollContainerRef:mt,messageListScrollContainerRef:dt,onToolbarAction:_,onContextMenuAction:Y,onFileAction:J,setShowCopyNotification:tt,onDownload:X,onResendMessage:Ie,fileActions:K,speechToTextConfig:Q,uploadConfig:Z,statusTemplate:B,userStatusTemplate:D,messageFilesLayout:te,timestampVisibility:j,onReferencedMessageClick:yt}),[lt,ot,kt,Oe,st,_,Y,J,tt,X,Ie,K,Q,Z,B,D,te,j,yt]);return h.createElement(ve.Provider,{value:Kt},h.createElement("div",{style:{width:u,height:m,position:"relative",overflow:"hidden",...C},onKeyDown:Bt,className:Pt(),ref:e=>{ut.current=e,mt.current=e,"function"==typeof t?t(e):t&&(t.current=e)},...He},void 0!==A&&h.createElement(We,null,Ot()),h.createElement("div",{className:"k-message-list",onBlur:Mt,onFocus:At,role:"log","aria-label":St.toLanguageString(y,me[y]),"aria-live":"polite",ref:dt,style:{scrollBehavior:"auto"}},Ft&&h.createElement(Ge,{message:Ft,onUnpin:H,user:st,onReferencedMessageClick:yt}),h.createElement("div",{className:n.classNames("k-message-list-content",{"k-message-list-content-empty":0===bt.length})},0===bt.length&&void 0!==M&&qt(),bt.length>0&&zt()),ne&&(it||!xt)&&h.createElement("div",{className:"k-chat-scroll-to-bottom-container"},h.createElement(a.FloatingActionButton,{svgIcon:l.arrowDownIcon,size:"small",themeColor:"base",rounded:"full",onClick:Et,"aria-label":St.toLanguageString(O,me[O]),title:St.toLanguageString(O,me[O])}))),Rt&&h.createElement("div",{className:"k-separator"}),h.createElement(je,{onSendMessage:(e,t)=>{d&&d({message:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})},onSuggestionClick:e=>{p&&p(e)},isDirectionRightToLeft:Ye,ref:pt,placeholder:b,MessageBox:k,suggestions:T,suggestionTemplate:N,inputValue:R,onInputValueChange:e=>{g&&g(e)},onInputClick:()=>{ft.current=!1},sendButtonConfig:ee,suggestionsLayout:F,dir:v,messageBoxSettings:Te,loading:Ne}),h.createElement(_e,{show:Ze,text:St.toLanguageString(w,me[w])}),Nt&&h.createElement(n.WatermarkOverlay,{message:wt})))});lt.displayName="Chat",lt.propTypes={messages:r.arrayOf(r.object),user:r.object,messageTemplate:r.any,messageContentTemplate:r.any,attachmentTemplate:r.any,width:r.oneOfType([r.string,r.number]),style:r.object,onSendMessage:r.func,onActionExecute:r.func,dir:r.string,messageBox:r.any,noDataTemplate:r.oneOfType([r.element,r.func]),suggestionsLayout:r.oneOf(["scroll","wrap","scrollbuttons"]),quickActionsLayout:r.oneOf(["scroll","wrap","scrollbuttons"]),userStatusTemplate:r.elementType,messageFilesLayout:r.oneOf(["vertical","wrap","horizontal"]),showAvatar:r.bool,showUsername:r.bool,authorMessageSettings:r.object,receiverMessageSettings:r.object,scrollMode:r.oneOf(["scrollable","endless"]),total:r.number,pageSize:r.number,startIndex:r.number,endIndex:r.number,onLoadMoreMessages:r.func,pinnedMessages:r.arrayOf(r.object),repliedToMessages:r.arrayOf(r.object),onReferencedMessageClick:r.func};const ot=e=>{const{activeView:t,toolbarItems:n,activeViewChange:l}=e;return h.createElement("div",{className:"k-prompt-header"},h.createElement(a.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},n.map(e=>h.isValidElement(e)?e:h.createElement(a.Button,{key:e.name,className:t===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>(e=>{null==l||l.call(null,e)})(e.name)},e.buttonText))))},st={name:"Output view",buttonText:"Output",buttonIcon:l.commentIcon},rt={name:"Commands view",buttonIcon:l.moreHorizontalIcon},it={name:"Prompt view",buttonText:"Ask AI",buttonIcon:l.sparklesIcon},ct=h.createContext([{},()=>{}]),ut=()=>h.useContext(ct),mt=e=>{const{children:t}=e;return h.createElement("div",{className:"k-prompt-footer"},h.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},t))},dt=h.forwardRef((e,t)=>{const{children:n,streaming:o,onCancel:r}=e,i=s.useLocalization().toLanguageString(x,me[x]),[c]=ut(),u=c.activeView===st.name,m=o&&!u,d=h.useCallback(e=>{"Escape"===e.key&&o&&r&&(e.preventDefault(),r())},[o,r]);return h.createElement("div",{className:"k-prompt-content",ref:t,onKeyDown:d},m&&h.createElement(a.FloatingActionButton,{onClick:r,svgIcon:l.stopIcon,icon:"stop",size:"medium",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":i,title:i}),h.createElement("div",{className:"k-prompt-view"},n))});dt.displayName="KendoReactAIPromptContent";const pt=e=>{const[t]=ut();return t.activeView===e.name?e.children:null},gt=e=>{const[t,n]=h.useState(!0),{children:o,title:s}=e;return h.createElement("div",{className:"k-prompt-expander"},h.createElement(a.Button,{"aria-controls":e.id,fillMode:"flat",svgIcon:t?l.chevronUpIcon:l.chevronDownIcon,title:s,onClick:()=>n(!t),"aria-expanded":t},s),t&&h.createElement("div",{id:e.id,className:"k-prompt-expander-content"},o))},ft=e=>null==e?void 0:e.map(e=>h.createElement(o.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&ft(e.children))),ht=({show:e=!1,anchor:t,onOpen:n,onClose:a,animate:l=!0,appendTo:o,popupOptions:s={},children:r,style:i})=>h.createElement(d.Popup,{show:e,anchor:t,style:i,animate:l,appendTo:o,onOpen:n,onClose:a,...s},r),vt=({placeholder:e="Ask or generate content with AI...",promptValue:t,onMenuClick:o,promptInput:s=m.TextArea,generateButton:r,enableSpeechToText:i=!1,streaming:c=!1,commands:u,onPromptRequest:d,onPromptCancel:p})=>{const[g,f]=h.useState(t||""),[v,k]=n.useCustomComponent(r),[b,E]=n.useCustomComponent(s),y=s===m.TextArea||b===m.TextArea,C={svgIcon:c?l.stopIcon:l.paperPlaneIcon,active:(!!c).toString(),title:"Send Button","aria-label":"Send Button",disabled:!g.trim()&&!c,"aria-disabled":!g.trim()&&!c},x={placeholder:e,className:"!k-flex-row",...y?{autoSize:!0}:{},rows:1},I=u&&u.length>0,T=Object.keys(k).length>0?k:C,N=Object.keys(E).length>0?E:x,w=e=>{const{isFinal:t,alternatives:n}=e;if(t&&n.length>0){const e=n[0].transcript,t=(()=>{const t=g,n=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(n?" ":"")+e})();f(t)}},F=()=>{g.trim()&&d&&d(g.trim())};return h.createElement(b,{value:g,onChange:e=>{const t=e.target.value;f(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),F())},prefix:I||i?h.createElement(h.Fragment,null,h.createElement(m.InputPrefix,{className:"!k-align-items-start"},I&&h.createElement(a.Button,{"aria-label":"Commands Button",title:"Commands Button",fillMode:"flat",svgIcon:l.menuIcon,onClick:o}),i&&h.createElement(a.SpeechToTextButton,{fillMode:"flat",..."object"==typeof i?{...i,onResult:i.onResult||w}:{onResult:w}})),h.createElement(m.InputSeparator,null)):void 0,suffix:h.createElement(m.InputSuffix,{className:"!k-align-items-start"},h.createElement(v,{className:n.classNames("k-prompt-send",{"k-generating":c,"k-active":c}),fillMode:"flat",onClick:c?p:F,...T})),...N})},kt=h.forwardRef((e,t)=>{const{svgIcon:a,label:o,labelClassName:s,secondaryLabel:r,linesAdded:i,linesRemoved:c,expandable:u,expanded:m,defaultExpanded:d,completed:p,onExpandedChange:g,headerTemplate:f,bodyTemplate:v,headerExtra:k,className:b,children:E,...y}=e,C=void 0!==m,[x,I]=h.useState(null!=d&&d),T=null!=m?m:x,N=h.useRef(null),w=h.useCallback(e=>{var t;if(!u)return;const n=!T;if(C||I(n),g){const a={expanded:n,syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(t=N.current)?t:e.currentTarget};g(a)}},[u,T,C,g]),F=h.createElement(h.Fragment,null,a&&h.createElement(n.SvgIcon,{icon:a,size:"small",className:"k-agent-step-icon"}),h.createElement("span",{className:"k-agent-step-content"},o&&h.createElement("span",{className:n.classNames("k-agent-step-label",!1===p&&"k-text-shimmer",s)},o),r&&h.createElement(h.Fragment,null,h.createElement("span",{className:"k-agent-step-sep"},"·"),h.createElement("span",{className:"k-agent-step-secondary"},r)),null!=i&&i>0&&h.createElement("span",{className:"k-agent-step-added k-text-success"},"+",i),null!=c&&c>0&&h.createElement("span",{className:"k-agent-step-removed k-text-error"},"-",c),k,u&&h.createElement(n.SvgIcon,{icon:T?l.chevronUpIcon:l.chevronRightIcon,size:"small",className:"k-agent-step-expand"})));let S;return S=f?h.createElement(f,{svgIcon:a,label:o,secondaryLabel:r,headerExtra:k,linesAdded:i,linesRemoved:c,completed:p,expanded:T,expandable:u}):u?h.createElement("button",{ref:N,type:"button",className:"k-agent-step-head","aria-expanded":T,onClick:w},F):h.createElement("div",{className:"k-agent-step-head"},F),h.createElement("div",{ref:t,className:n.classNames("k-agent-step",{"k-agent-completed":p},b),...y},S,T&&E&&(v?h.createElement(v,{expanded:T,completed:p},E):h.createElement("div",{className:"k-agent-step-body"},E)))});kt.displayName="KendoReactAgentStep";const bt=h.forwardRef((e,t)=>{const{svgIcon:a,label:l,labelClassName:o,secondaryLabel:s,linesAdded:r,linesRemoved:i,status:c,statusThemeColor:u,statusSvgIcon:m,completed:d,description:g,contentNode:f,className:v,children:k,...b}=e,E=!0===d,y=!E;return h.createElement("div",{className:n.classNames("k-thought",{"k-thought-completed":E},{"k-thought-active":y},v),ref:t,...b},h.createElement("span",{className:"k-agent-step-icon-col"},a&&h.createElement(n.SvgIcon,{icon:a,size:"small",className:"k-agent-step-icon"})),h.createElement("span",{className:"k-agent-step-content"},null!=f?f:h.createElement(h.Fragment,null,l&&h.createElement("span",{className:n.classNames("k-agent-step-label",y&&"k-text-shimmer",o)},l),g&&h.createElement("span",{className:"k-agent-step-description"},g),s&&h.createElement(h.Fragment,null,h.createElement("span",{className:"k-agent-step-sep"},"·"),h.createElement("span",{className:"k-agent-step-secondary"},s)),null!=r&&r>0&&h.createElement("span",{className:"k-agent-step-added k-text-success"},"+",r),null!=i&&i>0&&h.createElement("span",{className:"k-agent-step-removed k-text-error"},"-",i),c&&h.createElement(p.Badge,{size:"small",themeColor:null!=u?u:"success",rounded:"full"},m&&h.createElement(n.SvgIcon,{icon:m,size:"small"}),c),k&&h.createElement("div",{className:"k-agent-step-body"},k))))});bt.displayName="KendoReactThought";const Et=h.forwardRef((e,t)=>{const{label:a,secondaryLabel:o,svgIcon:s=l.sparklesIcon,completed:r,expanded:i,defaultExpanded:c,expandable:u,thoughts:m=[],linesAdded:d,linesRemoved:p,thoughtTemplate:g,onExpandedChange:f,className:v,...k}=e,b=m.map((e,t)=>h.createElement(bt,{key:t,label:e.label,secondaryLabel:e.secondaryLabel,svgIcon:e.svgIcon,completed:e.completed,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,contentNode:g?h.createElement(g,{thought:e,index:t}):void 0},e.content));return h.createElement(kt,{ref:t,svgIcon:s,label:a,secondaryLabel:o,completed:r,expanded:i,defaultExpanded:c,expandable:u&&m.length>0,linesAdded:d,linesRemoved:p,onExpandedChange:f,className:n.classNames("k-chain-of-thought",v),...k},b)});Et.displayName="KendoReactChainOfThought";const yt=h.forwardRef((e,t)=>{const{visible:l,state:o,template:r,onAction:i,className:c,...u}=e,m=s.useLocalization(),d=h.useRef(null),p=h.useCallback(e=>{var t,n;if(i&&o){const a={action:o,syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(n=null==(t=d.current)?void 0:t.element)?n:e.currentTarget};i(a)}},[i,o]),g=m.toLanguageString(ae,me[ae]),f=m.toLanguageString(le,me[le]),v=m.toLanguageString(oe,me[oe]),k=m.toLanguageString(se,me[se]);let b=null;return"startOver"===o||"restore"===o?b=h.createElement(a.Button,{ref:d,size:"small",fillMode:"flat",onClick:p},"startOver"===o?g:f):"redo"===o&&(b=h.createElement(h.Fragment,null,h.createElement("span",{className:"k-checkpoint-stamp"},v),h.createElement("span",null,"·"),h.createElement(a.Button,{ref:d,size:"small",fillMode:"flat",onClick:p},k))),h.createElement("div",{ref:t,className:n.classNames("k-checkpoint",{"k-checkpoint-visible":!0===l},c),...u},h.createElement("span",{className:"k-checkpoint-line","aria-hidden":"true"}),r?h.createElement(r,{state:o}):b,h.createElement("span",{className:"k-checkpoint-line","aria-hidden":"true"}))});yt.displayName="KendoReactCheckpoint";const Ct=e=>{const{sources:t}=e;return h.createElement(h.Fragment,null,t.map((e,t)=>{const a=n.sanitizeUrl(null==e?void 0:e.url);return h.createElement("div",{className:"k-citation-popover-view",key:t},(null==e?void 0:e.title)&&h.createElement("div",{className:"k-citation-popover-view-title"},e.title),a&&h.createElement("a",{className:"k-citation-popover-view-source",href:a,target:"_blank",rel:"noopener noreferrer"},h.createElement(n.IconWrap,{name:l.globeIcon.name,icon:l.globeIcon}),e.url),(null==e?void 0:e.description)&&h.createElement("span",{className:"k-citation-popover-view-body"},e.description))}))},xt={horizontal:"fit",vertical:"flip"},It=[],Tt=(e,t)=>{if(void 0!==e)return e;const n=t[0];return(e=>{if(!e)return"";try{return new URL(e).hostname}catch{return""}})(null==n?void 0:n.url)||(null==n?void 0:n.title)||""},Nt=h.forwardRef((e,t)=>{const{sources:o=It,label:r,svgIcon:i=l.globeIcon,additionalCount:c,bodyTemplate:u,onOpen:m,showOn:d="hover",className:p,...f}=e,v=s.useLocalization(),[k,b]=h.useState(null),[E,y]=h.useState(!1),[C,x]=h.useState(0),I=h.useRef(o),T=h.useRef(null);o!==I.current&&(I.current=o,x(0));const N=h.useCallback(e=>{var n;const a=null!=(n=null==e?void 0:e.element)?n:null;b(a),"function"==typeof t?t(a):t&&(t.current=a)},[t]),w=h.useCallback(()=>{null!==T.current&&(clearTimeout(T.current),T.current=null)},[]),F=h.useCallback(()=>{w(),T.current=setTimeout(()=>y(!1),150)},[w]);h.useEffect(()=>w,[w]),h.useEffect(()=>{if(!k||0===o.length||"hover"!==d)return;const e=()=>{w(),y(!0)},t=()=>F();return k.addEventListener("mouseenter",e),k.addEventListener("mouseleave",t),()=>{k.removeEventListener("mouseenter",e),k.removeEventListener("mouseleave",t)}},[k,o.length,w,F,d]);const S=h.useCallback((e,t)=>{if(0!==o.length&&(w(),y(!0),m)){const n={sources:o,syntheticEvent:e,nativeEvent:e.nativeEvent,target:t};m(n)}},[o,m,w]),R=h.useCallback(e=>{var t;S(e.syntheticEvent,null!=(t=e.target.element)?t:e.syntheticEvent.currentTarget)},[S]),A=h.useCallback(e=>{var t;"Enter"!==e.syntheticEvent.key&&" "!==e.syntheticEvent.key||(e.syntheticEvent.preventDefault(),S(e.syntheticEvent,null!=(t=e.target.element)?t:e.syntheticEvent.currentTarget))},[S]),M=`k-citation-popover-${n.useId()}`;h.useEffect(()=>{if(!E||"hover"!==d)return;const e=document.getElementById(M);return e?(e.addEventListener("mouseenter",w),e.addEventListener("mouseleave",F),()=>{e.removeEventListener("mouseenter",w),e.removeEventListener("mouseleave",F)}):void 0},[E,M,w,F,d]),h.useEffect(()=>{if(!E||"click"!==d)return;const e=e=>{const t=document.getElementById(M);k&&!k.contains(e.target)&&(!t||!t.contains(e.target))&&y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E,d,k,M]);const L=o.length,B=h.useCallback(()=>x(e=>Math.min(e+1,L-1)),[L]),D=h.useCallback(()=>x(e=>Math.max(e-1,0)),[]),P=[Tt(r,o),c&&o.length>1?"+"+(o.length-1):void 0].filter(Boolean).join(" "),z=null!=u?u:Ct,O=h.createElement(h.Fragment,null,h.createElement("span",{className:"k-citation-pages"},C+1,"/",L),h.createElement(a.ButtonGroup,null,h.createElement(a.Button,{svgIcon:l.arrowLeftIcon,fillMode:"flat",size:"small","aria-label":v.toLanguageString(ce,me[ce]),disabled:C<=0,onClick:D}),h.createElement(a.Button,{svgIcon:l.arrowRightIcon,fillMode:"flat",size:"small","aria-label":v.toLanguageString(ue,me[ue]),disabled:C>=L-1,onClick:B})));return h.createElement(h.Fragment,null,h.createElement(a.Chip,{ref:N,text:P,svgIcon:i,size:"small",fillMode:"outline",rounded:"full",selected:E,onClick:R,onKeyDown:A,className:n.classNames("k-citation",p),...f}),L>0&&h.createElement(g.Popover,{show:E,anchor:k,title:O,collision:xt,callout:!1,margin:{vertical:8,horizontal:0},position:"top",id:M,popoverClass:"k-citation-popover",style:{width:"320px","--kendo-citation-popover-view-current":C+1}},h.createElement(z,{sources:o})))});Nt.displayName="KendoReactCitation";const wt=h.forwardRef((e,t)=>{const{label:a="Reasoning",secondaryLabel:o,svgIcon:s=l.sparklesIcon,completed:r,expanded:i,defaultExpanded:c,expandable:u,contentTemplate:m,onExpandedChange:d,className:p,children:g,...f}=e,v=m?h.createElement(m,null,g):g;return h.createElement(kt,{ref:t,svgIcon:s,label:a,secondaryLabel:o,completed:r,expanded:i,defaultExpanded:c,expandable:u,onExpandedChange:d,className:n.classNames("k-reasoning",p),...f},v)});wt.displayName="KendoReactReasoning";const Ft=e=>"string"==typeof e?e:JSON.stringify(e,null,2),St=e=>h.createElement(h.Fragment,null,h.createElement("div",{className:"k-tool-call-label"},"Parameters"),h.createElement("pre",{className:"k-pre"},h.createElement("code",{className:"k-code"},Ft(e.parameters)))),Rt=e=>h.createElement(h.Fragment,null,h.createElement("div",{className:"k-tool-call-label"},"Result"),h.createElement("pre",{className:"k-pre"},h.createElement("code",{className:"k-code"},Ft(e.result)))),At=e=>e.errorText?h.createElement("div",{className:"k-messagebox k-messagebox-error"},e.errorText):null,Mt={active:"base",completed:"success",awaitingApproval:"warning",error:"error"},Lt={completed:l.checkCircleIcon,awaitingApproval:l.clockIcon,error:l.xCircleIcon},Bt={active:Z,completed:ee,awaitingApproval:te,error:ne},Dt=h.forwardRef((e,t)=>{const{svgIcon:r=l.wrenchIcon,state:i,parameters:c,result:u,errorText:m,approvalText:d,paramsTemplate:g,resultTemplate:f,errorTemplate:v,approvalTemplate:k,onExpandedChange:b,onAction:E,className:y,children:C,...x}=e,I=s.useLocalization(),T=h.useRef(null),N=h.useRef(null),w=null!=i&&"active"!==i,F=null!=i&&"active"!==i&&"awaitingApproval"!==i,S=w?I.toLanguageString(Bt[i],me[Bt[i]]):void 0,R=w?Mt[i]:void 0,A=w?Lt[i]:void 0,M=w&&h.createElement(p.Badge,{size:"small",themeColor:R,rounded:"full",position:null},A&&h.createElement(n.SvgIcon,{icon:A,size:"small"}),h.createElement("span",{className:"k-badge-text"},S)),L="awaitingApproval"===i,B=h.useCallback(e=>{var t,n;if(E){const a={action:"approve",syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(n=null==(t=T.current)?void 0:t.element)?n:e.currentTarget};E(a)}},[E]),D=h.useCallback(e=>{var t,n;if(E){const a={action:"reject",syntheticEvent:e,nativeEvent:e.nativeEvent,target:null!=(n=null==(t=N.current)?void 0:t.element)?n:e.currentTarget};E(a)}},[E]),P=L&&(k?h.createElement(k,{state:i,approvalText:d}):h.createElement(o.Card,null,d&&h.createElement(o.CardBody,null,d),h.createElement(o.CardActions,{layout:"end"},h.createElement(a.Button,{ref:N,fillMode:"outline",onClick:D},I.toLanguageString(ie,me[ie])),h.createElement(a.Button,{ref:T,themeColor:"primary",onClick:B},I.toLanguageString(re,me[re]))))),z=null!=g?g:St,O=null!=f?f:Rt,q=null!=v?v:At,K=h.createElement(h.Fragment,null,null!=c&&h.createElement(z,{parameters:c}),null!=u&&h.createElement(O,{result:u}),null!=m&&h.createElement(q,{errorText:m}),L?P:C);return h.createElement(kt,{ref:t,svgIcon:r,headerExtra:M,completed:F,onExpandedChange:b,className:n.classNames("k-tool-call",y),...x},K)});Dt.displayName="KendoReactToolCall",e.AIPrompt=e=>{const t=h.useRef(null);n.useWebMcpRegister("aiprompt",t,e,e.webMcp);const a=!n.validatePackage(Ke,{component:"AIPrompt"}),l=n.getLicenseMessage(Ke),{activeView:o,toolbarItems:s,children:r,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u,style:m,dir:d,className:p,streaming:g,loading:f,onCancel:v,promptPlaceholder:k,suggestionsView:b,...E}=e,y=s||[it,st],[C,x]=h.useState({activeView:o}),I={...C,activeView:o,streaming:g,loading:f,suggestionsView:null!=b?b:"classic",promptPlaceholder:k,onCancel:v,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u};return h.createElement(ct.Provider,{value:[I,e=>{x(e)}]},h.createElement("div",{className:n.classNames("k-prompt",p),style:m,dir:d,...E},h.createElement(ot,{activeView:I.activeView,toolbarItems:y,activeViewChange:i}),r,a&&h.createElement(n.WatermarkOverlay,{message:l})))},e.AIPromptCommandsView=e=>{const{commands:t}=e,[n]=ut();return h.createElement(pt,{name:rt.name},h.createElement(dt,{streaming:n.streaming,onCancel:n.onCancel},h.createElement("div",{className:"k-prompt-view"},h.createElement(o.PanelBar,{onSelect:e=>{var t,a,l;const o=null==(a=null==(t=e.target)?void 0:t.props)?void 0:a.data;null!=(l=null==o?void 0:o.children)&&l.length||n.onCommandExecute&&n.onCommandExecute.call(null,o)},selected:""},ft(null!=t?t:[])))))},e.AIPromptContent=dt,e.AIPromptFooter=mt,e.AIPromptOutputView=e=>{const[t,n]=h.useState(""),r=h.useRef(null),[i]=ut(),{outputs:c,showOutputRating:u,outputCard:m}=e,{header:d,body:p,actions:g}=m||{},f=s.useLocalization(),v=f.toLanguageString(x,me[x]),k=(e,t)=>{i.onPromptRequest&&i.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),b()},b=()=>{r&&r.current&&r.current.scrollTo({top:0,behavior:"smooth"})},E=h.createElement(o.Card,null,h.createElement(o.CardHeader,null,h.createElement(o.CardTitle,null,h.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),h.createElement(o.CardSubtitle,null,h.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),h.createElement(o.CardBody,null,h.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),h.createElement(o.CardActions,null,i.streaming&&i.onCancel?h.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",svgIcon:l.stopIcon,title:v,onClick:i.onCancel},v):h.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),y=(e,o)=>g?g(e):o&&i.onCancel?h.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",svgIcon:l.stopIcon,title:v,onClick:i.onCancel},v):h.createElement(h.Fragment,null,h.createElement(a.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:t===e.id?l.checkIcon:l.copyIcon,onClick:()=>(e=>{e.responseContent&&navigator.clipboard.writeText(e.responseContent),n(e.id),setTimeout(()=>{n("")},1e3)})(e)},"Copy"),h.createElement(a.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:l.arrowRotateCwIcon,onClick:()=>(e=>{i.onPromptRequest&&i.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),b()})(e)},"Retry"),u&&h.createElement(h.Fragment,null,h.createElement("span",{className:"k-spacer"}),h.createElement(a.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:l.thumbUpIcon,onClick:()=>k(e,"positive")}),h.createElement(a.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:l.thumbDownIcon,onClick:()=>k(e,"negative")}))),I=null==c?void 0:c.map((e,t)=>{const n=!(!i.streaming||i.loading||0!==t);return h.createElement(o.Card,{key:`${e.id}_${t}`},h.createElement(o.CardHeader,null,d?d(e):h.createElement(h.Fragment,null,e.title&&h.createElement(o.CardTitle,null,e.title),e.subTitle&&h.createElement(o.CardSubtitle,null,e.subTitle))),h.createElement(o.CardBody,null,p?p(e):e.responseContent),h.createElement(o.CardActions,null,y(e,n)))}),T=h.createElement(o.Card,null,h.createElement(o.CardBody,null,f.toLanguageString(C,me[C])));return h.createElement(pt,{name:st.name},h.createElement(dt,{ref:r,streaming:i.streaming,onCancel:i.onCancel},h.createElement("div",{className:"k-card-list"},i.loading&&E,I,(!I||0===I.length)&&!i.loading&&T)))},e.AIPromptView=e=>{var t;const{promptInput:o=m.TextArea,generateButton:r=a.Button,enableSpeechToText:i=!1,promptValue:c,promptSuggestions:u}=e,[d,p]=h.useState(c||""),[g]=ut(),f=s.useLocalization(),[v,k]=n.useCustomComponent(r),[b,E]=n.useCustomComponent(o),y=h.useRef(null);h.useEffect(()=>{var e,t;null!=(t=null==(e=y.current)?void 0:e.element)&&t.current&&requestAnimationFrame(()=>{var e,t;if(null!=(t=null==(e=y.current)?void 0:e.element)&&t.current){const e=y.current.element.current;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}})},[d]);const C={title:"Generate",children:"Generate",svgIcon:l.sparklesIcon},x={placeholder:null!=(t=g.promptPlaceholder)?t:f.toLanguageString(I,me[I]),rows:2},T=Object.keys(k).length>0?k:C,N=Object.keys(E).length>0?E:x,w=e=>{const{isFinal:t,alternatives:n}=e;if(t&&n.length>0){const e=n[0].transcript,t=(()=>{const t=d,n=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(n?" ":"")+e})();p(t)}};let F;return i&&(F="object"==typeof i?{...i,onResult:i.onResult||w}:{onResult:w}),h.createElement(pt,{name:it.name},h.createElement(dt,{streaming:g.streaming,onCancel:g.onCancel},h.createElement(b,{ref:y,value:d,flow:"vertical",textareaStyle:{maxHeight:"110px"},autoSize:!0,suffix:i?h.createElement(h.Fragment,null,h.createElement(m.InputSeparator,{orientation:"horizontal"}),h.createElement(m.InputSuffix,{orientation:"horizontal"},h.createElement(a.SpeechToTextButton,{fillMode:"flat",...F}))):void 0,onChange:e=>{p(e.target.value)},...N}),u&&u.length>0&&h.createElement(gt,{title:"Prompt Suggestions"},h.createElement(Me,{suggestionsView:g.suggestionsView,suggestions:u.map((e,t)=>({id:t,text:e,description:e})),onSuggestionClick:e=>{(e=>{p(e)})(e.text)}}))),h.createElement(mt,null,h.createElement(v,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:()=>{g.onPromptRequest&&g.onPromptRequest.call(null,d),p("")},disabled:!d.trim(),...T},T.children)))},e.AIPromptViewRender=pt,e.ChainOfThought=Et,e.Chat=lt,e.ChatMessage=Ee,e.Checkpoint=yt,e.Citation=Nt,e.DEFAULT_FIELD_MAPPING=Ye,e.HeroCard=e=>{const{imageUrl:t,imageMaxWidth:n,title:l,subtitle:o,actions:s,onActionExecute:r,altText:i}=e,c=h.useCallback((e,t)=>{null==r||r({action:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})},[r]),u=i||l||"";return h.createElement("div",{className:"k-card"},h.createElement("img",{className:"k-card-image",src:t,style:{maxWidth:n},alt:u}),h.createElement("div",{className:"k-card-body"},l&&h.createElement("h5",{className:"k-card-title"},l),o&&h.createElement("h6",{className:"k-card-subtitle"},o)),h.createElement("div",{className:"k-card-actions k-card-actions-vertical"},s.map((e,t)=>h.createElement("span",{className:"k-card-action",key:`action-${t}-${e.title||e.value||t}`},h.createElement(a.Button,{fillMode:"flat",onClick:t=>c(e,t)},e.title)))))},e.InlineAIPrompt=e=>{const t=!n.validatePackage(Ke,{component:"InlineAIPrompt"}),s=n.getLicenseMessage(Ke),{outputs:r=[],outputCard:i,promptInput:c=m.TextArea,generateButton:u=a.Button,promptPlaceholder:d="Ask or generate content with AI...",promptValue:p,onPromptRequest:g,onCopy:f,onDiscard:v,outputActions:k,onOutputAction:b,enableSpeechToText:E=!1,streaming:y,onPromptCancel:C,show:x=!1,anchor:I,width:T,height:N,onOpen:w,onClose:F,animate:S=!0,appendTo:R,commands:A,onCommandExecute:M,style:L,className:B,popupOptions:D={},...P}=e,[z,O]=h.useState(""),[q,K]=h.useState(!1),[H,U]=h.useState({left:0,top:0}),$=h.useRef(null),{body:V,actions:j}=i||{},W=k||[{id:"copy",text:"Copy",svgIcon:l.copyIcon,themeColor:"primary",title:"Copy"},{id:"discard",text:"Discard",svgIcon:l.cancelIcon,themeColor:"base",title:"Discard"}],G=(e,t)=>{switch(e.id){case"copy":(e=>{e.responseContent&&(navigator.clipboard.writeText(e.responseContent),O(e.id),setTimeout(()=>O(""),1e3)),null==f||f(e)})(t);break;case"discard":(e=>{null==v||v(e)})(t);break;default:null==b||b(e,t)}},_=h.useCallback(e=>{"Escape"===e.key&&(y&&C?C():!y&&F&&F({target:null}))},[y,C,F]),Y={...L,...T&&{width:T},...N&&{height:N}},J={...T&&{width:T},...N&&{height:N}},X=h.createElement(h.Fragment,null,h.createElement("div",{className:n.classNames("k-prompt",B),style:Y,onKeyDown:_,...P},h.createElement(dt,{ref:$},r&&r.length>0&&h.createElement("div",{className:"k-card-list"},r.map((e,t)=>h.createElement(o.Card,{key:`${e.id}_${t}`},h.createElement(o.CardBody,null,V?V(e):e.responseContent),h.createElement(o.CardActions,null,j?j(e):h.createElement(h.Fragment,null,W.map(t=>{var n;return t.spacer?h.createElement("span",{key:t.id,className:"k-spacer"}):h.createElement(a.Button,{key:t.id,size:"medium",themeColor:t.themeColor||"primary",fillMode:"flat",rounded:"medium",title:null!=(n=t.title)?n:t.text,svgIcon:"copy"===t.id&&z===e.id?l.checkIcon:t.svgIcon,onClick:()=>G(t,e)},t.text)})))))),h.createElement(vt,{promptValue:p,placeholder:d,onPromptRequest:g,onMenuClick:e=>{if(!$.current)return;const t=$.current.getBoundingClientRect();U({left:t.left,top:t.bottom}),K(!0)},onPromptCancel:C,promptInput:c,generateButton:u,enableSpeechToText:E,streaming:y,commands:A}))),t&&h.createElement(n.WatermarkOverlay,{message:s}));return h.createElement(h.Fragment,null,h.createElement(ht,{show:x,anchor:I,onOpen:w,onClose:F,animate:S,appendTo:R,popupOptions:D,style:J},X),h.createElement(o.ContextMenu,{show:q,offset:H,onClose:()=>{K(!1)},items:(e=>null==e?void 0:e.map(e=>({text:e.text,svgIcon:e.svgIcon,data:e,items:e.children?e.children.map(e=>({text:e.text,data:e})):void 0})))(A),onSelect:e=>{var t,n;const a=null==(t=e.item)?void 0:t.data;a&&(null==(n=a.children)||!n.length)&&(e=>{K(!1),M&&M(e)})(a)}}))},e.PromptBox=$e,e.PromptBoxActionButton=Be,e.PromptBoxSpeechToTextButton=De,e.PromptBoxUploadButton=Le,e.PromptHeader=ot,e.Reasoning=wt,e.SuggestionGroup=Me,e.ToolCall=Dt,e.commandsViewDefaults=rt,e.extractFieldMappingFromProps=e=>({textField:e.textField,statusField:e.statusField,authorIdField:e.authorIdField,authorNameField:e.authorNameField,authorImageUrlField:e.authorImageUrlField,authorImageAltTextField:e.authorImageAltTextField,idField:e.idField,timestampField:e.timestampField,filesField:e.filesField,attachmentsField:e.attachmentsField,replyToIdField:e.replyToIdField,isDeletedField:e.isDeletedField,isPinnedField:e.isPinnedField,typingField:e.typingField,suggestedActionsField:e.suggestedActionsField,isFailedField:e.isFailedField}),e.isStandardMessageFormat=Qe,e.mapDataArrayToMessages=Xe,e.mapDataToMessage=Je,e.mapMessageToCustomFormat=(e,t={})=>{const n={...Ye,...t},a={};return void 0!==e.id&&(a[n.idField]=e.id),void 0!==e.text&&(a[n.textField]=e.text),void 0!==e.status&&(a[n.statusField]=e.status),void 0!==e.isFailed&&(a[n.isFailedField]=e.isFailed),void 0!==e.timestamp&&(a[n.timestampField]=e.timestamp),void 0!==e.attachments&&(a[n.attachmentsField]=e.attachments),void 0!==e.files&&(a[n.filesField]=e.files),void 0!==e.suggestedActions&&(a[n.suggestedActionsField]=e.suggestedActions),void 0!==e.replyToId&&(a[n.replyToIdField]=e.replyToId),void 0!==e.isDeleted&&(a[n.isDeletedField]=e.isDeleted),void 0!==e.isPinned&&(a[n.isPinnedField]=e.isPinned),void 0!==e.typing&&(a[n.typingField]=e.typing),e.author&&(void 0!==e.author.id&&(a[n.authorIdField]=e.author.id),void 0!==e.author.name&&(a[n.authorNameField]=e.author.name),void 0!==e.author.avatarUrl&&(a[n.authorImageUrlField]=e.author.avatarUrl),void 0!==e.author.avatarAltText&&(a[n.authorImageAltTextField]=e.author.avatarAltText)),void 0!==e.pinnedAt&&(a.pinnedAt=e.pinnedAt),void 0!==e.pinnedBy&&(a.pinnedBy=e.pinnedBy),void 0!==e.attachmentLayout&&(a.attachmentLayout=e.attachmentLayout),a},e.outputViewDefaults=st,e.promptViewDefaults=it});
|
package/package-metadata.js
CHANGED
|
@@ -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 e=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1793360893,version:"16.3.0-develop.22",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -7,8 +7,8 @@ export const packageMetadata = Object.freeze({
|
|
|
7
7
|
productName: 'KendoReact',
|
|
8
8
|
productCode: 'KENDOUIREACT',
|
|
9
9
|
productCodes: ['KENDOUIREACT'],
|
|
10
|
-
publishDate:
|
|
11
|
-
version: '16.3.0-develop.
|
|
10
|
+
publishDate: 1793360893,
|
|
11
|
+
version: '16.3.0-develop.22',
|
|
12
12
|
licensingDocsUrl:
|
|
13
13
|
'https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-conversational-ui",
|
|
3
|
-
"version": "16.3.0-develop.
|
|
3
|
+
"version": "16.3.0-develop.22",
|
|
4
4
|
"description": "React Chat component allows the user to participate in chat sessions with users or chat bots. KendoReact Conversational UI components",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-licensing": "^1.12.0",
|
|
29
|
-
"@progress/kendo-react-animation": "16.3.0-develop.
|
|
30
|
-
"@progress/kendo-react-buttons": "16.3.0-develop.
|
|
31
|
-
"@progress/kendo-react-common": "16.3.0-develop.
|
|
32
|
-
"@progress/kendo-react-intl": "16.3.0-develop.
|
|
33
|
-
"@progress/kendo-react-indicators": "16.3.0-develop.
|
|
34
|
-
"@progress/kendo-react-inputs": "16.3.0-develop.
|
|
35
|
-
"@progress/kendo-react-layout": "16.3.0-develop.
|
|
36
|
-
"@progress/kendo-react-notification": "16.3.0-develop.
|
|
37
|
-
"@progress/kendo-react-tooltip": "16.3.0-develop.
|
|
38
|
-
"@progress/kendo-react-popup": "16.3.0-develop.
|
|
39
|
-
"@progress/kendo-react-upload": "16.3.0-develop.
|
|
29
|
+
"@progress/kendo-react-animation": "16.3.0-develop.22",
|
|
30
|
+
"@progress/kendo-react-buttons": "16.3.0-develop.22",
|
|
31
|
+
"@progress/kendo-react-common": "16.3.0-develop.22",
|
|
32
|
+
"@progress/kendo-react-intl": "16.3.0-develop.22",
|
|
33
|
+
"@progress/kendo-react-indicators": "16.3.0-develop.22",
|
|
34
|
+
"@progress/kendo-react-inputs": "16.3.0-develop.22",
|
|
35
|
+
"@progress/kendo-react-layout": "16.3.0-develop.22",
|
|
36
|
+
"@progress/kendo-react-notification": "16.3.0-develop.22",
|
|
37
|
+
"@progress/kendo-react-tooltip": "16.3.0-develop.22",
|
|
38
|
+
"@progress/kendo-react-popup": "16.3.0-develop.22",
|
|
39
|
+
"@progress/kendo-react-upload": "16.3.0-develop.22",
|
|
40
40
|
"@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
|
|
41
41
|
"react": "^18.0.0 || ^19.0.0",
|
|
42
42
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"package": {
|
|
130
130
|
"productName": "KendoReact",
|
|
131
131
|
"productCode": "KENDOUIREACT",
|
|
132
|
-
"publishDate":
|
|
132
|
+
"publishDate": 1793360893,
|
|
133
133
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
|
|
134
134
|
}
|
|
135
135
|
},
|