@botfabrik/engine-webclient 4.84.0 → 4.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/client/assets/{index-Cgu7e2D1.js → index-CXS7bgvw.js} +3 -3
- package/dist/client/assets/index-CXS7bgvw.js.map +1 -0
- package/dist/client/index.html +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/dist/client/assets/index-Cgu7e2D1.js.map +0 -1
|
@@ -94,7 +94,7 @@ For more details see https://formatjs.github.io/docs/getting-started/message-dis
|
|
|
94
94
|
`,{inline:T}));for(;typeof w[w.length-1]=="string"&&!w[w.length-1].trim();)w.pop();if(r.wrapper===null)return w;const D=r.wrapper||(T?"span":"div");let R;if(w.length>1||r.forceWrapper)R=w;else{if(w.length===1)return R=w[0],typeof R=="string"?o("span",{key:"outer"},R):R;R=null}return r.createElement(D,{key:"outer"},R)}function l(m,T){const w=T.match(JS);return w?w.reduce(function(D,R){const P=R.indexOf("=");if(P!==-1){const N=function(F){return F.indexOf("-")!==-1&&F.match(mx)===null&&(F=F.replace(Ex,function(z,W){return W.toUpperCase()})),F}(R.slice(0,P)).trim(),E=function(F){const z=F[0];return(z==='"'||z==="'")&&F.length>=2&&F[F.length-1]===z?F.slice(1,-1):F}(R.slice(P+1).trim()),C=Qm[N]||N;if(C==="ref")return D;const x=D[C]=function(F,z,W,he){return z==="style"?W.split(/;\s?/).reduce(function(te,ce){const pe=ce.slice(0,ce.indexOf(":"));return te[pe.trim().replace(/(-[a-z])/g,le=>le[1].toUpperCase())]=ce.slice(pe.length+1).trim(),te},{}):z==="href"||z==="src"?he(W,F,z):(W.match(gx)&&(W=W.slice(1,W.length-1)),W==="true"||W!=="false"&&W)}(m,N,E,r.sanitizer);typeof x=="string"&&(jc.test(x)||Uc.test(x))&&(D[C]=s(x.trim()))}else R!=="style"&&(D[Qm[R]||R]=!0);return D},{}):null}r.overrides=r.overrides||{},r.sanitizer=r.sanitizer||Qx,r.slugify=r.slugify||Wo,r.namedCodesToUnicode=r.namedCodesToUnicode?_r({},Xm,r.namedCodesToUnicode):Xm,r.createElement=r.createElement||B.createElement;const u=[],f={},h={[ie.blockQuote]:{match:Sn(hy),order:1,parse(m,T,w){const[,D,R]=m[0].replace(nx,"").match(rx);return{alert:D,children:T(R,w)}},render(m,T,w){const D={key:w.key};return m.alert&&(D.className="markdown-alert-"+r.slugify(m.alert.toLowerCase(),Wo),m.children.unshift({attrs:{},children:[{type:ie.text,text:m.alert}],noInnerParse:!0,type:ie.htmlBlock,tag:"header"})),o("blockquote",D,T(m.children,w))}},[ie.breakLine]:{match:Ko(ox),order:1,parse:zu,render:(m,T,w)=>o("br",{key:w.key})},[ie.breakThematic]:{match:Sn(ix),order:1,parse:zu,render:(m,T,w)=>o("hr",{key:w.key})},[ie.codeBlock]:{match:Sn(my),order:0,parse:m=>({lang:void 0,text:ri(m[0].replace(/^ {4}/gm,"")).replace(Uu,"$1")}),render:(m,T,w)=>o("pre",{key:w.key},o("code",_r({},m.attrs,{className:m.lang?`lang-${m.lang}`:""}),m.text))},[ie.codeFenced]:{match:Sn(py),order:0,parse:m=>({attrs:l("code",m[3]||""),lang:m[2]||void 0,text:m[4].replace(Uu,"$1"),type:ie.codeBlock})},[ie.codeInline]:{match:Qn(sx),order:3,parse:m=>({text:m[2].replace(Uu,"$1")}),render:(m,T,w)=>o("code",{key:w.key},m.text)},[ie.footnote]:{match:Sn(ux),order:0,parse:m=>(u.push({footnote:m[2],identifier:m[1]}),{}),render:Gu},[ie.footnoteReference]:{match:Zn(cx),order:1,parse:m=>({target:`#${r.slugify(m[1],Wo)}`,text:m[1]}),render:(m,T,w)=>o("a",{key:w.key,href:r.sanitizer(m.target,"a","href")},o("sup",{key:w.key},m.text))},[ie.gfmTask]:{match:Zn(hx),order:1,parse:m=>({completed:m[1].toLowerCase()==="x"}),render:(m,T,w)=>o("input",{checked:m.completed,key:w.key,readOnly:!0,type:"checkbox"})},[ie.heading]:{match:Sn(r.enforceAtxHeadings?yy:gy),order:1,parse:(m,T,w)=>({children:Ks(T,m[2],w),id:r.slugify(m[2],Wo),level:m[1].length}),render:(m,T,w)=>o(`h${m.level}`,{id:m.id,key:w.key},T(m.children,w))},[ie.headingSetext]:{match:Sn(vy),order:0,parse:(m,T,w)=>({children:Ks(T,m[1],w),level:m[2]==="="?1:2,type:ie.heading})},[ie.htmlBlock]:{match:Ko(jc),order:1,parse(m,T,w){const[,D]=m[3].match(Lx),R=new RegExp(`^${D}`,"gm"),P=m[3].replace(R,""),N=(E=P,qx.some(W=>W.test(E))?Yx:Ks);var E;const C=m[1].toLowerCase(),x=YS.indexOf(C)!==-1,F=(x?C:m[1]).trim(),z={attrs:l(F,m[2]),noInnerParse:x,tag:F};return w.inAnchor=w.inAnchor||C==="a",x?z.text=m[3]:z.children=N(T,P,w),w.inAnchor=!1,z},render:(m,T,w)=>o(m.tag,_r({key:w.key},m.attrs),m.text||(m.children?T(m.children,w):""))},[ie.htmlSelfClosing]:{match:Ko(Uc),order:1,parse(m){const T=m[1].trim();return{attrs:l(T,m[2]||""),tag:T}},render:(m,T,w)=>o(m.tag,_r({},m.attrs,{key:w.key}))},[ie.htmlComment]:{match:Ko(_y),order:1,parse:()=>({}),render:Gu},[ie.image]:{match:Qn(Vx),order:1,parse:m=>({alt:m[1],target:tg(m[2]),title:m[3]}),render:(m,T,w)=>o("img",{key:w.key,alt:m.alt||void 0,title:m.title||void 0,src:r.sanitizer(m.target,"img","src")})},[ie.link]:{match:Zn($x),order:3,parse:(m,T,w)=>({children:Xx(T,m[1],w),target:tg(m[2]),title:m[3]}),render:(m,T,w)=>o("a",{key:w.key,href:r.sanitizer(m.target,"a","href"),title:m.title},T(m.children,w))},[ie.linkAngleBraceStyleDetector]:{match:Zn(_x),order:0,parse:m=>({children:[{text:m[1],type:ie.text}],target:m[1],type:ie.link})},[ie.linkBareUrlDetector]:{match:Yr((m,T)=>T.inAnchor||r.disableAutoLink?null:Zn(yx)(m,T)),order:0,parse:m=>({children:[{text:m[1],type:ie.text}],target:m[1],title:void 0,type:ie.link})},[ie.linkMailtoDetector]:{match:Zn(vx),order:0,parse(m){let T=m[1],w=m[1];return ex.test(w)||(w="mailto:"+w),{children:[{text:T.replace("mailto:",""),type:ie.text}],target:w,type:ie.link}}},[ie.orderedList]:Ym(o,1),[ie.unorderedList]:Ym(o,2),[ie.newlineCoalescer]:{match:Sn(ax),order:3,parse:zu,render:()=>`
|
|
95
95
|
`},[ie.paragraph]:{match:Yr(Zx),order:3,parse:Hu,render:(m,T,w)=>o("p",{key:w.key},T(m.children,w))},[ie.ref]:{match:Zn(wx),order:0,parse:m=>(f[m[1]]={target:m[2],title:m[4]},{}),render:Gu},[ie.refImage]:{match:Qn(bx),order:0,parse:m=>({alt:m[1]||void 0,ref:m[2]}),render:(m,T,w)=>f[m.ref]?o("img",{key:w.key,alt:m.alt,src:r.sanitizer(f[m.ref].target,"img","src"),title:f[m.ref].title}):null},[ie.refLink]:{match:Zn(Sx),order:0,parse:(m,T,w)=>({children:T(m[1],w),fallbackChildren:m[0],ref:m[2]}),render:(m,T,w)=>f[m.ref]?o("a",{key:w.key,href:r.sanitizer(f[m.ref].target,"a","href"),title:f[m.ref].title},T(m.children,w)):o("span",{key:w.key},m.fallbackChildren)},[ie.table]:{match:Sn(Ey),order:1,parse:Kx,render(m,T,w){const D=m;return o("table",{key:w.key},o("thead",null,o("tr",null,D.header.map(function(R,P){return o("th",{key:P,style:eg(D,P)},T(R,w))}))),o("tbody",null,D.cells.map(function(R,P){return o("tr",{key:P},R.map(function(N,E){return o("td",{key:E,style:eg(D,E)},T(N,w))}))})))}},[ie.text]:{match:Ko(Mx),order:4,parse:m=>({text:m[0].replace(px,(T,w)=>r.namedCodesToUnicode[w]?r.namedCodesToUnicode[w]:T)}),render:m=>m.text},[ie.textBolded]:{match:Qn(Nx),order:2,parse:(m,T,w)=>({children:T(m[2],w)}),render:(m,T,w)=>o("strong",{key:w.key},T(m.children,w))},[ie.textEmphasized]:{match:Qn(Ax),order:3,parse:(m,T,w)=>({children:T(m[2],w)}),render:(m,T,w)=>o("em",{key:w.key},T(m.children,w))},[ie.textEscaped]:{match:Qn(Px),order:1,parse:m=>({text:m[1],type:ie.text})},[ie.textMarked]:{match:Qn(Ix),order:3,parse:Hu,render:(m,T,w)=>o("mark",{key:w.key},T(m.children,w))},[ie.textStrikethroughed]:{match:Qn(Dx),order:3,parse:Hu,render:(m,T,w)=>o("del",{key:w.key},T(m.children,w))}};r.disableParsingRawHTML===!0&&(delete h[ie.htmlBlock],delete h[ie.htmlSelfClosing]);const p=function(m){let T=Object.keys(m);function w(D,R){let P,N,E=[],C="",x="";for(R.prevCapture=R.prevCapture||"";D;){let F=0;for(;F<T.length;){if(C=T[F],P=m[C],R.inline&&!P.match.inline){F++;continue}const z=P.match(D,R);if(z){x=z[0],R.prevCapture+=x,D=D.substring(x.length),N=P.parse(z,w,R),N.type==null&&(N.type=C),E.push(N);break}F++}}return R.prevCapture="",E}return T.sort(function(D,R){let P=m[D].order,N=m[R].order;return P!==N?P-N:D<R?-1:1}),function(D,R){return w(function(P){return P.replace(lx,`
|
|
96
96
|
`).replace(fx,"").replace(Tx," ")}(D),R)}}(h),v=(_=function(m,T){return function(w,D,R){const P=m[w.type].render;return T?T(()=>P(w,D,R),w,D,R):P(w,D,R)}}(h,r.renderRule),function m(T,w={}){if(Array.isArray(T)){const D=w.key,R=[];let P=!1;for(let N=0;N<T.length;N++){w.key=N;const E=m(T[N],w),C=typeof E=="string";C&&P?R[R.length-1]+=E:E!==null&&R.push(E),P=C}return w.key=D,R}return _(T,m,w)});var _;const b=s(e);return u.length?o("div",null,b,o("footer",{key:"footer"},u.map(function(m){return o("div",{id:r.slugify(m.identifier,Wo),key:m.identifier},m.identifier,v(p(m.footnote,{inline:!0})))}))):b}const cn=e=>{let{children:r="",options:o}=e,s=function(l,u){if(l==null)return{};var f,h,p={},v=Object.keys(l);for(h=0;h<v.length;h++)u.indexOf(f=v[h])>=0||(p[f]=l[f]);return p}(e,XS);return B.cloneElement(e2(r,o),s)},t2="_generalConditionsContainer_55hjg_1",n2="_generalConditions_55hjg_1",r2="_generalConditionsHeader_55hjg_15",o2="_generalConditionsBody_55hjg_26",i2="_generalConditionsAccept_55hjg_35",Zo={generalConditionsContainer:t2,generalConditions:n2,generalConditionsHeader:r2,generalConditionsBody:o2,generalConditionsAccept:i2},s2=()=>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"})}),a2=()=>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"})}),l2="general-conditions.header",u2="general-conditions.body",ng="general-conditions.accept-conditions-note",c2=()=>{const e=Ke(),[r,o]=B.useState(!1),s=()=>o(!r),l=h=>{h.key==="ArrowDown"||h.key==="ArrowRight"?o(!0):h.key==="ArrowUp"||h.key==="ArrowLeft"||h.key==="Escape"?o(!1):(h.key==="Enter"||h.key==="Space"||h.key===" ")&&s()},u=e(l2),f=e(ng);return y.jsxs("div",{className:V(Zo.generalConditionsContainer,"chat__generalConditions"),children:[!!(u!=null&&u.length)&&y.jsxs("div",{className:Zo.generalConditions,children:[y.jsxs("div",{role:"button",onClick:s,onKeyDown:l,tabIndex:0,className:V(Zo.generalConditionsHeader,"chat__generalConditions__header"),"aria-controls":"general-conditions-body","aria-expanded":r?"true":"false","aria-pressed":r?"true":"false",children:[y.jsx(cn,{children:u}),r?y.jsx(a2,{}):y.jsx(s2,{})]}),y.jsx("div",{className:V(Zo.generalConditionsBody,"chat__generalConditions__body"),id:"general-conditions-body",role:"region",tabIndex:-1,children:r&&y.jsx(cn,{children:e(u2)||""})})]}),!!(f!=null&&f.length)&&y.jsx("div",{className:V(Zo.generalConditionsAccept,"chat__generalConditions__accept"),tabIndex:0,children:y.jsx(cn,{children:e(ng)||""})})]})},f2="_message_1qom7_1",d2="_messageBot_1qom7_9",h2="_messageBotLast_1qom7_19",p2="_avatar_1qom7_19",m2="_messageBotFirst_1qom7_24",g2="_messageBotAnimated_1qom7_37",y2="_messageGuest_1qom7_48",v2="_messageGuestFirst_1qom7_54",_2="_messageGuestLast_1qom7_60",E2="_botAvatar_1qom7_74",w2="_agentAvatar_1qom7_78",b2="_bubble_1qom7_82",S2="_bubbleContent_1qom7_88",x2="_bubbleLeft_1qom7_102",T2="_leftText_1qom7_113",C2="_bubbleRight_1qom7_120",k2="_rightText_1qom7_130",R2="_sourceInfoReference_1qom7_162",fe={message:f2,messageBot:d2,messageBotLast:h2,avatar:p2,messageBotFirst:m2,messageBotAnimated:g2,messageGuest:y2,messageGuestFirst:v2,messageGuestLast:_2,botAvatar:E2,agentAvatar:w2,bubble:b2,bubbleContent:S2,bubbleLeft:x2,leftText:T2,bubbleRight:C2,rightText:k2,sourceInfoReference:R2},O2="_botMessageActions_1dl7x_1",N2="_alwaysVisible_1dl7x_22",A2="_reported_1dl7x_29",I2="_action_1dl7x_33",Xn={botMessageActions:O2,alwaysVisible:N2,reported:A2,action:I2},D2=({alwaysVisible:e,reaction:r,botMessageRef:o,onReaction:s})=>{const l=Ke(),[u,f]=B.useState(!1),h=v=>()=>s(v),p=B.useCallback(async()=>{if(o.current)try{f(!0);const v=o.current.innerHTML,_=o.current.innerText;await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([v],{type:"text/html"}),"text/plain":new Blob([_],{type:"text/plain"})})]),await new Promise(b=>setTimeout(b,1500))}finally{f(!1)}},[o]);return y.jsxs("div",{className:V(Xn.botMessageActions,e&&Xn.alwaysVisible,r&&Xn.reported),children:[y.jsx("button",{className:V(Xn.action,r==="GOOD"&&Xn.reported,"tooltip--right"),tabIndex:0,"aria-label":l(r==="GOOD"?"bot-bubble.reaction.remove":"bot-bubble.reaction.good"),"data-title":l(r==="GOOD"?"bot-bubble.reaction.remove":"bot-bubble.reaction.good"),onClick:h(r==="GOOD"?null:"GOOD"),children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:r==="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"})})}),y.jsx("button",{className:V(Xn.action,r==="BAD"&&Xn.reported,"tooltip--right"),tabIndex:0,"aria-label":l(r==="BAD"?"bot-bubble.reaction.remove":"bot-bubble.reaction.bad"),"data-title":l(r==="BAD"?"bot-bubble.reaction.remove":"bot-bubble.reaction.bad"),onClick:h(r==="BAD"?null:"BAD"),children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:r==="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:V(Xn.action,"tooltip--right"),tabIndex:0,"aria-label":l("bot-bubble.copy"),"data-title":l("bot-bubble.copy"),onClick:p,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:u?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"})})})]})},Ny=B.forwardRef(({message:e,isAnimated:r,isLastMessage:o,isFirstMessageBySender:s,isLastMessageBySender:l,children:u,onReaction:f},h)=>{const p=Ke(),v=B.useRef(null),_=e.sender.type===ge.UserType.BOT;return y.jsxs("li",{ref:h,className:V(fe.message,fe.messageBot,o&&fe.lastMessage,s&&fe.messageBotFirst,l&&fe.messageBotLast,"chat__bubbleContainer",r&&fe.messageBotAnimated,r&&"chat__bubbleContainer--animated",_?"chat__botBubbleContainer":"chat__agentBubbleContainer",s&&"chat__bubbleContainer--first",l&&"chat__bubbleContainer--last"),children:[y.jsx("img",{className:V(fe.avatar,_?fe.botAvatar:fe.agentAvatar,"chat__avatar",_?"chat__botAvatar":"chat__agentAvatar"),src:`${e.sender.avatar}`,alt:_?"Bot":"Agent",referrerPolicy:"no-referrer"}),y.jsx("div",{ref:v,className:V(fe.bubble,fe.bubbleLeft,"chat__bubble",_?"chat__botBubble":"chat__agentBubble"),tabIndex:0,"aria-label":p(_?"bot-bubble.label":"agent-bubble.label"),children:y.jsx("div",{className:V(fe.leftText),children:u})}),f&&y.jsx(D2,{alwaysVisible:o&&l,reaction:e.reaction,botMessageRef:v,onReaction:f})]})}),P2="_sourceList_1p11n_1",M2="_source_1p11n_1",F2="_label_1p11n_36",Vu={sourceList:P2,source:M2,label:F2},Ay=e=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,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"})}),Iy=e=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,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"})}),Dy=e=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,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"})}),Py=e=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,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"})}),L2=({type:e,...r})=>{switch(e){case"WEBSITE":return y.jsx(Py,{...r});case"PDF":return y.jsx(Dy,{...r});case"DOCX":return y.jsx(Ay,{...r});default:return y.jsx(Iy,{...r})}},Sf=({sources:e,onLinkClick:r})=>{const o=Ke(),s=u=>()=>{r(u.url)},l=u=>f=>{(f.key==="Enter"||f.key===" ")&&r(u.url)};return e.length?y.jsx("ul",{className:Vu.sourceList,"aria-label":o("bot-bubble.sources"),children:e.map(u=>y.jsx("li",{className:Vu.source,children:y.jsxs("a",{role:"button",tabIndex:0,"aria-label":`${o("bot-bubble.source.open")}: ${u.label}`,onClick:s(u),onKeyDown:l(u),children:[y.jsx(L2,{type:u.type,"aria-hidden":"true"}),y.jsx("div",{className:Vu.label,children:u.label})]})},u.url))}):null},B2="_button_3ui4g_1",j2="_buttonDefault_3ui4g_13",U2="_buttonPrimary_3ui4g_28",oi={button:B2,buttonDefault:j2,buttonPrimary:U2},va=({className:e,children:r,...o})=>y.jsx("button",{className:V(oi.button,e),type:"button",...o,children:r}),H2="_title_b904h_1",z2="_subtitle_b904h_6",G2="_buttons_b904h_11",$2="_button_b904h_11",V2="_imageContainer_b904h_34",q2="_image_b904h_34",W2="_video_container_b904h_49",K2="_video_b904h_49",Z2="_only_b904h_63",wt={title:H2,subtitle:z2,buttons:G2,button:$2,imageContainer:V2,image:q2,video_container:W2,video:K2,only:Z2},Q2=({buttons:e,onButtonClick:r})=>y.jsx("div",{className:V(wt.buttons,"chat__bubbleButtons"),children:e.map((o,s)=>y.jsx(va,{className:V(wt.button,"chat__bubbleButton"),onClick:()=>r(o),children:o.title},s))});var Fs={},Ls={},Bs={},rg;function X2(){if(rg)return Bs;rg=1,Object.defineProperty(Bs,"__esModule",{value:!0});var e=Jr(),r=o(e);function o(s){if(s&&s.__esModule)return s;var l={};if(s!=null)for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(l[u]=s[u]);return l.default=s,l}return Bs.default=function(s,l,u){return r.createElement("a",{href:s,key:u},l)},Bs}var js={},og;function Y2(){return og||(og=1,Object.defineProperty(js,"__esModule",{value:!0}),js.default=function(e){return e}),js}var Us={},qu,ig;function J2(){return ig||(ig=1,qu=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),qu}var Wu,sg;function eT(){return sg||(sg=1,Wu=/[\0-\x1F\x7F-\x9F]/),Wu}var Ku,ag;function tT(){return ag||(ag=1,Ku=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),Ku}var Zu,lg;function nT(){return lg||(lg=1,Zu=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),Zu}var Qu,ug;function rT(){return ug||(ug=1,Qu=function(e){var r={};r.src_Any=J2().source,r.src_Cc=eT().source,r.src_Z=tT().source,r.src_P=nT().source,r.src_ZPCc=[r.src_Z,r.src_P,r.src_Cc].join("|"),r.src_ZCc=[r.src_Z,r.src_Cc].join("|");var o="[><|]";return r.src_pseudo_letter="(?:(?!"+o+"|"+r.src_ZPCc+")"+r.src_Any+")",r.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",r.src_auth="(?:(?:(?!"+r.src_ZCc+"|[@/\\[\\]()]).)+@)?",r.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",r.src_host_terminator="(?=$|"+o+"|"+r.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+r.src_ZPCc+"))",r.src_path="(?:[/?#](?:(?!"+r.src_ZCc+"|"+o+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+r.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+r.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+r.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+r.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+r.src_ZCc+"|[']).)+\\'|\\'(?="+r.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+r.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+r.src_ZCc+").|\\!(?!"+r.src_ZCc+"|[!]).|\\?(?!"+r.src_ZCc+"|[?]).)+|\\/)?",r.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',r.src_xn="xn--[a-z0-9\\-]{1,59}",r.src_domain_root="(?:"+r.src_xn+"|"+r.src_pseudo_letter+"{1,63})",r.src_domain="(?:"+r.src_xn+"|(?:"+r.src_pseudo_letter+")|(?:"+r.src_pseudo_letter+"(?:-|"+r.src_pseudo_letter+"){0,61}"+r.src_pseudo_letter+"))",r.src_host="(?:(?:(?:(?:"+r.src_domain+")\\.)*"+r.src_domain+"))",r.tpl_host_fuzzy="(?:"+r.src_ip4+"|(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%)))",r.tpl_host_no_ip_fuzzy="(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%))",r.src_host_strict=r.src_host+r.src_host_terminator,r.tpl_host_fuzzy_strict=r.tpl_host_fuzzy+r.src_host_terminator,r.src_host_port_strict=r.src_host+r.src_port+r.src_host_terminator,r.tpl_host_port_fuzzy_strict=r.tpl_host_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_port_no_ip_fuzzy_strict=r.tpl_host_no_ip_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+r.src_ZPCc+"|>|$))",r.tpl_email_fuzzy="(^|"+o+'|"|\\(|'+r.src_ZCc+")("+r.src_email_name+"@"+r.tpl_host_fuzzy_strict+")",r.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+r.src_ZPCc+"))((?![$+<=>^`||])"+r.tpl_host_port_fuzzy_strict+r.src_path+")",r.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+r.src_ZPCc+"))((?![$+<=>^`||])"+r.tpl_host_port_no_ip_fuzzy_strict+r.src_path+")",r}),Qu}var Xu,cg;function oT(){if(cg)return Xu;cg=1;function e(E){var C=Array.prototype.slice.call(arguments,1);return C.forEach(function(x){x&&Object.keys(x).forEach(function(F){E[F]=x[F]})}),E}function r(E){return Object.prototype.toString.call(E)}function o(E){return r(E)==="[object String]"}function s(E){return r(E)==="[object Object]"}function l(E){return r(E)==="[object RegExp]"}function u(E){return r(E)==="[object Function]"}function f(E){return E.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var h={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function p(E){return Object.keys(E||{}).reduce(function(C,x){return C||h.hasOwnProperty(x)},!1)}var v={"http:":{validate:function(E,C,x){var F=E.slice(C);return x.re.http||(x.re.http=new RegExp("^\\/\\/"+x.re.src_auth+x.re.src_host_port_strict+x.re.src_path,"i")),x.re.http.test(F)?F.match(x.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(E,C,x){var F=E.slice(C);return x.re.no_http||(x.re.no_http=new RegExp("^"+x.re.src_auth+"(?:localhost|(?:(?:"+x.re.src_domain+")\\.)+"+x.re.src_domain_root+")"+x.re.src_port+x.re.src_host_terminator+x.re.src_path,"i")),x.re.no_http.test(F)?C>=3&&E[C-3]===":"||C>=3&&E[C-3]==="/"?0:F.match(x.re.no_http)[0].length:0}},"mailto:":{validate:function(E,C,x){var F=E.slice(C);return x.re.mailto||(x.re.mailto=new RegExp("^"+x.re.src_email_name+"@"+x.re.src_host_strict,"i")),x.re.mailto.test(F)?F.match(x.re.mailto)[0].length:0}}},_="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",b="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function m(E){E.__index__=-1,E.__text_cache__=""}function T(E){return function(C,x){var F=C.slice(x);return E.test(F)?F.match(E)[0].length:0}}function w(){return function(E,C){C.normalize(E)}}function D(E){var C=E.re=rT()(E.__opts__),x=E.__tlds__.slice();E.onCompile(),E.__tlds_replaced__||x.push(_),x.push(C.src_xn),C.src_tlds=x.join("|");function F(te){return te.replace("%TLDS%",C.src_tlds)}C.email_fuzzy=RegExp(F(C.tpl_email_fuzzy),"i"),C.link_fuzzy=RegExp(F(C.tpl_link_fuzzy),"i"),C.link_no_ip_fuzzy=RegExp(F(C.tpl_link_no_ip_fuzzy),"i"),C.host_fuzzy_test=RegExp(F(C.tpl_host_fuzzy_test),"i");var z=[];E.__compiled__={};function W(te,ce){throw new Error('(LinkifyIt) Invalid schema "'+te+'": '+ce)}Object.keys(E.__schemas__).forEach(function(te){var ce=E.__schemas__[te];if(ce!==null){var pe={validate:null,link:null};if(E.__compiled__[te]=pe,s(ce)){l(ce.validate)?pe.validate=T(ce.validate):u(ce.validate)?pe.validate=ce.validate:W(te,ce),u(ce.normalize)?pe.normalize=ce.normalize:ce.normalize?W(te,ce):pe.normalize=w();return}if(o(ce)){z.push(te);return}W(te,ce)}}),z.forEach(function(te){E.__compiled__[E.__schemas__[te]]&&(E.__compiled__[te].validate=E.__compiled__[E.__schemas__[te]].validate,E.__compiled__[te].normalize=E.__compiled__[E.__schemas__[te]].normalize)}),E.__compiled__[""]={validate:null,normalize:w()};var he=Object.keys(E.__compiled__).filter(function(te){return te.length>0&&E.__compiled__[te]}).map(f).join("|");E.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+C.src_ZPCc+"))("+he+")","i"),E.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+C.src_ZPCc+"))("+he+")","ig"),E.re.pretest=RegExp("("+E.re.schema_test.source+")|("+E.re.host_fuzzy_test.source+")|@","i"),m(E)}function R(E,C){var x=E.__index__,F=E.__last_index__,z=E.__text_cache__.slice(x,F);this.schema=E.__schema__.toLowerCase(),this.index=x+C,this.lastIndex=F+C,this.raw=z,this.text=z,this.url=z}function P(E,C){var x=new R(E,C);return E.__compiled__[x.schema].normalize(x,E),x}function N(E,C){if(!(this instanceof N))return new N(E,C);C||p(E)&&(C=E,E={}),this.__opts__=e({},h,C),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=e({},v,E),this.__compiled__={},this.__tlds__=b,this.__tlds_replaced__=!1,this.re={},D(this)}return N.prototype.add=function(C,x){return this.__schemas__[C]=x,D(this),this},N.prototype.set=function(C){return this.__opts__=e(this.__opts__,C),this},N.prototype.test=function(C){if(this.__text_cache__=C,this.__index__=-1,!C.length)return!1;var x,F,z,W,he,te,ce,pe,le;if(this.re.schema_test.test(C)){for(ce=this.re.schema_search,ce.lastIndex=0;(x=ce.exec(C))!==null;)if(W=this.testSchemaAt(C,x[2],ce.lastIndex),W){this.__schema__=x[2],this.__index__=x.index+x[1].length,this.__last_index__=x.index+x[0].length+W;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(pe=C.search(this.re.host_fuzzy_test),pe>=0&&(this.__index__<0||pe<this.__index__)&&(F=C.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(he=F.index+F[1].length,(this.__index__<0||he<this.__index__)&&(this.__schema__="",this.__index__=he,this.__last_index__=F.index+F[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(le=C.indexOf("@"),le>=0&&(z=C.match(this.re.email_fuzzy))!==null&&(he=z.index+z[1].length,te=z.index+z[0].length,(this.__index__<0||he<this.__index__||he===this.__index__&&te>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=he,this.__last_index__=te))),this.__index__>=0},N.prototype.pretest=function(C){return this.re.pretest.test(C)},N.prototype.testSchemaAt=function(C,x,F){return this.__compiled__[x.toLowerCase()]?this.__compiled__[x.toLowerCase()].validate(C,F,this):0},N.prototype.match=function(C){var x=0,F=[];this.__index__>=0&&this.__text_cache__===C&&(F.push(P(this,x)),x=this.__last_index__);for(var z=x?C.slice(x):C;this.test(z);)F.push(P(this,x)),z=z.slice(this.__last_index__),x+=this.__last_index__;return F.length?F:null},N.prototype.tlds=function(C,x){return C=Array.isArray(C)?C:[C],x?(this.__tlds__=this.__tlds__.concat(C).sort().filter(function(F,z,W){return F!==W[z-1]}).reverse(),D(this),this):(this.__tlds__=C.slice(),this.__tlds_replaced__=!0,D(this),this)},N.prototype.normalize=function(C){C.schema||(C.url="http://"+C.url),C.schema==="mailto:"&&!/^mailto:/i.test(C.url)&&(C.url="mailto:"+C.url)},N.prototype.onCompile=function(){},Xu=N,Xu}const iT=JSON.parse('["aaa","aarp","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","actor","ad","ads","adult","ae","aeg","aero","aetna","af","afl","africa","ag","agakhan","agency","ai","aig","airbus","airforce","airtel","akdn","al","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","amazon","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","casa","case","cash","casino","cat","catering","catholic","cba","cbn","cbre","cc","cd","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","charity","chase","chat","cheap","chintai","christmas","chrome","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cool","coop","corsica","country","coupon","coupons","courses","cpa","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dog","domains","dot","download","drive","dtv","dubai","dunlop","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epson","equipment","er","ericsson","erni","es","esq","estate","et","eu","eurovision","eus","events","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontier","ftr","fujitsu","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gay","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","horse","hospital","host","hosting","hot","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","inc","industries","infiniti","info","ing","ink","institute","insurance","insure","int","international","intuit","investments","io","ipiranga","iq","ir","irish","is","ismaili","ist","istanbul","it","itau","itv","jaguar","java","jcb","je","jeep","jetzt","jewelry","jio","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerryproperties","kfh","kg","kh","ki","kia","kids","kim","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","lamborghini","lamer","lancaster","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","link","live","living","lk","llc","llp","loan","loans","locker","locus","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","luxe","luxury","lv","ly","ma","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","merckmsd","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","moda","moe","moi","mom","monash","money","monster","mormon","mortgage","moscow","moto","motorcycles","mov","movie","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","music","mv","mw","mx","my","mz","na","nab","nagoya","name","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","office","okinawa","olayan","olayangroup","ollo","om","omega","one","ong","onl","online","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","paris","pars","partners","parts","party","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","racing","radio","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","ril","rio","rip","ro","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sarl","sas","save","saxo","sb","sbi","sbs","sc","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scot","sd","se","search","seat","secure","security","seek","select","sener","services","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shell","shia","shiksha","shoes","shop","shopping","shouji","show","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","spa","space","sport","spot","sr","srl","ss","st","stada","staples","star","statebank","statefarm","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiss","sx","sy","sydney","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","vermögensberater","vermögensberatung","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","viva","vivo","vlaanderen","vn","vodka","volvo","vote","voting","voto","voyage","vu","wales","walmart","walter","wang","wanggou","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xihuan","xin","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zm","zone","zuerich","zw","ελ","ευ","бг","бел","дети","ею","католик","ком","мкд","мон","москва","онлайн","орг","рус","рф","сайт","срб","укр","қаз","հայ","ישראל","קום","ابوظبي","ارامكو","الاردن","البحرين","الجزائر","السعودية","العليان","المغرب","امارات","ایران","بارت","بازار","بيتك","بھارت","تونس","سودان","سورية","شبكة","عراق","عرب","عمان","فلسطين","قطر","كاثوليك","كوم","مصر","مليسيا","موريتانيا","موقع","همراه","پاکستان","ڀارت","कॉम","नेट","भारत","भारतम्","भारोत","संगठन","বাংলা","ভারত","ভাৰত","ਭਾਰਤ","ભારત","ଭାରତ","இந்தியா","இலங்கை","சிங்கப்பூர்","భారత్","ಭಾರತ","ഭാരതം","ලංකා","คอม","ไทย","ລາວ","გე","みんな","アマゾン","クラウド","グーグル","コム","ストア","セール","ファッション","ポイント","世界","中信","中国","中國","中文网","亚马逊","企业","佛山","信息","健康","八卦","公司","公益","台湾","台灣","商城","商店","商标","嘉里","嘉里大酒店","在线","大拿","天主教","娱乐","家電","广东","微博","慈善","我爱你","手机","招聘","政务","政府","新加坡","新闻","时尚","書籍","机构","淡马锡","游戏","澳門","点看","移动","组织机构","网址","网店","网站","网络","联通","谷歌","购物","通販","集团","電訊盈科","飞利浦","食品","餐厅","香格里拉","香港","닷넷","닷컴","삼성","한국"]');var fg;function sT(){if(fg)return Us;fg=1,Object.defineProperty(Us,"__esModule",{value:!0});var e=oT(),r=l(e),o=iT,s=l(o);function l(f){return f&&f.__esModule?f:{default:f}}var u=new r.default;return u.tlds(s.default),Us.default=function(f){return u.match(f)},Us}var Hs={},dg;function aT(){return dg||(dg=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.default=function(e){return e}),Hs}var hg;function lT(){if(hg)return Ls;hg=1,Object.defineProperty(Ls,"__esModule",{value:!0});var e=function(){function P(N,E){for(var C=0;C<E.length;C++){var x=E[C];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(N,x.key,x)}}return function(N,E,C){return E&&P(N.prototype,E),C&&P(N,C),N}}(),r=Jr(),o=m(r),s=X2(),l=b(s),u=Y2(),f=b(u),h=sT(),p=b(h),v=aT(),_=b(v);function b(P){return P&&P.__esModule?P:{default:P}}function m(P){if(P&&P.__esModule)return P;var N={};if(P!=null)for(var E in P)Object.prototype.hasOwnProperty.call(P,E)&&(N[E]=P[E]);return N.default=P,N}function T(P,N){if(!(P instanceof N))throw new TypeError("Cannot call a class as a function")}function w(P,N){if(!P)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return N&&(typeof N=="object"||typeof N=="function")?N:P}function D(P,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);P.prototype=Object.create(N&&N.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(P,N):P.__proto__=N)}var R=function(P){D(N,P);function N(){return T(this,N),w(this,(N.__proto__||Object.getPrototypeOf(N)).apply(this,arguments))}return e(N,[{key:"parseString",value:function(C){var x=this;if(C==="")return C;var F=this.props.matchDecorator(C);if(!F)return C;var z=[],W=0;return F.forEach(function(he,te){he.index>W&&z.push(C.substring(W,he.index));var ce=x.props.hrefDecorator(he.url),pe=x.props.textDecorator(he.text),le=x.props.componentDecorator(ce,pe,te);z.push(le),W=he.lastIndex}),C.length>W&&z.push(C.substring(W)),z.length===1?z[0]:z}},{key:"parse",value:function(C){var x=this,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof C=="string"?this.parseString(C):o.isValidElement(C)&&C.type!=="a"&&C.type!=="button"?o.cloneElement(C,{key:F},this.parse(C.props.children)):Array.isArray(C)?C.map(function(z,W){return x.parse(z,W)}):C}},{key:"render",value:function(){return o.createElement(o.Fragment,null,this.parse(this.props.children))}}]),N}(o.Component);return R.defaultProps={componentDecorator:l.default,hrefDecorator:f.default,matchDecorator:p.default,textDecorator:_.default},Ls.default=R,Ls}var pg;function uT(){if(pg)return Fs;pg=1,Object.defineProperty(Fs,"__esModule",{value:!0});var e=lT(),r=o(e);function o(s){return s&&s.__esModule?s:{default:s}}return Fs.default=r.default,Fs}var cT=uT();const fT=sa(cT),dT="_text_gp0s0_1",hT="_command_gp0s0_5",mg={text:dT,command:hT},My=({text:e,commands:r=[],onLinkClick:o})=>{const s=h=>p=>(p.preventDefault(),h&&o(h),!1),l=(h,p,v)=>y.jsx("a",{onClick:s(h),role:"button",children:p},v),u=r.find(h=>e.startsWith(`/${h}`)),f=u?e.slice(u.length+1):e;return y.jsxs("div",{children:[u&&y.jsxs("code",{className:mg.command,children:["/",u]}),f.split(`
|
|
97
|
-
`).map((h,p)=>y.jsxs("span",{className:mg.text,children:[y.jsx(fT,{componentDecorator:l,children:h}),y.jsx("br",{})]},p))]})},pT=({subtitle:e,onLinkClick:r})=>e?y.jsx("div",{className:wt.subtitle,children:y.jsx(My,{text:e,onLinkClick:r})}):null,gg="newtab#",Fy=({markdown:e,markdownOptions:r={},onLinkClick:o})=>{const s=u=>f=>(f.preventDefault(),u&&o(u),!1),l=({title:u,href:f,children:h})=>f.indexOf(gg)===0?y.jsx("a",{href:f.slice(gg.length),title:u,target:"_blank",rel:"noopener noreferrer",children:h}):y.jsx("a",{onClick:s(f),title:u,href:f,children:h});return y.jsx(cn,{options:{...r,overrides:{a:l}},children:e})},mT=({text:e,onLinkClick:r})=>e?y.jsx("div",{children:y.jsx(Fy,{markdown:e,onLinkClick:r})}):null,gT=({title:e})=>e?y.jsx("h1",{className:wt.title,children:e}):null,yT=({title:e,text:r,subtitle:o,buttons:s,onButtonClick:l,onLinkClick:u})=>(e==null?void 0:e.length)||(r==null?void 0:r.length)||(o==null?void 0:o.length)||(s==null?void 0:s.length)?y.jsxs("div",{className:V(fe.bubbleContent),children:[y.jsx(gT,{title:e}),y.jsx(mT,{text:r,onLinkClick:u}),y.jsx(pT,{subtitle:o,onLinkClick:u}),y.jsx(Q2,{buttons:s,onButtonClick:l})]}):null,vT=({alt:e,imageUrl:r,itemUrl:o,hasBody:s})=>r?o?o.indexOf("youtube.com")>-1?y.jsx("div",{className:wt.video_container,children:y.jsx("iframe",{className:V(wt.video,{[wt.only]:!s}),title:"Youtube",width:"100%",src:o+"?rel=0",frameBorder:"0",allowFullScreen:!0})}):y.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:y.jsx("div",{className:wt.imageContainer,children:y.jsx("img",{className:V(wt.image,{[wt.only]:!s}),src:r,alt:e})})}):y.jsx("div",{className:wt.imageContainer,children:y.jsx("img",{className:V(wt.image,{[wt.only]:!s}),src:r,alt:e})}):null,_T=({title:e,text:r,subtitle:o,imageUrl:s,itemUrl:l,buttons:u,sources:f,onButtonClick:h,onLinkClick:p})=>{const v=!!(e!=null&&e.length)||!!(r!=null&&r.length)||!!(o!=null&&o.length)||!!(u!=null&&u.length);return y.jsxs("div",{className:V(wt.detailMessage),children:[y.jsx(vT,{hasBody:v,imageUrl:s,itemUrl:l,alt:e||o}),v&&y.jsx(yT,{title:e,text:r,subtitle:o,buttons:u,onLinkClick:p,onButtonClick:h}),y.jsx(Sf,{sources:f,onLinkClick:p})]})},ET=B.forwardRef(({isFirstMessageBySender:e,isLastMessageBySender:r,children:o},s)=>{const l=Ke();return y.jsx("li",{ref:s,className:V(fe.message,fe.messageGuest,e&&fe.messageGuestFirst,r&&fe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer",e&&"chat__bubbleContainer--first",r&&"chat__bubbleContainer--last"),children:y.jsx("div",{className:V(fe.bubble,fe.bubbleRight,"chat__bubble","chat__guestBubble"),tabIndex:0,"aria-label":l("guest-bubble.label"),children:y.jsx("div",{className:V(fe.rightText),children:o})})})}),wT="_markdown_nw7vg_1",Ly={markdown:wT},zs="source-info-reference",bT=({markdown:e,sources:r,onLinkClick:o})=>{const s=to(),l=ST(),u=h=>p=>{const v=p.key;(v==="ArrowDown"||v==="ArrowRight"||v==="Enter"||v===" "||v==="Space")&&(p.stopPropagation(),s(Wm(h)))},f=h=>()=>{s(Wm(h))};return B.useLayoutEffect(()=>{document.querySelectorAll(`.${zs}`).forEach(h=>{var _,b,m,T;const p=h.previousSibling;p&&p.nodeType===Node.TEXT_NODE&&((_=p.textContent)!=null&&_.endsWith(" "))&&((b=p.textContent)!=null&&b.trim().length)&&h.classList.add(`${zs}--before-space`);const v=h.nextSibling;v&&v.nodeType===Node.TEXT_NODE&&((m=v.textContent)!=null&&m.startsWith(" "))&&((T=v.textContent)!=null&&T.trim().length)&&h.classList.add(`${zs}--after-space`)})},[e]),y.jsxs("div",{className:fe.bubbleContent,children:[y.jsx("div",{className:Ly.markdown,children:y.jsx(Fy,{markdown:e,onLinkClick:o,markdownOptions:{renderRule(h,p,v,_){return p.type===ie.footnoteReference?y.jsx("span",{className:V(fe.sourceInfoReference,zs),children:y.jsx("a",{type:"button",tabIndex:0,onClick:f(p.text),onKeyDown:u(p.text),children:l(p.text)})},_.key):h()}}})}),y.jsx(Sf,{sources:r,onLinkClick:o})]})},ST=()=>{const e=[];return o=>{const s=e.indexOf(o);return s>-1?s+1:(e.push(o),e.length)}},xT=({text:e,commands:r,sources:o,onLinkClick:s})=>y.jsxs("div",{className:fe.bubbleContent,children:[y.jsx(My,{text:e,commands:r,onLinkClick:s}),y.jsx(Sf,{sources:o,onLinkClick:s})]}),TT=B.forwardRef(({message:e,commands:r,isLastMessage:o,isFirstMessageBySender:s,isLastMessageBySender:l,onReaction:u,onButtonClick:f,onLinkClick:h},p)=>{const v=CT(e,r,f,h);switch(e.sender.type){case ge.UserType.GUEST:return y.jsx(ET,{ref:p,isFirstMessageBySender:s,isLastMessageBySender:l,children:v});default:{const _=b=>u(e._id,b);return y.jsx(Ny,{ref:p,message:e,isAnimated:!1,isLastMessage:o,isFirstMessageBySender:s,isLastMessageBySender:l,onReaction:_,children:v})}}}),CT=(e,r,o,s)=>{switch(e.type){case ge.MessageTypeEnum.TEXT:{const l=e;return y.jsx(xT,{text:l.text,commands:r,sources:e.sources||[],onLinkClick:s})}case ge.MessageTypeEnum.DETAIL:{const l=e;return y.jsx(_T,{title:l.title,text:l.text,subtitle:l.subtitle,imageUrl:l.imageUrl,itemUrl:l.itemUrl,buttons:l.buttons,sources:e.sources||[],onButtonClick:o,onLinkClick:s})}case ge.MessageTypeEnum.MARKDOWN:{const l=e;return y.jsx(bT,{markdown:l.markdown,sources:l.sources||[],onLinkClick:s})}}},kT=(e,r)=>e.message._id===r.message._id&&e.message.reaction===r.message.reaction&&e.isLastMessage===r.isLastMessage&&e.isFirstMessageBySender===r.isFirstMessageBySender&&e.isLastMessageBySender===r.isLastMessageBySender,RT=e0.memo(TT,kT),OT="_ticontainer_xg0dn_1",NT="_tiblock_xg0dn_5",AT="_tidot_xg0dn_12",Qo={ticontainer:OT,tiblock:NT,tidot:AT},IT=({isTyping:e=!1})=>y.jsx("div",{className:Qo.ticontainer,children:y.jsx("div",{className:Qo.tiblock,children:e?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:V(Qo.tidot,"chat__typingIndicator")}),y.jsx("div",{className:V(Qo.tidot,"chat__typingIndicator")}),y.jsx("div",{className:V(Qo.tidot,"chat__typingIndicator")})]}):null})}),DT=Object.assign({_id:"typing-indicator"},new ge.TextMessage("",new ge.BotUser)),PT=({messages:e,isBotTyping:r,commands:o,onTranscriptItemReaction:s,onButtonClick:l,onLinkClick:u})=>{const f=B.useRef(0),h=B.useRef(!0),p=B.useRef(null),v=B.useRef(null),_=B.useRef(null),b=jt(w=>w.settings.enableGeneralConditions);B.useLayoutEffect(()=>{if(e.length&&p.current&&(f.current<e.length||r)){if(v.current){const w=v.current.offsetTop;p.current.scrollTop=w}else if(_.current){const w=_.current.offsetTop;p.current.scrollTop=w}h.current&&(h.current=!1),f.current=e.length}},[e,h,r]);let m;const T=e.length;return y.jsxs("div",{ref:p,className:V(Km.messageContainer,"chat__messageContainer"),style:{scrollBehavior:e.length&&h.current?"auto":"smooth"},id:"MessageContainer",role:"log","aria-live":"polite",children:[b&&y.jsx(c2,{}),y.jsxs("ul",{className:Km.messages,children:[e.map((w,D)=>{const R=MT(w,m),P=FT(w,D,e,r);m=w.sender.type;const N=D+1===T;return y.jsx(RT,{ref:N?_:null,message:w,commands:o,isLastMessage:N,isFirstMessageBySender:R,isLastMessageBySender:P,onButtonClick:l,onLinkClick:u,onReaction:s},N&&!r?"last":w._id)}),r&&y.jsx(Ny,{ref:v,message:DT,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:m!==ge.UserType.BOT,isLastMessageBySender:!0,children:y.jsx(IT,{isTyping:!0})},"last")]})]})},MT=(e,r)=>!r||r!==e.sender.type,FT=(e,r,o,s)=>{var h;const l=e.sender.type,u=o.length;return r+1===u?!(l===ge.UserType.BOT&&s):l!==((h=o.at(r+1))==null?void 0:h.sender.type)},LT="_bottomSheet_jp8dl_1",BT="_bottomSheetOpen_jp8dl_15",jT="_bottomSheetClose_jp8dl_20",kn={bottomSheet:LT,bottomSheetOpen:BT,bottomSheetClose:jT},UT="_container_xc2nx_1",yg={container:UT},HT=({contentUrl:e})=>{const r=jt(u=>u.connection.sessionId),[o,s]=B.useState(!1);B.useEffect(()=>{s(u=>u||!!e)},[e]);const l=B.useMemo(()=>{if(e&&r){const u=new URL(e,document.baseURI);return u.searchParams.set("sessionId",r),u.toString()}else return},[e,r]);return y.jsx("div",{className:V(yg.container,kn.bottomSheet,{[kn.bottomSheetOpen]:!!e,[kn.bottomSheetClose]:o&&!e}),children:l&&y.jsx("iframe",{title:"Drawer",src:l,className:yg.iframe})})},zT="_container_tr4tn_1",GT={container:zT},$T=({title:e,href:r,children:o})=>y.jsx("a",{href:r,title:e,target:"_blank",rel:"noopener noreferrer",children:o}),VT=()=>{const r=Ke()("powered-by");return r&&r.length?y.jsx("div",{className:V(GT.container,"chat__poweredBy"),children:y.jsx(cn,{options:{overrides:{a:$T}},children:r})}):null},vg=({className:e,children:r,...o})=>y.jsx(va,{className:V(oi.buttonDefault,e),type:"button",...o,children:r}),ii=({className:e,children:r,...o})=>y.jsx(va,{className:V(oi.buttonPrimary,e),...o,children:r}),qT="_container_h23mk_1",WT="_formContainer_h23mk_17",KT="_emailInput_h23mk_22",ZT="_description_h23mk_52",QT="_actions_h23mk_57",XT="_validationError_h23mk_67",YT="_submitted_h23mk_74",xn={container:qT,formContainer:WT,emailInput:KT,description:ZT,actions:QT,validationError:XT,submitted:YT},JT=({visible:e,enableTranscriptExportPdf:r,enableTranscriptExportMail:o,onEmailExport:s,onPdfExport:l,onClose:u})=>{const f=Ke(),[h,p]=B.useState(void 0),[v,_]=B.useState(!1),[b,m]=B.useState(!1),[T,w]=B.useState(void 0),D=B.useRef(null);B.useEffect(()=>{var E;e?((E=D.current)==null||E.focus(),_(!1),m(!1),p(e)):h===!0&&p(!1)},[e,h]);const R=E=>{E.preventDefault(),T&&T.length>0&&(s(T),_(!0),setTimeout(u,3*1e3))},P=E=>{const C=E.target.value.trim(),x=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(C);w(x?C:"")},N=()=>{m(!0),l(),setTimeout(u,3*1e3)};return y.jsxs("div",{className:V(xn.container,kn.bottomSheet,{[kn.bottomSheetOpen]:h===!0,[kn.bottomSheetClose]:h===!1}),children:[r&&y.jsxs(y.Fragment,{children:[y.jsx("h2",{children:f("export-transcript.pdf.title")}),y.jsx(cn,{className:xn.description,children:f("export-transcript.pdf.description")||""}),y.jsxs("div",{className:xn.actions,children:[y.jsx(vg,{onClick:u,children:f("export-transcript.pdf.cancel")}),y.jsx(ii,{onClick:N,disabled:b,children:f("export-transcript.pdf.download")})]})]}),o&&y.jsxs(y.Fragment,{children:[y.jsx("h2",{children:f("export-transcript.email.title")}),y.jsx(cn,{className:xn.description,children:f("export-transcript.email.description")||""}),y.jsxs("form",{onSubmit:R,className:xn.formContainer,children:[y.jsxs("div",{children:[y.jsx("input",{disabled:v,ref:D,type:"email",placeholder:f("export-transcript.email.placeholder"),className:xn.emailInput,onChange:P}),(T==null?void 0:T.length)===0?y.jsx("div",{className:xn.validationError,children:f("export-transcript.email.invalid")}):null]}),y.jsxs("div",{className:xn.actions,children:[y.jsx(vg,{onClick:u,children:f("export-transcript.email.cancel")}),y.jsx(ii,{type:"submit",disabled:v||T===void 0||T.length===0,children:f("export-transcript.email.send")})]})]}),v&&y.jsx("div",{className:xn.submitted,children:f("export-transcript.email.success")})]})]})},eC="_inputContainer_fi5ao_1",tC={inputContainer:eC},nC="_blockUserInput_pot9c_1",rC={blockUserInput:nC},oC=({visible:e})=>{const r=Ke();return e?y.jsx("div",{className:V(rC.blockUserInput,"chat__blockUserInput"),children:r("block-user-input.title")}):null},iC="_commandsDropdown_5ytuv_1",sC="_commands_5ytuv_1",aC="_command_5ytuv_1",lC="_commandActive_5ytuv_46",uC="_commandsSelections_5ytuv_55",Jo={commandsDropdown:iC,commands:sC,command:aC,commandActive:lC,commandsSelections:uC},cC=(e,r)=>{B.useEffect(()=>{const o=s=>{e.current&&!e.current.contains(s.target)&&r()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r])},fC=(e,r,o,s,l)=>{B.useEffect(()=>{const u=f=>{if(e.length)switch(f.key){case"Enter":o(e[r]);break;case"ArrowUp":s(h=>h>0?h-1:e.length-1);break;case"ArrowDown":s(h=>h<e.length-1?h+1:0);break;case"Escape":l([]);break}};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[e,r,o,s,l])},dC=({text:e,commands:r,onSelectCommand:o,onVisibilityChange:s})=>{const l=B.useRef(null),u=Ke(),[f,h]=B.useState([]),[p,v]=B.useState(_g(r)),[_,b]=B.useState(0),m=T=>o(`/${T}`);return cC(l,()=>h([])),fC(f,_,m,b,h),B.useEffect(()=>{v(_g(r))},[r]),B.useEffect(()=>{const T=e.length||0;T===0||T>p||!e.startsWith("/")?h([]):h(r.filter(hC(e))),b(0)},[r,e,p]),B.useEffect(()=>{s(!!f.length)},[f,s]),f.length?y.jsx("div",{ref:l,className:Jo.commandsDropdown,children:y.jsx("ul",{className:Jo.commands,role:"listbox",children:f.map((T,w)=>y.jsxs("li",{className:V([Jo.command,_===w&&Jo.commandActive]),role:"option",onClick:()=>m(T),onMouseOver:()=>b(w),children:[y.jsxs("h1",{children:["/",T]}),y.jsx("p",{children:u(`commands.${T}`)})]},T))})}):null},_g=e=>Math.max(...e.map(r=>r.length+1)),hC=e=>r=>{const o=`/${r}`;return o.startsWith(e)&&o.length>=e.length},Eg=3,pC=({commands:e,onSelectCommand:r})=>{const o=Ke(),[s,l]=B.useState(!1),u=v=>()=>{r(`/${v}`),l(!1)},f=()=>{l(!0)},h=()=>{l(!1)},p=s?e:e.slice(0,Eg);return y.jsxs("div",{className:Jo.commandsSelections,children:[p.map(v=>y.jsxs("button",{onClick:u(v),children:["/",v]})),p.length<e.length?y.jsx("button",{"aria-label":o("commands.show-more.tooltip"),"data-title":o("commands.show-more.tooltip"),tabIndex:0,onClick:f,children:o("commands.show-more.action")},"show-more"):p.length>Eg?y.jsx("button",{"aria-label":o("commands.show-less.tooltip"),"data-title":o("commands.show-less.tooltip"),tabIndex:0,onClick:h,children:o("commands.show-less.action")},"show-less"):null]})},mC="_callToActionContainer_bkfcm_1",gC="_callToActionTitle_bkfcm_23",yC="_rateOverlay_bkfcm_30",vC="_body_bkfcm_52",_C="_footer_bkfcm_60",EC="_actions_bkfcm_73",wC="_bubbles_bkfcm_101",bC="_stars_bkfcm_203",SC="_starsSmall_bkfcm_215",xC="_starsLarge_bkfcm_219",TC="_star_bkfcm_203",CC="_starReadonly_bkfcm_236",kC="_starIcon_bkfcm_246",RC="_starsDescriptionContainer_bkfcm_264",OC="_starsDescription_bkfcm_264",pt={callToActionContainer:mC,callToActionTitle:gC,rateOverlay:yC,body:vC,footer:_C,actions:EC,bubbles:wC,stars:bC,starsSmall:SC,starsLarge:xC,star:TC,starReadonly:CC,starIcon:kC,starsDescriptionContainer:RC,starsDescription:OC},NC=({value:e,index:r,count:o,readonly:s,onHover:l,onClick:u})=>{const f=h=>{u&&h.key==="Enter"&&u()};return y.jsx("li",{className:V(pt.star,{[pt.starReadonly]:s},"chat__conversationRating__star"),children:y.jsx("div",{role:"radio","aria-checked":e>r?"true":"false","aria-posinset":r+1,"aria-setsize":o,tabIndex:0,onMouseOver:l,onKeyDown:f,onClick:u,children:y.jsx("span",{role:"img","aria-label":"Star",className:V(pt.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"})})})})})},wg=5,By=({value:e,size:r,readonly:o=!1,onChange:s})=>{const[l,u]=B.useState(void 0),f=()=>{u(void 0)},h=v=>()=>{if(!o){const _=v+1;u(_)}},p=v=>()=>{s&&!o&&(s(v===0&&e===1?0:v+1),u(void 0))};return y.jsx("ul",{tabIndex:0,role:"radiogroup",className:V(pt.stars,{[pt.starsSmall]:r==="small",[pt.starsLarge]:r==="large"},"chat__conversationRating__stars",{chat__conversationRating__stars__small:r==="small",chat__conversationRating__stars__large:r==="large"}),onMouseOut:f,children:Array(wg).fill(0).map((v,_)=>y.jsx(NC,{value:l===void 0?e:l,index:_,count:wg,readonly:o,onHover:h(_),onClick:p(_)},_))})},AC=({visible:e,onRate:r})=>{const o=Ke();return e?y.jsxs("div",{className:V(pt.callToActionContainer,"chat__conversationRating__callToAction"),children:[y.jsx("div",{className:V(pt.callToActionTitle,"chat__conversationRating__callToAction__title"),children:o("conversation-rating.call-to-action.title")}),y.jsx(By,{value:0,size:"small",onChange:r})]}):null},Yu=({isFirstMessageBySender:e,isLastMessageBySender:r,children:o})=>y.jsxs("div",{className:V(fe.message,fe.messageBot,e&&fe.messageBotFirst,r&&fe.messageBotLast,"chat__bubbleContainer","chat__botBubbleContainer",e&&"chat__bubbleContainer--first",r&&"chat__bubbleContainer--last"),children:[y.jsx("img",{className:V(fe.avatar,fe.botAvatar),src:"bot.svg",alt:"Bot"}),y.jsx("div",{className:V(fe.bubble,fe.bubbleLeft,"chat__bubble","chat__botBubble"),children:y.jsx("div",{className:V(fe.leftText,fe.bubbleContent),children:o})})]}),IC=({children:e})=>y.jsx("div",{className:V(fe.message,fe.messageGuest,fe.messageGuestFirst,fe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer","chat__bubbleContainer--first","chat__bubbleContainer--last"),children:y.jsx("div",{className:V(fe.bubble,fe.bubbleRight,"chat__bubble","chat__guestBubble"),children:y.jsx("div",{className:V(fe.rightText,fe.bubbleContent),children:e})})}),DC=({visible:e,rating:r,onRate:o,onClose:s})=>{const l=Ke(),[u,f]=B.useState(r),[h,p]=B.useState(void 0),[v,_]=B.useState(void 0),[b,m]=B.useState({submitted:!1,feedback:""}),[T,w]=B.useState(!1),D=B.useRef(null);B.useEffect(()=>{e?(m({submitted:!1,feedback:""}),_(e)):v===!0&&_(!1)},[e,v]),B.useEffect(()=>{f(r)},[r]),B.useEffect(()=>{const P=l(`conversation-rating.overlay.bot-message.rate-feedback.value-${u}`);p(P!=null&&P.length?P:void 0)},[u,l]),B.useEffect(()=>{b.submitted?setTimeout(()=>w(!0),b.feedback.length?500:0):w(!1)},[b]);const R=P=>{var E,C;P.preventDefault();const N=((C=(E=D.current)==null?void 0:E.value)==null?void 0:C.trim())||"";o(u,N),m({submitted:!0,feedback:N})};return y.jsx("div",{className:V(pt.rateOverlay,kn.bottomSheet,"chat__conversationRating__overlay",{[kn.bottomSheetOpen]:v===!0,[kn.bottomSheetClose]:v===!1}),children:y.jsxs("form",{onSubmit:R,children:[y.jsxs("div",{className:V(pt.body,"chat__conversationRating__overlay__body"),children:[y.jsx("div",{}),y.jsx("div",{className:V(pt.bubbles),children:e&&h&&y.jsxs(y.Fragment,{children:[y.jsxs(Yu,{isFirstMessageBySender:!0,isLastMessageBySender:!1,children:[y.jsx("h2",{children:l("conversation-rating.overlay.title")}),y.jsxs("div",{className:V(pt.starsDescriptionContainer),children:[y.jsx(By,{value:u,size:"large",readonly:b.submitted,onChange:f}),y.jsxs("div",{className:V(pt.starsDescription),children:[y.jsx("div",{children:l("conversation-rating.overlay.star.very-bad")}),y.jsx("div",{children:l("conversation-rating.overlay.star.very-good")})]})]})]}),y.jsx(Yu,{isFirstMessageBySender:!1,isLastMessageBySender:!T||!!b.feedback.length,children:y.jsx("div",{children:h})}),!!b.feedback.length&&y.jsx(IC,{children:b.feedback}),T&&y.jsx(Yu,{isFirstMessageBySender:!!b.feedback.length,isLastMessageBySender:!0,children:y.jsx("div",{children:l("conversation-rating.overlay.bot-message.submit-feedback")})})]})})]}),y.jsxs("div",{className:V(pt.footer,"chat__conversationRating__overlay__footer"),children:[!b.submitted&&y.jsx("input",{ref:D,placeholder:l("conversation-rating.overlay.guest-feedback.input-placeholder")}),y.jsx("div",{className:V(pt.actions,"chat__conversationRating__overlay__footer__actions"),children:b.submitted?y.jsx(ii,{type:"button",onClick:s,children:l("conversation-rating.overlay.action.close")}):y.jsx(ii,{type:"submit",children:l("conversation-rating.overlay.action.submit")})})]})]})})},PC=({conversationRating:{enabled:e,rating:r},numberOfMessagesFromGuest:o,showRatingOverlay:s,setShowRatingOverlay:l,onRate:u})=>{const[f,h]=B.useState(0),p=b=>{h(b),l(!0)},v=()=>l(!1),_=!r&&o>=1;return e?y.jsxs(y.Fragment,{children:[y.jsx(AC,{visible:_,onRate:p}),y.jsx(DC,{visible:s,rating:f,onRate:u,onClose:v})]}):null},MC="_inputWrapper_e3h44_1",FC="_withOpenCommands_e3h44_14",LC="_messageInputWrapper_e3h44_20",BC="_messageInput_e3h44_20",jC="_buttons_e3h44_44",UC="_button_e3h44_44",mr={inputWrapper:MC,withOpenCommands:FC,messageInputWrapper:LC,messageInput:BC,buttons:jC,button:UC},HC="_audioRecorder_g845f_1",zC="_audioButton_g845f_6",GC="_recorderIcon_g845f_37",$C="_spinning_g845f_60",gr={audioRecorder:HC,audioButton:zC,recorderIcon:GC,spinning:$C},bg=2048,ia=16e3;class VC extends e0.Component{constructor(o){super(o);xe(this,"audioInput",null);xe(this,"volume",null);xe(this,"leftchannel",[]);xe(this,"recorder",null);xe(this,"recordingLength",0);xe(this,"sampleRate",null);xe(this,"mediaStream",null);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(o){this.mediaStream=o,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(o)}initRecording(o){const s=window.AudioContext||window.webkitAudioContext,l=new s;this.sampleRate=l.sampleRate,this.volume=l.createGain(),this.audioInput=l.createMediaStreamSource(o),this.audioInput.connect(this.volume),this.recorder=l.createScriptProcessor(bg,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(l.destination)}processRecordingInput(o){if(this.state.recordingState==="connecting"&&this.setState({recordingState:"recording"}),this.state.recordingState!=="none"){const s=o.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(s)),this.recordingLength+=bg}}handleClickSubmitAudio(){const o=WC(this.leftchannel,this.recordingLength),s=KC(o,this.sampleRate||0),l=qC(s);this.props.onAudioRecorded(l),this.handleClickStopAudio()}handleClickStopAudio(){var o,s,l,u;this.setState({recordingState:"none"}),(o=this.audioInput)==null||o.disconnect(),(s=this.volume)==null||s.disconnect(),(l=this.recorder)==null||l.disconnect(),this.mediaStream&&((u=this.mediaStream)==null||u.getAudioTracks().forEach(f=>{f.stop()}))}render(){return y.jsxs("div",{className:gr.audioRecorder,children:[this.state.recordingState==="none"&&y.jsx("button",{className:V(gr.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:gr.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:gr.audioRecorder,children:[y.jsx("button",{className:V(gr.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:gr.recorderIcon}),y.jsx("button",{className:V(gr.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 qC=e=>{const r=new ArrayBuffer(44+e.length*2),o=new DataView(r);Gs(o,0,"RIFF"),o.setUint32(4,44+e.length*2,!0),Gs(o,8,"WAVE"),Gs(o,12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,ia,!0),o.setUint32(28,ia*4,!0),o.setUint16(32,4,!0),o.setUint16(34,16,!0),Gs(o,36,"data"),o.setUint32(40,e.length*2,!0);const s=e.length;let l=44;const u=1;for(let f=0;f<s;f++)o.setInt16(l,e[f]*(32767*u),!0),l+=2;return new Blob([o],{type:"audio/wav"})},Gs=(e,r,o)=>{for(let s=0;s<o.length;s++)e.setUint8(r+s,o.charCodeAt(s))},WC=(e,r)=>{const o=new Float32Array(r);let s=0;const l=e.length;for(let u=0;u<l;u++){const f=e[u];o.set(f,s),s+=f.length}return o},KC=(e,r)=>{if(ia===r)return e;const o=r/ia,s=Math.round(e.length/o),l=new Float32Array(s);let u=0,f=0;for(;u<l.length;){const h=Math.round((u+1)*o);let p=0,v=0;for(let _=f;_<h&&_<e.length;_++)p+=e[_],v++;l[u]=p/v,u++,f=h}return l},ZC=({disabled:e,textInput:r,commandsVisible:o,onTextInput:s,onTextInputSubmit:l,onAudioRecorded:u,onOpenTranscriptExportModal:f})=>{const h=Ke(),p=B.useRef(null),{enableTranscriptExportPdf:v,enableTranscriptExportMail:_,enableSpeechSupport:b}=jt(R=>R.settings);B.useEffect(()=>{var R;(R=p.current)==null||R.focus()},[r]);const m=()=>{const R=p.current;R&&r.trim().length>=1&&l(r.trim())&&(R.value="",R.style.height="",R.focus())},T=R=>{R.preventDefault(),m()},w=R=>{const P=R.target.value;s(P),R.target.style.height="";const{scrollHeight:N}=R.target;R.target.style.height=`${N>150?150:N}px`},D=R=>{R.code==="Enter"&&!R.shiftKey?(R.repeat||m(),R.preventDefault()):o&&(R.code==="ArrowUp"||R.code==="ArrowDown")&&R.preventDefault()};return y.jsxs("form",{className:V(mr.inputWrapper,o&&mr.withOpenCommands,"chat__textInput"),onSubmit:T,children:[y.jsx("div",{className:mr.messageInputWrapper,children:y.jsx("textarea",{id:"user_input",ref:p,className:mr.messageInput,tabIndex:0,placeholder:h("message-input-placeholder"),value:r,onChange:w,onKeyDown:D,"aria-label":h("message-input-label"),"aria-controls":"command-list","aria-haspopup":"listbox"})}),y.jsxs("div",{className:V(mr.buttons,"chat__buttons"),children:[!r.length&&(v||_)&&y.jsx("button",{type:"button",className:V(mr.button,"chat__button"),"aria-label":h("message-input.actions.export-transcript.label"),"data-title":h("message-input.actions.export-transcript.label"),tabIndex:0,onClick:f,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:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"})})}),r.length||!b||navigator.mediaDevices===void 0?y.jsx("button",{className:V(mr.button,"chat__button"),type:"submit","aria-label":h("message-input.actions.submit.label"),"data-title":h("message-input.actions.submit.label"),tabIndex:0,disabled:e,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"})})}):b&&navigator.mediaDevices!==void 0&&y.jsx(VC,{translate:h,onAudioRecorded:u})]})]})},QC="_quickReplies_83npe_1",XC="_quickReply_83npe_9",Sg={quickReplies:QC,quickReply:XC},YC=({quickReplies:e,onQuickReplyClick:r})=>e.length?y.jsx("div",{className:V(Sg.quickReplies,"chat__quickReplies"),children:e.map(o=>y.jsx(va,{tabIndex:0,className:V(Sg.quickReply,"chat__button","chat__quickReply"),onClick:()=>r(o),children:o.label},o.label))}):null,xg=5e3,JC=1e3,ek=({isBotTyping:e,quickReplies:r,conversationRating:o,numberOfMessagesFromGuest:s,showRatingOverlay:l,commands:u,setShowRatingOverlay:f,onTextInput:h,onRate:p,onQuickReplyClick:v,onAudioRecorded:_,onOpenTranscriptExportModal:b})=>{const[m,T]=B.useState(""),[w,D]=B.useState(!1),[R,P]=B.useState(!1),N=B.useRef(),E=B.useRef(0);B.useEffect(()=>{if(w&&!e){const F=N.current?Date.now()-N.current:0;F>xg?D(!1):setTimeout(()=>{D(!1)},xg-F)}},[w,e]),B.useEffect(()=>{w&&(N.current=Date.now())},[w]);const C=F=>{const z=Date.now()-E.current<JC;return R?!1:e||z?(D(!0),!1):(h(F),T(""),E.current=Date.now(),!0)},x=F=>{T(F+" ")};return y.jsxs("div",{className:V(tC.inputContainer),children:[y.jsx(YC,{quickReplies:r,onQuickReplyClick:v}),y.jsx(oC,{visible:w}),!w&&y.jsx(PC,{conversationRating:o,numberOfMessagesFromGuest:s,onRate:p,showRatingOverlay:l,setShowRatingOverlay:f}),!!(u!=null&&u.length)&&y.jsx(dC,{text:m,commands:u,onSelectCommand:x,onVisibilityChange:P}),y.jsx(ZC,{textInput:m,disabled:w,commandsVisible:R,onTextInput:T,onTextInputSubmit:C,onOpenTranscriptExportModal:b,onAudioRecorded:_}),!!(u!=null&&u.length)&&y.jsx(pC,{commands:u,onSelectCommand:T})]})},tk=({clientName:e,messages:r,quickReplies:o,isBotTyping:s,drawerContentUrl:l,conversationRating:u,onMessageFromUser:f,onRate:h,onQuickReplyClick:p,onButtonClick:v,onLinkClick:_,onAudioRecorded:b,onTranscriptExport:m,onPdfExport:T,onTranscriptItemReaction:w})=>{const D=to(),R=jt(te=>te.connection.connectionState),{enableTranscriptExportPdf:P,enableTranscriptExportMail:N,commands:E}=jt(te=>te.settings),[C,x]=B.useState(!1),[F,z]=B.useState(!1),W=P||N,he=r.filter(te=>te.sender.type===dy.GUEST).length;return B.useEffect(()=>{if(R===Er.CONNECTED){const te=ua.parse(window.location.search);D(fy(e,te))}},[e,R,D]),y.jsxs("div",{className:ju.container,children:[y.jsxs("div",{className:V([ju.chatcontent,(C||F)&&ju.accessabilityHidden]),children:[y.jsx(PT,{messages:r,isBotTyping:s,commands:E,onButtonClick:v,onLinkClick:_,onTranscriptItemReaction:w}),y.jsx(ek,{isBotTyping:s,quickReplies:s?[]:o,numberOfMessagesFromGuest:he,conversationRating:C?{enabled:!1}:u,showRatingOverlay:F,setShowRatingOverlay:z,commands:E,onRate:h,onQuickReplyClick:p,onTextInput:f,onAudioRecorded:b,onOpenTranscriptExportModal:()=>x(!C)}),y.jsx(VT,{})]}),W&&y.jsx(JT,{enableTranscriptExportPdf:P,enableTranscriptExportMail:N,visible:C,onEmailExport:m,onPdfExport:T,onClose:()=>x(!1)}),y.jsx(HT,{contentUrl:l})]})},nk=e=>{const{messages:r,quickReplies:o,isBotTyping:s,drawerContentUrl:l,conversationRating:u}=e.chat;return{messages:r,quickReplies:o,isBotTyping:s,drawerContentUrl:l,conversationRating:u}},rk=e=>({onRestartChat:(r,o)=>e(ga(r,o)),onMessageFromUser:r=>e(G0(r)),onRate:(r,o)=>e(Hb(r,o)),onAudioRecorded:r=>e(Fb(r)),onActionFromUser:r=>e(r),onQuickReplyClick:r=>e(z0(r)),onNluEvent:r=>e(Z0(r)),onButtonClick:r=>e(Gb(r)),onLinkClick:r=>e($b(r)),onTranscriptExport:r=>e(Bb(r)),onPdfExport:()=>e(jb()),onTranscriptItemReaction:(r,o)=>e(ge.transcriptItemGuestReaction(r,o||null))}),ok=dE(nk,rk)(tk),jy=()=>ik(window.location.pathname),ik=e=>{const r=e.split("/"),o=e.endsWith("/");return r[r.length-(o?2:1)]},Uy=()=>B.useMemo(()=>jy(),[]),Hy=()=>{const[e,r]=B.useState(!1);return B.useEffect(()=>{r((()=>{try{return window.self!==window.top}catch{return!0}})())},[]),e},xf=e=>r=>{const o=r.key;(o==="ArrowDown"||o==="ArrowRight"||o==="Enter"||o===" "||o==="Space")&&(r.stopPropagation(),e())},sk=({onClick:e})=>{const r=Ke();return Hy()?y.jsx("button",{className:"tooltip--bottom","aria-label":r("header.close-chat"),"data-title":r("header.close-chat"),tabIndex:0,onClick:e,onKeyDown:xf(e),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},ak=()=>{const e=Ke(),r=Hy(),o=jt(l=>l.settings.enableStandaloneView),s=()=>{window.open(window.location.href,"_blank")};return r&&o?y.jsx("button",{className:"tooltip--bottom","aria-label":e("header.expand-chat"),"data-title":e("header.expand-chat"),tabIndex:0,onClick:s,onKeyDown:xf(s),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:"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"})})}):null},lk="_header_1sel7_1",uk="_logoContainer_1sel7_13",ck="_logo_1sel7_13",fk="_actions_1sel7_26",$s={header:lk,logoContainer:uk,logo:ck,actions:fk},dk=({onClick:e})=>{const r=Ke();return y.jsx("button",{className:"tooltip--bottom","aria-label":r("header.restart-chat"),"data-title":r("header.restart-chat"),tabIndex:0,onClick:e,onKeyDown:xf(e),children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 32 32",children:[y.jsx("path",{d:"M14.506,23.578l-5.511,0l-3.993,3.501l-0.007,0.006c-0.302,0.261 -0.687,0.405 -1.084,0.405c-0.245,-0.001 -0.488,-0.055 -0.711,-0.161c-0.595,-0.277 -0.978,-0.886 -0.974,-1.551l-0,-19.558c-0,-0.939 0.761,-1.711 1.685,-1.711l21.189,-0c0.924,-0 1.685,0.772 1.685,1.711l0,5.104l-1.444,0l-0,-5.104c-0,-0.134 -0.109,-0.244 -0.241,-0.244l-21.189,-0c-0.132,-0 -0.24,0.11 -0.24,0.244l-0,19.558c0.001,0.133 0.109,0.242 0.24,0.242c0.056,-0 0.109,-0.019 0.152,-0.055l4.192,-3.675c0.131,-0.115 0.299,-0.179 0.472,-0.179l5.779,0l-0,1.467Z"}),y.jsx("path",{d:"M29.869,20.148c0,4.137 -3.373,7.556 -7.509,7.612l-0.102,-0c-1.943,0.004 -3.814,-0.741 -5.223,-2.078c-0.183,-0.172 -0.286,-0.412 -0.286,-0.664c-0,-0.501 0.412,-0.913 0.913,-0.913c0.233,-0 0.458,0.089 0.627,0.249c1.074,1.014 2.495,1.579 3.971,1.579c3.174,-0 5.785,-2.612 5.785,-5.785c-0,-3.173 -2.611,-5.784 -5.785,-5.784c-1.533,-0 -3.006,0.61 -4.09,1.694c-0.01,0.01 -0.019,0.019 -0.03,0.028l-1.447,1.322l1.302,0c0.502,0 0.914,0.413 0.914,0.914c-0,0.501 -0.412,0.913 -0.914,0.913l-3.653,0c-0.501,0 -0.913,-0.412 -0.913,-0.913l-0,-3.654c-0,-0.501 0.412,-0.913 0.913,-0.913c0.501,0 0.913,0.412 0.913,0.913l0,1.577l1.635,-1.496c1.426,-1.418 3.357,-2.215 5.368,-2.215c4.175,0 7.611,3.436 7.611,7.611c-0,0.001 -0,0.002 -0,0.003Z"})]})})},Tg=({className:e,withActions:r=!0,...o})=>{const s=to(),l=Uy(),u=()=>{const h=ua.parse(window.location.search);s(ga(l,h))},f=()=>{s(MS())};return y.jsxs("div",{className:V([$s.header,e]),...o,children:[y.jsx("div",{className:$s.logoContainer,children:y.jsx("div",{className:$s.logo})}),y.jsxs("div",{className:$s.actions,children:[r&&y.jsx(dk,{onClick:u}),y.jsx(ak,{}),y.jsx(sk,{onClick:f})]})]})},hk="_chatwindow_6v6ob_1",pk="_chatwindowWithAside_6v6ob_46",Cg={chatwindow:hk,chatwindowWithAside:pk},mk="_sourceInfos_1qwkt_1",gk="_sourceDetails_1qwkt_16",yk="_sourceHeader_1qwkt_23",vk="_sourceHeaderIcon_1qwkt_43",_k="_openSourceButton_1qwkt_47",Ek="_closeSourceInfosButton_1qwkt_70",wk="_sourceContent_1qwkt_85",bk="_loadingSourceInfos_1qwkt_108",Sk="_loading_1qwkt_108",xk="_loadingError_1qwkt_122",hn={sourceInfos:mk,sourceDetails:gk,sourceHeader:yk,sourceHeaderIcon:vk,openSourceButton:_k,closeSourceInfosButton:Ek,sourceContent:wk,loadingSourceInfos:bk,loading:Sk,loadingError:xk},Tk=({onClick:e})=>{const r=Ke();return y.jsx("button",{className:V(hn.closeSourceInfosButton,"tooltip--bottom"),"aria-label":r("source-infos.close"),"data-title":r("source-infos.close"),tabIndex:0,onClick:e,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"})})})},Ck=e=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,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"})}),kk=({type:e,...r})=>{switch(e){case"WEBSITE":return y.jsx(Py,{...r});case"PDF":return y.jsx(Dy,{...r});case"DOCX":return y.jsx(Ay,{...r});case"TEXT":return y.jsx(Ck,{...r});default:return y.jsx(Iy,{...r})}},Rk=({sourceInfos:e,onClose:r})=>y.jsxs("div",{className:hn.sourceHeader,children:[y.jsx("div",{className:hn.sourceHeaderIcon,children:e&&y.jsx(kk,{type:e.knowledgeBaseType})}),y.jsx("div",{children:e&&y.jsx("h1",{children:e.title})}),y.jsx(Tk,{onClick:r})]}),Ok=({title:e,href:r,children:o})=>y.jsx("a",{href:r,title:e,target:"_blank",rel:"noopener noreferrer",children:o}),Nk=({className:e,children:r,...o})=>y.jsx("a",{className:V(oi.button,oi.buttonPrimary,e),type:"button",...o,children:r}),Ak=({label:e,url:r})=>y.jsxs(Nk,{className:hn.openSourceButton,href:r,target:"_blank",children:[y.jsx("p",{children:e}),y.jsx("div",{children: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:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"})})})]}),Ik=({sourceInfos:e})=>y.jsxs(y.Fragment,{children:[y.jsx("div",{className:V(hn.sourceContent,Ly.markdown),children:y.jsx(cn,{options:{overrides:{a:Ok}},children:e.content})}),y.jsx(Ak,{label:e.title,url:e.url})]}),Dk=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,Pk=()=>{const e=Ke();return y.jsxs("div",{className:hn.loadingError,children:[y.jsx("h1",{children:e("source-infos.error.title")}),y.jsx("img",{src:Dk,title:e("source-infos.error.title")}),y.jsx("p",{children:e("source-infos.error.info")})]})},Mk=()=>y.jsx("div",{className:hn.loadingSourceInfos,children:y.jsx("svg",{className:hn.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"})})}),Fk=()=>{const e=to(),r=jt(s=>s.chat.sourceInfos),o=()=>{e(LS())};return r?y.jsxs("div",{className:hn.sourceInfos,children:[y.jsx("div",{className:hn.sourceDetails,children:y.jsx(Rk,{sourceInfos:r.type==="loaded"?r:void 0,onClose:o})}),r.type==="loading"?y.jsx(Mk,{}):r.type==="loading-error"?y.jsx(Pk,{}):y.jsx(Ik,{sourceInfos:r})]}):null},Lk="_container_114wy_1",Bk="_body_114wy_7",jk="_intro_114wy_14",Uk="_footer_114wy_39",Hk="_footnote_114wy_43",zk="_containerWithFootnote_114wy_58",Gk="_startChatButton_114wy_73",$k="_formFields_114wy_77",Vk="_formField_114wy_77",qk="_radio_114wy_89",Wk="_checkbox_114wy_96",Kk="_input_114wy_104",Zk="_inputLabel_114wy_138",Qk="_selectWrapper_114wy_142",Xk="_select_114wy_142",Yk="_selectLabel_114wy_188",it={container:Lk,body:Bk,intro:jk,footer:Uk,footnote:Hk,containerWithFootnote:zk,startChatButton:Gk,formFields:$k,formField:Vk,radio:qk,checkbox:Wk,input:Kk,inputLabel:Zk,selectWrapper:Qk,select:Xk,selectLabel:Yk},Jk=({name:e,label:r,defaultValue:o,required:s,onChange:l})=>{const u=f=>{l(f.currentTarget.checked?"true":"false")};return y.jsxs("label",{className:V(it.checkbox,"chat__startScreen__checkbox"),htmlFor:e,children:[y.jsx("input",{type:"checkbox",id:e,name:e,defaultChecked:o==="true",required:s,onChange:u}),y.jsx("div",{children:r})]})},eR=({type:e,name:r,label:o,defaultValue:s,placeholder:l,required:u,multiple:f,min:h,max:p,pattern:v,onChange:_})=>{const b=m=>{_(m.target.value)};return y.jsxs("label",{className:V(it.input,"chat__startScreen__input"),htmlFor:r,children:[y.jsx("div",{className:V(it.inputLabel),children:o}),y.jsx("input",{type:e,id:r,name:r,defaultValue:s,placeholder:l,required:u,multiple:f,min:h,max:p,pattern:v,onChange:b})]})},tR=({name:e,value:r,label:o,defaultChecked:s,required:l,onChange:u})=>{const f=`${e}-${r}`,h=p=>{u(p.target.value)};return y.jsxs("label",{className:V(it.radio,"chat__startScreen__radio"),htmlFor:f,children:[y.jsx("input",{id:f,type:"radio",name:e,value:r,defaultChecked:s,required:l,onChange:h}),y.jsx("span",{className:V(it.label),children:o})]})},nR=({name:e,label:r,defaultValue:o,required:s,multiple:l,options:u,onChange:f})=>{const h=p=>{f(p.target.value)};return y.jsxs("label",{className:V(it.select,"chat__startScreen__select"),htmlFor:e,children:[y.jsx("div",{className:V(it.selectLabel),children:r}),y.jsx("div",{className:V(it.selectWrapper),children:y.jsx("select",{id:e,name:e,defaultValue:o,required:s,multiple:l,onChange:h,children:Object.entries(u||{}).map(([p,v])=>y.jsx("option",{value:p,selected:v===o,children:v}))})})]})},rR="start-screen.intro",oR="start-screen.start-chat",iR="start-screen.footnote",Xt="start-screen.form",kg=`${Xt}.fields`,sR=()=>{const e=Ke(),r=to(),[o,s]=B.useState({}),l=()=>{const b=Object.entries(o).reduce((m,[T,w])=>({...m,[T]:w.value}),{});r(IS(b))},u=e(rR),f=e(oR),h=e(iR),p=B.useMemo(()=>{var b;return((b=e(kg))==null?void 0:b.split(";").map(m=>m.trim()))??[]},[e(kg)]);B.useEffect(()=>{p.length&&Object.keys(o).length===0&&s(p.reduce((b,m)=>({...b,[m]:aR(m,e)}),{}))},[e,p,o]);const v=b=>{b.preventDefault(),l()},_=b=>m=>{s(T=>({...T,[b]:{...T[b],value:m}}))};return y.jsxs("form",{onSubmit:v,className:V(it.container,h&&it.containerWithFootnote,"chat__startScreen"),children:[y.jsxs("div",{className:V(it.body,"chat__startScreen__body"),children:[u&&y.jsx("div",{className:V(it.intro,"chat__startScreen__intro"),children:y.jsx(cn,{options:{overrides:{a:Rg}},children:u})}),y.jsx("div",{className:V(it.formFields,"chat__startScreen__fields"),children:Object.values(o).map(({type:b,name:m,label:T,placeholder:w,defaultValue:D,options:R,required:P,multiple:N,min:E,max:C,pattern:x})=>y.jsx("div",{className:V(it.formField,"chat__startScreen__field"),children:(()=>{switch(b){case"radio":return y.jsxs(y.Fragment,{children:[y.jsx("div",{children:T}),Object.entries(R||{}).map(([F,z])=>y.jsx(tR,{name:m,value:F,label:z,defaultChecked:F===D,required:P,onChange:_(m)}))]});case"checkbox":return y.jsx(Jk,{name:m,label:T,defaultValue:D,required:P,onChange:_(m)});case"select":return y.jsx(nR,{name:m,label:T,defaultValue:D,required:P,multiple:N,options:R,onChange:_(m)});default:return y.jsx(eR,{type:b,name:m,label:T,placeholder:w,defaultValue:D,required:P,multiple:N,min:E,max:C,pattern:x,onChange:_(m)})}})()},m))})]}),y.jsxs("div",{className:V(it.footer,"chat__startScreen__footer"),children:[y.jsx(ii,{type:"submit",className:it.startChatButton,children:f}),h&&y.jsx("div",{className:it.footnote,children:y.jsx(cn,{options:{overrides:{a:Rg}},children:h})})]})]})},Rg=({title:e,href:r,children:o})=>y.jsx("a",{href:r,title:e,target:"_blank",rel:"noopener noreferrer",children:o}),aR=(e,r)=>{const o=r(`${Xt}.${e}.type`)||"text",s=r(`${Xt}.${e}.required`)==="true",l=r(`${Xt}.${e}.multiple`)==="true",u=r(`${Xt}.${e}.placeholder`),f=r(`${Xt}.${e}.label`)||"",h=r(`${Xt}.${e}.defaultValue`),p=r(`${Xt}.${e}.min`),v=r(`${Xt}.${e}.max`),_=r(`${Xt}.${e}.pattern`),b=uR(r(`${Xt}.${e}.options`));return{name:e,label:f,placeholder:u,value:lR(o,h,b)||"",defaultValue:h,options:b,type:o,required:s,multiple:l,min:p,max:v,pattern:_}},lR=(e,r,o)=>r||e==="select"&&Object.keys(o)[0]||"",uR=(e="")=>e.split(";").map(r=>r.trim()).reduce((r,o)=>{const[s,l]=o.split(":").map(u=>u.trim());return{...r,[s]:l}},{}),cR=()=>{const e=la();B.useEffect(()=>{window.document.documentElement.lang=e.locale},[e.locale])},Zr={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"},fR=({clientName:e})=>{cR();const r=to(),o=jt(_=>_.intl.messages),s=Ke(),l=jt(_=>_.settings.enableStartScreen),u=jt(_=>_.startScreen.startScreenStatus),[f,h]=B.useState(void 0);B.useEffect(()=>{const _=ua.parse(window.location.search);_.cssClassName&&h(_.cssClassName);const b=m=>{switch(m.data.type){case Zr.TRIGGER_ACTION:r(m.data.action);break;case Zr.TRIGGER_STORY:r(Z0(m.data.story));break;case Zr.ON_CHAT_WINDOW_OPEN:r({type:"webclient.chatwindow.opened"});break;case Zr.ON_CHAT_WINDOW_CLOSE:r({type:"webclient.chatwindow.closed"});break;case Zr.CHAT_MESSAGE_FROM_GUEST:r(G0(m.data.text));break;case Zr.RESTART_CHAT:r(ga(e,_));break}};return r(jS(e,_)),window.addEventListener("message",m=>b(m),!1),()=>window.removeEventListener("message",b)},[e,r]),B.useEffect(()=>{const _=s("page.title");_&&document&&(document.title=_)},[o,s]);const p=l===void 0,v=l===!1||u==="HIDDEN";return y.jsx("div",{className:V(Cg.chatwindow,v&&Cg.chatwindowWithAside,"chat__chatwindow",f),children:p?null:v?y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(Tg,{})}),y.jsx("main",{children:y.jsx(ok,{clientName:e})}),y.jsx("aside",{children:y.jsx(Fk,{})})]}):y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(Tg,{withActions:!1})}),y.jsx("main",{children:y.jsx(sR,{})})]})})},dR=1024,hR=()=>{const e=Uy(),r=jt(u=>u.intl.locale),o=jt(u=>u.intl.messages),[s,l]=B.useState(Og());return B.useEffect(()=>{const u=()=>{l(Og())};return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[]),y.jsx(Jw,{locale:r,messages:o,children:y.jsx("div",{className:V([tb.app,s?"chat__large":"chat__small"]),children:y.jsx(fR,{clientName:e})})})},Og=()=>window.innerWidth>=dR;var Ju,Ng;function Tf(){if(Ng)return Ju;Ng=1;function e(r){var o=typeof r;return r!=null&&(o=="object"||o=="function")}return Ju=e,Ju}var ec,Ag;function pR(){if(Ag)return ec;Ag=1;var e=typeof ys=="object"&&ys&&ys.Object===Object&&ys;return ec=e,ec}var tc,Ig;function zy(){if(Ig)return tc;Ig=1;var e=pR(),r=typeof self=="object"&&self&&self.Object===Object&&self,o=e||r||Function("return this")();return tc=o,tc}var nc,Dg;function mR(){if(Dg)return nc;Dg=1;var e=zy(),r=function(){return e.Date.now()};return nc=r,nc}var rc,Pg;function gR(){if(Pg)return rc;Pg=1;var e=/\s/;function r(o){for(var s=o.length;s--&&e.test(o.charAt(s)););return s}return rc=r,rc}var oc,Mg;function yR(){if(Mg)return oc;Mg=1;var e=gR(),r=/^\s+/;function o(s){return s&&s.slice(0,e(s)+1).replace(r,"")}return oc=o,oc}var ic,Fg;function Gy(){if(Fg)return ic;Fg=1;var e=zy(),r=e.Symbol;return ic=r,ic}var sc,Lg;function vR(){if(Lg)return sc;Lg=1;var e=Gy(),r=Object.prototype,o=r.hasOwnProperty,s=r.toString,l=e?e.toStringTag:void 0;function u(f){var h=o.call(f,l),p=f[l];try{f[l]=void 0;var v=!0}catch{}var _=s.call(f);return v&&(h?f[l]=p:delete f[l]),_}return sc=u,sc}var ac,Bg;function _R(){if(Bg)return ac;Bg=1;var e=Object.prototype,r=e.toString;function o(s){return r.call(s)}return ac=o,ac}var lc,jg;function ER(){if(jg)return lc;jg=1;var e=Gy(),r=vR(),o=_R(),s="[object Null]",l="[object Undefined]",u=e?e.toStringTag:void 0;function f(h){return h==null?h===void 0?l:s:u&&u in Object(h)?r(h):o(h)}return lc=f,lc}var uc,Ug;function wR(){if(Ug)return uc;Ug=1;function e(r){return r!=null&&typeof r=="object"}return uc=e,uc}var cc,Hg;function bR(){if(Hg)return cc;Hg=1;var e=ER(),r=wR(),o="[object Symbol]";function s(l){return typeof l=="symbol"||r(l)&&e(l)==o}return cc=s,cc}var fc,zg;function SR(){if(zg)return fc;zg=1;var e=yR(),r=Tf(),o=bR(),s=NaN,l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,f=/^0o[0-7]+$/i,h=parseInt;function p(v){if(typeof v=="number")return v;if(o(v))return s;if(r(v)){var _=typeof v.valueOf=="function"?v.valueOf():v;v=r(_)?_+"":_}if(typeof v!="string")return v===0?v:+v;v=e(v);var b=u.test(v);return b||f.test(v)?h(v.slice(2),b?2:8):l.test(v)?s:+v}return fc=p,fc}var dc,Gg;function xR(){if(Gg)return dc;Gg=1;var e=Tf(),r=mR(),o=SR(),s="Expected a function",l=Math.max,u=Math.min;function f(h,p,v){var _,b,m,T,w,D,R=0,P=!1,N=!1,E=!0;if(typeof h!="function")throw new TypeError(s);p=o(p)||0,e(v)&&(P=!!v.leading,N="maxWait"in v,m=N?l(o(v.maxWait)||0,p):m,E="trailing"in v?!!v.trailing:E);function C(le){var Ue=_,Ie=b;return _=b=void 0,R=le,T=h.apply(Ie,Ue),T}function x(le){return R=le,w=setTimeout(W,p),P?C(le):T}function F(le){var Ue=le-D,Ie=le-R,$e=p-Ue;return N?u($e,m-Ie):$e}function z(le){var Ue=le-D,Ie=le-R;return D===void 0||Ue>=p||Ue<0||N&&Ie>=m}function W(){var le=r();if(z(le))return he(le);w=setTimeout(W,F(le))}function he(le){return w=void 0,E&&_?C(le):(_=b=void 0,T)}function te(){w!==void 0&&clearTimeout(w),R=0,_=D=b=w=void 0}function ce(){return w===void 0?T:he(r())}function pe(){var le=r(),Ue=z(le);if(_=arguments,b=this,D=le,Ue){if(w===void 0)return x(D);if(N)return clearTimeout(w),w=setTimeout(W,p),C(D)}return w===void 0&&(w=setTimeout(W,p)),T}return pe.cancel=te,pe.flush=ce,pe}return dc=f,dc}var hc,$g;function TR(){if($g)return hc;$g=1;var e=xR(),r=Tf(),o="Expected a function";function s(l,u,f){var h=!0,p=!0;if(typeof l!="function")throw new TypeError(o);return r(f)&&(h="leading"in f?!!f.leading:h,p="trailing"in f?!!f.trailing:p),e(l,u,{leading:h,maxWait:u,trailing:p})}return hc=s,hc}var CR=TR();const kR=sa(CR);function RR(e){return e&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function OR(e){return e}function NR(e,r){r=r||{};const o=r.delimiter||".",s=r.maxDepth,l=r.transformKey||OR,u={};function f(h,p,v){v=v||1,Object.keys(h).forEach(function(_){const b=h[_],m=r.safe&&Array.isArray(b),T=Object.prototype.toString.call(b),w=RR(b),D=T==="[object Object]"||T==="[object Array]",R=p?p+o+l(_):l(_);if(!m&&!w&&D&&Object.keys(b).length&&(!r.maxDepth||v<s))return f(b,R,v+1);u[R]=b})}return f(e),u}const $y={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht","message-input.actions.submit.label":"Nachricht senden","message-input.actions.export-transcript.label":"Konversation exportieren","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.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","agent-bubble.label":"Nachricht des Live-Agenten","export-transcript.email.title":"Konversation per E-Mail versenden","export-transcript.email.description":"Geben Sie Ihre E-Mail-Adresse ein, um den Chatverlauf zu erhalten.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"Ihre E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Ich habe den Chatverlauf an Ihre E-Mail-Adresse gesendet.","export-transcript.pdf.title":"Konversation als PDF erhalten","export-transcript.pdf.description":"Laden Sie die Konversation als PDF herunter.","export-transcript.pdf.cancel":"Abbrechen","export-transcript.pdf.download":"Herunterladen","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
|
|
97
|
+
`).map((h,p)=>y.jsxs("span",{className:mg.text,children:[y.jsx(fT,{componentDecorator:l,children:h}),y.jsx("br",{})]},p))]})},pT=({subtitle:e,onLinkClick:r})=>e?y.jsx("div",{className:wt.subtitle,children:y.jsx(My,{text:e,onLinkClick:r})}):null,gg="newtab#",Fy=({markdown:e,markdownOptions:r={},onLinkClick:o})=>{const s=u=>f=>(f.preventDefault(),u&&o(u),!1),l=({title:u,href:f,children:h})=>f.indexOf(gg)===0?y.jsx("a",{href:f.slice(gg.length),title:u,target:"_blank",rel:"noopener noreferrer",children:h}):y.jsx("a",{onClick:s(f),title:u,href:f,children:h});return y.jsx(cn,{options:{...r,overrides:{a:l}},children:e})},mT=({text:e,onLinkClick:r})=>e?y.jsx("div",{children:y.jsx(Fy,{markdown:e,onLinkClick:r})}):null,gT=({title:e})=>e?y.jsx("h1",{className:wt.title,children:e}):null,yT=({title:e,text:r,subtitle:o,buttons:s,onButtonClick:l,onLinkClick:u})=>(e==null?void 0:e.length)||(r==null?void 0:r.length)||(o==null?void 0:o.length)||(s==null?void 0:s.length)?y.jsxs("div",{className:V(fe.bubbleContent),children:[y.jsx(gT,{title:e}),y.jsx(mT,{text:r,onLinkClick:u}),y.jsx(pT,{subtitle:o,onLinkClick:u}),y.jsx(Q2,{buttons:s,onButtonClick:l})]}):null,vT=({alt:e,imageUrl:r,itemUrl:o,hasBody:s})=>r?o?o.indexOf("youtube.com")>-1?y.jsx("div",{className:wt.video_container,children:y.jsx("iframe",{className:V(wt.video,{[wt.only]:!s}),title:"Youtube",width:"100%",src:o+"?rel=0",frameBorder:"0",allowFullScreen:!0})}):y.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:y.jsx("div",{className:wt.imageContainer,children:y.jsx("img",{className:V(wt.image,{[wt.only]:!s}),src:r,alt:e})})}):y.jsx("div",{className:wt.imageContainer,children:y.jsx("img",{className:V(wt.image,{[wt.only]:!s}),src:r,alt:e})}):null,_T=({title:e,text:r,subtitle:o,imageUrl:s,itemUrl:l,buttons:u,sources:f,onButtonClick:h,onLinkClick:p})=>{const v=!!(e!=null&&e.length)||!!(r!=null&&r.length)||!!(o!=null&&o.length)||!!(u!=null&&u.length);return y.jsxs("div",{className:V(wt.detailMessage),children:[y.jsx(vT,{hasBody:v,imageUrl:s,itemUrl:l,alt:e||o}),v&&y.jsx(yT,{title:e,text:r,subtitle:o,buttons:u,onLinkClick:p,onButtonClick:h}),y.jsx(Sf,{sources:f,onLinkClick:p})]})},ET=B.forwardRef(({isFirstMessageBySender:e,isLastMessageBySender:r,children:o},s)=>{const l=Ke();return y.jsx("li",{ref:s,className:V(fe.message,fe.messageGuest,e&&fe.messageGuestFirst,r&&fe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer",e&&"chat__bubbleContainer--first",r&&"chat__bubbleContainer--last"),children:y.jsx("div",{className:V(fe.bubble,fe.bubbleRight,"chat__bubble","chat__guestBubble"),tabIndex:0,"aria-label":l("guest-bubble.label"),children:y.jsx("div",{className:V(fe.rightText),children:o})})})}),wT="_markdown_nw7vg_1",Ly={markdown:wT},zs="source-info-reference",bT=({markdown:e,sources:r,onLinkClick:o})=>{const s=to(),l=ST(),u=h=>p=>{const v=p.key;(v==="ArrowDown"||v==="ArrowRight"||v==="Enter"||v===" "||v==="Space")&&(p.stopPropagation(),s(Wm(h)))},f=h=>()=>{s(Wm(h))};return B.useLayoutEffect(()=>{document.querySelectorAll(`.${zs}`).forEach(h=>{var _,b,m,T;const p=h.previousSibling;p&&p.nodeType===Node.TEXT_NODE&&((_=p.textContent)!=null&&_.endsWith(" "))&&((b=p.textContent)!=null&&b.trim().length)&&h.classList.add(`${zs}--before-space`);const v=h.nextSibling;v&&v.nodeType===Node.TEXT_NODE&&((m=v.textContent)!=null&&m.startsWith(" "))&&((T=v.textContent)!=null&&T.trim().length)&&h.classList.add(`${zs}--after-space`)})},[e]),y.jsxs("div",{className:fe.bubbleContent,children:[y.jsx("div",{className:Ly.markdown,children:y.jsx(Fy,{markdown:e,onLinkClick:o,markdownOptions:{renderRule(h,p,v,_){return p.type===ie.footnoteReference?y.jsx("span",{className:V(fe.sourceInfoReference,zs),children:y.jsx("a",{type:"button",tabIndex:0,onClick:f(p.text),onKeyDown:u(p.text),children:l(p.text)})},_.key):h()}}})}),y.jsx(Sf,{sources:r,onLinkClick:o})]})},ST=()=>{const e=[];return o=>{const s=e.indexOf(o);return s>-1?s+1:(e.push(o),e.length)}},xT=({text:e,commands:r,sources:o,onLinkClick:s})=>y.jsxs("div",{className:fe.bubbleContent,children:[y.jsx(My,{text:e,commands:r,onLinkClick:s}),y.jsx(Sf,{sources:o,onLinkClick:s})]}),TT=B.forwardRef(({message:e,commands:r,isLastMessage:o,isFirstMessageBySender:s,isLastMessageBySender:l,onReaction:u,onButtonClick:f,onLinkClick:h},p)=>{const v=CT(e,r,f,h);switch(e.sender.type){case ge.UserType.GUEST:return y.jsx(ET,{ref:p,isFirstMessageBySender:s,isLastMessageBySender:l,children:v});default:{const _=b=>u(e._id,b);return y.jsx(Ny,{ref:p,message:e,isAnimated:!1,isLastMessage:o,isFirstMessageBySender:s,isLastMessageBySender:l,onReaction:_,children:v})}}}),CT=(e,r,o,s)=>{switch(e.type){case ge.MessageTypeEnum.TEXT:{const l=e;return y.jsx(xT,{text:l.text,commands:r,sources:e.sources||[],onLinkClick:s})}case ge.MessageTypeEnum.DETAIL:{const l=e;return y.jsx(_T,{title:l.title,text:l.text,subtitle:l.subtitle,imageUrl:l.imageUrl,itemUrl:l.itemUrl,buttons:l.buttons,sources:e.sources||[],onButtonClick:o,onLinkClick:s})}case ge.MessageTypeEnum.MARKDOWN:{const l=e;return y.jsx(bT,{markdown:l.markdown,sources:l.sources||[],onLinkClick:s})}}},kT=(e,r)=>e.message._id===r.message._id&&e.message.reaction===r.message.reaction&&e.isLastMessage===r.isLastMessage&&e.isFirstMessageBySender===r.isFirstMessageBySender&&e.isLastMessageBySender===r.isLastMessageBySender,RT=e0.memo(TT,kT),OT="_ticontainer_xg0dn_1",NT="_tiblock_xg0dn_5",AT="_tidot_xg0dn_12",Qo={ticontainer:OT,tiblock:NT,tidot:AT},IT=({isTyping:e=!1})=>y.jsx("div",{className:Qo.ticontainer,children:y.jsx("div",{className:Qo.tiblock,children:e?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:V(Qo.tidot,"chat__typingIndicator")}),y.jsx("div",{className:V(Qo.tidot,"chat__typingIndicator")}),y.jsx("div",{className:V(Qo.tidot,"chat__typingIndicator")})]}):null})}),DT=Object.assign({_id:"typing-indicator"},new ge.TextMessage("",new ge.BotUser)),PT=({messages:e,isBotTyping:r,commands:o,onTranscriptItemReaction:s,onButtonClick:l,onLinkClick:u})=>{const f=B.useRef(0),h=B.useRef(!0),p=B.useRef(null),v=B.useRef(null),_=B.useRef(null),b=jt(w=>w.settings.enableGeneralConditions);B.useLayoutEffect(()=>{if(e.length&&p.current&&(f.current<e.length||r)){if(v.current){const w=v.current.offsetTop;p.current.scrollTop=w}else if(_.current){const w=_.current.offsetTop;p.current.scrollTop=w}h.current&&(h.current=!1),f.current=e.length}},[e,h,r]);let m;const T=e.length;return y.jsxs("div",{ref:p,className:V(Km.messageContainer,"chat__messageContainer"),style:{scrollBehavior:e.length&&h.current?"auto":"smooth"},id:"MessageContainer",role:"log","aria-live":"polite",children:[b&&y.jsx(c2,{}),y.jsxs("ul",{className:Km.messages,children:[e.map((w,D)=>{const R=MT(w,m),P=FT(w,D,e,r);m=w.sender.type;const N=D+1===T;return y.jsx(RT,{ref:N?_:null,message:w,commands:o,isLastMessage:N,isFirstMessageBySender:R,isLastMessageBySender:P,onButtonClick:l,onLinkClick:u,onReaction:s},N&&!r?"last":w._id)}),r&&y.jsx(Ny,{ref:v,message:DT,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:m!==ge.UserType.BOT,isLastMessageBySender:!0,children:y.jsx(IT,{isTyping:!0})},"last")]})]})},MT=(e,r)=>!r||r!==e.sender.type,FT=(e,r,o,s)=>{var h;const l=e.sender.type,u=o.length;return r+1===u?!(l===ge.UserType.BOT&&s):l!==((h=o.at(r+1))==null?void 0:h.sender.type)},LT="_bottomSheet_jp8dl_1",BT="_bottomSheetOpen_jp8dl_15",jT="_bottomSheetClose_jp8dl_20",kn={bottomSheet:LT,bottomSheetOpen:BT,bottomSheetClose:jT},UT="_container_xc2nx_1",yg={container:UT},HT=({contentUrl:e})=>{const r=jt(u=>u.connection.sessionId),[o,s]=B.useState(!1);B.useEffect(()=>{s(u=>u||!!e)},[e]);const l=B.useMemo(()=>{if(e&&r){const u=new URL(e,document.baseURI);return u.searchParams.set("sessionId",r),u.toString()}else return},[e,r]);return y.jsx("div",{className:V(yg.container,kn.bottomSheet,{[kn.bottomSheetOpen]:!!e,[kn.bottomSheetClose]:o&&!e}),children:l&&y.jsx("iframe",{title:"Drawer",src:l,className:yg.iframe})})},zT="_container_tr4tn_1",GT={container:zT},$T=({title:e,href:r,children:o})=>y.jsx("a",{href:r,title:e,target:"_blank",rel:"noopener noreferrer",children:o}),VT=()=>{const r=Ke()("powered-by");return r&&r.length?y.jsx("div",{className:V(GT.container,"chat__poweredBy"),children:y.jsx(cn,{options:{overrides:{a:$T}},children:r})}):null},vg=({className:e,children:r,...o})=>y.jsx(va,{className:V(oi.buttonDefault,e),type:"button",...o,children:r}),ii=({className:e,children:r,...o})=>y.jsx(va,{className:V(oi.buttonPrimary,e),...o,children:r}),qT="_container_h23mk_1",WT="_formContainer_h23mk_17",KT="_emailInput_h23mk_22",ZT="_description_h23mk_52",QT="_actions_h23mk_57",XT="_validationError_h23mk_67",YT="_submitted_h23mk_74",xn={container:qT,formContainer:WT,emailInput:KT,description:ZT,actions:QT,validationError:XT,submitted:YT},JT=({visible:e,enableTranscriptExportPdf:r,enableTranscriptExportEmail:o,onEmailExport:s,onPdfExport:l,onClose:u})=>{const f=Ke(),[h,p]=B.useState(void 0),[v,_]=B.useState(!1),[b,m]=B.useState(!1),[T,w]=B.useState(void 0),D=B.useRef(null);B.useEffect(()=>{var E;e?((E=D.current)==null||E.focus(),_(!1),m(!1),p(e)):h===!0&&p(!1)},[e,h]);const R=E=>{E.preventDefault(),T&&T.length>0&&(s(T),_(!0),setTimeout(u,3*1e3))},P=E=>{const C=E.target.value.trim(),x=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(C);w(x?C:"")},N=()=>{m(!0),l(),setTimeout(u,3*1e3)};return y.jsxs("div",{className:V(xn.container,kn.bottomSheet,{[kn.bottomSheetOpen]:h===!0,[kn.bottomSheetClose]:h===!1}),children:[r&&y.jsxs(y.Fragment,{children:[y.jsx("h2",{children:f("export-transcript.pdf.title")}),y.jsx(cn,{className:xn.description,children:f("export-transcript.pdf.description")||""}),y.jsxs("div",{className:xn.actions,children:[y.jsx(vg,{onClick:u,children:f("export-transcript.pdf.cancel")}),y.jsx(ii,{onClick:N,disabled:b,children:f("export-transcript.pdf.download")})]})]}),o&&y.jsxs(y.Fragment,{children:[y.jsx("h2",{children:f("export-transcript.email.title")}),y.jsx(cn,{className:xn.description,children:f("export-transcript.email.description")||""}),y.jsxs("form",{onSubmit:R,className:xn.formContainer,children:[y.jsxs("div",{children:[y.jsx("input",{disabled:v,ref:D,type:"email",placeholder:f("export-transcript.email.placeholder"),className:xn.emailInput,onChange:P}),(T==null?void 0:T.length)===0?y.jsx("div",{className:xn.validationError,children:f("export-transcript.email.invalid")}):null]}),y.jsxs("div",{className:xn.actions,children:[y.jsx(vg,{onClick:u,children:f("export-transcript.email.cancel")}),y.jsx(ii,{type:"submit",disabled:v||T===void 0||T.length===0,children:f("export-transcript.email.send")})]})]}),v&&y.jsx("div",{className:xn.submitted,children:f("export-transcript.email.success")})]})]})},eC="_inputContainer_fi5ao_1",tC={inputContainer:eC},nC="_blockUserInput_pot9c_1",rC={blockUserInput:nC},oC=({visible:e})=>{const r=Ke();return e?y.jsx("div",{className:V(rC.blockUserInput,"chat__blockUserInput"),children:r("block-user-input.title")}):null},iC="_commandsDropdown_5ytuv_1",sC="_commands_5ytuv_1",aC="_command_5ytuv_1",lC="_commandActive_5ytuv_46",uC="_commandsSelections_5ytuv_55",Jo={commandsDropdown:iC,commands:sC,command:aC,commandActive:lC,commandsSelections:uC},cC=(e,r)=>{B.useEffect(()=>{const o=s=>{e.current&&!e.current.contains(s.target)&&r()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r])},fC=(e,r,o,s,l)=>{B.useEffect(()=>{const u=f=>{if(e.length)switch(f.key){case"Enter":o(e[r]);break;case"ArrowUp":s(h=>h>0?h-1:e.length-1);break;case"ArrowDown":s(h=>h<e.length-1?h+1:0);break;case"Escape":l([]);break}};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[e,r,o,s,l])},dC=({text:e,commands:r,onSelectCommand:o,onVisibilityChange:s})=>{const l=B.useRef(null),u=Ke(),[f,h]=B.useState([]),[p,v]=B.useState(_g(r)),[_,b]=B.useState(0),m=T=>o(`/${T}`);return cC(l,()=>h([])),fC(f,_,m,b,h),B.useEffect(()=>{v(_g(r))},[r]),B.useEffect(()=>{const T=e.length||0;T===0||T>p||!e.startsWith("/")?h([]):h(r.filter(hC(e))),b(0)},[r,e,p]),B.useEffect(()=>{s(!!f.length)},[f,s]),f.length?y.jsx("div",{ref:l,className:Jo.commandsDropdown,children:y.jsx("ul",{className:Jo.commands,role:"listbox",children:f.map((T,w)=>y.jsxs("li",{className:V([Jo.command,_===w&&Jo.commandActive]),role:"option",onClick:()=>m(T),onMouseOver:()=>b(w),children:[y.jsxs("h1",{children:["/",T]}),y.jsx("p",{children:u(`commands.${T}`)})]},T))})}):null},_g=e=>Math.max(...e.map(r=>r.length+1)),hC=e=>r=>{const o=`/${r}`;return o.startsWith(e)&&o.length>=e.length},Eg=3,pC=({commands:e,onSelectCommand:r})=>{const o=Ke(),[s,l]=B.useState(!1),u=v=>()=>{r(`/${v}`),l(!1)},f=()=>{l(!0)},h=()=>{l(!1)},p=s?e:e.slice(0,Eg);return y.jsxs("div",{className:Jo.commandsSelections,children:[p.map(v=>y.jsxs("button",{onClick:u(v),children:["/",v]})),p.length<e.length?y.jsx("button",{"aria-label":o("commands.show-more.tooltip"),"data-title":o("commands.show-more.tooltip"),tabIndex:0,onClick:f,children:o("commands.show-more.action")},"show-more"):p.length>Eg?y.jsx("button",{"aria-label":o("commands.show-less.tooltip"),"data-title":o("commands.show-less.tooltip"),tabIndex:0,onClick:h,children:o("commands.show-less.action")},"show-less"):null]})},mC="_callToActionContainer_bkfcm_1",gC="_callToActionTitle_bkfcm_23",yC="_rateOverlay_bkfcm_30",vC="_body_bkfcm_52",_C="_footer_bkfcm_60",EC="_actions_bkfcm_73",wC="_bubbles_bkfcm_101",bC="_stars_bkfcm_203",SC="_starsSmall_bkfcm_215",xC="_starsLarge_bkfcm_219",TC="_star_bkfcm_203",CC="_starReadonly_bkfcm_236",kC="_starIcon_bkfcm_246",RC="_starsDescriptionContainer_bkfcm_264",OC="_starsDescription_bkfcm_264",pt={callToActionContainer:mC,callToActionTitle:gC,rateOverlay:yC,body:vC,footer:_C,actions:EC,bubbles:wC,stars:bC,starsSmall:SC,starsLarge:xC,star:TC,starReadonly:CC,starIcon:kC,starsDescriptionContainer:RC,starsDescription:OC},NC=({value:e,index:r,count:o,readonly:s,onHover:l,onClick:u})=>{const f=h=>{u&&h.key==="Enter"&&u()};return y.jsx("li",{className:V(pt.star,{[pt.starReadonly]:s},"chat__conversationRating__star"),children:y.jsx("div",{role:"radio","aria-checked":e>r?"true":"false","aria-posinset":r+1,"aria-setsize":o,tabIndex:0,onMouseOver:l,onKeyDown:f,onClick:u,children:y.jsx("span",{role:"img","aria-label":"Star",className:V(pt.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"})})})})})},wg=5,By=({value:e,size:r,readonly:o=!1,onChange:s})=>{const[l,u]=B.useState(void 0),f=()=>{u(void 0)},h=v=>()=>{if(!o){const _=v+1;u(_)}},p=v=>()=>{s&&!o&&(s(v===0&&e===1?0:v+1),u(void 0))};return y.jsx("ul",{tabIndex:0,role:"radiogroup",className:V(pt.stars,{[pt.starsSmall]:r==="small",[pt.starsLarge]:r==="large"},"chat__conversationRating__stars",{chat__conversationRating__stars__small:r==="small",chat__conversationRating__stars__large:r==="large"}),onMouseOut:f,children:Array(wg).fill(0).map((v,_)=>y.jsx(NC,{value:l===void 0?e:l,index:_,count:wg,readonly:o,onHover:h(_),onClick:p(_)},_))})},AC=({visible:e,onRate:r})=>{const o=Ke();return e?y.jsxs("div",{className:V(pt.callToActionContainer,"chat__conversationRating__callToAction"),children:[y.jsx("div",{className:V(pt.callToActionTitle,"chat__conversationRating__callToAction__title"),children:o("conversation-rating.call-to-action.title")}),y.jsx(By,{value:0,size:"small",onChange:r})]}):null},Yu=({isFirstMessageBySender:e,isLastMessageBySender:r,children:o})=>y.jsxs("div",{className:V(fe.message,fe.messageBot,e&&fe.messageBotFirst,r&&fe.messageBotLast,"chat__bubbleContainer","chat__botBubbleContainer",e&&"chat__bubbleContainer--first",r&&"chat__bubbleContainer--last"),children:[y.jsx("img",{className:V(fe.avatar,fe.botAvatar),src:"bot.svg",alt:"Bot"}),y.jsx("div",{className:V(fe.bubble,fe.bubbleLeft,"chat__bubble","chat__botBubble"),children:y.jsx("div",{className:V(fe.leftText,fe.bubbleContent),children:o})})]}),IC=({children:e})=>y.jsx("div",{className:V(fe.message,fe.messageGuest,fe.messageGuestFirst,fe.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer","chat__bubbleContainer--first","chat__bubbleContainer--last"),children:y.jsx("div",{className:V(fe.bubble,fe.bubbleRight,"chat__bubble","chat__guestBubble"),children:y.jsx("div",{className:V(fe.rightText,fe.bubbleContent),children:e})})}),DC=({visible:e,rating:r,onRate:o,onClose:s})=>{const l=Ke(),[u,f]=B.useState(r),[h,p]=B.useState(void 0),[v,_]=B.useState(void 0),[b,m]=B.useState({submitted:!1,feedback:""}),[T,w]=B.useState(!1),D=B.useRef(null);B.useEffect(()=>{e?(m({submitted:!1,feedback:""}),_(e)):v===!0&&_(!1)},[e,v]),B.useEffect(()=>{f(r)},[r]),B.useEffect(()=>{const P=l(`conversation-rating.overlay.bot-message.rate-feedback.value-${u}`);p(P!=null&&P.length?P:void 0)},[u,l]),B.useEffect(()=>{b.submitted?setTimeout(()=>w(!0),b.feedback.length?500:0):w(!1)},[b]);const R=P=>{var E,C;P.preventDefault();const N=((C=(E=D.current)==null?void 0:E.value)==null?void 0:C.trim())||"";o(u,N),m({submitted:!0,feedback:N})};return y.jsx("div",{className:V(pt.rateOverlay,kn.bottomSheet,"chat__conversationRating__overlay",{[kn.bottomSheetOpen]:v===!0,[kn.bottomSheetClose]:v===!1}),children:y.jsxs("form",{onSubmit:R,children:[y.jsxs("div",{className:V(pt.body,"chat__conversationRating__overlay__body"),children:[y.jsx("div",{}),y.jsx("div",{className:V(pt.bubbles),children:e&&h&&y.jsxs(y.Fragment,{children:[y.jsxs(Yu,{isFirstMessageBySender:!0,isLastMessageBySender:!1,children:[y.jsx("h2",{children:l("conversation-rating.overlay.title")}),y.jsxs("div",{className:V(pt.starsDescriptionContainer),children:[y.jsx(By,{value:u,size:"large",readonly:b.submitted,onChange:f}),y.jsxs("div",{className:V(pt.starsDescription),children:[y.jsx("div",{children:l("conversation-rating.overlay.star.very-bad")}),y.jsx("div",{children:l("conversation-rating.overlay.star.very-good")})]})]})]}),y.jsx(Yu,{isFirstMessageBySender:!1,isLastMessageBySender:!T||!!b.feedback.length,children:y.jsx("div",{children:h})}),!!b.feedback.length&&y.jsx(IC,{children:b.feedback}),T&&y.jsx(Yu,{isFirstMessageBySender:!!b.feedback.length,isLastMessageBySender:!0,children:y.jsx("div",{children:l("conversation-rating.overlay.bot-message.submit-feedback")})})]})})]}),y.jsxs("div",{className:V(pt.footer,"chat__conversationRating__overlay__footer"),children:[!b.submitted&&y.jsx("input",{ref:D,placeholder:l("conversation-rating.overlay.guest-feedback.input-placeholder")}),y.jsx("div",{className:V(pt.actions,"chat__conversationRating__overlay__footer__actions"),children:b.submitted?y.jsx(ii,{type:"button",onClick:s,children:l("conversation-rating.overlay.action.close")}):y.jsx(ii,{type:"submit",children:l("conversation-rating.overlay.action.submit")})})]})]})})},PC=({conversationRating:{enabled:e,rating:r},numberOfMessagesFromGuest:o,showRatingOverlay:s,setShowRatingOverlay:l,onRate:u})=>{const[f,h]=B.useState(0),p=b=>{h(b),l(!0)},v=()=>l(!1),_=!r&&o>=1;return e?y.jsxs(y.Fragment,{children:[y.jsx(AC,{visible:_,onRate:p}),y.jsx(DC,{visible:s,rating:f,onRate:u,onClose:v})]}):null},MC="_inputWrapper_e3h44_1",FC="_withOpenCommands_e3h44_14",LC="_messageInputWrapper_e3h44_20",BC="_messageInput_e3h44_20",jC="_buttons_e3h44_44",UC="_button_e3h44_44",mr={inputWrapper:MC,withOpenCommands:FC,messageInputWrapper:LC,messageInput:BC,buttons:jC,button:UC},HC="_audioRecorder_g845f_1",zC="_audioButton_g845f_6",GC="_recorderIcon_g845f_37",$C="_spinning_g845f_60",gr={audioRecorder:HC,audioButton:zC,recorderIcon:GC,spinning:$C},bg=2048,ia=16e3;class VC extends e0.Component{constructor(o){super(o);xe(this,"audioInput",null);xe(this,"volume",null);xe(this,"leftchannel",[]);xe(this,"recorder",null);xe(this,"recordingLength",0);xe(this,"sampleRate",null);xe(this,"mediaStream",null);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(o){this.mediaStream=o,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(o)}initRecording(o){const s=window.AudioContext||window.webkitAudioContext,l=new s;this.sampleRate=l.sampleRate,this.volume=l.createGain(),this.audioInput=l.createMediaStreamSource(o),this.audioInput.connect(this.volume),this.recorder=l.createScriptProcessor(bg,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(l.destination)}processRecordingInput(o){if(this.state.recordingState==="connecting"&&this.setState({recordingState:"recording"}),this.state.recordingState!=="none"){const s=o.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(s)),this.recordingLength+=bg}}handleClickSubmitAudio(){const o=WC(this.leftchannel,this.recordingLength),s=KC(o,this.sampleRate||0),l=qC(s);this.props.onAudioRecorded(l),this.handleClickStopAudio()}handleClickStopAudio(){var o,s,l,u;this.setState({recordingState:"none"}),(o=this.audioInput)==null||o.disconnect(),(s=this.volume)==null||s.disconnect(),(l=this.recorder)==null||l.disconnect(),this.mediaStream&&((u=this.mediaStream)==null||u.getAudioTracks().forEach(f=>{f.stop()}))}render(){return y.jsxs("div",{className:gr.audioRecorder,children:[this.state.recordingState==="none"&&y.jsx("button",{className:V(gr.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:gr.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:gr.audioRecorder,children:[y.jsx("button",{className:V(gr.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:gr.recorderIcon}),y.jsx("button",{className:V(gr.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 qC=e=>{const r=new ArrayBuffer(44+e.length*2),o=new DataView(r);Gs(o,0,"RIFF"),o.setUint32(4,44+e.length*2,!0),Gs(o,8,"WAVE"),Gs(o,12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,ia,!0),o.setUint32(28,ia*4,!0),o.setUint16(32,4,!0),o.setUint16(34,16,!0),Gs(o,36,"data"),o.setUint32(40,e.length*2,!0);const s=e.length;let l=44;const u=1;for(let f=0;f<s;f++)o.setInt16(l,e[f]*(32767*u),!0),l+=2;return new Blob([o],{type:"audio/wav"})},Gs=(e,r,o)=>{for(let s=0;s<o.length;s++)e.setUint8(r+s,o.charCodeAt(s))},WC=(e,r)=>{const o=new Float32Array(r);let s=0;const l=e.length;for(let u=0;u<l;u++){const f=e[u];o.set(f,s),s+=f.length}return o},KC=(e,r)=>{if(ia===r)return e;const o=r/ia,s=Math.round(e.length/o),l=new Float32Array(s);let u=0,f=0;for(;u<l.length;){const h=Math.round((u+1)*o);let p=0,v=0;for(let _=f;_<h&&_<e.length;_++)p+=e[_],v++;l[u]=p/v,u++,f=h}return l},ZC=({disabled:e,textInput:r,commandsVisible:o,onTextInput:s,onTextInputSubmit:l,onAudioRecorded:u,onOpenTranscriptExportModal:f})=>{const h=Ke(),p=B.useRef(null),{enableTranscriptExportPdf:v,enableTranscriptExportEmail:_,enableSpeechSupport:b}=jt(R=>R.settings);B.useEffect(()=>{var R;(R=p.current)==null||R.focus()},[r]);const m=()=>{const R=p.current;R&&r.trim().length>=1&&l(r.trim())&&(R.value="",R.style.height="",R.focus())},T=R=>{R.preventDefault(),m()},w=R=>{const P=R.target.value;s(P),R.target.style.height="";const{scrollHeight:N}=R.target;R.target.style.height=`${N>150?150:N}px`},D=R=>{R.code==="Enter"&&!R.shiftKey?(R.repeat||m(),R.preventDefault()):o&&(R.code==="ArrowUp"||R.code==="ArrowDown")&&R.preventDefault()};return y.jsxs("form",{className:V(mr.inputWrapper,o&&mr.withOpenCommands,"chat__textInput"),onSubmit:T,children:[y.jsx("div",{className:mr.messageInputWrapper,children:y.jsx("textarea",{id:"user_input",ref:p,className:mr.messageInput,tabIndex:0,placeholder:h("message-input-placeholder"),value:r,onChange:w,onKeyDown:D,"aria-label":h("message-input-label"),"aria-controls":"command-list","aria-haspopup":"listbox"})}),y.jsxs("div",{className:V(mr.buttons,"chat__buttons"),children:[!r.length&&(v||_)&&y.jsx("button",{type:"button",className:V(mr.button,"chat__button"),"aria-label":h("message-input.actions.export-transcript.label"),"data-title":h("message-input.actions.export-transcript.label"),tabIndex:0,onClick:f,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:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"})})}),r.length||!b||navigator.mediaDevices===void 0?y.jsx("button",{className:V(mr.button,"chat__button"),type:"submit","aria-label":h("message-input.actions.submit.label"),"data-title":h("message-input.actions.submit.label"),tabIndex:0,disabled:e,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"})})}):b&&navigator.mediaDevices!==void 0&&y.jsx(VC,{translate:h,onAudioRecorded:u})]})]})},QC="_quickReplies_83npe_1",XC="_quickReply_83npe_9",Sg={quickReplies:QC,quickReply:XC},YC=({quickReplies:e,onQuickReplyClick:r})=>e.length?y.jsx("div",{className:V(Sg.quickReplies,"chat__quickReplies"),children:e.map(o=>y.jsx(va,{tabIndex:0,className:V(Sg.quickReply,"chat__button","chat__quickReply"),onClick:()=>r(o),children:o.label},o.label))}):null,xg=5e3,JC=1e3,ek=({isBotTyping:e,quickReplies:r,conversationRating:o,numberOfMessagesFromGuest:s,showRatingOverlay:l,commands:u,setShowRatingOverlay:f,onTextInput:h,onRate:p,onQuickReplyClick:v,onAudioRecorded:_,onOpenTranscriptExportModal:b})=>{const[m,T]=B.useState(""),[w,D]=B.useState(!1),[R,P]=B.useState(!1),N=B.useRef(),E=B.useRef(0);B.useEffect(()=>{if(w&&!e){const F=N.current?Date.now()-N.current:0;F>xg?D(!1):setTimeout(()=>{D(!1)},xg-F)}},[w,e]),B.useEffect(()=>{w&&(N.current=Date.now())},[w]);const C=F=>{const z=Date.now()-E.current<JC;return R?!1:e||z?(D(!0),!1):(h(F),T(""),E.current=Date.now(),!0)},x=F=>{T(F+" ")};return y.jsxs("div",{className:V(tC.inputContainer),children:[y.jsx(YC,{quickReplies:r,onQuickReplyClick:v}),y.jsx(oC,{visible:w}),!w&&y.jsx(PC,{conversationRating:o,numberOfMessagesFromGuest:s,onRate:p,showRatingOverlay:l,setShowRatingOverlay:f}),!!(u!=null&&u.length)&&y.jsx(dC,{text:m,commands:u,onSelectCommand:x,onVisibilityChange:P}),y.jsx(ZC,{textInput:m,disabled:w,commandsVisible:R,onTextInput:T,onTextInputSubmit:C,onOpenTranscriptExportModal:b,onAudioRecorded:_}),!!(u!=null&&u.length)&&y.jsx(pC,{commands:u,onSelectCommand:T})]})},tk=({clientName:e,messages:r,quickReplies:o,isBotTyping:s,drawerContentUrl:l,conversationRating:u,onMessageFromUser:f,onRate:h,onQuickReplyClick:p,onButtonClick:v,onLinkClick:_,onAudioRecorded:b,onTranscriptExport:m,onPdfExport:T,onTranscriptItemReaction:w})=>{const D=to(),R=jt(te=>te.connection.connectionState),{enableTranscriptExportPdf:P,enableTranscriptExportEmail:N,commands:E}=jt(te=>te.settings),[C,x]=B.useState(!1),[F,z]=B.useState(!1),W=P||N,he=r.filter(te=>te.sender.type===dy.GUEST).length;return B.useEffect(()=>{if(R===Er.CONNECTED){const te=ua.parse(window.location.search);D(fy(e,te))}},[e,R,D]),y.jsxs("div",{className:ju.container,children:[y.jsxs("div",{className:V([ju.chatcontent,(C||F)&&ju.accessabilityHidden]),children:[y.jsx(PT,{messages:r,isBotTyping:s,commands:E,onButtonClick:v,onLinkClick:_,onTranscriptItemReaction:w}),y.jsx(ek,{isBotTyping:s,quickReplies:s?[]:o,numberOfMessagesFromGuest:he,conversationRating:C?{enabled:!1}:u,showRatingOverlay:F,setShowRatingOverlay:z,commands:E,onRate:h,onQuickReplyClick:p,onTextInput:f,onAudioRecorded:b,onOpenTranscriptExportModal:()=>x(!C)}),y.jsx(VT,{})]}),W&&y.jsx(JT,{enableTranscriptExportPdf:P,enableTranscriptExportEmail:N,visible:C,onEmailExport:m,onPdfExport:T,onClose:()=>x(!1)}),y.jsx(HT,{contentUrl:l})]})},nk=e=>{const{messages:r,quickReplies:o,isBotTyping:s,drawerContentUrl:l,conversationRating:u}=e.chat;return{messages:r,quickReplies:o,isBotTyping:s,drawerContentUrl:l,conversationRating:u}},rk=e=>({onRestartChat:(r,o)=>e(ga(r,o)),onMessageFromUser:r=>e(G0(r)),onRate:(r,o)=>e(Hb(r,o)),onAudioRecorded:r=>e(Fb(r)),onActionFromUser:r=>e(r),onQuickReplyClick:r=>e(z0(r)),onNluEvent:r=>e(Z0(r)),onButtonClick:r=>e(Gb(r)),onLinkClick:r=>e($b(r)),onTranscriptExport:r=>e(Bb(r)),onPdfExport:()=>e(jb()),onTranscriptItemReaction:(r,o)=>e(ge.transcriptItemGuestReaction(r,o||null))}),ok=dE(nk,rk)(tk),jy=()=>ik(window.location.pathname),ik=e=>{const r=e.split("/"),o=e.endsWith("/");return r[r.length-(o?2:1)]},Uy=()=>B.useMemo(()=>jy(),[]),Hy=()=>{const[e,r]=B.useState(!1);return B.useEffect(()=>{r((()=>{try{return window.self!==window.top}catch{return!0}})())},[]),e},xf=e=>r=>{const o=r.key;(o==="ArrowDown"||o==="ArrowRight"||o==="Enter"||o===" "||o==="Space")&&(r.stopPropagation(),e())},sk=({onClick:e})=>{const r=Ke();return Hy()?y.jsx("button",{className:"tooltip--bottom","aria-label":r("header.close-chat"),"data-title":r("header.close-chat"),tabIndex:0,onClick:e,onKeyDown:xf(e),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},ak=()=>{const e=Ke(),r=Hy(),o=jt(l=>l.settings.enableStandaloneView),s=()=>{window.open(window.location.href,"_blank")};return r&&o?y.jsx("button",{className:"tooltip--bottom","aria-label":e("header.expand-chat"),"data-title":e("header.expand-chat"),tabIndex:0,onClick:s,onKeyDown:xf(s),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:"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"})})}):null},lk="_header_1sel7_1",uk="_logoContainer_1sel7_13",ck="_logo_1sel7_13",fk="_actions_1sel7_26",$s={header:lk,logoContainer:uk,logo:ck,actions:fk},dk=({onClick:e})=>{const r=Ke();return y.jsx("button",{className:"tooltip--bottom","aria-label":r("header.restart-chat"),"data-title":r("header.restart-chat"),tabIndex:0,onClick:e,onKeyDown:xf(e),children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 32 32",children:[y.jsx("path",{d:"M14.506,23.578l-5.511,0l-3.993,3.501l-0.007,0.006c-0.302,0.261 -0.687,0.405 -1.084,0.405c-0.245,-0.001 -0.488,-0.055 -0.711,-0.161c-0.595,-0.277 -0.978,-0.886 -0.974,-1.551l-0,-19.558c-0,-0.939 0.761,-1.711 1.685,-1.711l21.189,-0c0.924,-0 1.685,0.772 1.685,1.711l0,5.104l-1.444,0l-0,-5.104c-0,-0.134 -0.109,-0.244 -0.241,-0.244l-21.189,-0c-0.132,-0 -0.24,0.11 -0.24,0.244l-0,19.558c0.001,0.133 0.109,0.242 0.24,0.242c0.056,-0 0.109,-0.019 0.152,-0.055l4.192,-3.675c0.131,-0.115 0.299,-0.179 0.472,-0.179l5.779,0l-0,1.467Z"}),y.jsx("path",{d:"M29.869,20.148c0,4.137 -3.373,7.556 -7.509,7.612l-0.102,-0c-1.943,0.004 -3.814,-0.741 -5.223,-2.078c-0.183,-0.172 -0.286,-0.412 -0.286,-0.664c-0,-0.501 0.412,-0.913 0.913,-0.913c0.233,-0 0.458,0.089 0.627,0.249c1.074,1.014 2.495,1.579 3.971,1.579c3.174,-0 5.785,-2.612 5.785,-5.785c-0,-3.173 -2.611,-5.784 -5.785,-5.784c-1.533,-0 -3.006,0.61 -4.09,1.694c-0.01,0.01 -0.019,0.019 -0.03,0.028l-1.447,1.322l1.302,0c0.502,0 0.914,0.413 0.914,0.914c-0,0.501 -0.412,0.913 -0.914,0.913l-3.653,0c-0.501,0 -0.913,-0.412 -0.913,-0.913l-0,-3.654c-0,-0.501 0.412,-0.913 0.913,-0.913c0.501,0 0.913,0.412 0.913,0.913l0,1.577l1.635,-1.496c1.426,-1.418 3.357,-2.215 5.368,-2.215c4.175,0 7.611,3.436 7.611,7.611c-0,0.001 -0,0.002 -0,0.003Z"})]})})},Tg=({className:e,withActions:r=!0,...o})=>{const s=to(),l=Uy(),u=()=>{const h=ua.parse(window.location.search);s(ga(l,h))},f=()=>{s(MS())};return y.jsxs("div",{className:V([$s.header,e]),...o,children:[y.jsx("div",{className:$s.logoContainer,children:y.jsx("div",{className:$s.logo})}),y.jsxs("div",{className:$s.actions,children:[r&&y.jsx(dk,{onClick:u}),y.jsx(ak,{}),y.jsx(sk,{onClick:f})]})]})},hk="_chatwindow_6v6ob_1",pk="_chatwindowWithAside_6v6ob_46",Cg={chatwindow:hk,chatwindowWithAside:pk},mk="_sourceInfos_1qwkt_1",gk="_sourceDetails_1qwkt_16",yk="_sourceHeader_1qwkt_23",vk="_sourceHeaderIcon_1qwkt_43",_k="_openSourceButton_1qwkt_47",Ek="_closeSourceInfosButton_1qwkt_70",wk="_sourceContent_1qwkt_85",bk="_loadingSourceInfos_1qwkt_108",Sk="_loading_1qwkt_108",xk="_loadingError_1qwkt_122",hn={sourceInfos:mk,sourceDetails:gk,sourceHeader:yk,sourceHeaderIcon:vk,openSourceButton:_k,closeSourceInfosButton:Ek,sourceContent:wk,loadingSourceInfos:bk,loading:Sk,loadingError:xk},Tk=({onClick:e})=>{const r=Ke();return y.jsx("button",{className:V(hn.closeSourceInfosButton,"tooltip--bottom"),"aria-label":r("source-infos.close"),"data-title":r("source-infos.close"),tabIndex:0,onClick:e,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"})})})},Ck=e=>y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,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"})}),kk=({type:e,...r})=>{switch(e){case"WEBSITE":return y.jsx(Py,{...r});case"PDF":return y.jsx(Dy,{...r});case"DOCX":return y.jsx(Ay,{...r});case"TEXT":return y.jsx(Ck,{...r});default:return y.jsx(Iy,{...r})}},Rk=({sourceInfos:e,onClose:r})=>y.jsxs("div",{className:hn.sourceHeader,children:[y.jsx("div",{className:hn.sourceHeaderIcon,children:e&&y.jsx(kk,{type:e.knowledgeBaseType})}),y.jsx("div",{children:e&&y.jsx("h1",{children:e.title})}),y.jsx(Tk,{onClick:r})]}),Ok=({title:e,href:r,children:o})=>y.jsx("a",{href:r,title:e,target:"_blank",rel:"noopener noreferrer",children:o}),Nk=({className:e,children:r,...o})=>y.jsx("a",{className:V(oi.button,oi.buttonPrimary,e),type:"button",...o,children:r}),Ak=({label:e,url:r})=>y.jsxs(Nk,{className:hn.openSourceButton,href:r,target:"_blank",children:[y.jsx("p",{children:e}),y.jsx("div",{children: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:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"})})})]}),Ik=({sourceInfos:e})=>y.jsxs(y.Fragment,{children:[y.jsx("div",{className:V(hn.sourceContent,Ly.markdown),children:y.jsx(cn,{options:{overrides:{a:Ok}},children:e.content})}),y.jsx(Ak,{label:e.title,url:e.url})]}),Dk=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,Pk=()=>{const e=Ke();return y.jsxs("div",{className:hn.loadingError,children:[y.jsx("h1",{children:e("source-infos.error.title")}),y.jsx("img",{src:Dk,title:e("source-infos.error.title")}),y.jsx("p",{children:e("source-infos.error.info")})]})},Mk=()=>y.jsx("div",{className:hn.loadingSourceInfos,children:y.jsx("svg",{className:hn.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"})})}),Fk=()=>{const e=to(),r=jt(s=>s.chat.sourceInfos),o=()=>{e(LS())};return r?y.jsxs("div",{className:hn.sourceInfos,children:[y.jsx("div",{className:hn.sourceDetails,children:y.jsx(Rk,{sourceInfos:r.type==="loaded"?r:void 0,onClose:o})}),r.type==="loading"?y.jsx(Mk,{}):r.type==="loading-error"?y.jsx(Pk,{}):y.jsx(Ik,{sourceInfos:r})]}):null},Lk="_container_114wy_1",Bk="_body_114wy_7",jk="_intro_114wy_14",Uk="_footer_114wy_39",Hk="_footnote_114wy_43",zk="_containerWithFootnote_114wy_58",Gk="_startChatButton_114wy_73",$k="_formFields_114wy_77",Vk="_formField_114wy_77",qk="_radio_114wy_89",Wk="_checkbox_114wy_96",Kk="_input_114wy_104",Zk="_inputLabel_114wy_138",Qk="_selectWrapper_114wy_142",Xk="_select_114wy_142",Yk="_selectLabel_114wy_188",it={container:Lk,body:Bk,intro:jk,footer:Uk,footnote:Hk,containerWithFootnote:zk,startChatButton:Gk,formFields:$k,formField:Vk,radio:qk,checkbox:Wk,input:Kk,inputLabel:Zk,selectWrapper:Qk,select:Xk,selectLabel:Yk},Jk=({name:e,label:r,defaultValue:o,required:s,onChange:l})=>{const u=f=>{l(f.currentTarget.checked?"true":"false")};return y.jsxs("label",{className:V(it.checkbox,"chat__startScreen__checkbox"),htmlFor:e,children:[y.jsx("input",{type:"checkbox",id:e,name:e,defaultChecked:o==="true",required:s,onChange:u}),y.jsx("div",{children:r})]})},eR=({type:e,name:r,label:o,defaultValue:s,placeholder:l,required:u,multiple:f,min:h,max:p,pattern:v,onChange:_})=>{const b=m=>{_(m.target.value)};return y.jsxs("label",{className:V(it.input,"chat__startScreen__input"),htmlFor:r,children:[y.jsx("div",{className:V(it.inputLabel),children:o}),y.jsx("input",{type:e,id:r,name:r,defaultValue:s,placeholder:l,required:u,multiple:f,min:h,max:p,pattern:v,onChange:b})]})},tR=({name:e,value:r,label:o,defaultChecked:s,required:l,onChange:u})=>{const f=`${e}-${r}`,h=p=>{u(p.target.value)};return y.jsxs("label",{className:V(it.radio,"chat__startScreen__radio"),htmlFor:f,children:[y.jsx("input",{id:f,type:"radio",name:e,value:r,defaultChecked:s,required:l,onChange:h}),y.jsx("span",{className:V(it.label),children:o})]})},nR=({name:e,label:r,defaultValue:o,required:s,multiple:l,options:u,onChange:f})=>{const h=p=>{f(p.target.value)};return y.jsxs("label",{className:V(it.select,"chat__startScreen__select"),htmlFor:e,children:[y.jsx("div",{className:V(it.selectLabel),children:r}),y.jsx("div",{className:V(it.selectWrapper),children:y.jsx("select",{id:e,name:e,defaultValue:o,required:s,multiple:l,onChange:h,children:Object.entries(u||{}).map(([p,v])=>y.jsx("option",{value:p,selected:v===o,children:v}))})})]})},rR="start-screen.intro",oR="start-screen.start-chat",iR="start-screen.footnote",Xt="start-screen.form",kg=`${Xt}.fields`,sR=()=>{const e=Ke(),r=to(),[o,s]=B.useState({}),l=()=>{const b=Object.entries(o).reduce((m,[T,w])=>({...m,[T]:w.value}),{});r(IS(b))},u=e(rR),f=e(oR),h=e(iR),p=B.useMemo(()=>{var b;return((b=e(kg))==null?void 0:b.split(";").map(m=>m.trim()))??[]},[e(kg)]);B.useEffect(()=>{p.length&&Object.keys(o).length===0&&s(p.reduce((b,m)=>({...b,[m]:aR(m,e)}),{}))},[e,p,o]);const v=b=>{b.preventDefault(),l()},_=b=>m=>{s(T=>({...T,[b]:{...T[b],value:m}}))};return y.jsxs("form",{onSubmit:v,className:V(it.container,h&&it.containerWithFootnote,"chat__startScreen"),children:[y.jsxs("div",{className:V(it.body,"chat__startScreen__body"),children:[u&&y.jsx("div",{className:V(it.intro,"chat__startScreen__intro"),children:y.jsx(cn,{options:{overrides:{a:Rg}},children:u})}),y.jsx("div",{className:V(it.formFields,"chat__startScreen__fields"),children:Object.values(o).map(({type:b,name:m,label:T,placeholder:w,defaultValue:D,options:R,required:P,multiple:N,min:E,max:C,pattern:x})=>y.jsx("div",{className:V(it.formField,"chat__startScreen__field"),children:(()=>{switch(b){case"radio":return y.jsxs(y.Fragment,{children:[y.jsx("div",{children:T}),Object.entries(R||{}).map(([F,z])=>y.jsx(tR,{name:m,value:F,label:z,defaultChecked:F===D,required:P,onChange:_(m)}))]});case"checkbox":return y.jsx(Jk,{name:m,label:T,defaultValue:D,required:P,onChange:_(m)});case"select":return y.jsx(nR,{name:m,label:T,defaultValue:D,required:P,multiple:N,options:R,onChange:_(m)});default:return y.jsx(eR,{type:b,name:m,label:T,placeholder:w,defaultValue:D,required:P,multiple:N,min:E,max:C,pattern:x,onChange:_(m)})}})()},m))})]}),y.jsxs("div",{className:V(it.footer,"chat__startScreen__footer"),children:[y.jsx(ii,{type:"submit",className:it.startChatButton,children:f}),h&&y.jsx("div",{className:it.footnote,children:y.jsx(cn,{options:{overrides:{a:Rg}},children:h})})]})]})},Rg=({title:e,href:r,children:o})=>y.jsx("a",{href:r,title:e,target:"_blank",rel:"noopener noreferrer",children:o}),aR=(e,r)=>{const o=r(`${Xt}.${e}.type`)||"text",s=r(`${Xt}.${e}.required`)==="true",l=r(`${Xt}.${e}.multiple`)==="true",u=r(`${Xt}.${e}.placeholder`),f=r(`${Xt}.${e}.label`)||"",h=r(`${Xt}.${e}.defaultValue`),p=r(`${Xt}.${e}.min`),v=r(`${Xt}.${e}.max`),_=r(`${Xt}.${e}.pattern`),b=uR(r(`${Xt}.${e}.options`));return{name:e,label:f,placeholder:u,value:lR(o,h,b)||"",defaultValue:h,options:b,type:o,required:s,multiple:l,min:p,max:v,pattern:_}},lR=(e,r,o)=>r||e==="select"&&Object.keys(o)[0]||"",uR=(e="")=>e.split(";").map(r=>r.trim()).reduce((r,o)=>{const[s,l]=o.split(":").map(u=>u.trim());return{...r,[s]:l}},{}),cR=()=>{const e=la();B.useEffect(()=>{window.document.documentElement.lang=e.locale},[e.locale])},Zr={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"},fR=({clientName:e})=>{cR();const r=to(),o=jt(_=>_.intl.messages),s=Ke(),l=jt(_=>_.settings.enableStartScreen),u=jt(_=>_.startScreen.startScreenStatus),[f,h]=B.useState(void 0);B.useEffect(()=>{const _=ua.parse(window.location.search);_.cssClassName&&h(_.cssClassName);const b=m=>{switch(m.data.type){case Zr.TRIGGER_ACTION:r(m.data.action);break;case Zr.TRIGGER_STORY:r(Z0(m.data.story));break;case Zr.ON_CHAT_WINDOW_OPEN:r({type:"webclient.chatwindow.opened"});break;case Zr.ON_CHAT_WINDOW_CLOSE:r({type:"webclient.chatwindow.closed"});break;case Zr.CHAT_MESSAGE_FROM_GUEST:r(G0(m.data.text));break;case Zr.RESTART_CHAT:r(ga(e,_));break}};return r(jS(e,_)),window.addEventListener("message",m=>b(m),!1),()=>window.removeEventListener("message",b)},[e,r]),B.useEffect(()=>{const _=s("page.title");_&&document&&(document.title=_)},[o,s]);const p=l===void 0,v=l===!1||u==="HIDDEN";return y.jsx("div",{className:V(Cg.chatwindow,v&&Cg.chatwindowWithAside,"chat__chatwindow",f),children:p?null:v?y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(Tg,{})}),y.jsx("main",{children:y.jsx(ok,{clientName:e})}),y.jsx("aside",{children:y.jsx(Fk,{})})]}):y.jsxs(y.Fragment,{children:[y.jsx("header",{children:y.jsx(Tg,{withActions:!1})}),y.jsx("main",{children:y.jsx(sR,{})})]})})},dR=1024,hR=()=>{const e=Uy(),r=jt(u=>u.intl.locale),o=jt(u=>u.intl.messages),[s,l]=B.useState(Og());return B.useEffect(()=>{const u=()=>{l(Og())};return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[]),y.jsx(Jw,{locale:r,messages:o,children:y.jsx("div",{className:V([tb.app,s?"chat__large":"chat__small"]),children:y.jsx(fR,{clientName:e})})})},Og=()=>window.innerWidth>=dR;var Ju,Ng;function Tf(){if(Ng)return Ju;Ng=1;function e(r){var o=typeof r;return r!=null&&(o=="object"||o=="function")}return Ju=e,Ju}var ec,Ag;function pR(){if(Ag)return ec;Ag=1;var e=typeof ys=="object"&&ys&&ys.Object===Object&&ys;return ec=e,ec}var tc,Ig;function zy(){if(Ig)return tc;Ig=1;var e=pR(),r=typeof self=="object"&&self&&self.Object===Object&&self,o=e||r||Function("return this")();return tc=o,tc}var nc,Dg;function mR(){if(Dg)return nc;Dg=1;var e=zy(),r=function(){return e.Date.now()};return nc=r,nc}var rc,Pg;function gR(){if(Pg)return rc;Pg=1;var e=/\s/;function r(o){for(var s=o.length;s--&&e.test(o.charAt(s)););return s}return rc=r,rc}var oc,Mg;function yR(){if(Mg)return oc;Mg=1;var e=gR(),r=/^\s+/;function o(s){return s&&s.slice(0,e(s)+1).replace(r,"")}return oc=o,oc}var ic,Fg;function Gy(){if(Fg)return ic;Fg=1;var e=zy(),r=e.Symbol;return ic=r,ic}var sc,Lg;function vR(){if(Lg)return sc;Lg=1;var e=Gy(),r=Object.prototype,o=r.hasOwnProperty,s=r.toString,l=e?e.toStringTag:void 0;function u(f){var h=o.call(f,l),p=f[l];try{f[l]=void 0;var v=!0}catch{}var _=s.call(f);return v&&(h?f[l]=p:delete f[l]),_}return sc=u,sc}var ac,Bg;function _R(){if(Bg)return ac;Bg=1;var e=Object.prototype,r=e.toString;function o(s){return r.call(s)}return ac=o,ac}var lc,jg;function ER(){if(jg)return lc;jg=1;var e=Gy(),r=vR(),o=_R(),s="[object Null]",l="[object Undefined]",u=e?e.toStringTag:void 0;function f(h){return h==null?h===void 0?l:s:u&&u in Object(h)?r(h):o(h)}return lc=f,lc}var uc,Ug;function wR(){if(Ug)return uc;Ug=1;function e(r){return r!=null&&typeof r=="object"}return uc=e,uc}var cc,Hg;function bR(){if(Hg)return cc;Hg=1;var e=ER(),r=wR(),o="[object Symbol]";function s(l){return typeof l=="symbol"||r(l)&&e(l)==o}return cc=s,cc}var fc,zg;function SR(){if(zg)return fc;zg=1;var e=yR(),r=Tf(),o=bR(),s=NaN,l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,f=/^0o[0-7]+$/i,h=parseInt;function p(v){if(typeof v=="number")return v;if(o(v))return s;if(r(v)){var _=typeof v.valueOf=="function"?v.valueOf():v;v=r(_)?_+"":_}if(typeof v!="string")return v===0?v:+v;v=e(v);var b=u.test(v);return b||f.test(v)?h(v.slice(2),b?2:8):l.test(v)?s:+v}return fc=p,fc}var dc,Gg;function xR(){if(Gg)return dc;Gg=1;var e=Tf(),r=mR(),o=SR(),s="Expected a function",l=Math.max,u=Math.min;function f(h,p,v){var _,b,m,T,w,D,R=0,P=!1,N=!1,E=!0;if(typeof h!="function")throw new TypeError(s);p=o(p)||0,e(v)&&(P=!!v.leading,N="maxWait"in v,m=N?l(o(v.maxWait)||0,p):m,E="trailing"in v?!!v.trailing:E);function C(le){var Ue=_,Ie=b;return _=b=void 0,R=le,T=h.apply(Ie,Ue),T}function x(le){return R=le,w=setTimeout(W,p),P?C(le):T}function F(le){var Ue=le-D,Ie=le-R,$e=p-Ue;return N?u($e,m-Ie):$e}function z(le){var Ue=le-D,Ie=le-R;return D===void 0||Ue>=p||Ue<0||N&&Ie>=m}function W(){var le=r();if(z(le))return he(le);w=setTimeout(W,F(le))}function he(le){return w=void 0,E&&_?C(le):(_=b=void 0,T)}function te(){w!==void 0&&clearTimeout(w),R=0,_=D=b=w=void 0}function ce(){return w===void 0?T:he(r())}function pe(){var le=r(),Ue=z(le);if(_=arguments,b=this,D=le,Ue){if(w===void 0)return x(D);if(N)return clearTimeout(w),w=setTimeout(W,p),C(D)}return w===void 0&&(w=setTimeout(W,p)),T}return pe.cancel=te,pe.flush=ce,pe}return dc=f,dc}var hc,$g;function TR(){if($g)return hc;$g=1;var e=xR(),r=Tf(),o="Expected a function";function s(l,u,f){var h=!0,p=!0;if(typeof l!="function")throw new TypeError(o);return r(f)&&(h="leading"in f?!!f.leading:h,p="trailing"in f?!!f.trailing:p),e(l,u,{leading:h,maxWait:u,trailing:p})}return hc=s,hc}var CR=TR();const kR=sa(CR);function RR(e){return e&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function OR(e){return e}function NR(e,r){r=r||{};const o=r.delimiter||".",s=r.maxDepth,l=r.transformKey||OR,u={};function f(h,p,v){v=v||1,Object.keys(h).forEach(function(_){const b=h[_],m=r.safe&&Array.isArray(b),T=Object.prototype.toString.call(b),w=RR(b),D=T==="[object Object]"||T==="[object Array]",R=p?p+o+l(_):l(_);if(!m&&!w&&D&&Object.keys(b).length&&(!r.maxDepth||v<s))return f(b,R,v+1);u[R]=b})}return f(e),u}const $y={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht","message-input.actions.submit.label":"Nachricht senden","message-input.actions.export-transcript.label":"Konversation exportieren","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.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","agent-bubble.label":"Nachricht des Live-Agenten","export-transcript.email.title":"Konversation per E-Mail versenden","export-transcript.email.description":"Geben Sie Ihre E-Mail-Adresse ein, um den Chatverlauf zu erhalten.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"Ihre E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Ich habe den Chatverlauf an Ihre E-Mail-Adresse gesendet.","export-transcript.pdf.title":"Konversation als PDF erhalten","export-transcript.pdf.description":"Laden Sie die Konversation als PDF herunter.","export-transcript.pdf.cancel":"Abbrechen","export-transcript.pdf.download":"Herunterladen","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
|
|
98
98
|
|
|
99
99
|
- Der Chatverlauf wird im EU-Raum gespeichert und kann nur von autorisierten Personen eingesehen werden.
|
|
100
100
|
- 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.close":"Zurück zum Chat","start-screen.intro":"","start-screen.start-chat":"Chat starten","header.restart-chat":"Chat neu starten","header.expand-chat":"Chat vergrössern","header.close-chat":"Chat minimieren","source-infos.close":"Schliessen","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.","commands.show-more.action":"Weitere ...","commands.show-more.tooltip":"Weitere Befehle anzeigen","commands.show-less.action":"Weniger ...","commands.show-less.tooltip":"Weniger Befehle anzeigen"},AR={"page.title":"Bubble Chat Chatbot","message-input-label":"User input","message-input-placeholder":"Message","message-input.actions.submit.label":"Send message","message-input.actions.export-transcript.label":"Export conversation","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.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 Conversation","export-transcript.email.description":"Enter your email address to receive the chat history.","export-transcript.email.cancel":"Cancel","export-transcript.email.send":"Send","export-transcript.email.placeholder":"Your email address","export-transcript.email.invalid":"Please enter a valid e-mail address.","export-transcript.email.success":"I have sent the chat history to your email address.","export-transcript.pdf.title":"Get conversation as PDF","export-transcript.pdf.description":"Download this conversation as PDF.","export-transcript.pdf.cancel":"Cancel","export-transcript.pdf.download":"Download","general-conditions.header":"**Terms of use**","general-conditions.body":`Please consider the following points:
|
|
@@ -106,5 +106,5 @@ For more details see https://formatjs.github.io/docs/getting-started/message-dis
|
|
|
106
106
|
- Ne saisissez aucune information personnelle dans la fenêtre de chat (mots de passe, date de naissance, etc.).`,"general-conditions.accept-conditions-note":"En utilisant le chat, vous acceptez les conditions d'utilisation.","block-user-input.title":"Veuillez attendre la réponse du chatbot.","conversation-rating.call-to-action.title":"Notez ce chat","conversation-rating.overlay.title":"Dans quelle mesure êtes-vous satisfait de ce chat ?","conversation-rating.overlay.guest-feedback.input-placeholder":"Veuillez saisir vos commentaires ici (facultatif)","conversation-rating.overlay.star.very-bad":"Très mauvais","conversation-rating.overlay.star.very-good":"Très bien","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, ça ne sonne pas bien. Merci de me donner un feedback pour que je puisse en apprendre davantage.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, ça ne sonne pas bien. Merci de me donner un feedback pour que je puisse en apprendre davantage.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"La moyenne n'est pas mon objectif, que puis-je encore améliorer ?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Le rater de peu, c'est le rater aussi. Que puis-je encore améliorer pour obtenir toutes les étoiles la prochaine fois ?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Parfait ! Alors j'espère pouvoir vous conseiller aussi bien une fois de plus.","conversation-rating.overlay.bot-message.submit-feedback":"Merci beaucoup pour votre feed-back. Je m'efforce de m'améliorer en permanence.","conversation-rating.overlay.action.submit":"Envoyer","conversation-rating.overlay.action.close":"Fermer","start-screen.intro":"","start-screen.start-chat":"Démarrer le chat","header.restart-chat":"Redémarrer le chat","header.expand-chat":"Agrandir le chat","header.close-chat":"Minimiser le chat","source-infos.close":"Fermer","source-infos.error.title":"Erreur","source-infos.error.info":"Oups ! Quelque chose s'est mal passé. Merci de réessayer ou de contacter le support si le problème persiste.","commands.show-more.action":"Plus","commands.show-more.tooltip":"Afficher plus de commandes","commands.show-less.action":"Moins","commands.show-less.tooltip":"Afficher moins de commandes"},DR={"page.title":"Bubble Chat Chatbot","message-input-label":"Input dell'utente","message-input-placeholder":"Messaggio","message-input.actions.submit.label":"Invia messaggio","message-input.actions.export-transcript.label":"Esportare la conversazione","message-input.actions.start-audio-recording.label":"Avviare l'input vocale","message-input.actions.stop-audio-recording.label":"Interrompere l'input vocale","message-input.actions.submit-audio-recording.label":"Trasmettere l'input vocale","guest-bubble.label":"Il tuo messaggio","bot-bubble.label":"Messaggio del chatbot","bot-bubble.reaction.good":"Mi piace","bot-bubble.reaction.bad":"Non mi piace","bot-bubble.reaction.remove":"Rimuovere il marcatore","bot-bubble.copy":"Copia","bot-bubble.sources":"Elenco delle fonti","bot-bubble.source.open":"Fonte aperta","agent-bubble.label":"Messaggio dell'agente dal vivo","export-transcript.email.title":"Ricevere la conversazione","export-transcript.email.description":"Inserisci il tuo indirizzo e-mail per ricevere la cronologia della chat.","export-transcript.email.cancel":"Annulla","export-transcript.email.send":"Invia","export-transcript.email.placeholder":"Il tuo indirizzo e-mail","export-transcript.email.invalid":"Inserire un indirizzo e-mail valido.","export-transcript.email.success":"Ho inviato la cronologia della chat al vostro indirizzo e-mail.","export-transcript.pdf.title":"Ricevi la conversazione come PDF","export-transcript.pdf.description":"Scarica questa conversazione in PDF.","export-transcript.pdf.cancel":"Annulla","export-transcript.pdf.download":"Scaricare","general-conditions.header":"**Condizioni di utilizzo**","general-conditions.body":`Si prega di considerare i seguenti punti:
|
|
107
107
|
|
|
108
108
|
- La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
|
|
109
|
-
- 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.close":"Chiudere","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","header.restart-chat":"Riavviare la chat","header.expand-chat":"Allarga la chat","header.close-chat":"Ridurre al minimo la chat","source-infos.close":"Chiudere","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","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"},PR=["de","en","fr","it"],Vy={locale:"de",messages:$y},MR=(e,r)=>{if(PR.includes(e)){const o=FR(e),s=NR(r);return{...o,...s}}return r},FR=e=>{switch(e.toString()){case"en":return AR;case"fr":return IR;case"it":return DR;default:return $y}},LR=(e=BR,r)=>{switch(r.type){case gf:return Object.assign({},e,{connectionState:Er.CONNECTING});case yf:return Object.assign({},e,{connectionState:Er.CONNECTED});case vf:return Object.assign({},e,{connectionState:Er.DISCONNECTED});case _f:return Object.assign({},e,{connectionState:Er.RECONNECTED});case Ef:return Object.assign({},e,{sessionId:r.sessionId});case pa:return Object.assign({},e,{sessionId:r.payload.sessionId,userId:r.payload.userId});case ma:return Object.assign({},e,{sessionId:void 0});default:return e}},BR={connectionState:Er.DISCONNECTED,sessionId:void 0,userId:void 0},jR=(e=qg,r)=>{switch(r.type){case cy:return qg;case pa:return yr({type:"webclient.chat.started"}),e;case ma:return yr({type:"webclient.chat.ended"}),e;case ge.ActionTypes.TYPING_ON:return Object.assign({},e,{isBotTyping:!0});case ge.ActionTypes.TYPING_OFF:return Object.assign({},e,{isBotTyping:!1});case ge.ActionTypes.MESSAGE_FROM_GUEST:case ge.ActionTypes.MESSAGE_WITHOUT_ANALYSIS_FROM_GUEST:return Vg(e,r.message);case ge.ActionTypes.MESSAGE_TO_GUEST:{yr(r);const o=Object.assign({},r.message,{_id:r.meta.actionId}),s=e.messages.filter(l=>l._id===r.meta.actionId).length>0;return Object.assign({},e,{isBotTyping:!1,messages:s?e.messages:e.messages.concat([o]),quickReplies:o.quickReplies?o.quickReplies:[]})}case of:{const o=r.messages,s=o.length?o[o.length-1]:void 0;return Object.assign({},e,{isBotTyping:!1,messages:o,quickReplies:(s==null?void 0:s.quickReplies)||[]})}case rf:return yr(r.message),e;case ge.ActionTypes.EVENT_TO_GUEST:return yr(r.event),e;case ge.ActionTypes.DRAWER_OPEN:return Object.assign({},e,{drawerContentUrl:r.payload.parameters.contentUrl});case ge.ActionTypes.DRAWER_CLOSE:return Object.assign({},e,{drawerContentUrl:void 0});case ge.ActionTypes.GUEST_LOCALE_CHANGED:return Object.assign({},e,{locale:r.payload.locale});case q0:return yr(r),e;case W0:return yr(r),e;case af:{const o=new ge.TextMessage(r.transcription,new ge.GuestUser),s=Object.assign({},o,{_id:Ic()});return Vg(e,s)}case ge.ActionTypes.TRANSCRIPT_ITEM_GUEST_REACTION:{const o=e.messages.map(s=>s._id===r.payload.actionId?Object.assign({},s,{reaction:r.payload.reaction}):s);return Object.assign({},e,{messages:o})}case lf:{const o={enabled:!0,rating:r.payload.rating};return Object.assign({},e,{conversationRating:o})}case ge.ActionTypes.CONVERSATION_RATING_FROM_GUEST:{const o={...e.conversationRating,rating:r.payload};return Object.assign({},e,{conversationRating:o})}case uf:return{...e,sourceInfos:{type:"loading",chunkId:r.payload.chunkId}};case V0:return{...e,sourceInfos:{type:"loading-error"}};case $0:return{...e,sourceInfos:{type:"loaded",chunkId:r.payload.chunkId,knowledgeBaseType:r.payload.knowledgeBaseType,title:r.payload.title,content:r.payload.content,url:r.payload.url}};case cf:return{...e,sourceInfos:void 0};default:return e}},Vg=(e,r)=>{const o=e.messages[e.messages.length-1],s=(o==null?void 0:o.text)===r.text;return o&&o.sender.type===r.sender.type&&s?e:Object.assign({},e,{messages:e.messages.concat([r]),quickReplies:[]})},yr=e=>{var r;UR()?(r=window.top)==null||r.postMessage(e,"*"):e.type==="webclient.change.url"&&window.open(e.url)},UR=()=>typeof window<"u"&&window.self!==window.top,qg={messages:[],quickReplies:[],isBotTyping:!1,conversationRating:{enabled:!1}},qy=pf({name:"intl",initialState:Vy,reducers:{updateIntl:(e,r)=>{e.locale=r.payload.language,e.messages=r.payload.messages}}}),{updateIntl:HR}=qy.actions,zR=qy.reducer,GR={enableStartScreen:!1,enableStandaloneView:!1,enableTranscriptExportMail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[]},Wy=pf({name:"settings",initialState:GR,reducers:{setSettings(e,r){console.log("setSettings",r.payload),e.enableStartScreen=r.payload.enableStartScreen,e.enableStandaloneView=r.payload.enableStandaloneView,e.enableTranscriptExportMail=r.payload.enableTranscriptExportMail,e.enableTranscriptExportPdf=r.payload.enableTranscriptExportPdf,e.enableGeneralConditions=r.payload.enableGeneralConditions,e.enableSpeechSupport=r.payload.enableSpeechSupport,e.commands=r.payload.commands}}}),{setSettings:$R}=Wy.actions,VR=Wy.reducer,qR=Y0({settings:VR,chat:jR,startScreen:PS,connection:LR,intl:zR}),WR="bubble-chat",Ky="state-last-saved-at",Zy="state",KR=e=>{try{if(!XR())return;const r=Wg(e,Ky);if(QR(r))return;{const o=Wg(e,Zy);return o===null?void 0:JSON.parse(o)}}catch(r){console.error(r);return}},ZR=(e,r)=>{try{const o=JSON.stringify(r);Kg(e,Zy,o);const s=new Date().toISOString();Kg(e,Ky,s)}catch(o){console.error(o)}},QR=e=>{if(e===null)return!1;const r=new Date(e);return r.setHours(r.getHours()+12),new Date>r},XR=()=>typeof localStorage<"u",Wg=(e,r)=>{const o=Qy(e,r);return localStorage.getItem(o)},Kg=(e,r,o)=>{const s=Qy(e,r);return localStorage.setItem(s,o)},Qy=(e,r)=>`${WR}-${e}-${r}`,pn=Object.create(null);pn.open="0";pn.close="1";pn.ping="2";pn.pong="3";pn.message="4";pn.upgrade="5";pn.noop="6";const Zs=Object.create(null);Object.keys(pn).forEach(e=>{Zs[pn[e]]=e});const Hc={type:"error",data:"parser error"},Xy=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Yy=typeof ArrayBuffer=="function",Jy=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Cf=({type:e,data:r},o,s)=>Xy&&r instanceof Blob?o?s(r):Zg(r,s):Yy&&(r instanceof ArrayBuffer||Jy(r))?o?s(r):Zg(new Blob([r]),s):s(pn[e]+(r||"")),Zg=(e,r)=>{const o=new FileReader;return o.onload=function(){const s=o.result.split(",")[1];r("b"+(s||""))},o.readAsDataURL(e)};function Qg(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let pc;function YR(e,r){if(Xy&&e.data instanceof Blob)return e.data.arrayBuffer().then(Qg).then(r);if(Yy&&(e.data instanceof ArrayBuffer||Jy(e.data)))return r(Qg(e.data));Cf(e,!1,o=>{pc||(pc=new TextEncoder),r(pc.encode(o))})}const Xg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ei=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Xg.length;e++)ei[Xg.charCodeAt(e)]=e;const JR=e=>{let r=e.length*.75,o=e.length,s,l=0,u,f,h,p;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);const v=new ArrayBuffer(r),_=new Uint8Array(v);for(s=0;s<o;s+=4)u=ei[e.charCodeAt(s)],f=ei[e.charCodeAt(s+1)],h=ei[e.charCodeAt(s+2)],p=ei[e.charCodeAt(s+3)],_[l++]=u<<2|f>>4,_[l++]=(f&15)<<4|h>>2,_[l++]=(h&3)<<6|p&63;return v},eO=typeof ArrayBuffer=="function",kf=(e,r)=>{if(typeof e!="string")return{type:"message",data:ev(e,r)};const o=e.charAt(0);return o==="b"?{type:"message",data:tO(e.substring(1),r)}:Zs[o]?e.length>1?{type:Zs[o],data:e.substring(1)}:{type:Zs[o]}:Hc},tO=(e,r)=>{if(eO){const o=JR(e);return ev(o,r)}else return{base64:!0,data:e}},ev=(e,r)=>{switch(r){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},tv="",nO=(e,r)=>{const o=e.length,s=new Array(o);let l=0;e.forEach((u,f)=>{Cf(u,!1,h=>{s[f]=h,++l===o&&r(s.join(tv))})})},rO=(e,r)=>{const o=e.split(tv),s=[];for(let l=0;l<o.length;l++){const u=kf(o[l],r);if(s.push(u),u.type==="error")break}return s};function oO(){return new TransformStream({transform(e,r){YR(e,o=>{const s=o.length;let l;if(s<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,s);else if(s<65536){l=new Uint8Array(3);const u=new DataView(l.buffer);u.setUint8(0,126),u.setUint16(1,s)}else{l=new Uint8Array(9);const u=new DataView(l.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(l[0]|=128),r.enqueue(l),r.enqueue(o)})}})}let mc;function Vs(e){return e.reduce((r,o)=>r+o.length,0)}function qs(e,r){if(e[0].length===r)return e.shift();const o=new Uint8Array(r);let s=0;for(let l=0;l<r;l++)o[l]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),o}function iO(e,r){mc||(mc=new TextDecoder);const o=[];let s=0,l=-1,u=!1;return new TransformStream({transform(f,h){for(o.push(f);;){if(s===0){if(Vs(o)<1)break;const p=qs(o,1);u=(p[0]&128)===128,l=p[0]&127,l<126?s=3:l===126?s=1:s=2}else if(s===1){if(Vs(o)<2)break;const p=qs(o,2);l=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),s=3}else if(s===2){if(Vs(o)<8)break;const p=qs(o,8),v=new DataView(p.buffer,p.byteOffset,p.length),_=v.getUint32(0);if(_>Math.pow(2,21)-1){h.enqueue(Hc);break}l=_*Math.pow(2,32)+v.getUint32(4),s=3}else{if(Vs(o)<l)break;const p=qs(o,l);h.enqueue(kf(u?p:mc.decode(p),r)),s=0}if(l===0||l>e){h.enqueue(Hc);break}}}})}const nv=4;function We(e){if(e)return sO(e)}function sO(e){for(var r in We.prototype)e[r]=We.prototype[r];return e}We.prototype.on=We.prototype.addEventListener=function(e,r){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(r),this};We.prototype.once=function(e,r){function o(){this.off(e,o),r.apply(this,arguments)}return o.fn=r,this.on(e,o),this};We.prototype.off=We.prototype.removeListener=We.prototype.removeAllListeners=We.prototype.removeEventListener=function(e,r){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var o=this._callbacks["$"+e];if(!o)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,l=0;l<o.length;l++)if(s=o[l],s===r||s.fn===r){o.splice(l,1);break}return o.length===0&&delete this._callbacks["$"+e],this};We.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var r=new Array(arguments.length-1),o=this._callbacks["$"+e],s=1;s<arguments.length;s++)r[s-1]=arguments[s];if(o){o=o.slice(0);for(var s=0,l=o.length;s<l;++s)o[s].apply(this,r)}return this};We.prototype.emitReserved=We.prototype.emit;We.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};We.prototype.hasListeners=function(e){return!!this.listeners(e).length};const _a=typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,o)=>o(r,0),Bt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),aO="arraybuffer";function rv(e,...r){return r.reduce((o,s)=>(e.hasOwnProperty(s)&&(o[s]=e[s]),o),{})}const lO=Bt.setTimeout,uO=Bt.clearTimeout;function Ea(e,r){r.useNativeTimers?(e.setTimeoutFn=lO.bind(Bt),e.clearTimeoutFn=uO.bind(Bt)):(e.setTimeoutFn=Bt.setTimeout.bind(Bt),e.clearTimeoutFn=Bt.clearTimeout.bind(Bt))}const cO=1.33;function fO(e){return typeof e=="string"?dO(e):Math.ceil((e.byteLength||e.size)*cO)}function dO(e){let r=0,o=0;for(let s=0,l=e.length;s<l;s++)r=e.charCodeAt(s),r<128?o+=1:r<2048?o+=2:r<55296||r>=57344?o+=3:(s++,o+=4);return o}function ov(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function hO(e){let r="";for(let o in e)e.hasOwnProperty(o)&&(r.length&&(r+="&"),r+=encodeURIComponent(o)+"="+encodeURIComponent(e[o]));return r}function pO(e){let r={},o=e.split("&");for(let s=0,l=o.length;s<l;s++){let u=o[s].split("=");r[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return r}class mO extends Error{constructor(r,o,s){super(r),this.description=o,this.context=s,this.type="TransportError"}}class Rf extends We{constructor(r){super(),this.writable=!1,Ea(this,r),this.opts=r,this.query=r.query,this.socket=r.socket,this.supportsBinary=!r.forceBase64}onError(r,o,s){return super.emitReserved("error",new mO(r,o,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(r){this.readyState==="open"&&this.write(r)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(r){const o=kf(r,this.socket.binaryType);this.onPacket(o)}onPacket(r){super.emitReserved("packet",r)}onClose(r){this.readyState="closed",super.emitReserved("close",r)}pause(r){}createUri(r,o={}){return r+"://"+this._hostname()+this._port()+this.opts.path+this._query(o)}_hostname(){const r=this.opts.hostname;return r.indexOf(":")===-1?r:"["+r+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(r){const o=hO(r);return o.length?"?"+o:""}}class gO extends Rf{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(r){this.readyState="pausing";const o=()=>{this.readyState="paused",r()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||o()})),this.writable||(s++,this.once("drain",function(){--s||o()}))}else o()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(r){const o=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};rO(r,this.socket.binaryType).forEach(o),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const r=()=>{this.write([{type:"close"}])};this.readyState==="open"?r():this.once("open",r)}write(r){this.writable=!1,nO(r,o=>{this.doWrite(o,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const r=this.opts.secure?"https":"http",o=this.query||{};return this.opts.timestampRequests!==!1&&(o[this.opts.timestampParam]=ov()),!this.supportsBinary&&!o.sid&&(o.b64=1),this.createUri(r,o)}}let iv=!1;try{iv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const yO=iv;function vO(){}class _O extends gO{constructor(r){if(super(r),typeof location<"u"){const o=location.protocol==="https:";let s=location.port;s||(s=o?"443":"80"),this.xd=typeof location<"u"&&r.hostname!==location.hostname||s!==r.port}}doWrite(r,o){const s=this.request({method:"POST",data:r});s.on("success",o),s.on("error",(l,u)=>{this.onError("xhr post error",l,u)})}doPoll(){const r=this.request();r.on("data",this.onData.bind(this)),r.on("error",(o,s)=>{this.onError("xhr poll error",o,s)}),this.pollXhr=r}}class fn extends We{constructor(r,o,s){super(),this.createRequest=r,Ea(this,s),this._opts=s,this._method=s.method||"GET",this._uri=o,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var r;const o=rv(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");o.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(o);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&s.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(r=this._opts.cookieJar)===null||r===void 0||r.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var l;s.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=fn.requestsCount++,fn.requests[this._index]=this)}_onError(r){this.emitReserved("error",r,this._xhr),this._cleanup(!0)}_cleanup(r){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=vO,r)try{this._xhr.abort()}catch{}typeof document<"u"&&delete fn.requests[this._index],this._xhr=null}}_onLoad(){const r=this._xhr.responseText;r!==null&&(this.emitReserved("data",r),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}fn.requestsCount=0;fn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Yg);else if(typeof addEventListener=="function"){const e="onpagehide"in Bt?"pagehide":"unload";addEventListener(e,Yg,!1)}}function Yg(){for(let e in fn.requests)fn.requests.hasOwnProperty(e)&&fn.requests[e].abort()}const EO=function(){const e=sv({xdomain:!1});return e&&e.responseType!==null}();class wO extends _O{constructor(r){super(r);const o=r&&r.forceBase64;this.supportsBinary=EO&&!o}request(r={}){return Object.assign(r,{xd:this.xd},this.opts),new fn(sv,this.uri(),r)}}function sv(e){const r=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!r||yO))return new XMLHttpRequest}catch{}if(!r)try{return new Bt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const av=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class bO extends Rf{get name(){return"websocket"}doOpen(){const r=this.uri(),o=this.opts.protocols,s=av?{}:rv(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(r,o,s)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=r=>this.onClose({description:"websocket connection closed",context:r}),this.ws.onmessage=r=>this.onData(r.data),this.ws.onerror=r=>this.onError("websocket error",r)}write(r){this.writable=!1;for(let o=0;o<r.length;o++){const s=r[o],l=o===r.length-1;Cf(s,this.supportsBinary,u=>{try{this.doWrite(s,u)}catch{}l&&_a(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const r=this.opts.secure?"wss":"ws",o=this.query||{};return this.opts.timestampRequests&&(o[this.opts.timestampParam]=ov()),this.supportsBinary||(o.b64=1),this.createUri(r,o)}}const gc=Bt.WebSocket||Bt.MozWebSocket;class SO extends bO{createSocket(r,o,s){return av?new gc(r,o,s):o?new gc(r,o):new gc(r)}doWrite(r,o){this.ws.send(o)}}class xO extends Rf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(r){return this.emitReserved("error",r)}this._transport.closed.then(()=>{this.onClose()}).catch(r=>{this.onError("webtransport error",r)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(r=>{const o=iO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=r.readable.pipeThrough(o).getReader(),l=oO();l.readable.pipeTo(r.writable),this._writer=l.writable.getWriter();const u=()=>{s.read().then(({done:h,value:p})=>{h||(this.onPacket(p),u())}).catch(h=>{})};u();const f={type:"open"};this.query.sid&&(f.data=`{"sid":"${this.query.sid}"}`),this._writer.write(f).then(()=>this.onOpen())})})}write(r){this.writable=!1;for(let o=0;o<r.length;o++){const s=r[o],l=o===r.length-1;this._writer.write(s).then(()=>{l&&_a(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var r;(r=this._transport)===null||r===void 0||r.close()}}const TO={websocket:SO,webtransport:xO,polling:wO},CO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,kO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function zc(e){if(e.length>8e3)throw"URI too long";const r=e,o=e.indexOf("["),s=e.indexOf("]");o!=-1&&s!=-1&&(e=e.substring(0,o)+e.substring(o,s).replace(/:/g,";")+e.substring(s,e.length));let l=CO.exec(e||""),u={},f=14;for(;f--;)u[kO[f]]=l[f]||"";return o!=-1&&s!=-1&&(u.source=r,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=RO(u,u.path),u.queryKey=OO(u,u.query),u}function RO(e,r){const o=/\/{2,9}/g,s=r.replace(o,"/").split("/");return(r.slice(0,1)=="/"||r.length===0)&&s.splice(0,1),r.slice(-1)=="/"&&s.splice(s.length-1,1),s}function OO(e,r){const o={};return r.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,l,u){l&&(o[l]=u)}),o}const Gc=typeof addEventListener=="function"&&typeof removeEventListener=="function",Qs=[];Gc&&addEventListener("offline",()=>{Qs.forEach(e=>e())},!1);class Yn extends We{constructor(r,o){if(super(),this.binaryType=aO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,r&&typeof r=="object"&&(o=r,r=null),r){const s=zc(r);o.hostname=s.host,o.secure=s.protocol==="https"||s.protocol==="wss",o.port=s.port,s.query&&(o.query=s.query)}else o.host&&(o.hostname=zc(o.host).host);Ea(this,o),this.secure=o.secure!=null?o.secure:typeof location<"u"&&location.protocol==="https:",o.hostname&&!o.port&&(o.port=this.secure?"443":"80"),this.hostname=o.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=o.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},o.transports.forEach(s=>{const l=s.prototype.name;this.transports.push(l),this._transportsByName[l]=s}),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},o),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=pO(this.opts.query)),Gc&&(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"})},Qs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(r){const o=Object.assign({},this.opts.query);o.EIO=nv,o.transport=r,this.id&&(o.sid=this.id);const s=Object.assign({},this.opts,{query:o,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[r]);return new this._transportsByName[r](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const r=this.opts.rememberUpgrade&&Yn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const o=this.createTransport(r);o.open(),this.setTransport(o)}setTransport(r){this.transport&&this.transport.removeAllListeners(),this.transport=r,r.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",o=>this._onClose("transport close",o))}onOpen(){this.readyState="open",Yn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",r),this.emitReserved("heartbeat"),r.type){case"open":this.onHandshake(JSON.parse(r.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const o=new Error("server error");o.code=r.data,this._onError(o);break;case"message":this.emitReserved("data",r.data),this.emitReserved("message",r.data);break}}onHandshake(r){this.emitReserved("handshake",r),this.id=r.sid,this.transport.query.sid=r.sid,this._pingInterval=r.pingInterval,this._pingTimeout=r.pingTimeout,this._maxPayload=r.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const r=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+r,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},r),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 r=this._getWritablePackets();this.transport.send(r),this._prevBufferLen=r.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let o=1;for(let s=0;s<this.writeBuffer.length;s++){const l=this.writeBuffer[s].data;if(l&&(o+=fO(l)),s>0&&o>this._maxPayload)return this.writeBuffer.slice(0,s);o+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const r=Date.now()>this._pingTimeoutTime;return r&&(this._pingTimeoutTime=0,_a(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),r}write(r,o,s){return this._sendPacket("message",r,o,s),this}send(r,o,s){return this._sendPacket("message",r,o,s),this}_sendPacket(r,o,s,l){if(typeof o=="function"&&(l=o,o=void 0),typeof s=="function"&&(l=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const u={type:r,data:o,options:s};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),l&&this.once("flush",l),this.flush()}close(){const r=()=>{this._onClose("forced close"),this.transport.close()},o=()=>{this.off("upgrade",o),this.off("upgradeError",o),r()},s=()=>{this.once("upgrade",o),this.once("upgradeError",o)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():r()}):this.upgrading?s():r()),this}_onError(r){if(Yn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",r),this._onClose("transport error",r)}_onClose(r,o){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(),Gc&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Qs.indexOf(this._offlineEventListener);s!==-1&&Qs.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",r,o),this.writeBuffer=[],this._prevBufferLen=0}}}Yn.protocol=nv;class NO extends Yn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let r=0;r<this._upgrades.length;r++)this._probe(this._upgrades[r])}_probe(r){let o=this.createTransport(r),s=!1;Yn.priorWebsocketSuccess=!1;const l=()=>{s||(o.send([{type:"ping",data:"probe"}]),o.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",o),!o)return;Yn.priorWebsocketSuccess=o.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(_(),this.setTransport(o),o.send([{type:"upgrade"}]),this.emitReserved("upgrade",o),o=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=o.name,this.emitReserved("upgradeError",m)}}))};function u(){s||(s=!0,_(),o.close(),o=null)}const f=b=>{const m=new Error("probe error: "+b);m.transport=o.name,u(),this.emitReserved("upgradeError",m)};function h(){f("transport closed")}function p(){f("socket closed")}function v(b){o&&b.name!==o.name&&u()}const _=()=>{o.removeListener("open",l),o.removeListener("error",f),o.removeListener("close",h),this.off("close",p),this.off("upgrading",v)};o.once("open",l),o.once("error",f),o.once("close",h),this.once("close",p),this.once("upgrading",v),this._upgrades.indexOf("webtransport")!==-1&&r!=="webtransport"?this.setTimeoutFn(()=>{s||o.open()},200):o.open()}onHandshake(r){this._upgrades=this._filterUpgrades(r.upgrades),super.onHandshake(r)}_filterUpgrades(r){const o=[];for(let s=0;s<r.length;s++)~this.transports.indexOf(r[s])&&o.push(r[s]);return o}}let AO=class extends NO{constructor(r,o={}){const s=typeof r=="object"?r:o;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(l=>TO[l]).filter(l=>!!l)),super(r,s)}};function IO(e,r="",o){let s=e;o=o||typeof location<"u"&&location,e==null&&(e=o.protocol+"//"+o.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=o.protocol+e:e=o.host+e),/^(https?|wss?):\/\//.test(e)||(typeof o<"u"?e=o.protocol+"//"+e:e="https://"+e),s=zc(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const u=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+u+":"+s.port+r,s.href=s.protocol+"://"+u+(o&&o.port===s.port?"":":"+s.port),s}const DO=typeof ArrayBuffer=="function",PO=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,lv=Object.prototype.toString,MO=typeof Blob=="function"||typeof Blob<"u"&&lv.call(Blob)==="[object BlobConstructor]",FO=typeof File=="function"||typeof File<"u"&&lv.call(File)==="[object FileConstructor]";function Of(e){return DO&&(e instanceof ArrayBuffer||PO(e))||MO&&e instanceof Blob||FO&&e instanceof File}function Xs(e,r){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let o=0,s=e.length;o<s;o++)if(Xs(e[o]))return!0;return!1}if(Of(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Xs(e.toJSON(),!0);for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&Xs(e[o]))return!0;return!1}function LO(e){const r=[],o=e.data,s=e;return s.data=$c(o,r),s.attachments=r.length,{packet:s,buffers:r}}function $c(e,r){if(!e)return e;if(Of(e)){const o={_placeholder:!0,num:r.length};return r.push(e),o}else if(Array.isArray(e)){const o=new Array(e.length);for(let s=0;s<e.length;s++)o[s]=$c(e[s],r);return o}else if(typeof e=="object"&&!(e instanceof Date)){const o={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(o[s]=$c(e[s],r));return o}return e}function BO(e,r){return e.data=Vc(e.data,r),delete e.attachments,e}function Vc(e,r){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<r.length)return r[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let o=0;o<e.length;o++)e[o]=Vc(e[o],r);else if(typeof e=="object")for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(e[o]=Vc(e[o],r));return e}const jO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],UO=5;var Ee;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ee||(Ee={}));class HO{constructor(r){this.replacer=r}encode(r){return(r.type===Ee.EVENT||r.type===Ee.ACK)&&Xs(r)?this.encodeAsBinary({type:r.type===Ee.EVENT?Ee.BINARY_EVENT:Ee.BINARY_ACK,nsp:r.nsp,data:r.data,id:r.id}):[this.encodeAsString(r)]}encodeAsString(r){let o=""+r.type;return(r.type===Ee.BINARY_EVENT||r.type===Ee.BINARY_ACK)&&(o+=r.attachments+"-"),r.nsp&&r.nsp!=="/"&&(o+=r.nsp+","),r.id!=null&&(o+=r.id),r.data!=null&&(o+=JSON.stringify(r.data,this.replacer)),o}encodeAsBinary(r){const o=LO(r),s=this.encodeAsString(o.packet),l=o.buffers;return l.unshift(s),l}}function Jg(e){return Object.prototype.toString.call(e)==="[object Object]"}class Nf extends We{constructor(r){super(),this.reviver=r}add(r){let o;if(typeof r=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");o=this.decodeString(r);const s=o.type===Ee.BINARY_EVENT;s||o.type===Ee.BINARY_ACK?(o.type=s?Ee.EVENT:Ee.ACK,this.reconstructor=new zO(o),o.attachments===0&&super.emitReserved("decoded",o)):super.emitReserved("decoded",o)}else if(Of(r)||r.base64)if(this.reconstructor)o=this.reconstructor.takeBinaryData(r),o&&(this.reconstructor=null,super.emitReserved("decoded",o));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+r)}decodeString(r){let o=0;const s={type:Number(r.charAt(0))};if(Ee[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Ee.BINARY_EVENT||s.type===Ee.BINARY_ACK){const u=o+1;for(;r.charAt(++o)!=="-"&&o!=r.length;);const f=r.substring(u,o);if(f!=Number(f)||r.charAt(o)!=="-")throw new Error("Illegal attachments");s.attachments=Number(f)}if(r.charAt(o+1)==="/"){const u=o+1;for(;++o&&!(r.charAt(o)===","||o===r.length););s.nsp=r.substring(u,o)}else s.nsp="/";const l=r.charAt(o+1);if(l!==""&&Number(l)==l){const u=o+1;for(;++o;){const f=r.charAt(o);if(f==null||Number(f)!=f){--o;break}if(o===r.length)break}s.id=Number(r.substring(u,o+1))}if(r.charAt(++o)){const u=this.tryParse(r.substr(o));if(Nf.isPayloadValid(s.type,u))s.data=u;else throw new Error("invalid payload")}return s}tryParse(r){try{return JSON.parse(r,this.reviver)}catch{return!1}}static isPayloadValid(r,o){switch(r){case Ee.CONNECT:return Jg(o);case Ee.DISCONNECT:return o===void 0;case Ee.CONNECT_ERROR:return typeof o=="string"||Jg(o);case Ee.EVENT:case Ee.BINARY_EVENT:return Array.isArray(o)&&(typeof o[0]=="number"||typeof o[0]=="string"&&jO.indexOf(o[0])===-1);case Ee.ACK:case Ee.BINARY_ACK:return Array.isArray(o)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class zO{constructor(r){this.packet=r,this.buffers=[],this.reconPack=r}takeBinaryData(r){if(this.buffers.push(r),this.buffers.length===this.reconPack.attachments){const o=BO(this.reconPack,this.buffers);return this.finishedReconstruction(),o}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const GO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Nf,Encoder:HO,get PacketType(){return Ee},protocol:UO},Symbol.toStringTag,{value:"Module"}));function Yt(e,r,o){return e.on(r,o),function(){e.off(r,o)}}const $O=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class uv extends We{constructor(r,o,s){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=r,this.nsp=o,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const r=this.io;this.subs=[Yt(r,"open",this.onopen.bind(this)),Yt(r,"packet",this.onpacket.bind(this)),Yt(r,"error",this.onerror.bind(this)),Yt(r,"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(...r){return r.unshift("message"),this.emit.apply(this,r),this}emit(r,...o){var s,l,u;if($O.hasOwnProperty(r))throw new Error('"'+r.toString()+'" is a reserved event name');if(o.unshift(r),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(o),this;const f={type:Ee.EVENT,data:o};if(f.options={},f.options.compress=this.flags.compress!==!1,typeof o[o.length-1]=="function"){const _=this.ids++,b=o.pop();this._registerAckCallback(_,b),f.id=_}const h=(l=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||l===void 0?void 0:l.writable,p=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!h||(p?(this.notifyOutgoingListeners(f),this.packet(f)):this.sendBuffer.push(f)),this.flags={},this}_registerAckCallback(r,o){var s;const l=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(l===void 0){this.acks[r]=o;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[r];for(let h=0;h<this.sendBuffer.length;h++)this.sendBuffer[h].id===r&&this.sendBuffer.splice(h,1);o.call(this,new Error("operation has timed out"))},l),f=(...h)=>{this.io.clearTimeoutFn(u),o.apply(this,h)};f.withError=!0,this.acks[r]=f}emitWithAck(r,...o){return new Promise((s,l)=>{const u=(f,h)=>f?l(f):s(h);u.withError=!0,o.push(u),this.emit(r,...o)})}_addToQueue(r){let o;typeof r[r.length-1]=="function"&&(o=r.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:r,flags:Object.assign({fromQueue:!0},this.flags)};r.push((l,...u)=>s!==this._queue[0]?void 0:(l!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),o&&o(l)):(this._queue.shift(),o&&o(null,...u)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(r=!1){if(!this.connected||this._queue.length===0)return;const o=this._queue[0];o.pending&&!r||(o.pending=!0,o.tryCount++,this.flags=o.flags,this.emit.apply(this,o.args))}packet(r){r.nsp=this.nsp,this.io._packet(r)}onopen(){typeof this.auth=="function"?this.auth(r=>{this._sendConnectPacket(r)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(r){this.packet({type:Ee.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},r):r})}onerror(r){this.connected||this.emitReserved("connect_error",r)}onclose(r,o){this.connected=!1,delete this.id,this.emitReserved("disconnect",r,o),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(r=>{if(!this.sendBuffer.some(s=>String(s.id)===r)){const s=this.acks[r];delete this.acks[r],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(r){if(r.nsp===this.nsp)switch(r.type){case Ee.CONNECT:r.data&&r.data.sid?this.onconnect(r.data.sid,r.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 Ee.EVENT:case Ee.BINARY_EVENT:this.onevent(r);break;case Ee.ACK:case Ee.BINARY_ACK:this.onack(r);break;case Ee.DISCONNECT:this.ondisconnect();break;case Ee.CONNECT_ERROR:this.destroy();const s=new Error(r.data.message);s.data=r.data.data,this.emitReserved("connect_error",s);break}}onevent(r){const o=r.data||[];r.id!=null&&o.push(this.ack(r.id)),this.connected?this.emitEvent(o):this.receiveBuffer.push(Object.freeze(o))}emitEvent(r){if(this._anyListeners&&this._anyListeners.length){const o=this._anyListeners.slice();for(const s of o)s.apply(this,r)}super.emit.apply(this,r),this._pid&&r.length&&typeof r[r.length-1]=="string"&&(this._lastOffset=r[r.length-1])}ack(r){const o=this;let s=!1;return function(...l){s||(s=!0,o.packet({type:Ee.ACK,id:r,data:l}))}}onack(r){const o=this.acks[r.id];typeof o=="function"&&(delete this.acks[r.id],o.withError&&r.data.unshift(null),o.apply(this,r.data))}onconnect(r,o){this.id=r,this.recovered=o&&this._pid===o,this._pid=o,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(r=>this.emitEvent(r)),this.receiveBuffer=[],this.sendBuffer.forEach(r=>{this.notifyOutgoingListeners(r),this.packet(r)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(r=>r()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ee.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(r){return this.flags.compress=r,this}get volatile(){return this.flags.volatile=!0,this}timeout(r){return this.flags.timeout=r,this}onAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(r),this}prependAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(r),this}offAny(r){if(!this._anyListeners)return this;if(r){const o=this._anyListeners;for(let s=0;s<o.length;s++)if(r===o[s])return o.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(r),this}prependAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(r),this}offAnyOutgoing(r){if(!this._anyOutgoingListeners)return this;if(r){const o=this._anyOutgoingListeners;for(let s=0;s<o.length;s++)if(r===o[s])return o.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(r){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const o=this._anyOutgoingListeners.slice();for(const s of o)s.apply(this,r.data)}}}function no(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}no.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),o=Math.floor(r*this.jitter*e);e=(Math.floor(r*10)&1)==0?e-o:e+o}return Math.min(e,this.max)|0};no.prototype.reset=function(){this.attempts=0};no.prototype.setMin=function(e){this.ms=e};no.prototype.setMax=function(e){this.max=e};no.prototype.setJitter=function(e){this.jitter=e};class qc extends We{constructor(r,o){var s;super(),this.nsps={},this.subs=[],r&&typeof r=="object"&&(o=r,r=void 0),o=o||{},o.path=o.path||"/socket.io",this.opts=o,Ea(this,o),this.reconnection(o.reconnection!==!1),this.reconnectionAttempts(o.reconnectionAttempts||1/0),this.reconnectionDelay(o.reconnectionDelay||1e3),this.reconnectionDelayMax(o.reconnectionDelayMax||5e3),this.randomizationFactor((s=o.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new no({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(o.timeout==null?2e4:o.timeout),this._readyState="closed",this.uri=r;const l=o.parser||GO;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=o.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(r){return arguments.length?(this._reconnection=!!r,r||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(r){return r===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=r,this)}reconnectionDelay(r){var o;return r===void 0?this._reconnectionDelay:(this._reconnectionDelay=r,(o=this.backoff)===null||o===void 0||o.setMin(r),this)}randomizationFactor(r){var o;return r===void 0?this._randomizationFactor:(this._randomizationFactor=r,(o=this.backoff)===null||o===void 0||o.setJitter(r),this)}reconnectionDelayMax(r){var o;return r===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=r,(o=this.backoff)===null||o===void 0||o.setMax(r),this)}timeout(r){return arguments.length?(this._timeout=r,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(r){if(~this._readyState.indexOf("open"))return this;this.engine=new AO(this.uri,this.opts);const o=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const l=Yt(o,"open",function(){s.onopen(),r&&r()}),u=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),r?r(h):this.maybeReconnectOnOpen()},f=Yt(o,"error",u);if(this._timeout!==!1){const h=this._timeout,p=this.setTimeoutFn(()=>{l(),u(new Error("timeout")),o.close()},h);this.opts.autoUnref&&p.unref(),this.subs.push(()=>{this.clearTimeoutFn(p)})}return this.subs.push(l),this.subs.push(f),this}connect(r){return this.open(r)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const r=this.engine;this.subs.push(Yt(r,"ping",this.onping.bind(this)),Yt(r,"data",this.ondata.bind(this)),Yt(r,"error",this.onerror.bind(this)),Yt(r,"close",this.onclose.bind(this)),Yt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(r){try{this.decoder.add(r)}catch(o){this.onclose("parse error",o)}}ondecoded(r){_a(()=>{this.emitReserved("packet",r)},this.setTimeoutFn)}onerror(r){this.emitReserved("error",r)}socket(r,o){let s=this.nsps[r];return s?this._autoConnect&&!s.active&&s.connect():(s=new uv(this,r,o),this.nsps[r]=s),s}_destroy(r){const o=Object.keys(this.nsps);for(const s of o)if(this.nsps[s].active)return;this._close()}_packet(r){const o=this.encoder.encode(r);for(let s=0;s<o.length;s++)this.engine.write(o[s],r.options)}cleanup(){this.subs.forEach(r=>r()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(r,o){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",r,o),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const r=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const o=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{r.skipReconnect||(this.emitReserved("reconnect_attempt",r.backoff.attempts),!r.skipReconnect&&r.open(l=>{l?(r._reconnecting=!1,r.reconnect(),this.emitReserved("reconnect_error",l)):r.onreconnect()}))},o);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const r=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",r)}}const Xo={};function Ys(e,r){typeof e=="object"&&(r=e,e=void 0),r=r||{};const o=IO(e,r.path||"/socket.io"),s=o.source,l=o.id,u=o.path,f=Xo[l]&&u in Xo[l].nsps,h=r.forceNew||r["force new connection"]||r.multiplex===!1||f;let p;return h?p=new qc(s,r):(Xo[l]||(Xo[l]=new qc(s,r)),p=Xo[l]),o.query&&!r.query&&(r.query=o.queryKey),p.socket(o.path,r)}Object.assign(Ys,{Manager:qc,Socket:uv,io:Ys,connect:Ys});const VO=[ge.ActionTypes.MESSAGE_TO_GUEST,ge.ActionTypes.EVENT_TO_GUEST,ge.ActionTypes.TYPING_ON,ge.ActionTypes.TYPING_OFF,ge.ActionTypes.RESTART_CHAT_REQUEST,...BS,...Mb,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],qO=({dispatch:e,getState:r})=>o=>{let s=null;return l=>{const u=o(l);if(l.type===mf){s!=null&&s.disconnect(),e(HS());const f=`/chat?${ua.stringify(l.querystrings)}`;s=Ys(`/${l.clientName}${f}`),s.on("action",e),s.on("connect",()=>e(zS())),s.on("disconnect",()=>e(GS())),s.on("reconnect",()=>e($S())),s.on("set-translations",(h,p)=>{e(HR({language:h,messages:MR(h,p)}))}),s.on("set-settings",h=>{e($R(h))}),s.on("enable-conversation-rating",h=>e(Ub(h))),s.on("speech-transcription",h=>e(Lb(h))),s.on("restore-client-state",h=>{e(US(h.sessionId)),e(zb(h.messages))}),s.on("expand-window",({devices:h,initial:p=!1})=>{e({type:q0,devices:h,initial:p})}),s.on("restart-chat",()=>{e(ga(l.clientName,l.querystrings))})}else if(l.type===pa)s==null||s.emit("start-chat",l.payload);else if(l.type===ma)s==null||s.emit("terminate-session",l.payload);else if(l.type===Pb)s==null||s.emit("get-started",JSON.stringify(l));else if(l.type===sf)s==null||s.emit("audio-message",l.buffer);else if(l.type===ge.ActionTypes.CONVERSATION_RATING_FROM_GUEST)s==null||s.emit("conversation-rating",l.payload);else if(l.type===K0){const{connection:{sessionId:f}}=r();window.location.href=`/transcript-pdf/${f}`}else VO.indexOf(l.type)===-1&&l.meta===void 0&&s&&s.emit("action",JSON.stringify(l));return u}},cv=jy(),WO={...KR(cv),intl:Vy},Wc=_S({middleware:e=>e().concat(qO),reducer:qR,preloadedState:WO});Wc.subscribe(kR(()=>{const e=Wc.getState();ZR(cv,{connection:e.connection,startScreen:e.startScreen})},1e3));const KO=document.getElementById("root"),ZO=y1.createRoot(KO);ZO.render(y.jsx(pE,{store:Wc,children:y.jsx(hR,{})}));
|
|
110
|
-
//# sourceMappingURL=index-
|
|
109
|
+
- 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.close":"Chiudere","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","header.restart-chat":"Riavviare la chat","header.expand-chat":"Allarga la chat","header.close-chat":"Ridurre al minimo la chat","source-infos.close":"Chiudere","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","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"},PR=["de","en","fr","it"],Vy={locale:"de",messages:$y},MR=(e,r)=>{if(PR.includes(e)){const o=FR(e),s=NR(r);return{...o,...s}}return r},FR=e=>{switch(e.toString()){case"en":return AR;case"fr":return IR;case"it":return DR;default:return $y}},LR=(e=BR,r)=>{switch(r.type){case gf:return Object.assign({},e,{connectionState:Er.CONNECTING});case yf:return Object.assign({},e,{connectionState:Er.CONNECTED});case vf:return Object.assign({},e,{connectionState:Er.DISCONNECTED});case _f:return Object.assign({},e,{connectionState:Er.RECONNECTED});case Ef:return Object.assign({},e,{sessionId:r.sessionId});case pa:return Object.assign({},e,{sessionId:r.payload.sessionId,userId:r.payload.userId});case ma:return Object.assign({},e,{sessionId:void 0});default:return e}},BR={connectionState:Er.DISCONNECTED,sessionId:void 0,userId:void 0},jR=(e=qg,r)=>{switch(r.type){case cy:return qg;case pa:return yr({type:"webclient.chat.started"}),e;case ma:return yr({type:"webclient.chat.ended"}),e;case ge.ActionTypes.TYPING_ON:return Object.assign({},e,{isBotTyping:!0});case ge.ActionTypes.TYPING_OFF:return Object.assign({},e,{isBotTyping:!1});case ge.ActionTypes.MESSAGE_FROM_GUEST:case ge.ActionTypes.MESSAGE_WITHOUT_ANALYSIS_FROM_GUEST:return Vg(e,r.message);case ge.ActionTypes.MESSAGE_TO_GUEST:{yr(r);const o=Object.assign({},r.message,{_id:r.meta.actionId}),s=e.messages.filter(l=>l._id===r.meta.actionId).length>0;return Object.assign({},e,{isBotTyping:!1,messages:s?e.messages:e.messages.concat([o]),quickReplies:o.quickReplies?o.quickReplies:[]})}case of:{const o=r.messages,s=o.length?o[o.length-1]:void 0;return Object.assign({},e,{isBotTyping:!1,messages:o,quickReplies:(s==null?void 0:s.quickReplies)||[]})}case rf:return yr(r.message),e;case ge.ActionTypes.EVENT_TO_GUEST:return yr(r.event),e;case ge.ActionTypes.DRAWER_OPEN:return Object.assign({},e,{drawerContentUrl:r.payload.parameters.contentUrl});case ge.ActionTypes.DRAWER_CLOSE:return Object.assign({},e,{drawerContentUrl:void 0});case ge.ActionTypes.GUEST_LOCALE_CHANGED:return Object.assign({},e,{locale:r.payload.locale});case q0:return yr(r),e;case W0:return yr(r),e;case af:{const o=new ge.TextMessage(r.transcription,new ge.GuestUser),s=Object.assign({},o,{_id:Ic()});return Vg(e,s)}case ge.ActionTypes.TRANSCRIPT_ITEM_GUEST_REACTION:{const o=e.messages.map(s=>s._id===r.payload.actionId?Object.assign({},s,{reaction:r.payload.reaction}):s);return Object.assign({},e,{messages:o})}case lf:{const o={enabled:!0,rating:r.payload.rating};return Object.assign({},e,{conversationRating:o})}case ge.ActionTypes.CONVERSATION_RATING_FROM_GUEST:{const o={...e.conversationRating,rating:r.payload};return Object.assign({},e,{conversationRating:o})}case uf:return{...e,sourceInfos:{type:"loading",chunkId:r.payload.chunkId}};case V0:return{...e,sourceInfos:{type:"loading-error"}};case $0:return{...e,sourceInfos:{type:"loaded",chunkId:r.payload.chunkId,knowledgeBaseType:r.payload.knowledgeBaseType,title:r.payload.title,content:r.payload.content,url:r.payload.url}};case cf:return{...e,sourceInfos:void 0};default:return e}},Vg=(e,r)=>{const o=e.messages[e.messages.length-1],s=(o==null?void 0:o.text)===r.text;return o&&o.sender.type===r.sender.type&&s?e:Object.assign({},e,{messages:e.messages.concat([r]),quickReplies:[]})},yr=e=>{var r;UR()?(r=window.top)==null||r.postMessage(e,"*"):e.type==="webclient.change.url"&&window.open(e.url)},UR=()=>typeof window<"u"&&window.self!==window.top,qg={messages:[],quickReplies:[],isBotTyping:!1,conversationRating:{enabled:!1}},qy=pf({name:"intl",initialState:Vy,reducers:{updateIntl:(e,r)=>{e.locale=r.payload.language,e.messages=r.payload.messages}}}),{updateIntl:HR}=qy.actions,zR=qy.reducer,GR={enableStartScreen:!1,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[]},Wy=pf({name:"settings",initialState:GR,reducers:{setSettings(e,r){e.enableStartScreen=r.payload.enableStartScreen,e.enableStandaloneView=r.payload.enableStandaloneView,e.enableTranscriptExportEmail=r.payload.enableTranscriptExportEmail,e.enableTranscriptExportPdf=r.payload.enableTranscriptExportPdf,e.enableGeneralConditions=r.payload.enableGeneralConditions,e.enableSpeechSupport=r.payload.enableSpeechSupport,e.commands=r.payload.commands}}}),{setSettings:$R}=Wy.actions,VR=Wy.reducer,qR=Y0({settings:VR,chat:jR,startScreen:PS,connection:LR,intl:zR}),WR="bubble-chat",Ky="state-last-saved-at",Zy="state",KR=e=>{try{if(!XR())return;const r=Wg(e,Ky);if(QR(r))return;{const o=Wg(e,Zy);return o===null?void 0:JSON.parse(o)}}catch(r){console.error(r);return}},ZR=(e,r)=>{try{const o=JSON.stringify(r);Kg(e,Zy,o);const s=new Date().toISOString();Kg(e,Ky,s)}catch(o){console.error(o)}},QR=e=>{if(e===null)return!1;const r=new Date(e);return r.setHours(r.getHours()+12),new Date>r},XR=()=>typeof localStorage<"u",Wg=(e,r)=>{const o=Qy(e,r);return localStorage.getItem(o)},Kg=(e,r,o)=>{const s=Qy(e,r);return localStorage.setItem(s,o)},Qy=(e,r)=>`${WR}-${e}-${r}`,pn=Object.create(null);pn.open="0";pn.close="1";pn.ping="2";pn.pong="3";pn.message="4";pn.upgrade="5";pn.noop="6";const Zs=Object.create(null);Object.keys(pn).forEach(e=>{Zs[pn[e]]=e});const Hc={type:"error",data:"parser error"},Xy=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Yy=typeof ArrayBuffer=="function",Jy=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Cf=({type:e,data:r},o,s)=>Xy&&r instanceof Blob?o?s(r):Zg(r,s):Yy&&(r instanceof ArrayBuffer||Jy(r))?o?s(r):Zg(new Blob([r]),s):s(pn[e]+(r||"")),Zg=(e,r)=>{const o=new FileReader;return o.onload=function(){const s=o.result.split(",")[1];r("b"+(s||""))},o.readAsDataURL(e)};function Qg(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let pc;function YR(e,r){if(Xy&&e.data instanceof Blob)return e.data.arrayBuffer().then(Qg).then(r);if(Yy&&(e.data instanceof ArrayBuffer||Jy(e.data)))return r(Qg(e.data));Cf(e,!1,o=>{pc||(pc=new TextEncoder),r(pc.encode(o))})}const Xg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ei=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Xg.length;e++)ei[Xg.charCodeAt(e)]=e;const JR=e=>{let r=e.length*.75,o=e.length,s,l=0,u,f,h,p;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);const v=new ArrayBuffer(r),_=new Uint8Array(v);for(s=0;s<o;s+=4)u=ei[e.charCodeAt(s)],f=ei[e.charCodeAt(s+1)],h=ei[e.charCodeAt(s+2)],p=ei[e.charCodeAt(s+3)],_[l++]=u<<2|f>>4,_[l++]=(f&15)<<4|h>>2,_[l++]=(h&3)<<6|p&63;return v},eO=typeof ArrayBuffer=="function",kf=(e,r)=>{if(typeof e!="string")return{type:"message",data:ev(e,r)};const o=e.charAt(0);return o==="b"?{type:"message",data:tO(e.substring(1),r)}:Zs[o]?e.length>1?{type:Zs[o],data:e.substring(1)}:{type:Zs[o]}:Hc},tO=(e,r)=>{if(eO){const o=JR(e);return ev(o,r)}else return{base64:!0,data:e}},ev=(e,r)=>{switch(r){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},tv="",nO=(e,r)=>{const o=e.length,s=new Array(o);let l=0;e.forEach((u,f)=>{Cf(u,!1,h=>{s[f]=h,++l===o&&r(s.join(tv))})})},rO=(e,r)=>{const o=e.split(tv),s=[];for(let l=0;l<o.length;l++){const u=kf(o[l],r);if(s.push(u),u.type==="error")break}return s};function oO(){return new TransformStream({transform(e,r){YR(e,o=>{const s=o.length;let l;if(s<126)l=new Uint8Array(1),new DataView(l.buffer).setUint8(0,s);else if(s<65536){l=new Uint8Array(3);const u=new DataView(l.buffer);u.setUint8(0,126),u.setUint16(1,s)}else{l=new Uint8Array(9);const u=new DataView(l.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(l[0]|=128),r.enqueue(l),r.enqueue(o)})}})}let mc;function Vs(e){return e.reduce((r,o)=>r+o.length,0)}function qs(e,r){if(e[0].length===r)return e.shift();const o=new Uint8Array(r);let s=0;for(let l=0;l<r;l++)o[l]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),o}function iO(e,r){mc||(mc=new TextDecoder);const o=[];let s=0,l=-1,u=!1;return new TransformStream({transform(f,h){for(o.push(f);;){if(s===0){if(Vs(o)<1)break;const p=qs(o,1);u=(p[0]&128)===128,l=p[0]&127,l<126?s=3:l===126?s=1:s=2}else if(s===1){if(Vs(o)<2)break;const p=qs(o,2);l=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),s=3}else if(s===2){if(Vs(o)<8)break;const p=qs(o,8),v=new DataView(p.buffer,p.byteOffset,p.length),_=v.getUint32(0);if(_>Math.pow(2,21)-1){h.enqueue(Hc);break}l=_*Math.pow(2,32)+v.getUint32(4),s=3}else{if(Vs(o)<l)break;const p=qs(o,l);h.enqueue(kf(u?p:mc.decode(p),r)),s=0}if(l===0||l>e){h.enqueue(Hc);break}}}})}const nv=4;function We(e){if(e)return sO(e)}function sO(e){for(var r in We.prototype)e[r]=We.prototype[r];return e}We.prototype.on=We.prototype.addEventListener=function(e,r){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(r),this};We.prototype.once=function(e,r){function o(){this.off(e,o),r.apply(this,arguments)}return o.fn=r,this.on(e,o),this};We.prototype.off=We.prototype.removeListener=We.prototype.removeAllListeners=We.prototype.removeEventListener=function(e,r){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var o=this._callbacks["$"+e];if(!o)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,l=0;l<o.length;l++)if(s=o[l],s===r||s.fn===r){o.splice(l,1);break}return o.length===0&&delete this._callbacks["$"+e],this};We.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var r=new Array(arguments.length-1),o=this._callbacks["$"+e],s=1;s<arguments.length;s++)r[s-1]=arguments[s];if(o){o=o.slice(0);for(var s=0,l=o.length;s<l;++s)o[s].apply(this,r)}return this};We.prototype.emitReserved=We.prototype.emit;We.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};We.prototype.hasListeners=function(e){return!!this.listeners(e).length};const _a=typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,o)=>o(r,0),Bt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),aO="arraybuffer";function rv(e,...r){return r.reduce((o,s)=>(e.hasOwnProperty(s)&&(o[s]=e[s]),o),{})}const lO=Bt.setTimeout,uO=Bt.clearTimeout;function Ea(e,r){r.useNativeTimers?(e.setTimeoutFn=lO.bind(Bt),e.clearTimeoutFn=uO.bind(Bt)):(e.setTimeoutFn=Bt.setTimeout.bind(Bt),e.clearTimeoutFn=Bt.clearTimeout.bind(Bt))}const cO=1.33;function fO(e){return typeof e=="string"?dO(e):Math.ceil((e.byteLength||e.size)*cO)}function dO(e){let r=0,o=0;for(let s=0,l=e.length;s<l;s++)r=e.charCodeAt(s),r<128?o+=1:r<2048?o+=2:r<55296||r>=57344?o+=3:(s++,o+=4);return o}function ov(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function hO(e){let r="";for(let o in e)e.hasOwnProperty(o)&&(r.length&&(r+="&"),r+=encodeURIComponent(o)+"="+encodeURIComponent(e[o]));return r}function pO(e){let r={},o=e.split("&");for(let s=0,l=o.length;s<l;s++){let u=o[s].split("=");r[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return r}class mO extends Error{constructor(r,o,s){super(r),this.description=o,this.context=s,this.type="TransportError"}}class Rf extends We{constructor(r){super(),this.writable=!1,Ea(this,r),this.opts=r,this.query=r.query,this.socket=r.socket,this.supportsBinary=!r.forceBase64}onError(r,o,s){return super.emitReserved("error",new mO(r,o,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(r){this.readyState==="open"&&this.write(r)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(r){const o=kf(r,this.socket.binaryType);this.onPacket(o)}onPacket(r){super.emitReserved("packet",r)}onClose(r){this.readyState="closed",super.emitReserved("close",r)}pause(r){}createUri(r,o={}){return r+"://"+this._hostname()+this._port()+this.opts.path+this._query(o)}_hostname(){const r=this.opts.hostname;return r.indexOf(":")===-1?r:"["+r+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(r){const o=hO(r);return o.length?"?"+o:""}}class gO extends Rf{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(r){this.readyState="pausing";const o=()=>{this.readyState="paused",r()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||o()})),this.writable||(s++,this.once("drain",function(){--s||o()}))}else o()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(r){const o=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};rO(r,this.socket.binaryType).forEach(o),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const r=()=>{this.write([{type:"close"}])};this.readyState==="open"?r():this.once("open",r)}write(r){this.writable=!1,nO(r,o=>{this.doWrite(o,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const r=this.opts.secure?"https":"http",o=this.query||{};return this.opts.timestampRequests!==!1&&(o[this.opts.timestampParam]=ov()),!this.supportsBinary&&!o.sid&&(o.b64=1),this.createUri(r,o)}}let iv=!1;try{iv=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const yO=iv;function vO(){}class _O extends gO{constructor(r){if(super(r),typeof location<"u"){const o=location.protocol==="https:";let s=location.port;s||(s=o?"443":"80"),this.xd=typeof location<"u"&&r.hostname!==location.hostname||s!==r.port}}doWrite(r,o){const s=this.request({method:"POST",data:r});s.on("success",o),s.on("error",(l,u)=>{this.onError("xhr post error",l,u)})}doPoll(){const r=this.request();r.on("data",this.onData.bind(this)),r.on("error",(o,s)=>{this.onError("xhr poll error",o,s)}),this.pollXhr=r}}class fn extends We{constructor(r,o,s){super(),this.createRequest=r,Ea(this,s),this._opts=s,this._method=s.method||"GET",this._uri=o,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var r;const o=rv(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");o.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(o);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let l in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(l)&&s.setRequestHeader(l,this._opts.extraHeaders[l])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(r=this._opts.cookieJar)===null||r===void 0||r.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var l;s.readyState===3&&((l=this._opts.cookieJar)===null||l===void 0||l.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(l){this.setTimeoutFn(()=>{this._onError(l)},0);return}typeof document<"u"&&(this._index=fn.requestsCount++,fn.requests[this._index]=this)}_onError(r){this.emitReserved("error",r,this._xhr),this._cleanup(!0)}_cleanup(r){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=vO,r)try{this._xhr.abort()}catch{}typeof document<"u"&&delete fn.requests[this._index],this._xhr=null}}_onLoad(){const r=this._xhr.responseText;r!==null&&(this.emitReserved("data",r),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}fn.requestsCount=0;fn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Yg);else if(typeof addEventListener=="function"){const e="onpagehide"in Bt?"pagehide":"unload";addEventListener(e,Yg,!1)}}function Yg(){for(let e in fn.requests)fn.requests.hasOwnProperty(e)&&fn.requests[e].abort()}const EO=function(){const e=sv({xdomain:!1});return e&&e.responseType!==null}();class wO extends _O{constructor(r){super(r);const o=r&&r.forceBase64;this.supportsBinary=EO&&!o}request(r={}){return Object.assign(r,{xd:this.xd},this.opts),new fn(sv,this.uri(),r)}}function sv(e){const r=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!r||yO))return new XMLHttpRequest}catch{}if(!r)try{return new Bt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const av=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class bO extends Rf{get name(){return"websocket"}doOpen(){const r=this.uri(),o=this.opts.protocols,s=av?{}:rv(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(r,o,s)}catch(l){return this.emitReserved("error",l)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=r=>this.onClose({description:"websocket connection closed",context:r}),this.ws.onmessage=r=>this.onData(r.data),this.ws.onerror=r=>this.onError("websocket error",r)}write(r){this.writable=!1;for(let o=0;o<r.length;o++){const s=r[o],l=o===r.length-1;Cf(s,this.supportsBinary,u=>{try{this.doWrite(s,u)}catch{}l&&_a(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const r=this.opts.secure?"wss":"ws",o=this.query||{};return this.opts.timestampRequests&&(o[this.opts.timestampParam]=ov()),this.supportsBinary||(o.b64=1),this.createUri(r,o)}}const gc=Bt.WebSocket||Bt.MozWebSocket;class SO extends bO{createSocket(r,o,s){return av?new gc(r,o,s):o?new gc(r,o):new gc(r)}doWrite(r,o){this.ws.send(o)}}class xO extends Rf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(r){return this.emitReserved("error",r)}this._transport.closed.then(()=>{this.onClose()}).catch(r=>{this.onError("webtransport error",r)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(r=>{const o=iO(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=r.readable.pipeThrough(o).getReader(),l=oO();l.readable.pipeTo(r.writable),this._writer=l.writable.getWriter();const u=()=>{s.read().then(({done:h,value:p})=>{h||(this.onPacket(p),u())}).catch(h=>{})};u();const f={type:"open"};this.query.sid&&(f.data=`{"sid":"${this.query.sid}"}`),this._writer.write(f).then(()=>this.onOpen())})})}write(r){this.writable=!1;for(let o=0;o<r.length;o++){const s=r[o],l=o===r.length-1;this._writer.write(s).then(()=>{l&&_a(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var r;(r=this._transport)===null||r===void 0||r.close()}}const TO={websocket:SO,webtransport:xO,polling:wO},CO=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,kO=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function zc(e){if(e.length>8e3)throw"URI too long";const r=e,o=e.indexOf("["),s=e.indexOf("]");o!=-1&&s!=-1&&(e=e.substring(0,o)+e.substring(o,s).replace(/:/g,";")+e.substring(s,e.length));let l=CO.exec(e||""),u={},f=14;for(;f--;)u[kO[f]]=l[f]||"";return o!=-1&&s!=-1&&(u.source=r,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=RO(u,u.path),u.queryKey=OO(u,u.query),u}function RO(e,r){const o=/\/{2,9}/g,s=r.replace(o,"/").split("/");return(r.slice(0,1)=="/"||r.length===0)&&s.splice(0,1),r.slice(-1)=="/"&&s.splice(s.length-1,1),s}function OO(e,r){const o={};return r.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,l,u){l&&(o[l]=u)}),o}const Gc=typeof addEventListener=="function"&&typeof removeEventListener=="function",Qs=[];Gc&&addEventListener("offline",()=>{Qs.forEach(e=>e())},!1);class Yn extends We{constructor(r,o){if(super(),this.binaryType=aO,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,r&&typeof r=="object"&&(o=r,r=null),r){const s=zc(r);o.hostname=s.host,o.secure=s.protocol==="https"||s.protocol==="wss",o.port=s.port,s.query&&(o.query=s.query)}else o.host&&(o.hostname=zc(o.host).host);Ea(this,o),this.secure=o.secure!=null?o.secure:typeof location<"u"&&location.protocol==="https:",o.hostname&&!o.port&&(o.port=this.secure?"443":"80"),this.hostname=o.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=o.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},o.transports.forEach(s=>{const l=s.prototype.name;this.transports.push(l),this._transportsByName[l]=s}),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},o),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=pO(this.opts.query)),Gc&&(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"})},Qs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(r){const o=Object.assign({},this.opts.query);o.EIO=nv,o.transport=r,this.id&&(o.sid=this.id);const s=Object.assign({},this.opts,{query:o,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[r]);return new this._transportsByName[r](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const r=this.opts.rememberUpgrade&&Yn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const o=this.createTransport(r);o.open(),this.setTransport(o)}setTransport(r){this.transport&&this.transport.removeAllListeners(),this.transport=r,r.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",o=>this._onClose("transport close",o))}onOpen(){this.readyState="open",Yn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",r),this.emitReserved("heartbeat"),r.type){case"open":this.onHandshake(JSON.parse(r.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const o=new Error("server error");o.code=r.data,this._onError(o);break;case"message":this.emitReserved("data",r.data),this.emitReserved("message",r.data);break}}onHandshake(r){this.emitReserved("handshake",r),this.id=r.sid,this.transport.query.sid=r.sid,this._pingInterval=r.pingInterval,this._pingTimeout=r.pingTimeout,this._maxPayload=r.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const r=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+r,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},r),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 r=this._getWritablePackets();this.transport.send(r),this._prevBufferLen=r.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let o=1;for(let s=0;s<this.writeBuffer.length;s++){const l=this.writeBuffer[s].data;if(l&&(o+=fO(l)),s>0&&o>this._maxPayload)return this.writeBuffer.slice(0,s);o+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const r=Date.now()>this._pingTimeoutTime;return r&&(this._pingTimeoutTime=0,_a(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),r}write(r,o,s){return this._sendPacket("message",r,o,s),this}send(r,o,s){return this._sendPacket("message",r,o,s),this}_sendPacket(r,o,s,l){if(typeof o=="function"&&(l=o,o=void 0),typeof s=="function"&&(l=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const u={type:r,data:o,options:s};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),l&&this.once("flush",l),this.flush()}close(){const r=()=>{this._onClose("forced close"),this.transport.close()},o=()=>{this.off("upgrade",o),this.off("upgradeError",o),r()},s=()=>{this.once("upgrade",o),this.once("upgradeError",o)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():r()}):this.upgrading?s():r()),this}_onError(r){if(Yn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",r),this._onClose("transport error",r)}_onClose(r,o){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(),Gc&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Qs.indexOf(this._offlineEventListener);s!==-1&&Qs.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",r,o),this.writeBuffer=[],this._prevBufferLen=0}}}Yn.protocol=nv;class NO extends Yn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let r=0;r<this._upgrades.length;r++)this._probe(this._upgrades[r])}_probe(r){let o=this.createTransport(r),s=!1;Yn.priorWebsocketSuccess=!1;const l=()=>{s||(o.send([{type:"ping",data:"probe"}]),o.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",o),!o)return;Yn.priorWebsocketSuccess=o.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(_(),this.setTransport(o),o.send([{type:"upgrade"}]),this.emitReserved("upgrade",o),o=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=o.name,this.emitReserved("upgradeError",m)}}))};function u(){s||(s=!0,_(),o.close(),o=null)}const f=b=>{const m=new Error("probe error: "+b);m.transport=o.name,u(),this.emitReserved("upgradeError",m)};function h(){f("transport closed")}function p(){f("socket closed")}function v(b){o&&b.name!==o.name&&u()}const _=()=>{o.removeListener("open",l),o.removeListener("error",f),o.removeListener("close",h),this.off("close",p),this.off("upgrading",v)};o.once("open",l),o.once("error",f),o.once("close",h),this.once("close",p),this.once("upgrading",v),this._upgrades.indexOf("webtransport")!==-1&&r!=="webtransport"?this.setTimeoutFn(()=>{s||o.open()},200):o.open()}onHandshake(r){this._upgrades=this._filterUpgrades(r.upgrades),super.onHandshake(r)}_filterUpgrades(r){const o=[];for(let s=0;s<r.length;s++)~this.transports.indexOf(r[s])&&o.push(r[s]);return o}}let AO=class extends NO{constructor(r,o={}){const s=typeof r=="object"?r:o;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(l=>TO[l]).filter(l=>!!l)),super(r,s)}};function IO(e,r="",o){let s=e;o=o||typeof location<"u"&&location,e==null&&(e=o.protocol+"//"+o.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=o.protocol+e:e=o.host+e),/^(https?|wss?):\/\//.test(e)||(typeof o<"u"?e=o.protocol+"//"+e:e="https://"+e),s=zc(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const u=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+u+":"+s.port+r,s.href=s.protocol+"://"+u+(o&&o.port===s.port?"":":"+s.port),s}const DO=typeof ArrayBuffer=="function",PO=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,lv=Object.prototype.toString,MO=typeof Blob=="function"||typeof Blob<"u"&&lv.call(Blob)==="[object BlobConstructor]",FO=typeof File=="function"||typeof File<"u"&&lv.call(File)==="[object FileConstructor]";function Of(e){return DO&&(e instanceof ArrayBuffer||PO(e))||MO&&e instanceof Blob||FO&&e instanceof File}function Xs(e,r){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let o=0,s=e.length;o<s;o++)if(Xs(e[o]))return!0;return!1}if(Of(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Xs(e.toJSON(),!0);for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&Xs(e[o]))return!0;return!1}function LO(e){const r=[],o=e.data,s=e;return s.data=$c(o,r),s.attachments=r.length,{packet:s,buffers:r}}function $c(e,r){if(!e)return e;if(Of(e)){const o={_placeholder:!0,num:r.length};return r.push(e),o}else if(Array.isArray(e)){const o=new Array(e.length);for(let s=0;s<e.length;s++)o[s]=$c(e[s],r);return o}else if(typeof e=="object"&&!(e instanceof Date)){const o={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(o[s]=$c(e[s],r));return o}return e}function BO(e,r){return e.data=Vc(e.data,r),delete e.attachments,e}function Vc(e,r){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<r.length)return r[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let o=0;o<e.length;o++)e[o]=Vc(e[o],r);else if(typeof e=="object")for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(e[o]=Vc(e[o],r));return e}const jO=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],UO=5;var Ee;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ee||(Ee={}));class HO{constructor(r){this.replacer=r}encode(r){return(r.type===Ee.EVENT||r.type===Ee.ACK)&&Xs(r)?this.encodeAsBinary({type:r.type===Ee.EVENT?Ee.BINARY_EVENT:Ee.BINARY_ACK,nsp:r.nsp,data:r.data,id:r.id}):[this.encodeAsString(r)]}encodeAsString(r){let o=""+r.type;return(r.type===Ee.BINARY_EVENT||r.type===Ee.BINARY_ACK)&&(o+=r.attachments+"-"),r.nsp&&r.nsp!=="/"&&(o+=r.nsp+","),r.id!=null&&(o+=r.id),r.data!=null&&(o+=JSON.stringify(r.data,this.replacer)),o}encodeAsBinary(r){const o=LO(r),s=this.encodeAsString(o.packet),l=o.buffers;return l.unshift(s),l}}function Jg(e){return Object.prototype.toString.call(e)==="[object Object]"}class Nf extends We{constructor(r){super(),this.reviver=r}add(r){let o;if(typeof r=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");o=this.decodeString(r);const s=o.type===Ee.BINARY_EVENT;s||o.type===Ee.BINARY_ACK?(o.type=s?Ee.EVENT:Ee.ACK,this.reconstructor=new zO(o),o.attachments===0&&super.emitReserved("decoded",o)):super.emitReserved("decoded",o)}else if(Of(r)||r.base64)if(this.reconstructor)o=this.reconstructor.takeBinaryData(r),o&&(this.reconstructor=null,super.emitReserved("decoded",o));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+r)}decodeString(r){let o=0;const s={type:Number(r.charAt(0))};if(Ee[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===Ee.BINARY_EVENT||s.type===Ee.BINARY_ACK){const u=o+1;for(;r.charAt(++o)!=="-"&&o!=r.length;);const f=r.substring(u,o);if(f!=Number(f)||r.charAt(o)!=="-")throw new Error("Illegal attachments");s.attachments=Number(f)}if(r.charAt(o+1)==="/"){const u=o+1;for(;++o&&!(r.charAt(o)===","||o===r.length););s.nsp=r.substring(u,o)}else s.nsp="/";const l=r.charAt(o+1);if(l!==""&&Number(l)==l){const u=o+1;for(;++o;){const f=r.charAt(o);if(f==null||Number(f)!=f){--o;break}if(o===r.length)break}s.id=Number(r.substring(u,o+1))}if(r.charAt(++o)){const u=this.tryParse(r.substr(o));if(Nf.isPayloadValid(s.type,u))s.data=u;else throw new Error("invalid payload")}return s}tryParse(r){try{return JSON.parse(r,this.reviver)}catch{return!1}}static isPayloadValid(r,o){switch(r){case Ee.CONNECT:return Jg(o);case Ee.DISCONNECT:return o===void 0;case Ee.CONNECT_ERROR:return typeof o=="string"||Jg(o);case Ee.EVENT:case Ee.BINARY_EVENT:return Array.isArray(o)&&(typeof o[0]=="number"||typeof o[0]=="string"&&jO.indexOf(o[0])===-1);case Ee.ACK:case Ee.BINARY_ACK:return Array.isArray(o)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class zO{constructor(r){this.packet=r,this.buffers=[],this.reconPack=r}takeBinaryData(r){if(this.buffers.push(r),this.buffers.length===this.reconPack.attachments){const o=BO(this.reconPack,this.buffers);return this.finishedReconstruction(),o}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const GO=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Nf,Encoder:HO,get PacketType(){return Ee},protocol:UO},Symbol.toStringTag,{value:"Module"}));function Yt(e,r,o){return e.on(r,o),function(){e.off(r,o)}}const $O=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class uv extends We{constructor(r,o,s){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=r,this.nsp=o,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const r=this.io;this.subs=[Yt(r,"open",this.onopen.bind(this)),Yt(r,"packet",this.onpacket.bind(this)),Yt(r,"error",this.onerror.bind(this)),Yt(r,"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(...r){return r.unshift("message"),this.emit.apply(this,r),this}emit(r,...o){var s,l,u;if($O.hasOwnProperty(r))throw new Error('"'+r.toString()+'" is a reserved event name');if(o.unshift(r),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(o),this;const f={type:Ee.EVENT,data:o};if(f.options={},f.options.compress=this.flags.compress!==!1,typeof o[o.length-1]=="function"){const _=this.ids++,b=o.pop();this._registerAckCallback(_,b),f.id=_}const h=(l=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||l===void 0?void 0:l.writable,p=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!h||(p?(this.notifyOutgoingListeners(f),this.packet(f)):this.sendBuffer.push(f)),this.flags={},this}_registerAckCallback(r,o){var s;const l=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(l===void 0){this.acks[r]=o;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[r];for(let h=0;h<this.sendBuffer.length;h++)this.sendBuffer[h].id===r&&this.sendBuffer.splice(h,1);o.call(this,new Error("operation has timed out"))},l),f=(...h)=>{this.io.clearTimeoutFn(u),o.apply(this,h)};f.withError=!0,this.acks[r]=f}emitWithAck(r,...o){return new Promise((s,l)=>{const u=(f,h)=>f?l(f):s(h);u.withError=!0,o.push(u),this.emit(r,...o)})}_addToQueue(r){let o;typeof r[r.length-1]=="function"&&(o=r.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:r,flags:Object.assign({fromQueue:!0},this.flags)};r.push((l,...u)=>s!==this._queue[0]?void 0:(l!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),o&&o(l)):(this._queue.shift(),o&&o(null,...u)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(r=!1){if(!this.connected||this._queue.length===0)return;const o=this._queue[0];o.pending&&!r||(o.pending=!0,o.tryCount++,this.flags=o.flags,this.emit.apply(this,o.args))}packet(r){r.nsp=this.nsp,this.io._packet(r)}onopen(){typeof this.auth=="function"?this.auth(r=>{this._sendConnectPacket(r)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(r){this.packet({type:Ee.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},r):r})}onerror(r){this.connected||this.emitReserved("connect_error",r)}onclose(r,o){this.connected=!1,delete this.id,this.emitReserved("disconnect",r,o),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(r=>{if(!this.sendBuffer.some(s=>String(s.id)===r)){const s=this.acks[r];delete this.acks[r],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(r){if(r.nsp===this.nsp)switch(r.type){case Ee.CONNECT:r.data&&r.data.sid?this.onconnect(r.data.sid,r.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 Ee.EVENT:case Ee.BINARY_EVENT:this.onevent(r);break;case Ee.ACK:case Ee.BINARY_ACK:this.onack(r);break;case Ee.DISCONNECT:this.ondisconnect();break;case Ee.CONNECT_ERROR:this.destroy();const s=new Error(r.data.message);s.data=r.data.data,this.emitReserved("connect_error",s);break}}onevent(r){const o=r.data||[];r.id!=null&&o.push(this.ack(r.id)),this.connected?this.emitEvent(o):this.receiveBuffer.push(Object.freeze(o))}emitEvent(r){if(this._anyListeners&&this._anyListeners.length){const o=this._anyListeners.slice();for(const s of o)s.apply(this,r)}super.emit.apply(this,r),this._pid&&r.length&&typeof r[r.length-1]=="string"&&(this._lastOffset=r[r.length-1])}ack(r){const o=this;let s=!1;return function(...l){s||(s=!0,o.packet({type:Ee.ACK,id:r,data:l}))}}onack(r){const o=this.acks[r.id];typeof o=="function"&&(delete this.acks[r.id],o.withError&&r.data.unshift(null),o.apply(this,r.data))}onconnect(r,o){this.id=r,this.recovered=o&&this._pid===o,this._pid=o,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(r=>this.emitEvent(r)),this.receiveBuffer=[],this.sendBuffer.forEach(r=>{this.notifyOutgoingListeners(r),this.packet(r)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(r=>r()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ee.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(r){return this.flags.compress=r,this}get volatile(){return this.flags.volatile=!0,this}timeout(r){return this.flags.timeout=r,this}onAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(r),this}prependAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(r),this}offAny(r){if(!this._anyListeners)return this;if(r){const o=this._anyListeners;for(let s=0;s<o.length;s++)if(r===o[s])return o.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(r),this}prependAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(r),this}offAnyOutgoing(r){if(!this._anyOutgoingListeners)return this;if(r){const o=this._anyOutgoingListeners;for(let s=0;s<o.length;s++)if(r===o[s])return o.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(r){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const o=this._anyOutgoingListeners.slice();for(const s of o)s.apply(this,r.data)}}}function no(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}no.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),o=Math.floor(r*this.jitter*e);e=(Math.floor(r*10)&1)==0?e-o:e+o}return Math.min(e,this.max)|0};no.prototype.reset=function(){this.attempts=0};no.prototype.setMin=function(e){this.ms=e};no.prototype.setMax=function(e){this.max=e};no.prototype.setJitter=function(e){this.jitter=e};class qc extends We{constructor(r,o){var s;super(),this.nsps={},this.subs=[],r&&typeof r=="object"&&(o=r,r=void 0),o=o||{},o.path=o.path||"/socket.io",this.opts=o,Ea(this,o),this.reconnection(o.reconnection!==!1),this.reconnectionAttempts(o.reconnectionAttempts||1/0),this.reconnectionDelay(o.reconnectionDelay||1e3),this.reconnectionDelayMax(o.reconnectionDelayMax||5e3),this.randomizationFactor((s=o.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new no({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(o.timeout==null?2e4:o.timeout),this._readyState="closed",this.uri=r;const l=o.parser||GO;this.encoder=new l.Encoder,this.decoder=new l.Decoder,this._autoConnect=o.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(r){return arguments.length?(this._reconnection=!!r,r||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(r){return r===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=r,this)}reconnectionDelay(r){var o;return r===void 0?this._reconnectionDelay:(this._reconnectionDelay=r,(o=this.backoff)===null||o===void 0||o.setMin(r),this)}randomizationFactor(r){var o;return r===void 0?this._randomizationFactor:(this._randomizationFactor=r,(o=this.backoff)===null||o===void 0||o.setJitter(r),this)}reconnectionDelayMax(r){var o;return r===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=r,(o=this.backoff)===null||o===void 0||o.setMax(r),this)}timeout(r){return arguments.length?(this._timeout=r,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(r){if(~this._readyState.indexOf("open"))return this;this.engine=new AO(this.uri,this.opts);const o=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const l=Yt(o,"open",function(){s.onopen(),r&&r()}),u=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),r?r(h):this.maybeReconnectOnOpen()},f=Yt(o,"error",u);if(this._timeout!==!1){const h=this._timeout,p=this.setTimeoutFn(()=>{l(),u(new Error("timeout")),o.close()},h);this.opts.autoUnref&&p.unref(),this.subs.push(()=>{this.clearTimeoutFn(p)})}return this.subs.push(l),this.subs.push(f),this}connect(r){return this.open(r)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const r=this.engine;this.subs.push(Yt(r,"ping",this.onping.bind(this)),Yt(r,"data",this.ondata.bind(this)),Yt(r,"error",this.onerror.bind(this)),Yt(r,"close",this.onclose.bind(this)),Yt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(r){try{this.decoder.add(r)}catch(o){this.onclose("parse error",o)}}ondecoded(r){_a(()=>{this.emitReserved("packet",r)},this.setTimeoutFn)}onerror(r){this.emitReserved("error",r)}socket(r,o){let s=this.nsps[r];return s?this._autoConnect&&!s.active&&s.connect():(s=new uv(this,r,o),this.nsps[r]=s),s}_destroy(r){const o=Object.keys(this.nsps);for(const s of o)if(this.nsps[s].active)return;this._close()}_packet(r){const o=this.encoder.encode(r);for(let s=0;s<o.length;s++)this.engine.write(o[s],r.options)}cleanup(){this.subs.forEach(r=>r()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(r,o){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",r,o),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const r=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const o=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{r.skipReconnect||(this.emitReserved("reconnect_attempt",r.backoff.attempts),!r.skipReconnect&&r.open(l=>{l?(r._reconnecting=!1,r.reconnect(),this.emitReserved("reconnect_error",l)):r.onreconnect()}))},o);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const r=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",r)}}const Xo={};function Ys(e,r){typeof e=="object"&&(r=e,e=void 0),r=r||{};const o=IO(e,r.path||"/socket.io"),s=o.source,l=o.id,u=o.path,f=Xo[l]&&u in Xo[l].nsps,h=r.forceNew||r["force new connection"]||r.multiplex===!1||f;let p;return h?p=new qc(s,r):(Xo[l]||(Xo[l]=new qc(s,r)),p=Xo[l]),o.query&&!r.query&&(r.query=o.queryKey),p.socket(o.path,r)}Object.assign(Ys,{Manager:qc,Socket:uv,io:Ys,connect:Ys});const VO=[ge.ActionTypes.MESSAGE_TO_GUEST,ge.ActionTypes.EVENT_TO_GUEST,ge.ActionTypes.TYPING_ON,ge.ActionTypes.TYPING_OFF,ge.ActionTypes.RESTART_CHAT_REQUEST,...BS,...Mb,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],qO=({dispatch:e,getState:r})=>o=>{let s=null;return l=>{const u=o(l);if(l.type===mf){s!=null&&s.disconnect(),e(HS());const f=`/chat?${ua.stringify(l.querystrings)}`;s=Ys(`/${l.clientName}${f}`),s.on("action",e),s.on("connect",()=>e(zS())),s.on("disconnect",()=>e(GS())),s.on("reconnect",()=>e($S())),s.on("set-translations",(h,p)=>{e(HR({language:h,messages:MR(h,p)}))}),s.on("set-settings",h=>{e($R(h))}),s.on("enable-conversation-rating",h=>e(Ub(h))),s.on("speech-transcription",h=>e(Lb(h))),s.on("restore-client-state",h=>{e(US(h.sessionId)),e(zb(h.messages))}),s.on("expand-window",({devices:h,initial:p=!1})=>{e({type:q0,devices:h,initial:p})}),s.on("restart-chat",()=>{e(ga(l.clientName,l.querystrings))})}else if(l.type===pa)s==null||s.emit("start-chat",l.payload);else if(l.type===ma)s==null||s.emit("terminate-session",l.payload);else if(l.type===Pb)s==null||s.emit("get-started",JSON.stringify(l));else if(l.type===sf)s==null||s.emit("audio-message",l.buffer);else if(l.type===ge.ActionTypes.CONVERSATION_RATING_FROM_GUEST)s==null||s.emit("conversation-rating",l.payload);else if(l.type===K0){const{connection:{sessionId:f}}=r();window.location.href=`/transcript-pdf/${f}`}else VO.indexOf(l.type)===-1&&l.meta===void 0&&s&&s.emit("action",JSON.stringify(l));return u}},cv=jy(),WO={...KR(cv),intl:Vy},Wc=_S({middleware:e=>e().concat(qO),reducer:qR,preloadedState:WO});Wc.subscribe(kR(()=>{const e=Wc.getState();ZR(cv,{connection:e.connection,startScreen:e.startScreen})},1e3));const KO=document.getElementById("root"),ZO=y1.createRoot(KO);ZO.render(y.jsx(pE,{store:Wc,children:y.jsx(hR,{})}));
|
|
110
|
+
//# sourceMappingURL=index-CXS7bgvw.js.map
|