@botfabrik/engine-webclient 4.101.3-alpha.6 → 4.102.0

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.
@@ -114,8 +114,8 @@ For more details see https://formatjs.github.io/docs/getting-started/message-dis
114
114
  `,D),G=_.slice(D,U===-1?void 0:U+1),M=_[D];if((M===">"||M==="#"||M==="|"||M==="`"||M==="~"||M==="*"||M==="-"||M==="_"||M===" ")&&Z1(c,G)||(T+=G,U===-1||!G.trim()))break;D=U+1}const z=Wl(T);return z===""?null:[T,,z]}),u:3,i:fR},22:{t:["["],o:or(jC),u:0,i:_=>(v[_[1]]={target:_[2],title:_[4]},{})},23:{t:["!["],o:Zo(HC),u:0,i:_=>({alt:_[1]?Zn(_[1]):void 0,ref:_[2]})},24:{t:_=>_[0]==="["&&!Xn(_,"]("),o:or(IC),u:0,i:(_,x,T)=>({children:x(_[1],T),fallbackChildren:_[0],ref:_[2]})},25:{t:["|"],o:Ca(q1),u:1,i:lR},27:{o:ur(function(_,x){let T;return ph(_,":")&&(T=YC.exec(_)),T||ZC.exec(_)}),u:4,i(_){const x=_[0];return{text:Xn(x,"&")?x.replace(wC,(T,D)=>a.namedCodesToUnicode[D]||T):x}}},34:{t:["*","_","~","="],o:ur(uC),u:2,i:(_,x,T)=>({children:x(_[2],T),tag:_[1]})},28:{t:["\\"],o:Zo(PC),u:1,i:_=>({text:_[1],type:"27"})}};a.disableParsingRawHTML===!0&&(delete E[11],delete E[13]);const S=(function(_){var x=Object.keys(_);function T(D,z){var U=[];if(z.prevCapture=z.prevCapture||"",D.trim())for(;D;)for(var G=0;G<x.length;){var M=x[G],P=_[M];if(!P.t||rR(D,z,P.t)){var Q=P.o(D,z);if(Q&&Q[0]){D=D.substring(Q[0].length);var ae=P.i(Q,T,z);z.prevCapture+=Q[0],ae.type||(ae.type=M),U.push(ae);break}G++}else G++}return z.prevCapture="",U}return x.sort(function(D,z){return _[D].u-_[z].u||(D<z?-1:1)}),function(D,z){return T((function(U){return U.replace(SC,`
115
115
  `).replace(OC,"").replace(GC," ")})(D),z)}})(E),w=(function(_,x,T,D,z){function U(G){return Array.isArray(G)?G.map(M=>"text"in M?M.text:""):"text"in G?G.text:""}return function G(M,P={}){const Q=(P.renderDepth||0)+1;if(Q>2500)return U(M);P.renderDepth=Q;try{if(Array.isArray(M)){const Be=P.key,He=[];let ge=!1;for(let be=0;be<M.length;be++){P.key=be;const K=G(M[be],P),Se=V1(K);Se&&ge?He[He.length-1]+=K:K!==null&&He.push(K),ge=Se}return P.key=Be,P.renderDepth=Q-1,He}const ae=(function(Be,He,ge){const be=()=>(function(K,Se,se,L,W,oe,_e){switch(K.type){case"0":{const me={key:se.key};return K.alert&&(me.className="markdown-alert-"+oe(K.alert.toLowerCase(),zl),K.children.unshift({attrs:{},children:[{type:"27",text:K.alert}],noInnerParse:!0,type:"11",tag:"header"})),L("blockquote",me,Se(K.children,se))}case"1":return L("br",{key:se.key});case"2":return L("hr",{key:se.key});case"3":return L("pre",{key:se.key},L("code",Wn({},K.attrs,{className:K.lang?"lang-"+K.lang:""}),K.text));case"5":return L("code",{key:se.key},K.text);case"7":return L("a",{key:se.key,href:W(K.target,"a","href")},L("sup",{key:se.key},K.text));case"8":return L("input",{checked:K.completed,key:se.key,readOnly:!0,type:"checkbox"});case"9":return L("h"+K.level,{id:K.id,key:se.key},Se(K.children,se));case"11":return L(K.tag,Wn({key:se.key},K.attrs),K.text||(K.children?Se(K.children,se):""));case"13":return L(K.tag,Wn({},K.attrs,{key:se.key}));case"14":return L("img",{key:se.key,alt:K.alt||void 0,title:K.title||void 0,src:W(K.target,"img","src")});case"15":return L("a",{key:se.key,href:W(K.target,"a","href"),title:K.title},Se(K.children,se));case"23":return _e[K.ref]?L("img",{key:se.key,alt:K.alt,src:W(_e[K.ref].target,"img","src"),title:_e[K.ref].title}):null;case"24":return _e[K.ref]?L("a",{key:se.key,href:W(_e[K.ref].target,"a","href"),title:_e[K.ref].title},Se(K.children,se)):L("span",{key:se.key},K.fallbackChildren);case"25":{const me=K;return L("table",{key:se.key},L("thead",null,L("tr",null,me.header.map(function(O,F){return L("th",{key:F,style:P1(me,F)},Se(O,se))}))),L("tbody",null,me.cells.map(function(O,F){return L("tr",{key:F},O.map(function(X,J){return L("td",{key:J,style:P1(me,J)},Se(X,se))}))})))}case"27":return K.text;case"34":return L(K.tag,{key:se.key},Se(K.children,se));case"20":case"30":return L(K.ordered?"ol":"ul",{key:se.key,start:K.type==="20"?K.start:void 0},K.items.map(function(me,O){return L("li",{key:O},Se(me,se))}));case"19":return`
116
116
  `;case"21":return L("p",{key:se.key},Se(K.children,se));default:return null}})(Be,He,ge,x,T,D,z);return _?_(be,Be,He,ge):be()})(M,G,P);return P.renderDepth=Q-1,ae}catch(ae){if(ae instanceof RangeError&&ae.message.includes("Maximum call stack"))return U(M);throw ae}}})(a.renderRule,h,l,i,v);return m(n)}const Na=n=>{let{children:a,options:i}=n,l=(function(o,c){if(o==null)return{};var d={};for(var h in o)if({}.hasOwnProperty.call(o,h)){if(c.indexOf(h)!==-1)continue;d[h]=o[h]}return d})(n,cC);return hR(a??"",Wn({},i,{wrapperProps:Wn({},i?.wrapperProps,l)}))},mR="_generalConditionsContainer_55hjg_1",pR="_generalConditions_55hjg_1",gR="_generalConditionsHeader_55hjg_15",yR="_generalConditionsBody_55hjg_26",vR="_generalConditionsAccept_55hjg_35",Gl={generalConditionsContainer:mR,generalConditions:pR,generalConditionsHeader:gR,generalConditionsBody:yR,generalConditionsAccept:vR},bR=()=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"})}),_R=()=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"})}),ER="general-conditions.header",SR="general-conditions.body",Q1="general-conditions.accept-conditions-note",TR=()=>{const n=tt(),[a,i]=H.useState(!1),l=()=>i(!a),o=h=>{h.key==="ArrowDown"||h.key==="ArrowRight"?i(!0):h.key==="ArrowUp"||h.key==="ArrowLeft"||h.key==="Escape"?i(!1):(h.key==="Enter"||h.key==="Space"||h.key===" ")&&l()},c=n(ER),d=n(Q1);return y.jsxs("div",{className:$(Gl.generalConditionsContainer,"chat__generalConditions"),children:[!!c?.length&&y.jsxs("div",{className:Gl.generalConditions,children:[y.jsxs("div",{role:"button",onClick:l,onKeyDown:o,tabIndex:0,className:$(Gl.generalConditionsHeader,"chat__generalConditions__header"),"aria-controls":"general-conditions-body","aria-expanded":a?"true":"false","aria-pressed":a?"true":"false",children:[y.jsx(Na,{children:c}),a?y.jsx(_R,{}):y.jsx(bR,{})]}),y.jsx("div",{className:$(Gl.generalConditionsBody,"chat__generalConditions__body"),id:"general-conditions-body",role:"region",tabIndex:-1,children:a&&y.jsx(Na,{children:n(SR)||""})})]}),!!d?.length&&y.jsx("div",{className:$(Gl.generalConditionsAccept,"chat__generalConditions__accept"),tabIndex:0,children:y.jsx(Na,{children:n(Q1)||""})})]})},AR="_messageContainer_1rxi5_1",OR="_message_1rxi5_1",xR="_messageBot_1rxi5_14",CR="_messageBotLast_1rxi5_45",RR="_avatar_1rxi5_45",wR="_messageBotFirst_1rxi5_54",NR="_messageBotAnimated_1rxi5_67",MR="_messageGuest_1rxi5_78",DR="_messageGuestFirst_1rxi5_84",LR="_messageGuestLast_1rxi5_90",BR="_botAvatar_1rxi5_104",UR="_agentAvatar_1rxi5_108",jR="_bubble_1rxi5_112",HR="_bubbleContent_1rxi5_118",IR="_bubbleLeft_1rxi5_132",zR="_leftText_1rxi5_143",GR="_bubbleRight_1rxi5_150",kR="_rightText_1rxi5_160",qR="_sourceInfoReference_1rxi5_192",FR="_sourceInfoReferenceActive_1rxi5_204",pe={messageContainer:AR,message:OR,messageBot:xR,messageBotLast:CR,avatar:RR,messageBotFirst:wR,messageBotAnimated:NR,messageGuest:MR,messageGuestFirst:DR,messageGuestLast:LR,botAvatar:BR,agentAvatar:UR,bubble:jR,bubbleContent:HR,bubbleLeft:IR,leftText:zR,bubbleRight:GR,rightText:kR,sourceInfoReference:qR,sourceInfoReferenceActive:FR},rm=(n,a)=>{H.useEffect(()=>{const i=l=>{n.current&&!n.current.contains(l.target)&&a()};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n,a])};var Ed,K1;function im(){if(K1)return Ed;K1=1;function n(a){var i=typeof a;return a!=null&&(i=="object"||i=="function")}return Ed=n,Ed}var Sd,$1;function VR(){if($1)return Sd;$1=1;var n=typeof Co=="object"&&Co&&Co.Object===Object&&Co;return Sd=n,Sd}var Td,W1;function h_(){if(W1)return Td;W1=1;var n=VR(),a=typeof self=="object"&&self&&self.Object===Object&&self,i=n||a||Function("return this")();return Td=i,Td}var Ad,J1;function YR(){if(J1)return Ad;J1=1;var n=h_(),a=function(){return n.Date.now()};return Ad=a,Ad}var Od,ev;function PR(){if(ev)return Od;ev=1;var n=/\s/;function a(i){for(var l=i.length;l--&&n.test(i.charAt(l)););return l}return Od=a,Od}var xd,tv;function XR(){if(tv)return xd;tv=1;var n=PR(),a=/^\s+/;function i(l){return l&&l.slice(0,n(l)+1).replace(a,"")}return xd=i,xd}var Cd,nv;function m_(){if(nv)return Cd;nv=1;var n=h_(),a=n.Symbol;return Cd=a,Cd}var Rd,av;function ZR(){if(av)return Rd;av=1;var n=m_(),a=Object.prototype,i=a.hasOwnProperty,l=a.toString,o=n?n.toStringTag:void 0;function c(d){var h=i.call(d,o),m=d[o];try{d[o]=void 0;var g=!0}catch{}var v=l.call(d);return g&&(h?d[o]=m:delete d[o]),v}return Rd=c,Rd}var wd,rv;function QR(){if(rv)return wd;rv=1;var n=Object.prototype,a=n.toString;function i(l){return a.call(l)}return wd=i,wd}var Nd,iv;function KR(){if(iv)return Nd;iv=1;var n=m_(),a=ZR(),i=QR(),l="[object Null]",o="[object Undefined]",c=n?n.toStringTag:void 0;function d(h){return h==null?h===void 0?o:l:c&&c in Object(h)?a(h):i(h)}return Nd=d,Nd}var Md,lv;function $R(){if(lv)return Md;lv=1;function n(a){return a!=null&&typeof a=="object"}return Md=n,Md}var Dd,sv;function WR(){if(sv)return Dd;sv=1;var n=KR(),a=$R(),i="[object Symbol]";function l(o){return typeof o=="symbol"||a(o)&&n(o)==i}return Dd=l,Dd}var Ld,ov;function JR(){if(ov)return Ld;ov=1;var n=XR(),a=im(),i=WR(),l=NaN,o=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,d=/^0o[0-7]+$/i,h=parseInt;function m(g){if(typeof g=="number")return g;if(i(g))return l;if(a(g)){var v=typeof g.valueOf=="function"?g.valueOf():g;g=a(v)?v+"":v}if(typeof g!="string")return g===0?g:+g;g=n(g);var E=c.test(g);return E||d.test(g)?h(g.slice(2),E?2:8):o.test(g)?l:+g}return Ld=m,Ld}var Bd,uv;function p_(){if(uv)return Bd;uv=1;var n=im(),a=YR(),i=JR(),l="Expected a function",o=Math.max,c=Math.min;function d(h,m,g){var v,E,S,w,_,x,T=0,D=!1,z=!1,U=!0;if(typeof h!="function")throw new TypeError(l);m=i(m)||0,n(g)&&(D=!!g.leading,z="maxWait"in g,S=z?o(i(g.maxWait)||0,m):S,U="trailing"in g?!!g.trailing:U);function G(K){var Se=v,se=E;return v=E=void 0,T=K,w=h.apply(se,Se),w}function M(K){return T=K,_=setTimeout(ae,m),D?G(K):w}function P(K){var Se=K-x,se=K-T,L=m-Se;return z?c(L,S-se):L}function Q(K){var Se=K-x,se=K-T;return x===void 0||Se>=m||Se<0||z&&se>=S}function ae(){var K=a();if(Q(K))return Be(K);_=setTimeout(ae,P(K))}function Be(K){return _=void 0,U&&v?G(K):(v=E=void 0,w)}function He(){_!==void 0&&clearTimeout(_),T=0,v=x=E=_=void 0}function ge(){return _===void 0?w:Be(a())}function be(){var K=a(),Se=Q(K);if(v=arguments,E=this,x=K,Se){if(_===void 0)return M(x);if(z)return clearTimeout(_),_=setTimeout(ae,m),G(x)}return _===void 0&&(_=setTimeout(ae,m)),w}return be.cancel=He,be.flush=ge,be}return Bd=d,Bd}var e6=p_();const t6=bu(e6),n6="_container_131ib_1",a6="_categoryContainer_131ib_13",r6="_categoryButton_131ib_20",i6="_active_131ib_35",l6="_commentTextarea_131ib_44",kl={container:n6,categoryContainer:a6,categoryButton:r6,active:i6,commentTextarea:l6},s6=(n,a,i)=>{H.useEffect(()=>{if(n){const l=()=>{const c=["button:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"a[href]","input:not([disabled])","select:not([disabled])"].join(","),d=a.current?Array.from(a.current.querySelectorAll(c)):[],h=i.current?Array.from(i.current.querySelectorAll(c)):[];return[...d,...h]},o=c=>{if(c.key==="Tab"){const d=l();if(d.length>0){const h=d[0],m=d[d.length-1],g=document.activeElement;!c.shiftKey&&g===m?(c.preventDefault(),h.focus()):c.shiftKey&&g===h&&(c.preventDefault(),m.focus())}}};return document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("keydown",o,!0)}}},[n,a,i])},o6=({open:n,actionsRef:a,reaction:i,onReaction:l})=>{const o=tt(),c=H.useRef(null),d=t6(g=>{l({...i,comment:g})},300);H.useEffect(()=>()=>d.flush(),[d]),s6(n,a,c);const h=g=>{l({...i,category:i.category===g?void 0:g})},m=g=>d(g.target.value);return n?y.jsxs("div",{ref:c,className:kl.container,role:"dialog","aria-modal":"true","aria-labelledby":"bad-reaction-title",children:[y.jsx("h2",{id:"bad-reaction-title",children:o("bot-bubble.reaction.say-more")}),y.jsx("div",{className:kl.categoryContainer,role:"radiogroup",children:["WRONG_INFORMATION","MISSING_INFORMATION","OLD_INFORMATION","UNCLEAR","OFF_TOPIC"].map(g=>y.jsx("button",{className:$(kl.categoryButton,i?.category===g&&kl.active),onClick:()=>h(g),"aria-pressed":i?.category===g,"aria-label":o(`bot-bubble.reaction.category.${g}`),tabIndex:0,role:"radio",children:o(`bot-bubble.reaction.category.${g}`)},g))}),y.jsx("textarea",{id:"comment",name:"comment",placeholder:o("bot-bubble.reaction.comment"),defaultValue:i?.comment,onChange:m,className:kl.commentTextarea,rows:3,"aria-label":o("bot-bubble.reaction.comment")})]}):null},u6="_botMessageActionContainer_18fjb_1",c6="_alwaysVisible_18fjb_15",f6="_active_18fjb_19",d6="_botMessageActionInnerContainer_18fjb_27",h6="_header_18fjb_52",m6="_botMessageActions_18fjb_57",p6="_reported_18fjb_68",g6="_action_18fjb_72",y6="_wave_18fjb_86",v6="_anyReport_18fjb_156",b6="_closeButton_18fjb_172",lt={botMessageActionContainer:u6,alwaysVisible:c6,active:f6,botMessageActionInnerContainer:d6,header:h6,botMessageActions:m6,reported:p6,action:g6,wave:y6,anyReport:v6,closeButton:b6},_6=({isSubmitting:n,onClick:a})=>{const i=tt();return y.jsx("button",{className:$(lt.action,lt.closeButton,"tooltip--bottom-left"),"aria-label":i("bot-bubble.reaction.close"),"data-title":i("bot-bubble.reaction.close"),tabIndex:0,onClick:a,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:n?y.jsx("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}):y.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})})},E6=({alwaysVisible:n,senderType:a,reaction:i,botMessageRef:l,message:o,animated:c,onReaction:d})=>{const h=tt(),[m,g]=H.useState(!1),[v,E]=H.useState(!1),[S,w]=H.useState(!1),_=H.useRef(null),x=H.useRef(null);rm(_,()=>{w(!1)});const T=P=>{P.key==="Escape"&&w(!1)};H.useEffect(()=>(document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}),[]),H.useEffect(()=>{S&&_.current?.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[S]);const D=P=>{x.current&&clearTimeout(x.current),E(!0),d(P),x.current=setTimeout(()=>{E(!1)},1e3)},z=H.useCallback(async()=>{if(l.current)try{g(!0);const P=l.current.innerHTML,Q=l.current.innerText;await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([P],{type:"text/html"}),"text/plain":new Blob([Q],{type:"text/plain"})})]),await new Promise(ae=>setTimeout(ae,1500))}finally{g(!1)}},[l]),U=()=>{w(!1),d(i?.type==="GOOD"?null:{type:"GOOD"})},G=()=>{d({...o.reaction,type:"BAD"}),w(!S)},M=P=>Q=>{(Q.key==="Enter"||Q.key===" ")&&P()};return y.jsx("div",{ref:_,className:$(lt.botMessageActionContainer,n&&lt.alwaysVisible,S&&lt.active),children:y.jsxs("div",{className:$(lt.botMessageActionInnerContainer,n&&lt.alwaysVisible,S&&lt.active,i&&lt.reported),role:"group",children:[y.jsxs("div",{className:lt.header,children:[y.jsxs("div",{className:$(lt.botMessageActions,i&&lt.reported),children:[a===gu.BOT&&y.jsx("button",{className:$(lt.action,c&&lt.wave,i?.type&&lt.anyReport,i?.type==="GOOD"&&lt.reported,"tooltip--top-right"),tabIndex:0,"aria-label":h(i?.type==="GOOD"?"bot-bubble.reaction.remove":"bot-bubble.reaction.good"),"aria-pressed":i?.type==="GOOD","data-title":h(i?.type==="GOOD"?"bot-bubble.reaction.remove":"bot-bubble.reaction.good"),onPointerDown:U,onKeyDown:M(U),children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:i?.type==="GOOD"?y.jsx("path",{d:"M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32Z"}):y.jsx("path",{d:"M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32ZM223.94,97l-12,96a8,8,0,0,1-7.94,7H88V105.89l36.71-73.43A24,24,0,0,1,144,56V80a8,8,0,0,0,8,8h64a8,8,0,0,1,7.94,9Z"})})}),a===gu.BOT&&y.jsx("button",{className:$(lt.action,c&&lt.wave,i?.type&&lt.anyReport,i?.type==="BAD"&&lt.reported,"tooltip--top-right"),tabIndex:0,"aria-label":h("bot-bubble.reaction.bad"),"aria-pressed":i?.type==="BAD","data-title":h("bot-bubble.reaction.bad"),onPointerDown:G,onKeyDown:M(G),children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:i?.type==="BAD"?y.jsx("path",{d:"M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Z"}):y.jsx("path",{d:"M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Zm150,21.29a7.88,7.88,0,0,1-6,2.71H152a8,8,0,0,0-8,8v24a24,24,0,0,1-19.29,23.54L88,150.11V56H204a8,8,0,0,1,7.94,7l12,96A7.87,7.87,0,0,1,222,165.29Z"})})}),y.jsx("button",{className:$(lt.action,c&&lt.wave,"tooltip--top-right"),style:{visibility:S?"hidden":"visible"},tabIndex:0,"aria-label":h("bot-bubble.copy"),"data-title":h("bot-bubble.copy"),onClick:z,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:m?y.jsx("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}):y.jsx("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"})})})]}),S&&y.jsx(_6,{isSubmitting:v,onClick:()=>w(!1)})]}),o.reaction&&y.jsx(o6,{open:S,actionsRef:_,reaction:o.reaction,onReaction:D})]})})},g_=H.forwardRef(({message:n,isAnimated:a,isFirstMessage:i,isLastMessage:l,isFirstMessageBySender:o,isLastMessageBySender:c,children:d,onReaction:h},m)=>{const g=tt(),v=H.useRef(null),E=n.sender.type===Te.UserType.BOT;return y.jsxs("li",{ref:m,className:$(pe.message,pe.messageBot,l&&pe.lastMessage,o&&pe.messageBotFirst,c&&pe.messageBotLast,"chat__bubbleContainer",a&&pe.messageBotAnimated,a&&"chat__bubbleContainer--animated",E?"chat__botBubbleContainer":"chat__agentBubbleContainer",o&&"chat__bubbleContainer--first",c&&"chat__bubbleContainer--last"),children:[y.jsx("img",{className:$(pe.avatar,E?pe.botAvatar:pe.agentAvatar,"chat__avatar",E?"chat__botAvatar":"chat__agentAvatar"),src:`${n.sender.avatar}`,alt:E?"Bot":"Agent",referrerPolicy:"no-referrer"}),y.jsxs("div",{className:pe.messageContainer,children:[y.jsx("div",{ref:v,className:$(pe.bubble,pe.bubbleLeft,"chat__bubble",E?"chat__botBubble":"chat__agentBubble"),tabIndex:0,"aria-label":g(E?"bot-bubble.label":"agent-bubble.label"),children:y.jsx("div",{className:$(pe.leftText),children:d})}),h&&y.jsx(E6,{alwaysVisible:l&&c,senderType:n.sender.type,reaction:n.reaction,message:n,botMessageRef:v,animated:i,onReaction:h})]})]})}),S6="_sourceList_1n31h_1",T6="_source_1n31h_1",A6="_label_1n31h_37",Ud={sourceList:S6,source:T6,label:A6},y_=n=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:y.jsx("path",{d:"M52,146H36a6,6,0,0,0-6,6v56a6,6,0,0,0,6,6H52a34,34,0,0,0,0-68Zm0,56H42V158H52a22,22,0,0,1,0,44Zm168.15-5.46a6,6,0,0,1,.18,8.48A28.06,28.06,0,0,1,200,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a28.06,28.06,0,0,1,20.33,9,6,6,0,0,1-8.66,8.3A16.23,16.23,0,0,0,200,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a16.23,16.23,0,0,0,11.67-5.28A6,6,0,0,1,220.15,196.54ZM128,146c-16.54,0-30,15.25-30,34s13.46,34,30,34,30-15.25,30-34S144.54,146,128,146Zm0,56c-9.93,0-18-9.87-18-22s8.07-22,18-22,18,9.87,18,22S137.93,202,128,202ZM48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Z"})}),v_=n=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:y.jsx("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Z"})}),b_=n=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:y.jsx("path",{d:"M222,152a6,6,0,0,1-6,6H190v20h18a6,6,0,0,1,0,12H190v18a6,6,0,0,1-12,0V152a6,6,0,0,1,6-6h32A6,6,0,0,1,222,152ZM90,172a26,26,0,0,1-26,26H54v10a6,6,0,0,1-12,0V152a6,6,0,0,1,6-6H64A26,26,0,0,1,90,172Zm-12,0a14,14,0,0,0-14-14H54v28H64A14,14,0,0,0,78,172Zm84,8a34,34,0,0,1-34,34H112a6,6,0,0,1-6-6V152a6,6,0,0,1,6-6h16A34,34,0,0,1,162,180Zm-12,0a22,22,0,0,0-22-22H118v44h10A22,22,0,0,0,150,180ZM42,112V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88v24a6,6,0,0,1-12,0V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2v72a6,6,0,0,1-12,0ZM158,82h35.52L158,46.48Z"})}),__=n=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:y.jsx("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm81.57,64H169.19a132.58,132.58,0,0,0-25.73-50.67A90.29,90.29,0,0,1,209.57,90ZM218,128a89.7,89.7,0,0,1-3.83,26H171.81a155.43,155.43,0,0,0,0-52h42.36A89.7,89.7,0,0,1,218,128Zm-90,87.83a110,110,0,0,1-15.19-19.45A124.24,124.24,0,0,1,99.35,166h57.3a124.24,124.24,0,0,1-13.46,30.38A110,110,0,0,1,128,215.83ZM96.45,154a139.18,139.18,0,0,1,0-52h63.1a139.18,139.18,0,0,1,0,52ZM38,128a89.7,89.7,0,0,1,3.83-26H84.19a155.43,155.43,0,0,0,0,52H41.83A89.7,89.7,0,0,1,38,128Zm90-87.83a110,110,0,0,1,15.19,19.45A124.24,124.24,0,0,1,156.65,90H99.35a124.24,124.24,0,0,1,13.46-30.38A110,110,0,0,1,128,40.17Zm-15.46-.84A132.58,132.58,0,0,0,86.81,90H46.43A90.29,90.29,0,0,1,112.54,39.33ZM46.43,166H86.81a132.58,132.58,0,0,0,25.73,50.67A90.29,90.29,0,0,1,46.43,166Zm97,50.67A132.58,132.58,0,0,0,169.19,166h40.38A90.29,90.29,0,0,1,143.46,216.67Z"})}),O6=({type:n,...a})=>{switch(n){case"WEBSITE":return y.jsx(__,{...a});case"PDF":return y.jsx(b_,{...a});case"DOCX":return y.jsx(y_,{...a});default:return y.jsx(v_,{...a})}},lm=({sources:n,onLinkClick:a})=>{const i=tt(),l=c=>()=>{a(c.url)},o=c=>d=>{(d.key==="Enter"||d.key===" ")&&a(c.url)};return n.length?y.jsx("ul",{className:Ud.sourceList,"aria-label":i("bot-bubble.sources"),children:n.map(c=>y.jsx("li",{className:Ud.source,children:y.jsxs("a",{role:"button",tabIndex:0,"aria-label":`${i("bot-bubble.source.open")}: ${c.label}`,onClick:l(c),onKeyDown:o(c),children:[y.jsx(O6,{type:c.type,"aria-hidden":"true"}),y.jsx("div",{className:Ud.label,children:c.label})]})},c.url))}):null},x6="_button_3ui4g_1",C6="_buttonDefault_3ui4g_13",R6="_buttonPrimary_3ui4g_28",ts={button:x6,buttonDefault:C6,buttonPrimary:R6},Ru=({className:n,children:a,...i})=>y.jsx("button",{className:$(ts.button,n),type:"button",role:"button",...i,children:a}),w6="_title_137pi_1",N6="_buttons_137pi_6",M6="_button_137pi_6",D6="_imageContainer_137pi_29",L6="_image_137pi_29",B6="_video_container_137pi_44",U6="_video_137pi_44",j6="_only_137pi_58",un={title:w6,buttons:N6,button:M6,imageContainer:D6,image:L6,video_container:B6,video:U6,only:j6},H6=({buttons:n,onButtonClick:a})=>y.jsx("div",{className:$(un.buttons,"chat__bubbleButtons"),children:n.map((i,l)=>y.jsx(Ru,{className:$(un.button,"chat__bubbleButton"),onClick:()=>a(i),children:i.title},l))}),cv="newtab#",E_=({markdown:n,markdownOptions:a={},onLinkClick:i})=>{const l=c=>d=>(d.preventDefault(),c&&i(c),!1),o=({title:c,href:d,children:h})=>d.indexOf(cv)===0?y.jsx("a",{href:d.slice(cv.length),title:c,target:"_blank",rel:"noopener noreferrer",children:h}):y.jsx("a",{onClick:l(d),title:c,href:d,children:h});return y.jsx(Na,{options:{...a,overrides:{a:o}},children:n})},I6=({text:n,onLinkClick:a})=>n?y.jsx("div",{children:y.jsx(E_,{markdown:n,onLinkClick:a})}):null,z6=({title:n})=>n?y.jsx("h1",{className:un.title,children:n}):null,G6=({title:n,text:a,buttons:i,onButtonClick:l,onLinkClick:o})=>n?.length||a?.length||i?.length?y.jsxs("div",{className:$(pe.bubbleContent),children:[y.jsx(z6,{title:n}),y.jsx(I6,{text:a,onLinkClick:o}),y.jsx(H6,{buttons:i,onButtonClick:l})]}):null,k6=({alt:n,imageUrl:a,itemUrl:i,hasBody:l})=>a?i?i.indexOf("youtube.com")>-1?y.jsx("div",{className:un.video_container,children:y.jsx("iframe",{className:$(un.video,{[un.only]:!l}),title:"Youtube",width:"100%",src:i+"?rel=0",frameBorder:"0",allowFullScreen:!0})}):y.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:y.jsx("div",{className:un.imageContainer,children:y.jsx("img",{className:$(un.image,{[un.only]:!l}),src:a,alt:n})})}):y.jsx("div",{className:un.imageContainer,children:y.jsx("img",{className:$(un.image,{[un.only]:!l}),src:a,alt:n})}):null,q6=({title:n,text:a,imageUrl:i,itemUrl:l,buttons:o,sources:c,onButtonClick:d,onLinkClick:h})=>{const m=!!n?.length||!!a?.length||!!o?.length;return y.jsxs("div",{className:$(un.detailMessage),children:[y.jsx(k6,{hasBody:m,imageUrl:i,itemUrl:l,alt:n||""}),m&&y.jsx(G6,{title:n,text:a,buttons:o,onLinkClick:h,onButtonClick:d}),y.jsx(lm,{sources:c,onLinkClick:h})]})},F6=H.forwardRef(({isFirstMessageBySender:n,isLastMessageBySender:a,children:i},l)=>{const o=tt();return y.jsx("li",{ref:l,className:$(pe.message,pe.messageGuest,n&&pe.messageGuestFirst,a&&pe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer",n&&"chat__bubbleContainer--first",a&&"chat__bubbleContainer--last"),children:y.jsx("div",{className:$(pe.bubble,pe.bubbleRight,"chat__bubble","chat__guestBubble"),tabIndex:0,"aria-label":o("guest-bubble.label"),children:y.jsx("div",{className:$(pe.rightText),children:i})})})}),sm=()=>H.useMemo(()=>Vh(),[]),V6="_markdown_nw7vg_1",S_={markdown:V6},Qo="source-info-reference",Y6=({actionId:n,markdown:a,sources:i,onLinkClick:l})=>{const o=sm(),c=Ba(),d=P6(),h=st(v=>{const E=v.chat.sourceInfos;if(E?.type==="loaded"||E?.type==="loading")return E.chunkId}),m=v=>E=>{const S=E.key;(S==="ArrowDown"||S==="ArrowRight"||S==="Enter"||S===" "||S==="Space")&&(E.stopPropagation(),c(w1(o,n,v)))},g=v=>()=>{c(w1(o,n,v))};return H.useLayoutEffect(()=>{document.querySelectorAll(`.${Qo}`).forEach(v=>{const E=v.previousSibling;E&&E.nodeType===Node.TEXT_NODE&&E.textContent?.endsWith(" ")&&E.textContent?.trim().length&&v.classList.add(`${Qo}--before-space`);const S=v.nextSibling;S&&S.nodeType===Node.TEXT_NODE&&S.textContent?.startsWith(" ")&&S.textContent?.trim().length&&v.classList.add(`${Qo}--after-space`)})},[a]),y.jsxs("div",{className:pe.bubbleContent,children:[y.jsx("div",{className:S_.markdown,children:y.jsx(E_,{markdown:a,onLinkClick:l,markdownOptions:{renderRule(v,E,S,w){if(E.type===fC.footnoteReference){const _=E.text===h;return y.jsx("span",{className:$(pe.sourceInfoReference,_&&pe.sourceInfoReferenceActive,Qo),children:y.jsx("a",{type:"button",tabIndex:0,onClick:g(E.text),onKeyDown:m(E.text),children:d(E.text)})},w.key)}return v()}}})}),y.jsx(lm,{sources:i,onLinkClick:l})]})},P6=()=>{const n=[];return i=>{const l=n.indexOf(i);return l>-1?l+1:(n.push(i),n.length)}},X6="_text_gp0s0_1",Z6="_command_gp0s0_5",fv={text:X6,command:Z6},Q6=({text:n,commands:a=[]})=>{const i=a.find(o=>n.startsWith(`/${o}`)),l=i?n.slice(i.length+1):n;return y.jsxs("div",{children:[i&&y.jsxs("code",{className:fv.command,children:["/",i]}),l.split(`
117
- `).map((o,c)=>y.jsxs("span",{className:fv.text,children:[o,y.jsx("br",{})]},c))]})},K6=({text:n,commands:a,sources:i,onLinkClick:l})=>y.jsxs("div",{className:pe.bubbleContent,children:[y.jsx(Q6,{text:n,commands:a}),y.jsx(lm,{sources:i,onLinkClick:l})]}),$6=H.forwardRef(({message:n,commands:a,isFirstMessage:i,isLastMessage:l,isFirstMessageBySender:o,isLastMessageBySender:c,onReaction:d,onButtonClick:h,onLinkClick:m},g)=>{const v=W6(n._id,n,a,h,m),E=S=>{d(n._id,S)};switch(n.sender.type){case Te.UserType.GUEST:return y.jsx(F6,{ref:g,isFirstMessageBySender:o,isLastMessageBySender:c,children:v});default:return y.jsx(g_,{ref:g,message:n,isAnimated:!1,isFirstMessage:i,isLastMessage:l,isFirstMessageBySender:o,isLastMessageBySender:c,onReaction:E,children:v})}}),W6=(n,a,i,l,o)=>{switch(a.type){case Te.MessageTypeEnum.TEXT:{const c=a;return y.jsx(K6,{text:c.text,commands:i,sources:a.sources||[],onLinkClick:o})}case Te.MessageTypeEnum.DETAIL:{const c=a;return y.jsx(q6,{title:c.title,text:c.text,imageUrl:c.imageUrl,itemUrl:c.itemUrl,buttons:c.buttons,sources:a.sources||[],onButtonClick:l,onLinkClick:o})}case Te.MessageTypeEnum.MARKDOWN:{const c=a;return y.jsx(Y6,{actionId:n,markdown:c.markdown,sources:c.sources||[],onLinkClick:o})}}},J6=(n,a)=>n.message._id===a.message._id&&n.message.reaction===a.message.reaction&&n.isFirstMessage===a.isFirstMessage&&n.isLastMessage===a.isLastMessage&&n.isFirstMessageBySender===a.isFirstMessageBySender&&n.isLastMessageBySender===a.isLastMessageBySender,ew=kv.memo($6,J6),tw="_ticontainer_xg0dn_1",nw="_tiblock_xg0dn_5",aw="_tidot_xg0dn_12",ql={ticontainer:tw,tiblock:nw,tidot:aw},rw=({isTyping:n=!1})=>y.jsx("div",{className:ql.ticontainer,children:y.jsx("div",{className:ql.tiblock,children:n?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:$(ql.tidot,"chat__typingIndicator")}),y.jsx("div",{className:$(ql.tidot,"chat__typingIndicator")}),y.jsx("div",{className:$(ql.tidot,"chat__typingIndicator")})]}):null})}),iw=Object.assign({_id:"typing-indicator"},new Te.TextMessage("",new Te.BotUser)),lw=({messages:n,isBotTyping:a,commands:i,onTranscriptItemReaction:l,onButtonClick:o,onLinkClick:c})=>{const d=H.useRef(0),h=H.useRef(!0),m=H.useRef(null),g=H.useRef(null),v=H.useRef(null),E=st(_=>_.settings.enableGeneralConditions);H.useLayoutEffect(()=>{if(n.length&&m.current&&(d.current<n.length||a)){if(g.current){const _=g.current.offsetTop;m.current.scrollTop=_}else if(v.current){const _=v.current.offsetTop;m.current.scrollTop=_}h.current&&(h.current=!1),d.current=n.length}},[n,h,a]);let S;const w=n.length;return y.jsxs("div",{ref:m,className:$(M1.messageContainer,"chat__messageContainer"),style:{scrollBehavior:n.length&&h.current?"auto":"smooth"},id:"MessageContainer",role:"log","aria-live":"polite",children:[E&&y.jsx(TR,{}),y.jsxs("ul",{className:M1.messages,children:[n.map((_,x)=>{const T=sw(_,S),D=ow(_,x,n,a);S=_.sender.type;const z=x+1===w,U=x===0,G=_._id||`added-${x}`;return y.jsx(ew,{ref:z?v:null,message:_,commands:i,isFirstMessage:U,isLastMessage:z,isFirstMessageBySender:T,isLastMessageBySender:D,onButtonClick:o,onLinkClick:c,onReaction:l},z&&!a?"last":G)}),a&&y.jsx(g_,{ref:g,message:iw,isFirstMessage:!1,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:S!==Te.UserType.BOT,isLastMessageBySender:!0,children:y.jsx(rw,{isTyping:!0})},"last")]})]})},sw=(n,a)=>!a||a!==n.sender.type,ow=(n,a,i,l)=>{const o=n.sender.type,c=i.length;return a+1===c?!(o===Te.UserType.BOT&&l):o!==i.at(a+1)?.sender.type},uw="_bottomSheet_jp8dl_1",cw="_bottomSheetOpen_jp8dl_15",fw="_bottomSheetClose_jp8dl_20",Ma={bottomSheet:uw,bottomSheetOpen:cw,bottomSheetClose:fw},dw="_container_xc2nx_1",dv={container:dw},hw=({contentUrl:n})=>{const a=st(c=>c.connection.sessionId),[i,l]=H.useState(!1);H.useEffect(()=>{l(c=>c||!!n)},[n]);const o=H.useMemo(()=>{if(n&&a){const c=new URL(n,document.baseURI);return c.searchParams.set("sessionId",a),c.toString()}else return},[n,a]);return y.jsx("div",{className:$(dv.container,Ma.bottomSheet,{[Ma.bottomSheetOpen]:!!n,[Ma.bottomSheetClose]:i&&!n}),children:o&&y.jsx("iframe",{title:"Drawer",src:o,className:dv.iframe})})},mw="_container_6tt4m_1",pw={container:mw},gw=({title:n,href:a,children:i})=>y.jsx("a",{href:a,title:n,target:"_blank",rel:"noopener noreferrer",children:i}),yw=()=>{const a=tt()("powered-by");return a&&a.length?y.jsx("div",{className:$(pw.container,"chat__poweredBy"),children:y.jsx(Na,{options:{overrides:{a:gw}},children:a})}):null},T_=({className:n,children:a,...i})=>y.jsx(Ru,{className:$(ts.buttonDefault,n),type:"button",...i,children:a}),yu=({className:n,children:a,...i})=>y.jsx(Ru,{className:$(ts.buttonPrimary,n),...i,children:a}),vw="_container_h23mk_1",bw="_formContainer_h23mk_17",_w="_emailInput_h23mk_22",Ew="_description_h23mk_52",Sw="_actions_h23mk_57",Tw="_validationError_h23mk_67",Aw="_submitted_h23mk_74",jr={container:vw,formContainer:bw,emailInput:_w,description:Ew,actions:Sw,validationError:Tw,submitted:Aw},Ow=({visible:n,onEmailExport:a,onClose:i})=>{const l=tt(),[o,c]=H.useState(void 0),[d,h]=H.useState(!1),[m,g]=H.useState(void 0),v=H.useRef(null);H.useEffect(()=>{n?(v.current?.focus(),h(!1),c(n)):o===!0&&c(!1)},[n,o]);const E=w=>{w.preventDefault(),m&&m.length>0&&(a(m),h(!0),setTimeout(i,3*1e3))},S=w=>{const _=w.target.value.trim(),x=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(_);g(x?_:"")};return y.jsxs("div",{className:$(jr.container,Ma.bottomSheet,{[Ma.bottomSheetOpen]:o===!0,[Ma.bottomSheetClose]:o===!1}),children:[y.jsx("h2",{children:l("export-transcript.email.title")}),y.jsx(Na,{className:jr.description,children:l("export-transcript.email.description")||""}),y.jsxs("form",{onSubmit:E,className:jr.formContainer,children:[y.jsxs("div",{children:[y.jsx("input",{disabled:d,ref:v,type:"email",placeholder:l("export-transcript.email.placeholder"),className:jr.emailInput,onChange:S}),m?.length===0?y.jsx("div",{className:jr.validationError,children:l("export-transcript.email.invalid")}):null]}),y.jsxs("div",{className:jr.actions,children:[y.jsx(T_,{onClick:i,children:l("export-transcript.email.cancel")}),y.jsx(yu,{type:"submit",disabled:d||m===void 0||m.length===0,children:l("export-transcript.email.send")})]})]}),d&&y.jsx("div",{className:jr.submitted,children:l("export-transcript.email.success")})]})},xw="_inputContainer_fi5ao_1",Cw={inputContainer:xw},Rw="_blockUserInput_pot9c_1",ww={blockUserInput:Rw},Nw=({visible:n})=>{const a=tt();return n?y.jsx("div",{className:$(ww.blockUserInput,"chat__blockUserInput"),children:a("block-user-input.title")}):null},Mw="_commandsDropdown_5ytuv_1",Dw="_commands_5ytuv_1",Lw="_command_5ytuv_1",Bw="_commandActive_5ytuv_46",Uw="_commandsSelections_5ytuv_55",Kl={commandsDropdown:Mw,commands:Dw,command:Lw,commandActive:Bw,commandsSelections:Uw},jw=(n,a,i,l,o)=>{H.useEffect(()=>{const c=d=>{if(n.length)switch(d.key){case"Enter":i(n[a]);break;case"ArrowUp":l(h=>h>0?h-1:n.length-1);break;case"ArrowDown":l(h=>h<n.length-1?h+1:0);break;case"Escape":o([]);break}};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c)}},[n,a,i,l,o])},Hw=({text:n,commands:a,onSelectCommand:i,onVisibilityChange:l})=>{const o=H.useRef(null),c=tt(),[d,h]=H.useState([]),[m,g]=H.useState(hv(a)),[v,E]=H.useState(0),S=w=>i(`/${w}`);return rm(o,()=>h([])),jw(d,v,S,E,h),H.useEffect(()=>{g(hv(a))},[a]),H.useEffect(()=>{const w=n.length||0;w===0||w>m||!n.startsWith("/")?h([]):h(a.filter(Iw(n))),E(0)},[a,n,m]),H.useEffect(()=>{l(!!d.length)},[d,l]),d.length?y.jsx("div",{ref:o,className:Kl.commandsDropdown,children:y.jsx("ul",{id:"command-list",className:Kl.commands,role:"listbox",children:d.map((w,_)=>y.jsxs("li",{className:$([Kl.command,v===_&&Kl.commandActive]),role:"option",onClick:()=>S(w),onMouseOver:()=>E(_),children:[y.jsxs("h1",{children:["/",w]}),y.jsx("p",{children:c(`commands.${w}`)})]},w))})}):null},hv=n=>Math.max(...n.map(a=>a.length+1)),Iw=n=>a=>{const i=`/${a}`;return i.startsWith(n)&&i.length>=n.length},mv=3,zw=({commands:n,onSelectCommand:a})=>{const i=tt(),[l,o]=H.useState(!1),c=g=>()=>{a(`/${g}`),o(!1)},d=()=>{o(!0)},h=()=>{o(!1)},m=l?n:n.slice(0,mv);return y.jsxs("div",{className:Kl.commandsSelections,children:[m.map(g=>y.jsxs("button",{className:"tooltip--top-center","aria-label":i(`commands.${g}`),"data-title":i(`commands.${g}`),tabIndex:0,onClick:c(g),children:["/",g]},g)),m.length<n.length?y.jsx("button",{"aria-label":i("commands.show-more.tooltip"),"data-title":i("commands.show-more.tooltip"),tabIndex:0,onClick:d,children:i("commands.show-more.action")},"show-more"):m.length>mv?y.jsx("button",{"aria-label":i("commands.show-less.tooltip"),"data-title":i("commands.show-less.tooltip"),tabIndex:0,onClick:h,children:i("commands.show-less.action")},"show-less"):null]})},Gw="_callToActionContainer_d8izj_1",kw="_callToActionTitle_d8izj_23",qw="_rateOverlay_d8izj_30",Fw="_body_d8izj_52",Vw="_footer_d8izj_60",Yw="_actions_d8izj_75",Pw="_bubbles_d8izj_89",Xw="_stars_d8izj_191",Zw="_starsSmall_d8izj_205",Qw="_starsLarge_d8izj_211",Kw="_star_d8izj_191",$w="_starReadonly_d8izj_225",Ww="_starIcon_d8izj_235",Jw="_starsDescriptionContainer_d8izj_253",e3="_starsDescription_d8izj_253",Gt={callToActionContainer:Gw,callToActionTitle:kw,rateOverlay:qw,body:Fw,footer:Vw,actions:Yw,bubbles:Pw,stars:Xw,starsSmall:Zw,starsLarge:Qw,star:Kw,starReadonly:$w,starIcon:Ww,starsDescriptionContainer:Jw,starsDescription:e3},t3=({value:n,index:a,count:i,readonly:l,onHover:o,onClick:c})=>{const d=h=>{c&&h.key==="Enter"&&c()};return y.jsx("li",{className:$(Gt.star,{[Gt.starReadonly]:l},"chat__conversationRating__star"),children:y.jsx("div",{role:"radio","aria-checked":n>a?"true":"false","aria-posinset":a+1,"aria-setsize":i,tabIndex:0,onMouseOver:o,onKeyDown:d,onClick:c,children:y.jsx("span",{role:"img","aria-label":"Star",className:$(Gt.starIcon),children:y.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"star",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"})})})})})},pv=5,A_=({value:n,size:a,readonly:i=!1,onChange:l})=>{const[o,c]=H.useState(void 0),d=()=>{c(void 0)},h=g=>()=>{if(!i){const v=g+1;c(v)}},m=g=>()=>{l&&!i&&(l(g===0&&n===1?0:g+1),c(void 0))};return y.jsx("ul",{tabIndex:0,role:"radiogroup",className:$(Gt.stars,{[Gt.starsSmall]:a==="small",[Gt.starsLarge]:a==="large"},"chat__conversationRating__stars",{chat__conversationRating__stars__small:a==="small",chat__conversationRating__stars__large:a==="large"}),onMouseOut:d,children:Array(pv).fill(0).map((g,v)=>y.jsx(t3,{value:o===void 0?n:o,index:v,count:pv,readonly:i,onHover:h(v),onClick:m(v)},v))})},n3=({visible:n,onRate:a})=>{const i=tt();return n?y.jsxs("div",{className:$(Gt.callToActionContainer,"chat__conversationRating__callToAction"),children:[y.jsx("div",{className:$(Gt.callToActionTitle,"chat__conversationRating__callToAction__title"),children:i("conversation-rating.call-to-action.title")}),y.jsx(A_,{value:0,size:"small",onChange:a})]}):null},jd=({isFirstMessageBySender:n,isLastMessageBySender:a,children:i})=>y.jsxs("div",{className:$(pe.message,pe.messageBot,n&&pe.messageBotFirst,a&&pe.messageBotLast,"chat__bubbleContainer","chat__botBubbleContainer",n&&"chat__bubbleContainer--first",a&&"chat__bubbleContainer--last"),children:[y.jsx("img",{className:$(pe.avatar,pe.botAvatar),src:"bot.svg",alt:"Bot"}),y.jsx("div",{className:$(pe.bubble,pe.bubbleLeft,"chat__bubble","chat__botBubble"),children:y.jsx("div",{className:$(pe.leftText,pe.bubbleContent),children:i})})]}),a3=({children:n})=>y.jsx("div",{className:$(pe.message,pe.messageGuest,pe.messageGuestFirst,pe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer","chat__bubbleContainer--first","chat__bubbleContainer--last"),children:y.jsx("div",{className:$(pe.bubble,pe.bubbleRight,"chat__bubble","chat__guestBubble"),children:y.jsx("div",{className:$(pe.rightText,pe.bubbleContent),children:n})})}),r3=()=>{const n=tt(),a=Ba(),i=st(T=>T.chat.conversationRating),[l,o]=H.useState(i.rating?.value||0),[c,d]=H.useState(void 0),[h,m]=H.useState(void 0),[g,v]=H.useState({submitted:!1,feedback:""}),E=H.useRef(null),[S,w]=H.useState(!1);H.useEffect(()=>{i.opener?(v({submitted:!1,feedback:""}),m(!0)):h===!0&&m(!1)},[i.opener,h]),H.useEffect(()=>{o(i.rating?.value||0)},[i.rating?.value,i.opener]),H.useEffect(()=>{E.current&&(E.current.value=i.rating?.feedback||"")},[i.rating?.feedback]),H.useEffect(()=>{const T=l>0?n(`conversation-rating.overlay.bot-message.rate-feedback.value-${l}`):void 0;d(T?.length?T:void 0)},[l,n]),H.useEffect(()=>{g.submitted?setTimeout(()=>w(!0),g.feedback.length?500:0):w(!1)},[g]);const _=T=>{T.preventDefault();const D=E.current?.value?.trim()||"";a(ZO(l,D)),v({submitted:!0,feedback:D})},x=()=>{i.opener==="CLOSE_CHAT"?a(n_()):i.opener==="RESTART_CHAT"?a(ls()):a(Xx())};return y.jsx("div",{className:$(Gt.rateOverlay,Ma.bottomSheet,"chat__conversationRating__overlay",{[Ma.bottomSheetOpen]:h===!0,[Ma.bottomSheetClose]:h===!1}),children:y.jsxs("form",{onSubmit:_,children:[y.jsxs("div",{className:$(Gt.body,"chat__conversationRating__overlay__body"),children:[y.jsx("div",{}),y.jsx("div",{className:$(Gt.bubbles),children:i.opener&&y.jsxs(y.Fragment,{children:[y.jsxs(jd,{isFirstMessageBySender:!0,isLastMessageBySender:!c,children:[y.jsx("h2",{children:n("conversation-rating.overlay.title")}),y.jsxs("div",{className:$(Gt.starsDescriptionContainer),children:[y.jsx(A_,{value:l,size:"large",readonly:g.submitted,onChange:o}),y.jsxs("div",{className:$(Gt.starsDescription),children:[y.jsx("div",{children:n("conversation-rating.overlay.star.very-bad")}),y.jsx("div",{children:n("conversation-rating.overlay.star.very-good")})]})]})]}),c&&y.jsx(jd,{isFirstMessageBySender:!1,isLastMessageBySender:!S||!!g.feedback.length,children:y.jsx("div",{children:c})}),!!g.feedback.length&&y.jsx(a3,{children:g.feedback}),S&&y.jsx(jd,{isFirstMessageBySender:!!g.feedback.length,isLastMessageBySender:!0,children:y.jsx("div",{children:n("conversation-rating.overlay.bot-message.submit-feedback")})})]})})]}),y.jsxs("div",{className:$(Gt.footer,"chat__conversationRating__overlay__footer"),children:[!g.submitted&&y.jsx("input",{ref:E,defaultValue:i.rating?.feedback||"",placeholder:n("conversation-rating.overlay.guest-feedback.input-placeholder")}),y.jsxs("div",{className:$(Gt.actions,"chat__conversationRating__overlay__footer__actions"),children:[g.submitted?y.jsx(yu,{type:"button",disabled:!l,onClick:x,children:i.opener==="CLOSE_CHAT"?n("conversation-rating.overlay.action.close-chat"):i.opener==="RESTART_CHAT"?n("conversation-rating.overlay.action.restart-chat"):n("conversation-rating.overlay.action.back-to-chat")},"close-button"):y.jsx(yu,{type:"submit",disabled:!l,children:n("conversation-rating.overlay.action.submit")},"submit-button"),i.opener!=="CHAT"&&!g.submitted&&y.jsx(T_,{onClick:x,children:i.opener==="CLOSE_CHAT"?n("conversation-rating.overlay.action.close-chat"):i.opener==="RESTART_CHAT"?n("conversation-rating.overlay.action.restart-chat"):n("conversation-rating.overlay.action.cancel")})]})]})]})})},i3=({numberOfMessagesFromGuest:n})=>{const a=Ba(),i=st(c=>c.chat.conversationRating),l=c=>{a(pu("CHAT",c))},o=!i.rating?.value&&n>=1;return i.enabled?y.jsxs(y.Fragment,{children:[y.jsx(n3,{visible:o,onRate:l}),y.jsx(r3,{})]}):null},l3=H.memo(i3),s3="_inputWrapper_e3h44_1",o3="_withOpenCommands_e3h44_14",u3="_messageInputWrapper_e3h44_20",c3="_messageInput_e3h44_20",f3="_buttons_e3h44_44",d3="_button_e3h44_44",Ri={inputWrapper:s3,withOpenCommands:o3,messageInputWrapper:u3,messageInput:c3,buttons:f3,button:d3},h3="_audioRecorder_g845f_1",m3="_audioButton_g845f_6",p3="_recorderIcon_g845f_37",g3="_spinning_g845f_60",Hr={audioRecorder:h3,audioButton:m3,recorderIcon:p3,spinning:g3},gv=2048,vu=16e3;class y3 extends kv.Component{audioInput=null;volume=null;leftchannel=[];recorder=null;recordingLength=0;sampleRate=null;mediaStream=null;constructor(a){super(a),this.state={recordingState:"none"},this.triggerAudioRecording=this.triggerAudioRecording.bind(this),this.triggerAudioRecordingSuccess=this.triggerAudioRecordingSuccess.bind(this),this.initRecording=this.initRecording.bind(this),this.processRecordingInput=this.processRecordingInput.bind(this),this.handleClickSubmitAudio=this.handleClickSubmitAudio.bind(this),this.handleClickStopAudio=this.handleClickStopAudio.bind(this)}triggerAudioRecording(){this.setState({recordingState:"connecting"}),navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(this.triggerAudioRecordingSuccess)}triggerAudioRecordingSuccess(a){this.mediaStream=a,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(a)}initRecording(a){const i=window.AudioContext||window.webkitAudioContext,l=new i;this.sampleRate=l.sampleRate,this.volume=l.createGain(),this.audioInput=l.createMediaStreamSource(a),this.audioInput.connect(this.volume),this.recorder=l.createScriptProcessor(gv,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(l.destination)}processRecordingInput(a){if(this.state.recordingState==="connecting"&&this.setState({recordingState:"recording"}),this.state.recordingState!=="none"){const i=a.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(i)),this.recordingLength+=gv}}handleClickSubmitAudio(){const a=b3(this.leftchannel,this.recordingLength),i=_3(a,this.sampleRate||0),l=v3(i);this.props.onAudioRecorded(l),this.handleClickStopAudio()}handleClickStopAudio(){this.setState({recordingState:"none"}),this.audioInput?.disconnect(),this.volume?.disconnect(),this.recorder?.disconnect(),this.mediaStream&&this.mediaStream?.getAudioTracks().forEach(a=>{a.stop()})}render(){return y.jsxs("div",{className:Hr.audioRecorder,children:[this.state.recordingState==="none"&&y.jsx("button",{className:$(Hr.audioButton,"chat__button"),type:"submit","aria-label":this.props.translate("message-input.actions.start-audio-recording.label"),"data-title":this.props.translate("message-input.actions.start-audio-recording.label"),tabIndex:0,onClick:this.triggerAudioRecording,children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"}),y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),this.state.recordingState==="connecting"&&y.jsxs("svg",{className:Hr.spinning,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]}),this.state.recordingState==="recording"&&y.jsxs("div",{className:Hr.audioRecorder,children:[y.jsx("button",{className:$(Hr.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate("message-input.actions.stop-audio-recording.label"),tabIndex:0,children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),y.jsx("div",{className:Hr.recorderIcon}),y.jsx("button",{className:$(Hr.audioButton),type:"submit",onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate("message-input.actions.submit-audio-recording.label"),tabIndex:0,autoFocus:!0,children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),y.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})]})})]})]})}}const v3=n=>{const a=new ArrayBuffer(44+n.length*2),i=new DataView(a);Ko(i,0,"RIFF"),i.setUint32(4,44+n.length*2,!0),Ko(i,8,"WAVE"),Ko(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,vu,!0),i.setUint32(28,vu*4,!0),i.setUint16(32,4,!0),i.setUint16(34,16,!0),Ko(i,36,"data"),i.setUint32(40,n.length*2,!0);const l=n.length;let o=44;const c=1;for(let d=0;d<l;d++)i.setInt16(o,n[d]*(32767*c),!0),o+=2;return new Blob([i],{type:"audio/wav"})},Ko=(n,a,i)=>{for(let l=0;l<i.length;l++)n.setUint8(a+l,i.charCodeAt(l))},b3=(n,a)=>{const i=new Float32Array(a);let l=0;const o=n.length;for(let c=0;c<o;c++){const d=n[c];i.set(d,l),l+=d.length}return i},_3=(n,a)=>{if(vu===a)return n;const i=a/vu,l=Math.round(n.length/i),o=new Float32Array(l);let c=0,d=0;for(;c<o.length;){const h=Math.round((c+1)*i);let m=0,g=0;for(let v=d;v<h&&v<n.length;v++)m+=n[v],g++;o[c]=m/g,c++,d=h}return o},E3=({disabled:n,textInput:a,commandsVisible:i,hasCommands:l,onTextInput:o,onTextInputSubmit:c,onAudioRecorded:d})=>{const h=tt(),m=H.useRef(null),{enableSpeechSupport:g}=st(_=>_.settings);H.useEffect(()=>{m.current?.focus()},[a]);const v=()=>{const _=m.current;_&&a.trim().length>=1&&c(a.trim())&&(_.value="",_.style.height="",_.focus())},E=_=>{_.preventDefault(),v()},S=_=>{const x=_.target.value;o(x),_.target.style.height="";const{scrollHeight:T}=_.target;_.target.style.height=`${T>150?150:T}px`},w=_=>{_.code==="Enter"&&!_.shiftKey?(_.repeat||v(),_.preventDefault()):i&&(_.code==="ArrowUp"||_.code==="ArrowDown")&&_.preventDefault()};return y.jsxs("form",{className:$(Ri.inputWrapper,i&&Ri.withOpenCommands,"chat__textInput"),onSubmit:E,children:[y.jsx("div",{className:Ri.messageInputWrapper,children:y.jsx("textarea",{id:"user_input",ref:m,className:Ri.messageInput,tabIndex:0,placeholder:h("message-input-placeholder"),value:a,onChange:S,onKeyDown:w,"aria-label":h("message-input-label"),"aria-controls":l?"command-list":void 0,"aria-haspopup":l?"listbox":void 0})}),y.jsx("div",{className:$(Ri.buttons,"chat__buttons"),children:a.length||!g||navigator.mediaDevices===void 0?y.jsx("button",{className:$(Ri.button,"chat__button"),type:"submit","aria-label":h("message-input.actions.submit.label"),"data-title":h("message-input.actions.submit.label"),tabIndex:0,disabled:n,children:y.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})}):g&&navigator.mediaDevices!==void 0&&y.jsx(y3,{translate:h,onAudioRecorded:d})})]})},S3="_quickReplies_83npe_1",T3="_quickReply_83npe_9",yv={quickReplies:S3,quickReply:T3},A3=({quickReplies:n,onQuickReplyClick:a})=>n.length?y.jsx("div",{className:$(yv.quickReplies,"chat__quickReplies"),children:n.map(i=>y.jsx(Ru,{tabIndex:0,className:$(yv.quickReply,"chat__button","chat__quickReply"),onClick:()=>a(i),children:i.label},i.label))}):null,vv=5e3,O3=1e3,x3=({isBotTyping:n,quickReplies:a,numberOfMessagesFromGuest:i,commands:l,onTextInput:o,onQuickReplyClick:c,onAudioRecorded:d})=>{const[h,m]=H.useState(""),[g,v]=H.useState(!1),[E,S]=H.useState(!1),w=H.useRef(0),_=H.useRef(0);H.useEffect(()=>{if(g&&!n){const D=w.current?Date.now()-w.current:0;D>vv?v(!1):setTimeout(()=>{v(!1)},vv-D)}},[g,n]),H.useEffect(()=>{g&&(w.current=Date.now())},[g]);const x=D=>{const z=Date.now()-_.current<O3;return E?!1:n||z?(v(!0),!1):(o(D),m(""),_.current=Date.now(),!0)},T=D=>{m(D+" ")};return y.jsxs("div",{className:$(Cw.inputContainer),children:[y.jsx(A3,{quickReplies:a,onQuickReplyClick:c}),y.jsx(Nw,{visible:g}),!g&&y.jsx(l3,{numberOfMessagesFromGuest:i}),!!l?.length&&y.jsx(Hw,{text:h,commands:l,onSelectCommand:T,onVisibilityChange:S}),y.jsx(E3,{textInput:h,disabled:g,commandsVisible:E,hasCommands:!!l?.length,onTextInput:m,onTextInputSubmit:x,onAudioRecorded:d}),!!l?.length&&y.jsx(zw,{commands:l,onSelectCommand:m})]})},C3=({clientName:n,messages:a,quickReplies:i,isBotTyping:l,drawerContentUrl:o,onMessageFromUser:c,onQuickReplyClick:d,onButtonClick:h,onLinkClick:m,onAudioRecorded:g,onTranscriptExport:v,onTranscriptItemReaction:E})=>{const S=Ba(),w=st(G=>G.connection.connectionState),{enableTranscriptExportEmail:_,commands:x}=st(G=>G.settings),{showTranscriptMailOverlay:T,conversationRating:D}=st(G=>G.chat),z=a.filter(G=>G.sender.type===gu.GUEST).length;H.useEffect(()=>{w===kr.CONNECTED&&S(r_(n))},[n,w,S]);const U=()=>{S(a_())};return y.jsxs("div",{className:yd.container,children:[y.jsxs("div",{className:$([yd.chatcontent,(T||D?.opener)&&yd.accessabilityHidden]),children:[y.jsx(lw,{messages:a,isBotTyping:l,commands:x,onButtonClick:h,onLinkClick:m,onTranscriptItemReaction:E}),y.jsx(x3,{isBotTyping:l,quickReplies:l?[]:i,numberOfMessagesFromGuest:z,commands:x,onQuickReplyClick:d,onTextInput:c,onAudioRecorded:g}),y.jsx(yw,{})]}),_&&y.jsx(Ow,{visible:!!T,onEmailExport:v,onClose:U}),y.jsx(hw,{contentUrl:o})]})},R3=n=>{const{messages:a,quickReplies:i,isBotTyping:l,drawerContentUrl:o}=n.chat;return{messages:a,quickReplies:i,isBotTyping:l,drawerContentUrl:o}},w3=n=>({onRestartChat:()=>n(ls()),onMessageFromUser:a=>n(Mb(a)),onAudioRecorded:a=>n(FO(a)),onActionFromUser:a=>n(a),onQuickReplyClick:a=>n(Nb(a)),onNluEvent:a=>n(jb(a)),onButtonClick:a=>n(KO(a)),onLinkClick:a=>n(Hb(a)),onTranscriptExport:a=>n(YO(a)),onTranscriptItemReaction:(a,i)=>{n(Te.Actions.transcriptItemGuestReaction(a,i?.type||null,i?.category,i?.comment))}}),N3=dT(R3,w3)(C3),O_=()=>{const[n,a]=H.useState(!1);return H.useEffect(()=>{a((()=>{try{return window.self!==window.top}catch{return!0}})())},[]),n},M3=n=>a=>{const i=a.key;(i==="ArrowDown"||i==="ArrowRight"||i==="Enter"||i===" "||i==="Space")&&(a.stopPropagation(),n())},D3=({onClick:n})=>{const a=tt();return O_()?y.jsx("button",{className:"tooltip--bottom-left","aria-label":a("header.close-chat"),"data-title":a("header.close-chat"),tabIndex:0,onClick:n,onKeyDown:M3(n),children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"})})}):null},L3="_header_3gvbz_1",B3="_logoContainer_3gvbz_14",U3="_logo_3gvbz_14",j3="_actions_3gvbz_28",H3="_active_3gvbz_43",I3="_menuContainer_3gvbz_56",z3="_menu_3gvbz_56",G3="_divider_3gvbz_86",cr={header:L3,logoContainer:B3,logo:U3,actions:j3,active:H3,menuContainer:I3,menu:z3,divider:G3},k3=({icon:n})=>{switch(n){case"arrow-counter-clockwise":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"})});case"download":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"})});case"expand":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M214,48V96a6,6,0,0,1-12,0V62.48l-53.76,53.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM107.76,139.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l53.76-53.76a6,6,0,0,0-8.48-8.48Z"})});case"mail":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"})});case"phone":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M144.27,45.93a8,8,0,0,1,9.8-5.66,86.22,86.22,0,0,1,61.66,61.66,8,8,0,0,1-5.66,9.8A8.23,8.23,0,0,1,208,112a8,8,0,0,1-7.73-5.94,70.35,70.35,0,0,0-50.33-50.33A8,8,0,0,1,144.27,45.93Zm-2.33,41.8c13.79,3.68,22.65,12.54,26.33,26.33A8,8,0,0,0,176,120a8.23,8.23,0,0,0,2.07-.27,8,8,0,0,0,5.66-9.8c-5.12-19.16-18.5-32.54-37.66-37.66a8,8,0,1,0-4.13,15.46Zm81.94,95.35A56.26,56.26,0,0,1,168,232C88.6,232,24,167.4,24,88A56.26,56.26,0,0,1,72.92,32.12a16,16,0,0,1,16.62,9.52l21.12,47.15,0,.12A16,16,0,0,1,109.39,104c-.18.27-.37.52-.57.77L88,129.45c7.49,15.22,23.41,31,38.83,38.51l24.34-20.71a8.12,8.12,0,0,1,.75-.56,16,16,0,0,1,15.17-1.4l.13.06,47.11,21.11A16,16,0,0,1,223.88,183.08Zm-15.88-2s-.07,0-.11,0h0l-47-21.05-24.35,20.71a8.44,8.44,0,0,1-.74.56,16,16,0,0,1-15.75,1.14c-18.73-9.05-37.4-27.58-46.46-46.11a16,16,0,0,1,1-15.7,6.13,6.13,0,0,1,.57-.77L96,95.15l-21-47a.61.61,0,0,1,0-.12A40.2,40.2,0,0,0,40,88,128.14,128.14,0,0,0,168,216,40.21,40.21,0,0,0,208,181.07Z"})});case"scroll":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M96,104a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H104A8,8,0,0,1,96,104Zm8,40h64a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16Zm128,48a32,32,0,0,1-32,32H88a32,32,0,0,1-32-32V64a16,16,0,0,0-32,0c0,5.74,4.83,9.62,4.88,9.66h0A8,8,0,0,1,24,88a7.89,7.89,0,0,1-4.79-1.61h0C18.05,85.54,8,77.61,8,64A32,32,0,0,1,40,32H176a32,32,0,0,1,32,32V168h8a8,8,0,0,1,4.8,1.6C222,170.46,232,178.39,232,192ZM96.26,173.48A8.07,8.07,0,0,1,104,168h88V64a16,16,0,0,0-16-16H67.69A31.71,31.71,0,0,1,72,64V192a16,16,0,0,0,32,0c0-5.74-4.83-9.62-4.88-9.66A7.82,7.82,0,0,1,96.26,173.48ZM216,192a12.58,12.58,0,0,0-3.23-8h-94a26.92,26.92,0,0,1,1.21,8,31.82,31.82,0,0,1-4.29,16H200A16,16,0,0,0,216,192Z"})});case"star":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"})});case"link":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"})});default:return y.jsx("div",{})}},q3=H.forwardRef(({selected:n,item:a,onClick:i},l)=>{const o=tt(),c=d=>{d.preventDefault(),i()};return y.jsx("li",{"aria-selected":n,role:"option",className:a.withDivider?cr.divider:void 0,children:y.jsxs("a",{ref:l,type:"button",role:"button",tabIndex:-1,onClick:c,children:[y.jsx(k3,{icon:a.icon}),y.jsx("span",{children:o(`header.menu.${a.id}`)})]})})}),F3=(n,a)=>{const i=O_(),{menuItems:l,enableStandaloneView:o,enableTranscriptExportPdf:c,enableTranscriptExportEmail:d}=st(g=>g.settings),h=st(g=>g.chat.conversationRating.enabled);return H.useMemo(()=>{const g=[],v=l.filter(({visibility:E})=>n?E==="always"||E==="chat-only":E==="always"||E==="start-screen-only");if(n&&(g.push({id:"restart-chat",type:"restart-chat",icon:"arrow-counter-clockwise",visibility:"chat-only"}),i&&o&&g.push({id:"expand-chat-window",type:"expand-chat-window",icon:"expand",visibility:"always"}),a&&c&&g.push({id:"download-transcript",type:"download-transcript",icon:"download",visibility:"chat-only"}),a&&d&&g.push({id:"send-transcript",type:"send-transcript",icon:"mail",visibility:"chat-only"}),a&&h&&g.push({id:"rate-conversation",type:"rate-conversation",icon:"star",visibility:"chat-only"}),g.length>0&&v.length)){const E=g.pop();E&&l.length&&g.push({...E,withDivider:!0})}return g.push(...v),g},[n,a,c,d,o,h,i,l])},V3=({chatStarted:n,hasGuestMessages:a})=>{const i=Ba(),l=tt(),[o,c]=H.useState(!1),[d,h]=H.useState(-1),m=H.useRef(null),g=H.useRef(null),v=H.useRef([]),E=F3(n,a);H.useEffect(()=>{v.current[d]?.focus()},[d]);const S=H.useCallback(()=>{i(a?pu("RESTART_CHAT"):ls()),c(!1),h(0)},[a,i]),w=H.useCallback(T=>{switch(T.type){case"restart-chat":S();break;case"expand-chat-window":window.open(window.location.href,"_blank");break;case"download-transcript":i(PO());break;case"send-transcript":i(a_());break;case"rate-conversation":i(pu("MENU"));break;case"link":i(Hb(T.url));break;case"action":i(JSON.parse(JSON.stringify(T.action)));break}c(!1)},[i,S,c]);H.useEffect(()=>{const T=D=>{if(o)switch(D.key){case"Enter":D.preventDefault(),w(E[d]);break;case"ArrowUp":h(z=>z>0?z-1:E.length-1);break;case"ArrowDown":h(z=>z<E.length-1?z+1:0);break;case"Escape":c(!1);break;case"Tab":d>-1&&c(!1);break}};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[o,d,E,h,c,w]),H.useEffect(()=>{o||h(-1)},[o,d]),rm(g,()=>c(!1));const _=()=>{c(T=>!T)},x=()=>{setTimeout(()=>{const T=document.activeElement;g.current&&!g.current.contains(T)&&c(!1)},0)};return E.length?y.jsxs("div",{className:$(cr.menuContainer),ref:g,children:[y.jsx("button",{ref:m,className:$(o&&cr.active,o?"tooltip-hidden":"tooltip--bottom-left"),"aria-label":l("header.menu.title"),"data-title":l("header.menu.title"),onClick:_,onBlur:x,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"})})}),o&&y.jsx("nav",{className:cr.menu,"aria-label":l("header.menu.title"),children:y.jsx("ul",{tabIndex:0,children:E.map((T,D)=>y.jsx(q3,{ref:z=>{v.current[D]=z},selected:d===D,item:T,onClick:()=>w(T)},T.id))})})]}):null},bv=({className:n,chatStarted:a,...i})=>{const l=Ba(),o=st(h=>h.chat.conversationRating),c=st(h=>h.chat.messages.some(m=>m.sender.type===Te.UserType.GUEST)),d=()=>{o.enabled&&!o.opener&&c?l(pu("CLOSE_CHAT")):l(n_())};return y.jsxs("div",{className:$([cr.header,n]),...i,children:[y.jsx("div",{className:cr.logoContainer,children:y.jsx("div",{className:cr.logo})}),y.jsxs("div",{className:cr.actions,children:[y.jsx(V3,{chatStarted:a,hasGuestMessages:c}),y.jsx(D3,{onClick:d})]})]})},Y3="_chatwindow_rkbir_1",P3="_chatwindowWithAside_rkbir_21",_v={chatwindow:Y3,chatwindowWithAside:P3},x_=()=>{const[n,a]=H.useState(!1);return H.useEffect(()=>{const i=window.matchMedia("(max-width: 1023px)"),l=()=>a(i.matches);return l(),i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[]),n},X3="_sourceInfos_vei0l_1",Z3="_waitForLoading_vei0l_24",Q3="_loadingContent_vei0l_28",K3="_sourceHeader_vei0l_37",$3="_sourceHeaderIcon_vei0l_57",W3="_sourceContent_vei0l_61",J3="_openSourceButton_vei0l_69",eN="_sourceButtonLabel_vei0l_79",tN="_closeSourceInfosButton_vei0l_101",nN="_loadingSourceInfos_vei0l_125",aN="_loading_vei0l_28",rN="_loadingError_vei0l_139",iN="_highlightLoadingInfo_vei0l_155",lN="_highlightLoadingInfoInnerContainer_vei0l_169",sN="_highlightLoadingInfoContent_vei0l_178",oN="_highlightLoadingInfoCloseIcon_vei0l_198",uN="_highlightLoader_vei0l_203",cN="_highlightLoaderLoading_vei0l_210",xt={sourceInfos:X3,waitForLoading:Z3,loadingContent:Q3,sourceHeader:K3,sourceHeaderIcon:$3,sourceContent:W3,openSourceButton:J3,sourceButtonLabel:eN,closeSourceInfosButton:tN,loadingSourceInfos:nN,loading:aN,loadingError:rN,highlightLoadingInfo:iN,highlightLoadingInfoInnerContainer:lN,highlightLoadingInfoContent:sN,highlightLoadingInfoCloseIcon:oN,highlightLoader:uN,highlightLoaderLoading:cN},fN=({onClick:n})=>{const a=tt();return y.jsx("button",{className:$(xt.closeSourceInfosButton,"tooltip--bottom-left"),"aria-label":a("source-infos.close"),"data-title":a("source-infos.close"),tabIndex:0,onClick:n,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})})},dN=H.forwardRef(({sourceInfos:n,onClose:a,...i},l)=>y.jsxs("div",{className:xt.sourceHeader,...i,ref:l,children:[y.jsx("div",{children:n?y.jsx("p",{id:"source-info-title",children:n.title}):y.jsx("p",{children:" "})}),y.jsx(fN,{onClick:a})]})),hN=({loading:n})=>y.jsx("div",{className:xt.highlightLoader,children:n&&y.jsx("div",{className:xt.highlightLoaderLoading})});/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:C_,setPrototypeOf:Ev,isFrozen:mN,getPrototypeOf:pN,getOwnPropertyDescriptor:gN}=Object;let{freeze:kt,seal:xn,create:gh}=Object,{apply:yh,construct:vh}=typeof Reflect<"u"&&Reflect;kt||(kt=function(a){return a});xn||(xn=function(a){return a});yh||(yh=function(a,i){for(var l=arguments.length,o=new Array(l>2?l-2:0),c=2;c<l;c++)o[c-2]=arguments[c];return a.apply(i,o)});vh||(vh=function(a){for(var i=arguments.length,l=new Array(i>1?i-1:0),o=1;o<i;o++)l[o-1]=arguments[o];return new a(...l)});const $o=qt(Array.prototype.forEach),yN=qt(Array.prototype.lastIndexOf),Sv=qt(Array.prototype.pop),Fl=qt(Array.prototype.push),vN=qt(Array.prototype.splice),au=qt(String.prototype.toLowerCase),Hd=qt(String.prototype.toString),Id=qt(String.prototype.match),Vl=qt(String.prototype.replace),bN=qt(String.prototype.indexOf),_N=qt(String.prototype.trim),In=qt(Object.prototype.hasOwnProperty),It=qt(RegExp.prototype.test),Yl=EN(TypeError);function qt(n){return function(a){a instanceof RegExp&&(a.lastIndex=0);for(var i=arguments.length,l=new Array(i>1?i-1:0),o=1;o<i;o++)l[o-1]=arguments[o];return yh(n,a,l)}}function EN(n){return function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return vh(n,i)}}function Ce(n,a){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:au;Ev&&Ev(n,null);let l=a.length;for(;l--;){let o=a[l];if(typeof o=="string"){const c=i(o);c!==o&&(mN(a)||(a[l]=c),o=c)}n[o]=!0}return n}function SN(n){for(let a=0;a<n.length;a++)In(n,a)||(n[a]=null);return n}function Ra(n){const a=gh(null);for(const[i,l]of C_(n))In(n,i)&&(Array.isArray(l)?a[i]=SN(l):l&&typeof l=="object"&&l.constructor===Object?a[i]=Ra(l):a[i]=l);return a}function Pl(n,a){for(;n!==null;){const l=gN(n,a);if(l){if(l.get)return qt(l.get);if(typeof l.value=="function")return qt(l.value)}n=pN(n)}function i(){return null}return i}const Tv=kt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zd=kt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Gd=kt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),TN=kt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kd=kt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),AN=kt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Av=kt(["#text"]),Ov=kt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),qd=kt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xv=kt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Wo=kt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ON=xn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),xN=xn(/<%[\w\W]*|[\w\W]*%>/gm),CN=xn(/\$\{[\w\W]*/gm),RN=xn(/^data-[\-\w.\u00B7-\uFFFF]+$/),wN=xn(/^aria-[\-\w]+$/),R_=xn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NN=xn(/^(?:\w+script|data):/i),MN=xn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),w_=xn(/^html$/i),DN=xn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cv=Object.freeze({__proto__:null,ARIA_ATTR:wN,ATTR_WHITESPACE:MN,CUSTOM_ELEMENT:DN,DATA_ATTR:RN,DOCTYPE_NAME:w_,ERB_EXPR:xN,IS_ALLOWED_URI:R_,IS_SCRIPT_OR_DATA:NN,MUSTACHE_EXPR:ON,TMPLIT_EXPR:CN});const Xl={element:1,text:3,progressingInstruction:7,comment:8,document:9},LN=function(){return typeof window>"u"?null:window},BN=function(a,i){if(typeof a!="object"||typeof a.createPolicy!="function")return null;let l=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(l=i.getAttribute(o));const c="dompurify"+(l?"#"+l:"");try{return a.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Rv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function N_(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:LN();const a=re=>N_(re);if(a.version="3.3.0",a.removed=[],!n||!n.document||n.document.nodeType!==Xl.document||!n.Element)return a.isSupported=!1,a;let{document:i}=n;const l=i,o=l.currentScript,{DocumentFragment:c,HTMLTemplateElement:d,Node:h,Element:m,NodeFilter:g,NamedNodeMap:v=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:E,DOMParser:S,trustedTypes:w}=n,_=m.prototype,x=Pl(_,"cloneNode"),T=Pl(_,"remove"),D=Pl(_,"nextSibling"),z=Pl(_,"childNodes"),U=Pl(_,"parentNode");if(typeof d=="function"){const re=i.createElement("template");re.content&&re.content.ownerDocument&&(i=re.content.ownerDocument)}let G,M="";const{implementation:P,createNodeIterator:Q,createDocumentFragment:ae,getElementsByTagName:Be}=i,{importNode:He}=l;let ge=Rv();a.isSupported=typeof C_=="function"&&typeof U=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:be,ERB_EXPR:K,TMPLIT_EXPR:Se,DATA_ATTR:se,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:_e}=Cv;let{IS_ALLOWED_URI:me}=Cv,O=null;const F=Ce({},[...Tv,...zd,...Gd,...kd,...Av]);let X=null;const J=Ce({},[...Ov,...qd,...xv,...Wo]);let ee=Object.seal(gh(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,Ae=null;const We=Object.seal(gh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ke=!0,$t=!0,Ua=!1,bt=!0,jt=!1,dn=!0,wn=!1,hr=!1,Bi=!1,na=!1,ja=!1,Ha=!1,Yr=!0,ss=!1;const Mu="user-content-";let Ct=!0,mr=!1,aa={},ra=null;const pr=Ce({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let os=null;const Ui=Ce({},["audio","video","img","source","image","track"]);let ji=null;const us=Ce({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kn="http://www.w3.org/1998/Math/MathML",St="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let ct=Tt,Hi=!1,Ii=null;const Du=Ce({},[kn,St,Tt],Hd);let ia=Ce({},["mi","mo","mn","ms","mtext"]),la=Ce({},["annotation-xml"]);const Pr=Ce({},["title","style","font","a","script"]);let Wt=null;const Xr=["application/xhtml+xml","text/html"],gr="text/html";let ft=null,sa=null;const zi=i.createElement("form"),Ia=function(C){return C instanceof RegExp||C instanceof Function},Gi=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(sa&&sa===C)){if((!C||typeof C!="object")&&(C={}),C=Ra(C),Wt=Xr.indexOf(C.PARSER_MEDIA_TYPE)===-1?gr:C.PARSER_MEDIA_TYPE,ft=Wt==="application/xhtml+xml"?Hd:au,O=In(C,"ALLOWED_TAGS")?Ce({},C.ALLOWED_TAGS,ft):F,X=In(C,"ALLOWED_ATTR")?Ce({},C.ALLOWED_ATTR,ft):J,Ii=In(C,"ALLOWED_NAMESPACES")?Ce({},C.ALLOWED_NAMESPACES,Hd):Du,ji=In(C,"ADD_URI_SAFE_ATTR")?Ce(Ra(us),C.ADD_URI_SAFE_ATTR,ft):us,os=In(C,"ADD_DATA_URI_TAGS")?Ce(Ra(Ui),C.ADD_DATA_URI_TAGS,ft):Ui,ra=In(C,"FORBID_CONTENTS")?Ce({},C.FORBID_CONTENTS,ft):pr,fe=In(C,"FORBID_TAGS")?Ce({},C.FORBID_TAGS,ft):Ra({}),Ae=In(C,"FORBID_ATTR")?Ce({},C.FORBID_ATTR,ft):Ra({}),aa=In(C,"USE_PROFILES")?C.USE_PROFILES:!1,ke=C.ALLOW_ARIA_ATTR!==!1,$t=C.ALLOW_DATA_ATTR!==!1,Ua=C.ALLOW_UNKNOWN_PROTOCOLS||!1,bt=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,jt=C.SAFE_FOR_TEMPLATES||!1,dn=C.SAFE_FOR_XML!==!1,wn=C.WHOLE_DOCUMENT||!1,na=C.RETURN_DOM||!1,ja=C.RETURN_DOM_FRAGMENT||!1,Ha=C.RETURN_TRUSTED_TYPE||!1,Bi=C.FORCE_BODY||!1,Yr=C.SANITIZE_DOM!==!1,ss=C.SANITIZE_NAMED_PROPS||!1,Ct=C.KEEP_CONTENT!==!1,mr=C.IN_PLACE||!1,me=C.ALLOWED_URI_REGEXP||R_,ct=C.NAMESPACE||Tt,ia=C.MATHML_TEXT_INTEGRATION_POINTS||ia,la=C.HTML_INTEGRATION_POINTS||la,ee=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Ia(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Ia(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),jt&&($t=!1),ja&&(na=!0),aa&&(O=Ce({},Av),X=[],aa.html===!0&&(Ce(O,Tv),Ce(X,Ov)),aa.svg===!0&&(Ce(O,zd),Ce(X,qd),Ce(X,Wo)),aa.svgFilters===!0&&(Ce(O,Gd),Ce(X,qd),Ce(X,Wo)),aa.mathMl===!0&&(Ce(O,kd),Ce(X,xv),Ce(X,Wo))),C.ADD_TAGS&&(typeof C.ADD_TAGS=="function"?We.tagCheck=C.ADD_TAGS:(O===F&&(O=Ra(O)),Ce(O,C.ADD_TAGS,ft))),C.ADD_ATTR&&(typeof C.ADD_ATTR=="function"?We.attributeCheck=C.ADD_ATTR:(X===J&&(X=Ra(X)),Ce(X,C.ADD_ATTR,ft))),C.ADD_URI_SAFE_ATTR&&Ce(ji,C.ADD_URI_SAFE_ATTR,ft),C.FORBID_CONTENTS&&(ra===pr&&(ra=Ra(ra)),Ce(ra,C.FORBID_CONTENTS,ft)),Ct&&(O["#text"]=!0),wn&&Ce(O,["html","head","body"]),O.table&&(Ce(O,["tbody"]),delete fe.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');G=C.TRUSTED_TYPES_POLICY,M=G.createHTML("")}else G===void 0&&(G=BN(w,o)),G!==null&&typeof M=="string"&&(M=G.createHTML(""));kt&&kt(C),sa=C}},ki=Ce({},[...zd,...Gd,...TN]),qi=Ce({},[...kd,...AN]),cs=function(C){let Z=U(C);(!Z||!Z.tagName)&&(Z={namespaceURI:ct,tagName:"template"});const te=au(C.tagName),ze=au(Z.tagName);return Ii[C.namespaceURI]?C.namespaceURI===St?Z.namespaceURI===Tt?te==="svg":Z.namespaceURI===kn?te==="svg"&&(ze==="annotation-xml"||ia[ze]):!!ki[te]:C.namespaceURI===kn?Z.namespaceURI===Tt?te==="math":Z.namespaceURI===St?te==="math"&&la[ze]:!!qi[te]:C.namespaceURI===Tt?Z.namespaceURI===St&&!la[ze]||Z.namespaceURI===kn&&!ia[ze]?!1:!qi[te]&&(Pr[te]||!ki[te]):!!(Wt==="application/xhtml+xml"&&Ii[C.namespaceURI]):!1},Ft=function(C){Fl(a.removed,{element:C});try{U(C).removeChild(C)}catch{T(C)}},Nn=function(C,Z){try{Fl(a.removed,{attribute:Z.getAttributeNode(C),from:Z})}catch{Fl(a.removed,{attribute:null,from:Z})}if(Z.removeAttribute(C),C==="is")if(na||ja)try{Ft(Z)}catch{}else try{Z.setAttribute(C,"")}catch{}},Fi=function(C){let Z=null,te=null;if(Bi)C="<remove></remove>"+C;else{const Ee=Id(C,/^[\r\n\t ]+/);te=Ee&&Ee[0]}Wt==="application/xhtml+xml"&&ct===Tt&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const ze=G?G.createHTML(C):C;if(ct===Tt)try{Z=new S().parseFromString(ze,Wt)}catch{}if(!Z||!Z.documentElement){Z=P.createDocument(ct,"template",null);try{Z.documentElement.innerHTML=Hi?M:ze}catch{}}const nt=Z.body||Z.documentElement;return C&&te&&nt.insertBefore(i.createTextNode(te),nt.childNodes[0]||null),ct===Tt?Be.call(Z,wn?"html":"body")[0]:wn?Z.documentElement:nt},Vi=function(C){return Q.call(C.ownerDocument||C,C,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},hn=function(C){return C instanceof E&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof v)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},dt=function(C){return typeof h=="function"&&C instanceof h};function Je(re,C,Z){$o(re,te=>{te.call(a,C,Z,sa)})}const oa=function(C){let Z=null;if(Je(ge.beforeSanitizeElements,C,null),hn(C))return Ft(C),!0;const te=ft(C.nodeName);if(Je(ge.uponSanitizeElement,C,{tagName:te,allowedTags:O}),dn&&C.hasChildNodes()&&!dt(C.firstElementChild)&&It(/<[/\w!]/g,C.innerHTML)&&It(/<[/\w!]/g,C.textContent)||C.nodeType===Xl.progressingInstruction||dn&&C.nodeType===Xl.comment&&It(/<[/\w]/g,C.data))return Ft(C),!0;if(!(We.tagCheck instanceof Function&&We.tagCheck(te))&&(!O[te]||fe[te])){if(!fe[te]&&fs(te)&&(ee.tagNameCheck instanceof RegExp&&It(ee.tagNameCheck,te)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(te)))return!1;if(Ct&&!ra[te]){const ze=U(C)||C.parentNode,nt=z(C)||C.childNodes;if(nt&&ze){const Ee=nt.length;for(let Rt=Ee-1;Rt>=0;--Rt){const mn=x(nt[Rt],!0);mn.__removalCount=(C.__removalCount||0)+1,ze.insertBefore(mn,D(C))}}}return Ft(C),!0}return C instanceof m&&!cs(C)||(te==="noscript"||te==="noembed"||te==="noframes")&&It(/<\/no(script|embed|frames)/i,C.innerHTML)?(Ft(C),!0):(jt&&C.nodeType===Xl.text&&(Z=C.textContent,$o([be,K,Se],ze=>{Z=Vl(Z,ze," ")}),C.textContent!==Z&&(Fl(a.removed,{element:C.cloneNode()}),C.textContent=Z)),Je(ge.afterSanitizeElements,C,null),!1)},Zr=function(C,Z,te){if(Yr&&(Z==="id"||Z==="name")&&(te in i||te in zi))return!1;if(!($t&&!Ae[Z]&&It(se,Z))){if(!(ke&&It(L,Z))){if(!(We.attributeCheck instanceof Function&&We.attributeCheck(Z,C))){if(!X[Z]||Ae[Z]){if(!(fs(C)&&(ee.tagNameCheck instanceof RegExp&&It(ee.tagNameCheck,C)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(C))&&(ee.attributeNameCheck instanceof RegExp&&It(ee.attributeNameCheck,Z)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(Z,C))||Z==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&It(ee.tagNameCheck,te)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(te))))return!1}else if(!ji[Z]){if(!It(me,Vl(te,oe,""))){if(!((Z==="src"||Z==="xlink:href"||Z==="href")&&C!=="script"&&bN(te,"data:")===0&&os[C])){if(!(Ua&&!It(W,Vl(te,oe,"")))){if(te)return!1}}}}}}}return!0},fs=function(C){return C!=="annotation-xml"&&Id(C,_e)},ds=function(C){Je(ge.beforeSanitizeAttributes,C,null);const{attributes:Z}=C;if(!Z||hn(C))return;const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let ze=Z.length;for(;ze--;){const nt=Z[ze],{name:Ee,namespaceURI:Rt,value:mn}=nt,Vt=ft(Ee),qn=mn;let _t=Ee==="value"?qn:_N(qn);if(te.attrName=Vt,te.attrValue=_t,te.keepAttr=!0,te.forceKeepAttr=void 0,Je(ge.uponSanitizeAttribute,C,te),_t=te.attrValue,ss&&(Vt==="id"||Vt==="name")&&(Nn(Ee,C),_t=Mu+_t),dn&&It(/((--!?|])>)|<\/(style|title|textarea)/i,_t)){Nn(Ee,C);continue}if(Vt==="attributename"&&Id(_t,"href")){Nn(Ee,C);continue}if(te.forceKeepAttr)continue;if(!te.keepAttr){Nn(Ee,C);continue}if(!bt&&It(/\/>/i,_t)){Nn(Ee,C);continue}jt&&$o([be,K,Se],Pi=>{_t=Vl(_t,Pi," ")});const Yi=ft(C.nodeName);if(!Zr(Yi,Vt,_t)){Nn(Ee,C);continue}if(G&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Rt)switch(w.getAttributeType(Yi,Vt)){case"TrustedHTML":{_t=G.createHTML(_t);break}case"TrustedScriptURL":{_t=G.createScriptURL(_t);break}}if(_t!==qn)try{Rt?C.setAttributeNS(Rt,Ee,_t):C.setAttribute(Ee,_t),hn(C)?Ft(C):Sv(a.removed)}catch{Nn(Ee,C)}}Je(ge.afterSanitizeAttributes,C,null)},hs=function re(C){let Z=null;const te=Vi(C);for(Je(ge.beforeSanitizeShadowDOM,C,null);Z=te.nextNode();)Je(ge.uponSanitizeShadowNode,Z,null),oa(Z),ds(Z),Z.content instanceof c&&re(Z.content);Je(ge.afterSanitizeShadowDOM,C,null)};return a.sanitize=function(re){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=null,te=null,ze=null,nt=null;if(Hi=!re,Hi&&(re="<!-->"),typeof re!="string"&&!dt(re))if(typeof re.toString=="function"){if(re=re.toString(),typeof re!="string")throw Yl("dirty is not a string, aborting")}else throw Yl("toString is not a function");if(!a.isSupported)return re;if(hr||Gi(C),a.removed=[],typeof re=="string"&&(mr=!1),mr){if(re.nodeName){const mn=ft(re.nodeName);if(!O[mn]||fe[mn])throw Yl("root node is forbidden and cannot be sanitized in-place")}}else if(re instanceof h)Z=Fi("<!---->"),te=Z.ownerDocument.importNode(re,!0),te.nodeType===Xl.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?Z=te:Z.appendChild(te);else{if(!na&&!jt&&!wn&&re.indexOf("<")===-1)return G&&Ha?G.createHTML(re):re;if(Z=Fi(re),!Z)return na?null:Ha?M:""}Z&&Bi&&Ft(Z.firstChild);const Ee=Vi(mr?re:Z);for(;ze=Ee.nextNode();)oa(ze),ds(ze),ze.content instanceof c&&hs(ze.content);if(mr)return re;if(na){if(ja)for(nt=ae.call(Z.ownerDocument);Z.firstChild;)nt.appendChild(Z.firstChild);else nt=Z;return(X.shadowroot||X.shadowrootmode)&&(nt=He.call(l,nt,!0)),nt}let Rt=wn?Z.outerHTML:Z.innerHTML;return wn&&O["!doctype"]&&Z.ownerDocument&&Z.ownerDocument.doctype&&Z.ownerDocument.doctype.name&&It(w_,Z.ownerDocument.doctype.name)&&(Rt="<!DOCTYPE "+Z.ownerDocument.doctype.name+`>
118
- `+Rt),jt&&$o([be,K,Se],mn=>{Rt=Vl(Rt,mn," ")}),G&&Ha?G.createHTML(Rt):Rt},a.setConfig=function(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gi(re),hr=!0},a.clearConfig=function(){sa=null,hr=!1},a.isValidAttribute=function(re,C,Z){sa||Gi({});const te=ft(re),ze=ft(C);return Zr(te,ze,Z)},a.addHook=function(re,C){typeof C=="function"&&Fl(ge[re],C)},a.removeHook=function(re,C){if(C!==void 0){const Z=yN(ge[re],C);return Z===-1?void 0:vN(ge[re],Z,1)[0]}return Sv(ge[re])},a.removeHooks=function(re){ge[re]=[]},a.removeAllHooks=function(){ge=Rv()},a}var UN=N_();const jN=({onClose:n})=>{const a=tt();return y.jsxs("div",{className:xt.highlightLoadingInfo,onClick:n,children:[y.jsx("div",{className:xt.highlightLoadingInfoCloseIcon,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})}),y.jsxs("div",{className:xt.highlightLoadingInfoInnerContainer,children:[y.jsxs("div",{className:xt.highlightLoadingInfoContent,children:[y.jsx("h3",{children:a("source-infos.highlight-loading.title")}),y.jsx("p",{children:a("source-infos.highlight-loading.description")})]}),y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"#000000",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M253.66,106.34a8,8,0,0,0-11.32,0L192,156.69,107.31,72l50.35-50.34a8,8,0,1,0-11.32-11.32L96,60.69A16,16,0,0,0,93.18,79.5L72,100.69a16,16,0,0,0,0,22.62L76.69,128,18.34,186.34a8,8,0,0,0,3.13,13.25l72,24A7.88,7.88,0,0,0,96,224a8,8,0,0,0,5.66-2.34L136,187.31l4.69,4.69a16,16,0,0,0,22.62,0l21.19-21.18A16,16,0,0,0,203.31,168l50.35-50.34A8,8,0,0,0,253.66,106.34ZM93.84,206.85l-55-18.35L88,139.31,124.69,176ZM152,180.69,83.31,112,104,91.31,172.69,160Z"})})]})]})},HN=({title:n,href:a,children:i})=>y.jsx("a",{href:a,title:n,target:"_blank",rel:"noopener noreferrer",children:i}),IN=({className:n,children:a,...i})=>y.jsx("a",{className:$(ts.button,ts.buttonDefault,n),type:"button",role:"button",...i,children:a}),zN=n=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:y.jsx("path",{d:"M52,146H36a6,6,0,0,0-6,6v56a6,6,0,0,0,6,6H52a34,34,0,0,0,0-68Zm0,56H42V158H52a22,22,0,0,1,0,44Zm168.15-5.46a6,6,0,0,1,.18,8.48A28.06,28.06,0,0,1,200,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a28.06,28.06,0,0,1,20.33,9,6,6,0,0,1-8.66,8.3A16.23,16.23,0,0,0,200,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a16.23,16.23,0,0,0,11.67-5.28A6,6,0,0,1,220.15,196.54ZM128,146c-16.54,0-30,15.25-30,34s13.46,34,30,34,30-15.25,30-34S144.54,146,128,146Zm0,56c-9.93,0-18-9.87-18-22s8.07-22,18-22,18,9.87,18,22S137.93,202,128,202ZM48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Z"})}),GN=({type:n,...a})=>{switch(n){case"WEBSITE":return y.jsx(__,{...a});case"PDF":return y.jsx(b_,{...a});case"DOCX":return y.jsx(y_,{...a});case"TEXT":return y.jsx(zN,{...a});default:return y.jsx(v_,{...a})}},kN=({url:n,knowledgeBaseType:a})=>{const i=tt();return y.jsx(IN,{className:xt.openSourceButton,href:n,target:"_blank",children:y.jsxs("div",{className:xt.sourceButtonLabel,children:[y.jsx("div",{className:xt.sourceHeaderIcon,children:y.jsx(GN,{type:a})}),y.jsx("p",{children:i("source-infos.open-source")})]})})},qN=({sourceInfos:{content:n,url:a,knowledgeBaseType:i,highlighted:l}})=>{const[o,c]=H.useState(!l);H.useEffect(()=>{l&&c(!1)},[l]);const d=UN.sanitize(n,{USE_PROFILES:{html:!0}});return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:$(xt.sourceContent,S_.markdown),children:[y.jsx(Na,{options:{overrides:{a:HN}},children:d}),o&&y.jsx(jN,{onClose:()=>c(!1)})]}),y.jsx(kN,{url:a,knowledgeBaseType:i})]})},FN=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,VN=()=>{const n=tt();return y.jsxs("div",{className:xt.loadingError,children:[y.jsx("h1",{children:n("source-infos.error.title")}),y.jsx("img",{src:FN,title:n("source-infos.error.title")}),y.jsx("p",{children:n("source-infos.error.info")})]})},YN=()=>y.jsx("div",{className:xt.loadingSourceInfos,children:y.jsx("svg",{className:xt.loading,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"})})});function PN({sourceInfos:n,onClose:a,threshold:i=100}){const l=H.useRef(null),[o,c]=H.useState(0),[d,h]=H.useState(!1),m=H.useRef(null),g=H.useRef(null),v=H.useCallback(_=>{m.current=_,h(!0)},[]),E=H.useCallback(_=>{if(m.current!==null&&d){const x=_-m.current;x>0&&c(x)}},[d]),S=H.useCallback(()=>{h(!1),o>i&&a(),c(0),m.current=null},[o,i,a]),w=H.useCallback(_=>{const x=M=>v(M.touches[0].clientY),T=M=>E(M.touches[0].clientY),D=()=>S(),z=M=>{M.preventDefault(),v(M.clientY),window.addEventListener("mousemove",U),window.addEventListener("mouseup",G)},U=M=>E(M.clientY),G=()=>{S(),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",G)};_.addEventListener("touchstart",x),_.addEventListener("touchmove",T),_.addEventListener("touchend",D),_.addEventListener("mousedown",z),g.current=()=>{_.removeEventListener("touchstart",x),_.removeEventListener("touchmove",T),_.removeEventListener("touchend",D),_.removeEventListener("mousedown",z),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",G)}},[v,E,S]);return H.useEffect(()=>{let _;return(()=>{l.current?(g.current?.(),w(l.current)):(_=new MutationObserver(()=>{l.current&&(g.current?.(),w(l.current),_?.disconnect())}),_.observe(document.body,{childList:!0,subtree:!0}))})(),()=>{_?.disconnect(),g.current?.()}},[w,n]),{ref:l,dragOffsetY:o,isDragging:d}}const XN=n=>{const[a,i]=H.useState(!0);return H.useEffect(()=>{let l=null;return n?.type==="loading"?(i(!0),l=setTimeout(()=>{i(!1)},300)):i(!n),()=>{l&&clearTimeout(l)}},[n]),a},ZN=()=>{const n=Ba(),a=st(m=>m.chat.sourceInfos),i=x_(),l=H.useRef(null),o=XN(a);H.useEffect(()=>{l.current&&a?.type==="loading"&&(i?l.current.showModal():(l.current.setAttribute("open","true"),l.current?.focus()))},[a,i]);const c=H.useCallback(()=>{l.current&&(i?l.current.close():l.current.removeAttribute("open"),n(Zx()))},[n,i]),{ref:d,dragOffsetY:h}=PN({onClose:c,sourceInfos:a});return a?y.jsx("dialog",{ref:l,className:$(xt.sourceInfos,o?xt.waitForLoading:a.type==="loading"?xt.loadingContent:""),style:i&&h?{transform:`translateY(${h}px)`}:{},onClose:c,autoFocus:!0,role:"dialog","aria-labelledby":"source-info-title",children:o?null:y.jsxs(y.Fragment,{children:[y.jsx(dN,{ref:d,tabIndex:-1,sourceInfos:a.type==="loaded"?a:void 0,onClose:c}),a.type==="loading"?y.jsx(YN,{}):a.type==="loading-error"?y.jsx(VN,{}):y.jsxs(y.Fragment,{children:[y.jsx(hN,{loading:!a.highlighted}),y.jsx(qN,{sourceInfos:a})]})]})}):null},QN="_container_1aof3_1",KN="_body_1aof3_7",$N="_intro_1aof3_14",WN="_footer_1aof3_39",JN="_footnote_1aof3_43",e8="_containerWithFootnote_1aof3_58",t8="_startChatButton_1aof3_73",n8="_spinner_1aof3_88",a8="_formFields_1aof3_92",r8="_formField_1aof3_92",i8="_radio_1aof3_104",l8="_checkbox_1aof3_111",s8="_input_1aof3_119",o8="_inputLabel_1aof3_153",u8="_selectWrapper_1aof3_157",c8="_select_1aof3_157",f8="_selectLabel_1aof3_203",Ot={container:QN,body:KN,intro:$N,footer:WN,footnote:JN,containerWithFootnote:e8,startChatButton:t8,spinner:n8,formFields:a8,formField:r8,radio:i8,checkbox:l8,input:s8,inputLabel:o8,selectWrapper:u8,select:c8,selectLabel:f8},d8=({name:n,label:a,defaultValue:i,required:l,onChange:o})=>{const c=d=>{o(d.currentTarget.checked?"true":"false")};return y.jsxs("label",{className:$(Ot.checkbox,"chat__startScreen__checkbox"),htmlFor:n,children:[y.jsx("input",{type:"checkbox",id:n,name:n,defaultChecked:i==="true",required:l,onChange:c}),y.jsx("div",{children:a})]})},h8=({type:n,name:a,label:i,defaultValue:l,placeholder:o,required:c,multiple:d,min:h,max:m,pattern:g,onChange:v})=>{const E=S=>{v(S.target.value)};return y.jsxs("label",{className:$(Ot.input,"chat__startScreen__input"),htmlFor:a,children:[y.jsx("div",{className:$(Ot.inputLabel),children:i}),y.jsx("input",{type:n,id:a,name:a,defaultValue:l,placeholder:o,required:c,multiple:d,min:h,max:m,pattern:g,onChange:E})]})},m8=({name:n,value:a,label:i,defaultChecked:l,required:o,onChange:c})=>{const d=`${n}-${a}`,h=m=>{c(m.target.value)};return y.jsxs("label",{className:$(Ot.radio,"chat__startScreen__radio"),htmlFor:d,children:[y.jsx("input",{id:d,type:"radio",name:n,value:a,defaultChecked:l,required:o,onChange:h}),y.jsx("span",{className:$(Ot.label),children:i})]})},p8=({name:n,label:a,defaultValue:i,required:l,multiple:o,options:c,onChange:d})=>{const h=m=>{d(m.target.value)};return y.jsxs("label",{className:$(Ot.select,"chat__startScreen__select"),htmlFor:n,children:[y.jsx("div",{className:$(Ot.selectLabel),children:a}),y.jsx("div",{className:$(Ot.selectWrapper),children:y.jsx("select",{id:n,name:n,defaultValue:i,required:l,multiple:o,onChange:h,children:Object.entries(c||{}).map(([m,g])=>y.jsx("option",{value:m,selected:g===i,children:g}))})})]})},g8="start-screen.intro",y8="start-screen.start-chat",v8="start-screen.waiting-for-login",b8="start-screen.footnote",Hn="start-screen.form",wv=`${Hn}.fields`,_8=()=>{const n=tt(),a=Ba(),i=sm(),l=st(_=>_.startScreen.loginRequestToken),o=st(_=>_.settings.requiresUserAuthentication);H.useEffect(()=>{let _;if(l){const D=window.screenX+(window.outerWidth-600)/2,z=window.screenY+(window.outerHeight-700)/2,U=window.open(`/${i}/auth/login?loginRequestToken=${l}`,"Login",`width=600,height=700,left=${D},top=${z},resizable=yes,scrollbars=yes`);_=setInterval(()=>{U?.closed&&(a(Vx()),clearInterval(_))},500)}return()=>{_&&clearInterval(_)}},[i,l,a]);const[c,d]=H.useState({}),h=()=>{const _=Object.entries(c).reduce((x,[T,D])=>({...x,[T]:D.value}),{});a(o?Fx({loginRequestToken:uu(),formValues:_}):Gx({formValues:_}))},m=n(g8),g=n(l?v8:y8),v=n(b8),E=H.useMemo(()=>n(wv)?.split(";").map(_=>_.trim())??[],[n(wv)]);H.useEffect(()=>{E.length&&Object.keys(c).length===0&&d(E.reduce((_,x)=>({..._,[x]:E8(x,n)}),{}))},[n,E,c]);const S=_=>{_.preventDefault(),h()},w=_=>x=>{d(T=>({...T,[_]:{...T[_],value:x}}))};return y.jsxs("form",{onSubmit:S,className:$(Ot.container,v&&Ot.containerWithFootnote,"chat__startScreen"),children:[y.jsxs("div",{className:$(Ot.body,"chat__startScreen__body"),children:[m&&y.jsx("div",{className:$(Ot.intro,"chat__startScreen__intro"),children:y.jsx(Na,{options:{overrides:{a:Nv}},children:m})}),y.jsx("div",{className:$(Ot.formFields,"chat__startScreen__fields"),children:Object.values(c).map(({type:_,name:x,label:T,placeholder:D,defaultValue:z,options:U,required:G,multiple:M,min:P,max:Q,pattern:ae})=>y.jsx("div",{className:$(Ot.formField,"chat__startScreen__field"),children:(()=>{switch(_){case"radio":return y.jsxs(y.Fragment,{children:[y.jsx("div",{children:T}),Object.entries(U||{}).map(([Be,He])=>y.jsx(m8,{name:x,value:Be,label:He,defaultChecked:Be===z,required:G,onChange:w(x)},Be))]});case"checkbox":return y.jsx(d8,{name:x,label:T,defaultValue:z,required:G,onChange:w(x)});case"select":return y.jsx(p8,{name:x,label:T,defaultValue:z,required:G,multiple:M,options:U,onChange:w(x)});default:return y.jsx(h8,{type:_,name:x,label:T,placeholder:D,defaultValue:z,required:G,multiple:M,min:P,max:Q,pattern:ae,onChange:w(x)})}})()},x))})]}),y.jsxs("div",{className:$(Ot.footer,"chat__startScreen__footer"),children:[y.jsxs(yu,{type:"submit",className:Ot.startChatButton,disabled:!!l,children:[!!l&&y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",className:Ot.spinner,children:y.jsx("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"})}),y.jsx("div",{children:g})]}),v&&y.jsx("div",{className:Ot.footnote,children:y.jsx(Na,{options:{overrides:{a:Nv}},children:v})})]})]})},Nv=({title:n,href:a,children:i})=>y.jsx("a",{href:a,title:n,target:"_blank",rel:"noopener noreferrer",children:i}),E8=(n,a)=>{const i=a(`${Hn}.${n}.type`)||"text",l=a(`${Hn}.${n}.required`)==="true",o=a(`${Hn}.${n}.multiple`)==="true",c=a(`${Hn}.${n}.placeholder`),d=a(`${Hn}.${n}.label`)||"",h=a(`${Hn}.${n}.defaultValue`),m=a(`${Hn}.${n}.min`),g=a(`${Hn}.${n}.max`),v=a(`${Hn}.${n}.pattern`),E=T8(a(`${Hn}.${n}.options`));return{name:n,label:d,placeholder:c,value:S8(i,h,E)||"",defaultValue:h,options:E,type:i,required:l,multiple:o,min:m,max:g,pattern:v}},S8=(n,a,i)=>a||n==="select"&&Object.keys(i)[0]||"",T8=(n="")=>n.split(";").map(a=>a.trim()).reduce((a,i)=>{const[l,o]=i.split(":").map(c=>c.trim());return{...a,[l]:o}},{}),A8=()=>{const n=Su();H.useEffect(()=>{window.document.documentElement.lang=n.locale},[n.locale])},wi={TRIGGER_ACTION:"TRIGGER_ACTION",TRIGGER_STORY:"TRIGGER_STORY",CHAT_MESSAGE_FROM_GUEST:"CHAT_MESSAGE_FROM_GUEST",ON_CHAT_WINDOW_OPEN:"ON_CHAT_WINDOW_OPEN",ON_CHAT_WINDOW_CLOSE:"ON_CHAT_WINDOW_CLOSE",RESTART_CHAT:"RESTART_CHAT"},O8=({clientName:n})=>{A8();const a=Ba(),i=st(v=>v.intl.messages),l=tt(),o=st(v=>v.settings.enableStartScreen),c=st(v=>v.startScreen.startScreenStatus),d=st(v=>v.connection.queryString),h=H.useMemo(()=>new URLSearchParams(d||"?").get("cssClassName"),[d]);H.useEffect(()=>{const v=Lh.parse(d||""),E=S=>{switch(S.data.type){case wi.TRIGGER_ACTION:a(S.data.action);break;case wi.TRIGGER_STORY:a(jb(S.data.story));break;case wi.ON_CHAT_WINDOW_OPEN:a({type:"webclient.chatwindow.opened"});break;case wi.ON_CHAT_WINDOW_CLOSE:a({type:"webclient.chatwindow.closed"});break;case wi.CHAT_MESSAGE_FROM_GUEST:a(Mb(S.data.text));break;case wi.RESTART_CHAT:a(ls());break}};return a(Kx(n,v)),window.addEventListener("message",S=>E(S),!1),()=>window.removeEventListener("message",E)},[n,d,a]),H.useEffect(()=>{const v=l("page.title");v&&document&&(document.title=v)},[i,l]);const m=o===void 0,g=o===!1||c==="HIDDEN";return y.jsx("div",{className:$(_v.chatwindow,g&&_v.chatwindowWithAside,"chat__chatwindow",h),children:m?null:g?y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(bv,{chatStarted:!0})}),y.jsx("main",{children:y.jsx(N3,{clientName:n})}),y.jsx("aside",{children:y.jsx(ZN,{})})]}):y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(bv,{chatStarted:!1})}),y.jsx("main",{children:y.jsx(_8,{})})]})})},x8=()=>{const n=sm(),a=x_(),i=st(o=>o.intl.locale),l=st(o=>o.intl.messages);return y.jsx($A,{locale:i,messages:l,onError:()=>{},children:y.jsx("div",{className:$([JA.app,a?"chat__small":"chat__large"]),children:y.jsx(O8,{clientName:n})})})};var Fd,Mv;function C8(){if(Mv)return Fd;Mv=1;var n=p_(),a=im(),i="Expected a function";function l(o,c,d){var h=!0,m=!0;if(typeof o!="function")throw new TypeError(i);return a(d)&&(h="leading"in d?!!d.leading:h,m="trailing"in d?!!d.trailing:m),n(o,c,{leading:h,maxWait:c,trailing:m})}return Fd=l,Fd}var R8=C8();const w8=bu(R8);function N8(n){return n&&n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function M8(n){return n}function D8(n,a){a=a||{};const i=a.delimiter||".",l=a.maxDepth,o=a.transformKey||M8,c={};function d(h,m,g){g=g||1,Object.keys(h).forEach(function(v){const E=h[v],S=a.safe&&Array.isArray(E),w=Object.prototype.toString.call(E),_=N8(E),x=w==="[object Object]"||w==="[object Array]",T=m?m+i+o(v):o(v);if(!S&&!_&&x&&Object.keys(E).length&&(!a.maxDepth||g<l))return d(E,T,g+1);c[T]=E})}return d(n),c}const M_={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht eingeben","message-input.actions.submit.label":"Nachricht senden","message-input.actions.start-audio-recording.label":"Spracheingabe starten","message-input.actions.stop-audio-recording.label":"Spracheingabe stoppen","message-input.actions.submit-audio-recording.label":"Spracheingabe übermitteln","guest-bubble.label":"Ihre Nachricht","bot-bubble.label":"Nachricht des Chatbots","bot-bubble.reaction.good":"Gefällt mir","bot-bubble.reaction.bad":"Gefällt mir nicht","bot-bubble.reaction.remove":"Markierung entfernen","bot-bubble.reaction.say-more":"Erzähle mir bitte mehr","bot-bubble.reaction.category.WRONG_INFORMATION":"Falsch","bot-bubble.reaction.category.MISSING_INFORMATION":"Unvollständig","bot-bubble.reaction.category.OLD_INFORMATION":"Veraltet","bot-bubble.reaction.category.UNCLEAR":"Unklar","bot-bubble.reaction.category.OFF_TOPIC":"Nicht zur Frage passend","bot-bubble.reaction.comment":"Gedanken mit mir teilen...","bot-bubble.reaction.close":"Schliessen","bot-bubble.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","agent-bubble.label":"Nachricht des Live-Agenten","export-transcript.email.title":"Chatverlauf per E-Mail versenden","export-transcript.email.description":"Bitte E-Mail-Adresse angeben, an die der Chatverlauf gesendet werden soll.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Der Chatverlauf wurde an die hinterlegte E-Mail-Adresse übermittelt.","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
117
+ `).map((o,c)=>y.jsxs("span",{className:fv.text,children:[o,y.jsx("br",{})]},c))]})},K6=({text:n,commands:a,sources:i,onLinkClick:l})=>y.jsxs("div",{className:pe.bubbleContent,children:[y.jsx(Q6,{text:n,commands:a}),y.jsx(lm,{sources:i,onLinkClick:l})]}),$6=H.forwardRef(({message:n,commands:a,isFirstMessage:i,isLastMessage:l,isFirstMessageBySender:o,isLastMessageBySender:c,onReaction:d,onButtonClick:h,onLinkClick:m},g)=>{const v=W6(n._id,n,a,h,m),E=S=>{d(n._id,S)};switch(n.sender.type){case Te.UserType.GUEST:return y.jsx(F6,{ref:g,isFirstMessageBySender:o,isLastMessageBySender:c,children:v});default:return y.jsx(g_,{ref:g,message:n,isAnimated:!1,isFirstMessage:i,isLastMessage:l,isFirstMessageBySender:o,isLastMessageBySender:c,onReaction:E,children:v})}}),W6=(n,a,i,l,o)=>{switch(a.type){case Te.MessageTypeEnum.TEXT:{const c=a;return y.jsx(K6,{text:c.text,commands:i,sources:a.sources||[],onLinkClick:o})}case Te.MessageTypeEnum.DETAIL:{const c=a;return y.jsx(q6,{title:c.title,text:c.text,imageUrl:c.imageUrl,itemUrl:c.itemUrl,buttons:c.buttons,sources:a.sources||[],onButtonClick:l,onLinkClick:o})}case Te.MessageTypeEnum.MARKDOWN:{const c=a;return y.jsx(Y6,{actionId:n,markdown:c.markdown,sources:c.sources||[],onLinkClick:o})}}},J6=(n,a)=>n.message._id===a.message._id&&n.message.reaction===a.message.reaction&&n.isFirstMessage===a.isFirstMessage&&n.isLastMessage===a.isLastMessage&&n.isFirstMessageBySender===a.isFirstMessageBySender&&n.isLastMessageBySender===a.isLastMessageBySender,ew=kv.memo($6,J6),tw="_ticontainer_xg0dn_1",nw="_tiblock_xg0dn_5",aw="_tidot_xg0dn_12",ql={ticontainer:tw,tiblock:nw,tidot:aw},rw=({isTyping:n=!1})=>y.jsx("div",{className:ql.ticontainer,children:y.jsx("div",{className:ql.tiblock,children:n?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:$(ql.tidot,"chat__typingIndicator")}),y.jsx("div",{className:$(ql.tidot,"chat__typingIndicator")}),y.jsx("div",{className:$(ql.tidot,"chat__typingIndicator")})]}):null})}),iw=Object.assign({_id:"typing-indicator"},new Te.TextMessage("",new Te.BotUser)),lw=({messages:n,isBotTyping:a,commands:i,onTranscriptItemReaction:l,onButtonClick:o,onLinkClick:c})=>{const d=H.useRef(0),h=H.useRef(!0),m=H.useRef(null),g=H.useRef(null),v=H.useRef(null),E=st(_=>_.settings.enableGeneralConditions);H.useLayoutEffect(()=>{if(n.length&&m.current&&(d.current<n.length||a)){if(g.current){const _=g.current.offsetTop;m.current.scrollTop=_}else if(v.current){const _=v.current.offsetTop;m.current.scrollTop=_}h.current&&(h.current=!1),d.current=n.length}},[n,h,a]);let S;const w=n.length;return y.jsxs("div",{ref:m,className:$(M1.messageContainer,"chat__messageContainer"),style:{scrollBehavior:n.length&&h.current?"auto":"smooth"},id:"MessageContainer",role:"log","aria-live":"polite",children:[E&&y.jsx(TR,{}),y.jsxs("ul",{className:M1.messages,children:[n.map((_,x)=>{const T=sw(_,S),D=ow(_,x,n,a);S=_.sender.type;const z=x+1===w,U=x===0,G=_._id||`added-${x}`;return y.jsx(ew,{ref:z?v:null,message:_,commands:i,isFirstMessage:U,isLastMessage:z,isFirstMessageBySender:T,isLastMessageBySender:D,onButtonClick:o,onLinkClick:c,onReaction:l},z&&!a?"last":G)}),a&&y.jsx(g_,{ref:g,message:iw,isFirstMessage:!1,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:S!==Te.UserType.BOT,isLastMessageBySender:!0,children:y.jsx(rw,{isTyping:!0})},"last")]})]})},sw=(n,a)=>!a||a!==n.sender.type,ow=(n,a,i,l)=>{const o=n.sender.type,c=i.length;return a+1===c?!(o===Te.UserType.BOT&&l):o!==i.at(a+1)?.sender.type},uw="_bottomSheet_jp8dl_1",cw="_bottomSheetOpen_jp8dl_15",fw="_bottomSheetClose_jp8dl_20",Ma={bottomSheet:uw,bottomSheetOpen:cw,bottomSheetClose:fw},dw="_container_xc2nx_1",dv={container:dw},hw=({contentUrl:n})=>{const a=st(c=>c.connection.sessionId),[i,l]=H.useState(!1);H.useEffect(()=>{l(c=>c||!!n)},[n]);const o=H.useMemo(()=>{if(n&&a){const c=new URL(n,document.baseURI);return c.searchParams.set("sessionId",a),c.toString()}else return},[n,a]);return y.jsx("div",{className:$(dv.container,Ma.bottomSheet,{[Ma.bottomSheetOpen]:!!n,[Ma.bottomSheetClose]:i&&!n}),children:o&&y.jsx("iframe",{title:"Drawer",src:o,className:dv.iframe})})},mw="_container_6tt4m_1",pw={container:mw},gw=({title:n,href:a,children:i})=>y.jsx("a",{href:a,title:n,target:"_blank",rel:"noopener noreferrer",children:i}),yw=()=>{const a=tt()("powered-by");return a&&a.length?y.jsx("div",{className:$(pw.container,"chat__poweredBy"),children:y.jsx(Na,{options:{overrides:{a:gw}},children:a})}):null},T_=({className:n,children:a,...i})=>y.jsx(Ru,{className:$(ts.buttonDefault,n),type:"button",...i,children:a}),yu=({className:n,children:a,...i})=>y.jsx(Ru,{className:$(ts.buttonPrimary,n),...i,children:a}),vw="_container_h23mk_1",bw="_formContainer_h23mk_17",_w="_emailInput_h23mk_22",Ew="_description_h23mk_52",Sw="_actions_h23mk_57",Tw="_validationError_h23mk_67",Aw="_submitted_h23mk_74",jr={container:vw,formContainer:bw,emailInput:_w,description:Ew,actions:Sw,validationError:Tw,submitted:Aw},Ow=({visible:n,onEmailExport:a,onClose:i})=>{const l=tt(),[o,c]=H.useState(void 0),[d,h]=H.useState(!1),[m,g]=H.useState(void 0),v=H.useRef(null);H.useEffect(()=>{n?(v.current?.focus(),h(!1),c(n)):o===!0&&c(!1)},[n,o]);const E=w=>{w.preventDefault(),m&&m.length>0&&(a(m),h(!0),setTimeout(i,3*1e3))},S=w=>{const _=w.target.value.trim(),x=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(_);g(x?_:"")};return y.jsxs("div",{className:$(jr.container,Ma.bottomSheet,{[Ma.bottomSheetOpen]:o===!0,[Ma.bottomSheetClose]:o===!1}),children:[y.jsx("h2",{children:l("export-transcript.email.title")}),y.jsx(Na,{className:jr.description,children:l("export-transcript.email.description")||""}),y.jsxs("form",{onSubmit:E,className:jr.formContainer,children:[y.jsxs("div",{children:[y.jsx("input",{disabled:d,ref:v,type:"email",placeholder:l("export-transcript.email.placeholder"),className:jr.emailInput,onChange:S}),m?.length===0?y.jsx("div",{className:jr.validationError,children:l("export-transcript.email.invalid")}):null]}),y.jsxs("div",{className:jr.actions,children:[y.jsx(T_,{onClick:i,children:l("export-transcript.email.cancel")}),y.jsx(yu,{type:"submit",disabled:d||m===void 0||m.length===0,children:l("export-transcript.email.send")})]})]}),d&&y.jsx("div",{className:jr.submitted,children:l("export-transcript.email.success")})]})},xw="_inputContainer_fi5ao_1",Cw={inputContainer:xw},Rw="_blockUserInput_pot9c_1",ww={blockUserInput:Rw},Nw=({visible:n})=>{const a=tt();return n?y.jsx("div",{className:$(ww.blockUserInput,"chat__blockUserInput"),children:a("block-user-input.title")}):null},Mw="_commandsDropdown_5ytuv_1",Dw="_commands_5ytuv_1",Lw="_command_5ytuv_1",Bw="_commandActive_5ytuv_46",Uw="_commandsSelections_5ytuv_55",Kl={commandsDropdown:Mw,commands:Dw,command:Lw,commandActive:Bw,commandsSelections:Uw},jw=(n,a,i,l,o)=>{H.useEffect(()=>{const c=d=>{if(n.length)switch(d.key){case"Enter":i(n[a]);break;case"ArrowUp":l(h=>h>0?h-1:n.length-1);break;case"ArrowDown":l(h=>h<n.length-1?h+1:0);break;case"Escape":o([]);break}};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c)}},[n,a,i,l,o])},Hw=({text:n,commands:a,onSelectCommand:i,onVisibilityChange:l})=>{const o=H.useRef(null),c=tt(),[d,h]=H.useState([]),[m,g]=H.useState(hv(a)),[v,E]=H.useState(0),S=w=>i(`/${w}`);return rm(o,()=>h([])),jw(d,v,S,E,h),H.useEffect(()=>{g(hv(a))},[a]),H.useEffect(()=>{const w=n.length||0;w===0||w>m||!n.startsWith("/")?h([]):h(a.filter(Iw(n))),E(0)},[a,n,m]),H.useEffect(()=>{l(!!d.length)},[d,l]),d.length?y.jsx("div",{ref:o,className:Kl.commandsDropdown,children:y.jsx("ul",{id:"command-list",className:Kl.commands,role:"listbox",children:d.map((w,_)=>y.jsxs("li",{className:$([Kl.command,v===_&&Kl.commandActive]),role:"option",onClick:()=>S(w),onMouseOver:()=>E(_),children:[y.jsxs("h1",{children:["/",w]}),y.jsx("p",{children:c(`commands.${w}`)})]},w))})}):null},hv=n=>Math.max(...n.map(a=>a.length+1)),Iw=n=>a=>{const i=`/${a}`;return i.startsWith(n)&&i.length>=n.length},mv=3,zw=({commands:n,onSelectCommand:a})=>{const i=tt(),[l,o]=H.useState(!1),c=g=>()=>{a(`/${g}`),o(!1)},d=()=>{o(!0)},h=()=>{o(!1)},m=l?n:n.slice(0,mv);return y.jsxs("div",{className:Kl.commandsSelections,children:[m.map(g=>y.jsxs("button",{className:"tooltip--top-center","aria-label":i(`commands.${g}`),"data-title":i(`commands.${g}`),tabIndex:0,onClick:c(g),children:["/",g]},g)),m.length<n.length?y.jsx("button",{"aria-label":i("commands.show-more.tooltip"),"data-title":i("commands.show-more.tooltip"),tabIndex:0,onClick:d,children:i("commands.show-more.action")},"show-more"):m.length>mv?y.jsx("button",{"aria-label":i("commands.show-less.tooltip"),"data-title":i("commands.show-less.tooltip"),tabIndex:0,onClick:h,children:i("commands.show-less.action")},"show-less"):null]})},Gw="_callToActionContainer_d8izj_1",kw="_callToActionTitle_d8izj_23",qw="_rateOverlay_d8izj_30",Fw="_body_d8izj_52",Vw="_footer_d8izj_60",Yw="_actions_d8izj_75",Pw="_bubbles_d8izj_89",Xw="_stars_d8izj_191",Zw="_starsSmall_d8izj_205",Qw="_starsLarge_d8izj_211",Kw="_star_d8izj_191",$w="_starReadonly_d8izj_225",Ww="_starIcon_d8izj_235",Jw="_starsDescriptionContainer_d8izj_253",e3="_starsDescription_d8izj_253",Gt={callToActionContainer:Gw,callToActionTitle:kw,rateOverlay:qw,body:Fw,footer:Vw,actions:Yw,bubbles:Pw,stars:Xw,starsSmall:Zw,starsLarge:Qw,star:Kw,starReadonly:$w,starIcon:Ww,starsDescriptionContainer:Jw,starsDescription:e3},t3=({value:n,index:a,count:i,readonly:l,onHover:o,onClick:c})=>{const d=h=>{c&&h.key==="Enter"&&c()};return y.jsx("li",{className:$(Gt.star,{[Gt.starReadonly]:l},"chat__conversationRating__star"),children:y.jsx("div",{role:"radio","aria-checked":n>a?"true":"false","aria-posinset":a+1,"aria-setsize":i,tabIndex:0,onMouseOver:o,onKeyDown:d,onClick:c,children:y.jsx("span",{role:"img","aria-label":"Star",className:$(Gt.starIcon),children:y.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"star",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"})})})})})},pv=5,A_=({value:n,size:a,readonly:i=!1,onChange:l})=>{const[o,c]=H.useState(void 0),d=()=>{c(void 0)},h=g=>()=>{if(!i){const v=g+1;c(v)}},m=g=>()=>{l&&!i&&(l(g===0&&n===1?0:g+1),c(void 0))};return y.jsx("ul",{tabIndex:0,role:"radiogroup",className:$(Gt.stars,{[Gt.starsSmall]:a==="small",[Gt.starsLarge]:a==="large"},"chat__conversationRating__stars",{chat__conversationRating__stars__small:a==="small",chat__conversationRating__stars__large:a==="large"}),onMouseOut:d,children:Array(pv).fill(0).map((g,v)=>y.jsx(t3,{value:o===void 0?n:o,index:v,count:pv,readonly:i,onHover:h(v),onClick:m(v)},v))})},n3=({visible:n,onRate:a})=>{const i=tt();return n?y.jsxs("div",{className:$(Gt.callToActionContainer,"chat__conversationRating__callToAction"),children:[y.jsx("div",{className:$(Gt.callToActionTitle,"chat__conversationRating__callToAction__title"),children:i("conversation-rating.call-to-action.title")}),y.jsx(A_,{value:0,size:"small",onChange:a})]}):null},jd=({isFirstMessageBySender:n,isLastMessageBySender:a,children:i})=>y.jsxs("div",{className:$(pe.message,pe.messageBot,n&&pe.messageBotFirst,a&&pe.messageBotLast,"chat__bubbleContainer","chat__botBubbleContainer",n&&"chat__bubbleContainer--first",a&&"chat__bubbleContainer--last"),children:[y.jsx("img",{className:$(pe.avatar,pe.botAvatar),src:"bot.svg",alt:"Bot"}),y.jsx("div",{className:$(pe.bubble,pe.bubbleLeft,"chat__bubble","chat__botBubble"),children:y.jsx("div",{className:$(pe.leftText,pe.bubbleContent),children:i})})]}),a3=({children:n})=>y.jsx("div",{className:$(pe.message,pe.messageGuest,pe.messageGuestFirst,pe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer","chat__bubbleContainer--first","chat__bubbleContainer--last"),children:y.jsx("div",{className:$(pe.bubble,pe.bubbleRight,"chat__bubble","chat__guestBubble"),children:y.jsx("div",{className:$(pe.rightText,pe.bubbleContent),children:n})})}),r3=()=>{const n=tt(),a=Ba(),i=st(T=>T.chat.conversationRating),[l,o]=H.useState(i.rating?.value||0),[c,d]=H.useState(void 0),[h,m]=H.useState(void 0),[g,v]=H.useState({submitted:!1,feedback:""}),E=H.useRef(null),[S,w]=H.useState(!1);H.useEffect(()=>{i.opener?(v({submitted:!1,feedback:""}),m(!0)):h===!0&&m(!1)},[i.opener,h]),H.useEffect(()=>{o(i.rating?.value||0)},[i.rating?.value,i.opener]),H.useEffect(()=>{E.current&&(E.current.value=i.rating?.feedback||"")},[i.rating?.feedback]),H.useEffect(()=>{const T=l>0?n(`conversation-rating.overlay.bot-message.rate-feedback.value-${l}`):void 0;d(T?.length?T:void 0)},[l,n]),H.useEffect(()=>{g.submitted?setTimeout(()=>w(!0),g.feedback.length?500:0):w(!1)},[g]);const _=T=>{T.preventDefault();const D=E.current?.value?.trim()||"";a(ZO(l,D)),v({submitted:!0,feedback:D})},x=()=>{i.opener==="CLOSE_CHAT"?a(n_()):i.opener==="RESTART_CHAT"?a(ls()):a(Xx())};return y.jsx("div",{className:$(Gt.rateOverlay,Ma.bottomSheet,"chat__conversationRating__overlay",{[Ma.bottomSheetOpen]:h===!0,[Ma.bottomSheetClose]:h===!1}),children:y.jsxs("form",{onSubmit:_,children:[y.jsxs("div",{className:$(Gt.body,"chat__conversationRating__overlay__body"),children:[y.jsx("div",{}),y.jsx("div",{className:$(Gt.bubbles),children:i.opener&&y.jsxs(y.Fragment,{children:[y.jsxs(jd,{isFirstMessageBySender:!0,isLastMessageBySender:!c,children:[y.jsx("h2",{children:n("conversation-rating.overlay.title")}),y.jsxs("div",{className:$(Gt.starsDescriptionContainer),children:[y.jsx(A_,{value:l,size:"large",readonly:g.submitted,onChange:o}),y.jsxs("div",{className:$(Gt.starsDescription),children:[y.jsx("div",{children:n("conversation-rating.overlay.star.very-bad")}),y.jsx("div",{children:n("conversation-rating.overlay.star.very-good")})]})]})]}),c&&y.jsx(jd,{isFirstMessageBySender:!1,isLastMessageBySender:!S||!!g.feedback.length,children:y.jsx("div",{children:c})}),!!g.feedback.length&&y.jsx(a3,{children:g.feedback}),S&&y.jsx(jd,{isFirstMessageBySender:!!g.feedback.length,isLastMessageBySender:!0,children:y.jsx("div",{children:n("conversation-rating.overlay.bot-message.submit-feedback")})})]})})]}),y.jsxs("div",{className:$(Gt.footer,"chat__conversationRating__overlay__footer"),children:[!g.submitted&&y.jsx("input",{ref:E,defaultValue:i.rating?.feedback||"",placeholder:n("conversation-rating.overlay.guest-feedback.input-placeholder")}),y.jsxs("div",{className:$(Gt.actions,"chat__conversationRating__overlay__footer__actions"),children:[g.submitted?y.jsx(yu,{type:"button",disabled:!l,onClick:x,children:i.opener==="CLOSE_CHAT"?n("conversation-rating.overlay.action.close-chat"):i.opener==="RESTART_CHAT"?n("conversation-rating.overlay.action.restart-chat"):n("conversation-rating.overlay.action.back-to-chat")},"close-button"):y.jsx(yu,{type:"submit",disabled:!l,children:n("conversation-rating.overlay.action.submit")},"submit-button"),i.opener!=="CHAT"&&!g.submitted&&y.jsx(T_,{onClick:x,children:i.opener==="CLOSE_CHAT"?n("conversation-rating.overlay.action.close-chat"):i.opener==="RESTART_CHAT"?n("conversation-rating.overlay.action.restart-chat"):n("conversation-rating.overlay.action.cancel")})]})]})]})})},i3=({numberOfMessagesFromGuest:n})=>{const a=Ba(),i=st(c=>c.chat.conversationRating),l=c=>{a(pu("CHAT",c))},o=!i.rating?.value&&n>=1;return i.enabled?y.jsxs(y.Fragment,{children:[y.jsx(n3,{visible:o,onRate:l}),y.jsx(r3,{})]}):null},l3=H.memo(i3),s3="_inputWrapper_e3h44_1",o3="_withOpenCommands_e3h44_14",u3="_messageInputWrapper_e3h44_20",c3="_messageInput_e3h44_20",f3="_buttons_e3h44_44",d3="_button_e3h44_44",Ri={inputWrapper:s3,withOpenCommands:o3,messageInputWrapper:u3,messageInput:c3,buttons:f3,button:d3},h3="_audioRecorder_g845f_1",m3="_audioButton_g845f_6",p3="_recorderIcon_g845f_37",g3="_spinning_g845f_60",Hr={audioRecorder:h3,audioButton:m3,recorderIcon:p3,spinning:g3},gv=2048,vu=16e3;class y3 extends kv.Component{audioInput=null;volume=null;leftchannel=[];recorder=null;recordingLength=0;sampleRate=null;mediaStream=null;constructor(a){super(a),this.state={recordingState:"none"},this.triggerAudioRecording=this.triggerAudioRecording.bind(this),this.triggerAudioRecordingSuccess=this.triggerAudioRecordingSuccess.bind(this),this.initRecording=this.initRecording.bind(this),this.processRecordingInput=this.processRecordingInput.bind(this),this.handleClickSubmitAudio=this.handleClickSubmitAudio.bind(this),this.handleClickStopAudio=this.handleClickStopAudio.bind(this)}triggerAudioRecording(){this.setState({recordingState:"connecting"}),navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(this.triggerAudioRecordingSuccess)}triggerAudioRecordingSuccess(a){this.mediaStream=a,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(a)}initRecording(a){const i=window.AudioContext||window.webkitAudioContext,l=new i;this.sampleRate=l.sampleRate,this.volume=l.createGain(),this.audioInput=l.createMediaStreamSource(a),this.audioInput.connect(this.volume),this.recorder=l.createScriptProcessor(gv,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(l.destination)}processRecordingInput(a){if(this.state.recordingState==="connecting"&&this.setState({recordingState:"recording"}),this.state.recordingState!=="none"){const i=a.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(i)),this.recordingLength+=gv}}handleClickSubmitAudio(){const a=b3(this.leftchannel,this.recordingLength),i=_3(a,this.sampleRate||0),l=v3(i);this.props.onAudioRecorded(l),this.handleClickStopAudio()}handleClickStopAudio(){this.setState({recordingState:"none"}),this.audioInput?.disconnect(),this.volume?.disconnect(),this.recorder?.disconnect(),this.mediaStream&&this.mediaStream?.getAudioTracks().forEach(a=>{a.stop()})}render(){return y.jsxs("div",{className:Hr.audioRecorder,children:[this.state.recordingState==="none"&&y.jsx("button",{className:$(Hr.audioButton,"chat__button"),type:"submit","aria-label":this.props.translate("message-input.actions.start-audio-recording.label"),"data-title":this.props.translate("message-input.actions.start-audio-recording.label"),tabIndex:0,onClick:this.triggerAudioRecording,children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"}),y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),this.state.recordingState==="connecting"&&y.jsxs("svg",{className:Hr.spinning,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]}),this.state.recordingState==="recording"&&y.jsxs("div",{className:Hr.audioRecorder,children:[y.jsx("button",{className:$(Hr.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate("message-input.actions.stop-audio-recording.label"),tabIndex:0,children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),y.jsx("div",{className:Hr.recorderIcon}),y.jsx("button",{className:$(Hr.audioButton),type:"submit",onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate("message-input.actions.submit-audio-recording.label"),tabIndex:0,autoFocus:!0,children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[y.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),y.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})]})})]})]})}}const v3=n=>{const a=new ArrayBuffer(44+n.length*2),i=new DataView(a);Ko(i,0,"RIFF"),i.setUint32(4,44+n.length*2,!0),Ko(i,8,"WAVE"),Ko(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,vu,!0),i.setUint32(28,vu*4,!0),i.setUint16(32,4,!0),i.setUint16(34,16,!0),Ko(i,36,"data"),i.setUint32(40,n.length*2,!0);const l=n.length;let o=44;const c=1;for(let d=0;d<l;d++)i.setInt16(o,n[d]*(32767*c),!0),o+=2;return new Blob([i],{type:"audio/wav"})},Ko=(n,a,i)=>{for(let l=0;l<i.length;l++)n.setUint8(a+l,i.charCodeAt(l))},b3=(n,a)=>{const i=new Float32Array(a);let l=0;const o=n.length;for(let c=0;c<o;c++){const d=n[c];i.set(d,l),l+=d.length}return i},_3=(n,a)=>{if(vu===a)return n;const i=a/vu,l=Math.round(n.length/i),o=new Float32Array(l);let c=0,d=0;for(;c<o.length;){const h=Math.round((c+1)*i);let m=0,g=0;for(let v=d;v<h&&v<n.length;v++)m+=n[v],g++;o[c]=m/g,c++,d=h}return o},E3=({disabled:n,textInput:a,commandsVisible:i,hasCommands:l,onTextInput:o,onTextInputSubmit:c,onAudioRecorded:d})=>{const h=tt(),m=H.useRef(null),{enableSpeechSupport:g}=st(_=>_.settings);H.useEffect(()=>{m.current?.focus()},[a]);const v=()=>{const _=m.current;_&&a.trim().length>=1&&c(a.trim())&&(_.value="",_.style.height="",_.focus())},E=_=>{_.preventDefault(),v()},S=_=>{const x=_.target.value;o(x),_.target.style.height="";const{scrollHeight:T}=_.target;_.target.style.height=`${T>150?150:T}px`},w=_=>{_.code==="Enter"&&!_.shiftKey?(_.repeat||v(),_.preventDefault()):i&&(_.code==="ArrowUp"||_.code==="ArrowDown")&&_.preventDefault()};return y.jsxs("form",{className:$(Ri.inputWrapper,i&&Ri.withOpenCommands,"chat__textInput"),onSubmit:E,children:[y.jsx("div",{className:Ri.messageInputWrapper,children:y.jsx("textarea",{id:"user_input",ref:m,className:Ri.messageInput,tabIndex:0,placeholder:h("message-input-placeholder"),value:a,onChange:S,onKeyDown:w,"aria-label":h("message-input-label"),"aria-controls":l?"command-list":void 0,"aria-haspopup":l?"listbox":void 0})}),y.jsx("div",{className:$(Ri.buttons,"chat__buttons"),children:a.length||!g||navigator.mediaDevices===void 0?y.jsx("button",{className:$(Ri.button,"chat__button"),type:"submit","aria-label":h("message-input.actions.submit.label"),"data-title":h("message-input.actions.submit.label"),tabIndex:0,disabled:n,children:y.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})}):g&&navigator.mediaDevices!==void 0&&y.jsx(y3,{translate:h,onAudioRecorded:d})})]})},S3="_quickReplies_83npe_1",T3="_quickReply_83npe_9",yv={quickReplies:S3,quickReply:T3},A3=({quickReplies:n,onQuickReplyClick:a})=>n.length?y.jsx("div",{className:$(yv.quickReplies,"chat__quickReplies"),children:n.map(i=>y.jsx(Ru,{tabIndex:0,className:$(yv.quickReply,"chat__button","chat__quickReply"),onClick:()=>a(i),children:i.label},i.label))}):null,vv=5e3,O3=1e3,x3=({isBotTyping:n,quickReplies:a,numberOfMessagesFromGuest:i,commands:l,onTextInput:o,onQuickReplyClick:c,onAudioRecorded:d})=>{const[h,m]=H.useState(""),[g,v]=H.useState(!1),[E,S]=H.useState(!1),w=H.useRef(0),_=H.useRef(0);H.useEffect(()=>{if(g&&!n){const D=w.current?Date.now()-w.current:0;D>vv?v(!1):setTimeout(()=>{v(!1)},vv-D)}},[g,n]),H.useEffect(()=>{g&&(w.current=Date.now())},[g]);const x=D=>{const z=Date.now()-_.current<O3;return E?!1:n||z?(v(!0),!1):(o(D),m(""),_.current=Date.now(),!0)},T=D=>{m(D+" ")};return y.jsxs("div",{className:$(Cw.inputContainer),children:[y.jsx(A3,{quickReplies:a,onQuickReplyClick:c}),y.jsx(Nw,{visible:g}),!g&&y.jsx(l3,{numberOfMessagesFromGuest:i}),!!l?.length&&y.jsx(Hw,{text:h,commands:l,onSelectCommand:T,onVisibilityChange:S}),y.jsx(E3,{textInput:h,disabled:g,commandsVisible:E,hasCommands:!!l?.length,onTextInput:m,onTextInputSubmit:x,onAudioRecorded:d}),!!l?.length&&y.jsx(zw,{commands:l,onSelectCommand:m})]})},C3=({clientName:n,messages:a,quickReplies:i,isBotTyping:l,drawerContentUrl:o,onMessageFromUser:c,onQuickReplyClick:d,onButtonClick:h,onLinkClick:m,onAudioRecorded:g,onTranscriptExport:v,onTranscriptItemReaction:E})=>{const S=Ba(),w=st(G=>G.connection.connectionState),{enableTranscriptExportEmail:_,commands:x}=st(G=>G.settings),{showTranscriptMailOverlay:T,conversationRating:D}=st(G=>G.chat),z=a.filter(G=>G.sender.type===gu.GUEST).length;H.useEffect(()=>{w===kr.CONNECTED&&S(r_(n))},[n,w,S]);const U=()=>{S(a_())};return y.jsxs("div",{className:yd.container,children:[y.jsxs("div",{className:$([yd.chatcontent,(T||D?.opener)&&yd.accessabilityHidden]),children:[y.jsx(lw,{messages:a,isBotTyping:l,commands:x,onButtonClick:h,onLinkClick:m,onTranscriptItemReaction:E}),y.jsx(x3,{isBotTyping:l,quickReplies:l?[]:i,numberOfMessagesFromGuest:z,commands:x,onQuickReplyClick:d,onTextInput:c,onAudioRecorded:g}),y.jsx(yw,{})]}),_&&y.jsx(Ow,{visible:!!T,onEmailExport:v,onClose:U}),y.jsx(hw,{contentUrl:o})]})},R3=n=>{const{messages:a,quickReplies:i,isBotTyping:l,drawerContentUrl:o}=n.chat;return{messages:a,quickReplies:i,isBotTyping:l,drawerContentUrl:o}},w3=n=>({onRestartChat:()=>n(ls()),onMessageFromUser:a=>n(Mb(a)),onAudioRecorded:a=>n(FO(a)),onActionFromUser:a=>n(a),onQuickReplyClick:a=>n(Nb(a)),onNluEvent:a=>n(jb(a)),onButtonClick:a=>n(KO(a)),onLinkClick:a=>n(Hb(a)),onTranscriptExport:a=>n(YO(a)),onTranscriptItemReaction:(a,i)=>{n(Te.Actions.transcriptItemGuestReaction(a,i?.type||null,i?.category,i?.comment))}}),N3=dT(R3,w3)(C3),O_=()=>H.useMemo(()=>{try{return window.self!==window.top}catch{return!0}},[]),M3=n=>a=>{const i=a.key;(i==="ArrowDown"||i==="ArrowRight"||i==="Enter"||i===" "||i==="Space")&&(a.stopPropagation(),n())},D3=({onClick:n})=>{const a=tt();return O_()?y.jsx("button",{className:"tooltip--bottom-left","aria-label":a("header.close-chat"),"data-title":a("header.close-chat"),tabIndex:0,onClick:n,onKeyDown:M3(n),children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"})})}):null},L3="_header_3gvbz_1",B3="_logoContainer_3gvbz_14",U3="_logo_3gvbz_14",j3="_actions_3gvbz_28",H3="_active_3gvbz_43",I3="_menuContainer_3gvbz_56",z3="_menu_3gvbz_56",G3="_divider_3gvbz_86",cr={header:L3,logoContainer:B3,logo:U3,actions:j3,active:H3,menuContainer:I3,menu:z3,divider:G3},k3=({icon:n})=>{switch(n){case"arrow-counter-clockwise":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"})});case"download":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"})});case"expand":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M214,48V96a6,6,0,0,1-12,0V62.48l-53.76,53.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM107.76,139.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l53.76-53.76a6,6,0,0,0-8.48-8.48Z"})});case"mail":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"})});case"phone":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M144.27,45.93a8,8,0,0,1,9.8-5.66,86.22,86.22,0,0,1,61.66,61.66,8,8,0,0,1-5.66,9.8A8.23,8.23,0,0,1,208,112a8,8,0,0,1-7.73-5.94,70.35,70.35,0,0,0-50.33-50.33A8,8,0,0,1,144.27,45.93Zm-2.33,41.8c13.79,3.68,22.65,12.54,26.33,26.33A8,8,0,0,0,176,120a8.23,8.23,0,0,0,2.07-.27,8,8,0,0,0,5.66-9.8c-5.12-19.16-18.5-32.54-37.66-37.66a8,8,0,1,0-4.13,15.46Zm81.94,95.35A56.26,56.26,0,0,1,168,232C88.6,232,24,167.4,24,88A56.26,56.26,0,0,1,72.92,32.12a16,16,0,0,1,16.62,9.52l21.12,47.15,0,.12A16,16,0,0,1,109.39,104c-.18.27-.37.52-.57.77L88,129.45c7.49,15.22,23.41,31,38.83,38.51l24.34-20.71a8.12,8.12,0,0,1,.75-.56,16,16,0,0,1,15.17-1.4l.13.06,47.11,21.11A16,16,0,0,1,223.88,183.08Zm-15.88-2s-.07,0-.11,0h0l-47-21.05-24.35,20.71a8.44,8.44,0,0,1-.74.56,16,16,0,0,1-15.75,1.14c-18.73-9.05-37.4-27.58-46.46-46.11a16,16,0,0,1,1-15.7,6.13,6.13,0,0,1,.57-.77L96,95.15l-21-47a.61.61,0,0,1,0-.12A40.2,40.2,0,0,0,40,88,128.14,128.14,0,0,0,168,216,40.21,40.21,0,0,0,208,181.07Z"})});case"scroll":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M96,104a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H104A8,8,0,0,1,96,104Zm8,40h64a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16Zm128,48a32,32,0,0,1-32,32H88a32,32,0,0,1-32-32V64a16,16,0,0,0-32,0c0,5.74,4.83,9.62,4.88,9.66h0A8,8,0,0,1,24,88a7.89,7.89,0,0,1-4.79-1.61h0C18.05,85.54,8,77.61,8,64A32,32,0,0,1,40,32H176a32,32,0,0,1,32,32V168h8a8,8,0,0,1,4.8,1.6C222,170.46,232,178.39,232,192ZM96.26,173.48A8.07,8.07,0,0,1,104,168h88V64a16,16,0,0,0-16-16H67.69A31.71,31.71,0,0,1,72,64V192a16,16,0,0,0,32,0c0-5.74-4.83-9.62-4.88-9.66A7.82,7.82,0,0,1,96.26,173.48ZM216,192a12.58,12.58,0,0,0-3.23-8h-94a26.92,26.92,0,0,1,1.21,8,31.82,31.82,0,0,1-4.29,16H200A16,16,0,0,0,216,192Z"})});case"star":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"})});case"link":return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"})});default:return y.jsx("div",{})}},q3=H.forwardRef(({selected:n,item:a,onClick:i},l)=>{const o=tt(),c=d=>{d.preventDefault(),i()};return y.jsx("li",{"aria-selected":n,role:"option",className:a.withDivider?cr.divider:void 0,children:y.jsxs("a",{ref:l,type:"button",role:"button",tabIndex:-1,onClick:c,children:[y.jsx(k3,{icon:a.icon}),y.jsx("span",{children:o(`header.menu.${a.id}`)})]})})}),F3=(n,a)=>{const i=O_(),{menuItems:l,enableStandaloneView:o,enableTranscriptExportPdf:c,enableTranscriptExportEmail:d}=st(g=>g.settings),h=st(g=>g.chat.conversationRating.enabled);return H.useMemo(()=>{const g=[],v=l.filter(({visibility:E})=>n?E==="always"||E==="chat-only":E==="always"||E==="start-screen-only");if(n&&(g.push({id:"restart-chat",type:"restart-chat",icon:"arrow-counter-clockwise",visibility:"chat-only"}),i&&o&&g.push({id:"expand-chat-window",type:"expand-chat-window",icon:"expand",visibility:"always"}),a&&c&&g.push({id:"download-transcript",type:"download-transcript",icon:"download",visibility:"chat-only"}),a&&d&&g.push({id:"send-transcript",type:"send-transcript",icon:"mail",visibility:"chat-only"}),a&&h&&g.push({id:"rate-conversation",type:"rate-conversation",icon:"star",visibility:"chat-only"}),g.length>0&&v.length)){const E=g.pop();E&&l.length&&g.push({...E,withDivider:!0})}return g.push(...v),g},[n,a,c,d,o,h,i,l])},V3=({chatStarted:n,hasGuestMessages:a})=>{const i=Ba(),l=tt(),[o,c]=H.useState(!1),[d,h]=H.useState(-1),m=H.useRef(null),g=H.useRef(null),v=H.useRef([]),E=F3(n,a);H.useEffect(()=>{v.current[d]?.focus()},[d]);const S=H.useCallback(()=>{i(a?pu("RESTART_CHAT"):ls()),c(!1),h(0)},[a,i]),w=H.useCallback(T=>{switch(T.type){case"restart-chat":S();break;case"expand-chat-window":window.open(window.location.href,"_blank");break;case"download-transcript":i(PO());break;case"send-transcript":i(a_());break;case"rate-conversation":i(pu("MENU"));break;case"link":i(Hb(T.url));break;case"action":i(JSON.parse(JSON.stringify(T.action)));break}c(!1)},[i,S,c]);H.useEffect(()=>{const T=D=>{if(o)switch(D.key){case"Enter":D.preventDefault(),w(E[d]);break;case"ArrowUp":h(z=>z>0?z-1:E.length-1);break;case"ArrowDown":h(z=>z<E.length-1?z+1:0);break;case"Escape":c(!1);break;case"Tab":d>-1&&c(!1);break}};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[o,d,E,h,c,w]),H.useEffect(()=>{o||h(-1)},[o,d]),rm(g,()=>c(!1));const _=()=>{c(T=>!T)},x=()=>{setTimeout(()=>{const T=document.activeElement;g.current&&!g.current.contains(T)&&c(!1)},0)};return E.length?y.jsxs("div",{className:$(cr.menuContainer),ref:g,children:[y.jsx("button",{ref:m,className:$(o&&cr.active,o?"tooltip-hidden":"tooltip--bottom-left"),"aria-label":l("header.menu.title"),"data-title":l("header.menu.title"),onClick:_,onBlur:x,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"})})}),o&&y.jsx("nav",{className:cr.menu,"aria-label":l("header.menu.title"),children:y.jsx("ul",{tabIndex:0,children:E.map((T,D)=>y.jsx(q3,{ref:z=>{v.current[D]=z},selected:d===D,item:T,onClick:()=>w(T)},T.id))})})]}):null},bv=({className:n,chatStarted:a,...i})=>{const l=Ba(),o=st(h=>h.chat.conversationRating),c=st(h=>h.chat.messages.some(m=>m.sender.type===Te.UserType.GUEST)),d=()=>{o.enabled&&!o.opener&&c?l(pu("CLOSE_CHAT")):l(n_())};return y.jsxs("div",{className:$([cr.header,n]),...i,children:[y.jsx("div",{className:cr.logoContainer,children:y.jsx("div",{className:cr.logo})}),y.jsxs("div",{className:cr.actions,children:[y.jsx(V3,{chatStarted:a,hasGuestMessages:c}),y.jsx(D3,{onClick:d})]})]})},Y3="_chatwindow_rkbir_1",P3="_chatwindowWithAside_rkbir_21",_v={chatwindow:Y3,chatwindowWithAside:P3},x_=()=>{const[n,a]=H.useState(!1);return H.useEffect(()=>{const i=window.matchMedia("(max-width: 1023px)"),l=()=>a(i.matches);return l(),i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[]),n},X3="_sourceInfos_vei0l_1",Z3="_waitForLoading_vei0l_24",Q3="_loadingContent_vei0l_28",K3="_sourceHeader_vei0l_37",$3="_sourceHeaderIcon_vei0l_57",W3="_sourceContent_vei0l_61",J3="_openSourceButton_vei0l_69",eN="_sourceButtonLabel_vei0l_79",tN="_closeSourceInfosButton_vei0l_101",nN="_loadingSourceInfos_vei0l_125",aN="_loading_vei0l_28",rN="_loadingError_vei0l_139",iN="_highlightLoadingInfo_vei0l_155",lN="_highlightLoadingInfoInnerContainer_vei0l_169",sN="_highlightLoadingInfoContent_vei0l_178",oN="_highlightLoadingInfoCloseIcon_vei0l_198",uN="_highlightLoader_vei0l_203",cN="_highlightLoaderLoading_vei0l_210",xt={sourceInfos:X3,waitForLoading:Z3,loadingContent:Q3,sourceHeader:K3,sourceHeaderIcon:$3,sourceContent:W3,openSourceButton:J3,sourceButtonLabel:eN,closeSourceInfosButton:tN,loadingSourceInfos:nN,loading:aN,loadingError:rN,highlightLoadingInfo:iN,highlightLoadingInfoInnerContainer:lN,highlightLoadingInfoContent:sN,highlightLoadingInfoCloseIcon:oN,highlightLoader:uN,highlightLoaderLoading:cN},fN=({onClick:n})=>{const a=tt();return y.jsx("button",{className:$(xt.closeSourceInfosButton,"tooltip--bottom-left"),"aria-label":a("source-infos.close"),"data-title":a("source-infos.close"),tabIndex:0,onClick:n,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})})},dN=H.forwardRef(({sourceInfos:n,onClose:a,...i},l)=>y.jsxs("div",{className:xt.sourceHeader,...i,ref:l,children:[y.jsx("div",{children:n?y.jsx("p",{id:"source-info-title",children:n.title}):y.jsx("p",{children:" "})}),y.jsx(fN,{onClick:a})]})),hN=({loading:n})=>y.jsx("div",{className:xt.highlightLoader,children:n&&y.jsx("div",{className:xt.highlightLoaderLoading})});/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:C_,setPrototypeOf:Ev,isFrozen:mN,getPrototypeOf:pN,getOwnPropertyDescriptor:gN}=Object;let{freeze:kt,seal:xn,create:gh}=Object,{apply:yh,construct:vh}=typeof Reflect<"u"&&Reflect;kt||(kt=function(a){return a});xn||(xn=function(a){return a});yh||(yh=function(a,i){for(var l=arguments.length,o=new Array(l>2?l-2:0),c=2;c<l;c++)o[c-2]=arguments[c];return a.apply(i,o)});vh||(vh=function(a){for(var i=arguments.length,l=new Array(i>1?i-1:0),o=1;o<i;o++)l[o-1]=arguments[o];return new a(...l)});const $o=qt(Array.prototype.forEach),yN=qt(Array.prototype.lastIndexOf),Sv=qt(Array.prototype.pop),Fl=qt(Array.prototype.push),vN=qt(Array.prototype.splice),au=qt(String.prototype.toLowerCase),Hd=qt(String.prototype.toString),Id=qt(String.prototype.match),Vl=qt(String.prototype.replace),bN=qt(String.prototype.indexOf),_N=qt(String.prototype.trim),In=qt(Object.prototype.hasOwnProperty),It=qt(RegExp.prototype.test),Yl=EN(TypeError);function qt(n){return function(a){a instanceof RegExp&&(a.lastIndex=0);for(var i=arguments.length,l=new Array(i>1?i-1:0),o=1;o<i;o++)l[o-1]=arguments[o];return yh(n,a,l)}}function EN(n){return function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return vh(n,i)}}function Ce(n,a){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:au;Ev&&Ev(n,null);let l=a.length;for(;l--;){let o=a[l];if(typeof o=="string"){const c=i(o);c!==o&&(mN(a)||(a[l]=c),o=c)}n[o]=!0}return n}function SN(n){for(let a=0;a<n.length;a++)In(n,a)||(n[a]=null);return n}function Ra(n){const a=gh(null);for(const[i,l]of C_(n))In(n,i)&&(Array.isArray(l)?a[i]=SN(l):l&&typeof l=="object"&&l.constructor===Object?a[i]=Ra(l):a[i]=l);return a}function Pl(n,a){for(;n!==null;){const l=gN(n,a);if(l){if(l.get)return qt(l.get);if(typeof l.value=="function")return qt(l.value)}n=pN(n)}function i(){return null}return i}const Tv=kt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zd=kt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Gd=kt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),TN=kt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kd=kt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),AN=kt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Av=kt(["#text"]),Ov=kt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),qd=kt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xv=kt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Wo=kt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ON=xn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),xN=xn(/<%[\w\W]*|[\w\W]*%>/gm),CN=xn(/\$\{[\w\W]*/gm),RN=xn(/^data-[\-\w.\u00B7-\uFFFF]+$/),wN=xn(/^aria-[\-\w]+$/),R_=xn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NN=xn(/^(?:\w+script|data):/i),MN=xn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),w_=xn(/^html$/i),DN=xn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cv=Object.freeze({__proto__:null,ARIA_ATTR:wN,ATTR_WHITESPACE:MN,CUSTOM_ELEMENT:DN,DATA_ATTR:RN,DOCTYPE_NAME:w_,ERB_EXPR:xN,IS_ALLOWED_URI:R_,IS_SCRIPT_OR_DATA:NN,MUSTACHE_EXPR:ON,TMPLIT_EXPR:CN});const Xl={element:1,text:3,progressingInstruction:7,comment:8,document:9},LN=function(){return typeof window>"u"?null:window},BN=function(a,i){if(typeof a!="object"||typeof a.createPolicy!="function")return null;let l=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(l=i.getAttribute(o));const c="dompurify"+(l?"#"+l:"");try{return a.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Rv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function N_(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:LN();const a=re=>N_(re);if(a.version="3.3.0",a.removed=[],!n||!n.document||n.document.nodeType!==Xl.document||!n.Element)return a.isSupported=!1,a;let{document:i}=n;const l=i,o=l.currentScript,{DocumentFragment:c,HTMLTemplateElement:d,Node:h,Element:m,NodeFilter:g,NamedNodeMap:v=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:E,DOMParser:S,trustedTypes:w}=n,_=m.prototype,x=Pl(_,"cloneNode"),T=Pl(_,"remove"),D=Pl(_,"nextSibling"),z=Pl(_,"childNodes"),U=Pl(_,"parentNode");if(typeof d=="function"){const re=i.createElement("template");re.content&&re.content.ownerDocument&&(i=re.content.ownerDocument)}let G,M="";const{implementation:P,createNodeIterator:Q,createDocumentFragment:ae,getElementsByTagName:Be}=i,{importNode:He}=l;let ge=Rv();a.isSupported=typeof C_=="function"&&typeof U=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:be,ERB_EXPR:K,TMPLIT_EXPR:Se,DATA_ATTR:se,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:_e}=Cv;let{IS_ALLOWED_URI:me}=Cv,O=null;const F=Ce({},[...Tv,...zd,...Gd,...kd,...Av]);let X=null;const J=Ce({},[...Ov,...qd,...xv,...Wo]);let ee=Object.seal(gh(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),fe=null,Ae=null;const We=Object.seal(gh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ke=!0,$t=!0,Ua=!1,bt=!0,jt=!1,dn=!0,wn=!1,hr=!1,Bi=!1,na=!1,ja=!1,Ha=!1,Yr=!0,ss=!1;const Mu="user-content-";let Ct=!0,mr=!1,aa={},ra=null;const pr=Ce({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let os=null;const Ui=Ce({},["audio","video","img","source","image","track"]);let ji=null;const us=Ce({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kn="http://www.w3.org/1998/Math/MathML",St="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let ct=Tt,Hi=!1,Ii=null;const Du=Ce({},[kn,St,Tt],Hd);let ia=Ce({},["mi","mo","mn","ms","mtext"]),la=Ce({},["annotation-xml"]);const Pr=Ce({},["title","style","font","a","script"]);let Wt=null;const Xr=["application/xhtml+xml","text/html"],gr="text/html";let ft=null,sa=null;const zi=i.createElement("form"),Ia=function(C){return C instanceof RegExp||C instanceof Function},Gi=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(sa&&sa===C)){if((!C||typeof C!="object")&&(C={}),C=Ra(C),Wt=Xr.indexOf(C.PARSER_MEDIA_TYPE)===-1?gr:C.PARSER_MEDIA_TYPE,ft=Wt==="application/xhtml+xml"?Hd:au,O=In(C,"ALLOWED_TAGS")?Ce({},C.ALLOWED_TAGS,ft):F,X=In(C,"ALLOWED_ATTR")?Ce({},C.ALLOWED_ATTR,ft):J,Ii=In(C,"ALLOWED_NAMESPACES")?Ce({},C.ALLOWED_NAMESPACES,Hd):Du,ji=In(C,"ADD_URI_SAFE_ATTR")?Ce(Ra(us),C.ADD_URI_SAFE_ATTR,ft):us,os=In(C,"ADD_DATA_URI_TAGS")?Ce(Ra(Ui),C.ADD_DATA_URI_TAGS,ft):Ui,ra=In(C,"FORBID_CONTENTS")?Ce({},C.FORBID_CONTENTS,ft):pr,fe=In(C,"FORBID_TAGS")?Ce({},C.FORBID_TAGS,ft):Ra({}),Ae=In(C,"FORBID_ATTR")?Ce({},C.FORBID_ATTR,ft):Ra({}),aa=In(C,"USE_PROFILES")?C.USE_PROFILES:!1,ke=C.ALLOW_ARIA_ATTR!==!1,$t=C.ALLOW_DATA_ATTR!==!1,Ua=C.ALLOW_UNKNOWN_PROTOCOLS||!1,bt=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,jt=C.SAFE_FOR_TEMPLATES||!1,dn=C.SAFE_FOR_XML!==!1,wn=C.WHOLE_DOCUMENT||!1,na=C.RETURN_DOM||!1,ja=C.RETURN_DOM_FRAGMENT||!1,Ha=C.RETURN_TRUSTED_TYPE||!1,Bi=C.FORCE_BODY||!1,Yr=C.SANITIZE_DOM!==!1,ss=C.SANITIZE_NAMED_PROPS||!1,Ct=C.KEEP_CONTENT!==!1,mr=C.IN_PLACE||!1,me=C.ALLOWED_URI_REGEXP||R_,ct=C.NAMESPACE||Tt,ia=C.MATHML_TEXT_INTEGRATION_POINTS||ia,la=C.HTML_INTEGRATION_POINTS||la,ee=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Ia(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Ia(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),jt&&($t=!1),ja&&(na=!0),aa&&(O=Ce({},Av),X=[],aa.html===!0&&(Ce(O,Tv),Ce(X,Ov)),aa.svg===!0&&(Ce(O,zd),Ce(X,qd),Ce(X,Wo)),aa.svgFilters===!0&&(Ce(O,Gd),Ce(X,qd),Ce(X,Wo)),aa.mathMl===!0&&(Ce(O,kd),Ce(X,xv),Ce(X,Wo))),C.ADD_TAGS&&(typeof C.ADD_TAGS=="function"?We.tagCheck=C.ADD_TAGS:(O===F&&(O=Ra(O)),Ce(O,C.ADD_TAGS,ft))),C.ADD_ATTR&&(typeof C.ADD_ATTR=="function"?We.attributeCheck=C.ADD_ATTR:(X===J&&(X=Ra(X)),Ce(X,C.ADD_ATTR,ft))),C.ADD_URI_SAFE_ATTR&&Ce(ji,C.ADD_URI_SAFE_ATTR,ft),C.FORBID_CONTENTS&&(ra===pr&&(ra=Ra(ra)),Ce(ra,C.FORBID_CONTENTS,ft)),Ct&&(O["#text"]=!0),wn&&Ce(O,["html","head","body"]),O.table&&(Ce(O,["tbody"]),delete fe.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');G=C.TRUSTED_TYPES_POLICY,M=G.createHTML("")}else G===void 0&&(G=BN(w,o)),G!==null&&typeof M=="string"&&(M=G.createHTML(""));kt&&kt(C),sa=C}},ki=Ce({},[...zd,...Gd,...TN]),qi=Ce({},[...kd,...AN]),cs=function(C){let Z=U(C);(!Z||!Z.tagName)&&(Z={namespaceURI:ct,tagName:"template"});const te=au(C.tagName),ze=au(Z.tagName);return Ii[C.namespaceURI]?C.namespaceURI===St?Z.namespaceURI===Tt?te==="svg":Z.namespaceURI===kn?te==="svg"&&(ze==="annotation-xml"||ia[ze]):!!ki[te]:C.namespaceURI===kn?Z.namespaceURI===Tt?te==="math":Z.namespaceURI===St?te==="math"&&la[ze]:!!qi[te]:C.namespaceURI===Tt?Z.namespaceURI===St&&!la[ze]||Z.namespaceURI===kn&&!ia[ze]?!1:!qi[te]&&(Pr[te]||!ki[te]):!!(Wt==="application/xhtml+xml"&&Ii[C.namespaceURI]):!1},Ft=function(C){Fl(a.removed,{element:C});try{U(C).removeChild(C)}catch{T(C)}},Nn=function(C,Z){try{Fl(a.removed,{attribute:Z.getAttributeNode(C),from:Z})}catch{Fl(a.removed,{attribute:null,from:Z})}if(Z.removeAttribute(C),C==="is")if(na||ja)try{Ft(Z)}catch{}else try{Z.setAttribute(C,"")}catch{}},Fi=function(C){let Z=null,te=null;if(Bi)C="<remove></remove>"+C;else{const Ee=Id(C,/^[\r\n\t ]+/);te=Ee&&Ee[0]}Wt==="application/xhtml+xml"&&ct===Tt&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const ze=G?G.createHTML(C):C;if(ct===Tt)try{Z=new S().parseFromString(ze,Wt)}catch{}if(!Z||!Z.documentElement){Z=P.createDocument(ct,"template",null);try{Z.documentElement.innerHTML=Hi?M:ze}catch{}}const nt=Z.body||Z.documentElement;return C&&te&&nt.insertBefore(i.createTextNode(te),nt.childNodes[0]||null),ct===Tt?Be.call(Z,wn?"html":"body")[0]:wn?Z.documentElement:nt},Vi=function(C){return Q.call(C.ownerDocument||C,C,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},hn=function(C){return C instanceof E&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof v)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},dt=function(C){return typeof h=="function"&&C instanceof h};function Je(re,C,Z){$o(re,te=>{te.call(a,C,Z,sa)})}const oa=function(C){let Z=null;if(Je(ge.beforeSanitizeElements,C,null),hn(C))return Ft(C),!0;const te=ft(C.nodeName);if(Je(ge.uponSanitizeElement,C,{tagName:te,allowedTags:O}),dn&&C.hasChildNodes()&&!dt(C.firstElementChild)&&It(/<[/\w!]/g,C.innerHTML)&&It(/<[/\w!]/g,C.textContent)||C.nodeType===Xl.progressingInstruction||dn&&C.nodeType===Xl.comment&&It(/<[/\w]/g,C.data))return Ft(C),!0;if(!(We.tagCheck instanceof Function&&We.tagCheck(te))&&(!O[te]||fe[te])){if(!fe[te]&&fs(te)&&(ee.tagNameCheck instanceof RegExp&&It(ee.tagNameCheck,te)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(te)))return!1;if(Ct&&!ra[te]){const ze=U(C)||C.parentNode,nt=z(C)||C.childNodes;if(nt&&ze){const Ee=nt.length;for(let Rt=Ee-1;Rt>=0;--Rt){const mn=x(nt[Rt],!0);mn.__removalCount=(C.__removalCount||0)+1,ze.insertBefore(mn,D(C))}}}return Ft(C),!0}return C instanceof m&&!cs(C)||(te==="noscript"||te==="noembed"||te==="noframes")&&It(/<\/no(script|embed|frames)/i,C.innerHTML)?(Ft(C),!0):(jt&&C.nodeType===Xl.text&&(Z=C.textContent,$o([be,K,Se],ze=>{Z=Vl(Z,ze," ")}),C.textContent!==Z&&(Fl(a.removed,{element:C.cloneNode()}),C.textContent=Z)),Je(ge.afterSanitizeElements,C,null),!1)},Zr=function(C,Z,te){if(Yr&&(Z==="id"||Z==="name")&&(te in i||te in zi))return!1;if(!($t&&!Ae[Z]&&It(se,Z))){if(!(ke&&It(L,Z))){if(!(We.attributeCheck instanceof Function&&We.attributeCheck(Z,C))){if(!X[Z]||Ae[Z]){if(!(fs(C)&&(ee.tagNameCheck instanceof RegExp&&It(ee.tagNameCheck,C)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(C))&&(ee.attributeNameCheck instanceof RegExp&&It(ee.attributeNameCheck,Z)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(Z,C))||Z==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&It(ee.tagNameCheck,te)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(te))))return!1}else if(!ji[Z]){if(!It(me,Vl(te,oe,""))){if(!((Z==="src"||Z==="xlink:href"||Z==="href")&&C!=="script"&&bN(te,"data:")===0&&os[C])){if(!(Ua&&!It(W,Vl(te,oe,"")))){if(te)return!1}}}}}}}return!0},fs=function(C){return C!=="annotation-xml"&&Id(C,_e)},ds=function(C){Je(ge.beforeSanitizeAttributes,C,null);const{attributes:Z}=C;if(!Z||hn(C))return;const te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let ze=Z.length;for(;ze--;){const nt=Z[ze],{name:Ee,namespaceURI:Rt,value:mn}=nt,Vt=ft(Ee),qn=mn;let _t=Ee==="value"?qn:_N(qn);if(te.attrName=Vt,te.attrValue=_t,te.keepAttr=!0,te.forceKeepAttr=void 0,Je(ge.uponSanitizeAttribute,C,te),_t=te.attrValue,ss&&(Vt==="id"||Vt==="name")&&(Nn(Ee,C),_t=Mu+_t),dn&&It(/((--!?|])>)|<\/(style|title|textarea)/i,_t)){Nn(Ee,C);continue}if(Vt==="attributename"&&Id(_t,"href")){Nn(Ee,C);continue}if(te.forceKeepAttr)continue;if(!te.keepAttr){Nn(Ee,C);continue}if(!bt&&It(/\/>/i,_t)){Nn(Ee,C);continue}jt&&$o([be,K,Se],Pi=>{_t=Vl(_t,Pi," ")});const Yi=ft(C.nodeName);if(!Zr(Yi,Vt,_t)){Nn(Ee,C);continue}if(G&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Rt)switch(w.getAttributeType(Yi,Vt)){case"TrustedHTML":{_t=G.createHTML(_t);break}case"TrustedScriptURL":{_t=G.createScriptURL(_t);break}}if(_t!==qn)try{Rt?C.setAttributeNS(Rt,Ee,_t):C.setAttribute(Ee,_t),hn(C)?Ft(C):Sv(a.removed)}catch{Nn(Ee,C)}}Je(ge.afterSanitizeAttributes,C,null)},hs=function re(C){let Z=null;const te=Vi(C);for(Je(ge.beforeSanitizeShadowDOM,C,null);Z=te.nextNode();)Je(ge.uponSanitizeShadowNode,Z,null),oa(Z),ds(Z),Z.content instanceof c&&re(Z.content);Je(ge.afterSanitizeShadowDOM,C,null)};return a.sanitize=function(re){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=null,te=null,ze=null,nt=null;if(Hi=!re,Hi&&(re="<!-->"),typeof re!="string"&&!dt(re))if(typeof re.toString=="function"){if(re=re.toString(),typeof re!="string")throw Yl("dirty is not a string, aborting")}else throw Yl("toString is not a function");if(!a.isSupported)return re;if(hr||Gi(C),a.removed=[],typeof re=="string"&&(mr=!1),mr){if(re.nodeName){const mn=ft(re.nodeName);if(!O[mn]||fe[mn])throw Yl("root node is forbidden and cannot be sanitized in-place")}}else if(re instanceof h)Z=Fi("<!---->"),te=Z.ownerDocument.importNode(re,!0),te.nodeType===Xl.element&&te.nodeName==="BODY"||te.nodeName==="HTML"?Z=te:Z.appendChild(te);else{if(!na&&!jt&&!wn&&re.indexOf("<")===-1)return G&&Ha?G.createHTML(re):re;if(Z=Fi(re),!Z)return na?null:Ha?M:""}Z&&Bi&&Ft(Z.firstChild);const Ee=Vi(mr?re:Z);for(;ze=Ee.nextNode();)oa(ze),ds(ze),ze.content instanceof c&&hs(ze.content);if(mr)return re;if(na){if(ja)for(nt=ae.call(Z.ownerDocument);Z.firstChild;)nt.appendChild(Z.firstChild);else nt=Z;return(X.shadowroot||X.shadowrootmode)&&(nt=He.call(l,nt,!0)),nt}let Rt=wn?Z.outerHTML:Z.innerHTML;return wn&&O["!doctype"]&&Z.ownerDocument&&Z.ownerDocument.doctype&&Z.ownerDocument.doctype.name&&It(w_,Z.ownerDocument.doctype.name)&&(Rt="<!DOCTYPE "+Z.ownerDocument.doctype.name+`>
118
+ `+Rt),jt&&$o([be,K,Se],mn=>{Rt=Vl(Rt,mn," ")}),G&&Ha?G.createHTML(Rt):Rt},a.setConfig=function(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gi(re),hr=!0},a.clearConfig=function(){sa=null,hr=!1},a.isValidAttribute=function(re,C,Z){sa||Gi({});const te=ft(re),ze=ft(C);return Zr(te,ze,Z)},a.addHook=function(re,C){typeof C=="function"&&Fl(ge[re],C)},a.removeHook=function(re,C){if(C!==void 0){const Z=yN(ge[re],C);return Z===-1?void 0:vN(ge[re],Z,1)[0]}return Sv(ge[re])},a.removeHooks=function(re){ge[re]=[]},a.removeAllHooks=function(){ge=Rv()},a}var UN=N_();const jN=({onClose:n})=>{const a=tt();return y.jsxs("div",{className:xt.highlightLoadingInfo,onClick:n,children:[y.jsx("div",{className:xt.highlightLoadingInfoCloseIcon,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})})}),y.jsxs("div",{className:xt.highlightLoadingInfoInnerContainer,children:[y.jsxs("div",{className:xt.highlightLoadingInfoContent,children:[y.jsx("h3",{children:a("source-infos.highlight-loading.title")}),y.jsx("p",{children:a("source-infos.highlight-loading.description")})]}),y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"#000000",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M253.66,106.34a8,8,0,0,0-11.32,0L192,156.69,107.31,72l50.35-50.34a8,8,0,1,0-11.32-11.32L96,60.69A16,16,0,0,0,93.18,79.5L72,100.69a16,16,0,0,0,0,22.62L76.69,128,18.34,186.34a8,8,0,0,0,3.13,13.25l72,24A7.88,7.88,0,0,0,96,224a8,8,0,0,0,5.66-2.34L136,187.31l4.69,4.69a16,16,0,0,0,22.62,0l21.19-21.18A16,16,0,0,0,203.31,168l50.35-50.34A8,8,0,0,0,253.66,106.34ZM93.84,206.85l-55-18.35L88,139.31,124.69,176ZM152,180.69,83.31,112,104,91.31,172.69,160Z"})})]})]})},HN=({title:n,href:a,children:i})=>y.jsx("a",{href:a,title:n,target:"_blank",rel:"noopener noreferrer",children:i}),IN=({className:n,children:a,...i})=>y.jsx("a",{className:$(ts.button,ts.buttonDefault,n),type:"button",role:"button",...i,children:a}),zN=n=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:y.jsx("path",{d:"M52,146H36a6,6,0,0,0-6,6v56a6,6,0,0,0,6,6H52a34,34,0,0,0,0-68Zm0,56H42V158H52a22,22,0,0,1,0,44Zm168.15-5.46a6,6,0,0,1,.18,8.48A28.06,28.06,0,0,1,200,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a28.06,28.06,0,0,1,20.33,9,6,6,0,0,1-8.66,8.3A16.23,16.23,0,0,0,200,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a16.23,16.23,0,0,0,11.67-5.28A6,6,0,0,1,220.15,196.54ZM128,146c-16.54,0-30,15.25-30,34s13.46,34,30,34,30-15.25,30-34S144.54,146,128,146Zm0,56c-9.93,0-18-9.87-18-22s8.07-22,18-22,18,9.87,18,22S137.93,202,128,202ZM48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Z"})}),GN=({type:n,...a})=>{switch(n){case"WEBSITE":return y.jsx(__,{...a});case"PDF":return y.jsx(b_,{...a});case"DOCX":return y.jsx(y_,{...a});case"TEXT":return y.jsx(zN,{...a});default:return y.jsx(v_,{...a})}},kN=({url:n,knowledgeBaseType:a})=>{const i=tt();return y.jsx(IN,{className:xt.openSourceButton,href:n,target:"_blank",children:y.jsxs("div",{className:xt.sourceButtonLabel,children:[y.jsx("div",{className:xt.sourceHeaderIcon,children:y.jsx(GN,{type:a})}),y.jsx("p",{children:i("source-infos.open-source")})]})})},qN=({sourceInfos:{content:n,url:a,knowledgeBaseType:i,highlighted:l}})=>{const[o,c]=H.useState(!l);H.useEffect(()=>{l&&c(!1)},[l]);const d=UN.sanitize(n,{USE_PROFILES:{html:!0}});return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:$(xt.sourceContent,S_.markdown),children:[y.jsx(Na,{options:{overrides:{a:HN}},children:d}),o&&y.jsx(jN,{onClose:()=>c(!1)})]}),y.jsx(kN,{url:a,knowledgeBaseType:i})]})},FN=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,VN=()=>{const n=tt();return y.jsxs("div",{className:xt.loadingError,children:[y.jsx("h1",{children:n("source-infos.error.title")}),y.jsx("img",{src:FN,title:n("source-infos.error.title")}),y.jsx("p",{children:n("source-infos.error.info")})]})},YN=()=>y.jsx("div",{className:xt.loadingSourceInfos,children:y.jsx("svg",{className:xt.loading,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:y.jsx("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"})})}),PN=n=>{const[a,i]=H.useState(!0);return H.useEffect(()=>{let l=null;return n?.type==="loading"?(i(!0),l=setTimeout(()=>{i(!1)},300)):i(!n),()=>{l&&clearTimeout(l)}},[n]),a};function XN({sourceInfos:n,onClose:a,threshold:i=100}){const l=H.useRef(null),[o,c]=H.useState(0),[d,h]=H.useState(!1),m=H.useRef(null),g=H.useRef(null),v=H.useCallback(_=>{m.current=_,h(!0)},[]),E=H.useCallback(_=>{if(m.current!==null&&d){const x=_-m.current;x>0&&c(x)}},[d]),S=H.useCallback(()=>{h(!1),o>i&&a(),c(0),m.current=null},[o,i,a]),w=H.useCallback(_=>{const x=M=>v(M.touches[0].clientY),T=M=>E(M.touches[0].clientY),D=()=>S(),z=M=>{M.preventDefault(),v(M.clientY),window.addEventListener("mousemove",U),window.addEventListener("mouseup",G)},U=M=>E(M.clientY),G=()=>{S(),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",G)};_.addEventListener("touchstart",x),_.addEventListener("touchmove",T),_.addEventListener("touchend",D),_.addEventListener("mousedown",z),g.current=()=>{_.removeEventListener("touchstart",x),_.removeEventListener("touchmove",T),_.removeEventListener("touchend",D),_.removeEventListener("mousedown",z),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",G)}},[v,E,S]);return H.useEffect(()=>{let _;return(()=>{l.current?(g.current?.(),w(l.current)):(_=new MutationObserver(()=>{l.current&&(g.current?.(),w(l.current),_?.disconnect())}),_.observe(document.body,{childList:!0,subtree:!0}))})(),()=>{_?.disconnect(),g.current?.()}},[w,n]),{ref:l,dragOffsetY:o,isDragging:d}}const ZN=()=>{const n=Ba(),a=st(m=>m.chat.sourceInfos),i=x_(),l=H.useRef(null),o=PN(a);H.useEffect(()=>{l.current&&a?.type==="loading"&&(i?l.current.showModal():(l.current.setAttribute("open","true"),l.current?.focus()))},[a,i]);const c=H.useCallback(()=>{l.current&&(i?l.current.close():l.current.removeAttribute("open"),n(Zx()))},[n,i]),{ref:d,dragOffsetY:h}=XN({onClose:c,sourceInfos:a});return a?y.jsx("dialog",{ref:l,className:$(xt.sourceInfos,o?xt.waitForLoading:a.type==="loading"?xt.loadingContent:""),style:i&&h?{transform:`translateY(${h}px)`}:{},onClose:c,autoFocus:!0,role:"dialog","aria-labelledby":"source-info-title",children:o?null:y.jsxs(y.Fragment,{children:[y.jsx(dN,{ref:d,tabIndex:-1,sourceInfos:a.type==="loaded"?a:void 0,onClose:c}),a.type==="loading"?y.jsx(YN,{}):a.type==="loading-error"?y.jsx(VN,{}):y.jsxs(y.Fragment,{children:[y.jsx(hN,{loading:!a.highlighted}),y.jsx(qN,{sourceInfos:a})]})]})}):null},QN="_container_1aof3_1",KN="_body_1aof3_7",$N="_intro_1aof3_14",WN="_footer_1aof3_39",JN="_footnote_1aof3_43",e8="_containerWithFootnote_1aof3_58",t8="_startChatButton_1aof3_73",n8="_spinner_1aof3_88",a8="_formFields_1aof3_92",r8="_formField_1aof3_92",i8="_radio_1aof3_104",l8="_checkbox_1aof3_111",s8="_input_1aof3_119",o8="_inputLabel_1aof3_153",u8="_selectWrapper_1aof3_157",c8="_select_1aof3_157",f8="_selectLabel_1aof3_203",Ot={container:QN,body:KN,intro:$N,footer:WN,footnote:JN,containerWithFootnote:e8,startChatButton:t8,spinner:n8,formFields:a8,formField:r8,radio:i8,checkbox:l8,input:s8,inputLabel:o8,selectWrapper:u8,select:c8,selectLabel:f8},d8=({name:n,label:a,defaultValue:i,required:l,onChange:o})=>{const c=d=>{o(d.currentTarget.checked?"true":"false")};return y.jsxs("label",{className:$(Ot.checkbox,"chat__startScreen__checkbox"),htmlFor:n,children:[y.jsx("input",{type:"checkbox",id:n,name:n,defaultChecked:i==="true",required:l,onChange:c}),y.jsx("div",{children:a})]})},h8=({type:n,name:a,label:i,defaultValue:l,placeholder:o,required:c,multiple:d,min:h,max:m,pattern:g,onChange:v})=>{const E=S=>{v(S.target.value)};return y.jsxs("label",{className:$(Ot.input,"chat__startScreen__input"),htmlFor:a,children:[y.jsx("div",{className:$(Ot.inputLabel),children:i}),y.jsx("input",{type:n,id:a,name:a,defaultValue:l,placeholder:o,required:c,multiple:d,min:h,max:m,pattern:g,onChange:E})]})},m8=({name:n,value:a,label:i,defaultChecked:l,required:o,onChange:c})=>{const d=`${n}-${a}`,h=m=>{c(m.target.value)};return y.jsxs("label",{className:$(Ot.radio,"chat__startScreen__radio"),htmlFor:d,children:[y.jsx("input",{id:d,type:"radio",name:n,value:a,defaultChecked:l,required:o,onChange:h}),y.jsx("span",{className:$(Ot.label),children:i})]})},p8=({name:n,label:a,defaultValue:i,required:l,multiple:o,options:c,onChange:d})=>{const h=m=>{d(m.target.value)};return y.jsxs("label",{className:$(Ot.select,"chat__startScreen__select"),htmlFor:n,children:[y.jsx("div",{className:$(Ot.selectLabel),children:a}),y.jsx("div",{className:$(Ot.selectWrapper),children:y.jsx("select",{id:n,name:n,defaultValue:i,required:l,multiple:o,onChange:h,children:Object.entries(c||{}).map(([m,g])=>y.jsx("option",{value:m,selected:g===i,children:g}))})})]})},g8="start-screen.intro",y8="start-screen.start-chat",v8="start-screen.waiting-for-login",b8="start-screen.footnote",Hn="start-screen.form",wv=`${Hn}.fields`,_8=()=>{const n=tt(),a=Ba(),i=sm(),l=st(_=>_.startScreen.loginRequestToken),o=st(_=>_.settings.requiresUserAuthentication);H.useEffect(()=>{let _;if(l){const D=window.screenX+(window.outerWidth-600)/2,z=window.screenY+(window.outerHeight-700)/2,U=window.open(`/${i}/auth/login?loginRequestToken=${l}`,"Login",`width=600,height=700,left=${D},top=${z},resizable=yes,scrollbars=yes`);_=setInterval(()=>{U?.closed&&(a(Vx()),clearInterval(_))},500)}return()=>{_&&clearInterval(_)}},[i,l,a]);const[c,d]=H.useState({}),h=()=>{const _=Object.entries(c).reduce((x,[T,D])=>({...x,[T]:D.value}),{});a(o?Fx({loginRequestToken:uu(),formValues:_}):Gx({formValues:_}))},m=n(g8),g=n(l?v8:y8),v=n(b8),E=H.useMemo(()=>n(wv)?.split(";").map(_=>_.trim())??[],[n(wv)]);H.useEffect(()=>{E.length&&Object.keys(c).length===0&&d(E.reduce((_,x)=>({..._,[x]:E8(x,n)}),{}))},[n,E,c]);const S=_=>{_.preventDefault(),h()},w=_=>x=>{d(T=>({...T,[_]:{...T[_],value:x}}))};return y.jsxs("form",{onSubmit:S,className:$(Ot.container,v&&Ot.containerWithFootnote,"chat__startScreen"),children:[y.jsxs("div",{className:$(Ot.body,"chat__startScreen__body"),children:[m&&y.jsx("div",{className:$(Ot.intro,"chat__startScreen__intro"),children:y.jsx(Na,{options:{overrides:{a:Nv}},children:m})}),y.jsx("div",{className:$(Ot.formFields,"chat__startScreen__fields"),children:Object.values(c).map(({type:_,name:x,label:T,placeholder:D,defaultValue:z,options:U,required:G,multiple:M,min:P,max:Q,pattern:ae})=>y.jsx("div",{className:$(Ot.formField,"chat__startScreen__field"),children:(()=>{switch(_){case"radio":return y.jsxs(y.Fragment,{children:[y.jsx("div",{children:T}),Object.entries(U||{}).map(([Be,He])=>y.jsx(m8,{name:x,value:Be,label:He,defaultChecked:Be===z,required:G,onChange:w(x)},Be))]});case"checkbox":return y.jsx(d8,{name:x,label:T,defaultValue:z,required:G,onChange:w(x)});case"select":return y.jsx(p8,{name:x,label:T,defaultValue:z,required:G,multiple:M,options:U,onChange:w(x)});default:return y.jsx(h8,{type:_,name:x,label:T,placeholder:D,defaultValue:z,required:G,multiple:M,min:P,max:Q,pattern:ae,onChange:w(x)})}})()},x))})]}),y.jsxs("div",{className:$(Ot.footer,"chat__startScreen__footer"),children:[y.jsxs(yu,{type:"submit",className:Ot.startChatButton,disabled:!!l,children:[!!l&&y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",className:Ot.spinner,children:y.jsx("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"})}),y.jsx("div",{children:g})]}),v&&y.jsx("div",{className:Ot.footnote,children:y.jsx(Na,{options:{overrides:{a:Nv}},children:v})})]})]})},Nv=({title:n,href:a,children:i})=>y.jsx("a",{href:a,title:n,target:"_blank",rel:"noopener noreferrer",children:i}),E8=(n,a)=>{const i=a(`${Hn}.${n}.type`)||"text",l=a(`${Hn}.${n}.required`)==="true",o=a(`${Hn}.${n}.multiple`)==="true",c=a(`${Hn}.${n}.placeholder`),d=a(`${Hn}.${n}.label`)||"",h=a(`${Hn}.${n}.defaultValue`),m=a(`${Hn}.${n}.min`),g=a(`${Hn}.${n}.max`),v=a(`${Hn}.${n}.pattern`),E=T8(a(`${Hn}.${n}.options`));return{name:n,label:d,placeholder:c,value:S8(i,h,E)||"",defaultValue:h,options:E,type:i,required:l,multiple:o,min:m,max:g,pattern:v}},S8=(n,a,i)=>a||n==="select"&&Object.keys(i)[0]||"",T8=(n="")=>n.split(";").map(a=>a.trim()).reduce((a,i)=>{const[l,o]=i.split(":").map(c=>c.trim());return{...a,[l]:o}},{}),A8=()=>{const n=Su();H.useEffect(()=>{window.document.documentElement.lang=n.locale},[n.locale])},wi={TRIGGER_ACTION:"TRIGGER_ACTION",TRIGGER_STORY:"TRIGGER_STORY",CHAT_MESSAGE_FROM_GUEST:"CHAT_MESSAGE_FROM_GUEST",ON_CHAT_WINDOW_OPEN:"ON_CHAT_WINDOW_OPEN",ON_CHAT_WINDOW_CLOSE:"ON_CHAT_WINDOW_CLOSE",RESTART_CHAT:"RESTART_CHAT"},O8=({clientName:n})=>{A8();const a=Ba(),i=st(v=>v.intl.messages),l=tt(),o=st(v=>v.settings.enableStartScreen),c=st(v=>v.startScreen.startScreenStatus),d=st(v=>v.connection.queryString),h=H.useMemo(()=>new URLSearchParams(d||"?").get("cssClassName"),[d]);H.useEffect(()=>{const v=Lh.parse(d||""),E=S=>{switch(S.data.type){case wi.TRIGGER_ACTION:a(S.data.action);break;case wi.TRIGGER_STORY:a(jb(S.data.story));break;case wi.ON_CHAT_WINDOW_OPEN:a({type:"webclient.chatwindow.opened"});break;case wi.ON_CHAT_WINDOW_CLOSE:a({type:"webclient.chatwindow.closed"});break;case wi.CHAT_MESSAGE_FROM_GUEST:a(Mb(S.data.text));break;case wi.RESTART_CHAT:a(ls());break}};return a(Kx(n,v)),window.addEventListener("message",S=>E(S),!1),()=>window.removeEventListener("message",E)},[n,d,a]),H.useEffect(()=>{const v=l("page.title");v&&document&&(document.title=v)},[i,l]);const m=o===void 0,g=o===!1||c==="HIDDEN";return y.jsx("div",{className:$(_v.chatwindow,g&&_v.chatwindowWithAside,"chat__chatwindow",h),children:m?null:g?y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(bv,{chatStarted:!0})}),y.jsx("main",{children:y.jsx(N3,{clientName:n})}),y.jsx("aside",{children:y.jsx(ZN,{})})]}):y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(bv,{chatStarted:!1})}),y.jsx("main",{children:y.jsx(_8,{})})]})})},x8=()=>{const n=sm(),a=x_(),i=st(o=>o.intl.locale),l=st(o=>o.intl.messages);return y.jsx($A,{locale:i,messages:l,onError:()=>{},children:y.jsx("div",{className:$([JA.app,a?"chat__small":"chat__large"]),children:y.jsx(O8,{clientName:n})})})};var Fd,Mv;function C8(){if(Mv)return Fd;Mv=1;var n=p_(),a=im(),i="Expected a function";function l(o,c,d){var h=!0,m=!0;if(typeof o!="function")throw new TypeError(i);return a(d)&&(h="leading"in d?!!d.leading:h,m="trailing"in d?!!d.trailing:m),n(o,c,{leading:h,maxWait:c,trailing:m})}return Fd=l,Fd}var R8=C8();const w8=bu(R8);function N8(n){return n&&n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function M8(n){return n}function D8(n,a){a=a||{};const i=a.delimiter||".",l=a.maxDepth,o=a.transformKey||M8,c={};function d(h,m,g){g=g||1,Object.keys(h).forEach(function(v){const E=h[v],S=a.safe&&Array.isArray(E),w=Object.prototype.toString.call(E),_=N8(E),x=w==="[object Object]"||w==="[object Array]",T=m?m+i+o(v):o(v);if(!S&&!_&&x&&Object.keys(E).length&&(!a.maxDepth||g<l))return d(E,T,g+1);c[T]=E})}return d(n),c}const M_={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht eingeben","message-input.actions.submit.label":"Nachricht senden","message-input.actions.start-audio-recording.label":"Spracheingabe starten","message-input.actions.stop-audio-recording.label":"Spracheingabe stoppen","message-input.actions.submit-audio-recording.label":"Spracheingabe übermitteln","guest-bubble.label":"Ihre Nachricht","bot-bubble.label":"Nachricht des Chatbots","bot-bubble.reaction.good":"Gefällt mir","bot-bubble.reaction.bad":"Gefällt mir nicht","bot-bubble.reaction.remove":"Markierung entfernen","bot-bubble.reaction.say-more":"Erzähle mir bitte mehr","bot-bubble.reaction.category.WRONG_INFORMATION":"Falsch","bot-bubble.reaction.category.MISSING_INFORMATION":"Unvollständig","bot-bubble.reaction.category.OLD_INFORMATION":"Veraltet","bot-bubble.reaction.category.UNCLEAR":"Unklar","bot-bubble.reaction.category.OFF_TOPIC":"Nicht zur Frage passend","bot-bubble.reaction.comment":"Gedanken mit mir teilen...","bot-bubble.reaction.close":"Schliessen","bot-bubble.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","agent-bubble.label":"Nachricht des Live-Agenten","export-transcript.email.title":"Chatverlauf per E-Mail versenden","export-transcript.email.description":"Bitte E-Mail-Adresse angeben, an die der Chatverlauf gesendet werden soll.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Der Chatverlauf wurde an die hinterlegte E-Mail-Adresse übermittelt.","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
119
119
 
120
120
  - Der Chatverlauf wird im EU-Raum gespeichert und kann nur von autorisierten Personen eingesehen werden.
121
121
  - Geben Sie im Chatfenster keine persönlichen Daten ein (Passwörter, Geburtsdatum usw.).`,"general-conditions.accept-conditions-note":"Mit der Verwendung des Chats erklären Sie sich mit den Nutzungsbedingungen einverstanden.","block-user-input.title":"Bitte auf die Antwort des Chatbots warten.","conversation-rating.call-to-action.title":"Bewerten Sie diesen Chat","conversation-rating.overlay.title":"Wie zufrieden sind Sie mit diesem Chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Feedback bitte hier eingeben (optional)","conversation-rating.overlay.star.very-bad":"Sehr schlecht","conversation-rating.overlay.star.very-good":"Sehr gut","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, das tönt nicht gut. Bitte geben Sie mir doch ein schriftliches Feedback, damit ich dazulernen kann.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, das tönt nicht gut. Bitte geben Sie mir doch ein schriftliches Feedback, damit ich dazulernen kann.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"Durchschnitt ist nicht mein Ziel, was kann ich noch verbessern?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Knapp daneben ist auch vorbei. Was kann ich noch verbessern, um das nächste Mal alle Sterne zu erreichen?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfekt! Dann hoffe ich, dass ich Sie wieder einmal so gut beraten kann.","conversation-rating.overlay.bot-message.submit-feedback":"Vielen Dank für die Rückmeldung. Ich bin bestrebt, mich ständig zu verbessern.","conversation-rating.overlay.action.submit":"Bewertung senden","conversation-rating.overlay.action.back-to-chat":"Zurück zum Chat","conversation-rating.overlay.action.close-chat":"Chat minimieren","conversation-rating.overlay.action.restart-chat":"Chat neu starten","conversation-rating.overlay.action.cancel":"Abbrechen","start-screen.intro":"","start-screen.start-chat":"Chat starten","start-screen.waiting-for-login":"Warte auf Login ...","header.close-chat":"Chat minimieren","header.menu.title":"Menü","header.menu.restart-chat":"Chat neu starten","header.menu.expand-chat-window":"Fenster maximieren","header.menu.download-transcript":"Chatverlauf herunterladen","header.menu.send-transcript":"Chatverlauf versenden","header.menu.export-transcript":"Chatverlauf exportieren","header.menu.rate-conversation":"Chat bewerten","source-infos.close":"Schliessen","source-infos.open-source":"Quelle öffnen","source-infos.error.title":"Fehler","source-infos.error.info":"Oops! Etwas ist schiefgelaufen. Bitte versuche es erneut oder kontaktiere den Support, falls das Problem weiterhin besteht.","source-infos.highlight-loading.title":"Relevante Inhalte werden markiert...","source-infos.highlight-loading.description":"Einen Moment – die Quelle wird analysiert.","commands.show-more.action":"Weitere ...","commands.show-more.tooltip":"Weitere Befehle anzeigen","commands.show-less.action":"Weniger ...","commands.show-less.tooltip":"Weniger Befehle anzeigen"},L8={"page.title":"Bubble Chat Chatbot","message-input-label":"User input","message-input-placeholder":"Enter a message","message-input.actions.submit.label":"Send message","message-input.actions.start-audio-recording.label":"Start voice input","message-input.actions.stop-audio-recording.label":"Stop voice input","message-input.actions.submit-audio-recording.label":"Transmit voice input","guest-bubble.label":"Your message","bot-bubble.label":"Message from the chatbot","bot-bubble.reaction.good":"I like","bot-bubble.reaction.bad":"I don't like it","bot-bubble.reaction.remove":"Remove marker","bot-bubble.reaction.say-more":"Please tell us more","bot-bubble.reaction.category.WRONG_INFORMATION":"Wrong","bot-bubble.reaction.category.MISSING_INFORMATION":"Incomplete","bot-bubble.reaction.category.OLD_INFORMATION":"Outdated","bot-bubble.reaction.category.UNCLEAR":"Unclear","bot-bubble.reaction.category.OFF_TOPIC":"Not relevant to the question","bot-bubble.reaction.comment":"Share your thoughts with us...","bot-bubble.reaction.close":"Close","bot-bubble.copy":"Copy","bot-bubble.sources":"Source list","bot-bubble.source.open":"Open source","agent-bubble.label":"Message from the live agent","export-transcript.email.title":"Receive chat history","export-transcript.email.description":"Please enter the e-mail address to which the chat history should be sent.","export-transcript.email.cancel":"Cancel","export-transcript.email.send":"Send","export-transcript.email.placeholder":"E-mail address","export-transcript.email.invalid":"Please enter a valid e-mail address.","export-transcript.email.success":"The chat history was sent to the e-mail address provided.","general-conditions.header":"**Terms of use**","general-conditions.body":`Please consider the following points:
@@ -128,4 +128,4 @@ For more details see https://formatjs.github.io/docs/getting-started/message-dis
128
128
 
129
129
  - La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
130
130
  - Non inserire dati personali nella finestra di chat (password, data di nascita, ecc.).`,"general-conditions.accept-conditions-note":"Utilizzando la chat si accettano le condizioni d'uso.","block-user-input.title":"Attendere la risposta del chatbot.","conversation-rating.call-to-action.title":"Valuta questa chat","conversation-rating.overlay.title":"Quanto sei soddisfatto di questa chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Inserisci qui il tuo feedback (opzionale)","conversation-rating.overlay.star.very-bad":"Molto male","conversation-rating.overlay.star.very-good":"Molto buono","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"La media non è il mio obiettivo, cosa posso ancora migliorare?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Anche l'assenza è finita. Cosa posso migliorare per ottenere tutte le stelle la prossima volta?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfetto! Allora spero di potervi consigliare ancora una volta bene.","conversation-rating.overlay.bot-message.submit-feedback":"Grazie mille per il feedback. Mi impegno costantemente per migliorare.","conversation-rating.overlay.action.submit":"Invia","conversation-rating.overlay.action.back-to-chat":"Chiudere","conversation-rating.overlay.action.close-chat":"Minimizzare la chat","conversation-rating.overlay.action.restart-chat":"Riavviare la chat","conversation-rating.overlay.action.cancel":"Annulla","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","start-screen.waiting-for-login":"In attesa di login ...","header.close-chat":"Minimizzare la chat","header.menu.title":"Menu","header.menu.restart-chat":"Riavviare la chat","header.menu.expand-chat-window":"Espandere la finestra","header.menu.download-transcript":"Scaricare la trascrizione","header.menu.send-transcript":"Inviare la trascrizione","header.menu.export-transcript":"Esportare la trascrizione","header.menu.rate-conversation":"Valutare la conversazione","source-infos.close":"Chiudere","source-infos.open-source":"Fonte aperta","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","source-infos.highlight-loading.title":"Il contenuto rilevante è evidenziato...","source-infos.highlight-loading.description":"Un momento - la fonte è in fase di analisi","commands.show-more.action":"Di più","commands.show-more.tooltip":"Mostra più comandi","commands.show-less.action":"Meno","commands.show-less.tooltip":"Mostra meno comandi"},j8=["de","en","fr","it"],D_={locale:"de",messages:M_},H8=(n,a)=>{if(j8.includes(n)){const i=I8(n),l=D8(a);return{...i,...l}}return a},I8=n=>{switch(n.toString()){case"en":return L8;case"fr":return B8;case"it":return U8;default:return M_}},z8=(n=G8,a)=>{switch(a.type){case Kh:return Object.assign({},n,{connectionState:kr.CONNECTING});case $h:return Object.assign({},n,{connectionState:kr.CONNECTED});case Wh:return Object.assign({},n,{connectionState:kr.DISCONNECTED});case Jh:return Object.assign({},n,{connectionState:kr.RECONNECTED});case em:return Object.assign({},n,{sessionId:a.sessionId});case xu:return Object.assign({},n,{sessionId:a.payload.sessionId,userId:a.payload.userId});case Cu:return Object.assign({},n,{sessionId:void 0});default:return n}},G8={connectionState:kr.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},k8=(n=Lv,a)=>{switch(a.type){case Wb:return Lv;case xu:return Ir({type:"webclient.chat.started"}),n;case Cu:return Ir({type:"webclient.chat.ended"}),n;case Te.ActionTypes.TYPING_ON:return Object.assign({},n,{isBotTyping:!0});case Te.ActionTypes.TYPING_OFF:return Object.assign({},n,{isBotTyping:!1});case Te.ActionTypes.MESSAGE_FROM_GUEST:case Te.ActionTypes.MESSAGE_WITHOUT_ANALYSIS_FROM_GUEST:return Dv(n,a.message);case Te.ActionTypes.MESSAGE_TO_GUEST:{Ir(a);const i=Object.assign({},a.message,{_id:a.meta.actionId}),l=n.messages.filter(o=>o._id===a.meta.actionId).length>0;return Object.assign({},n,{isBotTyping:!1,messages:l?n.messages:n.messages.concat([i]),quickReplies:i.quickReplies?i.quickReplies:[]})}case Hh:{const i=a.messages,l=i.length?i[i.length-1]:void 0;return Object.assign({},n,{isBotTyping:!1,messages:i,quickReplies:l?.quickReplies||[]})}case jh:return Ir(a.message),n;case Te.ActionTypes.EVENT_TO_GUEST:return Ir(a.event),n;case Te.ActionTypes.DRAWER_OPEN:return Object.assign({},n,{drawerContentUrl:a.payload.parameters.contentUrl});case Te.ActionTypes.DRAWER_CLOSE:return Object.assign({},n,{drawerContentUrl:void 0});case Te.ActionTypes.GUEST_LOCALE_CHANGED:return Object.assign({},n,{locale:a.payload.locale});case Lb:return Ir(a),n;case Bb:return Ir(a),{...n,conversationRating:{...n.conversationRating,opener:void 0}};case zh:{const i=new Te.TextMessage(a.transcription,new Te.GuestUser),l=Object.assign({},i,{_id:uu()});return Dv(n,l)}case Te.ActionTypes.TRANSCRIPT_ITEM_GUEST_REACTION:{const i=n.messages.map(l=>l._id===a.payload.actionId?Object.assign({},l,a.payload.reaction?{reaction:{type:a.payload.reaction,category:a.payload.category,comment:a.payload.comment}}:{reaction:void 0}):l);return Object.assign({},n,{messages:i})}case Gh:{const i={enabled:!0,rating:a.payload.rating};return Object.assign({},n,{conversationRating:i})}case Te.ActionTypes.CONVERSATION_RATING_FROM_GUEST:{const i={...n.conversationRating,rating:a.payload};return Object.assign({},n,{conversationRating:i})}case e_:{const i={...n.conversationRating,opener:a.payload.opener,...a.payload.defaultRating?{rating:{value:a.payload.defaultRating,feedback:n.conversationRating.rating?.feedback||""}}:{}};return Object.assign({},n,{conversationRating:i})}case t_:{const i={...n.conversationRating,opener:void 0};return Object.assign({},n,{conversationRating:i})}case qh:return{...n,sourceInfos:{type:"loading",chunkId:a.payload.chunkId}};case kh:{const{highlighted:i}=a.payload;return n.sourceInfos?.type==="loaded"&&i?{...n,sourceInfos:{...n.sourceInfos,highlighted:!0}}:{...n,sourceInfos:{type:"loading-error"}}}case Db:{const i=n.sourceInfos?.type,{chunkId:l,knowledgeBaseType:o,title:c,content:d,highlighted:h,url:m}=a.payload,g=n.sourceInfos?.type==="loading"||n.sourceInfos?.type==="loaded"?n.sourceInfos?.chunkId:void 0;return g&&g!==l?n:i==="loading"||i==="loaded"&&h?{...n,sourceInfos:{type:"loaded",chunkId:l,knowledgeBaseType:o,title:c,content:d,highlighted:h,url:m}}:n}case Fh:return{...n,sourceInfos:void 0};case Jb:return{...n,showTranscriptMailOverlay:!n.showTranscriptMailOverlay,conversationRating:{...n.conversationRating,opener:void 0}};default:return n}},Dv=(n,a)=>{const i=n.messages[n.messages.length-1],l=i?.text===a.text;return i&&i.sender.type===a.sender.type&&l?n:Object.assign({},n,{messages:n.messages.concat([a]),quickReplies:[]})},Ir=n=>{q8()?window.top?.postMessage(n,"*"):n.type==="webclient.change.url"&&window.open(n.url)},q8=()=>typeof window<"u"&&window.self!==window.top,Lv={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},L_=Zh({name:"intl",initialState:D_,reducers:{updateIntl:(n,a)=>{n.locale=a.payload.language,n.messages=a.payload.messages}}}),{updateIntl:F8}=L_.actions,V8=L_.reducer,Y8={version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[]},B_=Zh({name:"settings",initialState:Y8,reducers:{setSettings(n,a){n.version&&n.version!==a.payload.version?(console.log("version changed, reloading chat window"),window.location.reload()):(n.version=a.payload.version,n.requiresUserAuthentication=a.payload.requiresUserAuthentication,n.enableStartScreen=a.payload.enableStartScreen,n.enableStandaloneView=a.payload.enableStandaloneView,n.enableTranscriptExportEmail=a.payload.enableTranscriptExportEmail,n.enableTranscriptExportPdf=a.payload.enableTranscriptExportPdf,n.enableGeneralConditions=a.payload.enableGeneralConditions,n.enableSpeechSupport=a.payload.enableSpeechSupport,n.commands=a.payload.commands,n.menuItems=a.payload.menuItems||[])}}}),{setSettings:P8}=B_.actions,X8=B_.reducer,Z8=Gb({settings:X8,chat:k8,startScreen:Yx,connection:z8,intl:V8}),Q8="bubble-chat",U_="state-last-saved-at",j_="state",K8=n=>{try{if(!J8())return;const a=Bv(n,U_);if(W8(a))return;{const i=Bv(n,j_);if(i===null)return;const l=JSON.parse(i),o=l.connection?.queryString;if(o!==void 0&&o!==window.location.search){console.log("Ignoring persisted state due to different query string");return}else return l}}catch(a){console.error(a);return}},$8=(n,a)=>{try{const i=JSON.stringify(a);Uv(n,j_,i);const l=new Date().toISOString();Uv(n,U_,l)}catch(i){console.error(i)}},W8=n=>{if(n===null)return!1;const a=new Date(n);return a.setHours(a.getHours()+12),new Date>a},J8=()=>typeof localStorage<"u",Bv=(n,a)=>{const i=H_(n,a);return localStorage.getItem(i)},Uv=(n,a,i)=>{const l=H_(n,a);return localStorage.setItem(l,i)},H_=(n,a)=>`${Q8}-${n}-${a}`,ta=Object.create(null);ta.open="0";ta.close="1";ta.ping="2";ta.pong="3";ta.message="4";ta.upgrade="5";ta.noop="6";const ru=Object.create(null);Object.keys(ta).forEach(n=>{ru[ta[n]]=n});const bh={type:"error",data:"parser error"},I_=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",z_=typeof ArrayBuffer=="function",G_=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,om=({type:n,data:a},i,l)=>I_&&a instanceof Blob?i?l(a):jv(a,l):z_&&(a instanceof ArrayBuffer||G_(a))?i?l(a):jv(new Blob([a]),l):l(ta[n]+(a||"")),jv=(n,a)=>{const i=new FileReader;return i.onload=function(){const l=i.result.split(",")[1];a("b"+(l||""))},i.readAsDataURL(n)};function Hv(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Vd;function eM(n,a){if(I_&&n.data instanceof Blob)return n.data.arrayBuffer().then(Hv).then(a);if(z_&&(n.data instanceof ArrayBuffer||G_(n.data)))return a(Hv(n.data));om(n,!1,i=>{Vd||(Vd=new TextEncoder),a(Vd.encode(i))})}const Iv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$l=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Iv.length;n++)$l[Iv.charCodeAt(n)]=n;const tM=n=>{let a=n.length*.75,i=n.length,l,o=0,c,d,h,m;n[n.length-1]==="="&&(a--,n[n.length-2]==="="&&a--);const g=new ArrayBuffer(a),v=new Uint8Array(g);for(l=0;l<i;l+=4)c=$l[n.charCodeAt(l)],d=$l[n.charCodeAt(l+1)],h=$l[n.charCodeAt(l+2)],m=$l[n.charCodeAt(l+3)],v[o++]=c<<2|d>>4,v[o++]=(d&15)<<4|h>>2,v[o++]=(h&3)<<6|m&63;return g},nM=typeof ArrayBuffer=="function",um=(n,a)=>{if(typeof n!="string")return{type:"message",data:k_(n,a)};const i=n.charAt(0);return i==="b"?{type:"message",data:aM(n.substring(1),a)}:ru[i]?n.length>1?{type:ru[i],data:n.substring(1)}:{type:ru[i]}:bh},aM=(n,a)=>{if(nM){const i=tM(n);return k_(i,a)}else return{base64:!0,data:n}},k_=(n,a)=>{switch(a){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},q_="",rM=(n,a)=>{const i=n.length,l=new Array(i);let o=0;n.forEach((c,d)=>{om(c,!1,h=>{l[d]=h,++o===i&&a(l.join(q_))})})},iM=(n,a)=>{const i=n.split(q_),l=[];for(let o=0;o<i.length;o++){const c=um(i[o],a);if(l.push(c),c.type==="error")break}return l};function lM(){return new TransformStream({transform(n,a){eM(n,i=>{const l=i.length;let o;if(l<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,l);else if(l<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,l)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(l))}n.data&&typeof n.data!="string"&&(o[0]|=128),a.enqueue(o),a.enqueue(i)})}})}let Yd;function Jo(n){return n.reduce((a,i)=>a+i.length,0)}function eu(n,a){if(n[0].length===a)return n.shift();const i=new Uint8Array(a);let l=0;for(let o=0;o<a;o++)i[o]=n[0][l++],l===n[0].length&&(n.shift(),l=0);return n.length&&l<n[0].length&&(n[0]=n[0].slice(l)),i}function sM(n,a){Yd||(Yd=new TextDecoder);const i=[];let l=0,o=-1,c=!1;return new TransformStream({transform(d,h){for(i.push(d);;){if(l===0){if(Jo(i)<1)break;const m=eu(i,1);c=(m[0]&128)===128,o=m[0]&127,o<126?l=3:o===126?l=1:l=2}else if(l===1){if(Jo(i)<2)break;const m=eu(i,2);o=new DataView(m.buffer,m.byteOffset,m.length).getUint16(0),l=3}else if(l===2){if(Jo(i)<8)break;const m=eu(i,8),g=new DataView(m.buffer,m.byteOffset,m.length),v=g.getUint32(0);if(v>Math.pow(2,21)-1){h.enqueue(bh);break}o=v*Math.pow(2,32)+g.getUint32(4),l=3}else{if(Jo(i)<o)break;const m=eu(i,o);h.enqueue(um(c?m:Yd.decode(m),a)),l=0}if(o===0||o>n){h.enqueue(bh);break}}}})}const F_=4;function vt(n){if(n)return oM(n)}function oM(n){for(var a in vt.prototype)n[a]=vt.prototype[a];return n}vt.prototype.on=vt.prototype.addEventListener=function(n,a){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(a),this};vt.prototype.once=function(n,a){function i(){this.off(n,i),a.apply(this,arguments)}return i.fn=a,this.on(n,i),this};vt.prototype.off=vt.prototype.removeListener=vt.prototype.removeAllListeners=vt.prototype.removeEventListener=function(n,a){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+n];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var l,o=0;o<i.length;o++)if(l=i[o],l===a||l.fn===a){i.splice(o,1);break}return i.length===0&&delete this._callbacks["$"+n],this};vt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var a=new Array(arguments.length-1),i=this._callbacks["$"+n],l=1;l<arguments.length;l++)a[l-1]=arguments[l];if(i){i=i.slice(0);for(var l=0,o=i.length;l<o;++l)i[l].apply(this,a)}return this};vt.prototype.emitReserved=vt.prototype.emit;vt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};vt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const wu=typeof Promise=="function"&&typeof Promise.resolve=="function"?a=>Promise.resolve().then(a):(a,i)=>i(a,0),On=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),uM="arraybuffer";function V_(n,...a){return a.reduce((i,l)=>(n.hasOwnProperty(l)&&(i[l]=n[l]),i),{})}const cM=On.setTimeout,fM=On.clearTimeout;function Nu(n,a){a.useNativeTimers?(n.setTimeoutFn=cM.bind(On),n.clearTimeoutFn=fM.bind(On)):(n.setTimeoutFn=On.setTimeout.bind(On),n.clearTimeoutFn=On.clearTimeout.bind(On))}const dM=1.33;function hM(n){return typeof n=="string"?mM(n):Math.ceil((n.byteLength||n.size)*dM)}function mM(n){let a=0,i=0;for(let l=0,o=n.length;l<o;l++)a=n.charCodeAt(l),a<128?i+=1:a<2048?i+=2:a<55296||a>=57344?i+=3:(l++,i+=4);return i}function Y_(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function pM(n){let a="";for(let i in n)n.hasOwnProperty(i)&&(a.length&&(a+="&"),a+=encodeURIComponent(i)+"="+encodeURIComponent(n[i]));return a}function gM(n){let a={},i=n.split("&");for(let l=0,o=i.length;l<o;l++){let c=i[l].split("=");a[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return a}class yM extends Error{constructor(a,i,l){super(a),this.description=i,this.context=l,this.type="TransportError"}}class cm extends vt{constructor(a){super(),this.writable=!1,Nu(this,a),this.opts=a,this.query=a.query,this.socket=a.socket,this.supportsBinary=!a.forceBase64}onError(a,i,l){return super.emitReserved("error",new yM(a,i,l)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(a){this.readyState==="open"&&this.write(a)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(a){const i=um(a,this.socket.binaryType);this.onPacket(i)}onPacket(a){super.emitReserved("packet",a)}onClose(a){this.readyState="closed",super.emitReserved("close",a)}pause(a){}createUri(a,i={}){return a+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const a=this.opts.hostname;return a.indexOf(":")===-1?a:"["+a+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(a){const i=pM(a);return i.length?"?"+i:""}}class vM extends cm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(a){this.readyState="pausing";const i=()=>{this.readyState="paused",a()};if(this._polling||!this.writable){let l=0;this._polling&&(l++,this.once("pollComplete",function(){--l||i()})),this.writable||(l++,this.once("drain",function(){--l||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(a){const i=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};iM(a,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const a=()=>{this.write([{type:"close"}])};this.readyState==="open"?a():this.once("open",a)}write(a){this.writable=!1,rM(a,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const a=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=Y_()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(a,i)}}let P_=!1;try{P_=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const bM=P_;function _M(){}class EM extends vM{constructor(a){if(super(a),typeof location<"u"){const i=location.protocol==="https:";let l=location.port;l||(l=i?"443":"80"),this.xd=typeof location<"u"&&a.hostname!==location.hostname||l!==a.port}}doWrite(a,i){const l=this.request({method:"POST",data:a});l.on("success",i),l.on("error",(o,c)=>{this.onError("xhr post error",o,c)})}doPoll(){const a=this.request();a.on("data",this.onData.bind(this)),a.on("error",(i,l)=>{this.onError("xhr poll error",i,l)}),this.pollXhr=a}}class Jn extends vt{constructor(a,i,l){super(),this.createRequest=a,Nu(this,l),this._opts=l,this._method=l.method||"GET",this._uri=i,this._data=l.data!==void 0?l.data:null,this._create()}_create(){var a;const i=V_(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const l=this._xhr=this.createRequest(i);try{l.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){l.setDisableHeaderCheck&&l.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&l.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{l.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{l.setRequestHeader("Accept","*/*")}catch{}(a=this._opts.cookieJar)===null||a===void 0||a.addCookies(l),"withCredentials"in l&&(l.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(l.timeout=this._opts.requestTimeout),l.onreadystatechange=()=>{var o;l.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(l.getResponseHeader("set-cookie"))),l.readyState===4&&(l.status===200||l.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof l.status=="number"?l.status:0)},0))},l.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Jn.requestsCount++,Jn.requests[this._index]=this)}_onError(a){this.emitReserved("error",a,this._xhr),this._cleanup(!0)}_cleanup(a){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=_M,a)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Jn.requests[this._index],this._xhr=null}}_onLoad(){const a=this._xhr.responseText;a!==null&&(this.emitReserved("data",a),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Jn.requestsCount=0;Jn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",zv);else if(typeof addEventListener=="function"){const n="onpagehide"in On?"pagehide":"unload";addEventListener(n,zv,!1)}}function zv(){for(let n in Jn.requests)Jn.requests.hasOwnProperty(n)&&Jn.requests[n].abort()}const SM=(function(){const n=X_({xdomain:!1});return n&&n.responseType!==null})();class TM extends EM{constructor(a){super(a);const i=a&&a.forceBase64;this.supportsBinary=SM&&!i}request(a={}){return Object.assign(a,{xd:this.xd},this.opts),new Jn(X_,this.uri(),a)}}function X_(n){const a=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!a||bM))return new XMLHttpRequest}catch{}if(!a)try{return new On[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Z_=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class AM extends cm{get name(){return"websocket"}doOpen(){const a=this.uri(),i=this.opts.protocols,l=Z_?{}:V_(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(l.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(a,i,l)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=a=>this.onClose({description:"websocket connection closed",context:a}),this.ws.onmessage=a=>this.onData(a.data),this.ws.onerror=a=>this.onError("websocket error",a)}write(a){this.writable=!1;for(let i=0;i<a.length;i++){const l=a[i],o=i===a.length-1;om(l,this.supportsBinary,c=>{try{this.doWrite(l,c)}catch{}o&&wu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const a=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=Y_()),this.supportsBinary||(i.b64=1),this.createUri(a,i)}}const Pd=On.WebSocket||On.MozWebSocket;class OM extends AM{createSocket(a,i,l){return Z_?new Pd(a,i,l):i?new Pd(a,i):new Pd(a)}doWrite(a,i){this.ws.send(i)}}class xM extends cm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(a){return this.emitReserved("error",a)}this._transport.closed.then(()=>{this.onClose()}).catch(a=>{this.onError("webtransport error",a)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(a=>{const i=sM(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=a.readable.pipeThrough(i).getReader(),o=lM();o.readable.pipeTo(a.writable),this._writer=o.writable.getWriter();const c=()=>{l.read().then(({done:h,value:m})=>{h||(this.onPacket(m),c())}).catch(h=>{})};c();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(a){this.writable=!1;for(let i=0;i<a.length;i++){const l=a[i],o=i===a.length-1;this._writer.write(l).then(()=>{o&&wu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var a;(a=this._transport)===null||a===void 0||a.close()}}const CM={websocket:OM,webtransport:xM,polling:TM},RM=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,wM=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function _h(n){if(n.length>8e3)throw"URI too long";const a=n,i=n.indexOf("["),l=n.indexOf("]");i!=-1&&l!=-1&&(n=n.substring(0,i)+n.substring(i,l).replace(/:/g,";")+n.substring(l,n.length));let o=RM.exec(n||""),c={},d=14;for(;d--;)c[wM[d]]=o[d]||"";return i!=-1&&l!=-1&&(c.source=a,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=NM(c,c.path),c.queryKey=MM(c,c.query),c}function NM(n,a){const i=/\/{2,9}/g,l=a.replace(i,"/").split("/");return(a.slice(0,1)=="/"||a.length===0)&&l.splice(0,1),a.slice(-1)=="/"&&l.splice(l.length-1,1),l}function MM(n,a){const i={};return a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(l,o,c){o&&(i[o]=c)}),i}const Eh=typeof addEventListener=="function"&&typeof removeEventListener=="function",iu=[];Eh&&addEventListener("offline",()=>{iu.forEach(n=>n())},!1);class fr extends vt{constructor(a,i){if(super(),this.binaryType=uM,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,a&&typeof a=="object"&&(i=a,a=null),a){const l=_h(a);i.hostname=l.host,i.secure=l.protocol==="https"||l.protocol==="wss",i.port=l.port,l.query&&(i.query=l.query)}else i.host&&(i.hostname=_h(i.host).host);Nu(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(l=>{const o=l.prototype.name;this.transports.push(o),this._transportsByName[o]=l}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=gM(this.opts.query)),Eh&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},iu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(a){const i=Object.assign({},this.opts.query);i.EIO=F_,i.transport=a,this.id&&(i.sid=this.id);const l=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[a]);return new this._transportsByName[a](l)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const a=this.opts.rememberUpgrade&&fr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(a);i.open(),this.setTransport(i)}setTransport(a){this.transport&&this.transport.removeAllListeners(),this.transport=a,a.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",fr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(a){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",a),this.emitReserved("heartbeat"),a.type){case"open":this.onHandshake(JSON.parse(a.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=a.data,this._onError(i);break;case"message":this.emitReserved("data",a.data),this.emitReserved("message",a.data);break}}onHandshake(a){this.emitReserved("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this._pingInterval=a.pingInterval,this._pingTimeout=a.pingTimeout,this._maxPayload=a.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const a=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+a,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},a),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const a=this._getWritablePackets();this.transport.send(a),this._prevBufferLen=a.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let l=0;l<this.writeBuffer.length;l++){const o=this.writeBuffer[l].data;if(o&&(i+=hM(o)),l>0&&i>this._maxPayload)return this.writeBuffer.slice(0,l);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const a=Date.now()>this._pingTimeoutTime;return a&&(this._pingTimeoutTime=0,wu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),a}write(a,i,l){return this._sendPacket("message",a,i,l),this}send(a,i,l){return this._sendPacket("message",a,i,l),this}_sendPacket(a,i,l,o){if(typeof i=="function"&&(o=i,i=void 0),typeof l=="function"&&(o=l,l=null),this.readyState==="closing"||this.readyState==="closed")return;l=l||{},l.compress=l.compress!==!1;const c={type:a,data:i,options:l};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),this.flush()}close(){const a=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),a()},l=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?l():a()}):this.upgrading?l():a()),this}_onError(a){if(fr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",a),this._onClose("transport error",a)}_onClose(a,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Eh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const l=iu.indexOf(this._offlineEventListener);l!==-1&&iu.splice(l,1)}this.readyState="closed",this.id=null,this.emitReserved("close",a,i),this.writeBuffer=[],this._prevBufferLen=0}}}fr.protocol=F_;class DM extends fr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let a=0;a<this._upgrades.length;a++)this._probe(this._upgrades[a])}_probe(a){let i=this.createTransport(a),l=!1;fr.priorWebsocketSuccess=!1;const o=()=>{l||(i.send([{type:"ping",data:"probe"}]),i.once("packet",E=>{if(!l)if(E.type==="pong"&&E.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;fr.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{l||this.readyState!=="closed"&&(v(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const S=new Error("probe error");S.transport=i.name,this.emitReserved("upgradeError",S)}}))};function c(){l||(l=!0,v(),i.close(),i=null)}const d=E=>{const S=new Error("probe error: "+E);S.transport=i.name,c(),this.emitReserved("upgradeError",S)};function h(){d("transport closed")}function m(){d("socket closed")}function g(E){i&&E.name!==i.name&&c()}const v=()=>{i.removeListener("open",o),i.removeListener("error",d),i.removeListener("close",h),this.off("close",m),this.off("upgrading",g)};i.once("open",o),i.once("error",d),i.once("close",h),this.once("close",m),this.once("upgrading",g),this._upgrades.indexOf("webtransport")!==-1&&a!=="webtransport"?this.setTimeoutFn(()=>{l||i.open()},200):i.open()}onHandshake(a){this._upgrades=this._filterUpgrades(a.upgrades),super.onHandshake(a)}_filterUpgrades(a){const i=[];for(let l=0;l<a.length;l++)~this.transports.indexOf(a[l])&&i.push(a[l]);return i}}let LM=class extends DM{constructor(a,i={}){const l=typeof a=="object"?a:i;(!l.transports||l.transports&&typeof l.transports[0]=="string")&&(l.transports=(l.transports||["polling","websocket","webtransport"]).map(o=>CM[o]).filter(o=>!!o)),super(a,l)}};function BM(n,a="",i){let l=n;i=i||typeof location<"u"&&location,n==null&&(n=i.protocol+"//"+i.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=i.protocol+n:n=i.host+n),/^(https?|wss?):\/\//.test(n)||(typeof i<"u"?n=i.protocol+"//"+n:n="https://"+n),l=_h(n)),l.port||(/^(http|ws)$/.test(l.protocol)?l.port="80":/^(http|ws)s$/.test(l.protocol)&&(l.port="443")),l.path=l.path||"/";const c=l.host.indexOf(":")!==-1?"["+l.host+"]":l.host;return l.id=l.protocol+"://"+c+":"+l.port+a,l.href=l.protocol+"://"+c+(i&&i.port===l.port?"":":"+l.port),l}const UM=typeof ArrayBuffer=="function",jM=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Q_=Object.prototype.toString,HM=typeof Blob=="function"||typeof Blob<"u"&&Q_.call(Blob)==="[object BlobConstructor]",IM=typeof File=="function"||typeof File<"u"&&Q_.call(File)==="[object FileConstructor]";function fm(n){return UM&&(n instanceof ArrayBuffer||jM(n))||HM&&n instanceof Blob||IM&&n instanceof File}function lu(n,a){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let i=0,l=n.length;i<l;i++)if(lu(n[i]))return!0;return!1}if(fm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return lu(n.toJSON(),!0);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&lu(n[i]))return!0;return!1}function zM(n){const a=[],i=n.data,l=n;return l.data=Sh(i,a),l.attachments=a.length,{packet:l,buffers:a}}function Sh(n,a){if(!n)return n;if(fm(n)){const i={_placeholder:!0,num:a.length};return a.push(n),i}else if(Array.isArray(n)){const i=new Array(n.length);for(let l=0;l<n.length;l++)i[l]=Sh(n[l],a);return i}else if(typeof n=="object"&&!(n instanceof Date)){const i={};for(const l in n)Object.prototype.hasOwnProperty.call(n,l)&&(i[l]=Sh(n[l],a));return i}return n}function GM(n,a){return n.data=Th(n.data,a),delete n.attachments,n}function Th(n,a){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<a.length)return a[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let i=0;i<n.length;i++)n[i]=Th(n[i],a);else if(typeof n=="object")for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=Th(n[i],a));return n}const kM=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],qM=5;var De;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(De||(De={}));class FM{constructor(a){this.replacer=a}encode(a){return(a.type===De.EVENT||a.type===De.ACK)&&lu(a)?this.encodeAsBinary({type:a.type===De.EVENT?De.BINARY_EVENT:De.BINARY_ACK,nsp:a.nsp,data:a.data,id:a.id}):[this.encodeAsString(a)]}encodeAsString(a){let i=""+a.type;return(a.type===De.BINARY_EVENT||a.type===De.BINARY_ACK)&&(i+=a.attachments+"-"),a.nsp&&a.nsp!=="/"&&(i+=a.nsp+","),a.id!=null&&(i+=a.id),a.data!=null&&(i+=JSON.stringify(a.data,this.replacer)),i}encodeAsBinary(a){const i=zM(a),l=this.encodeAsString(i.packet),o=i.buffers;return o.unshift(l),o}}function Gv(n){return Object.prototype.toString.call(n)==="[object Object]"}class dm extends vt{constructor(a){super(),this.reviver=a}add(a){let i;if(typeof a=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(a);const l=i.type===De.BINARY_EVENT;l||i.type===De.BINARY_ACK?(i.type=l?De.EVENT:De.ACK,this.reconstructor=new VM(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(fm(a)||a.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(a),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+a)}decodeString(a){let i=0;const l={type:Number(a.charAt(0))};if(De[l.type]===void 0)throw new Error("unknown packet type "+l.type);if(l.type===De.BINARY_EVENT||l.type===De.BINARY_ACK){const c=i+1;for(;a.charAt(++i)!=="-"&&i!=a.length;);const d=a.substring(c,i);if(d!=Number(d)||a.charAt(i)!=="-")throw new Error("Illegal attachments");l.attachments=Number(d)}if(a.charAt(i+1)==="/"){const c=i+1;for(;++i&&!(a.charAt(i)===","||i===a.length););l.nsp=a.substring(c,i)}else l.nsp="/";const o=a.charAt(i+1);if(o!==""&&Number(o)==o){const c=i+1;for(;++i;){const d=a.charAt(i);if(d==null||Number(d)!=d){--i;break}if(i===a.length)break}l.id=Number(a.substring(c,i+1))}if(a.charAt(++i)){const c=this.tryParse(a.substr(i));if(dm.isPayloadValid(l.type,c))l.data=c;else throw new Error("invalid payload")}return l}tryParse(a){try{return JSON.parse(a,this.reviver)}catch{return!1}}static isPayloadValid(a,i){switch(a){case De.CONNECT:return Gv(i);case De.DISCONNECT:return i===void 0;case De.CONNECT_ERROR:return typeof i=="string"||Gv(i);case De.EVENT:case De.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&kM.indexOf(i[0])===-1);case De.ACK:case De.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class VM{constructor(a){this.packet=a,this.buffers=[],this.reconPack=a}takeBinaryData(a){if(this.buffers.push(a),this.buffers.length===this.reconPack.attachments){const i=GM(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const YM=Object.freeze(Object.defineProperty({__proto__:null,Decoder:dm,Encoder:FM,get PacketType(){return De},protocol:qM},Symbol.toStringTag,{value:"Module"}));function zn(n,a,i){return n.on(a,i),function(){n.off(a,i)}}const PM=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class K_ extends vt{constructor(a,i,l){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=a,this.nsp=i,l&&l.auth&&(this.auth=l.auth),this._opts=Object.assign({},l),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const a=this.io;this.subs=[zn(a,"open",this.onopen.bind(this)),zn(a,"packet",this.onpacket.bind(this)),zn(a,"error",this.onerror.bind(this)),zn(a,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...a){return a.unshift("message"),this.emit.apply(this,a),this}emit(a,...i){var l,o,c;if(PM.hasOwnProperty(a))throw new Error('"'+a.toString()+'" is a reserved event name');if(i.unshift(a),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const d={type:De.EVENT,data:i};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const v=this.ids++,E=i.pop();this._registerAckCallback(v,E),d.id=v}const h=(o=(l=this.io.engine)===null||l===void 0?void 0:l.transport)===null||o===void 0?void 0:o.writable,m=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!h||(m?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(a,i){var l;const o=(l=this.flags.timeout)!==null&&l!==void 0?l:this._opts.ackTimeout;if(o===void 0){this.acks[a]=i;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[a];for(let h=0;h<this.sendBuffer.length;h++)this.sendBuffer[h].id===a&&this.sendBuffer.splice(h,1);i.call(this,new Error("operation has timed out"))},o),d=(...h)=>{this.io.clearTimeoutFn(c),i.apply(this,h)};d.withError=!0,this.acks[a]=d}emitWithAck(a,...i){return new Promise((l,o)=>{const c=(d,h)=>d?o(d):l(h);c.withError=!0,i.push(c),this.emit(a,...i)})}_addToQueue(a){let i;typeof a[a.length-1]=="function"&&(i=a.pop());const l={id:this._queueSeq++,tryCount:0,pending:!1,args:a,flags:Object.assign({fromQueue:!0},this.flags)};a.push((o,...c)=>l!==this._queue[0]?void 0:(o!==null?l.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(o)):(this._queue.shift(),i&&i(null,...c)),l.pending=!1,this._drainQueue())),this._queue.push(l),this._drainQueue()}_drainQueue(a=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!a||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(a){a.nsp=this.nsp,this.io._packet(a)}onopen(){typeof this.auth=="function"?this.auth(a=>{this._sendConnectPacket(a)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(a){this.packet({type:De.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},a):a})}onerror(a){this.connected||this.emitReserved("connect_error",a)}onclose(a,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",a,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(a=>{if(!this.sendBuffer.some(l=>String(l.id)===a)){const l=this.acks[a];delete this.acks[a],l.withError&&l.call(this,new Error("socket has been disconnected"))}})}onpacket(a){if(a.nsp===this.nsp)switch(a.type){case De.CONNECT:a.data&&a.data.sid?this.onconnect(a.data.sid,a.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case De.EVENT:case De.BINARY_EVENT:this.onevent(a);break;case De.ACK:case De.BINARY_ACK:this.onack(a);break;case De.DISCONNECT:this.ondisconnect();break;case De.CONNECT_ERROR:this.destroy();const l=new Error(a.data.message);l.data=a.data.data,this.emitReserved("connect_error",l);break}}onevent(a){const i=a.data||[];a.id!=null&&i.push(this.ack(a.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(a){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const l of i)l.apply(this,a)}super.emit.apply(this,a),this._pid&&a.length&&typeof a[a.length-1]=="string"&&(this._lastOffset=a[a.length-1])}ack(a){const i=this;let l=!1;return function(...o){l||(l=!0,i.packet({type:De.ACK,id:a,data:o}))}}onack(a){const i=this.acks[a.id];typeof i=="function"&&(delete this.acks[a.id],i.withError&&a.data.unshift(null),i.apply(this,a.data))}onconnect(a,i){this.id=a,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(a=>this.emitEvent(a)),this.receiveBuffer=[],this.sendBuffer.forEach(a=>{this.notifyOutgoingListeners(a),this.packet(a)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(a=>a()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:De.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(a){return this.flags.compress=a,this}get volatile(){return this.flags.volatile=!0,this}timeout(a){return this.flags.timeout=a,this}onAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(a),this}prependAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(a),this}offAny(a){if(!this._anyListeners)return this;if(a){const i=this._anyListeners;for(let l=0;l<i.length;l++)if(a===i[l])return i.splice(l,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(a),this}prependAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(a),this}offAnyOutgoing(a){if(!this._anyOutgoingListeners)return this;if(a){const i=this._anyOutgoingListeners;for(let l=0;l<i.length;l++)if(a===i[l])return i.splice(l,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(a){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const l of i)l.apply(this,a.data)}}}function Li(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}Li.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),i=Math.floor(a*this.jitter*n);n=(Math.floor(a*10)&1)==0?n-i:n+i}return Math.min(n,this.max)|0};Li.prototype.reset=function(){this.attempts=0};Li.prototype.setMin=function(n){this.ms=n};Li.prototype.setMax=function(n){this.max=n};Li.prototype.setJitter=function(n){this.jitter=n};class Ah extends vt{constructor(a,i){var l;super(),this.nsps={},this.subs=[],a&&typeof a=="object"&&(i=a,a=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,Nu(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((l=i.randomizationFactor)!==null&&l!==void 0?l:.5),this.backoff=new Li({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=a;const o=i.parser||YM;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(a){return arguments.length?(this._reconnection=!!a,a||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(a){return a===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=a,this)}reconnectionDelay(a){var i;return a===void 0?this._reconnectionDelay:(this._reconnectionDelay=a,(i=this.backoff)===null||i===void 0||i.setMin(a),this)}randomizationFactor(a){var i;return a===void 0?this._randomizationFactor:(this._randomizationFactor=a,(i=this.backoff)===null||i===void 0||i.setJitter(a),this)}reconnectionDelayMax(a){var i;return a===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=a,(i=this.backoff)===null||i===void 0||i.setMax(a),this)}timeout(a){return arguments.length?(this._timeout=a,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(a){if(~this._readyState.indexOf("open"))return this;this.engine=new LM(this.uri,this.opts);const i=this.engine,l=this;this._readyState="opening",this.skipReconnect=!1;const o=zn(i,"open",function(){l.onopen(),a&&a()}),c=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),a?a(h):this.maybeReconnectOnOpen()},d=zn(i,"error",c);if(this._timeout!==!1){const h=this._timeout,m=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),i.close()},h);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}return this.subs.push(o),this.subs.push(d),this}connect(a){return this.open(a)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const a=this.engine;this.subs.push(zn(a,"ping",this.onping.bind(this)),zn(a,"data",this.ondata.bind(this)),zn(a,"error",this.onerror.bind(this)),zn(a,"close",this.onclose.bind(this)),zn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(a){try{this.decoder.add(a)}catch(i){this.onclose("parse error",i)}}ondecoded(a){wu(()=>{this.emitReserved("packet",a)},this.setTimeoutFn)}onerror(a){this.emitReserved("error",a)}socket(a,i){let l=this.nsps[a];return l?this._autoConnect&&!l.active&&l.connect():(l=new K_(this,a,i),this.nsps[a]=l),l}_destroy(a){const i=Object.keys(this.nsps);for(const l of i)if(this.nsps[l].active)return;this._close()}_packet(a){const i=this.encoder.encode(a);for(let l=0;l<i.length;l++)this.engine.write(i[l],a.options)}cleanup(){this.subs.forEach(a=>a()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(a,i){var l;this.cleanup(),(l=this.engine)===null||l===void 0||l.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",a,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const a=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const l=this.setTimeoutFn(()=>{a.skipReconnect||(this.emitReserved("reconnect_attempt",a.backoff.attempts),!a.skipReconnect&&a.open(o=>{o?(a._reconnecting=!1,a.reconnect(),this.emitReserved("reconnect_error",o)):a.onreconnect()}))},i);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}}onreconnect(){const a=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",a)}}const Zl={};function su(n,a){typeof n=="object"&&(a=n,n=void 0),a=a||{};const i=BM(n,a.path||"/socket.io"),l=i.source,o=i.id,c=i.path,d=Zl[o]&&c in Zl[o].nsps,h=a.forceNew||a["force new connection"]||a.multiplex===!1||d;let m;return h?m=new Ah(l,a):(Zl[o]||(Zl[o]=new Ah(l,a)),m=Zl[o]),i.query&&!a.query&&(a.query=i.queryKey),m.socket(i.path,a)}Object.assign(su,{Manager:Ah,Socket:K_,io:su,connect:su});const XM=[Te.ActionTypes.MESSAGE_TO_GUEST,Te.ActionTypes.EVENT_TO_GUEST,Te.ActionTypes.TYPING_ON,Te.ActionTypes.TYPING_OFF,Te.ActionTypes.RESTART_CHAT_REQUEST,...Qx,...qO,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],ZM=({dispatch:n,getState:a})=>i=>{let l=null;return o=>{const c=i(o);if(o.type===Qh){l?.disconnect(),n(Wx());const d=`/chat?${Lh.stringify(o.querystrings)}`;l=su(`/${o.clientName}${d}`),l.on("action",n),l.on("connect",()=>n(Jx())),l.on("disconnect",()=>n(eC())),l.on("reconnect",()=>n(tC())),l.on("set-translations",(h,m)=>{n(F8({language:h,messages:H8(h,m)}))}),l.on("set-settings",h=>{n(P8(h))}),l.on("enable-conversation-rating",h=>n(XO(h))),l.on("speech-transcription",h=>n(VO(h))),l.on("restore-client-state",h=>{n($x(h.sessionId)),n(QO(h.messages))}),l.on("expand-window",({devices:h,initial:m=!1})=>{n({type:Lb,devices:h,initial:m})}),l.on("restart-chat",()=>{n(ls())}),l.on("login-success",h=>{n(kx({loginToken:h.loginToken}))})}else if(o.type==="start-screen/requestLogin")l?.emit("login-requested",o.payload);else if(o.type===xu)l?.emit("start-chat",o.payload);else if(o.type===Cu)l?.emit("terminate-session",o.payload);else if(o.type===kO)l?.emit("get-started",JSON.stringify(o));else if(o.type===Ih)l?.emit("audio-message",o.buffer);else if(o.type===Te.ActionTypes.CONVERSATION_RATING_FROM_GUEST)l?.emit("conversation-rating",o.payload);else if(o.type===Ub){const{connection:{sessionId:d}}=a();window.location.href=`/transcript-pdf/${d}`}else XM.indexOf(o.type)===-1&&o.meta===void 0&&l&&l.emit("action",JSON.stringify(o));return c}},$_=Vh(),QM={...K8($_),intl:D_},Oh=Cx({middleware:n=>n().concat(ZM),reducer:Z8,preloadedState:QM});Oh.subscribe(w8(()=>{const n=Oh.getState();$8($_,{connection:n.connection,startScreen:n.startScreen})},1e3));const KM=document.getElementById("root"),$M=pS.createRoot(KM);$M.render(y.jsx(mT,{store:Oh,children:y.jsx(x8,{})}));
131
- //# sourceMappingURL=index-oHteAZDC.js.map
131
+ //# sourceMappingURL=index-A-Y4qaOd.js.map