1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[698],{698:(e,r,t)=>{t.d(r,{A:()=>O});var l=t(37876),o=t(14232),n=t(39822),i=t(72953),a=t(92146),s=t(30488),d=t(1924),c=t(9463),p=t(84361),u=t(14741),g=t(53224),x=t(44276),h=t(70294),m=t(82703),b=t(80161),y=t(12324),f=t(26849),j=t(34214),v=t(33203),w=t(51231),S=t(11382);let k=new Set(["widget","ai_page","playground"]);var _=t(83239),z=t(40950),C=t(31047),W=t(88293),E=t(4741),A=t(24426),M=t(32510),N=t(30466),R=t(45146),I=t(67765),H=t(39062);let B=new Set(["product_grid","products","product_card","product_detail","actions","carousel","image_carousel"]),L=/```(\w+)?\n([\s\S]*?)```/g;function T(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch(r){return e.trim()}}function q(e,r){for(let t of r.split(/\n\n+/)){let r=t.trim();if(!r)continue;let l=function(e){let r=e.trim();return r?r.startsWith("[")&&(0,I.d)(r)?"product_grid":r.startsWith("{")&&(0,R.G)(r)?"product_card":r.startsWith("[")&&(0,H.WB)(r)?"actions":null:null}(r);l?e.push({type:"json",blockType:l,content:T(r)}):e.push({type:"text",content:r})}}let K=e=>{let{content:r,isDark:t}=e,[d,c]=(0,o.useState)(!1);return(0,l.jsxs)(n.a,{mt:2,children:[(0,l.jsx)(i.$,{type:"button",onClick:()=>c(e=>!e),"aria-expanded":d,size:"2xs",variant:"ghost",bg:t?"gray.700":"gray.100",color:t?"gray.300":"gray.600",borderRadius:"full",px:2,py:0,h:"auto",minH:"20px",fontSize:"xs",fontWeight:"normal",_hover:{bg:t?"gray.600":"gray.200"},children:(0,l.jsxs)(a.z,{gap:1,alignItems:"center",children:[d?(0,l.jsx)(h.fK4,{size:11}):(0,l.jsx)(h.fOo,{size:11}),(0,l.jsx)(s.E,{fontSize:"xs",children:d?"Hide previous conversation":"Show previous conversation"})]})}),d&&(0,l.jsx)(n.a,{mt:2,pl:3,borderLeftWidth:"3px",borderLeftColor:t?"gray.600":"gray.300",color:t?"gray.400":"gray.600",children:(0,l.jsx)(s.E,{fontSize:"xs",whiteSpace:"pre-wrap",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:r})})]})},O=o.memo(e=>{var r,t;let{message:R,sessionId:I,sessionMetadata:H,sessionFeedback:O,channel:P="widget",agentId:D,isDisabled:F=!1,nextCustomerText:Y=null,hiddenErrorTypes:$}=e,{resolvedTheme:G}=(0,m.j)(),[J,X]=(0,o.useState)(!1),[Q,V]=(0,o.useState)("rendered"),Z="dark"===G,U=Z?"gray.800":"gray.50",ee=b.kY.blockBorderColor[G],er=Z?"gray.400":"gray.500",et=b.kY.blockBgColor[G],el=(0,o.useMemo)(()=>(0,y.A)({codeblock:{backgroundColor:et}},void 0,void 0,G,"sm",void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,{clickedQuickActionMessage:Y}),[et,G,Y]),eo=(0,o.useMemo)(()=>[g.A],[]),en=(0,o.useMemo)(()=>[x.A],[]),ei=!!R.role&&!!R.content&&!R.question&&!R.answer,ea=!ei&&(null!==R.question||null!==R.answer),es=(0,o.useMemo)(()=>{let e=(0,M.iZ)(R);if(!(null==$?void 0:$.length))return e;let r=new Set($);return e.filter(e=>!r.has(e))},[R,$]),ed=(0,o.useMemo)(()=>(function(e,r){let t=function(e){var r;if(!e||"transfer_to_human"===e.type)return null;let t=null==(r=e.reference)?void 0:r.trim();return t?"escalate_to_inbox"===e.type?{source:"escalate_to_inbox",reference:t}:"create_zendesk_ticket"===e.type?{source:"create_zendesk_ticket",reference:t}:null:null}(e);return t?[t]:(0,w.Q)(r).tickets})(R.escalation,R.answer),[R.escalation,R.answer]),ec=function(e){return(null==e?void 0:e.type)==="transfer_to_human"}(R.escalation)&&function(e){return k.has((null!=e?e:"").toLowerCase())}(P),ep=e=>{if(!e)return"N/A";try{return(0,p.GP)(new Date(e),"MMM dd, yyyy HH:mm")}catch(r){return e}},eu=(e,r)=>{let t,o,i,a;switch(e){case"customer":t=Z?"blue.200":"blue.700",o=Z?"blue.900":"blue.50",i=Z?"blue.700":"blue.200",a="Customer";break;case"ai":t=Z?"purple.200":"purple.700",o=Z?"purple.900":"purple.50",i=Z?"purple.700":"purple.200",a="AI Agent";break;case"copilot":t=Z?"teal.200":"teal.700",o=Z?"teal.900":"teal.50",i=Z?"teal.700":"teal.200",a="AI Copilot";break;case"human":t=Z?"green.200":"green.700",o=Z?"green.900":"green.50",i=Z?"green.700":"green.200",a=r||"Agent";break;case"note":t=Z?"yellow.200":"yellow.700",o=Z?"yellow.900":"yellow.50",i=Z?"yellow.700":"yellow.200",a=r||"Note";break;default:t=Z?"gray.300":"gray.600",o=Z?"gray.800":"gray.100",i=Z?"gray.600":"gray.300",a=e}return(0,l.jsx)(n.a,{px:1.5,py:0,borderRadius:"sm",bg:o,borderWidth:"1px",borderColor:i,children:(0,l.jsx)(s.E,{fontSize:"xs",fontWeight:"medium",color:t,children:a})})};if(ei){let e=R.role,t="customer"===e,o="note"===e,i=(0,_.r)(R.sender_name,R.sender_email);return(0,l.jsxs)(n.a,{p:4,borderRadius:"md",borderWidth:"1px",borderColor:t?Z?"blue.700":"blue.200":ee,bg:t?Z?"blue.900":"blue.50":U,children:[(0,l.jsxs)(a.z,{mb:2,gap:2,flexWrap:"wrap",children:[eu(e,"human"===e&&i?i:"note"===e&&i?"Note by ".concat(i):void 0),(0,l.jsx)(s.E,{fontSize:"sm",color:er,children:ep(R.created_at)})]}),o?(0,l.jsx)(s.E,{fontSize:"sm",whiteSpace:"pre-wrap",fontStyle:"italic",children:R.content}):(0,l.jsx)(s.E,{fontSize:"sm",whiteSpace:"pre-wrap",children:R.content}),t&&!!(null==(r=R.quoted_content)?void 0:r.trim())&&(0,l.jsx)(K,{content:R.quoted_content,isDark:Z}),(()=>{let e=(0,E.d6)(R.attachments,R.images_urls);return 0===e.length?null:(0,l.jsx)(a.z,{gap:2,flexWrap:"wrap",mt:2,children:e.map((e,r)=>(0,l.jsx)(W.E,{resolved:e,imageMaxH:"180px",imageMaxW:"240px",borderColor:ee},e.key||e.url||r))})})()]})}return ea?(0,l.jsxs)(d.T,{align:"stretch",gap:3,children:[(0,l.jsxs)(n.a,{p:4,borderRadius:"md",borderWidth:"1px",borderColor:Z?"blue.700":"blue.200",bg:Z?"blue.900":"blue.50",children:[(0,l.jsxs)(a.z,{mb:2,gap:2,flexWrap:"wrap",children:[eu("customer"),(0,l.jsx)(s.E,{fontSize:"sm",color:er,children:ep(R.created_at)})]}),(0,l.jsx)(s.E,{fontSize:"sm",whiteSpace:"pre-wrap",children:R.question||"N/A"}),!!(null==(t=R.quoted_content)?void 0:t.trim())&&(0,l.jsx)(K,{content:R.quoted_content,isDark:Z}),(()=>{let e=(0,E.d6)(R.attachments,R.images_urls);if(0===e.length)return null;let r=Z?"blue.700":"blue.200";return(0,l.jsx)(a.z,{gap:2,flexWrap:"wrap",mt:2,children:e.map((e,t)=>(0,l.jsx)(W.E,{resolved:e,imageMaxH:"180px",imageMaxW:"240px",borderColor:r},e.key||e.url||t))})})(),R.page_url&&(0,l.jsxs)(a.z,{mt:2,gap:1,alignItems:"center",children:[(0,l.jsx)(h.HaR,{size:11,color:Z?"#A0AEC0":"#718096",style:{flexShrink:0}}),(0,l.jsx)(s.E,{fontSize:"xs",color:er,flexShrink:0,children:"Browsing"}),(0,l.jsx)("a",{href:R.page_url,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.75rem",color:Z?"#63B3ED":"#2B6CB0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.page_url})]})]}),(0,l.jsxs)(n.a,{p:4,borderRadius:"md",borderWidth:"1px",borderColor:ee,bg:U,borderLeftWidth:R.copilot_mode?"3px":"1px",borderLeftColor:R.copilot_mode?Z?"teal.500":"teal.400":ee,children:[(0,l.jsxs)(a.z,{mb:2,gap:2,flexWrap:"wrap",children:[eu(R.copilot_mode?"copilot":"ai"),(0,l.jsx)(s.E,{fontSize:"sm",color:er,children:ep(R.created_at)}),es.length>0&&(0,l.jsx)(A.X_,{types:es,labelStyle:"display"})]}),R.answer?"rendered"===Q?(0,l.jsx)(n.a,{fontSize:"sm",children:(0,l.jsx)(u.oz,{rehypePlugins:en,remarkPlugins:eo,components:el,children:(0,f.m)(R.answer)})}):(0,l.jsx)(d.T,{align:"stretch",gap:3,fontSize:"sm",children:(function(e){let r,t=(0,f.m)(e);if(!t)return[];let l=[],o=0;for(L.lastIndex=0;null!==(r=L.exec(t));){let e=t.slice(o,r.index);e.trim()&&q(l,e);let n=(r[1]||"text").toLowerCase(),i=r[2].replace(/\n$/,"");B.has(n)?l.push({type:"json",blockType:n,content:T(i)}):l.push({type:"json",blockType:n,content:i.trim()}),o=r.index+r[0].length}let n=t.slice(o);return n.trim()&&q(l,n),l})(R.answer).map((e,r)=>"text"===e.type?(0,l.jsx)(s.E,{whiteSpace:"pre-wrap",children:e.content},r):(0,l.jsx)(n.a,{css:{"& .codeblock":{marginBottom:0,fontSize:"12px"}},children:(0,l.jsx)(N.N,{language:"json",value:e.content})},r))}):(0,l.jsx)(s.E,{fontSize:"sm",color:er,fontStyle:"italic",children:"N/A"}),ec&&(0,l.jsx)(n.a,{mt:2,children:(0,l.jsx)(v.Y,{text:(0,S.h$)("en").transferToHumanNotice,colorMode:G})}),ed.length>0&&(0,l.jsx)(d.T,{align:"stretch",gap:1.5,mt:2,children:ed.map((e,r)=>(0,l.jsx)(j.f,{ticket:e,colorMode:G,language:"en"},"".concat(e.source,"-").concat(e.reference,"-").concat(r)))}),(0,l.jsxs)(a.z,{mt:3,gap:2,alignItems:"center",flexWrap:"wrap",children:[R.answer&&(0,l.jsxs)(a.z,{gap:.5,mr:1,children:[(0,l.jsx)(c.K,{"aria-label":"Rendered view",size:"xs",variant:"rendered"===Q?"solid":"ghost",bg:"rendered"===Q?Z?"gray.600":"gray.300":void 0,color:Z?"gray.200":"gray.700",_hover:{bg:"rendered"===Q?Z?"gray.500":"gray.400":Z?"gray.700":"gray.200"},onClick:()=>V("rendered"),borderRadius:"md",children:(0,l.jsx)(h.Iy6,{size:12})}),(0,l.jsx)(c.K,{"aria-label":"JSON view",size:"xs",variant:"json"===Q?"solid":"ghost",bg:"json"===Q?Z?"gray.600":"gray.300":void 0,color:Z?"gray.200":"gray.700",_hover:{bg:"json"===Q?Z?"gray.500":"gray.400":Z?"gray.700":"gray.200"},onClick:()=>V("json"),borderRadius:"md",children:(0,l.jsx)(h.PjK,{size:12})})]}),(0,l.jsx)(i.$,{size:"xs",variant:"ghost",onClick:()=>X(!0),color:Z?"gray.400":"gray.600",_hover:{bg:Z?"gray.700":"gray.200"},children:(0,l.jsxs)(a.z,{gap:1,children:[(0,l.jsx)(h.Vap,{size:12}),(0,l.jsx)("span",{children:"Show AI logic"})]})})]})]}),(0,l.jsx)(z.A,{isOpen:J,onClose:()=>X(!1),title:"Reasoning, actions & prompt",onSubmit:()=>X(!1),showActions:!1,children:(0,l.jsx)(C.A,{reasoning:R.reasoning,toolCalls:R.tool_calls,prompt:R.prompt,errors:R.errors,model:R.model,modelLabel:R.model_label,thinkingLevel:R.thinking_level})})]}):null})},24426:(e,r,t)=>{t.d(r,{Fo:()=>x,KW:()=>c,X_:()=>p,vu:()=>g});
1var l=t(37876);t(14232);var o=t(39822),n=t(92146),i=t(30488),a=t(70294),s=t(82703),d=t(32510);let c=e=>{let{type:r,labelStyle:t="short",onSelect:a,selected:c=!1}=e,{resolvedTheme:p}=(0,s.j)(),u="dark"===p,g=(0,d.Xw)(r,t);if(!g)return null;let x=(0,d.Kr)(r),h=!!a;return(0,l.jsx)(o.a,{display:"inline-flex",bg:u?"red.900":"red.50",borderWidth:"1px",borderColor:c?x:u?"red.700":"red.200",boxShadow:c?"0 0 0 1px ".concat(x):void 0,px:1.5,py:.5,borderRadius:"sm",flexShrink:0,cursor:h?"pointer":void 0,role:h?"button":void 0,title:h?"Filter by ".concat(g):void 0,onClick:h?e=>{e.stopPropagation(),null==a||a(r)}:void 0,children:(0,l.jsxs)(n.z,{gap:1,alignItems:"center",children:[(0,l.jsx)(o.a,{w:"6px",h:"6px",borderRadius:"full",bg:x,flexShrink:0}),(0,l.jsx)(i.E,{fontSize:"xs",fontWeight:"medium",color:u?"red.200":"red.700",lineHeight:"1.2",children:g})]})})},p=e=>{let{types:r,labelStyle:t="short",onSelect:o,selectedType:i=null}=e;return r.length?(0,l.jsx)(n.z,{gap:1,flexWrap:"wrap",children:r.map(e=>(0,l.jsx)(c,{type:e,labelStyle:t,onSelect:o,selected:i===e},e))}):null},u=()=>{let{resolvedTheme:e}=(0,s.j)(),r="dark"===e;return(0,l.jsxs)(n.z,{gap:.5,display:"inline-flex",bg:r?"red.900":"red.50",borderWidth:"1px",borderColor:r?"red.700":"red.200",color:r?"red.200":"red.700",px:1.5,py:0,borderRadius:"sm",fontSize:"2xs",fontWeight:"medium",flexShrink:0,children:[(0,l.jsx)(a.y3G,{size:10}),(0,l.jsx)(i.E,{fontSize:"2xs",children:"Errors"})]})},g=e=>{let{types:r,labelStyle:t="short",onSelect:o,selectedType:n=null}=e;return(null==r?void 0:r.length)?(0,l.jsx)(p,{types:r,labelStyle:t,onSelect:o?e=>o(e):void 0,selectedType:n}):null},x=e=>{let{hasAnyError:r,replyErrorTypes:t,sessionErrorTypes:o,onTypeClick:n,selectedType:i=null}=e,a=(0,d.sx)(t,o);return a.length?(0,l.jsx)(p,{types:a,labelStyle:"short",onSelect:n?e=>n(e):void 0,selectedType:i}):r?(0,l.jsx)(u,{}):null}},33203:(e,r,t)=>{t.d(r,{Y:()=>c});
1var l=t(37876);t(14232);var o=t(43123),n=t(92146),i=t(5787),a=t(30488),s=t(70294);let d=(e,r)=>{let t=e.replace("#",""),l=3===t.length?t.split("").map(e=>e+e).join(""):t,o=parseInt(l.slice(0,2),16),n=parseInt(l.slice(2,4),16),i=parseInt(l.slice(4,6),16);return[o,n,i].some(e=>Number.isNaN(e))?e:"rgba(".concat(o,", ").concat(n,", ").concat(i,", ").concat(r,")")},c=e=>{let{text:r,widgetColor:t,colorMode:c="light",borderRadius:p=12}=e,u="dark"===c,g=(null==t?void 0:t.trim())||"#4206E4",x=d(g,u?.14:.06),h=d(g,u?.45:.3);return(0,l.jsx)(o.s,{w:"100%",justifyContent:"center",children:(0,l.jsxs)(n.z,{role:"note","aria-label":r,gap:2,align:"center",border:"1px solid",borderColor:h,bg:x,borderRadius:"".concat(p,"px"),px:3,py:2,maxW:"90%",children:[(0,l.jsx)(i.I,{as:s.p45,color:g,boxSize:"16px",flexShrink:0,"aria-hidden":"true"}),(0,l.jsx)(a.E,{fontSize:"xs",color:u?"whiteAlpha.900":"blackAlpha.800",lineHeight:"1.35",textAlign:"center",children:r})]})})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.