@inkeep/cxkit-primitives 0.0.0-dev-20250617171939 → 0.0.0-dev-20250621014709

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.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),c=require("react"),f=require("@radix-ui/react-avatar"),n=require("./factory.cjs"),B=require("../atoms/avatars/ai.cjs"),_=require("../providers/config-provider.cjs"),p=require("../utils/compose-event-handlers.cjs"),A=require("@inkeep/cxkit-color-mode");function P(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=P(f),k=n.ikp("div",{_id:"chatButton__Container"}),b=n.ikp("button",{_id:"chatButton__Button"}),y=n.ikp("div",{_id:"chatButton__Text"}),S=n.ikp(l.Root,{_id:"chatButton__AvatarContent"}),j=n.ikp(l.Image,{_id:"chatButton__AvatarImage"}),g=c.memo(e=>{const{onLoadingStatusChange:a,avatar:t,...o}=e,{aiChatSettings:m}=_.useInkeepConfig(),{aiAssistantAvatar:r}=m??{},i=typeof t=="string"?t:A.useColorModeValue(t?.light,t?.dark),u=typeof r=="string"?r:r?.dark,[s,v]=c.useState(i??u);c.useEffect(()=>{v(i??u)},[i,u]);const C=h=>{h==="error"&&v(null)};return s?d.jsx(j,{src:s,"data-type":"image",onLoadingStatusChange:p.composeEventHandlers(a,C),...o}):d.jsx(B.default,{"data-type":"icon",...e})});exports.ChatButton=b;exports.ChatButtonAvatarContent=S;exports.ChatButtonAvatarImage=g;exports.ChatButtonContainer=k;exports.ChatButtonPrimitiveAvatarImage=g;exports.ChatButtonText=y;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),c=require("react"),f=require("@radix-ui/react-avatar"),n=require("./factory.cjs"),B=require("../atoms/avatars/ai.cjs"),_=require("../providers/config-provider.cjs"),p=require("../utils/compose-event-handlers.cjs"),A=require("@inkeep/cxkit-color-mode");function P(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=P(f),k=n.ikp("div",{_id:"chatButton__Container"}),b=n.ikp("button",{_id:"chatButton__Button"}),y=n.ikp("div",{_id:"chatButton__Text"}),S=n.ikp(l.Root,{_id:"chatButton__AvatarContent"}),j=n.ikp(l.Image,{_id:"chatButton__AvatarImage"}),g=c.memo(e=>{const{onLoadingStatusChange:a,avatar:t,...o}=e,{aiChatSettings:m}=_.useInkeepConfig(),{aiAssistantAvatar:r}=m??{},i=typeof t=="string"?t:A.useColorModeValue(t?.light,t?.dark),u=typeof r=="string"?r:r?.dark,[s,v]=c.useState(i??u);c.useEffect(()=>{v(i??u)},[i,u]);const C=h=>{h==="error"&&v(null)};return s?d.jsx(j,{src:s,alt:"Chat avatar","data-type":"image",onLoadingStatusChange:p.composeEventHandlers(a,C),...o}):d.jsx(B.default,{"data-type":"icon",...e})});exports.ChatButton=b;exports.ChatButtonAvatarContent=S;exports.ChatButtonAvatarImage=g;exports.ChatButtonContainer=k;exports.ChatButtonPrimitiveAvatarImage=g;exports.ChatButtonText=y;
@@ -5,8 +5,8 @@ import * as u from "@radix-ui/react-avatar";
5
5
  import { ikp as t } from "./factory.js";
6
6
  import f from "../atoms/avatars/ai.js";
7
7
  import { useInkeepConfig as _ } from "../providers/config-provider.js";
8
- import { composeEventHandlers as p } from "../utils/compose-event-handlers.js";
9
- import { useColorModeValue as A } from "@inkeep/cxkit-color-mode";
8
+ import { composeEventHandlers as l } from "../utils/compose-event-handlers.js";
9
+ import { useColorModeValue as p } from "@inkeep/cxkit-color-mode";
10
10
  const b = t("div", {
11
11
  _id: "chatButton__Container"
12
12
  }), E = t("button", {
@@ -15,23 +15,24 @@ const b = t("div", {
15
15
  _id: "chatButton__Text"
16
16
  }), j = t(u.Root, {
17
17
  _id: "chatButton__AvatarContent"
18
- }), l = t(u.Image, {
18
+ }), A = t(u.Image, {
19
19
  _id: "chatButton__AvatarImage"
20
20
  }), H = g((r) => {
21
- const { onLoadingStatusChange: c, avatar: a, ...h } = r, { aiChatSettings: v } = _(), { aiAssistantAvatar: o } = v ?? {}, n = typeof a == "string" ? a : A(a?.light, a?.dark), i = typeof o == "string" ? o : o?.dark, [e, s] = d(
21
+ const { onLoadingStatusChange: h, avatar: a, ...v } = r, { aiChatSettings: c } = _(), { aiAssistantAvatar: o } = c ?? {}, n = typeof a == "string" ? a : p(a?.light, a?.dark), i = typeof o == "string" ? o : o?.dark, [e, s] = d(
22
22
  n ?? i
23
23
  );
24
24
  return B(() => {
25
25
  s(n ?? i);
26
26
  }, [n, i]), e ? /* @__PURE__ */ m(
27
- l,
27
+ A,
28
28
  {
29
29
  src: e,
30
+ alt: "Chat avatar",
30
31
  "data-type": "image",
31
- onLoadingStatusChange: p(c, (C) => {
32
+ onLoadingStatusChange: l(h, (C) => {
32
33
  C === "error" && s(null);
33
34
  }),
34
- ...h
35
+ ...v
35
36
  }
36
37
  ) : /* @__PURE__ */ m(f, { "data-type": "icon", ...r });
37
38
  });
@@ -4,7 +4,7 @@
4
4
 
5
5
  Ask me anything about \`${c}\`.`:`
6
6
 
7
- Let me know how I can help.`,b={content:s.introMessage??`${m}${h}`,id:qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),cn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageLoading"}),ze=t=>{const{isLoading:e,isStreaming:i,messages:s}=v.useChat(),{message:r}=P.useMessage();return!(s.at(-1)?.id===r?.id)||r.role!=="assistant"||!e||i?null:n.jsx(mn,{children:"Thinking...",...t})},ln=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(hn,{"data-username":l.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},un=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(un,{"data-role":i.role,children:l.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),Xe=g.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:s,baseSettings:{userProperties:r}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,h=ya.useColorModeValue(c,m),[p,b]=g.useState(h);g.useEffect(()=>{b(h)},[h]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?r.name?null:s.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:s.userAvatar,...t}):n.jsx(ka.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(Ea.default,{"data-type":"icon","data-role":o.role,...t})}),Cn=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(Cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(pn,{"data-role":e.role,"data-has-message-buttons":l.dataAttr(!!s.length),...t})},vn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,...t})},bn=a.ikp("div",{_id:"aiChatMessageAttachments"}),it=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(bn,{...t})})},gn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),at=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),r=s.metadata?.attributes?.attachments;return r?n.jsx(gn,{children:l.maybeRender(e,r),...i}):null},Pn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),nt=t=>{const{attachment:e,onClick:i,...s}=t,{selectItem:r,onOpen:o}=q.useMessageAttachments(),d=()=>{r(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Pn,{onClick:u.composeEventHandlers(i,d),...s})})},An=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(An,{iconSettings:i,...t}):null},_n=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),rt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(_n,{children:e.title,...t})},Fn=a.ikp(A.Root,{_id:"aiChatMessageAttachmentsPreview"}),ot=t=>{const{onOpenChange:e,...i}=t,{selectItem:s,isOpen:r,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),s(null))};return n.jsx(Fn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(A.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(A.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(A.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(A.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),kn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(kn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=l.getMessageContent(r),{conversation:c}=O.useInkeepConversation();return r.role==="user"?n.jsx(ve,{"data-role":r.role,children:d,...s}):n.jsx(ve,{"data-role":r.role,...s,children:n.jsx(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,h)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:h?.toString(),url:m}})},onCodeCopy:(m,h)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:h}})}})})},In=a.ikp("div",{_id:"aiChatMessageToolbar"}),Ct=t=>{const{isLoading:e,messages:i}=v.useChat(),{message:s}=P.useMessage();return i.at(-1)?.id===s?.id&&e||s.role==="user"?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageToolActions"}),pt=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),{messageButtons:r}=v.useChat(),o=r[s.id]||[];return n.jsx(Mn,{children:l.maybeRender(e,o),...i})},Sn=a.ikp("a",{_id:"aiChatMessageToolAction"}),xn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),o=()=>{r()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Sn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s}):n.jsx(xn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s})},Bn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[h,p]=ee.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=xa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(l.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(F.CustomIcon,{iconKey:h?"messageCopied":"messageCopy"}),upvote:n.jsx(F.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(F.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":l.dataAttr(h)},upvote:{"data-upvoted":l.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":l.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${s} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...r})},fn=a.ikp("div",{_id:"aiChatMessageSources"}),gt=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(fn,{...t})},Tn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Tn,{children:"Sources",...t}),jn=a.ikp("div",{_id:"aiChatMessageSources__List"}),At=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(h=>{const p=La.transformInkeepSource(h,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(jn,{children:l.maybeRender(i,m),...s})},yn=a.ikp(Ia.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),_t=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(B.SourceItemProvider,{source:e,children:n.jsx(yn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},Hn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Ft=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Et=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=B.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ta.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(qn,{"data-type":e.type,children:l.maybeRender(i,r),...s}):null},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":s.type,children:e.content,"data-highlighted":l.dataAttr(e.highlighted),...i})},Wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Bt=a.ikp("div",{_id:"aiChatFooter"}),ft=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Nn=a.ikp("textarea",{_id:"aiChatInput"}),jt=g.forwardRef(({onChange:t,onKeyDown:e,...i},s)=>{const{handleInputChange:r,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:h}=v.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=re.useComposedRefs(s,h);return Oa.useWidgetAutoFocus("chat",h,m),n.jsx(Nn,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Qn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(F.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(E.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx(Vn,{children:l.maybeRender(e,s),...i})},Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...i})})},Kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Kn,{iconSettings:i,...t}):null},zn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Rt=t=>{const{onClick:e,...i}=t,{attachment:s}=w.useAttachmentItem(),{setMessageAttachments:r}=v.useChat(),o=()=>{r(d=>d.filter(c=>c.id!==s.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(F.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},Wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Nt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Qt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),$t=a.ikp(j.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Yn,{children:l.maybeRender(e,s.supportedInputs),...i}):null},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Ut=t=>{const{input:e,onClick:i,...s}=t,{selectedWorkflow:r,messageAttachments:o,setMessageAttachments:d}=v.useChat(),{selectInput:c,onOpen:m}=E.useAttachmentsBar(),h=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(i,h),...s})},Xn=a.ikp(A.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=E.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Xn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(A.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(A.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=a.ikp(A.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Zn,{children:i,...t})},es=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(es,{children:i,...t}):null},ts=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=E.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(ts,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(A.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),is=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=E.useAttachmentsBar();return n.jsx(is,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),as=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(as,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},ns=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(ns,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":l.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ss=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.title?n.jsx(ss,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),rs=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(rs,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},os=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(os,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":l.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ie,{maxRows:10})})},ds=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.content?n.jsx(ds,{"aria-live":"polite",children:e.errors.content,...t}):null},li=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),hi=a.ikp("div",{_id:"aiChatActionBar"}),ui=a.ikp("div",{_id:"aiChat__ChatActions"}),Ci=a.ikp("div",{_id:"aiChatTagline__Container"}),pi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),vi=a.ikp(Sa.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cs=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:h}=v.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!h||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const Q=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=l.getMessageContent(H),S=Ma.stringifyAttachments(H.metadata?.attributes?.attachments),$=S?`
7
+ Let me know how I can help.`,b={content:s.introMessage??`${m}${h}`,id:qa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),cn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(cn,{"data-role":e.role,...t})},mn=a.ikp("div",{_id:"aiChatMessageLoading"}),ze=t=>{const{isLoading:e,isStreaming:i,messages:s}=v.useChat(),{message:r}=P.useMessage();return!(s.at(-1)?.id===r?.id)||r.role!=="assistant"||!e||i?null:n.jsx(mn,{children:"Thinking...",...t})},ln=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(ln,{"data-role":e.role,...t})},hn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(hn,{"data-username":l.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},un=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(un,{"data-role":i.role,children:l.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),Xe=g.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:s,baseSettings:{userProperties:r}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,h=ya.useColorModeValue(c,m),[p,b]=g.useState(h);g.useEffect(()=>{b(h)},[h]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?r.name?null:s.userAvatar?n.jsx(pe,{"data-type":"image",alt:"User avatar","data-role":o.role,src:s.userAvatar,...t}):n.jsx(ka.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,alt:"AI assistant avatar","data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(Ea.default,{"data-type":"icon","data-role":o.role,...t})}),Cn=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(Cn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(pn,{"data-role":e.role,"data-has-message-buttons":l.dataAttr(!!s.length),...t})},vn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(vn,{"data-role":e.role,...t})},bn=a.ikp("div",{_id:"aiChatMessageAttachments"}),it=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(bn,{...t})})},gn=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),at=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),r=s.metadata?.attributes?.attachments;return r?n.jsx(gn,{children:l.maybeRender(e,r),...i}):null},Pn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),nt=t=>{const{attachment:e,onClick:i,...s}=t,{selectItem:r,onOpen:o}=q.useMessageAttachments(),d=()=>{r(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Pn,{onClick:u.composeEventHandlers(i,d),...s})})},An=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(An,{iconSettings:i,...t}):null},_n=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),rt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(_n,{children:e.title,...t})},Fn=a.ikp(A.Root,{_id:"aiChatMessageAttachmentsPreview"}),ot=t=>{const{onOpenChange:e,...i}=t,{selectItem:s,isOpen:r,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),s(null))};return n.jsx(Fn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(A.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(A.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(A.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(A.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),kn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(kn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=l.getMessageContent(r),{conversation:c}=O.useInkeepConversation();return r.role==="user"?n.jsx(ve,{"data-role":r.role,children:d,...s}):n.jsx(ve,{"data-role":r.role,...s,children:n.jsx(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,h)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:h?.toString(),url:m}})},onCodeCopy:(m,h)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:h}})}})})},In=a.ikp("div",{_id:"aiChatMessageToolbar"}),Ct=t=>{const{isLoading:e,messages:i}=v.useChat(),{message:s}=P.useMessage();return i.at(-1)?.id===s?.id&&e||s.role==="user"?null:n.jsx(In,{...t})},Mn=a.ikp("div",{_id:"aiChatMessageToolActions"}),pt=t=>{const{children:e,...i}=t,{message:s}=P.useMessage(),{messageButtons:r}=v.useChat(),o=r[s.id]||[];return n.jsx(Mn,{children:l.maybeRender(e,o),...i})},Sn=a.ikp("a",{_id:"aiChatMessageToolAction"}),xn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),o=()=>{r()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Sn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s}):n.jsx(xn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...s})},Bn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[h,p]=ee.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=xa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(l.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(F.CustomIcon,{iconKey:h?"messageCopied":"messageCopy"}),upvote:n.jsx(F.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(F.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":l.dataAttr(h)},upvote:{"data-upvoted":l.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":l.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Bn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${s} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...r})},fn=a.ikp("div",{_id:"aiChatMessageSources"}),gt=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(fn,{...t})},Tn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Tn,{children:"Sources",...t}),jn=a.ikp("div",{_id:"aiChatMessageSources__List"}),At=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(h=>{const p=La.transformInkeepSource(h,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(jn,{children:l.maybeRender(i,m),...s})},yn=a.ikp(Ia.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),_t=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(B.SourceItemProvider,{source:e,children:n.jsx(yn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},Hn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Ft=t=>{const{source:e}=B.useSourceItem();return e.breadcrumbs?.length?n.jsx(Hn,{"data-type":e.type,...t}):null},wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Ln=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Et=t=>{const{source:e}=B.useSourceItem();return n.jsx(Ln,{iconSettings:e.icon,"data-type":e.type,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Dn,{"data-type":e.type,children:e.title,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=B.useSourceItem();return n.jsx(On,{"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=B.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ta.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(qn,{"data-type":e.type,children:l.maybeRender(i,r),...s}):null},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=B.useSourceItem();return typeof e=="string"?e:n.jsx(Rn,{"data-type":s.type,children:e.content,"data-highlighted":l.dataAttr(e.highlighted),...i})},Wn=a.ikp(F.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=B.useSourceItem();return n.jsx(Wn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Bt=a.ikp("div",{_id:"aiChatFooter"}),ft=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Nn=a.ikp("textarea",{_id:"aiChatInput"}),jt=g.forwardRef(({onChange:t,onKeyDown:e,...i},s)=>{const{handleInputChange:r,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:h}=v.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=re.useComposedRefs(s,h);return Oa.useWidgetAutoFocus("chat",h,m),n.jsx(Nn,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Qn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Qn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(F.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),$n=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(E.AttachmentsBarProvider,{children:n.jsx($n,{...t})})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx(Vn,{children:l.maybeRender(e,s),...i})},Un=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Un,{...i})})},Kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Kn,{iconSettings:i,...t}):null},zn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(zn,{children:e.title,...t})},Gn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Rt=t=>{const{onClick:e,...i}=t,{attachment:s}=w.useAttachmentItem(),{setMessageAttachments:r}=v.useChat(),o=()=>{r(d=>d.filter(c=>c.id!==s.id))};return n.jsx(Gn,{"aria-label":"Remove attachment",children:n.jsx(F.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},Wt=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Nt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Qt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(F.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),$t=a.ikp(j.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Yn,{children:l.maybeRender(e,s.supportedInputs),...i}):null},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),Ut=t=>{const{input:e,onClick:i,...s}=t,{selectedWorkflow:r,messageAttachments:o,setMessageAttachments:d}=v.useChat(),{selectInput:c,onOpen:m}=E.useAttachmentsBar(),h=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Jn,{children:e.displayName,onClick:u.composeEventHandlers(i,h),...s})},Xn=a.ikp(A.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=E.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Xn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(A.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(A.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Zn=a.ikp(A.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Zn,{children:i,...t})},es=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=E.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(es,{children:i,...t}):null},ts=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=E.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(ts,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(A.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(F.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),is=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=E.useAttachmentsBar();return n.jsx(is,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),as=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(as,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},ns=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(ns,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":l.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ss=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.title?n.jsx(ss,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),rs=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=E.useAttachmentsBar();return n.jsx(rs,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},os=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=E.useAttachmentsBar();return n.jsx(os,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":l.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ie,{maxRows:10})})},ds=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=E.useAttachmentsBar();return e.errors.content?n.jsx(ds,{"aria-live":"polite",children:e.errors.content,...t}):null},li=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),hi=a.ikp("div",{_id:"aiChatActionBar"}),ui=a.ikp("div",{_id:"aiChat__ChatActions"}),Ci=a.ikp("div",{_id:"aiChatTagline__Container"}),pi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),vi=a.ikp(Sa.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),cs=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:h}=v.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!h||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const Q=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=l.getMessageContent(H),S=Ma.stringifyAttachments(H.metadata?.attributes?.attachments),$=S?`
8
8
 
9
9
  **Attachments**
10
10
 
@@ -325,6 +325,7 @@ const et = "__intro__", tt = i("div", {
325
325
  ve,
326
326
  {
327
327
  "data-type": "image",
328
+ alt: "User avatar",
328
329
  "data-role": r.role,
329
330
  src: s.userAvatar,
330
331
  ...t
@@ -340,6 +341,7 @@ const et = "__intro__", tt = i("div", {
340
341
  ve,
341
342
  {
342
343
  src: C,
344
+ alt: "AI assistant avatar",
343
345
  "data-type": "image",
344
346
  "data-role": r.role,
345
347
  onLoadingStatusChange: h(
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.86",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.88",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
@@ -7,7 +7,7 @@ import { useUser as A } from "./user-provider.js";
7
7
  const u = B(void 0), $ = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: s } = w(), { apiKey: r, analyticsApiBaseUrl: i, tags: a, privacyPreferences: d, env: E, analyticsProperties: c } = t, { userProperties: v } = A(), p = P(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.86",
10
+ widgetLibraryVersion: "0.5.88",
11
11
  componentType: s,
12
12
  tags: a
13
13
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.0.0-dev-20250617171939",
3
+ "version": "0.0.0-dev-20250621014709",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -63,9 +63,9 @@
63
63
  "remark-gfm": "^4.0.1",
64
64
  "unist-util-visit": "^5.0.0",
65
65
  "use-sync-external-store": "^1.4.0",
66
- "@inkeep/cxkit-color-mode": "0.0.0-dev-20250617171939",
67
- "@inkeep/cxkit-theme": "0.0.0-dev-20250617171939",
68
- "@inkeep/cxkit-types": "0.0.0-dev-20250617171939"
66
+ "@inkeep/cxkit-color-mode": "0.0.0-dev-20250621014709",
67
+ "@inkeep/cxkit-theme": "0.0.0-dev-20250621014709",
68
+ "@inkeep/cxkit-types": "0.0.0-dev-20250621014709"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@biomejs/biome": "1.9.4",