@inkeep/cxkit-primitives 0.5.112 → 0.5.114

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.
@@ -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}${l}`,id:Oa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),dn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(dn,{"data-role":e.role,...t})},cn=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(cn,{children:"Thinking...",...t})},mn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(mn,{"data-role":e.role,...t})},ln=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=p.useInkeepConfig();return n.jsx(ln,{"data-username":h.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},hn=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=p.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(hn,{"data-role":i.role,children:h.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}}=p.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=ja.useColorModeValue(c,m),[C,b]=g.useState(l);g.useEffect(()=>{b(l)},[l]);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(Fa.default,{"data-type":"icon","data-role":o.role,...t}):C?n.jsx(pe,{src:C,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})}),un=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},Cn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(Cn,{"data-role":e.role,"data-has-message-buttons":h.dataAttr(!!s.length),...t})},pn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(pn,{"data-role":e.role,...t})},vn=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(vn,{...t})})},bn=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(bn,{children:h.maybeRender(e,r),...i}):null},gn=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(gn,{onClick:u.composeEventHandlers(i,d),...s})})},Pn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Pn,{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})},An=a.ikp(_.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(An,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Fn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Fn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=p.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=O.useChatEvents(),d=h.getMessageContent(r),{conversation:c}=L.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(U.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},kn=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(kn,{...t})},In=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(In,{children:h.maybeRender(e,o),...i})},Mn=a.ikp("a",{_id:"aiChatMessageToolAction"}),Sn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),{logEvent:o}=O.useChatEvents(),{conversation:d}=L.useInkeepConversation(),c=()=>{r(),o({eventName:"tool_call_action_clicked",properties:{conversation:d}}),i.action.type!=="open_form"&&o({eventName:"user_escalation_indicated",properties:{escalationType:"contact_us",conversation:d}})},m=i.label||"Contact Support",l=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),m]});return i.action.type==="open_link"?n.jsx(Mn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...s}):n.jsx(Sn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...s})},xn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=L.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[l,C]=te.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:N}=ne.useMessageFeedback(),{logEvent:J}=O.useChatEvents(),[Q,X]=Sa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=p.useInkeepConfig(),{optOutAllAnalytics:Z}=he,ue=m.at(-1)?.id===d?.id,ee=d.role==="assistant";if(ue&&c||!ee||{copy:!1,upvote:Z,downvote:Z}[e])return null;const H={copy(){C(h.getMessageContent(d)),J({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{X()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(E.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(E.CustomIcon,{iconKey:Q?"messageCopied":"thumbsUp"}),downvote:n.jsx(E.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(b[d.id]?.type==="negative"),"data-state":N===null?"closed":"open"}};return n.jsx(xn,{"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})},Bn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Bn,{children:"Sources",...t}),Tn=a.ikp("div",{_id:"aiChatMessageSources__List"}),_t=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=p.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const C=wa.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=C.shouldOpenInNewTab!==void 0?C.shouldOpenInNewTab:d;return{...C,isExternal:b}});return n.jsx(Tn,{children:h.maybeRender(i,m),...s})},jn=a.ikp(ka.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),At=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=O.useChatEvents(),{conversation:o}=L.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(f.SourceItemProvider,{source:e,children:n.jsx(jn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},yn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Et=t=>{const{source:e}=f.useSourceItem();return e.breadcrumbs?.length?n.jsx(yn,{"data-type":e.type,...t}):null},Hn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),wn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Ft=t=>{const{source:e}=f.useSourceItem();return n.jsx(wn,{iconSettings:e.icon,"data-type":e.type,...t})},Ln=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Ln,{"data-type":e.type,children:e.title,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=f.useSourceItem();return n.jsx(Dn,{"data-type":e.type,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=f.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ba.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(On,{"data-type":e.type,children:h.maybeRender(i,r),...s}):null},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=f.useSourceItem();return typeof e=="string"?e:n.jsx(qn,{"data-type":s.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...i})},Rn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Rn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},ft=a.ikp("div",{_id:"aiChatFooter"}),Bt=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Wn=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:l}=v.useChat(),{aiChatSettings:C}=p.useInkeepConfig(),b=re.useComposedRefs(s,l);return Da.useWidgetAutoFocus("chat",l,m),n.jsx(Wn,{asChild:!0,ref:b,maxLength:99999,placeholder:C.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||C.isViewOnly,...i,children:n.jsx(ae,{})})}),Nn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=p.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Nn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(E.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),Qn=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx(Qn,{...t})})},$n=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx($n,{children:h.maybeRender(e,s),...i})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Vn,{...i})})},Un=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Un,{iconSettings:i,...t}):null},Kn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(Kn,{children:e.title,...t})},zn=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(zn,{"aria-label":"Remove attachment",children:n.jsx(E.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(E.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."]})}),Gn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Gn,{children:h.maybeRender(e,s.supportedInputs),...i}):null},Yn=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}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Yn,{children:e.displayName,onClick:u.composeEventHandlers(i,l),...s})},Jn=a.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=F.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Jn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Xn=a.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Xn,{children:i,...t})},Zn=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(Zn,{children:i,...t}):null},es=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=F.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(es,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ts=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=F.useAttachmentsBar();return n.jsx(ts,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),is=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(is,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},as=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=F.useAttachmentsBar();return n.jsx(as,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":h.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ns=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(ns,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ss=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(ss,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},rs=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=F.useAttachmentsBar();return n.jsx(rs,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":h.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ae,{maxRows:10})})},os=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(os,{"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(Ma.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),ds=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),G=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:l}=v.useChat(),{conversation:C}=L.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=p.useInkeepConfig(),{logEvent:y}=O.useChatEvents(),[N,J]=te.useCopyToClipboard(),[Q,X]=te.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!C.id||!!l||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const ee={help:()=>{},copy:()=>{const $=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(H),S=Ia.stringifyAttachments(H.metadata?.attributes?.attachments),V=S?`
7
+ Let me know how I can help.`,b={content:s.introMessage??`${m}${l}`,id:Oa,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),dn=a.ikp("div",{_id:"aiChatMessageHeader"}),Ke=t=>{const{message:e}=P.useMessage();return n.jsx(dn,{"data-role":e.role,...t})},cn=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(cn,{children:"Thinking...",...t})},mn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(mn,{"data-role":e.role,...t})},ln=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Ye=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=p.useInkeepConfig();return n.jsx(ln,{"data-username":h.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},hn=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Je=g.memo(t=>{const{baseSettings:e}=p.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(hn,{"data-role":i.role,children:h.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}}=p.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=s??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=ja.useColorModeValue(c,m),[C,b]=g.useState(l);g.useEffect(()=>{b(l)},[l]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?s.userAvatar?n.jsx(pe,{"data-type":"image",alt:"User avatar","data-role":o.role,src:s.userAvatar,...t}):r.name?null:n.jsx(Fa.default,{"data-type":"icon","data-role":o.role,...t}):C?n.jsx(pe,{src:C,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})}),un=a.ikp("span",{_id:"aiChatMessageName"}),Ze=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},Cn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),et=t=>{const{message:e}=P.useMessage(),{messageButtons:i}=v.useChat(),s=i[e.id]||[];return n.jsx(Cn,{"data-role":e.role,"data-has-message-buttons":h.dataAttr(!!s.length),...t})},pn=a.ikp("div",{_id:"aiChatMessageContent"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(pn,{"data-role":e.role,...t})},vn=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(vn,{...t})})},bn=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(bn,{children:h.maybeRender(e,r),...i}):null},gn=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(gn,{onClick:u.composeEventHandlers(i,d),...s})})},Pn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),st=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Pn,{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})},An=a.ikp(_.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(An,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},dt=a.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),ct=a.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),En=a.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),mt=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(En,{children:e?.title||"Attachment",...t})},lt=a.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Fn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Fn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),ut=t=>{const{aiChatSettings:e}=p.useInkeepConfig(),{componentStyles:i,...s}=t,{message:r}=P.useMessage(),{logEvent:o}=O.useChatEvents(),d=h.getMessageContent(r),{conversation:c}=L.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(U.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},kn=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(kn,{...t})},In=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(In,{children:h.maybeRender(e,o),...i})},Mn=a.ikp("a",{_id:"aiChatMessageToolAction"}),Sn=a.ikp("button",{_id:"aiChatMessageToolAction"}),vt=t=>{const{onClick:e,action:i,...s}=t,{handleAction:r}=se.useChatAction(i),{logEvent:o}=O.useChatEvents(),{conversation:d}=L.useInkeepConversation(),c=()=>{r(),o({eventName:"tool_call_action_clicked",properties:{conversation:d}}),i.action.type!=="open_form"&&o({eventName:"user_escalation_indicated",properties:{escalationType:"contact_us",conversation:d}})},m=i.label||"Contact Support",l=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),m]});return i.action.type==="open_link"?n.jsx(Mn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...s}):n.jsx(Sn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,c),children:l,...s})},xn=a.ikp("button",{_id:"aiChatMessageAction"}),bt=t=>{const{action:e,onClick:i,className:s,...r}=t,{conversation:o}=L.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=v.useChat(),[l,C]=te.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:N}=ne.useMessageFeedback(),{logEvent:J}=O.useChatEvents(),[Q,X]=Sa.useSettleAction(),{baseSettings:{privacyPreferences:he}}=p.useInkeepConfig(),{optOutAllAnalytics:Z}=he,ue=m.at(-1)?.id===d?.id,ee=d.role==="assistant";if(ue&&c||!ee||{copy:!1,upvote:Z,downvote:Z}[e])return null;const H={copy(){C(h.getMessageContent(d)),J({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{X()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(E.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(E.CustomIcon,{iconKey:Q?"messageCopied":"thumbsUp"}),downvote:n.jsx(E.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(b[d.id]?.type==="negative"),"data-state":N===null?"closed":"open"}};return n.jsx(xn,{"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})},Bn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),Pt=t=>n.jsx(Bn,{children:"Sources",...t}),Tn=a.ikp("div",{_id:"aiChatMessageSources__List"}),_t=t=>{const{message:e}=P.useMessage(),{children:i,...s}=t,{baseSettings:{transformSource:r,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=p.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const C=wa.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:r}),b=C.shouldOpenInNewTab!==void 0?C.shouldOpenInNewTab:d;return{...C,isExternal:b}});return n.jsx(Tn,{children:h.maybeRender(i,m),...s})},jn=a.ikp(ka.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),At=t=>{const{source:e,onClick:i,...s}=t,{logEvent:r}=O.useChatEvents(),{conversation:o}=L.useInkeepConversation(),d=()=>{r({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(f.SourceItemProvider,{source:e,children:n.jsx(jn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...s})})},yn=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),Et=t=>{const{source:e}=f.useSourceItem();return e.breadcrumbs?.length?n.jsx(yn,{"data-type":e.type,...t}):null},Hn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),wn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),Ft=t=>{const{source:e}=f.useSourceItem();return n.jsx(wn,{iconSettings:e.icon,"data-type":e.type,...t})},Ln=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),kt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Ln,{"data-type":e.type,children:e.title,...t})},Dn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),It=t=>{const{source:e}=f.useSourceItem();return n.jsx(Dn,{"data-type":e.type,...t})},On=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),Mt=t=>{const{source:e}=f.useSourceItem(),{children:i,...s}=t,r=g.useMemo(()=>e.description?Ba.highlightEmphasis(e.description):[],[e.description]);return r.length?n.jsx(On,{"data-type":e.type,children:h.maybeRender(i,r),...s}):null},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),St=t=>{const{part:e,...i}=t,{source:s}=f.useSourceItem();return typeof e=="string"?e:n.jsx(qn,{"data-type":s.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...i})},Rn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),xt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Rn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},ft=a.ikp("div",{_id:"aiChatFooter"}),Bt=a.ikp("div",{_id:"aiChatInput__Fieldset"}),Tt=a.ikp("div",{_id:"aiChatInput__Group"}),Wn=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:l}=v.useChat(),{aiChatSettings:C}=p.useInkeepConfig(),b=re.useComposedRefs(s,l);return Da.useWidgetAutoFocus("chat",l,m),n.jsx(Wn,{asChild:!0,ref:b,maxLength:99999,placeholder:C.placeholder,value:d,onChange:u.composeEventHandlers(t,r),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||C.isViewOnly,...i,children:n.jsx(ae,{})})}),Nn=a.ikp("button",{_id:"aiChatInput__SendButton"}),yt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:s}=v.useChat(),{aiChatSettings:r}=p.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Nn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!s||r.isViewOnly,...d})},Ht=a.ikp(E.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),Qn=a.ikp("div",{_id:"aiChatAttachmentsBar"}),wt=t=>{const{selectedWorkflow:e}=v.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx(Qn,{...t})})},$n=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Lt=t=>{const{children:e,...i}=t,{messageAttachments:s}=v.useChat();return n.jsx($n,{children:h.maybeRender(e,s),...i})},Vn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),Dt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Vn,{...i})})},Un=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Un,{iconSettings:i,...t}):null},Kn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),qt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(Kn,{children:e.title,...t})},zn=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(zn,{"aria-label":"Remove attachment",children:n.jsx(E.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(E.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."]})}),Gn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Vt=t=>{const{children:e,...i}=t,{selectedWorkflow:s}=v.useChat();return s?.supportedInputs?n.jsx(Gn,{children:h.maybeRender(e,s.supportedInputs),...i}):null},Yn=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}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return r?e.onInvoke(r,e,d,[...o]):void 0;c(e),m()};return n.jsx(Yn,{children:e.displayName,onClick:u.composeEventHandlers(i,l),...s})},Jn=a.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Kt=t=>{const{onOpenChange:e,...i}=t,{selectInput:s,isOpen:r,onClose:o,selectedInput:d}=F.useAttachmentsBar(),c=m=>{m||(o(),s(null))};return n.jsx(Jn,{open:r&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},zt=a.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Gt=a.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Yt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),Xn=a.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),Jt=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(Xn,{children:i,...t})},Zn=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),Xt=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(Zn,{children:i,...t}):null},es=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),Zt=t=>{const{children:e,...i}=t,{selectedInput:s}=F.useAttachmentsBar(),r=s?.workflowModalProps?.modalHelpElement;return r?n.jsx(es,{asChild:!e,children:e||r,...i}):null},ei=a.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),ti=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),ts=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ii=t=>{const{onSubmit:e,...i}=t,{form:s}=F.useAttachmentsBar();return n.jsx(ts,{onSubmit:u.composeEventHandlers(e,s.onSubmit),...i})},ai=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),is=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),ni=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(is,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},as=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),si=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=F.useAttachmentsBar();return n.jsx(as,{name:"title",value:s.data.title,id:`${r?.id}-title`,"data-invalid":h.dataAttr(!!s.errors.title),"aria-invalid":!!s.errors.title,onChange:u.composeEventHandlers(e,s.onChange),...i})},ns=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ri=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(ns,{"aria-live":"polite",children:e.errors.title,...t}):null},oi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),ss=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),di=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(ss,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},rs=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),ci=t=>{const{onChange:e,...i}=t,{form:s,selectedInput:r}=F.useAttachmentsBar();return n.jsx(rs,{asChild:!0,rows:4,name:"content",value:s.data.content,id:`${r?.id}-content`,"data-invalid":h.dataAttr(!!s.errors.content),"aria-invalid":!!s.errors.content,onChange:u.composeEventHandlers(e,s.onChange),...i,children:n.jsx(ae,{maxRows:10})})},os=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),mi=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(os,{"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(Ma.default,{_id:"aiChatTagline__Logo"}),bi=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),ds=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),G=t=>{const{action:e,onClick:i,className:s,...r}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:l}=v.useChat(),{conversation:C}=L.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=p.useInkeepConfig(),{logEvent:y}=O.useChatEvents(),[N,J]=te.useCopyToClipboard(),[Q,X]=te.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!C.id||!!l||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const ee={help:()=>{},copy:()=>{const $=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(H),S=Ia.stringifyAttachments(H.metadata?.attributes?.attachments),V=S?`
8
8
 
9
9
  **Attachments**
10
10
 
@@ -321,7 +321,7 @@ const ct = "__intro__", dt = i("div", {
321
321
  const I = (T) => {
322
322
  T === "error" && v(null);
323
323
  };
324
- return r.role === "user" ? o.name ? null : s.userAvatar ? /* @__PURE__ */ n(
324
+ return r.role === "user" ? s.userAvatar ? /* @__PURE__ */ n(
325
325
  pe,
326
326
  {
327
327
  "data-type": "image",
@@ -330,7 +330,7 @@ const ct = "__intro__", dt = i("div", {
330
330
  src: s.userAvatar,
331
331
  ...t
332
332
  }
333
- ) : /* @__PURE__ */ n(
333
+ ) : o.name ? null : /* @__PURE__ */ n(
334
334
  xe,
335
335
  {
336
336
  "data-type": "icon",
package/dist/index.d.cts CHANGED
@@ -1400,6 +1400,54 @@ declare const defaultInkeepBaseSettings: {
1400
1400
  '8xl': string;
1401
1401
  '9xl': string;
1402
1402
  };
1403
+ spacing: {
1404
+ 0: string;
1405
+ px: string;
1406
+ 0.5: string;
1407
+ 1: string;
1408
+ 1.5: string;
1409
+ 2: string;
1410
+ 2.5: string;
1411
+ 3: string;
1412
+ 3.5: string;
1413
+ 4: string;
1414
+ 5: string;
1415
+ 6: string;
1416
+ 7: string;
1417
+ 8: string;
1418
+ 9: string;
1419
+ 10: string;
1420
+ 11: string;
1421
+ 12: string;
1422
+ 14: string;
1423
+ 16: string;
1424
+ 20: string;
1425
+ 24: string;
1426
+ 28: string;
1427
+ 32: string;
1428
+ 36: string;
1429
+ 40: string;
1430
+ 44: string;
1431
+ 48: string;
1432
+ 52: string;
1433
+ 56: string;
1434
+ 60: string;
1435
+ 64: string;
1436
+ 72: string;
1437
+ 80: string;
1438
+ 96: string;
1439
+ };
1440
+ borderRadius: {
1441
+ none: string;
1442
+ sm: string;
1443
+ DEFAULT: string;
1444
+ md: string;
1445
+ lg: string;
1446
+ xl: string;
1447
+ '2xl': string;
1448
+ '3xl': string;
1449
+ full: string;
1450
+ };
1403
1451
  zIndex: {
1404
1452
  hide: number;
1405
1453
  auto: string;
package/dist/index.d.ts CHANGED
@@ -1400,6 +1400,54 @@ declare const defaultInkeepBaseSettings: {
1400
1400
  '8xl': string;
1401
1401
  '9xl': string;
1402
1402
  };
1403
+ spacing: {
1404
+ 0: string;
1405
+ px: string;
1406
+ 0.5: string;
1407
+ 1: string;
1408
+ 1.5: string;
1409
+ 2: string;
1410
+ 2.5: string;
1411
+ 3: string;
1412
+ 3.5: string;
1413
+ 4: string;
1414
+ 5: string;
1415
+ 6: string;
1416
+ 7: string;
1417
+ 8: string;
1418
+ 9: string;
1419
+ 10: string;
1420
+ 11: string;
1421
+ 12: string;
1422
+ 14: string;
1423
+ 16: string;
1424
+ 20: string;
1425
+ 24: string;
1426
+ 28: string;
1427
+ 32: string;
1428
+ 36: string;
1429
+ 40: string;
1430
+ 44: string;
1431
+ 48: string;
1432
+ 52: string;
1433
+ 56: string;
1434
+ 60: string;
1435
+ 64: string;
1436
+ 72: string;
1437
+ 80: string;
1438
+ 96: string;
1439
+ };
1440
+ borderRadius: {
1441
+ none: string;
1442
+ sm: string;
1443
+ DEFAULT: string;
1444
+ md: string;
1445
+ lg: string;
1446
+ xl: string;
1447
+ '2xl': string;
1448
+ '3xl': string;
1449
+ full: string;
1450
+ };
1403
1451
  zIndex: {
1404
1452
  hide: number;
1405
1453
  auto: string;
@@ -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.112",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.114",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.112",
10
+ widgetLibraryVersion: "0.5.114",
11
11
  componentType: s,
12
12
  tags: a
13
13
  }),
@@ -1,3 +1,3 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("@inkeep/cxkit-theme"),D=require("@inkeep/cxkit-color-mode"),H=require("./config-provider.cjs"),L=require("merge-anything"),z=require("../atoms/custom-styles.cjs"),i=require("react"),E=({children:g})=>{const{baseSettings:y}=H.useInkeepConfig(),{theme:s,primaryBrandColor:h,shadowHost:f,rootElement:b,colorMode:S}=y,{primaryColors:C,varsClassName:M}=s,{disableLoadingDefaultFont:p,fontFamily:v,fontSize:x,zIndex:q}=s,k=m.createColorScheme(C,h),T={colors:L.merge(s.colors,k),fontFamily:v,fontSize:x,zIndex:q},j=m.createCSSVariables(T),{customStyles:I,loaded:w}=z.useCustomStyles(),{sync:e,forcedColorMode:P,...F}=S??{},[R,l]=i.useState(),V=i.useRef(null);return i.useEffect(()=>{if(!e?.target)return;const o=typeof e.target=="string"?document.querySelector(e.target):e.target;if(!o)return;function a(c,r){return r.reduce((A,d)=>({...A,[d]:c.getAttribute(d)}),{})}const n=new MutationObserver(()=>{const c=a(o,e.attributes),r=e.isDarkMode?.(c)?"dark":"light";e.onChange?.(r),l(r)});n.observe(o,{attributes:!0,attributeFilter:e.attributes,childList:!1,subtree:!1}),V.current=n;const u=e.isDarkMode?.(a(o,e?.attributes))?"dark":"light";return e.onChange?.(u),l(u),()=>n.disconnect()},[e]),t.jsxs(t.Fragment,{children:[!p&&t.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:`
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("@inkeep/cxkit-theme"),L=require("@inkeep/cxkit-color-mode"),z=require("./config-provider.cjs"),E=require("merge-anything"),N=require("../atoms/custom-styles.cjs"),i=require("react"),O=({children:g})=>{const{baseSettings:y}=z.useInkeepConfig(),{theme:s,primaryBrandColor:h,shadowHost:f,rootElement:b,colorMode:S}=y,{primaryColors:C,varsClassName:M}=s,{disableLoadingDefaultFont:p,fontFamily:v,fontSize:x,spacing:q,borderRadius:k,zIndex:T}=s,j=m.createColorScheme(C,h),I={colors:E.merge(s.colors,j),fontFamily:v,fontSize:x,spacing:q,borderRadius:k,zIndex:T},w=m.createCSSVariables(I),{customStyles:P,loaded:R}=N.useCustomStyles(),{sync:e,forcedColorMode:F,...V}=S??{},[A,l]=i.useState(),D=i.useRef(null);return i.useEffect(()=>{if(!e?.target)return;const o=typeof e.target=="string"?document.querySelector(e.target):e.target;if(!o)return;function a(c,r){return r.reduce((H,d)=>({...H,[d]:c.getAttribute(d)}),{})}const n=new MutationObserver(()=>{const c=a(o,e.attributes),r=e.isDarkMode?.(c)?"dark":"light";e.onChange?.(r),l(r)});n.observe(o,{attributes:!0,attributeFilter:e.attributes,childList:!1,subtree:!1}),D.current=n;const u=e.isDarkMode?.(a(o,e?.attributes))?"dark":"light";return e.onChange?.(u),l(u),()=>n.disconnect()},[e]),t.jsxs(t.Fragment,{children:[!p&&t.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:`
2
2
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');
3
- `}}),I,w&&t.jsx(D.ColorModeProvider,{forcedColorMode:P??R,...F,shadowHostId:f?.id,rootId:b?.id,children:t.jsx("div",{className:M,style:{display:"contents",...j},children:g})})]})};exports.ThemeProvider=E;
3
+ `}}),P,R&&t.jsx(L.ColorModeProvider,{forcedColorMode:F??A,...V,shadowHostId:f?.id,rootId:b?.id,children:t.jsx("div",{className:M,style:{display:"contents",...w},children:g})})]})};exports.ThemeProvider=O;
@@ -1,26 +1,28 @@
1
1
  "use client";
2
- import { jsxs as j, Fragment as z, jsx as c } from "react/jsx-runtime";
3
- import { createColorScheme as A, createCSSVariables as E } from "@inkeep/cxkit-theme";
4
- import { ColorModeProvider as N } from "@inkeep/cxkit-color-mode";
5
- import { useInkeepConfig as P } from "./config-provider.js";
6
- import { merge as R } from "merge-anything";
7
- import { useCustomStyles as _ } from "../atoms/custom-styles.js";
8
- import { useState as q, useRef as B, useEffect as O } from "react";
9
- const Z = ({ children: u }) => {
10
- const { baseSettings: m } = P(), { theme: r, primaryBrandColor: f, shadowHost: g, rootElement: p, colorMode: y } = m, { primaryColors: h, varsClassName: b } = r, { disableLoadingDefaultFont: C, fontFamily: M, fontSize: S, zIndex: v } = r, I = A(h, f), k = {
11
- colors: R(r.colors, I),
2
+ import { jsxs as z, Fragment as A, jsx as c } from "react/jsx-runtime";
3
+ import { createColorScheme as E, createCSSVariables as N } from "@inkeep/cxkit-theme";
4
+ import { ColorModeProvider as P } from "@inkeep/cxkit-color-mode";
5
+ import { useInkeepConfig as _ } from "./config-provider.js";
6
+ import { merge as q } from "merge-anything";
7
+ import { useCustomStyles as B } from "../atoms/custom-styles.js";
8
+ import { useState as O, useRef as G, useEffect as J } from "react";
9
+ const ee = ({ children: u }) => {
10
+ const { baseSettings: m } = _(), { theme: r, primaryBrandColor: f, shadowHost: g, rootElement: p, colorMode: y } = m, { primaryColors: h, varsClassName: b } = r, { disableLoadingDefaultFont: C, fontFamily: M, fontSize: S, spacing: v, borderRadius: I, zIndex: k } = r, w = E(h, f), x = {
11
+ colors: q(r.colors, w),
12
12
  fontFamily: M,
13
13
  fontSize: S,
14
- zIndex: v
15
- }, w = E(k), { customStyles: x, loaded: F } = _(), { sync: e, forcedColorMode: T, ...V } = y ?? {}, [D, a] = q(), H = B(null);
16
- return O(() => {
14
+ spacing: v,
15
+ borderRadius: I,
16
+ zIndex: k
17
+ }, F = N(x), { customStyles: T, loaded: V } = B(), { sync: e, forcedColorMode: D, ...H } = y ?? {}, [L, a] = O(), R = G(null);
18
+ return J(() => {
17
19
  if (!e?.target) return;
18
20
  const t = typeof e.target == "string" ? document.querySelector(e.target) : e.target;
19
21
  if (!t) return;
20
22
  function i(n, o) {
21
23
  return o.reduce(
22
- (L, d) => ({
23
- ...L,
24
+ (j, d) => ({
25
+ ...j,
24
26
  [d]: n.getAttribute(d)
25
27
  }),
26
28
  {}
@@ -35,10 +37,10 @@ const Z = ({ children: u }) => {
35
37
  attributeFilter: e.attributes,
36
38
  childList: !1,
37
39
  subtree: !1
38
- }), H.current = s;
40
+ }), R.current = s;
39
41
  const l = e.isDarkMode?.(i(t, e?.attributes)) ? "dark" : "light";
40
42
  return e.onChange?.(l), a(l), () => s.disconnect();
41
- }, [e]), /* @__PURE__ */ j(z, { children: [
43
+ }, [e]), /* @__PURE__ */ z(A, { children: [
42
44
  !C && /* @__PURE__ */ c(
43
45
  "style",
44
46
  {
@@ -50,12 +52,12 @@ const Z = ({ children: u }) => {
50
52
  }
51
53
  }
52
54
  ),
53
- x,
54
- F && /* @__PURE__ */ c(
55
- N,
55
+ T,
56
+ V && /* @__PURE__ */ c(
57
+ P,
56
58
  {
57
- forcedColorMode: T ?? D,
58
- ...V,
59
+ forcedColorMode: D ?? L,
60
+ ...H,
59
61
  shadowHostId: g?.id,
60
62
  rootId: p?.id,
61
63
  children: /* @__PURE__ */ c(
@@ -64,7 +66,7 @@ const Z = ({ children: u }) => {
64
66
  className: b,
65
67
  style: {
66
68
  display: "contents",
67
- ...w
69
+ ...F
68
70
  },
69
71
  children: u
70
72
  }
@@ -74,5 +76,5 @@ const Z = ({ children: u }) => {
74
76
  ] });
75
77
  };
76
78
  export {
77
- Z as ThemeProvider
79
+ ee as ThemeProvider
78
80
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.112",
3
+ "version": "0.5.114",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -67,9 +67,9 @@
67
67
  "remark-gfm": "^4.0.1",
68
68
  "unist-util-visit": "^5.0.0",
69
69
  "use-sync-external-store": "^1.4.0",
70
- "@inkeep/cxkit-color-mode": "^0.5.112",
71
- "@inkeep/cxkit-theme": "0.5.112",
72
- "@inkeep/cxkit-types": "0.5.112"
70
+ "@inkeep/cxkit-color-mode": "^0.5.114",
71
+ "@inkeep/cxkit-theme": "0.5.114",
72
+ "@inkeep/cxkit-types": "0.5.114"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@biomejs/biome": "1.9.4",