@botfabrik/engine-webclient 4.110.2 → 4.110.4
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/dist/applySecurityMiddleware.js +18 -18
- package/dist/applySecurityMiddleware.test.js +14 -14
- package/dist/client/assets/{index-DR0rhLK_.js → index-iPU9jlP1.js} +3 -3
- package/dist/client/assets/{index-DR0rhLK_.js.map → index-iPU9jlP1.js.map} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +3 -3
|
@@ -60,7 +60,7 @@ ${ue.current.stack}
|
|
|
60
60
|
`).map((c,f)=>v.jsxs("span",{className:nv.text,children:[c,v.jsx("br",{})]},f))]})},tT=({text:n,commands:l,sources:r,onLinkClick:s})=>v.jsxs("div",{className:Ne.bubbleContent,children:[v.jsx(eT,{text:n,commands:l}),v.jsx(sm,{sources:r,onLinkClick:s})]}),nT=q.forwardRef(({message:n,commands:l,isLastMessage:r,isFirstMessageBySender:s,isLastMessageBySender:c,onReaction:f,onButtonClick:d,onLinkClick:m},h)=>{const p=aT(n._id,n,l,d,m),y=b=>{f(n._id,b)};return n.sender.type===xl.GUEST?v.jsx(J6,{ref:h,isFirstMessageBySender:s,isLastMessageBySender:c,children:p}):v.jsx(jy,{ref:h,message:n,isAnimated:!1,isLastMessage:r,isFirstMessageBySender:s,isLastMessageBySender:c,onReaction:y,children:p})}),aT=(n,l,r,s,c)=>{switch(l.type){case Di.TEXT:{const f=l;return v.jsx(tT,{text:f.text,commands:r,sources:l.sources||[],onLinkClick:c})}case Di.DETAIL:{const f=l;return v.jsx(F6,{title:f.title,text:f.text,imageUrl:f.imageUrl,itemUrl:f.itemUrl,buttons:f.buttons,sources:l.sources||[],onButtonClick:s,onLinkClick:c})}case Di.MARKDOWN:{const f=l;return v.jsx(W6,{actionId:n,markdown:f.markdown,sources:f.sources||[],onLinkClick:c})}}},lT=(n,l)=>n.message._id===l.message._id&&n.message.reaction===l.message.reaction&&n.isLastMessage===l.isLastMessage&&n.isFirstMessageBySender===l.isFirstMessageBySender&&n.isLastMessageBySender===l.isLastMessageBySender,rT=Nv.memo(nT,lT),iT="_ticontainer_xg0dn_1",sT="_tiblock_xg0dn_5",oT="_tidot_xg0dn_12",Ls={ticontainer:iT,tiblock:sT,tidot:oT},cT=({isTyping:n=!1})=>v.jsx("div",{className:Ls.ticontainer,children:v.jsx("div",{className:Ls.tiblock,children:n?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:se(Ls.tidot,"chat__typingIndicator"),"aria-hidden":"true"}),v.jsx("div",{className:se(Ls.tidot,"chat__typingIndicator"),"aria-hidden":"true"}),v.jsx("div",{className:se(Ls.tidot,"chat__typingIndicator"),"aria-hidden":"true"})]}):null})}),uT=Object.assign({_id:"typing-indicator"},new nu("",new WA)),fT=({messages:n,isBotTyping:l,commands:r,onTranscriptItemReaction:s,onButtonClick:c,onLinkClick:f})=>{const d=St(),m=q.useRef(0),h=q.useRef(!0),p=q.useRef(null),y=q.useRef(null),b=q.useRef(null),C=Dt(A=>A.settings.enableGeneralConditions);q.useLayoutEffect(()=>{if(n.length&&p.current&&(m.current<n.length||l)){if(y.current){const A=y.current.offsetTop;p.current.scrollTop=A}else if(b.current){const A=b.current.offsetTop;p.current.scrollTop=A}h.current&&(h.current=!1),m.current=n.length}},[n,h,l]);let E;const x=n.length;return v.jsxs("div",{ref:p,className:se(D1.messageContainer,"chat__messageContainer"),style:{scrollBehavior:n.length&&h.current?"auto":"smooth"},id:"MessageContainer","aria-label":d("conversation.label"),children:[C&&v.jsx(HE,{}),v.jsxs("ul",{className:D1.messages,role:"list",children:[n.map((A,S)=>{const N=dT(A,E),k=hT(A,S,n,l);E=A.sender.type;const M=S+1===x,L=A._id||`added-${S}`;return v.jsx(rT,{ref:M?b:null,message:A,commands:r,isLastMessage:M,isFirstMessageBySender:N,isLastMessageBySender:k,onButtonClick:c,onLinkClick:f,onReaction:s},L)}),l&&v.jsx(jy,{ref:y,message:uT,isLastMessage:!1,isAnimated:!0,isFirstMessageBySender:E!==xl.BOT,isLastMessageBySender:!0,children:v.jsx(cT,{isTyping:!0})},"last")]})]})},dT=(n,l)=>!l||l!==n.sender.type,hT=(n,l,r,s)=>{const c=n.sender.type,f=r.length;return l+1===f?!(c===xl.BOT&&s):c!==r.at(l+1)?.sender.type},mT="_bottomSheet_jp8dl_1",pT="_bottomSheetOpen_jp8dl_15",gT="_bottomSheetClose_jp8dl_20",El={bottomSheet:mT,bottomSheetOpen:pT,bottomSheetClose:gT},vT="_container_xc2nx_1",av={container:vT},yT=({contentUrl:n})=>{const l=Dt(f=>f.connection.sessionId),[r,s]=q.useState(!1);q.useEffect(()=>{s(f=>f||!!n)},[n]);const c=q.useMemo(()=>{if(n&&l){const f=new URL(n,document.baseURI);return f.searchParams.set("sessionId",l),f.toString()}else return},[n,l]);return v.jsx("div",{className:se(av.container,El.bottomSheet,{[El.bottomSheetOpen]:!!n,[El.bottomSheetClose]:r&&!n}),children:c&&v.jsx("iframe",{title:"Drawer",id:"form-drawer",src:c,className:av.iframe})})},bT="_container_vvbth_1",_T={container:bT},AT=({title:n,href:l,children:r})=>v.jsx("a",{href:l,title:n,target:"_blank",rel:"noopener noreferrer",children:r}),CT=()=>{const l=St()("powered-by");return l&&l.length?v.jsx("div",{className:se(_T.container,"chat__poweredBy"),children:v.jsx(Sl,{options:{overrides:{a:AT}},children:l})}):null},ST=(n,l)=>{const r=new Map;let s=0;return n.replace(/^#{1,6}\s+/gm,"").replace(/(\*\*|__)(.*?)\1/g,"$2").replace(/(\*|_)(.*?)\1/g,"$2").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\[\^([^\]]+)\]/g,(c,f)=>(r.has(f)||r.set(f,++s),`(${l} ${r.get(f)})`)).replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^>\s+/gm,"").replace(/^(-{3,}|_{3,}|\*{3,})$/gm,"").replace(/^[\s]*[-*+]\s+/gm,"").replace(/^[\s]*\d+\.\s+/gm,"").replace(/\n{3,}/g,`
|
|
61
61
|
|
|
62
62
|
`).trim()},ET=({messages:n,isBotTyping:l})=>{const r=q.useRef(""),s=St(),c=s("bot-bubble.footnote"),f=h=>{switch(h.type){case"TEXT":return h.text||"";case"MARKDOWN":{const p=h.markdown||"";return ST(p,c)}case"DETAIL":return h.text||h.title||"";default:return""}},m=(()=>{if(l)return s("chatbot.typing")??"Chatbot is typing";const h=[...n].reverse().find(p=>p.sender.type===Ks.BOT);return h?f(h):""})();return q.useEffect(()=>{m!==r.current&&(r.current=m)},[m]),v.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m})},Xy=({className:n,children:l,...r})=>v.jsx(yu,{className:se(Js.buttonDefault,n),type:"button",...r,children:l}),$c=({className:n,children:l,...r})=>v.jsx(yu,{className:se(Js.buttonPrimary,n),...r,children:l}),TT="_container_h23mk_1",xT="_formContainer_h23mk_17",OT="_emailInput_h23mk_22",RT="_description_h23mk_52",wT="_actions_h23mk_57",NT="_validationError_h23mk_67",MT="_submitted_h23mk_74",Ir={container:TT,formContainer:xT,emailInput:OT,description:RT,actions:wT,validationError:NT,submitted:MT},DT=({visible:n,onEmailExport:l,onClose:r})=>{const s=St(),[c,f]=q.useState(void 0),[d,m]=q.useState(!1),[h,p]=q.useState(void 0),y=q.useRef(null);q.useEffect(()=>{n?(y.current?.focus(),m(!1),f(n)):c===!0&&f(!1)},[n,c]);const b=E=>{E.preventDefault(),h&&h.length>0&&(l(h),m(!0),setTimeout(r,3*1e3))},C=E=>{const x=E.target.value.trim(),A=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(x);p(A?x:"")};return v.jsxs("div",{className:se(Ir.container,El.bottomSheet,{[El.bottomSheetOpen]:c===!0,[El.bottomSheetClose]:c===!1}),children:[v.jsx("h2",{children:s("export-transcript.email.title")}),v.jsx(Sl,{className:Ir.description,children:s("export-transcript.email.description")||""}),v.jsxs("form",{onSubmit:b,className:Ir.formContainer,children:[v.jsxs("div",{children:[v.jsx("input",{disabled:d,ref:y,type:"email",placeholder:s("export-transcript.email.placeholder"),className:Ir.emailInput,onChange:C}),h?.length===0?v.jsx("div",{className:Ir.validationError,children:s("export-transcript.email.invalid")}):null]}),v.jsxs("div",{className:Ir.actions,children:[v.jsx(Xy,{onClick:r,children:s("export-transcript.email.cancel")}),v.jsx($c,{type:"submit",disabled:d||h===void 0||h.length===0,children:s("export-transcript.email.send")})]})]}),d&&v.jsx("div",{className:Ir.submitted,children:s("export-transcript.email.success")})]})},LT="_inputContainer_fi5ao_1",zT={inputContainer:LT},kT="_blockUserInput_pot9c_1",BT={blockUserInput:kT},jT=({visible:n})=>{const l=St();return n?v.jsx("div",{className:se(BT.blockUserInput,"chat__blockUserInput"),children:l("block-user-input.title")}):null},UT="_commandsDropdown_fmklx_1",HT="_commands_fmklx_1",qT="_command_fmklx_1",IT="_commandActive_fmklx_49",_c={commandsDropdown:UT,commands:HT,command:qT,commandActive:IT},GT=(n,l,r,s,c)=>{q.useEffect(()=>{const f=d=>{if(n.length)switch(d.key){case"Enter":r(n[l]);break;case"ArrowUp":s(m=>m>0?m-1:n.length-1);break;case"ArrowDown":s(m=>m<n.length-1?m+1:0);break;case"Escape":c([]);break}};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[n,l,r,s,c])},VT=({text:n,commands:l,onSelectCommand:r,onVisibilityChange:s})=>{const c=q.useRef(null),f=St(),[d,m]=q.useState([]),[h,p]=q.useState(lv(l)),[y,b]=q.useState(0),C=E=>r(`/${E}`);return im(c,()=>m([])),GT(d,y,C,b,m),q.useEffect(()=>{p(lv(l))},[l]),q.useEffect(()=>{const E=n.length||0;E===0||E>h||!n.startsWith("/")?m([]):m(l.filter(XT(n))),b(0)},[l,n,h]),q.useEffect(()=>{s(!!d.length)},[d,s]),d.length?v.jsx("div",{ref:c,className:_c.commandsDropdown,children:v.jsx("ul",{id:"command-list",className:_c.commands,role:"listbox",children:d.map((E,x)=>v.jsxs("li",{className:se([_c.command,y===x&&_c.commandActive]),role:"option",onClick:()=>C(E),onMouseOver:()=>b(x),children:[v.jsxs("h1",{children:["/",E]}),v.jsx("p",{children:f(`commands.${E}`)})]},E))})}):null},lv=n=>Math.max(...n.map(l=>l.length+1)),XT=n=>l=>{const r=`/${l}`;return r.startsWith(n)&&r.length>=n.length},YT="_callToActionContainer_d8izj_1",KT="_callToActionTitle_d8izj_23",FT="_rateOverlay_d8izj_30",JT="_body_d8izj_52",ZT="_footer_d8izj_60",WT="_actions_d8izj_75",QT="_bubbles_d8izj_89",PT="_stars_d8izj_191",$T="_starsSmall_d8izj_205",e3="_starsLarge_d8izj_211",t3="_star_d8izj_191",n3="_starReadonly_d8izj_225",a3="_starIcon_d8izj_235",l3="_starsDescriptionContainer_d8izj_253",r3="_starsDescription_d8izj_253",kn={callToActionContainer:YT,callToActionTitle:KT,rateOverlay:FT,body:JT,footer:ZT,actions:WT,bubbles:QT,stars:PT,starsSmall:$T,starsLarge:e3,star:t3,starReadonly:n3,starIcon:a3,starsDescriptionContainer:l3,starsDescription:r3},i3=({value:n,index:l,count:r,readonly:s,onHover:c,onClick:f})=>{const d=m=>{f&&m.key==="Enter"&&f()};return v.jsx("li",{className:se(kn.star,{[kn.starReadonly]:s},"chat__conversationRating__star"),children:v.jsx("div",{role:"radio","aria-checked":n>l?"true":"false","aria-posinset":l+1,"aria-setsize":r,tabIndex:0,onMouseOver:c,onKeyDown:d,onClick:f,children:v.jsx("span",{role:"img","aria-label":"Star",className:se(kn.starIcon),children:v.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"star",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:v.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"})})})})})},rv=5,Yy=({value:n,size:l,readonly:r=!1,onChange:s})=>{const[c,f]=q.useState(void 0),d=()=>{f(void 0)},m=p=>()=>{if(!r){const y=p+1;f(y)}},h=p=>()=>{s&&!r&&(s(p===0&&n===1?0:p+1),f(void 0))};return v.jsx("ul",{tabIndex:0,role:"radiogroup",className:se(kn.stars,{[kn.starsSmall]:l==="small",[kn.starsLarge]:l==="large"},"chat__conversationRating__stars",{chat__conversationRating__stars__small:l==="small",chat__conversationRating__stars__large:l==="large"}),onMouseOut:d,children:Array(rv).fill(0).map((p,y)=>v.jsx(i3,{value:c===void 0?n:c,index:y,count:rv,readonly:r,onHover:m(y),onClick:h(y)},y))})},s3=({visible:n,onRate:l})=>{const r=St();return n?v.jsxs("div",{className:se(kn.callToActionContainer,"chat__conversationRating__callToAction"),children:[v.jsx("div",{className:se(kn.callToActionTitle,"chat__conversationRating__callToAction__title"),children:r("conversation-rating.call-to-action.title")}),v.jsx(Yy,{value:0,size:"small",onChange:l})]}):null},Kd=({isFirstMessageBySender:n,isLastMessageBySender:l,children:r})=>v.jsxs("div",{className:se(Ne.message,Ne.messageBot,n&&Ne.messageBotFirst,l&&Ne.messageBotLast,"chat__bubbleContainer","chat__botBubbleContainer",n&&"chat__bubbleContainer--first",l&&"chat__bubbleContainer--last"),children:[v.jsx("img",{className:se(Ne.avatar,Ne.botAvatar),src:"bot.svg",alt:"Bot"}),v.jsx("div",{className:se(Ne.bubble,Ne.bubbleLeft,"chat__bubble","chat__botBubble"),children:v.jsx("div",{className:se(Ne.leftText,Ne.bubbleContent),children:r})})]}),o3=({children:n})=>v.jsx("div",{className:se(Ne.message,Ne.messageGuest,Ne.messageGuestFirst,Ne.messageGuestLast,"chat__bubbleContainer","chat__guestBubbleContainer","chat__bubbleContainer--first","chat__bubbleContainer--last"),children:v.jsx("div",{className:se(Ne.bubble,Ne.bubbleRight,"chat__bubble","chat__guestBubble"),children:v.jsx("div",{className:se(Ne.rightText,Ne.bubbleContent),children:n})})}),c3=()=>{const n=St(),l=wl(),r=Dt(S=>S.chat.conversationRating),[s,c]=q.useState(r.rating?.value||0),[f,d]=q.useState(void 0),[m,h]=q.useState(void 0),[p,y]=q.useState({submitted:!1,feedback:""}),b=q.useRef(null),[C,E]=q.useState(!1);q.useEffect(()=>{r.opener?(y({submitted:!1,feedback:""}),h(!0)):m===!0&&h(!1)},[r.opener,m]),q.useEffect(()=>{c(r.rating?.value||0)},[r.rating?.value,r.opener]),q.useEffect(()=>{b.current&&(b.current.value=r.rating?.feedback||"")},[r.rating?.feedback]),q.useEffect(()=>{const S=s>0?n(`conversation-rating.overlay.bot-message.rate-feedback.value-${s}`):void 0;d(S?.length?S:void 0)},[s,n]),q.useEffect(()=>{p.submitted?setTimeout(()=>E(!0),p.feedback.length?500:0):E(!1)},[p]);const x=S=>{S.preventDefault();const N=b.current?.value?.trim()||"";l(oC(s,N)),y({submitted:!0,feedback:N})},A=()=>{r.opener==="CLOSE_CHAT"?l(_y()):r.opener==="RESTART_CHAT"?l(Ws()):l(dS())};return v.jsx("div",{className:se(kn.rateOverlay,El.bottomSheet,"chat__conversationRating__overlay",{[El.bottomSheetOpen]:m===!0,[El.bottomSheetClose]:m===!1}),children:v.jsxs("form",{onSubmit:x,children:[v.jsxs("div",{className:se(kn.body,"chat__conversationRating__overlay__body"),children:[v.jsx("div",{}),v.jsx("div",{className:se(kn.bubbles),children:r.opener&&v.jsxs(v.Fragment,{children:[v.jsxs(Kd,{isFirstMessageBySender:!0,isLastMessageBySender:!f,children:[v.jsx("h2",{children:n("conversation-rating.overlay.title")}),v.jsxs("div",{className:se(kn.starsDescriptionContainer),children:[v.jsx(Yy,{value:s,size:"large",readonly:p.submitted,onChange:c}),v.jsxs("div",{className:se(kn.starsDescription),children:[v.jsx("div",{children:n("conversation-rating.overlay.star.very-bad")}),v.jsx("div",{children:n("conversation-rating.overlay.star.very-good")})]})]})]}),f&&v.jsx(Kd,{isFirstMessageBySender:!1,isLastMessageBySender:!C||!!p.feedback.length,children:v.jsx("div",{children:f})}),!!p.feedback.length&&v.jsx(o3,{children:p.feedback}),C&&v.jsx(Kd,{isFirstMessageBySender:!!p.feedback.length,isLastMessageBySender:!0,children:v.jsx("div",{children:n("conversation-rating.overlay.bot-message.submit-feedback")})})]})})]}),v.jsxs("div",{className:se(kn.footer,"chat__conversationRating__overlay__footer"),children:[!p.submitted&&v.jsx("input",{ref:b,defaultValue:r.rating?.feedback||"",placeholder:n("conversation-rating.overlay.guest-feedback.input-placeholder")}),v.jsxs("div",{className:se(kn.actions,"chat__conversationRating__overlay__footer__actions"),children:[p.submitted?v.jsx($c,{type:"button",disabled:!s,onClick:A,children:r.opener==="CLOSE_CHAT"?n("conversation-rating.overlay.action.close-chat"):r.opener==="RESTART_CHAT"?n("conversation-rating.overlay.action.restart-chat"):n("conversation-rating.overlay.action.back-to-chat")},"close-button"):v.jsx($c,{type:"submit",disabled:!s,children:n("conversation-rating.overlay.action.submit")},"submit-button"),r.opener!=="CHAT"&&!p.submitted&&v.jsx(Xy,{onClick:A,children:r.opener==="CLOSE_CHAT"?n("conversation-rating.overlay.action.close-chat"):r.opener==="RESTART_CHAT"?n("conversation-rating.overlay.action.restart-chat"):n("conversation-rating.overlay.action.cancel")})]})]})]})})},u3=({numberOfMessagesFromGuest:n})=>{const l=wl(),r=Dt(f=>f.chat.conversationRating),s=f=>{l(Kc("CHAT",f))},c=!r.rating?.value&&n>=1;return r.enabled?v.jsxs(v.Fragment,{children:[v.jsx(s3,{visible:c,onRate:s}),v.jsx(c3,{})]}):null},f3=q.memo(u3),d3="_inputWrapper_m3q4d_1",h3="_withOpenCommands_m3q4d_13",m3="_actions_m3q4d_18",p3="_messageInputWrapper_m3q4d_53",g3="_messageInput_m3q4d_53",v3="_buttons_m3q4d_78",y3="_button_m3q4d_78",Gr={inputWrapper:d3,withOpenCommands:h3,actions:m3,messageInputWrapper:p3,messageInput:g3,buttons:v3,button:y3},b3="_audioRecorder_g845f_1",_3="_audioButton_g845f_6",A3="_recorderIcon_g845f_37",C3="_spinning_g845f_60",Vr={audioRecorder:b3,audioButton:_3,recorderIcon:A3,spinning:C3},iv=2048,eu=16e3;class S3 extends Nv.Component{audioInput=null;volume=null;leftchannel=[];recorder=null;recordingLength=0;sampleRate=null;mediaStream=null;constructor(l){super(l),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(l){this.mediaStream=l,this.leftchannel.length=0,this.recordingLength=0,this.initRecording(l)}initRecording(l){const r=window.AudioContext||window.webkitAudioContext,s=new r;this.sampleRate=s.sampleRate,this.volume=s.createGain(),this.audioInput=s.createMediaStreamSource(l),this.audioInput.connect(this.volume),this.recorder=s.createScriptProcessor(iv,1,1),this.recorder.onaudioprocess=this.processRecordingInput,this.volume.connect(this.recorder),this.recorder.connect(s.destination)}processRecordingInput(l){if(this.state.recordingState==="connecting"&&this.setState({recordingState:"recording"}),this.state.recordingState!=="none"){const r=l.inputBuffer.getChannelData(0);this.leftchannel.push(new Float32Array(r)),this.recordingLength+=iv}}handleClickSubmitAudio(){const l=T3(this.leftchannel,this.recordingLength),r=x3(l,this.sampleRate||0),s=E3(r);this.props.onAudioRecorded(s),this.handleClickStopAudio()}handleClickStopAudio(){this.setState({recordingState:"none"}),this.audioInput?.disconnect(),this.volume?.disconnect(),this.recorder?.disconnect(),this.mediaStream&&this.mediaStream?.getAudioTracks().forEach(l=>{l.stop()})}render(){return v.jsxs("div",{className:Vr.audioRecorder,children:[this.state.recordingState==="none"&&v.jsx("button",{className:se(Vr.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:v.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[v.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"}),v.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),this.state.recordingState==="connecting"&&v.jsxs("svg",{className:Vr.spinning,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[v.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"}),v.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]}),this.state.recordingState==="recording"&&v.jsxs("div",{className:Vr.audioRecorder,children:[v.jsx("button",{className:se(Vr.audioButton),onClick:this.handleClickStopAudio,"aria-label":this.props.translate("message-input.actions.stop-audio-recording.label"),tabIndex:0,children:v.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[v.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"}),v.jsx("path",{d:"M0 0h24v24H0z",fill:"none"})]})}),v.jsx("div",{className:Vr.recorderIcon}),v.jsx("button",{className:se(Vr.audioButton),type:"submit",onClick:this.handleClickSubmitAudio,"aria-label":this.props.translate("message-input.actions.submit-audio-recording.label"),tabIndex:0,autoFocus:!0,children:v.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[v.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),v.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})]})})]})]})}}const E3=n=>{const l=new ArrayBuffer(44+n.length*2),r=new DataView(l);Ac(r,0,"RIFF"),r.setUint32(4,44+n.length*2,!0),Ac(r,8,"WAVE"),Ac(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,eu,!0),r.setUint32(28,eu*4,!0),r.setUint16(32,4,!0),r.setUint16(34,16,!0),Ac(r,36,"data"),r.setUint32(40,n.length*2,!0);const s=n.length;let c=44;const f=1;for(let d=0;d<s;d++)r.setInt16(c,n[d]*(32767*f),!0),c+=2;return new Blob([r],{type:"audio/wav"})},Ac=(n,l,r)=>{for(let s=0;s<r.length;s++)n.setUint8(l+s,r.charCodeAt(s))},T3=(n,l)=>{const r=new Float32Array(l);let s=0;const c=n.length;for(let f=0;f<c;f++){const d=n[f];r.set(d,s),s+=d.length}return r},x3=(n,l)=>{if(eu===l)return n;const r=l/eu,s=Math.round(n.length/r),c=new Float32Array(s);let f=0,d=0;for(;f<c.length;){const m=Math.round((f+1)*r);let h=0,p=0;for(let y=d;y<m&&y<n.length;y++)h+=n[y],p++;c[f]=h/p,f++,d=m}return c},O3=({onClick:n})=>{const l=St();return v.jsxs("button",{onClick:n,type:"button","aria-label":l("message-input.actions.command.label"),children:[v.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",fill:"#000000",viewBox:"0 0 256 256",children:[v.jsx("rect",{x:"32",y:"32",width:"192",height:"192",rx:"16",ry:"16",fill:"none",stroke:"currentColor","stroke-width":"16"}),v.jsx("line",{x1:"80",y1:"176",x2:"176",y2:"80",stroke:"currentColor","stroke-width":"16","stroke-linecap":"round"})]}),v.jsx("span",{children:l("message-input.actions.command.label")})]})},R3=({disabled:n,textInput:l,commandsVisible:r,hasCommands:s,onTextInput:c,onTextInputSubmit:f,onAudioRecorded:d})=>{const m=St(),h=q.useRef(null),{enableSpeechSupport:p}=Dt(A=>A.settings);q.useEffect(()=>{h.current?.focus()},[l]);const y=()=>{const A=h.current;A&&l.trim().length>=1&&f(l.trim())&&(A.value="",A.style.height="",A.focus())},b=A=>{A.preventDefault(),y()},C=A=>{const S=A.target.value;c(S),A.target.style.height="";const{scrollHeight:N}=A.target;A.target.style.height=`${N>150?150:N}px`},E=A=>{A.code==="Enter"&&!A.shiftKey?(A.repeat||y(),A.preventDefault()):r&&(A.code==="ArrowUp"||A.code==="ArrowDown")&&A.preventDefault()},x=()=>{l.startsWith("/")?c(""):c("/")};return v.jsxs("form",{className:se(Gr.inputWrapper,r&&Gr.withOpenCommands,"chat__textInput"),onSubmit:b,children:[v.jsxs("div",{className:Gr.messageInputWrapper,children:[v.jsx("textarea",{id:"user_input",ref:h,className:Gr.messageInput,tabIndex:0,placeholder:m("message-input-placeholder"),value:l,onChange:C,onKeyDown:E,"aria-label":m("message-input-label"),"aria-controls":s?"command-list":void 0,"aria-haspopup":s?"listbox":void 0}),s&&v.jsx("div",{className:Gr.actions,children:v.jsx(O3,{onClick:x})})]}),v.jsx("div",{className:se(Gr.buttons,"chat__buttons"),children:l.length||!p||navigator.mediaDevices===void 0?v.jsx("button",{className:se(Gr.button,"chat__button"),type:"submit","aria-label":m("message-input.actions.submit.label"),"data-title":m("message-input.actions.submit.label"),tabIndex:0,disabled:n,children:v.jsx("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:v.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"})})}):p&&navigator.mediaDevices!==void 0&&v.jsx(S3,{translate:m,onAudioRecorded:d})})]})},w3="_quickReplies_83npe_1",N3="_quickReply_83npe_9",sv={quickReplies:w3,quickReply:N3},M3=({quickReplies:n,onQuickReplyClick:l})=>n.length?v.jsx("div",{className:se(sv.quickReplies,"chat__quickReplies"),children:n.map(r=>v.jsx(yu,{tabIndex:0,className:se(sv.quickReply,"chat__button","chat__quickReply"),onClick:()=>l(r),children:r.label},r.label))}):null,ov=5e3,D3=1e3,L3=({isBotTyping:n,quickReplies:l,numberOfMessagesFromGuest:r,commands:s,onTextInput:c,onQuickReplyClick:f,onAudioRecorded:d})=>{const[m,h]=q.useState(""),[p,y]=q.useState(!1),[b,C]=q.useState(!1),E=q.useRef(0),x=q.useRef(0);q.useEffect(()=>{if(p&&!n){const N=E.current?Date.now()-E.current:0;N>ov?y(!1):setTimeout(()=>{y(!1)},ov-N)}},[p,n]),q.useEffect(()=>{p&&(E.current=Date.now())},[p]);const A=N=>{const k=Date.now()-x.current<D3;return b?!1:n||k?(y(!0),!1):(c(N),h(""),x.current=Date.now(),!0)},S=N=>{h(N+" ")};return v.jsxs("div",{className:se(zT.inputContainer),children:[v.jsx(M3,{quickReplies:l,onQuickReplyClick:f}),v.jsx(jT,{visible:p}),!p&&v.jsx(f3,{numberOfMessagesFromGuest:r}),!!s?.length&&v.jsx(VT,{text:m,commands:s,onSelectCommand:S,onVisibilityChange:C}),v.jsx(R3,{textInput:m,disabled:p,commandsVisible:b,hasCommands:!!s?.length,onTextInput:h,onTextInputSubmit:A,onAudioRecorded:d})]})},z3=({clientName:n,messages:l,quickReplies:r,isBotTyping:s,drawerContentUrl:c,onMessageFromUser:f,onQuickReplyClick:d,onButtonClick:m,onLinkClick:h,onAudioRecorded:p,onTranscriptExport:y,onTranscriptItemReaction:b})=>{const C=wl(),E=Dt(L=>L.connection.connectionState),{enableTranscriptExportEmail:x,commands:A}=Dt(L=>L.settings),{showTranscriptMailOverlay:S,conversationRating:N}=Dt(L=>L.chat),k=l.filter(L=>L.sender.type===Ks.GUEST).length;q.useEffect(()=>{E===Kr.CONNECTED&&C(Cy(n))},[n,E,C]);const M=()=>{C(Ay())};return v.jsxs("div",{className:Vd.container,children:[v.jsx(ET,{messages:l,isBotTyping:s}),v.jsxs("div",{className:se([Vd.chatcontent,(S||N?.opener)&&Vd.accessabilityHidden]),children:[v.jsx(fT,{messages:l,isBotTyping:s,commands:A,onButtonClick:m,onLinkClick:h,onTranscriptItemReaction:b}),v.jsx(L3,{isBotTyping:s,quickReplies:s?[]:r,numberOfMessagesFromGuest:k,commands:A,onQuickReplyClick:d,onTextInput:f,onAudioRecorded:p}),v.jsx(CT,{})]}),x&&v.jsx(DT,{visible:!!S,onEmailExport:y,onClose:M}),v.jsx(yT,{contentUrl:c})]})},k3=n=>{const{messages:l,quickReplies:r,isBotTyping:s,drawerContentUrl:c}=n.chat;return{messages:l,quickReplies:r,isBotTyping:s,drawerContentUrl:c}},B3=n=>({onRestartChat:()=>n(Ws()),onMessageFromUser:l=>n(Kv(l)),onAudioRecorded:l=>n(aC(l)),onActionFromUser:l=>n(l),onQuickReplyClick:l=>n(Yv(l)),onNluEvent:l=>n(Qv(l)),onButtonClick:l=>n(uC(l)),onLinkClick:l=>n(Pv(l)),onTranscriptExport:l=>n(rC(l)),onTranscriptItemReaction:(l,r)=>{n(eC(l,r?.type||null,r?.category,r?.comment))}}),j3=DA(k3,B3)(z3),Ky=()=>q.useMemo(()=>{try{return window.self!==window.top}catch{return!0}},[]),U3=n=>l=>{const r=l.key;(r==="ArrowDown"||r==="ArrowRight"||r==="Enter"||r===" "||r==="Space")&&(l.stopPropagation(),n())},H3=({onClick:n})=>{const l=St();return Ky()?v.jsx("button",{className:"tooltip--bottom-left","aria-label":l("header.close-chat"),"data-title":l("header.close-chat"),tabIndex:0,onClick:n,onKeyDown:U3(n),children:v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.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},q3="_header_3gvbz_1",I3="_logoContainer_3gvbz_14",G3="_logo_3gvbz_14",V3="_actions_3gvbz_28",X3="_active_3gvbz_43",Y3="_menuContainer_3gvbz_56",K3="_menu_3gvbz_56",F3="_divider_3gvbz_86",sr={header:q3,logoContainer:I3,logo:G3,actions:V3,active:X3,menuContainer:Y3,menu:K3,divider:F3},J3=({icon:n})=>{switch(n){case"arrow-counter-clockwise":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"})});case"download":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"})});case"expand":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M214,48V96a6,6,0,0,1-12,0V62.48l-53.76,53.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM107.76,139.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l53.76-53.76a6,6,0,0,0-8.48-8.48Z"})});case"mail":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"})});case"phone":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M144.27,45.93a8,8,0,0,1,9.8-5.66,86.22,86.22,0,0,1,61.66,61.66,8,8,0,0,1-5.66,9.8A8.23,8.23,0,0,1,208,112a8,8,0,0,1-7.73-5.94,70.35,70.35,0,0,0-50.33-50.33A8,8,0,0,1,144.27,45.93Zm-2.33,41.8c13.79,3.68,22.65,12.54,26.33,26.33A8,8,0,0,0,176,120a8.23,8.23,0,0,0,2.07-.27,8,8,0,0,0,5.66-9.8c-5.12-19.16-18.5-32.54-37.66-37.66a8,8,0,1,0-4.13,15.46Zm81.94,95.35A56.26,56.26,0,0,1,168,232C88.6,232,24,167.4,24,88A56.26,56.26,0,0,1,72.92,32.12a16,16,0,0,1,16.62,9.52l21.12,47.15,0,.12A16,16,0,0,1,109.39,104c-.18.27-.37.52-.57.77L88,129.45c7.49,15.22,23.41,31,38.83,38.51l24.34-20.71a8.12,8.12,0,0,1,.75-.56,16,16,0,0,1,15.17-1.4l.13.06,47.11,21.11A16,16,0,0,1,223.88,183.08Zm-15.88-2s-.07,0-.11,0h0l-47-21.05-24.35,20.71a8.44,8.44,0,0,1-.74.56,16,16,0,0,1-15.75,1.14c-18.73-9.05-37.4-27.58-46.46-46.11a16,16,0,0,1,1-15.7,6.13,6.13,0,0,1,.57-.77L96,95.15l-21-47a.61.61,0,0,1,0-.12A40.2,40.2,0,0,0,40,88,128.14,128.14,0,0,0,168,216,40.21,40.21,0,0,0,208,181.07Z"})});case"scroll":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M96,104a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H104A8,8,0,0,1,96,104Zm8,40h64a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16Zm128,48a32,32,0,0,1-32,32H88a32,32,0,0,1-32-32V64a16,16,0,0,0-32,0c0,5.74,4.83,9.62,4.88,9.66h0A8,8,0,0,1,24,88a7.89,7.89,0,0,1-4.79-1.61h0C18.05,85.54,8,77.61,8,64A32,32,0,0,1,40,32H176a32,32,0,0,1,32,32V168h8a8,8,0,0,1,4.8,1.6C222,170.46,232,178.39,232,192ZM96.26,173.48A8.07,8.07,0,0,1,104,168h88V64a16,16,0,0,0-16-16H67.69A31.71,31.71,0,0,1,72,64V192a16,16,0,0,0,32,0c0-5.74-4.83-9.62-4.88-9.66A7.82,7.82,0,0,1,96.26,173.48ZM216,192a12.58,12.58,0,0,0-3.23-8h-94a26.92,26.92,0,0,1,1.21,8,31.82,31.82,0,0,1-4.29,16H200A16,16,0,0,0,216,192Z"})});case"star":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"})});case"link":return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"})});default:return v.jsx("div",{})}},Z3=q.forwardRef(({selected:n,item:l,onClick:r},s)=>{const c=St(),f=d=>{d.preventDefault(),r()};return v.jsx("li",{"aria-selected":n,role:"option",className:l.withDivider?sr.divider:void 0,children:v.jsxs("a",{ref:s,type:"button",role:"button",tabIndex:-1,onClick:f,children:[v.jsx(J3,{icon:l.icon}),v.jsx("span",{children:c(`header.menu.${l.id}`)})]})})}),W3=(n,l)=>{const r=Ky(),{menuItems:s,enableStandaloneView:c,enableTranscriptExportPdf:f,enableTranscriptExportEmail:d}=Dt(p=>p.settings),m=Dt(p=>p.chat.conversationRating.enabled);return q.useMemo(()=>{const p=[],y=s.filter(({visibility:b})=>n?b==="always"||b==="chat-only":b==="always"||b==="start-screen-only");if(n&&(p.push({id:"restart-chat",type:"restart-chat",icon:"arrow-counter-clockwise",visibility:"chat-only"}),r&&c&&p.push({id:"expand-chat-window",type:"expand-chat-window",icon:"expand",visibility:"always"}),l&&f&&p.push({id:"download-transcript",type:"download-transcript",icon:"download",visibility:"chat-only"}),l&&d&&p.push({id:"send-transcript",type:"send-transcript",icon:"mail",visibility:"chat-only"}),l&&m&&p.push({id:"rate-conversation",type:"rate-conversation",icon:"star",visibility:"chat-only"}),p.length>0&&y.length)){const b=p.pop();b&&s.length&&p.push({...b,withDivider:!0})}return p.push(...y),p},[n,l,f,d,c,m,r,s])},Q3=({chatStarted:n,hasGuestMessages:l})=>{const r=wl(),s=St(),{enabled:c,opener:f}=Dt(k=>k.chat.conversationRating),[d,m]=q.useState(!1),[h,p]=q.useState(-1),y=q.useRef(null),b=q.useRef(null),C=q.useRef([]),E=W3(n,l);q.useEffect(()=>{C.current[h]?.focus()},[h]);const x=q.useCallback(()=>{r(l&&c&&!f?Kc("RESTART_CHAT"):Ws()),m(!1),p(0)},[l,c,f,r]),A=q.useCallback(k=>{switch(k.type){case"restart-chat":{x();break}case"expand-chat-window":{const M=new URL(window.location.origin);M.pathname=window.location.pathname,M.search=window.location.search,M.hash=window.location.hash,window.open(M.href,"_blank");break}case"download-transcript":{r(iC());break}case"send-transcript":{r(Ay());break}case"rate-conversation":{r(Kc("MENU"));break}case"link":{r(Pv(k.url));break}case"action":{r(JSON.parse(JSON.stringify(k.action)));break}}m(!1)},[r,x,m]);q.useEffect(()=>{const k=M=>{if(d)switch(M.key){case"Enter":M.preventDefault(),A(E[h]);break;case"ArrowUp":p(L=>L>0?L-1:E.length-1);break;case"ArrowDown":p(L=>L<E.length-1?L+1:0);break;case"Escape":m(!1);break;case"Tab":h>-1&&m(!1);break}};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k)}},[d,h,E,p,m,A]),q.useEffect(()=>{d||p(-1)},[d,h]),im(b,()=>m(!1));const S=()=>{m(k=>!k)},N=()=>{setTimeout(()=>{const k=document.activeElement;b.current&&!b.current.contains(k)&&m(!1)},0)};return E.length?v.jsxs("div",{className:se(sr.menuContainer),ref:b,children:[v.jsx("button",{ref:y,className:se(d&&sr.active,d?"tooltip-hidden":"tooltip--bottom-left"),"aria-label":s("header.menu.title"),"data-title":s("header.menu.title"),onClick:S,onBlur:N,children:v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"})})}),d&&v.jsx("nav",{className:sr.menu,"aria-label":s("header.menu.title"),children:v.jsx("ul",{tabIndex:0,children:E.map((k,M)=>v.jsx(Z3,{ref:L=>{C.current[M]=L},selected:h===M,item:k,onClick:()=>A(k)},k.id))})})]}):null},cv=({className:n,chatStarted:l,...r})=>{const s=wl(),c=Dt(m=>m.chat.conversationRating),f=Dt(m=>m.chat.messages.some(h=>h.sender.type===xl.GUEST)),d=()=>{c.enabled&&!c.opener&&f?s(Kc("CLOSE_CHAT")):s(_y())};return v.jsxs("div",{className:se(sr.header,n),...r,children:[v.jsx("div",{className:sr.logoContainer,children:v.jsx("div",{className:sr.logo})}),v.jsxs("div",{className:sr.actions,children:[v.jsx(Q3,{chatStarted:l,hasGuestMessages:f}),v.jsx(H3,{onClick:d})]})]})},P3="_chatwindow_rkbir_1",$3="_chatwindowWithAside_rkbir_21",uv={chatwindow:P3,chatwindowWithAside:$3},Fy=()=>{const[n,l]=q.useState(!1);return q.useEffect(()=>{const r=window.matchMedia("(max-width: 1023px)"),s=()=>l(r.matches);return s(),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),n},e8="_sourceInfos_vei0l_1",t8="_waitForLoading_vei0l_24",n8="_loadingContent_vei0l_28",a8="_sourceHeader_vei0l_37",l8="_sourceHeaderIcon_vei0l_57",r8="_sourceContent_vei0l_61",i8="_openSourceButton_vei0l_69",s8="_sourceButtonLabel_vei0l_79",o8="_closeSourceInfosButton_vei0l_101",c8="_loadingSourceInfos_vei0l_125",u8="_loading_vei0l_28",f8="_loadingError_vei0l_139",d8="_highlightLoadingInfo_vei0l_155",h8="_highlightLoadingInfoInnerContainer_vei0l_169",m8="_highlightLoadingInfoContent_vei0l_178",p8="_highlightLoadingInfoCloseIcon_vei0l_198",g8="_highlightLoader_vei0l_203",v8="_highlightLoaderLoading_vei0l_210",pn={sourceInfos:e8,waitForLoading:t8,loadingContent:n8,sourceHeader:a8,sourceHeaderIcon:l8,sourceContent:r8,openSourceButton:i8,sourceButtonLabel:s8,closeSourceInfosButton:o8,loadingSourceInfos:c8,loading:u8,loadingError:f8,highlightLoadingInfo:d8,highlightLoadingInfoInnerContainer:h8,highlightLoadingInfoContent:m8,highlightLoadingInfoCloseIcon:p8,highlightLoader:g8,highlightLoaderLoading:v8},y8=({onClick:n})=>{const l=St();return v.jsx("button",{className:se(pn.closeSourceInfosButton,"tooltip--bottom-left"),"aria-label":l("source-infos.close"),"data-title":l("source-infos.close"),tabIndex:0,onClick:n,children:v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.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"})})})},b8=q.forwardRef(({sourceInfos:n,onClose:l,...r},s)=>v.jsxs("div",{className:pn.sourceHeader,...r,ref:s,children:[v.jsx("div",{children:n?v.jsx("p",{id:"source-info-title",children:n.title}):v.jsx("p",{children:" "})}),v.jsx(y8,{onClick:l})]})),_8=({loading:n})=>v.jsx("div",{className:pn.highlightLoader,children:n&&v.jsx("div",{className:pn.highlightLoaderLoading})});const{entries:Jy,setPrototypeOf:fv,isFrozen:A8,getPrototypeOf:C8,getOwnPropertyDescriptor:S8}=Object;let{freeze:In,seal:Ra,create:wc}=Object,{apply:Ah,construct:Ch}=typeof Reflect<"u"&&Reflect;In||(In=function(l){return l});Ra||(Ra=function(l){return l});Ah||(Ah=function(l,r){for(var s=arguments.length,c=new Array(s>2?s-2:0),f=2;f<s;f++)c[f-2]=arguments[f];return l.apply(r,c)});Ch||(Ch=function(l){for(var r=arguments.length,s=new Array(r>1?r-1:0),c=1;c<r;c++)s[c-1]=arguments[c];return new l(...s)});const Cc=Gn(Array.prototype.forEach),E8=Gn(Array.prototype.lastIndexOf),dv=Gn(Array.prototype.pop),zs=Gn(Array.prototype.push),T8=Gn(Array.prototype.splice),Nc=Gn(String.prototype.toLowerCase),Fd=Gn(String.prototype.toString),Jd=Gn(String.prototype.match),ks=Gn(String.prototype.replace),x8=Gn(String.prototype.indexOf),O8=Gn(String.prototype.trim),oa=Gn(Object.prototype.hasOwnProperty),zn=Gn(RegExp.prototype.test),Bs=R8(TypeError);function Gn(n){return function(l){l instanceof RegExp&&(l.lastIndex=0);for(var r=arguments.length,s=new Array(r>1?r-1:0),c=1;c<r;c++)s[c-1]=arguments[c];return Ah(n,l,s)}}function R8(n){return function(){for(var l=arguments.length,r=new Array(l),s=0;s<l;s++)r[s]=arguments[s];return Ch(n,r)}}function Ue(n,l){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Nc;fv&&fv(n,null);let s=l.length;for(;s--;){let c=l[s];if(typeof c=="string"){const f=r(c);f!==c&&(A8(l)||(l[s]=f),c=f)}n[c]=!0}return n}function w8(n){for(let l=0;l<n.length;l++)oa(n,l)||(n[l]=null);return n}function Fa(n){const l=wc(null);for(const[r,s]of Jy(n))oa(n,r)&&(Array.isArray(s)?l[r]=w8(s):s&&typeof s=="object"&&s.constructor===Object?l[r]=Fa(s):l[r]=s);return l}function js(n,l){for(;n!==null;){const s=S8(n,l);if(s){if(s.get)return Gn(s.get);if(typeof s.value=="function")return Gn(s.value)}n=C8(n)}function r(){return null}return r}const hv=In(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zd=In(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Wd=In(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),N8=In(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Qd=In(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),M8=In(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mv=In(["#text"]),pv=In(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Pd=In(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),gv=In(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sc=In(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),D8=Ra(/\{\{[\w\W]*|[\w\W]*\}\}/gm),L8=Ra(/<%[\w\W]*|[\w\W]*%>/gm),z8=Ra(/\$\{[\w\W]*/gm),k8=Ra(/^data-[\-\w.\u00B7-\uFFFF]+$/),B8=Ra(/^aria-[\-\w]+$/),Zy=Ra(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),j8=Ra(/^(?:\w+script|data):/i),U8=Ra(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wy=Ra(/^html$/i),H8=Ra(/^[a-z][.\w]*(-[.\w]+)+$/i);var vv=Object.freeze({__proto__:null,ARIA_ATTR:B8,ATTR_WHITESPACE:U8,CUSTOM_ELEMENT:H8,DATA_ATTR:k8,DOCTYPE_NAME:Wy,ERB_EXPR:L8,IS_ALLOWED_URI:Zy,IS_SCRIPT_OR_DATA:j8,MUSTACHE_EXPR:D8,TMPLIT_EXPR:z8});const Us={element:1,text:3,progressingInstruction:7,comment:8,document:9},q8=function(){return typeof window>"u"?null:window},I8=function(l,r){if(typeof l!="object"||typeof l.createPolicy!="function")return null;let s=null;const c="data-tt-policy-suffix";r&&r.hasAttribute(c)&&(s=r.getAttribute(c));const f="dompurify"+(s?"#"+s:"");try{return l.createPolicy(f,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+f+" could not be created."),null}},yv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Qy(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q8();const l=me=>Qy(me);if(l.version="3.3.2",l.removed=[],!n||!n.document||n.document.nodeType!==Us.document||!n.Element)return l.isSupported=!1,l;let{document:r}=n;const s=r,c=s.currentScript,{DocumentFragment:f,HTMLTemplateElement:d,Node:m,Element:h,NodeFilter:p,NamedNodeMap:y=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:b,DOMParser:C,trustedTypes:E}=n,x=h.prototype,A=js(x,"cloneNode"),S=js(x,"remove"),N=js(x,"nextSibling"),k=js(x,"childNodes"),M=js(x,"parentNode");if(typeof d=="function"){const me=r.createElement("template");me.content&&me.content.ownerDocument&&(r=me.content.ownerDocument)}let L,H="";const{implementation:B,createNodeIterator:X,createDocumentFragment:W,getElementsByTagName:ie}=r,{importNode:ee}=s;let ae=yv();l.isSupported=typeof Jy=="function"&&typeof M=="function"&&B&&B.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:oe,ERB_EXPR:pe,TMPLIT_EXPR:ye,DATA_ATTR:fe,ARIA_ATTR:w,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:ne,CUSTOM_ELEMENT:le}=vv;let{IS_ALLOWED_URI:_e}=vv,T=null;const V=Ue({},[...hv,...Zd,...Wd,...Qd,...mv]);let Y=null;const re=Ue({},[...pv,...Pd,...gv,...Sc]);let J=Object.seal(wc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ue=null,Ce=null;const ce=Object.seal(wc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,Ge=!0,rt=!1,he=!0,$=!1,ze=!0,Te=!1,wt=!1,Pe=!1,Ke=!1,Lt=!1,zt=!1,kt=!0,Fe=!1;const qa="user-content-";let dt=!0,Nn=!1,En={},Gt=null;const Qt=Ue({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Pa=null;const gn=Ue({},["audio","video","img","source","image","track"]);let Tn=null;const Qn=Ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Bt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",Ve="http://www.w3.org/1999/xhtml";let At=Ve,Mn=!1,gt=null;const pr=Ue({},[Bt,nt,Ve],Fd);let Pn=Ue({},["mi","mo","mn","ms","mtext"]),on=Ue({},["annotation-xml"]);const Kt=Ue({},["title","style","font","a","script"]);let Nt=null;const ma=["application/xhtml+xml","text/html"],$a="text/html";let jt=null,wa=null;const gr=r.createElement("form"),Ia=function(R){return R instanceof RegExp||R instanceof Function},Nl=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(wa&&wa===R)){if((!R||typeof R!="object")&&(R={}),R=Fa(R),Nt=ma.indexOf(R.PARSER_MEDIA_TYPE)===-1?$a:R.PARSER_MEDIA_TYPE,jt=Nt==="application/xhtml+xml"?Fd:Nc,T=oa(R,"ALLOWED_TAGS")?Ue({},R.ALLOWED_TAGS,jt):V,Y=oa(R,"ALLOWED_ATTR")?Ue({},R.ALLOWED_ATTR,jt):re,gt=oa(R,"ALLOWED_NAMESPACES")?Ue({},R.ALLOWED_NAMESPACES,Fd):pr,Tn=oa(R,"ADD_URI_SAFE_ATTR")?Ue(Fa(Qn),R.ADD_URI_SAFE_ATTR,jt):Qn,Pa=oa(R,"ADD_DATA_URI_TAGS")?Ue(Fa(gn),R.ADD_DATA_URI_TAGS,jt):gn,Gt=oa(R,"FORBID_CONTENTS")?Ue({},R.FORBID_CONTENTS,jt):Qt,ue=oa(R,"FORBID_TAGS")?Ue({},R.FORBID_TAGS,jt):Fa({}),Ce=oa(R,"FORBID_ATTR")?Ue({},R.FORBID_ATTR,jt):Fa({}),En=oa(R,"USE_PROFILES")?R.USE_PROFILES:!1,Re=R.ALLOW_ARIA_ATTR!==!1,Ge=R.ALLOW_DATA_ATTR!==!1,rt=R.ALLOW_UNKNOWN_PROTOCOLS||!1,he=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$=R.SAFE_FOR_TEMPLATES||!1,ze=R.SAFE_FOR_XML!==!1,Te=R.WHOLE_DOCUMENT||!1,Ke=R.RETURN_DOM||!1,Lt=R.RETURN_DOM_FRAGMENT||!1,zt=R.RETURN_TRUSTED_TYPE||!1,Pe=R.FORCE_BODY||!1,kt=R.SANITIZE_DOM!==!1,Fe=R.SANITIZE_NAMED_PROPS||!1,dt=R.KEEP_CONTENT!==!1,Nn=R.IN_PLACE||!1,_e=R.ALLOWED_URI_REGEXP||Zy,At=R.NAMESPACE||Ve,Pn=R.MATHML_TEXT_INTEGRATION_POINTS||Pn,on=R.HTML_INTEGRATION_POINTS||on,J=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&Ia(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&Ia(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$&&(Ge=!1),Lt&&(Ke=!0),En&&(T=Ue({},mv),Y=wc(null),En.html===!0&&(Ue(T,hv),Ue(Y,pv)),En.svg===!0&&(Ue(T,Zd),Ue(Y,Pd),Ue(Y,Sc)),En.svgFilters===!0&&(Ue(T,Wd),Ue(Y,Pd),Ue(Y,Sc)),En.mathMl===!0&&(Ue(T,Qd),Ue(Y,gv),Ue(Y,Sc))),oa(R,"ADD_TAGS")||(ce.tagCheck=null),oa(R,"ADD_ATTR")||(ce.attributeCheck=null),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?ce.tagCheck=R.ADD_TAGS:(T===V&&(T=Fa(T)),Ue(T,R.ADD_TAGS,jt))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?ce.attributeCheck=R.ADD_ATTR:(Y===re&&(Y=Fa(Y)),Ue(Y,R.ADD_ATTR,jt))),R.ADD_URI_SAFE_ATTR&&Ue(Tn,R.ADD_URI_SAFE_ATTR,jt),R.FORBID_CONTENTS&&(Gt===Qt&&(Gt=Fa(Gt)),Ue(Gt,R.FORBID_CONTENTS,jt)),R.ADD_FORBID_CONTENTS&&(Gt===Qt&&(Gt=Fa(Gt)),Ue(Gt,R.ADD_FORBID_CONTENTS,jt)),dt&&(T["#text"]=!0),Te&&Ue(T,["html","head","body"]),T.table&&(Ue(T,["tbody"]),delete ue.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=R.TRUSTED_TYPES_POLICY,H=L.createHTML("")}else L===void 0&&(L=I8(E,c)),L!==null&&typeof H=="string"&&(H=L.createHTML(""));In&&In(R),wa=R}},vr=Ue({},[...Zd,...Wd,...N8]),Ml=Ue({},[...Qd,...M8]),Dl=function(R){let te=M(R);(!te||!te.tagName)&&(te={namespaceURI:At,tagName:"template"});const ve=Nc(R.tagName),Je=Nc(te.tagName);return gt[R.namespaceURI]?R.namespaceURI===nt?te.namespaceURI===Ve?ve==="svg":te.namespaceURI===Bt?ve==="svg"&&(Je==="annotation-xml"||Pn[Je]):!!vr[ve]:R.namespaceURI===Bt?te.namespaceURI===Ve?ve==="math":te.namespaceURI===nt?ve==="math"&&on[Je]:!!Ml[ve]:R.namespaceURI===Ve?te.namespaceURI===nt&&!on[Je]||te.namespaceURI===Bt&&!Pn[Je]?!1:!Ml[ve]&&(Kt[ve]||!vr[ve]):!!(Nt==="application/xhtml+xml"&>[R.namespaceURI]):!1},xn=function(R){zs(l.removed,{element:R});try{M(R).removeChild(R)}catch{S(R)}},$n=function(R,te){try{zs(l.removed,{attribute:te.getAttributeNode(R),from:te})}catch{zs(l.removed,{attribute:null,from:te})}if(te.removeAttribute(R),R==="is")if(Ke||Lt)try{xn(te)}catch{}else try{te.setAttribute(R,"")}catch{}},yr=function(R){let te=null,ve=null;if(Pe)R="<remove></remove>"+R;else{const Oe=Jd(R,/^[\r\n\t ]+/);ve=Oe&&Oe[0]}Nt==="application/xhtml+xml"&&At===Ve&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Je=L?L.createHTML(R):R;if(At===Ve)try{te=new C().parseFromString(Je,Nt)}catch{}if(!te||!te.documentElement){te=B.createDocument(At,"template",null);try{te.documentElement.innerHTML=Mn?H:Je}catch{}}const ut=te.body||te.documentElement;return R&&ve&&ut.insertBefore(r.createTextNode(ve),ut.childNodes[0]||null),At===Ve?ie.call(te,Te?"html":"body")[0]:Te?te.documentElement:ut},cn=function(R){return X.call(R.ownerDocument||R,R,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Dn=function(R){return R instanceof b&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof y)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},Et=function(R){return typeof m=="function"&&R instanceof m};function vt(me,R,te){Cc(me,ve=>{ve.call(l,R,te,wa)})}const Vn=function(R){let te=null;if(vt(ae.beforeSanitizeElements,R,null),Dn(R))return xn(R),!0;const ve=jt(R.nodeName);if(vt(ae.uponSanitizeElement,R,{tagName:ve,allowedTags:T}),ze&&R.hasChildNodes()&&!Et(R.firstElementChild)&&zn(/<[/\w!]/g,R.innerHTML)&&zn(/<[/\w!]/g,R.textContent)||R.nodeType===Us.progressingInstruction||ze&&R.nodeType===Us.comment&&zn(/<[/\w]/g,R.data))return xn(R),!0;if(!(ce.tagCheck instanceof Function&&ce.tagCheck(ve))&&(!T[ve]||ue[ve])){if(!ue[ve]&&br(ve)&&(J.tagNameCheck instanceof RegExp&&zn(J.tagNameCheck,ve)||J.tagNameCheck instanceof Function&&J.tagNameCheck(ve)))return!1;if(dt&&!Gt[ve]){const Je=M(R)||R.parentNode,ut=k(R)||R.childNodes;if(ut&&Je){const Oe=ut.length;for(let un=Oe-1;un>=0;--un){const vn=A(ut[un],!0);vn.__removalCount=(R.__removalCount||0)+1,Je.insertBefore(vn,N(R))}}}return xn(R),!0}return R instanceof h&&!Dl(R)||(ve==="noscript"||ve==="noembed"||ve==="noframes")&&zn(/<\/no(script|embed|frames)/i,R.innerHTML)?(xn(R),!0):($&&R.nodeType===Us.text&&(te=R.textContent,Cc([oe,pe,ye],Je=>{te=ks(te,Je," ")}),R.textContent!==te&&(zs(l.removed,{element:R.cloneNode()}),R.textContent=te)),vt(ae.afterSanitizeElements,R,null),!1)},Ll=function(R,te,ve){if(Ce[te]||kt&&(te==="id"||te==="name")&&(ve in r||ve in gr))return!1;if(!(Ge&&!Ce[te]&&zn(fe,te))){if(!(Re&&zn(w,te))){if(!(ce.attributeCheck instanceof Function&&ce.attributeCheck(te,R))){if(!Y[te]||Ce[te]){if(!(br(R)&&(J.tagNameCheck instanceof RegExp&&zn(J.tagNameCheck,R)||J.tagNameCheck instanceof Function&&J.tagNameCheck(R))&&(J.attributeNameCheck instanceof RegExp&&zn(J.attributeNameCheck,te)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(te,R))||te==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&zn(J.tagNameCheck,ve)||J.tagNameCheck instanceof Function&&J.tagNameCheck(ve))))return!1}else if(!Tn[te]){if(!zn(_e,ks(ve,ne,""))){if(!((te==="src"||te==="xlink:href"||te==="href")&&R!=="script"&&x8(ve,"data:")===0&&Pa[R])){if(!(rt&&!zn(F,ks(ve,ne,"")))){if(ve)return!1}}}}}}}return!0},br=function(R){return R!=="annotation-xml"&&Jd(R,le)},zl=function(R){vt(ae.beforeSanitizeAttributes,R,null);const{attributes:te}=R;if(!te||Dn(R))return;const ve={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Je=te.length;for(;Je--;){const ut=te[Je],{name:Oe,namespaceURI:un,value:vn}=ut,Pt=jt(Oe),pa=vn;let Ft=Oe==="value"?pa:O8(pa);if(ve.attrName=Pt,ve.attrValue=Ft,ve.keepAttr=!0,ve.forceKeepAttr=void 0,vt(ae.uponSanitizeAttribute,R,ve),Ft=ve.attrValue,Fe&&(Pt==="id"||Pt==="name")&&($n(Oe,R),Ft=qa+Ft),ze&&zn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ft)){$n(Oe,R);continue}if(Pt==="attributename"&&Jd(Ft,"href")){$n(Oe,R);continue}if(ve.forceKeepAttr)continue;if(!ve.keepAttr){$n(Oe,R);continue}if(!he&&zn(/\/>/i,Ft)){$n(Oe,R);continue}$&&Cc([oe,pe,ye],Cr=>{Ft=ks(Ft,Cr," ")});const Ar=jt(R.nodeName);if(!Ll(Ar,Pt,Ft)){$n(Oe,R);continue}if(L&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!un)switch(E.getAttributeType(Ar,Pt)){case"TrustedHTML":{Ft=L.createHTML(Ft);break}case"TrustedScriptURL":{Ft=L.createScriptURL(Ft);break}}if(Ft!==pa)try{un?R.setAttributeNS(un,Oe,Ft):R.setAttribute(Oe,Ft),Dn(R)?xn(R):dv(l.removed)}catch{$n(Oe,R)}}vt(ae.afterSanitizeAttributes,R,null)},_r=function me(R){let te=null;const ve=cn(R);for(vt(ae.beforeSanitizeShadowDOM,R,null);te=ve.nextNode();)vt(ae.uponSanitizeShadowNode,te,null),Vn(te),zl(te),te.content instanceof f&&me(te.content);vt(ae.afterSanitizeShadowDOM,R,null)};return l.sanitize=function(me){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=null,ve=null,Je=null,ut=null;if(Mn=!me,Mn&&(me="<!-->"),typeof me!="string"&&!Et(me))if(typeof me.toString=="function"){if(me=me.toString(),typeof me!="string")throw Bs("dirty is not a string, aborting")}else throw Bs("toString is not a function");if(!l.isSupported)return me;if(wt||Nl(R),l.removed=[],typeof me=="string"&&(Nn=!1),Nn){if(me.nodeName){const vn=jt(me.nodeName);if(!T[vn]||ue[vn])throw Bs("root node is forbidden and cannot be sanitized in-place")}}else if(me instanceof m)te=yr("<!---->"),ve=te.ownerDocument.importNode(me,!0),ve.nodeType===Us.element&&ve.nodeName==="BODY"||ve.nodeName==="HTML"?te=ve:te.appendChild(ve);else{if(!Ke&&!$&&!Te&&me.indexOf("<")===-1)return L&&zt?L.createHTML(me):me;if(te=yr(me),!te)return Ke?null:zt?H:""}te&&Pe&&xn(te.firstChild);const Oe=cn(Nn?me:te);for(;Je=Oe.nextNode();)Vn(Je),zl(Je),Je.content instanceof f&&_r(Je.content);if(Nn)return me;if(Ke){if(Lt)for(ut=W.call(te.ownerDocument);te.firstChild;)ut.appendChild(te.firstChild);else ut=te;return(Y.shadowroot||Y.shadowrootmode)&&(ut=ee.call(s,ut,!0)),ut}let un=Te?te.outerHTML:te.innerHTML;return Te&&T["!doctype"]&&te.ownerDocument&&te.ownerDocument.doctype&&te.ownerDocument.doctype.name&&zn(Wy,te.ownerDocument.doctype.name)&&(un="<!DOCTYPE "+te.ownerDocument.doctype.name+`>
|
|
63
|
-
`+un),$&&Cc([oe,pe,ye],vn=>{un=ks(un,vn," ")}),L&&zt?L.createHTML(un):un},l.setConfig=function(){let me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nl(me),wt=!0},l.clearConfig=function(){wa=null,wt=!1},l.isValidAttribute=function(me,R,te){wa||Nl({});const ve=jt(me),Je=jt(R);return Ll(ve,Je,te)},l.addHook=function(me,R){typeof R=="function"&&zs(ae[me],R)},l.removeHook=function(me,R){if(R!==void 0){const te=E8(ae[me],R);return te===-1?void 0:T8(ae[me],te,1)[0]}return dv(ae[me])},l.removeHooks=function(me){ae[me]=[]},l.removeAllHooks=function(){ae=yv()},l}var G8=Qy();const V8=({onClose:n})=>{const l=St();return v.jsxs("div",{className:pn.highlightLoadingInfo,onClick:n,children:[v.jsx("div",{className:pn.highlightLoadingInfoCloseIcon,children:v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.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"})})}),v.jsxs("div",{className:pn.highlightLoadingInfoInnerContainer,children:[v.jsxs("div",{className:pn.highlightLoadingInfoContent,children:[v.jsx("h3",{children:l("source-infos.highlight-loading.title")}),v.jsx("p",{children:l("source-infos.highlight-loading.description")})]}),v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"#000000",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M253.66,106.34a8,8,0,0,0-11.32,0L192,156.69,107.31,72l50.35-50.34a8,8,0,1,0-11.32-11.32L96,60.69A16,16,0,0,0,93.18,79.5L72,100.69a16,16,0,0,0,0,22.62L76.69,128,18.34,186.34a8,8,0,0,0,3.13,13.25l72,24A7.88,7.88,0,0,0,96,224a8,8,0,0,0,5.66-2.34L136,187.31l4.69,4.69a16,16,0,0,0,22.62,0l21.19-21.18A16,16,0,0,0,203.31,168l50.35-50.34A8,8,0,0,0,253.66,106.34ZM93.84,206.85l-55-18.35L88,139.31,124.69,176ZM152,180.69,83.31,112,104,91.31,172.69,160Z"})})]})]})},X8=({title:n,href:l,children:r})=>v.jsx("a",{href:l,title:n,target:"_blank",rel:"noopener noreferrer",children:r}),Y8=({className:n,children:l,...r})=>v.jsx("a",{className:se(Js.button,Js.buttonDefault,n),type:"button",role:"button",...r,children:l}),K8=n=>v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:v.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"})}),F8=({type:n,...l})=>{switch(n){case"WEBSITE":return v.jsx(Iy,{...l});case"PDF":return v.jsx(qy,{...l});case"DOCX":return v.jsx(Uy,{...l});case"TEXT":return v.jsx(K8,{...l});default:return v.jsx(Hy,{...l})}},J8=({url:n,knowledgeBaseType:l})=>{const r=St();return v.jsx(Y8,{className:pn.openSourceButton,href:n,target:"_blank",children:v.jsxs("div",{className:pn.sourceButtonLabel,children:[v.jsx("div",{className:pn.sourceHeaderIcon,children:v.jsx(F8,{type:l})}),v.jsx("p",{children:r("source-infos.open-source")})]})})},Z8=({sourceInfos:{content:n,url:l,knowledgeBaseType:r,highlighted:s}})=>{const[c,f]=q.useState(!s);q.useEffect(()=>{s&&f(!1)},[s]);const d=G8.sanitize(n,{USE_PROFILES:{html:!0}});return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:se(pn.sourceContent,Vy.markdown),children:[v.jsx(Sl,{options:{overrides:{a:X8}},children:d}),c&&v.jsx(V8,{onClose:()=>f(!1)})]}),v.jsx(J8,{url:l,knowledgeBaseType:r})]})},W8=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,Q8=()=>{const n=St();return v.jsxs("div",{className:pn.loadingError,children:[v.jsx("h1",{children:n("source-infos.error.title")}),v.jsx("img",{src:W8,title:n("source-infos.error.title")}),v.jsx("p",{children:n("source-infos.error.info")})]})},P8=()=>v.jsx("div",{className:pn.loadingSourceInfos,children:v.jsx("svg",{className:pn.loading,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"})})});function $8({sourceInfos:n,onClose:l,threshold:r=100}){const s=q.useRef(null),[c,f]=q.useState(0),[d,m]=q.useState(!1),h=q.useRef(null),p=q.useRef(null),y=q.useCallback(x=>{h.current=x,m(!0)},[]),b=q.useCallback(x=>{if(h.current!==null&&d){const A=x-h.current;A>0&&f(A)}},[d]),C=q.useCallback(()=>{m(!1),c>r&&l(),f(0),h.current=null},[c,r,l]),E=q.useCallback(x=>{const A=H=>y(H.touches[0].clientY),S=H=>b(H.touches[0].clientY),N=()=>C(),k=H=>{H.preventDefault(),y(H.clientY),window.addEventListener("mousemove",M),window.addEventListener("mouseup",L)},M=H=>b(H.clientY),L=()=>{C(),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",L)};x.addEventListener("touchstart",A),x.addEventListener("touchmove",S),x.addEventListener("touchend",N),x.addEventListener("mousedown",k),p.current=()=>{x.removeEventListener("touchstart",A),x.removeEventListener("touchmove",S),x.removeEventListener("touchend",N),x.removeEventListener("mousedown",k),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",L)}},[y,b,C]);return q.useEffect(()=>{let x;return s.current?(p.current?.(),E(s.current)):(x=new MutationObserver(()=>{s.current&&(p.current?.(),E(s.current),x?.disconnect())}),x.observe(document.body,{childList:!0,subtree:!0})),()=>{x?.disconnect(),p.current?.()}},[E,n]),{ref:s,dragOffsetY:c,isDragging:d}}const ex=n=>{const[l,r]=q.useState(!0);return q.useEffect(()=>{let s=null;return n?.type==="loading"?(r(!0),s=setTimeout(()=>{r(!1)},300)):r(!n),()=>{s&&clearTimeout(s)}},[n]),l},tx=()=>{const n=wl(),l=Dt(h=>h.chat.sourceInfos),r=Fy(),s=q.useRef(null),c=ex(l);q.useEffect(()=>{s.current&&l?.type==="loading"&&(r?s.current.showModal():(s.current.setAttribute("open","true"),s.current?.focus()))},[l,r]);const f=q.useCallback(()=>{s.current&&(r?s.current.close():s.current.removeAttribute("open"),n(hS()))},[n,r]),{ref:d,dragOffsetY:m}=$8({onClose:f,sourceInfos:l});return l?v.jsx("dialog",{ref:s,className:se(pn.sourceInfos,c?pn.waitForLoading:l.type==="loading"?pn.loadingContent:""),style:r&&m?{transform:`translateY(${m}px)`}:{},onClose:f,autoFocus:!0,role:"dialog","aria-labelledby":"source-info-title",children:c?null:v.jsxs(v.Fragment,{children:[v.jsx(b8,{ref:d,tabIndex:-1,sourceInfos:l.type==="loaded"?l:void 0,onClose:f}),l.type==="loading"?v.jsx(P8,{}):l.type==="loading-error"?v.jsx(Q8,{}):v.jsxs(v.Fragment,{children:[v.jsx(_8,{loading:!l.highlighted}),v.jsx(Z8,{sourceInfos:l})]})]})}):null},nx="_container_1hnv6_1",ax="_body_1hnv6_7",lx="_intro_1hnv6_14",rx="_footer_1hnv6_48",ix="_footnote_1hnv6_52",sx="_containerWithFootnote_1hnv6_67",ox="_startChatButton_1hnv6_82",cx="_spinner_1hnv6_97",ux="_formFields_1hnv6_101",fx="_formField_1hnv6_101",dx="_radio_1hnv6_113",hx="_checkbox_1hnv6_120",mx="_input_1hnv6_128",px="_inputLabel_1hnv6_162",gx="_selectWrapper_1hnv6_166",vx="_select_1hnv6_166",yx="_selectLabel_1hnv6_212",mn={container:nx,body:ax,intro:lx,footer:rx,footnote:ix,containerWithFootnote:sx,startChatButton:ox,spinner:cx,formFields:ux,formField:fx,radio:dx,checkbox:hx,input:mx,inputLabel:px,selectWrapper:gx,select:vx,selectLabel:yx},bx=({name:n,label:l,defaultValue:r,required:s,onChange:c})=>{const f=d=>{c(d.currentTarget.checked?"true":"false")};return v.jsxs("label",{className:se(mn.checkbox,"chat__startScreen__checkbox"),htmlFor:n,children:[v.jsx("input",{type:"checkbox",id:n,name:n,defaultChecked:r==="true",required:s,onChange:f}),v.jsx("div",{children:l})]})},_x=({type:n,name:l,label:r,defaultValue:s,placeholder:c,required:f,multiple:d,min:m,max:h,pattern:p,onChange:y})=>{const b=C=>{y(C.target.value)};return v.jsxs("label",{className:se(mn.input,"chat__startScreen__input"),htmlFor:l,children:[v.jsx("div",{className:se(mn.inputLabel),children:r}),v.jsx("input",{type:n,id:l,name:l,defaultValue:s,placeholder:c,required:f,multiple:d,min:m,max:h,pattern:p,onChange:b})]})},Ax=({name:n,value:l,label:r,defaultChecked:s,required:c,onChange:f})=>{const d=`${n}-${l}`,m=h=>{f(h.target.value)};return v.jsxs("label",{className:se(mn.radio,"chat__startScreen__radio"),htmlFor:d,children:[v.jsx("input",{id:d,type:"radio",name:n,value:l,defaultChecked:s,required:c,onChange:m}),v.jsx("span",{className:se(mn.label),children:r})]})},Cx=({name:n,label:l,defaultValue:r,required:s,multiple:c,options:f,onChange:d})=>{const m=h=>{d(h.target.value)};return v.jsxs("label",{className:se(mn.select,"chat__startScreen__select"),htmlFor:n,children:[v.jsx("div",{className:se(mn.selectLabel),children:l}),v.jsx("div",{className:se(mn.selectWrapper),children:v.jsx("select",{id:n,name:n,defaultValue:r,required:s,multiple:c,onChange:m,children:Object.entries(f||{}).map(([h,p])=>v.jsx("option",{value:h,selected:p===r,children:p}))})})]})},Sx="start-screen.intro",Ex="start-screen.start-chat",Tx="start-screen.waiting-for-login",xx="start-screen.footnote",ka="start-screen.form",bv=`${ka}.fields`,Ox=()=>{const n=St(),l=wl(),r=om(),s=Dt(x=>x.startScreen.loginRequestToken),c=Dt(x=>x.settings.requiresUserAuthentication);q.useEffect(()=>{let x;if(s){const N=window.screenX+(window.outerWidth-600)/2,k=window.screenY+(window.outerHeight-700)/2,M=encodeURIComponent(r),L=new URL(window.location.origin);L.pathname=`/${M}/auth/login`,L.searchParams.set("loginRequestToken",s);const H=window.open(L.href,"Login",`width=600,height=700,left=${N},top=${k},resizable=yes,scrollbars=yes`);x=setInterval(()=>{H?.closed&&(l(cS()),clearInterval(x))},500)}return()=>{x&&clearInterval(x)}},[r,s,l]);const[f,d]=q.useState({}),m=()=>{const x=Object.entries(f).reduce((A,[S,N])=>({...A,[S]:N.value}),{});l(c?oS({loginRequestToken:jc(),formValues:x}):rS({formValues:x}))},h=n(Sx),p=n(s?Tx:Ex),y=n(xx),b=q.useMemo(()=>n(bv)?.split(";").map(x=>x.trim())??[],[n(bv)]);q.useEffect(()=>{b.length&&Object.keys(f).length===0&&d(b.reduce((x,A)=>({...x,[A]:Rx(A,n)}),{}))},[n,b,f]);const C=x=>{x.preventDefault(),m()},E=x=>A=>{d(S=>({...S,[x]:{...S[x],value:A}}))};return v.jsxs("form",{onSubmit:C,className:se(mn.container,y&&mn.containerWithFootnote,"chat__startScreen"),children:[v.jsxs("div",{className:se(mn.body,"chat__startScreen__body"),children:[h&&v.jsx("div",{className:se(mn.intro,"chat__startScreen__intro"),children:v.jsx(Sl,{options:{overrides:{a:_v}},children:h})}),v.jsx("div",{className:se(mn.formFields,"chat__startScreen__fields"),children:Object.values(f).map(({type:x,name:A,label:S,placeholder:N,defaultValue:k,options:M,required:L,multiple:H,min:B,max:X,pattern:W})=>v.jsx("div",{className:se(mn.formField,"chat__startScreen__field"),children:(()=>{switch(x){case"radio":return v.jsxs(v.Fragment,{children:[v.jsx("div",{children:S}),Object.entries(M||{}).map(([ie,ee])=>v.jsx(Ax,{name:A,value:ie,label:ee,defaultChecked:ie===k,required:L,onChange:E(A)},ie))]});case"checkbox":return v.jsx(bx,{name:A,label:S,defaultValue:k,required:L,onChange:E(A)});case"select":return v.jsx(Cx,{name:A,label:S,defaultValue:k,required:L,multiple:H,options:M,onChange:E(A)});default:return v.jsx(_x,{type:x,name:A,label:S,placeholder:N,defaultValue:k,required:L,multiple:H,min:B,max:X,pattern:W,onChange:E(A)})}})()},A))})]}),v.jsxs("div",{className:se(mn.footer,"chat__startScreen__footer"),children:[v.jsxs($c,{type:"submit",className:mn.startChatButton,disabled:!!s,children:[!!s&&v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",className:mn.spinner,children:v.jsx("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"})}),v.jsx("div",{children:p})]}),y&&v.jsx("div",{className:mn.footnote,children:v.jsx(Sl,{options:{overrides:{a:_v}},children:y})})]})]})},_v=({title:n,href:l,children:r})=>v.jsx("a",{href:l,title:n,target:"_blank",rel:"noopener noreferrer",children:r}),Rx=(n,l)=>{const r=l(`${ka}.${n}.type`)||"text",s=l(`${ka}.${n}.required`)==="true",c=l(`${ka}.${n}.multiple`)==="true",f=l(`${ka}.${n}.placeholder`),d=l(`${ka}.${n}.label`)||"",m=l(`${ka}.${n}.defaultValue`),h=l(`${ka}.${n}.min`),p=l(`${ka}.${n}.max`),y=l(`${ka}.${n}.pattern`),b=Nx(l(`${ka}.${n}.options`));return{name:n,label:d,placeholder:f,value:wx(r,m,b)||"",defaultValue:m,options:b,type:r,required:s,multiple:c,min:h,max:p,pattern:y}},wx=(n,l,r)=>l||n==="select"&&Object.keys(r)[0]||"",Nx=(n="")=>n.split(";").map(l=>l.trim()).reduce((l,r)=>{const[s,c]=r.split(":").map(f=>f.trim());return{...l,[s]:c}},{}),Mx=()=>{const n=Dt(l=>l.intl.locale);q.useEffect(()=>{window.document.documentElement.lang=n},[n])},Xr={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"},Dx=({clientName:n})=>{Mx();const l=wl(),r=Dt(b=>b.intl.messages),s=St(),c=Dt(b=>b.settings.enableStartScreen),f=Dt(b=>b.startScreen.startScreenStatus),d=Dt(b=>b.connection.queryString),m=Dt(b=>b.settings.allowedOrigins),h=q.useMemo(()=>new URLSearchParams(d||"?").get("cssClassName"),[d]);q.useEffect(()=>{const b=new URLSearchParams(d||""),C=Object.fromEntries(b.entries());l(pS(n,C))},[n,d,l]),q.useEffect(()=>{const b=C=>{if(!C.data?.type||!Object.values(Xr).includes(C.data.type))return;const E=C.origin===window.location.origin,x=C.source===window.parent,A=m===void 0||m.includes(C.origin);if(!(E||x&&A)){console.warn("Rejected postMessage from untrusted origin:",C.origin);return}switch(C.data.type){case Xr.TRIGGER_ACTION:l(C.data.action);break;case Xr.TRIGGER_STORY:l(Qv(C.data.story));break;case Xr.ON_CHAT_WINDOW_OPEN:l({type:"webclient.chatwindow.opened"});break;case Xr.ON_CHAT_WINDOW_CLOSE:l({type:"webclient.chatwindow.closed"});break;case Xr.CHAT_MESSAGE_FROM_GUEST:l(Kv(C.data.text));break;case Xr.RESTART_CHAT:l(Ws());break}};return window.addEventListener("message",b,!1),()=>window.removeEventListener("message",b)},[m,l]),q.useEffect(()=>{const b=s("page.title");b&&document&&(document.title=b)},[r,s]);const p=c===void 0,y=c===!1||f==="HIDDEN";return v.jsx("div",{className:se(uv.chatwindow,y&&uv.chatwindowWithAside,"chat__chatwindow",h),children:p?null:y?v.jsxs(v.Fragment,{children:[v.jsx("header",{children:v.jsx(cv,{chatStarted:!0})}),v.jsx("main",{children:v.jsx(j3,{clientName:n})}),v.jsx("aside",{children:v.jsx(tx,{})})]}):v.jsxs(v.Fragment,{children:[v.jsx("header",{children:v.jsx(cv,{chatStarted:!1})}),v.jsx("main",{children:v.jsx(Ox,{})})]})})},Lx=()=>{const n=om(),l=Fy();return v.jsx("div",{className:se([GA.app,l?"chat__small":"chat__large"]),children:v.jsx(Dx,{clientName:n})})},Py={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht eingeben","message-input.actions.submit.label":"Nachricht senden","message-input.actions.start-audio-recording.label":"Spracheingabe starten","message-input.actions.stop-audio-recording.label":"Spracheingabe stoppen","message-input.actions.submit-audio-recording.label":"Spracheingabe übermitteln","message-input.actions.command.label":"Aktion ausführen","guest-bubble.label":"Ihre Nachricht","bot-bubble.label":"Nachricht des Chatbots","bot-bubble.actions.label":"Nachricht-Aktionen","bot-bubble.reaction.good":"Gefällt mir","bot-bubble.reaction.bad":"Gefällt mir nicht","bot-bubble.reaction.remove":"Markierung entfernen","bot-bubble.reaction.say-more":"Erzähle mir bitte mehr","bot-bubble.reaction.category.WRONG_INFORMATION":"Falsch","bot-bubble.reaction.category.MISSING_INFORMATION":"Unvollständig","bot-bubble.reaction.category.OLD_INFORMATION":"Veraltet","bot-bubble.reaction.category.UNCLEAR":"Unklar","bot-bubble.reaction.category.OFF_TOPIC":"Nicht zur Frage passend","bot-bubble.reaction.comment":"Gedanken mit mir teilen...","bot-bubble.reaction.close":"Schliessen","bot-bubble.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","bot-bubble.footnote":"Fussnote","agent-bubble.label":"Nachricht des Live-Agenten","conversation.label":"Chat Verlauf","chatbot.typing":"Chatbot schreibt","export-transcript.email.title":"Chatverlauf per E-Mail versenden","export-transcript.email.description":"Bitte E-Mail-Adresse angeben, an die der Chatverlauf gesendet werden soll.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Der Chatverlauf wurde an die hinterlegte E-Mail-Adresse übermittelt.","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
|
|
63
|
+
`+un),$&&Cc([oe,pe,ye],vn=>{un=ks(un,vn," ")}),L&&zt?L.createHTML(un):un},l.setConfig=function(){let me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nl(me),wt=!0},l.clearConfig=function(){wa=null,wt=!1},l.isValidAttribute=function(me,R,te){wa||Nl({});const ve=jt(me),Je=jt(R);return Ll(ve,Je,te)},l.addHook=function(me,R){typeof R=="function"&&zs(ae[me],R)},l.removeHook=function(me,R){if(R!==void 0){const te=E8(ae[me],R);return te===-1?void 0:T8(ae[me],te,1)[0]}return dv(ae[me])},l.removeHooks=function(me){ae[me]=[]},l.removeAllHooks=function(){ae=yv()},l}var G8=Qy();const V8=({onClose:n})=>{const l=St();return v.jsxs("div",{className:pn.highlightLoadingInfo,onClick:n,children:[v.jsx("div",{className:pn.highlightLoadingInfoCloseIcon,children:v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.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"})})}),v.jsxs("div",{className:pn.highlightLoadingInfoInnerContainer,children:[v.jsxs("div",{className:pn.highlightLoadingInfoContent,children:[v.jsx("h3",{children:l("source-infos.highlight-loading.title")}),v.jsx("p",{children:l("source-infos.highlight-loading.description")})]}),v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"#000000",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M253.66,106.34a8,8,0,0,0-11.32,0L192,156.69,107.31,72l50.35-50.34a8,8,0,1,0-11.32-11.32L96,60.69A16,16,0,0,0,93.18,79.5L72,100.69a16,16,0,0,0,0,22.62L76.69,128,18.34,186.34a8,8,0,0,0,3.13,13.25l72,24A7.88,7.88,0,0,0,96,224a8,8,0,0,0,5.66-2.34L136,187.31l4.69,4.69a16,16,0,0,0,22.62,0l21.19-21.18A16,16,0,0,0,203.31,168l50.35-50.34A8,8,0,0,0,253.66,106.34ZM93.84,206.85l-55-18.35L88,139.31,124.69,176ZM152,180.69,83.31,112,104,91.31,172.69,160Z"})})]})]})},X8=({title:n,href:l,children:r})=>v.jsx("a",{href:l,title:n,target:"_blank",rel:"noopener noreferrer",children:r}),Y8=({className:n,children:l,...r})=>v.jsx("a",{className:se(Js.button,Js.buttonDefault,n),type:"button",role:"button",...r,children:l}),K8=n=>v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...n,children:v.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"})}),F8=({type:n,...l})=>{switch(n){case"WEBSITE":return v.jsx(Iy,{...l});case"PDF":return v.jsx(qy,{...l});case"DOCX":return v.jsx(Uy,{...l});case"TEXT":return v.jsx(K8,{...l});default:return v.jsx(Hy,{...l})}},J8=({url:n,knowledgeBaseType:l})=>{const r=St();return v.jsx(Y8,{className:pn.openSourceButton,href:n,target:"_blank",children:v.jsxs("div",{className:pn.sourceButtonLabel,children:[v.jsx("div",{className:pn.sourceHeaderIcon,children:v.jsx(F8,{type:l})}),v.jsx("p",{children:r("source-infos.open-source")})]})})},Z8=({sourceInfos:{content:n,url:l,knowledgeBaseType:r,highlighted:s}})=>{const[c,f]=q.useState(!s);q.useEffect(()=>{s&&f(!1)},[s]);const d=G8.sanitize(n,{USE_PROFILES:{html:!0}});return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:se(pn.sourceContent,Vy.markdown),children:[v.jsx(Sl,{options:{overrides:{a:X8}},children:d}),c&&v.jsx(V8,{onClose:()=>f(!1)})]}),v.jsx(J8,{url:l,knowledgeBaseType:r})]})},W8=""+new URL("undraw_fixing-bugs-D_eYxJc6.svg",import.meta.url).href,Q8=()=>{const n=St();return v.jsxs("div",{className:pn.loadingError,children:[v.jsx("h1",{children:n("source-infos.error.title")}),v.jsx("img",{src:W8,title:n("source-infos.error.title")}),v.jsx("p",{children:n("source-infos.error.info")})]})},P8=()=>v.jsx("div",{className:pn.loadingSourceInfos,children:v.jsx("svg",{className:pn.loading,xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",children:v.jsx("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"})})});function $8({sourceInfos:n,onClose:l,threshold:r=100}){const s=q.useRef(null),[c,f]=q.useState(0),[d,m]=q.useState(!1),h=q.useRef(null),p=q.useRef(null),y=q.useCallback(x=>{h.current=x,m(!0)},[]),b=q.useCallback(x=>{if(h.current!==null&&d){const A=x-h.current;A>0&&f(A)}},[d]),C=q.useCallback(()=>{m(!1),c>r&&l(),f(0),h.current=null},[c,r,l]),E=q.useCallback(x=>{const A=H=>y(H.touches[0].clientY),S=H=>b(H.touches[0].clientY),N=()=>C(),k=H=>{H.preventDefault(),y(H.clientY),window.addEventListener("mousemove",M),window.addEventListener("mouseup",L)},M=H=>b(H.clientY),L=()=>{C(),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",L)};x.addEventListener("touchstart",A),x.addEventListener("touchmove",S),x.addEventListener("touchend",N),x.addEventListener("mousedown",k),p.current=()=>{x.removeEventListener("touchstart",A),x.removeEventListener("touchmove",S),x.removeEventListener("touchend",N),x.removeEventListener("mousedown",k),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",L)}},[y,b,C]);return q.useEffect(()=>{let x;return s.current?(p.current?.(),E(s.current)):(x=new MutationObserver(()=>{s.current&&(p.current?.(),E(s.current),x?.disconnect())}),x.observe(document.body,{childList:!0,subtree:!0})),()=>{x?.disconnect(),p.current?.()}},[E,n]),{ref:s,dragOffsetY:c,isDragging:d}}const ex=n=>{const[l,r]=q.useState(!0);return q.useEffect(()=>{let s=null;return n?.type==="loading"?(r(!0),s=setTimeout(()=>{r(!1)},300)):r(!n),()=>{s&&clearTimeout(s)}},[n]),l},tx=()=>{const n=wl(),l=Dt(h=>h.chat.sourceInfos),r=Fy(),s=q.useRef(null),c=ex(l);q.useEffect(()=>{s.current&&l?.type==="loading"&&(r?s.current.showModal():(s.current.setAttribute("open","true"),s.current?.focus()))},[l,r]);const f=q.useCallback(()=>{s.current&&(r?s.current.close():s.current.removeAttribute("open"),n(hS()))},[n,r]),{ref:d,dragOffsetY:m}=$8({onClose:f,sourceInfos:l});return l?v.jsx("dialog",{ref:s,className:se(pn.sourceInfos,c?pn.waitForLoading:l.type==="loading"?pn.loadingContent:""),style:r&&m?{transform:`translateY(${m}px)`}:{},onClose:f,autoFocus:!0,role:"dialog","aria-labelledby":"source-info-title",children:c?null:v.jsxs(v.Fragment,{children:[v.jsx(b8,{ref:d,tabIndex:-1,sourceInfos:l.type==="loaded"?l:void 0,onClose:f}),l.type==="loading"?v.jsx(P8,{}):l.type==="loading-error"?v.jsx(Q8,{}):v.jsxs(v.Fragment,{children:[v.jsx(_8,{loading:!l.highlighted}),v.jsx(Z8,{sourceInfos:l})]})]})}):null},nx="_container_1hnv6_1",ax="_body_1hnv6_7",lx="_intro_1hnv6_14",rx="_footer_1hnv6_48",ix="_footnote_1hnv6_52",sx="_containerWithFootnote_1hnv6_67",ox="_startChatButton_1hnv6_82",cx="_spinner_1hnv6_97",ux="_formFields_1hnv6_101",fx="_formField_1hnv6_101",dx="_radio_1hnv6_113",hx="_checkbox_1hnv6_120",mx="_input_1hnv6_128",px="_inputLabel_1hnv6_162",gx="_selectWrapper_1hnv6_166",vx="_select_1hnv6_166",yx="_selectLabel_1hnv6_212",mn={container:nx,body:ax,intro:lx,footer:rx,footnote:ix,containerWithFootnote:sx,startChatButton:ox,spinner:cx,formFields:ux,formField:fx,radio:dx,checkbox:hx,input:mx,inputLabel:px,selectWrapper:gx,select:vx,selectLabel:yx},bx=({name:n,label:l,defaultValue:r,required:s,onChange:c})=>{const f=d=>{c(d.currentTarget.checked?"true":"false")};return v.jsxs("label",{className:se(mn.checkbox,"chat__startScreen__checkbox"),htmlFor:n,children:[v.jsx("input",{type:"checkbox",id:n,name:n,defaultChecked:r==="true",required:s,onChange:f}),v.jsx("div",{children:l})]})},_x=({type:n,name:l,label:r,defaultValue:s,placeholder:c,required:f,multiple:d,min:m,max:h,pattern:p,onChange:y})=>{const b=C=>{y(C.target.value)};return v.jsxs("label",{className:se(mn.input,"chat__startScreen__input"),htmlFor:l,children:[v.jsx("div",{className:se(mn.inputLabel),children:r}),v.jsx("input",{type:n,id:l,name:l,defaultValue:s,placeholder:c,required:f,multiple:d,min:m,max:h,pattern:p,onChange:b})]})},Ax=({name:n,value:l,label:r,defaultChecked:s,required:c,onChange:f})=>{const d=`${n}-${l}`,m=h=>{f(h.target.value)};return v.jsxs("label",{className:se(mn.radio,"chat__startScreen__radio"),htmlFor:d,children:[v.jsx("input",{id:d,type:"radio",name:n,value:l,defaultChecked:s,required:c,onChange:m}),v.jsx("span",{className:se(mn.label),children:r})]})},Cx=({name:n,label:l,defaultValue:r,required:s,multiple:c,options:f,onChange:d})=>{const m=h=>{d(h.target.value)};return v.jsxs("label",{className:se(mn.select,"chat__startScreen__select"),htmlFor:n,children:[v.jsx("div",{className:se(mn.selectLabel),children:l}),v.jsx("div",{className:se(mn.selectWrapper),children:v.jsx("select",{id:n,name:n,defaultValue:r,required:s,multiple:c,onChange:m,children:Object.entries(f||{}).map(([h,p])=>v.jsx("option",{value:h,selected:p===r,children:p}))})})]})},Sx="start-screen.intro",Ex="start-screen.start-chat",Tx="start-screen.waiting-for-login",xx="start-screen.footnote",ka="start-screen.form",bv=`${ka}.fields`,Ox=()=>{const n=St(),l=wl(),r=om(),s=Dt(x=>x.startScreen.loginRequestToken),c=Dt(x=>x.settings.requiresUserAuthentication);q.useEffect(()=>{let x;if(s){const N=window.screenX+(window.outerWidth-600)/2,k=window.screenY+(window.outerHeight-700)/2,M=encodeURIComponent(r),L=new URL(window.location.origin);L.pathname=`/${M}/auth/login`,L.searchParams.set("loginRequestToken",s);const H=window.open(L.href,"Login",`width=600,height=700,left=${N},top=${k},resizable=yes,scrollbars=yes`);x=setInterval(()=>{H?.closed&&(l(cS()),clearInterval(x))},500)}return()=>{x&&clearInterval(x)}},[r,s,l]);const[f,d]=q.useState({}),m=()=>{const x=Object.entries(f).reduce((A,[S,N])=>({...A,[S]:N.value}),{});l(c?oS({loginRequestToken:jc(),formValues:x}):rS({formValues:x}))},h=n(Sx),p=n(s?Tx:Ex),y=n(xx),b=q.useMemo(()=>n(bv)?.split(";").map(x=>x.trim())??[],[n(bv)]);q.useEffect(()=>{b.length&&Object.keys(f).length===0&&d(b.reduce((x,A)=>({...x,[A]:Rx(A,n)}),{}))},[n,b,f]);const C=x=>{x.preventDefault(),m()},E=x=>A=>{d(S=>({...S,[x]:{...S[x],value:A}}))};return v.jsxs("form",{onSubmit:C,className:se(mn.container,y&&mn.containerWithFootnote,"chat__startScreen"),children:[v.jsxs("div",{className:se(mn.body,"chat__startScreen__body"),children:[h&&v.jsx("div",{className:se(mn.intro,"chat__startScreen__intro"),children:v.jsx(Sl,{options:{overrides:{a:_v}},children:h})}),v.jsx("div",{className:se(mn.formFields,"chat__startScreen__fields"),children:Object.values(f).map(({type:x,name:A,label:S,placeholder:N,defaultValue:k,options:M,required:L,multiple:H,min:B,max:X,pattern:W})=>v.jsx("div",{className:se(mn.formField,"chat__startScreen__field"),children:(()=>{switch(x){case"radio":return v.jsxs(v.Fragment,{children:[v.jsx("div",{children:S}),Object.entries(M||{}).map(([ie,ee])=>v.jsx(Ax,{name:A,value:ie,label:ee,defaultChecked:ie===k,required:L,onChange:E(A)},ie))]});case"checkbox":return v.jsx(bx,{name:A,label:S,defaultValue:k,required:L,onChange:E(A)});case"select":return v.jsx(Cx,{name:A,label:S,defaultValue:k,required:L,multiple:H,options:M,onChange:E(A)});default:return v.jsx(_x,{type:x,name:A,label:S,placeholder:N,defaultValue:k,required:L,multiple:H,min:B,max:X,pattern:W,onChange:E(A)})}})()},A))})]}),v.jsxs("div",{className:se(mn.footer,"chat__startScreen__footer"),children:[v.jsxs($c,{type:"submit",className:mn.startChatButton,disabled:!!s,children:[!!s&&v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",className:mn.spinner,children:v.jsx("path",{d:"M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"})}),v.jsx("div",{children:p})]}),y&&v.jsx("div",{className:mn.footnote,children:v.jsx(Sl,{options:{overrides:{a:_v}},children:y})})]})]})},_v=({title:n,href:l,children:r})=>v.jsx("a",{href:l,title:n,target:"_blank",rel:"noopener noreferrer",children:r}),Rx=(n,l)=>{const r=l(`${ka}.${n}.type`)||"text",s=l(`${ka}.${n}.required`)==="true",c=l(`${ka}.${n}.multiple`)==="true",f=l(`${ka}.${n}.placeholder`),d=l(`${ka}.${n}.label`)||"",m=l(`${ka}.${n}.defaultValue`),h=l(`${ka}.${n}.min`),p=l(`${ka}.${n}.max`),y=l(`${ka}.${n}.pattern`),b=Nx(l(`${ka}.${n}.options`));return{name:n,label:d,placeholder:f,value:wx(r,m,b)||"",defaultValue:m,options:b,type:r,required:s,multiple:c,min:h,max:p,pattern:y}},wx=(n,l,r)=>l||n==="select"&&Object.keys(r)[0]||"",Nx=(n="")=>n.split(";").map(l=>l.trim()).reduce((l,r)=>{const[s,c]=r.split(":").map(f=>f.trim());return{...l,[s]:c}},{}),Mx=()=>{const n=Dt(l=>l.intl.locale);q.useEffect(()=>{window.document.documentElement.lang=n},[n])},Xr={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"},Dx=({clientName:n})=>{Mx();const l=wl(),r=Dt(b=>b.intl.messages),s=St(),c=Dt(b=>b.settings.enableStartScreen),f=Dt(b=>b.startScreen.startScreenStatus),d=Dt(b=>b.connection.queryString),m=Dt(b=>b.settings.allowedEmbedOrigins),h=q.useMemo(()=>new URLSearchParams(d||"?").get("cssClassName"),[d]);q.useEffect(()=>{const b=new URLSearchParams(d||""),C=Object.fromEntries(b.entries());l(pS(n,C))},[n,d,l]),q.useEffect(()=>{const b=C=>{if(!C.data?.type||!Object.values(Xr).includes(C.data.type))return;const E=C.origin===window.location.origin,x=C.source===window.parent,A=m===void 0||m.includes(C.origin);if(!(E||x&&A)){console.warn("Rejected postMessage from untrusted origin:",C.origin);return}switch(C.data.type){case Xr.TRIGGER_ACTION:l(C.data.action);break;case Xr.TRIGGER_STORY:l(Qv(C.data.story));break;case Xr.ON_CHAT_WINDOW_OPEN:l({type:"webclient.chatwindow.opened"});break;case Xr.ON_CHAT_WINDOW_CLOSE:l({type:"webclient.chatwindow.closed"});break;case Xr.CHAT_MESSAGE_FROM_GUEST:l(Kv(C.data.text));break;case Xr.RESTART_CHAT:l(Ws());break}};return window.addEventListener("message",b,!1),()=>window.removeEventListener("message",b)},[m,l]),q.useEffect(()=>{const b=s("page.title");b&&document&&(document.title=b)},[r,s]);const p=c===void 0,y=c===!1||f==="HIDDEN";return v.jsx("div",{className:se(uv.chatwindow,y&&uv.chatwindowWithAside,"chat__chatwindow",h),children:p?null:y?v.jsxs(v.Fragment,{children:[v.jsx("header",{children:v.jsx(cv,{chatStarted:!0})}),v.jsx("main",{children:v.jsx(j3,{clientName:n})}),v.jsx("aside",{children:v.jsx(tx,{})})]}):v.jsxs(v.Fragment,{children:[v.jsx("header",{children:v.jsx(cv,{chatStarted:!1})}),v.jsx("main",{children:v.jsx(Ox,{})})]})})},Lx=()=>{const n=om(),l=Fy();return v.jsx("div",{className:se([GA.app,l?"chat__small":"chat__large"]),children:v.jsx(Dx,{clientName:n})})},Py={"page.title":"Bubble Chat Chatbot","message-input-label":"Benutzereingabe","message-input-placeholder":"Nachricht eingeben","message-input.actions.submit.label":"Nachricht senden","message-input.actions.start-audio-recording.label":"Spracheingabe starten","message-input.actions.stop-audio-recording.label":"Spracheingabe stoppen","message-input.actions.submit-audio-recording.label":"Spracheingabe übermitteln","message-input.actions.command.label":"Aktion ausführen","guest-bubble.label":"Ihre Nachricht","bot-bubble.label":"Nachricht des Chatbots","bot-bubble.actions.label":"Nachricht-Aktionen","bot-bubble.reaction.good":"Gefällt mir","bot-bubble.reaction.bad":"Gefällt mir nicht","bot-bubble.reaction.remove":"Markierung entfernen","bot-bubble.reaction.say-more":"Erzähle mir bitte mehr","bot-bubble.reaction.category.WRONG_INFORMATION":"Falsch","bot-bubble.reaction.category.MISSING_INFORMATION":"Unvollständig","bot-bubble.reaction.category.OLD_INFORMATION":"Veraltet","bot-bubble.reaction.category.UNCLEAR":"Unklar","bot-bubble.reaction.category.OFF_TOPIC":"Nicht zur Frage passend","bot-bubble.reaction.comment":"Gedanken mit mir teilen...","bot-bubble.reaction.close":"Schliessen","bot-bubble.copy":"Kopieren","bot-bubble.sources":"Quellenliste","bot-bubble.source.open":"Quelle öffnen","bot-bubble.footnote":"Fussnote","agent-bubble.label":"Nachricht des Live-Agenten","conversation.label":"Chat Verlauf","chatbot.typing":"Chatbot schreibt","export-transcript.email.title":"Chatverlauf per E-Mail versenden","export-transcript.email.description":"Bitte E-Mail-Adresse angeben, an die der Chatverlauf gesendet werden soll.","export-transcript.email.cancel":"Abbrechen","export-transcript.email.send":"Senden","export-transcript.email.placeholder":"E-Mail-Adresse","export-transcript.email.invalid":"Bitte gültige E-Mail-Adresse eingeben.","export-transcript.email.success":"Der Chatverlauf wurde an die hinterlegte E-Mail-Adresse übermittelt.","general-conditions.header":"**Nutzungsbedingungen**","general-conditions.body":`Bitte berücksichtigen Sie die folgenden Punkte:
|
|
64
64
|
|
|
65
65
|
- Der Chatverlauf wird im EU-Raum gespeichert und kann nur von autorisierten Personen eingesehen werden.
|
|
66
66
|
- Geben Sie im Chatfenster keine persönlichen Daten ein (Passwörter, Geburtsdatum usw.).`,"general-conditions.accept-conditions-note":"Mit der Verwendung des Chats erklären Sie sich mit den Nutzungsbedingungen einverstanden.","block-user-input.title":"Bitte auf die Antwort des Chatbots warten.","conversation-rating.call-to-action.title":"Bewerten Sie diesen Chat","conversation-rating.overlay.title":"Wie zufrieden sind Sie mit diesem Chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Feedback bitte hier eingeben (optional)","conversation-rating.overlay.star.very-bad":"Sehr schlecht","conversation-rating.overlay.star.very-good":"Sehr gut","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, das tönt nicht gut. Bitte geben Sie mir doch ein schriftliches Feedback, damit ich dazulernen kann.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, das tönt nicht gut. Bitte geben Sie mir doch ein schriftliches Feedback, damit ich dazulernen kann.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"Durchschnitt ist nicht mein Ziel, was kann ich noch verbessern?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Knapp daneben ist auch vorbei. Was kann ich noch verbessern, um das nächste Mal alle Sterne zu erreichen?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfekt! Dann hoffe ich, dass ich Sie wieder einmal so gut beraten kann.","conversation-rating.overlay.bot-message.submit-feedback":"Vielen Dank für die Rückmeldung. Ich bin bestrebt, mich ständig zu verbessern.","conversation-rating.overlay.action.submit":"Bewertung senden","conversation-rating.overlay.action.back-to-chat":"Zurück zum Chat","conversation-rating.overlay.action.close-chat":"Chat minimieren","conversation-rating.overlay.action.restart-chat":"Chat neu starten","conversation-rating.overlay.action.cancel":"Abbrechen","start-screen.intro":"","start-screen.start-chat":"Chat starten","start-screen.waiting-for-login":"Warte auf Login ...","header.close-chat":"Chat minimieren","header.menu.title":"Menü","header.menu.restart-chat":"Chat neu starten","header.menu.expand-chat-window":"Fenster maximieren","header.menu.download-transcript":"Chatverlauf herunterladen","header.menu.send-transcript":"Chatverlauf versenden","header.menu.export-transcript":"Chatverlauf exportieren","header.menu.rate-conversation":"Chat bewerten","source-infos.close":"Schliessen","source-infos.open-source":"Quelle öffnen","source-infos.error.title":"Fehler","source-infos.error.info":"Oops! Etwas ist schiefgelaufen. Bitte versuche es erneut oder kontaktiere den Support, falls das Problem weiterhin besteht.","source-infos.highlight-loading.title":"Relevante Inhalte werden markiert...","source-infos.highlight-loading.description":"Einen Moment – die Quelle wird analysiert.","commands.show-more.action":"Weitere ...","commands.show-more.tooltip":"Weitere Befehle anzeigen","commands.show-less.action":"Weniger ...","commands.show-less.tooltip":"Weniger Befehle anzeigen"},zx={"page.title":"Bubble Chat Chatbot","message-input-label":"User input","message-input-placeholder":"Enter a message","message-input.actions.submit.label":"Send message","message-input.actions.start-audio-recording.label":"Start voice input","message-input.actions.stop-audio-recording.label":"Stop voice input","message-input.actions.submit-audio-recording.label":"Transmit voice input","guest-bubble.label":"Your message","message-input.actions.command.label":"Perform action","bot-bubble.label":"Message from the chatbot","bot-bubble.actions.label":"Message actions","bot-bubble.reaction.good":"I like","bot-bubble.reaction.bad":"I don't like it","bot-bubble.reaction.remove":"Remove marker","bot-bubble.reaction.say-more":"Please tell us more","bot-bubble.reaction.category.WRONG_INFORMATION":"Wrong","bot-bubble.reaction.category.MISSING_INFORMATION":"Incomplete","bot-bubble.reaction.category.OLD_INFORMATION":"Outdated","bot-bubble.reaction.category.UNCLEAR":"Unclear","bot-bubble.reaction.category.OFF_TOPIC":"Not relevant to the question","bot-bubble.reaction.comment":"Share your thoughts with us...","bot-bubble.reaction.close":"Close","bot-bubble.copy":"Copy","bot-bubble.sources":"Source list","bot-bubble.source.open":"Open source","bot-bubble.footnote":"Footnote","agent-bubble.label":"Message from the live agent","conversation.label":"Chat history","chatbot.typing":"Chatbot is typing","export-transcript.email.title":"Receive chat history","export-transcript.email.description":"Please enter the e-mail address to which the chat history should be sent.","export-transcript.email.cancel":"Cancel","export-transcript.email.send":"Send","export-transcript.email.placeholder":"E-mail address","export-transcript.email.invalid":"Please enter a valid e-mail address.","export-transcript.email.success":"The chat history was sent to the e-mail address provided.","general-conditions.header":"**Terms of use**","general-conditions.body":`Please consider the following points:
|
|
@@ -72,5 +72,5 @@ ${ue.current.stack}
|
|
|
72
72
|
- 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.back-to-chat":"Fermer","conversation-rating.overlay.action.close-chat":"Minimiser le chat","conversation-rating.overlay.action.restart-chat":"Redémarrer le chat","conversation-rating.overlay.action.cancel":"Annuler","start-screen.intro":"","start-screen.start-chat":"Démarrer le chat","start-screen.waiting-for-login":"En attente de connexion ...","header.close-chat":"Minimiser le chat","header.menu.title":"Menu","header.menu.restart-chat":"Redémarrer le chat","header.menu.expand-chat-window":"Agrandir la fenêtre","header.menu.download-transcript":"Télécharger l'historique du chat","header.menu.send-transcript":"Envoyer l'historique du chat","header.menu.export-transcript":"Exporter l'historique du chat","header.menu.rate-conversation":"Évaluer le chat","source-infos.close":"Fermer","source-infos.open-source":"Ouvrir source","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.","source-infos.highlight-loading.title":"Contenus pertinents en surbrillance...","source-infos.highlight-loading.description":"Un instant - la source est analysée","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"},Bx={"page.title":"Bubble Chat Chatbot","message-input-label":"Input dell'utente","message-input-placeholder":"Inserire un messaggio","message-input.actions.submit.label":"Invia messaggio","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","message-input.actions.command.label":"Esegui azione","guest-bubble.label":"Il tuo messaggio","bot-bubble.label":"Messaggio del chatbot","bot-bubble.actions.label":"Azioni del messaggio","bot-bubble.reaction.good":"Mi piace","bot-bubble.reaction.bad":"Non mi piace","bot-bubble.reaction.remove":"Rimuovere il marcatore","bot-bubble.reaction.say-more":"Disci più, per favore","bot-bubble.reaction.category.WRONG_INFORMATION":"Errate","bot-bubble.reaction.category.MISSING_INFORMATION":"Incompleto","bot-bubble.reaction.category.OLD_INFORMATION":"Obsoleta","bot-bubble.reaction.category.UNCLEAR":"Poco chiaro","bot-bubble.reaction.category.OFF_TOPIC":"Non pertinente alla domanda","bot-bubble.reaction.comment":"Condividete con noi i vostri pensieri...","bot-bubble.reaction.close":"Chiudere","bot-bubble.copy":"Copia","bot-bubble.sources":"Elenco delle fonti","bot-bubble.source.open":"Fonte aperta","bot-bubble.footnote":"Nota a piè di pagina","agent-bubble.label":"Messaggio dell'agente dal vivo","conversation.label":"Cronologia chat","chatbot.typing":"Il chatbot sta scrivendo","export-transcript.email.title":"Ricevere la cronologia della chat","export-transcript.email.description":"Inserire l'indirizzo e-mail a cui inviare la cronologia della chat.","export-transcript.email.cancel":"Annulla","export-transcript.email.send":"Invia","export-transcript.email.placeholder":"E-mail","export-transcript.email.invalid":"Inserire un indirizzo e-mail valido.","export-transcript.email.success":"La cronologia della chat è stata inviata all'indirizzo e-mail fornito.","general-conditions.header":"**Condizioni di utilizzo**","general-conditions.body":`Si prega di considerare i seguenti punti:
|
|
73
73
|
|
|
74
74
|
- La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
|
|
75
|
-
- Non inserire dati personali nella finestra di chat (password, data di nascita, ecc.).`,"general-conditions.accept-conditions-note":"Utilizzando la chat si accettano le condizioni d'uso.","block-user-input.title":"Attendere la risposta del chatbot.","conversation-rating.call-to-action.title":"Valuta questa chat","conversation-rating.overlay.title":"Quanto sei soddisfatto di questa chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Inserisci qui il tuo feedback (opzionale)","conversation-rating.overlay.star.very-bad":"Molto male","conversation-rating.overlay.star.very-good":"Molto buono","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"La media non è il mio obiettivo, cosa posso ancora migliorare?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Anche l'assenza è finita. Cosa posso migliorare per ottenere tutte le stelle la prossima volta?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfetto! Allora spero di potervi consigliare ancora una volta bene.","conversation-rating.overlay.bot-message.submit-feedback":"Grazie mille per il feedback. Mi impegno costantemente per migliorare.","conversation-rating.overlay.action.submit":"Invia","conversation-rating.overlay.action.back-to-chat":"Chiudere","conversation-rating.overlay.action.close-chat":"Minimizzare la chat","conversation-rating.overlay.action.restart-chat":"Riavviare la chat","conversation-rating.overlay.action.cancel":"Annulla","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","start-screen.waiting-for-login":"In attesa di login ...","header.close-chat":"Minimizzare la chat","header.menu.title":"Menu","header.menu.restart-chat":"Riavviare la chat","header.menu.expand-chat-window":"Espandere la finestra","header.menu.download-transcript":"Scaricare la trascrizione","header.menu.send-transcript":"Inviare la trascrizione","header.menu.export-transcript":"Esportare la trascrizione","header.menu.rate-conversation":"Valutare la conversazione","source-infos.close":"Chiudere","source-infos.open-source":"Fonte aperta","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","source-infos.highlight-loading.title":"Il contenuto rilevante è evidenziato...","source-infos.highlight-loading.description":"Un momento - la fonte è in fase di analisi","commands.show-more.action":"Di più","commands.show-more.tooltip":"Mostra più comandi","commands.show-less.action":"Meno","commands.show-less.tooltip":"Mostra meno comandi"},jx=["de","en","fr","it"],eb={locale:"de",messages:Py},Ux=(n,l)=>{if(jx.includes(n)){const r=Hx(n),s=$y(l);return{...r,...s}}return l},Hx=n=>{switch(n.toString()){case"en":return zx;case"fr":return kx;case"it":return Bx;default:return Py}},qx=(n=Ix,l)=>{switch(l.type){case Wh:return Object.assign({},n,{connectionState:Kr.CONNECTING});case Qh:return Object.assign({},n,{connectionState:Kr.CONNECTED});case Ph:return Object.assign({},n,{connectionState:Kr.DISCONNECTED});case $h:return Object.assign({},n,{connectionState:Kr.RECONNECTED});case em:return Object.assign({},n,{sessionId:l.sessionId});case fu:return Object.assign({},n,{sessionId:l.payload.sessionId,userId:l.payload.userId});case du:return Object.assign({},n,{sessionId:void 0});default:return n}},Ix={connectionState:Kr.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},Gx=(n=Cv,l)=>{switch(l.type){case gy:return Cv;case fu:return Yr({type:"webclient.chat.started"}),n;case du:return Yr({type:"webclient.chat.ended"}),n;case Uv:return Object.assign({},n,{isBotTyping:!0});case Hv:return Object.assign({},n,{isBotTyping:!1});case Lh:case qv:return Av(n,l.message);case Iv:{Yr(l);const r=Object.assign({},l.message,{_id:l.meta.actionId}),s=n.messages.filter(c=>c._id===l.meta.actionId).length>0;return Object.assign({},n,{isBotTyping:!1,messages:s?n.messages:n.messages.concat([r]),quickReplies:r.quickReplies?r.quickReplies:[]})}case jh:{const r=l.messages,s=r.length?r[r.length-1]:void 0;return Object.assign({},n,{isBotTyping:!1,messages:r,quickReplies:s?.quickReplies||[]})}case Bh:return Yr(l.message),n;case Gv:return Yr(l.event),n;case KA:return Object.assign({},n,{drawerContentUrl:l.payload.parameters.contentUrl});case FA:return Object.assign({},n,{drawerContentUrl:void 0});case JA:return Object.assign({},n,{locale:l.payload.locale});case Jv:return Yr(l),n;case Zv:return Yr(l),{...n,conversationRating:{...n.conversationRating,opener:void 0}};case Hh:{const r=new nu(l.transcription,new kh),s=Object.assign({},r,{_id:jc()});return Av(n,s)}case Vv:{const r=n.messages.map(s=>s._id===l.payload.actionId?Object.assign({},s,l.payload.reaction?{reaction:{type:l.payload.reaction,category:l.payload.category,comment:l.payload.comment}}:{reaction:void 0}):s);return Object.assign({},n,{messages:r})}case qh:{const r={enabled:!0,rating:l.payload.rating};return Object.assign({},n,{conversationRating:r})}case zh:{const r={...n.conversationRating,rating:l.payload};return Object.assign({},n,{conversationRating:r})}case yy:{const r={...n.conversationRating,opener:l.payload.opener,...l.payload.defaultRating?{rating:{value:l.payload.defaultRating,feedback:n.conversationRating.rating?.feedback||""}}:{}};return Object.assign({},n,{conversationRating:r})}case by:{const r={...n.conversationRating,opener:void 0};return Object.assign({},n,{conversationRating:r})}case Gh:return{...n,sourceInfos:{type:"loading",chunkId:l.payload.chunkId}};case Ih:{const{highlighted:r}=l.payload;return n.sourceInfos?.type==="loaded"&&r?{...n,sourceInfos:{...n.sourceInfos,highlighted:!0}}:{...n,sourceInfos:{type:"loading-error"}}}case Fv:{const r=n.sourceInfos?.type,{chunkId:s,knowledgeBaseType:c,title:f,content:d,highlighted:m,url:h}=l.payload,p=n.sourceInfos?.type==="loading"||n.sourceInfos?.type==="loaded"?n.sourceInfos?.chunkId:void 0;return p&&p!==s?n:r==="loading"||r==="loaded"&&m?{...n,sourceInfos:{type:"loaded",chunkId:s,knowledgeBaseType:c,title:f,content:d,highlighted:m,url:h}}:n}case Vh:return{...n,sourceInfos:void 0};case vy:return{...n,showTranscriptMailOverlay:!n.showTranscriptMailOverlay,conversationRating:{...n.conversationRating,opener:void 0}};default:return n}},Av=(n,l)=>{const r=n.messages[n.messages.length-1],s=r?.text===l.text;return r&&r.sender.type===l.sender.type&&s?n:Object.assign({},n,{messages:n.messages.concat([l]),quickReplies:[]})},Yr=n=>{if(Xx()){const l=Vx();window.top?.postMessage(n,l)}else n.type==="webclient.change.url"&&window.open(n.url)},Vx=()=>{try{return document.referrer?new URL(document.referrer).origin:"*"}catch{return"*"}},Xx=()=>typeof window<"u"&&window.self!==window.top,Cv={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},tb=Jh({name:"intl",initialState:eb,reducers:{updateIntl:(n,l)=>{n.locale=l.payload.language,n.messages=l.payload.messages}}}),{updateIntl:Yx}=tb.actions,Kx=tb.reducer,Fx={version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[],allowedOrigins:void 0},nb=Jh({name:"settings",initialState:Fx,reducers:{setSettings(n,l){n.version&&n.version!==l.payload.version?(console.log("version changed, reloading chat window"),window.location.reload()):(n.version=l.payload.version,n.requiresUserAuthentication=l.payload.requiresUserAuthentication,n.enableStartScreen=l.payload.enableStartScreen,n.enableStandaloneView=l.payload.enableStandaloneView,n.enableTranscriptExportEmail=l.payload.enableTranscriptExportEmail,n.enableTranscriptExportPdf=l.payload.enableTranscriptExportPdf,n.enableGeneralConditions=l.payload.enableGeneralConditions,n.enableSpeechSupport=l.payload.enableSpeechSupport,n.commands=l.payload.commands,n.menuItems=l.payload.menuItems||[],n.allowedOrigins=l.payload.allowedOrigins)}}}),{setSettings:Jx}=nb.actions,Zx=nb.reducer,Wx=ty({settings:Zx,chat:Gx,startScreen:uS,connection:qx,intl:Kx}),Qx="bubble-chat",ab="state-last-saved-at",lb="state",Px=n=>{try{if(!t4())return;const l=Sv(n,ab);if(e4(l))return;{const r=Sv(n,lb);if(r===null)return;const s=JSON.parse(r),c=s.connection?.queryString;if(c!==void 0&&!n4(c,window.location.search)){console.log("Ignoring persisted state due to different query string");return}else return s}}catch(l){console.error(l);return}},$x=(n,l)=>{try{const r=JSON.stringify(l);Ev(n,lb,r);const s=new Date().toISOString();Ev(n,ab,s)}catch(r){console.error(r)}},e4=n=>{if(n===null)return!1;const l=new Date(n);return l.setHours(l.getHours()+12),new Date>l},t4=()=>typeof localStorage<"u",Sv=(n,l)=>{const r=rb(n,l);return localStorage.getItem(r)},Ev=(n,l,r)=>{const s=rb(n,l);return localStorage.setItem(s,r)},rb=(n,l)=>`${Qx}-${n}-${l}`,n4=(n,l)=>{const r=new URLSearchParams(n),s=new URLSearchParams(l);r.delete("referrer"),s.delete("referrer");const c=Array.from(r.entries()).sort(),f=Array.from(s.entries()).sort();return c.length!==f.length?!1:c.every(([d,m],h)=>{const[p,y]=f[h];return d===p&&m===y})},Qa=Object.create(null);Qa.open="0";Qa.close="1";Qa.ping="2";Qa.pong="3";Qa.message="4";Qa.upgrade="5";Qa.noop="6";const Mc=Object.create(null);Object.keys(Qa).forEach(n=>{Mc[Qa[n]]=n});const Sh={type:"error",data:"parser error"},ib=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",sb=typeof ArrayBuffer=="function",ob=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,cm=({type:n,data:l},r,s)=>ib&&l instanceof Blob?r?s(l):Tv(l,s):sb&&(l instanceof ArrayBuffer||ob(l))?r?s(l):Tv(new Blob([l]),s):s(Qa[n]+(l||"")),Tv=(n,l)=>{const r=new FileReader;return r.onload=function(){const s=r.result.split(",")[1];l("b"+(s||""))},r.readAsDataURL(n)};function xv(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let $d;function a4(n,l){if(ib&&n.data instanceof Blob)return n.data.arrayBuffer().then(xv).then(l);if(sb&&(n.data instanceof ArrayBuffer||ob(n.data)))return l(xv(n.data));cm(n,!1,r=>{$d||($d=new TextEncoder),l($d.encode(r))})}const Ov="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gs=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Ov.length;n++)Gs[Ov.charCodeAt(n)]=n;const l4=n=>{let l=n.length*.75,r=n.length,s,c=0,f,d,m,h;n[n.length-1]==="="&&(l--,n[n.length-2]==="="&&l--);const p=new ArrayBuffer(l),y=new Uint8Array(p);for(s=0;s<r;s+=4)f=Gs[n.charCodeAt(s)],d=Gs[n.charCodeAt(s+1)],m=Gs[n.charCodeAt(s+2)],h=Gs[n.charCodeAt(s+3)],y[c++]=f<<2|d>>4,y[c++]=(d&15)<<4|m>>2,y[c++]=(m&3)<<6|h&63;return p},r4=typeof ArrayBuffer=="function",um=(n,l)=>{if(typeof n!="string")return{type:"message",data:cb(n,l)};const r=n.charAt(0);return r==="b"?{type:"message",data:i4(n.substring(1),l)}:Mc[r]?n.length>1?{type:Mc[r],data:n.substring(1)}:{type:Mc[r]}:Sh},i4=(n,l)=>{if(r4){const r=l4(n);return cb(r,l)}else return{base64:!0,data:n}},cb=(n,l)=>l==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,ub="",s4=(n,l)=>{const r=n.length,s=new Array(r);let c=0;n.forEach((f,d)=>{cm(f,!1,m=>{s[d]=m,++c===r&&l(s.join(ub))})})},o4=(n,l)=>{const r=n.split(ub),s=[];for(let c=0;c<r.length;c++){const f=um(r[c],l);if(s.push(f),f.type==="error")break}return s};function c4(){return new TransformStream({transform(n,l){a4(n,r=>{const s=r.length;let c;if(s<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,s);else if(s<65536){c=new Uint8Array(3);const f=new DataView(c.buffer);f.setUint8(0,126),f.setUint16(1,s)}else{c=new Uint8Array(9);const f=new DataView(c.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(c[0]|=128),l.enqueue(c),l.enqueue(r)})}})}let eh;function Ec(n){return n.reduce((l,r)=>l+r.length,0)}function Tc(n,l){if(n[0].length===l)return n.shift();const r=new Uint8Array(l);let s=0;for(let c=0;c<l;c++)r[c]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),r}function u4(n,l){eh||(eh=new TextDecoder);const r=[];let s=0,c=-1,f=!1;return new TransformStream({transform(d,m){for(r.push(d);;){if(s===0){if(Ec(r)<1)break;const h=Tc(r,1);f=(h[0]&128)===128,c=h[0]&127,c<126?s=3:c===126?s=1:s=2}else if(s===1){if(Ec(r)<2)break;const h=Tc(r,2);c=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(Ec(r)<8)break;const h=Tc(r,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){m.enqueue(Sh);break}c=y*Math.pow(2,32)+p.getUint32(4),s=3}else{if(Ec(r)<c)break;const h=Tc(r,c);m.enqueue(um(f?h:eh.decode(h),l)),s=0}if(c===0||c>n){m.enqueue(Sh);break}}}})}const fb=4;function sn(n){if(n)return f4(n)}function f4(n){for(var l in sn.prototype)n[l]=sn.prototype[l];return n}sn.prototype.on=sn.prototype.addEventListener=function(n,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(l),this};sn.prototype.once=function(n,l){function r(){this.off(n,r),l.apply(this,arguments)}return r.fn=l,this.on(n,r),this};sn.prototype.off=sn.prototype.removeListener=sn.prototype.removeAllListeners=sn.prototype.removeEventListener=function(n,l){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+n];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,c=0;c<r.length;c++)if(s=r[c],s===l||s.fn===l){r.splice(c,1);break}return r.length===0&&delete this._callbacks["$"+n],this};sn.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var l=new Array(arguments.length-1),r=this._callbacks["$"+n],s=1;s<arguments.length;s++)l[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,c=r.length;s<c;++s)r[s].apply(this,l)}return this};sn.prototype.emitReserved=sn.prototype.emit;sn.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};sn.prototype.hasListeners=function(n){return!!this.listeners(n).length};const bu=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,r)=>r(l,0),Ea=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),d4="arraybuffer";function db(n,...l){return l.reduce((r,s)=>(n.hasOwnProperty(s)&&(r[s]=n[s]),r),{})}const h4=Ea.setTimeout,m4=Ea.clearTimeout;function _u(n,l){l.useNativeTimers?(n.setTimeoutFn=h4.bind(Ea),n.clearTimeoutFn=m4.bind(Ea)):(n.setTimeoutFn=Ea.setTimeout.bind(Ea),n.clearTimeoutFn=Ea.clearTimeout.bind(Ea))}const p4=1.33;function g4(n){return typeof n=="string"?v4(n):Math.ceil((n.byteLength||n.size)*p4)}function v4(n){let l=0,r=0;for(let s=0,c=n.length;s<c;s++)l=n.charCodeAt(s),l<128?r+=1:l<2048?r+=2:l<55296||l>=57344?r+=3:(s++,r+=4);return r}function hb(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y4(n){let l="";for(let r in n)n.hasOwnProperty(r)&&(l.length&&(l+="&"),l+=encodeURIComponent(r)+"="+encodeURIComponent(n[r]));return l}function b4(n){let l={},r=n.split("&");for(let s=0,c=r.length;s<c;s++){let f=r[s].split("=");l[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return l}class _4 extends Error{constructor(l,r,s){super(l),this.description=r,this.context=s,this.type="TransportError"}}class fm extends sn{constructor(l){super(),this.writable=!1,_u(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,r,s){return super.emitReserved("error",new _4(l,r,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"&&this.write(l)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const r=um(l,this.socket.binaryType);this.onPacket(r)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,r={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const r=y4(l);return r.length?"?"+r:""}}class A4 extends fm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(l){this.readyState="pausing";const r=()=>{this.readyState="paused",l()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||r()})),this.writable||(s++,this.once("drain",function(){--s||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(l){const r=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)};o4(l,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const l=()=>{this.write([{type:"close"}])};this.readyState==="open"?l():this.once("open",l)}write(l){this.writable=!1,s4(l,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const l=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=hb()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(l,r)}}let mb=!1;try{mb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const C4=mb;function S4(){}class E4 extends A4{constructor(l){if(super(l),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&l.hostname!==location.hostname||s!==l.port}}doWrite(l,r){const s=this.request({method:"POST",data:l});s.on("success",r),s.on("error",(c,f)=>{this.onError("xhr post error",c,f)})}doPoll(){const l=this.request();l.on("data",this.onData.bind(this)),l.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=l}}class Za extends sn{constructor(l,r,s){super(),this.createRequest=l,_u(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var l;const r=db(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&s.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(l=this._opts.cookieJar)===null||l===void 0||l.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var c;s.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.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(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=Za.requestsCount++,Za.requests[this._index]=this)}_onError(l){this.emitReserved("error",l,this._xhr),this._cleanup(!0)}_cleanup(l){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=S4,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Za.requests[this._index],this._xhr=null}}_onLoad(){const l=this._xhr.responseText;l!==null&&(this.emitReserved("data",l),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Za.requestsCount=0;Za.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rv);else if(typeof addEventListener=="function"){const n="onpagehide"in Ea?"pagehide":"unload";addEventListener(n,Rv,!1)}}function Rv(){for(let n in Za.requests)Za.requests.hasOwnProperty(n)&&Za.requests[n].abort()}const T4=(function(){const n=pb({xdomain:!1});return n&&n.responseType!==null})();class x4 extends E4{constructor(l){super(l);const r=l&&l.forceBase64;this.supportsBinary=T4&&!r}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new Za(pb,this.uri(),l)}}function pb(n){const l=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||C4))return new XMLHttpRequest}catch{}if(!l)try{return new Ea[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const gb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class O4 extends fm{get name(){return"websocket"}doOpen(){const l=this.uri(),r=this.opts.protocols,s=gb?{}:db(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(l,r,s)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=l=>this.onClose({description:"websocket connection closed",context:l}),this.ws.onmessage=l=>this.onData(l.data),this.ws.onerror=l=>this.onError("websocket error",l)}write(l){this.writable=!1;for(let r=0;r<l.length;r++){const s=l[r],c=r===l.length-1;cm(s,this.supportsBinary,f=>{try{this.doWrite(s,f)}catch{}c&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const l=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=hb()),this.supportsBinary||(r.b64=1),this.createUri(l,r)}}const th=Ea.WebSocket||Ea.MozWebSocket;class R4 extends O4{createSocket(l,r,s){return gb?new th(l,r,s):r?new th(l,r):new th(l)}doWrite(l,r){this.ws.send(r)}}class w4 extends fm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(l){return this.emitReserved("error",l)}this._transport.closed.then(()=>{this.onClose()}).catch(l=>{this.onError("webtransport error",l)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(l=>{const r=u4(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=l.readable.pipeThrough(r).getReader(),c=c4();c.readable.pipeTo(l.writable),this._writer=c.writable.getWriter();const f=()=>{s.read().then(({done:m,value:h})=>{m||(this.onPacket(h),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(l){this.writable=!1;for(let r=0;r<l.length;r++){const s=l[r],c=r===l.length-1;this._writer.write(s).then(()=>{c&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const N4={websocket:R4,webtransport:w4,polling:x4},M4=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,D4=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Eh(n){if(n.length>8e3)throw"URI too long";const l=n,r=n.indexOf("["),s=n.indexOf("]");r!=-1&&s!=-1&&(n=n.substring(0,r)+n.substring(r,s).replace(/:/g,";")+n.substring(s,n.length));let c=M4.exec(n||""),f={},d=14;for(;d--;)f[D4[d]]=c[d]||"";return r!=-1&&s!=-1&&(f.source=l,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=L4(f,f.path),f.queryKey=z4(f,f.query),f}function L4(n,l){const r=/\/{2,9}/g,s=l.replace(r,"/").split("/");return(l.slice(0,1)=="/"||l.length===0)&&s.splice(0,1),l.slice(-1)=="/"&&s.splice(s.length-1,1),s}function z4(n,l){const r={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,c,f){c&&(r[c]=f)}),r}const Th=typeof addEventListener=="function"&&typeof removeEventListener=="function",Dc=[];Th&&addEventListener("offline",()=>{Dc.forEach(n=>n())},!1);class ur extends sn{constructor(l,r){if(super(),this.binaryType=d4,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(r=l,l=null),l){const s=Eh(l);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=Eh(r.host).host);_u(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const c=s.prototype.name;this.transports.push(c),this._transportsByName[c]=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},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=b4(this.opts.query)),Th&&(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"})},Dc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const r=Object.assign({},this.opts.query);r.EIO=fb,r.transport=l,this.id&&(r.sid=this.id);const s=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[l]);return new this._transportsByName[l](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const l=this.opts.rememberUpgrade&&ur.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(l);r.open(),this.setTransport(r)}setTransport(l){this.transport&&this.transport.removeAllListeners(),this.transport=l,l.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",ur.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(l){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",l),this.emitReserved("heartbeat"),l.type){case"open":this.onHandshake(JSON.parse(l.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=l.data,this._onError(r);break;case"message":this.emitReserved("data",l.data),this.emitReserved("message",l.data);break}}onHandshake(l){this.emitReserved("handshake",l),this.id=l.sid,this.transport.query.sid=l.sid,this._pingInterval=l.pingInterval,this._pingTimeout=l.pingTimeout,this._maxPayload=l.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const l=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+l,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},l),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 l=this._getWritablePackets();this.transport.send(l),this._prevBufferLen=l.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let s=0;s<this.writeBuffer.length;s++){const c=this.writeBuffer[s].data;if(c&&(r+=g4(c)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const l=Date.now()>this._pingTimeoutTime;return l&&(this._pingTimeoutTime=0,bu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),l}write(l,r,s){return this._sendPacket("message",l,r,s),this}send(l,r,s){return this._sendPacket("message",l,r,s),this}_sendPacket(l,r,s,c){if(typeof r=="function"&&(c=r,r=void 0),typeof s=="function"&&(c=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const f={type:l,data:r,options:s};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),c&&this.once("flush",c),this.flush()}close(){const l=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),l()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():l()}):this.upgrading?s():l()),this}_onError(l){if(ur.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",l),this._onClose("transport error",l)}_onClose(l,r){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(),Th&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Dc.indexOf(this._offlineEventListener);s!==-1&&Dc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,r),this.writeBuffer=[],this._prevBufferLen=0}}}ur.protocol=fb;class k4 extends ur{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let l=0;l<this._upgrades.length;l++)this._probe(this._upgrades[l])}_probe(l){let r=this.createTransport(l),s=!1;ur.priorWebsocketSuccess=!1;const c=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ur.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(y(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const C=new Error("probe error");C.transport=r.name,this.emitReserved("upgradeError",C)}}))};function f(){s||(s=!0,y(),r.close(),r=null)}const d=b=>{const C=new Error("probe error: "+b);C.transport=r.name,f(),this.emitReserved("upgradeError",C)};function m(){d("transport closed")}function h(){d("socket closed")}function p(b){r&&b.name!==r.name&&f()}const y=()=>{r.removeListener("open",c),r.removeListener("error",d),r.removeListener("close",m),this.off("close",h),this.off("upgrading",p)};r.once("open",c),r.once("error",d),r.once("close",m),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&l!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(l){this._upgrades=this._filterUpgrades(l.upgrades),super.onHandshake(l)}_filterUpgrades(l){const r=[];for(let s=0;s<l.length;s++)~this.transports.indexOf(l[s])&&r.push(l[s]);return r}}let B4=class extends k4{constructor(l,r={}){const s=typeof l=="object"?l:r;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(c=>N4[c]).filter(c=>!!c)),super(l,s)}};function j4(n,l="",r){let s=n;r=r||typeof location<"u"&&location,n==null&&(n=r.protocol+"//"+r.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=r.protocol+n:n=r.host+n),/^(https?|wss?):\/\//.test(n)||(typeof r<"u"?n=r.protocol+"//"+n:n="https://"+n),s=Eh(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const f=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+f+":"+s.port+l,s.href=s.protocol+"://"+f+(r&&r.port===s.port?"":":"+s.port),s}const U4=typeof ArrayBuffer=="function",H4=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,vb=Object.prototype.toString,q4=typeof Blob=="function"||typeof Blob<"u"&&vb.call(Blob)==="[object BlobConstructor]",I4=typeof File=="function"||typeof File<"u"&&vb.call(File)==="[object FileConstructor]";function dm(n){return U4&&(n instanceof ArrayBuffer||H4(n))||q4&&n instanceof Blob||I4&&n instanceof File}function Lc(n,l){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let r=0,s=n.length;r<s;r++)if(Lc(n[r]))return!0;return!1}if(dm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Lc(n.toJSON(),!0);for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&Lc(n[r]))return!0;return!1}function G4(n){const l=[],r=n.data,s=n;return s.data=xh(r,l),s.attachments=l.length,{packet:s,buffers:l}}function xh(n,l){if(!n)return n;if(dm(n)){const r={_placeholder:!0,num:l.length};return l.push(n),r}else if(Array.isArray(n)){const r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=xh(n[s],l);return r}else if(typeof n=="object"&&!(n instanceof Date)){const r={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=xh(n[s],l));return r}return n}function V4(n,l){return n.data=Oh(n.data,l),delete n.attachments,n}function Oh(n,l){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<l.length)return l[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=Oh(n[r],l);else if(typeof n=="object")for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=Oh(n[r],l));return n}const X4=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var We;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(We||(We={}));class Y4{constructor(l){this.replacer=l}encode(l){return(l.type===We.EVENT||l.type===We.ACK)&&Lc(l)?this.encodeAsBinary({type:l.type===We.EVENT?We.BINARY_EVENT:We.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let r=""+l.type;return(l.type===We.BINARY_EVENT||l.type===We.BINARY_ACK)&&(r+=l.attachments+"-"),l.nsp&&l.nsp!=="/"&&(r+=l.nsp+","),l.id!=null&&(r+=l.id),l.data!=null&&(r+=JSON.stringify(l.data,this.replacer)),r}encodeAsBinary(l){const r=G4(l),s=this.encodeAsString(r.packet),c=r.buffers;return c.unshift(s),c}}class hm extends sn{constructor(l){super(),this.reviver=l}add(l){let r;if(typeof l=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(l);const s=r.type===We.BINARY_EVENT;s||r.type===We.BINARY_ACK?(r.type=s?We.EVENT:We.ACK,this.reconstructor=new K4(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(dm(l)||l.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(l),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+l)}decodeString(l){let r=0;const s={type:Number(l.charAt(0))};if(We[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===We.BINARY_EVENT||s.type===We.BINARY_ACK){const f=r+1;for(;l.charAt(++r)!=="-"&&r!=l.length;);const d=l.substring(f,r);if(d!=Number(d)||l.charAt(r)!=="-")throw new Error("Illegal attachments");s.attachments=Number(d)}if(l.charAt(r+1)==="/"){const f=r+1;for(;++r&&!(l.charAt(r)===","||r===l.length););s.nsp=l.substring(f,r)}else s.nsp="/";const c=l.charAt(r+1);if(c!==""&&Number(c)==c){const f=r+1;for(;++r;){const d=l.charAt(r);if(d==null||Number(d)!=d){--r;break}if(r===l.length)break}s.id=Number(l.substring(f,r+1))}if(l.charAt(++r)){const f=this.tryParse(l.substr(r));if(hm.isPayloadValid(s.type,f))s.data=f;else throw new Error("invalid payload")}return s}tryParse(l){try{return JSON.parse(l,this.reviver)}catch{return!1}}static isPayloadValid(l,r){switch(l){case We.CONNECT:return wv(r);case We.DISCONNECT:return r===void 0;case We.CONNECT_ERROR:return typeof r=="string"||wv(r);case We.EVENT:case We.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&X4.indexOf(r[0])===-1);case We.ACK:case We.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class K4{constructor(l){this.packet=l,this.buffers=[],this.reconPack=l}takeBinaryData(l){if(this.buffers.push(l),this.buffers.length===this.reconPack.attachments){const r=V4(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function wv(n){return Object.prototype.toString.call(n)==="[object Object]"}const F4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:hm,Encoder:Y4,get PacketType(){return We}},Symbol.toStringTag,{value:"Module"}));function Ba(n,l,r){return n.on(l,r),function(){n.off(l,r)}}const J4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class yb extends sn{constructor(l,r,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=l,this.nsp=r,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 l=this.io;this.subs=[Ba(l,"open",this.onopen.bind(this)),Ba(l,"packet",this.onpacket.bind(this)),Ba(l,"error",this.onerror.bind(this)),Ba(l,"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(...l){return l.unshift("message"),this.emit.apply(this,l),this}emit(l,...r){var s,c,f;if(J4.hasOwnProperty(l))throw new Error('"'+l.toString()+'" is a reserved event name');if(r.unshift(l),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const d={type:We.EVENT,data:r};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const y=this.ids++,b=r.pop();this._registerAckCallback(y,b),d.id=y}const m=(c=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||c===void 0?void 0:c.writable,h=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(h?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(l,r){var s;const c=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(c===void 0){this.acks[l]=r;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===l&&this.sendBuffer.splice(m,1);r.call(this,new Error("operation has timed out"))},c),d=(...m)=>{this.io.clearTimeoutFn(f),r.apply(this,m)};d.withError=!0,this.acks[l]=d}emitWithAck(l,...r){return new Promise((s,c)=>{const f=(d,m)=>d?c(d):s(m);f.withError=!0,r.push(f),this.emit(l,...r)})}_addToQueue(l){let r;typeof l[l.length-1]=="function"&&(r=l.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:l,flags:Object.assign({fromQueue:!0},this.flags)};l.push((c,...f)=>(this._queue[0],c!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(c)):(this._queue.shift(),r&&r(null,...f)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(l=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!l||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(l){l.nsp=this.nsp,this.io._packet(l)}onopen(){typeof this.auth=="function"?this.auth(l=>{this._sendConnectPacket(l)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(l){this.packet({type:We.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},l):l})}onerror(l){this.connected||this.emitReserved("connect_error",l)}onclose(l,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",l,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(l=>{if(!this.sendBuffer.some(s=>String(s.id)===l)){const s=this.acks[l];delete this.acks[l],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(l){if(l.nsp===this.nsp)switch(l.type){case We.CONNECT:l.data&&l.data.sid?this.onconnect(l.data.sid,l.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 We.EVENT:case We.BINARY_EVENT:this.onevent(l);break;case We.ACK:case We.BINARY_ACK:this.onack(l);break;case We.DISCONNECT:this.ondisconnect();break;case We.CONNECT_ERROR:this.destroy();const s=new Error(l.data.message);s.data=l.data.data,this.emitReserved("connect_error",s);break}}onevent(l){const r=l.data||[];l.id!=null&&r.push(this.ack(l.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(l){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.apply(this,l)}super.emit.apply(this,l),this._pid&&l.length&&typeof l[l.length-1]=="string"&&(this._lastOffset=l[l.length-1])}ack(l){const r=this;let s=!1;return function(...c){s||(s=!0,r.packet({type:We.ACK,id:l,data:c}))}}onack(l){const r=this.acks[l.id];typeof r=="function"&&(delete this.acks[l.id],r.withError&&l.data.unshift(null),r.apply(this,l.data))}onconnect(l,r){this.id=l,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(l=>this.emitEvent(l)),this.receiveBuffer=[],this.sendBuffer.forEach(l=>{this.notifyOutgoingListeners(l),this.packet(l)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(l=>l()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:We.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(l){return this.flags.compress=l,this}get volatile(){return this.flags.volatile=!0,this}timeout(l){return this.flags.timeout=l,this}onAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(l),this}prependAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(l),this}offAny(l){if(!this._anyListeners)return this;if(l){const r=this._anyListeners;for(let s=0;s<r.length;s++)if(l===r[s])return r.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(l),this}prependAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(l),this}offAnyOutgoing(l){if(!this._anyOutgoingListeners)return this;if(l){const r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(l===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(l){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,l.data)}}}function Ui(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}Ui.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var l=Math.random(),r=Math.floor(l*this.jitter*n);n=(Math.floor(l*10)&1)==0?n-r:n+r}return Math.min(n,this.max)|0};Ui.prototype.reset=function(){this.attempts=0};Ui.prototype.setMin=function(n){this.ms=n};Ui.prototype.setMax=function(n){this.max=n};Ui.prototype.setJitter=function(n){this.jitter=n};class Rh extends sn{constructor(l,r){var s;super(),this.nsps={},this.subs=[],l&&typeof l=="object"&&(r=l,l=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,_u(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Ui({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=l;const c=r.parser||F4;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(l){return arguments.length?(this._reconnection=!!l,l||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(l){return l===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=l,this)}reconnectionDelay(l){var r;return l===void 0?this._reconnectionDelay:(this._reconnectionDelay=l,(r=this.backoff)===null||r===void 0||r.setMin(l),this)}randomizationFactor(l){var r;return l===void 0?this._randomizationFactor:(this._randomizationFactor=l,(r=this.backoff)===null||r===void 0||r.setJitter(l),this)}reconnectionDelayMax(l){var r;return l===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=l,(r=this.backoff)===null||r===void 0||r.setMax(l),this)}timeout(l){return arguments.length?(this._timeout=l,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(l){if(~this._readyState.indexOf("open"))return this;this.engine=new B4(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const c=Ba(r,"open",function(){s.onopen(),l&&l()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),l?l(m):this.maybeReconnectOnOpen()},d=Ba(r,"error",f);if(this._timeout!==!1){const m=this._timeout,h=this.setTimeoutFn(()=>{c(),f(new Error("timeout")),r.close()},m);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(c),this.subs.push(d),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(Ba(l,"ping",this.onping.bind(this)),Ba(l,"data",this.ondata.bind(this)),Ba(l,"error",this.onerror.bind(this)),Ba(l,"close",this.onclose.bind(this)),Ba(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(l){try{this.decoder.add(l)}catch(r){this.onclose("parse error",r)}}ondecoded(l){bu(()=>{this.emitReserved("packet",l)},this.setTimeoutFn)}onerror(l){this.emitReserved("error",l)}socket(l,r){let s=this.nsps[l];return s?this._autoConnect&&!s.active&&s.connect():(s=new yb(this,l,r),this.nsps[l]=s),s}_destroy(l){const r=Object.keys(this.nsps);for(const s of r)if(this.nsps[s].active)return;this._close()}_packet(l){const r=this.encoder.encode(l);for(let s=0;s<r.length;s++)this.engine.write(r[s],l.options)}cleanup(){this.subs.forEach(l=>l()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(l,r){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",l,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const l=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{l.skipReconnect||(this.emitReserved("reconnect_attempt",l.backoff.attempts),!l.skipReconnect&&l.open(c=>{c?(l._reconnecting=!1,l.reconnect(),this.emitReserved("reconnect_error",c)):l.onreconnect()}))},r);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const l=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",l)}}const Hs={};function zc(n,l){typeof n=="object"&&(l=n,n=void 0),l=l||{};const r=j4(n,l.path||"/socket.io"),s=r.source,c=r.id,f=r.path,d=Hs[c]&&f in Hs[c].nsps,m=l.forceNew||l["force new connection"]||l.multiplex===!1||d;let h;return m?h=new Rh(s,l):(Hs[c]||(Hs[c]=new Rh(s,l)),h=Hs[c]),r.query&&!l.query&&(l.query=r.queryKey),h.socket(r.path,l)}Object.assign(zc,{Manager:Rh,Socket:yb,io:zc,connect:zc});const Z4=[Iv,Gv,Uv,Hv,XA,...mS,...nC,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],W4=({dispatch:n,getState:l})=>r=>{let s=null;return c=>{const f=r(c);if(c.type===Zh){s?.disconnect(),n(vS());const m={path:`/website-messenger/${c.clientName}/socket.io`,query:c.querystrings};s=zc(m),s.on("action",n),s.on("connect",()=>n(yS())),s.on("disconnect",()=>n(bS())),s.on("reconnect",()=>n(_S())),s.on("set-translations",(h,p)=>{n(Yx({language:h,messages:Ux(h,p)}))}),s.on("set-settings",h=>{n(Jx(h))}),s.on("enable-conversation-rating",h=>n(sC(h))),s.on("speech-transcription",h=>n(lC(h))),s.on("restore-client-state",h=>{n(gS(h.sessionId)),n(cC(h.messages))}),s.on("expand-window",({devices:h,initial:p=!1})=>{n({type:Jv,devices:h,initial:p})}),s.on("restart-chat",()=>{n(Ws())}),s.on("login-success",h=>{n(iS({loginToken:h.loginToken}))})}else if(c.type==="start-screen/requestLogin")s?.emit("login-requested",c.payload);else if(c.type===fu)s?.emit("start-chat",c.payload);else if(c.type===du)s?.emit("terminate-session",c.payload);else if(c.type===tC)s?.emit("get-started",JSON.stringify(c));else if(c.type===Uh)s?.emit("audio-message",c.buffer);else if(c.type===zh)s?.emit("conversation-rating",c.payload);else if(c.type===Wv){const{connection:{sessionId:d}}=l();if(d){const m=au(),h=new URL(`/${encodeURIComponent(m)}/transcript-pdf/${encodeURIComponent(d)}`,window.location.origin);window.location.href=h.toString()}}else Z4.indexOf(c.type)===-1&&c.meta===void 0&&s&&s.emit("action",JSON.stringify(c));return f}},bb=au(),Q4={...Px(bb),intl:eb},wh=KC({middleware:n=>n().concat(W4),reducer:Wx,preloadedState:Q4});wh.subscribe(s6(()=>{const n=wh.getState();$x(bb,{connection:n.connection,startScreen:n.startScreen})},1e3));const P4=document.getElementById("root"),$4=k2.createRoot(P4);$4.render(v.jsx(zA,{store:wh,children:v.jsx(Lx,{})}));
|
|
76
|
-
//# sourceMappingURL=index-
|
|
75
|
+
- Non inserire dati personali nella finestra di chat (password, data di nascita, ecc.).`,"general-conditions.accept-conditions-note":"Utilizzando la chat si accettano le condizioni d'uso.","block-user-input.title":"Attendere la risposta del chatbot.","conversation-rating.call-to-action.title":"Valuta questa chat","conversation-rating.overlay.title":"Quanto sei soddisfatto di questa chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Inserisci qui il tuo feedback (opzionale)","conversation-rating.overlay.star.very-bad":"Molto male","conversation-rating.overlay.star.very-good":"Molto buono","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"La media non è il mio obiettivo, cosa posso ancora migliorare?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Anche l'assenza è finita. Cosa posso migliorare per ottenere tutte le stelle la prossima volta?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfetto! Allora spero di potervi consigliare ancora una volta bene.","conversation-rating.overlay.bot-message.submit-feedback":"Grazie mille per il feedback. Mi impegno costantemente per migliorare.","conversation-rating.overlay.action.submit":"Invia","conversation-rating.overlay.action.back-to-chat":"Chiudere","conversation-rating.overlay.action.close-chat":"Minimizzare la chat","conversation-rating.overlay.action.restart-chat":"Riavviare la chat","conversation-rating.overlay.action.cancel":"Annulla","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","start-screen.waiting-for-login":"In attesa di login ...","header.close-chat":"Minimizzare la chat","header.menu.title":"Menu","header.menu.restart-chat":"Riavviare la chat","header.menu.expand-chat-window":"Espandere la finestra","header.menu.download-transcript":"Scaricare la trascrizione","header.menu.send-transcript":"Inviare la trascrizione","header.menu.export-transcript":"Esportare la trascrizione","header.menu.rate-conversation":"Valutare la conversazione","source-infos.close":"Chiudere","source-infos.open-source":"Fonte aperta","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","source-infos.highlight-loading.title":"Il contenuto rilevante è evidenziato...","source-infos.highlight-loading.description":"Un momento - la fonte è in fase di analisi","commands.show-more.action":"Di più","commands.show-more.tooltip":"Mostra più comandi","commands.show-less.action":"Meno","commands.show-less.tooltip":"Mostra meno comandi"},jx=["de","en","fr","it"],eb={locale:"de",messages:Py},Ux=(n,l)=>{if(jx.includes(n)){const r=Hx(n),s=$y(l);return{...r,...s}}return l},Hx=n=>{switch(n.toString()){case"en":return zx;case"fr":return kx;case"it":return Bx;default:return Py}},qx=(n=Ix,l)=>{switch(l.type){case Wh:return Object.assign({},n,{connectionState:Kr.CONNECTING});case Qh:return Object.assign({},n,{connectionState:Kr.CONNECTED});case Ph:return Object.assign({},n,{connectionState:Kr.DISCONNECTED});case $h:return Object.assign({},n,{connectionState:Kr.RECONNECTED});case em:return Object.assign({},n,{sessionId:l.sessionId});case fu:return Object.assign({},n,{sessionId:l.payload.sessionId,userId:l.payload.userId});case du:return Object.assign({},n,{sessionId:void 0});default:return n}},Ix={connectionState:Kr.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},Gx=(n=Cv,l)=>{switch(l.type){case gy:return Cv;case fu:return Yr({type:"webclient.chat.started"}),n;case du:return Yr({type:"webclient.chat.ended"}),n;case Uv:return Object.assign({},n,{isBotTyping:!0});case Hv:return Object.assign({},n,{isBotTyping:!1});case Lh:case qv:return Av(n,l.message);case Iv:{Yr(l);const r=Object.assign({},l.message,{_id:l.meta.actionId}),s=n.messages.filter(c=>c._id===l.meta.actionId).length>0;return Object.assign({},n,{isBotTyping:!1,messages:s?n.messages:n.messages.concat([r]),quickReplies:r.quickReplies?r.quickReplies:[]})}case jh:{const r=l.messages,s=r.length?r[r.length-1]:void 0;return Object.assign({},n,{isBotTyping:!1,messages:r,quickReplies:s?.quickReplies||[]})}case Bh:return Yr(l.message),n;case Gv:return Yr(l.event),n;case KA:return Object.assign({},n,{drawerContentUrl:l.payload.parameters.contentUrl});case FA:return Object.assign({},n,{drawerContentUrl:void 0});case JA:return Object.assign({},n,{locale:l.payload.locale});case Jv:return Yr(l),n;case Zv:return Yr(l),{...n,conversationRating:{...n.conversationRating,opener:void 0}};case Hh:{const r=new nu(l.transcription,new kh),s=Object.assign({},r,{_id:jc()});return Av(n,s)}case Vv:{const r=n.messages.map(s=>s._id===l.payload.actionId?Object.assign({},s,l.payload.reaction?{reaction:{type:l.payload.reaction,category:l.payload.category,comment:l.payload.comment}}:{reaction:void 0}):s);return Object.assign({},n,{messages:r})}case qh:{const r={enabled:!0,rating:l.payload.rating};return Object.assign({},n,{conversationRating:r})}case zh:{const r={...n.conversationRating,rating:l.payload};return Object.assign({},n,{conversationRating:r})}case yy:{const r={...n.conversationRating,opener:l.payload.opener,...l.payload.defaultRating?{rating:{value:l.payload.defaultRating,feedback:n.conversationRating.rating?.feedback||""}}:{}};return Object.assign({},n,{conversationRating:r})}case by:{const r={...n.conversationRating,opener:void 0};return Object.assign({},n,{conversationRating:r})}case Gh:return{...n,sourceInfos:{type:"loading",chunkId:l.payload.chunkId}};case Ih:{const{highlighted:r}=l.payload;return n.sourceInfos?.type==="loaded"&&r?{...n,sourceInfos:{...n.sourceInfos,highlighted:!0}}:{...n,sourceInfos:{type:"loading-error"}}}case Fv:{const r=n.sourceInfos?.type,{chunkId:s,knowledgeBaseType:c,title:f,content:d,highlighted:m,url:h}=l.payload,p=n.sourceInfos?.type==="loading"||n.sourceInfos?.type==="loaded"?n.sourceInfos?.chunkId:void 0;return p&&p!==s?n:r==="loading"||r==="loaded"&&m?{...n,sourceInfos:{type:"loaded",chunkId:s,knowledgeBaseType:c,title:f,content:d,highlighted:m,url:h}}:n}case Vh:return{...n,sourceInfos:void 0};case vy:return{...n,showTranscriptMailOverlay:!n.showTranscriptMailOverlay,conversationRating:{...n.conversationRating,opener:void 0}};default:return n}},Av=(n,l)=>{const r=n.messages[n.messages.length-1],s=r?.text===l.text;return r&&r.sender.type===l.sender.type&&s?n:Object.assign({},n,{messages:n.messages.concat([l]),quickReplies:[]})},Yr=n=>{if(Xx()){const l=Vx();window.top?.postMessage(n,l)}else n.type==="webclient.change.url"&&window.open(n.url)},Vx=()=>{try{return document.referrer?new URL(document.referrer).origin:"*"}catch{return"*"}},Xx=()=>typeof window<"u"&&window.self!==window.top,Cv={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},tb=Jh({name:"intl",initialState:eb,reducers:{updateIntl:(n,l)=>{n.locale=l.payload.language,n.messages=l.payload.messages}}}),{updateIntl:Yx}=tb.actions,Kx=tb.reducer,Fx={version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[],allowedEmbedOrigins:void 0},nb=Jh({name:"settings",initialState:Fx,reducers:{setSettings(n,l){n.version&&n.version!==l.payload.version?(console.log("version changed, reloading chat window"),window.location.reload()):(n.version=l.payload.version,n.requiresUserAuthentication=l.payload.requiresUserAuthentication,n.enableStartScreen=l.payload.enableStartScreen,n.enableStandaloneView=l.payload.enableStandaloneView,n.enableTranscriptExportEmail=l.payload.enableTranscriptExportEmail,n.enableTranscriptExportPdf=l.payload.enableTranscriptExportPdf,n.enableGeneralConditions=l.payload.enableGeneralConditions,n.enableSpeechSupport=l.payload.enableSpeechSupport,n.commands=l.payload.commands,n.menuItems=l.payload.menuItems||[],n.allowedEmbedOrigins=l.payload.allowedEmbedOrigins)}}}),{setSettings:Jx}=nb.actions,Zx=nb.reducer,Wx=ty({settings:Zx,chat:Gx,startScreen:uS,connection:qx,intl:Kx}),Qx="bubble-chat",ab="state-last-saved-at",lb="state",Px=n=>{try{if(!t4())return;const l=Sv(n,ab);if(e4(l))return;{const r=Sv(n,lb);if(r===null)return;const s=JSON.parse(r),c=s.connection?.queryString;if(c!==void 0&&!n4(c,window.location.search)){console.log("Ignoring persisted state due to different query string");return}else return s}}catch(l){console.error(l);return}},$x=(n,l)=>{try{const r=JSON.stringify(l);Ev(n,lb,r);const s=new Date().toISOString();Ev(n,ab,s)}catch(r){console.error(r)}},e4=n=>{if(n===null)return!1;const l=new Date(n);return l.setHours(l.getHours()+12),new Date>l},t4=()=>typeof localStorage<"u",Sv=(n,l)=>{const r=rb(n,l);return localStorage.getItem(r)},Ev=(n,l,r)=>{const s=rb(n,l);return localStorage.setItem(s,r)},rb=(n,l)=>`${Qx}-${n}-${l}`,n4=(n,l)=>{const r=new URLSearchParams(n),s=new URLSearchParams(l);r.delete("referrer"),s.delete("referrer");const c=Array.from(r.entries()).sort(),f=Array.from(s.entries()).sort();return c.length!==f.length?!1:c.every(([d,m],h)=>{const[p,y]=f[h];return d===p&&m===y})},Qa=Object.create(null);Qa.open="0";Qa.close="1";Qa.ping="2";Qa.pong="3";Qa.message="4";Qa.upgrade="5";Qa.noop="6";const Mc=Object.create(null);Object.keys(Qa).forEach(n=>{Mc[Qa[n]]=n});const Sh={type:"error",data:"parser error"},ib=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",sb=typeof ArrayBuffer=="function",ob=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,cm=({type:n,data:l},r,s)=>ib&&l instanceof Blob?r?s(l):Tv(l,s):sb&&(l instanceof ArrayBuffer||ob(l))?r?s(l):Tv(new Blob([l]),s):s(Qa[n]+(l||"")),Tv=(n,l)=>{const r=new FileReader;return r.onload=function(){const s=r.result.split(",")[1];l("b"+(s||""))},r.readAsDataURL(n)};function xv(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let $d;function a4(n,l){if(ib&&n.data instanceof Blob)return n.data.arrayBuffer().then(xv).then(l);if(sb&&(n.data instanceof ArrayBuffer||ob(n.data)))return l(xv(n.data));cm(n,!1,r=>{$d||($d=new TextEncoder),l($d.encode(r))})}const Ov="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gs=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Ov.length;n++)Gs[Ov.charCodeAt(n)]=n;const l4=n=>{let l=n.length*.75,r=n.length,s,c=0,f,d,m,h;n[n.length-1]==="="&&(l--,n[n.length-2]==="="&&l--);const p=new ArrayBuffer(l),y=new Uint8Array(p);for(s=0;s<r;s+=4)f=Gs[n.charCodeAt(s)],d=Gs[n.charCodeAt(s+1)],m=Gs[n.charCodeAt(s+2)],h=Gs[n.charCodeAt(s+3)],y[c++]=f<<2|d>>4,y[c++]=(d&15)<<4|m>>2,y[c++]=(m&3)<<6|h&63;return p},r4=typeof ArrayBuffer=="function",um=(n,l)=>{if(typeof n!="string")return{type:"message",data:cb(n,l)};const r=n.charAt(0);return r==="b"?{type:"message",data:i4(n.substring(1),l)}:Mc[r]?n.length>1?{type:Mc[r],data:n.substring(1)}:{type:Mc[r]}:Sh},i4=(n,l)=>{if(r4){const r=l4(n);return cb(r,l)}else return{base64:!0,data:n}},cb=(n,l)=>l==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,ub="",s4=(n,l)=>{const r=n.length,s=new Array(r);let c=0;n.forEach((f,d)=>{cm(f,!1,m=>{s[d]=m,++c===r&&l(s.join(ub))})})},o4=(n,l)=>{const r=n.split(ub),s=[];for(let c=0;c<r.length;c++){const f=um(r[c],l);if(s.push(f),f.type==="error")break}return s};function c4(){return new TransformStream({transform(n,l){a4(n,r=>{const s=r.length;let c;if(s<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,s);else if(s<65536){c=new Uint8Array(3);const f=new DataView(c.buffer);f.setUint8(0,126),f.setUint16(1,s)}else{c=new Uint8Array(9);const f=new DataView(c.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(c[0]|=128),l.enqueue(c),l.enqueue(r)})}})}let eh;function Ec(n){return n.reduce((l,r)=>l+r.length,0)}function Tc(n,l){if(n[0].length===l)return n.shift();const r=new Uint8Array(l);let s=0;for(let c=0;c<l;c++)r[c]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),r}function u4(n,l){eh||(eh=new TextDecoder);const r=[];let s=0,c=-1,f=!1;return new TransformStream({transform(d,m){for(r.push(d);;){if(s===0){if(Ec(r)<1)break;const h=Tc(r,1);f=(h[0]&128)===128,c=h[0]&127,c<126?s=3:c===126?s=1:s=2}else if(s===1){if(Ec(r)<2)break;const h=Tc(r,2);c=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(Ec(r)<8)break;const h=Tc(r,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){m.enqueue(Sh);break}c=y*Math.pow(2,32)+p.getUint32(4),s=3}else{if(Ec(r)<c)break;const h=Tc(r,c);m.enqueue(um(f?h:eh.decode(h),l)),s=0}if(c===0||c>n){m.enqueue(Sh);break}}}})}const fb=4;function sn(n){if(n)return f4(n)}function f4(n){for(var l in sn.prototype)n[l]=sn.prototype[l];return n}sn.prototype.on=sn.prototype.addEventListener=function(n,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(l),this};sn.prototype.once=function(n,l){function r(){this.off(n,r),l.apply(this,arguments)}return r.fn=l,this.on(n,r),this};sn.prototype.off=sn.prototype.removeListener=sn.prototype.removeAllListeners=sn.prototype.removeEventListener=function(n,l){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+n];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,c=0;c<r.length;c++)if(s=r[c],s===l||s.fn===l){r.splice(c,1);break}return r.length===0&&delete this._callbacks["$"+n],this};sn.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var l=new Array(arguments.length-1),r=this._callbacks["$"+n],s=1;s<arguments.length;s++)l[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,c=r.length;s<c;++s)r[s].apply(this,l)}return this};sn.prototype.emitReserved=sn.prototype.emit;sn.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};sn.prototype.hasListeners=function(n){return!!this.listeners(n).length};const bu=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,r)=>r(l,0),Ea=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),d4="arraybuffer";function db(n,...l){return l.reduce((r,s)=>(n.hasOwnProperty(s)&&(r[s]=n[s]),r),{})}const h4=Ea.setTimeout,m4=Ea.clearTimeout;function _u(n,l){l.useNativeTimers?(n.setTimeoutFn=h4.bind(Ea),n.clearTimeoutFn=m4.bind(Ea)):(n.setTimeoutFn=Ea.setTimeout.bind(Ea),n.clearTimeoutFn=Ea.clearTimeout.bind(Ea))}const p4=1.33;function g4(n){return typeof n=="string"?v4(n):Math.ceil((n.byteLength||n.size)*p4)}function v4(n){let l=0,r=0;for(let s=0,c=n.length;s<c;s++)l=n.charCodeAt(s),l<128?r+=1:l<2048?r+=2:l<55296||l>=57344?r+=3:(s++,r+=4);return r}function hb(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y4(n){let l="";for(let r in n)n.hasOwnProperty(r)&&(l.length&&(l+="&"),l+=encodeURIComponent(r)+"="+encodeURIComponent(n[r]));return l}function b4(n){let l={},r=n.split("&");for(let s=0,c=r.length;s<c;s++){let f=r[s].split("=");l[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return l}class _4 extends Error{constructor(l,r,s){super(l),this.description=r,this.context=s,this.type="TransportError"}}class fm extends sn{constructor(l){super(),this.writable=!1,_u(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,r,s){return super.emitReserved("error",new _4(l,r,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"&&this.write(l)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const r=um(l,this.socket.binaryType);this.onPacket(r)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,r={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const r=y4(l);return r.length?"?"+r:""}}class A4 extends fm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(l){this.readyState="pausing";const r=()=>{this.readyState="paused",l()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||r()})),this.writable||(s++,this.once("drain",function(){--s||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(l){const r=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)};o4(l,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const l=()=>{this.write([{type:"close"}])};this.readyState==="open"?l():this.once("open",l)}write(l){this.writable=!1,s4(l,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const l=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=hb()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(l,r)}}let mb=!1;try{mb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const C4=mb;function S4(){}class E4 extends A4{constructor(l){if(super(l),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&l.hostname!==location.hostname||s!==l.port}}doWrite(l,r){const s=this.request({method:"POST",data:l});s.on("success",r),s.on("error",(c,f)=>{this.onError("xhr post error",c,f)})}doPoll(){const l=this.request();l.on("data",this.onData.bind(this)),l.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=l}}class Za extends sn{constructor(l,r,s){super(),this.createRequest=l,_u(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var l;const r=db(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&s.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(l=this._opts.cookieJar)===null||l===void 0||l.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var c;s.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.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(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=Za.requestsCount++,Za.requests[this._index]=this)}_onError(l){this.emitReserved("error",l,this._xhr),this._cleanup(!0)}_cleanup(l){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=S4,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Za.requests[this._index],this._xhr=null}}_onLoad(){const l=this._xhr.responseText;l!==null&&(this.emitReserved("data",l),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Za.requestsCount=0;Za.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rv);else if(typeof addEventListener=="function"){const n="onpagehide"in Ea?"pagehide":"unload";addEventListener(n,Rv,!1)}}function Rv(){for(let n in Za.requests)Za.requests.hasOwnProperty(n)&&Za.requests[n].abort()}const T4=(function(){const n=pb({xdomain:!1});return n&&n.responseType!==null})();class x4 extends E4{constructor(l){super(l);const r=l&&l.forceBase64;this.supportsBinary=T4&&!r}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new Za(pb,this.uri(),l)}}function pb(n){const l=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||C4))return new XMLHttpRequest}catch{}if(!l)try{return new Ea[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const gb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class O4 extends fm{get name(){return"websocket"}doOpen(){const l=this.uri(),r=this.opts.protocols,s=gb?{}:db(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(l,r,s)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=l=>this.onClose({description:"websocket connection closed",context:l}),this.ws.onmessage=l=>this.onData(l.data),this.ws.onerror=l=>this.onError("websocket error",l)}write(l){this.writable=!1;for(let r=0;r<l.length;r++){const s=l[r],c=r===l.length-1;cm(s,this.supportsBinary,f=>{try{this.doWrite(s,f)}catch{}c&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const l=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=hb()),this.supportsBinary||(r.b64=1),this.createUri(l,r)}}const th=Ea.WebSocket||Ea.MozWebSocket;class R4 extends O4{createSocket(l,r,s){return gb?new th(l,r,s):r?new th(l,r):new th(l)}doWrite(l,r){this.ws.send(r)}}class w4 extends fm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(l){return this.emitReserved("error",l)}this._transport.closed.then(()=>{this.onClose()}).catch(l=>{this.onError("webtransport error",l)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(l=>{const r=u4(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=l.readable.pipeThrough(r).getReader(),c=c4();c.readable.pipeTo(l.writable),this._writer=c.writable.getWriter();const f=()=>{s.read().then(({done:m,value:h})=>{m||(this.onPacket(h),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(l){this.writable=!1;for(let r=0;r<l.length;r++){const s=l[r],c=r===l.length-1;this._writer.write(s).then(()=>{c&&bu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const N4={websocket:R4,webtransport:w4,polling:x4},M4=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,D4=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Eh(n){if(n.length>8e3)throw"URI too long";const l=n,r=n.indexOf("["),s=n.indexOf("]");r!=-1&&s!=-1&&(n=n.substring(0,r)+n.substring(r,s).replace(/:/g,";")+n.substring(s,n.length));let c=M4.exec(n||""),f={},d=14;for(;d--;)f[D4[d]]=c[d]||"";return r!=-1&&s!=-1&&(f.source=l,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=L4(f,f.path),f.queryKey=z4(f,f.query),f}function L4(n,l){const r=/\/{2,9}/g,s=l.replace(r,"/").split("/");return(l.slice(0,1)=="/"||l.length===0)&&s.splice(0,1),l.slice(-1)=="/"&&s.splice(s.length-1,1),s}function z4(n,l){const r={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,c,f){c&&(r[c]=f)}),r}const Th=typeof addEventListener=="function"&&typeof removeEventListener=="function",Dc=[];Th&&addEventListener("offline",()=>{Dc.forEach(n=>n())},!1);class ur extends sn{constructor(l,r){if(super(),this.binaryType=d4,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(r=l,l=null),l){const s=Eh(l);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=Eh(r.host).host);_u(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const c=s.prototype.name;this.transports.push(c),this._transportsByName[c]=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},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=b4(this.opts.query)),Th&&(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"})},Dc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const r=Object.assign({},this.opts.query);r.EIO=fb,r.transport=l,this.id&&(r.sid=this.id);const s=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[l]);return new this._transportsByName[l](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const l=this.opts.rememberUpgrade&&ur.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(l);r.open(),this.setTransport(r)}setTransport(l){this.transport&&this.transport.removeAllListeners(),this.transport=l,l.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",ur.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(l){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",l),this.emitReserved("heartbeat"),l.type){case"open":this.onHandshake(JSON.parse(l.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=l.data,this._onError(r);break;case"message":this.emitReserved("data",l.data),this.emitReserved("message",l.data);break}}onHandshake(l){this.emitReserved("handshake",l),this.id=l.sid,this.transport.query.sid=l.sid,this._pingInterval=l.pingInterval,this._pingTimeout=l.pingTimeout,this._maxPayload=l.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const l=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+l,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},l),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 l=this._getWritablePackets();this.transport.send(l),this._prevBufferLen=l.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let s=0;s<this.writeBuffer.length;s++){const c=this.writeBuffer[s].data;if(c&&(r+=g4(c)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const l=Date.now()>this._pingTimeoutTime;return l&&(this._pingTimeoutTime=0,bu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),l}write(l,r,s){return this._sendPacket("message",l,r,s),this}send(l,r,s){return this._sendPacket("message",l,r,s),this}_sendPacket(l,r,s,c){if(typeof r=="function"&&(c=r,r=void 0),typeof s=="function"&&(c=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const f={type:l,data:r,options:s};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),c&&this.once("flush",c),this.flush()}close(){const l=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),l()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():l()}):this.upgrading?s():l()),this}_onError(l){if(ur.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",l),this._onClose("transport error",l)}_onClose(l,r){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(),Th&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Dc.indexOf(this._offlineEventListener);s!==-1&&Dc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,r),this.writeBuffer=[],this._prevBufferLen=0}}}ur.protocol=fb;class k4 extends ur{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let l=0;l<this._upgrades.length;l++)this._probe(this._upgrades[l])}_probe(l){let r=this.createTransport(l),s=!1;ur.priorWebsocketSuccess=!1;const c=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ur.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(y(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const C=new Error("probe error");C.transport=r.name,this.emitReserved("upgradeError",C)}}))};function f(){s||(s=!0,y(),r.close(),r=null)}const d=b=>{const C=new Error("probe error: "+b);C.transport=r.name,f(),this.emitReserved("upgradeError",C)};function m(){d("transport closed")}function h(){d("socket closed")}function p(b){r&&b.name!==r.name&&f()}const y=()=>{r.removeListener("open",c),r.removeListener("error",d),r.removeListener("close",m),this.off("close",h),this.off("upgrading",p)};r.once("open",c),r.once("error",d),r.once("close",m),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&l!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(l){this._upgrades=this._filterUpgrades(l.upgrades),super.onHandshake(l)}_filterUpgrades(l){const r=[];for(let s=0;s<l.length;s++)~this.transports.indexOf(l[s])&&r.push(l[s]);return r}}let B4=class extends k4{constructor(l,r={}){const s=typeof l=="object"?l:r;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(c=>N4[c]).filter(c=>!!c)),super(l,s)}};function j4(n,l="",r){let s=n;r=r||typeof location<"u"&&location,n==null&&(n=r.protocol+"//"+r.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=r.protocol+n:n=r.host+n),/^(https?|wss?):\/\//.test(n)||(typeof r<"u"?n=r.protocol+"//"+n:n="https://"+n),s=Eh(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const f=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+f+":"+s.port+l,s.href=s.protocol+"://"+f+(r&&r.port===s.port?"":":"+s.port),s}const U4=typeof ArrayBuffer=="function",H4=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,vb=Object.prototype.toString,q4=typeof Blob=="function"||typeof Blob<"u"&&vb.call(Blob)==="[object BlobConstructor]",I4=typeof File=="function"||typeof File<"u"&&vb.call(File)==="[object FileConstructor]";function dm(n){return U4&&(n instanceof ArrayBuffer||H4(n))||q4&&n instanceof Blob||I4&&n instanceof File}function Lc(n,l){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let r=0,s=n.length;r<s;r++)if(Lc(n[r]))return!0;return!1}if(dm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Lc(n.toJSON(),!0);for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&Lc(n[r]))return!0;return!1}function G4(n){const l=[],r=n.data,s=n;return s.data=xh(r,l),s.attachments=l.length,{packet:s,buffers:l}}function xh(n,l){if(!n)return n;if(dm(n)){const r={_placeholder:!0,num:l.length};return l.push(n),r}else if(Array.isArray(n)){const r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=xh(n[s],l);return r}else if(typeof n=="object"&&!(n instanceof Date)){const r={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=xh(n[s],l));return r}return n}function V4(n,l){return n.data=Oh(n.data,l),delete n.attachments,n}function Oh(n,l){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<l.length)return l[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=Oh(n[r],l);else if(typeof n=="object")for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=Oh(n[r],l));return n}const X4=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var We;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(We||(We={}));class Y4{constructor(l){this.replacer=l}encode(l){return(l.type===We.EVENT||l.type===We.ACK)&&Lc(l)?this.encodeAsBinary({type:l.type===We.EVENT?We.BINARY_EVENT:We.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let r=""+l.type;return(l.type===We.BINARY_EVENT||l.type===We.BINARY_ACK)&&(r+=l.attachments+"-"),l.nsp&&l.nsp!=="/"&&(r+=l.nsp+","),l.id!=null&&(r+=l.id),l.data!=null&&(r+=JSON.stringify(l.data,this.replacer)),r}encodeAsBinary(l){const r=G4(l),s=this.encodeAsString(r.packet),c=r.buffers;return c.unshift(s),c}}class hm extends sn{constructor(l){super(),this.reviver=l}add(l){let r;if(typeof l=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(l);const s=r.type===We.BINARY_EVENT;s||r.type===We.BINARY_ACK?(r.type=s?We.EVENT:We.ACK,this.reconstructor=new K4(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(dm(l)||l.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(l),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+l)}decodeString(l){let r=0;const s={type:Number(l.charAt(0))};if(We[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===We.BINARY_EVENT||s.type===We.BINARY_ACK){const f=r+1;for(;l.charAt(++r)!=="-"&&r!=l.length;);const d=l.substring(f,r);if(d!=Number(d)||l.charAt(r)!=="-")throw new Error("Illegal attachments");s.attachments=Number(d)}if(l.charAt(r+1)==="/"){const f=r+1;for(;++r&&!(l.charAt(r)===","||r===l.length););s.nsp=l.substring(f,r)}else s.nsp="/";const c=l.charAt(r+1);if(c!==""&&Number(c)==c){const f=r+1;for(;++r;){const d=l.charAt(r);if(d==null||Number(d)!=d){--r;break}if(r===l.length)break}s.id=Number(l.substring(f,r+1))}if(l.charAt(++r)){const f=this.tryParse(l.substr(r));if(hm.isPayloadValid(s.type,f))s.data=f;else throw new Error("invalid payload")}return s}tryParse(l){try{return JSON.parse(l,this.reviver)}catch{return!1}}static isPayloadValid(l,r){switch(l){case We.CONNECT:return wv(r);case We.DISCONNECT:return r===void 0;case We.CONNECT_ERROR:return typeof r=="string"||wv(r);case We.EVENT:case We.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&X4.indexOf(r[0])===-1);case We.ACK:case We.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class K4{constructor(l){this.packet=l,this.buffers=[],this.reconPack=l}takeBinaryData(l){if(this.buffers.push(l),this.buffers.length===this.reconPack.attachments){const r=V4(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function wv(n){return Object.prototype.toString.call(n)==="[object Object]"}const F4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:hm,Encoder:Y4,get PacketType(){return We}},Symbol.toStringTag,{value:"Module"}));function Ba(n,l,r){return n.on(l,r),function(){n.off(l,r)}}const J4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class yb extends sn{constructor(l,r,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=l,this.nsp=r,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 l=this.io;this.subs=[Ba(l,"open",this.onopen.bind(this)),Ba(l,"packet",this.onpacket.bind(this)),Ba(l,"error",this.onerror.bind(this)),Ba(l,"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(...l){return l.unshift("message"),this.emit.apply(this,l),this}emit(l,...r){var s,c,f;if(J4.hasOwnProperty(l))throw new Error('"'+l.toString()+'" is a reserved event name');if(r.unshift(l),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const d={type:We.EVENT,data:r};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const y=this.ids++,b=r.pop();this._registerAckCallback(y,b),d.id=y}const m=(c=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||c===void 0?void 0:c.writable,h=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(h?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(l,r){var s;const c=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(c===void 0){this.acks[l]=r;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===l&&this.sendBuffer.splice(m,1);r.call(this,new Error("operation has timed out"))},c),d=(...m)=>{this.io.clearTimeoutFn(f),r.apply(this,m)};d.withError=!0,this.acks[l]=d}emitWithAck(l,...r){return new Promise((s,c)=>{const f=(d,m)=>d?c(d):s(m);f.withError=!0,r.push(f),this.emit(l,...r)})}_addToQueue(l){let r;typeof l[l.length-1]=="function"&&(r=l.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:l,flags:Object.assign({fromQueue:!0},this.flags)};l.push((c,...f)=>(this._queue[0],c!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(c)):(this._queue.shift(),r&&r(null,...f)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(l=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!l||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(l){l.nsp=this.nsp,this.io._packet(l)}onopen(){typeof this.auth=="function"?this.auth(l=>{this._sendConnectPacket(l)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(l){this.packet({type:We.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},l):l})}onerror(l){this.connected||this.emitReserved("connect_error",l)}onclose(l,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",l,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(l=>{if(!this.sendBuffer.some(s=>String(s.id)===l)){const s=this.acks[l];delete this.acks[l],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(l){if(l.nsp===this.nsp)switch(l.type){case We.CONNECT:l.data&&l.data.sid?this.onconnect(l.data.sid,l.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 We.EVENT:case We.BINARY_EVENT:this.onevent(l);break;case We.ACK:case We.BINARY_ACK:this.onack(l);break;case We.DISCONNECT:this.ondisconnect();break;case We.CONNECT_ERROR:this.destroy();const s=new Error(l.data.message);s.data=l.data.data,this.emitReserved("connect_error",s);break}}onevent(l){const r=l.data||[];l.id!=null&&r.push(this.ack(l.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(l){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.apply(this,l)}super.emit.apply(this,l),this._pid&&l.length&&typeof l[l.length-1]=="string"&&(this._lastOffset=l[l.length-1])}ack(l){const r=this;let s=!1;return function(...c){s||(s=!0,r.packet({type:We.ACK,id:l,data:c}))}}onack(l){const r=this.acks[l.id];typeof r=="function"&&(delete this.acks[l.id],r.withError&&l.data.unshift(null),r.apply(this,l.data))}onconnect(l,r){this.id=l,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(l=>this.emitEvent(l)),this.receiveBuffer=[],this.sendBuffer.forEach(l=>{this.notifyOutgoingListeners(l),this.packet(l)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(l=>l()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:We.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(l){return this.flags.compress=l,this}get volatile(){return this.flags.volatile=!0,this}timeout(l){return this.flags.timeout=l,this}onAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(l),this}prependAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(l),this}offAny(l){if(!this._anyListeners)return this;if(l){const r=this._anyListeners;for(let s=0;s<r.length;s++)if(l===r[s])return r.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(l),this}prependAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(l),this}offAnyOutgoing(l){if(!this._anyOutgoingListeners)return this;if(l){const r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(l===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(l){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,l.data)}}}function Ui(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}Ui.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var l=Math.random(),r=Math.floor(l*this.jitter*n);n=(Math.floor(l*10)&1)==0?n-r:n+r}return Math.min(n,this.max)|0};Ui.prototype.reset=function(){this.attempts=0};Ui.prototype.setMin=function(n){this.ms=n};Ui.prototype.setMax=function(n){this.max=n};Ui.prototype.setJitter=function(n){this.jitter=n};class Rh extends sn{constructor(l,r){var s;super(),this.nsps={},this.subs=[],l&&typeof l=="object"&&(r=l,l=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,_u(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Ui({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=l;const c=r.parser||F4;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(l){return arguments.length?(this._reconnection=!!l,l||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(l){return l===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=l,this)}reconnectionDelay(l){var r;return l===void 0?this._reconnectionDelay:(this._reconnectionDelay=l,(r=this.backoff)===null||r===void 0||r.setMin(l),this)}randomizationFactor(l){var r;return l===void 0?this._randomizationFactor:(this._randomizationFactor=l,(r=this.backoff)===null||r===void 0||r.setJitter(l),this)}reconnectionDelayMax(l){var r;return l===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=l,(r=this.backoff)===null||r===void 0||r.setMax(l),this)}timeout(l){return arguments.length?(this._timeout=l,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(l){if(~this._readyState.indexOf("open"))return this;this.engine=new B4(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const c=Ba(r,"open",function(){s.onopen(),l&&l()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),l?l(m):this.maybeReconnectOnOpen()},d=Ba(r,"error",f);if(this._timeout!==!1){const m=this._timeout,h=this.setTimeoutFn(()=>{c(),f(new Error("timeout")),r.close()},m);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(c),this.subs.push(d),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(Ba(l,"ping",this.onping.bind(this)),Ba(l,"data",this.ondata.bind(this)),Ba(l,"error",this.onerror.bind(this)),Ba(l,"close",this.onclose.bind(this)),Ba(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(l){try{this.decoder.add(l)}catch(r){this.onclose("parse error",r)}}ondecoded(l){bu(()=>{this.emitReserved("packet",l)},this.setTimeoutFn)}onerror(l){this.emitReserved("error",l)}socket(l,r){let s=this.nsps[l];return s?this._autoConnect&&!s.active&&s.connect():(s=new yb(this,l,r),this.nsps[l]=s),s}_destroy(l){const r=Object.keys(this.nsps);for(const s of r)if(this.nsps[s].active)return;this._close()}_packet(l){const r=this.encoder.encode(l);for(let s=0;s<r.length;s++)this.engine.write(r[s],l.options)}cleanup(){this.subs.forEach(l=>l()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(l,r){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",l,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const l=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{l.skipReconnect||(this.emitReserved("reconnect_attempt",l.backoff.attempts),!l.skipReconnect&&l.open(c=>{c?(l._reconnecting=!1,l.reconnect(),this.emitReserved("reconnect_error",c)):l.onreconnect()}))},r);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const l=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",l)}}const Hs={};function zc(n,l){typeof n=="object"&&(l=n,n=void 0),l=l||{};const r=j4(n,l.path||"/socket.io"),s=r.source,c=r.id,f=r.path,d=Hs[c]&&f in Hs[c].nsps,m=l.forceNew||l["force new connection"]||l.multiplex===!1||d;let h;return m?h=new Rh(s,l):(Hs[c]||(Hs[c]=new Rh(s,l)),h=Hs[c]),r.query&&!l.query&&(l.query=r.queryKey),h.socket(r.path,l)}Object.assign(zc,{Manager:Rh,Socket:yb,io:zc,connect:zc});const Z4=[Iv,Gv,Uv,Hv,XA,...mS,...nC,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],W4=({dispatch:n,getState:l})=>r=>{let s=null;return c=>{const f=r(c);if(c.type===Zh){s?.disconnect(),n(vS());const m={path:`/website-messenger/${c.clientName}/socket.io`,query:c.querystrings};s=zc(m),s.on("action",n),s.on("connect",()=>n(yS())),s.on("disconnect",()=>n(bS())),s.on("reconnect",()=>n(_S())),s.on("set-translations",(h,p)=>{n(Yx({language:h,messages:Ux(h,p)}))}),s.on("set-settings",h=>{n(Jx(h))}),s.on("enable-conversation-rating",h=>n(sC(h))),s.on("speech-transcription",h=>n(lC(h))),s.on("restore-client-state",h=>{n(gS(h.sessionId)),n(cC(h.messages))}),s.on("expand-window",({devices:h,initial:p=!1})=>{n({type:Jv,devices:h,initial:p})}),s.on("restart-chat",()=>{n(Ws())}),s.on("login-success",h=>{n(iS({loginToken:h.loginToken}))})}else if(c.type==="start-screen/requestLogin")s?.emit("login-requested",c.payload);else if(c.type===fu)s?.emit("start-chat",c.payload);else if(c.type===du)s?.emit("terminate-session",c.payload);else if(c.type===tC)s?.emit("get-started",JSON.stringify(c));else if(c.type===Uh)s?.emit("audio-message",c.buffer);else if(c.type===zh)s?.emit("conversation-rating",c.payload);else if(c.type===Wv){const{connection:{sessionId:d}}=l();if(d){const m=au(),h=new URL(`/${encodeURIComponent(m)}/transcript-pdf/${encodeURIComponent(d)}`,window.location.origin);window.location.href=h.toString()}}else Z4.indexOf(c.type)===-1&&c.meta===void 0&&s&&s.emit("action",JSON.stringify(c));return f}},bb=au(),Q4={...Px(bb),intl:eb},wh=KC({middleware:n=>n().concat(W4),reducer:Wx,preloadedState:Q4});wh.subscribe(s6(()=>{const n=wh.getState();$x(bb,{connection:n.connection,startScreen:n.startScreen})},1e3));const P4=document.getElementById("root"),$4=k2.createRoot(P4);$4.render(v.jsx(zA,{store:wh,children:v.jsx(Lx,{})}));
|
|
76
|
+
//# sourceMappingURL=index-iPU9jlP1.js.map
|