@seamly/web-ui 23.0.6-alpha.1 → 23.0.6-alpha.2

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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see style-guide.min.js.LICENSE.txt */
2
- (()=>{var e={2086:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,i){return(t[n]=t[n]||[]).push([r,i]),e},e.off=function(r,i){r||(t={});for(var a=t[r]||n,o=a.length=i?a.length:0;o--;)i==a[o][0]&&a.splice(o,1);return e},e.emit=function(r){for(var i,a=t[r]||n,o=a.length>0?a.slice(0,a.length):a,s=0;i=o[s++];)i[0].apply(i[1],n.slice.call(arguments,1));return e}}},7402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>f,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>c,StrictMode:()=>te,Suspense:()=>b,SuspenseList:()=>C,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>X,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>W,createPortal:()=>T,createRef:()=>r.createRef,default:()=>le,findDOMNode:()=>Z,flushSync:()=>ee,forwardRef:()=>p,hydrate:()=>O,isElement:()=>oe,isFragment:()=>K,isMemo:()=>J,isValidElement:()=>q,lazy:()=>w,memo:()=>l,render:()=>M,startTransition:()=>ne,unmountComponentAtNode:()=>Y,unstable_batchedUpdates:()=>Q,useDeferredValue:()=>re,useInsertionEffect:()=>ae,useSyncExternalStore:()=>se,useTransition:()=>ie,version:()=>G});var r=n(8785),i=n(1162),a={};for(const e in i)["default","Component","Fragment","createContext","createElement","createRef","Children","PureComponent","StrictMode","Suspense","SuspenseList","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","cloneElement","createFactory","createPortal","findDOMNode","flushSync","forwardRef","hydrate","isElement","isFragment","isMemo","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(a[e]=()=>i[e]);function o(e,t){for(var n in t)e[n]=t[n];return e}function s(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}function l(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:s(this.props,e)}function i(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return i.displayName="Memo("+(e.displayName||e.name)+")",i.prototype.isReactComponent=!0,i.__f=!0,i}n.d(t,a),(c.prototype=new r.Component).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return s(this.props,e)||s(this.state,t)};var u=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),u&&u(e)};var d="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function p(e){function t(t){var n=o({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=d,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var h=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},f={map:h,forEach:h,count:function(e){return e?(0,r.toChildArray)(e).length:0},only:function(e){var t=(0,r.toChildArray)(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:r.toChildArray},m=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);m(e,t,n,r)};var y=r.options.unmount;function g(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=o({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return g(e,t,n)}))),e}function v(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function b(){this.__u=0,this.t=null,this.__b=null}function x(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function w(e){var t,n,i;function a(a){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){i=e})),i)throw i;if(!n)throw t;return(0,r.createElement)(n,a)}return a.displayName="Lazy",a.__f=!0,a}function C(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),y&&y(e)},(b.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=x(r.__v),a=!1,o=function(){a||(a=!0,n.__R=null,i?i(s):s())};n.__R=o;var s=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=v(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},b.prototype.componentWillUnmount=function(){this.t=[]},b.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=g(this.__b,n,i.__O=i.__P)}this.__b=null}var a=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return a&&(a.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),a]};var _=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function S(e){return this.getChildContext=function(){return e.context},e.children}function E(e){var t=this,n=e.i;t.componentWillUnmount=function(){(0,r.render)(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),(0,r.render)((0,r.createElement)(S,{context:t.context},e.__v),t.l)}function T(e,t){var n=(0,r.createElement)(E,{__v:e,i:t});return n.containerInfo=t,n}(C.prototype=new r.Component).__a=function(e){var t=this,n=x(t.__v),r=t.o.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),_(t,e,r)):i()};n?n(a):a()}},C.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},C.prototype.componentDidUpdate=C.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var j="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,k=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,N=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,I=/[A-Z0-9]/g,A="undefined"!=typeof document,L=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function M(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function O(e,t,n){return(0,r.hydrate)(e,t),"function"==typeof n&&n(),e?e.__c:null}r.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(r.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var R=r.options.event;function P(){}function D(){return this.cancelBubble}function z(){return this.defaultPrevented}r.options.event=function(e){return R&&(e=R(e)),e.persist=P,e.isPropagationStopped=D,e.isDefaultPrevented=z,e.nativeEvent=e};var U,F={enumerable:!1,configurable:!0,get:function(){return this.class}},B=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var a in t){var o=t[a];if(!("value"===a&&"defaultValue"in t&&null==o||A&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var s=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===o?o="":"translate"===s&&"no"===o?o=!1:"ondoubleclick"===s?a="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||L(t.type)?"onfocus"===s?a="onfocusin":"onblur"===s?a="onfocusout":N.test(a)?a=s:-1===n.indexOf("-")&&k.test(a)?a=a.replace(I,"-$&").toLowerCase():null===o&&(o=void 0):s=a="oninput","oninput"===s&&i[a=s]&&(a="oninputCapture"),i[a]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",F)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=j,B&&B(e)};var H=r.options.__r;r.options.__r=function(e){H&&H(e),U=e.__c};var $=r.options.diffed;r.options.diffed=function(e){$&&$(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),U=null};var V={ReactCurrentDispatcher:{current:{readContext:function(e){return U.__n[e.__c].props.value},useCallback:i.useCallback,useContext:i.useContext,useDebugValue:i.useDebugValue,useDeferredValue:re,useEffect:i.useEffect,useId:i.useId,useImperativeHandle:i.useImperativeHandle,useInsertionEffect:ae,useLayoutEffect:i.useLayoutEffect,useMemo:i.useMemo,useReducer:i.useReducer,useRef:i.useRef,useState:i.useState,useSyncExternalStore:se,useTransition:ie}}},G="17.0.2";function W(e){return r.createElement.bind(null,e)}function q(e){return!!e&&e.$$typeof===j}function K(e){return q(e)&&e.type===r.Fragment}function J(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function X(e){return q(e)?r.cloneElement.apply(null,arguments):e}function Y(e){return!!e.__k&&((0,r.render)(null,e),!0)}function Z(e){return e&&(e.base||1===e.nodeType&&e)||null}var Q=function(e,t){return e(t)},ee=function(e,t){return e(t)},te=r.Fragment;function ne(e){e()}function re(e){return e}function ie(){return[!1,ne]}var ae=i.useLayoutEffect,oe=q;function se(e,t){var n=t(),r=(0,i.useState)({h:{__:n,v:t}}),a=r[0].h,o=r[1];return(0,i.useLayoutEffect)((function(){a.__=n,a.v=t,ce(a)&&o({h:a})}),[e,n,t]),(0,i.useEffect)((function(){return ce(a)&&o({h:a}),e((function(){ce(a)&&o({h:a})}))}),[e]),n}function ce(e){var t,n,r=e.v,i=e.__;try{var a=r();return!((t=i)===(n=a)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var le={useState:i.useState,useId:i.useId,useReducer:i.useReducer,useEffect:i.useEffect,useLayoutEffect:i.useLayoutEffect,useInsertionEffect:ae,useTransition:ie,useDeferredValue:re,useSyncExternalStore:se,startTransition:ne,useRef:i.useRef,useImperativeHandle:i.useImperativeHandle,useMemo:i.useMemo,useCallback:i.useCallback,useContext:i.useContext,useDebugValue:i.useDebugValue,version:"17.0.2",Children:f,render:M,hydrate:O,unmountComponentAtNode:Y,createPortal:T,createElement:r.createElement,createContext:r.createContext,createFactory:W,cloneElement:X,createRef:r.createRef,Fragment:r.Fragment,isValidElement:q,isElement:oe,isFragment:K,isMemo:J,findDOMNode:Z,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:ee,unstable_batchedUpdates:Q,StrictMode:te,Suspense:b,SuspenseList:C,lazy:w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:V}},7154:(e,t,n)=>{"use strict";var r=n(7402),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useSyncExternalStore,o=r.useRef,s=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c((function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return o=t}return o=e}if(t=o,i(a,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(a=e,o=n)}var a,o,s=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,u]);var h=a(e,d[0],d[1]);return s((function(){p.hasValue=!0,p.value=h}),[h]),l(h),h}},8418:(e,t,n)=>{"use strict";e.exports=n(7154)},8785:e=>{"use strict";e.exports=require("preact")},1162:e=>{"use strict";e.exports=require("preact/hooks")},9306:(e,t,n)=>{"use strict";var r=n(4901),i=n(6823),a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+" is not a function")}},3506:(e,t,n)=>{"use strict";var r=n(3925),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a("Can't set "+i(e)+" as a prototype")}},7080:(e,t,n)=>{"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},679:(e,t,n)=>{"use strict";var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+" is not an object")}},9617:(e,t,n)=>{"use strict";var r=n(5397),i=n(5610),a=n(6198),o=function(e){return function(t,n,o){var s=r(t),c=a(s);if(0===c)return!e&&-1;var l,u=i(o,c);if(e&&n!=n){for(;c>u;)if((l=s[u++])!=l)return!0}else for(;c>u;u++)if((e||u in s)&&s[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},4527:(e,t,n)=>{"use strict";var r=n(3724),i=n(4376),a=TypeError,o=Object.getOwnPropertyDescriptor,s=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=s?function(e,t){if(i(e)&&!o(e,"length").writable)throw new a("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4576:(e,t,n)=>{"use strict";var r=n(9504),i=r({}.toString),a=r("".slice);e.exports=function(e){return a(i(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),i=n(4901),a=n(4576),o=n(8227)("toStringTag"),s=Object,c="Arguments"===a(function(){return arguments}());e.exports=r?a:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),o))?n:c?a(t):"Object"===(r=a(t))&&i(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),i=n(5031),a=n(7347),o=n(4913);e.exports=function(e,t,n){for(var s=i(t),c=o.f,l=a.f,u=0;u<s.length;u++){var d=s[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},6699:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),a=n(6980);e.exports=r?function(e,t,n){return i.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6840:(e,t,n)=>{"use strict";var r=n(4901),i=n(4913),a=n(283),o=n(9433);e.exports=function(e,t,n,s){s||(s={});var c=s.enumerable,l=void 0!==s.name?s.name:t;if(r(n)&&a(n,l,s),s.global)c?e[t]=n:o(t,n);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},9433:(e,t,n)=>{"use strict";var r=n(4475),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,n)=>{"use strict";var r=n(4475),i=n(34),a=r.document,o=i(a)&&i(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},5002:e=>{"use strict";e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},9392:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:(e,t,n)=>{"use strict";var r,i,a=n(4475),o=n(9392),s=a.process,c=a.Deno,l=s&&s.versions||c&&c.version,u=l&&l.v8;u&&(i=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&o&&(!(r=o.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(e,t,n)=>{"use strict";var r=n(9504),i=Error,a=r("".replace),o=String(new i("zxcasd").stack),s=/\n\s*at [^:]*:[^\n]*/,c=s.test(o);e.exports=function(e,t){if(c&&"string"==typeof e&&!i.prepareStackTrace)for(;t--;)e=a(e,s,"");return e}},6518:(e,t,n)=>{"use strict";var r=n(4475),i=n(7347).f,a=n(6699),o=n(6840),s=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,p,h,f=e.target,m=e.global,y=e.stat;if(n=m?r:y?r[f]||s(f,{}):r[f]&&r[f].prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(h=i(n,u))&&h.value:n[u],!l(m?u:f+(y?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&a(p,"sham",!0),o(n,u,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),i=n(9297),a=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,s=i(a,"name"),c=s&&"something"===function(){}.name,l=s&&(!r||r&&o(a,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:l}},6706:(e,t,n)=>{"use strict";var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},9504:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,a=i.call,o=r&&i.bind.bind(a,a);e.exports=r?o:function(e){return function(){return a.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4475),i=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],i(n)?n:void 0):r[e]&&r[e][t];var n}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},5966:(e,t,n)=>{"use strict";var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},3789:(e,t,n)=>{"use strict";var r=n(9306),i=n(8551),a=n(9565),o=n(1291),s=n(1767),c="Invalid size",l=RangeError,u=TypeError,d=Math.max,p=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return s(i(a(this.keys,this.set)))},includes:function(e){return a(this.has,this.set,e)}},e.exports=function(e){i(e);var t=+e.size;if(t!=t)throw new u(c);var n=o(t);if(n<0)throw new l(c);return new p(e,n)}},4475:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),a=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},421:e=>{"use strict";e.exports={}},5917:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039),a=n(4055);e.exports=!r&&!i((function(){return 7!==Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),a=n(4576),o=Object,s=r("".split);e.exports=i((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"===a(e)?s(e,""):o(e)}:o},3167:(e,t,n)=>{"use strict";var r=n(4901),i=n(34),a=n(2967);e.exports=function(e,t,n){var o,s;return a&&r(o=t.constructor)&&o!==n&&i(s=o.prototype)&&s!==n.prototype&&a(e,s),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),i=n(4901),a=n(7629),o=r(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},1181:(e,t,n)=>{"use strict";var r,i,a,o=n(8622),s=n(4475),c=n(34),l=n(6699),u=n(9297),d=n(7629),p=n(6119),h=n(421),f="Object already initialized",m=s.TypeError,y=s.WeakMap;if(o||d.state){var g=d.state||(d.state=new y);g.get=g.get,g.has=g.has,g.set=g.set,r=function(e,t){if(g.has(e))throw new m(f);return t.facade=e,g.set(e,t),t},i=function(e){return g.get(e)||{}},a=function(e){return g.has(e)}}else{var v=p("state");h[v]=!0,r=function(e,t){if(u(e,v))throw new m(f);return t.facade=e,l(e,v,t),t},i=function(e){return u(e,v)?e[v]:{}},a=function(e){return u(e,v)}}e.exports={set:r,get:i,has:a,enforce:function(e){return a(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=i(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},4376:(e,t,n)=>{"use strict";var r=n(4576);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796:(e,t,n)=>{"use strict";var r=n(9039),i=n(4901),a=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n===u||n!==l&&(i(t)?r(t):!!t)},s=o.normalize=function(e){return String(e).replace(a,".").toLowerCase()},c=o.data={},l=o.NATIVE="N",u=o.POLYFILL="P";e.exports=o},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:e=>{"use strict";e.exports=!1},757:(e,t,n)=>{"use strict";var r=n(7751),i=n(4901),a=n(1625),o=n(7040),s=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&a(t.prototype,s(e))}},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var i,a,o=n?e:e.iterator,s=e.next;!(i=r(s,o)).done;)if(void 0!==(a=t(i.value)))return a}},9539:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),a=n(5966);e.exports=function(e,t,n){var o,s;i(e);try{if(!(o=a(e,"return"))){if("throw"===t)throw n;return n}o=r(o,e)}catch(e){s=!0,o=e}if("throw"===t)throw n;if(s)throw o;return i(o),n}},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),a=n(4901),o=n(9297),s=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,p=u.get,h=String,f=Object.defineProperty,m=r("".slice),y=r("".replace),g=r([].join),v=s&&!i((function(){return 8!==f((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===m(h(t),0,7)&&(t="["+y(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!o(e,"name")||c&&e.name!==t)&&(s?f(e,"name",{value:t,configurable:!0}):e.name=t),v&&n&&o(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&o(n,"constructor")&&n.constructor?s&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return o(r,"source")||(r.source=g(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return a(this)&&p(this).source||l(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},2603:(e,t,n)=>{"use strict";var r=n(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},4913:(e,t,n)=>{"use strict";var r=n(3724),i=n(5917),a=n(8686),o=n(8551),s=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",h="writable";t.f=r?a?function(e,t,n){if(o(e),t=s(t),o(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var r=u(e,t);r&&r[h]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(o(e),t=s(t),o(n),i)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),i=n(9565),a=n(8773),o=n(6980),s=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return o(!i(a.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),i=n(9297),a=n(5397),o=n(9617).indexOf,s=n(421),c=r([].push);e.exports=function(e,t){var n,r=a(e),l=0,u=[];for(n in r)!i(s,n)&&i(r,n)&&c(u,n);for(;t.length>l;)i(r,n=t[l++])&&(~o(u,n)||c(u,n));return u}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),i=n(34),a=n(7750),o=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return a(n),o(r),i(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),i=n(4901),a=n(34),o=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&i(n=e.toString)&&!a(s=r(n,e)))return s;if(i(n=e.valueOf)&&!a(s=r(n,e)))return s;if("string"!==t&&i(n=e.toString)&&!a(s=r(n,e)))return s;throw new o("Can't convert object to primitive value")}},5031:(e,t,n)=>{"use strict";var r=n(7751),i=n(9504),a=n(8480),o=n(3717),s=n(8551),c=i([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=a.f(s(e)),n=o.f;return n?c(t,n(e)):t}},7750:(e,t,n)=>{"use strict";var r=n(4117),i=TypeError;e.exports=function(e){if(r(e))throw new i("Can't call method on "+e);return e}},9286:(e,t,n)=>{"use strict";var r=n(4402),i=n(8469),a=r.Set,o=r.add;e.exports=function(e){var t=new a;return i(e,(function(e){o(t,e)})),t}},3440:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402),a=n(9286),o=n(5170),s=n(3789),c=n(8469),l=n(507),u=i.has,d=i.remove;e.exports=function(e){var t=r(this),n=s(e),i=a(t);return o(t)<=n.size?c(t,(function(e){n.includes(e)&&d(i,e)})):l(n.getIterator(),(function(e){u(t,e)&&d(i,e)})),i}},4402:(e,t,n)=>{"use strict";var r=n(9504),i=Set.prototype;e.exports={Set,add:r(i.add),has:r(i.has),remove:r(i.delete),proto:i}},8750:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402),a=n(5170),o=n(3789),s=n(8469),c=n(507),l=i.Set,u=i.add,d=i.has;e.exports=function(e){var t=r(this),n=o(e),i=new l;return a(t)>n.size?c(n.getIterator(),(function(e){d(t,e)&&u(i,e)})):s(t,(function(e){n.includes(e)&&u(i,e)})),i}},4449:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402).has,a=n(5170),o=n(3789),s=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=o(e);if(a(t)<=n.size)return!1!==s(t,(function(e){if(n.includes(e))return!1}),!0);var u=n.getIterator();return!1!==c(u,(function(e){if(i(t,e))return l(u,"normal",!1)}))}},3838:(e,t,n)=>{"use strict";var r=n(7080),i=n(5170),a=n(8469),o=n(3789);e.exports=function(e){var t=r(this),n=o(e);return!(i(t)>n.size)&&!1!==a(t,(function(e){if(!n.includes(e))return!1}),!0)}},8527:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402).has,a=n(5170),o=n(3789),s=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=o(e);if(a(t)<n.size)return!1;var l=n.getIterator();return!1!==s(l,(function(e){if(!i(t,e))return c(l,"normal",!1)}))}},8469:(e,t,n)=>{"use strict";var r=n(9504),i=n(507),a=n(4402),o=a.Set,s=a.proto,c=r(s.forEach),l=r(s.keys),u=l(new o).next;e.exports=function(e,t,n){return n?i({iterator:l(e),next:u},t):c(e,t)}},4916:(e,t,n)=>{"use strict";var r=n(7751),i=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};e.exports=function(e){var t=r("Set");try{(new t)[e](i(0));try{return(new t)[e](i(-1)),!1}catch(e){return!0}}catch(e){return!1}}},5170:(e,t,n)=>{"use strict";var r=n(6706),i=n(4402);e.exports=r(i.proto,"size","get")||function(e){return e.size}},3650:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402),a=n(9286),o=n(3789),s=n(507),c=i.add,l=i.has,u=i.remove;e.exports=function(e){var t=r(this),n=o(e).getIterator(),i=a(t);return s(n,(function(e){l(t,e)?u(i,e):c(i,e)})),i}},4204:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402).add,a=n(9286),o=n(3789),s=n(507);e.exports=function(e){var t=r(this),n=o(e).getIterator(),c=a(t);return s(n,(function(e){i(c,e)})),c}},6119:(e,t,n)=>{"use strict";var r=n(5745),i=n(3392),a=r("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),i=n(4475),a=n(9433),o="__core-js_shared__",s=e.exports=i[o]||a(o,{});(s.versions||(s.versions=[])).push({version:"3.37.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},4495:(e,t,n)=>{"use strict";var r=n(7388),i=n(9039),a=n(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:(e,t,n)=>{"use strict";var r=n(1291),i=Math.max,a=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):a(n,t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),i=n(7750);e.exports=function(e){return r(i(e))}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},8014:(e,t,n)=>{"use strict";var r=n(1291),i=Math.min;e.exports=function(e){var t=r(e);return t>0?i(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),i=Object;e.exports=function(e){return i(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),i=n(34),a=n(757),o=n(5966),s=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!i(e)||a(e))return e;var n,c=o(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!i(n)||a(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:(e,t,n)=>{"use strict";var r=n(2777),i=n(757);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},655:(e,t,n)=>{"use strict";var r=n(6955),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,n)=>{"use strict";var r=n(9504),i=0,a=Math.random(),o=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++i+a,36)}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039);e.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:(e,t,n)=>{"use strict";var r=n(4475),i=n(4901),a=r.WeakMap;e.exports=i(a)&&/native code/.test(String(a))},8227:(e,t,n)=>{"use strict";var r=n(4475),i=n(5745),a=n(9297),o=n(3392),s=n(4495),c=n(7040),l=r.Symbol,u=i("wks"),d=c?l.for||l:l&&l.withoutSetter||o;e.exports=function(e){return a(u,e)||(u[e]=s&&a(l,e)?l[e]:d("Symbol."+e)),u[e]}},4114:(e,t,n)=>{"use strict";var r=n(6518),i=n(8981),a=n(6198),o=n(4527),s=n(6837);r({target:"Array",proto:!0,arity:1,forced:n(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=i(this),n=a(t),r=arguments.length;s(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return o(t,n),n}})},7642:(e,t,n)=>{"use strict";var r=n(6518),i=n(3440);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("difference")},{difference:i})},8004:(e,t,n)=>{"use strict";var r=n(6518),i=n(9039),a=n(8750);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("intersection")||i((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:a})},3853:(e,t,n)=>{"use strict";var r=n(6518),i=n(4449);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isDisjointFrom")},{isDisjointFrom:i})},5876:(e,t,n)=>{"use strict";var r=n(6518),i=n(3838);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSubsetOf")},{isSubsetOf:i})},2475:(e,t,n)=>{"use strict";var r=n(6518),i=n(8527);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSupersetOf")},{isSupersetOf:i})},5024:(e,t,n)=>{"use strict";var r=n(6518),i=n(3650);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("symmetricDifference")},{symmetricDifference:i})},1698:(e,t,n)=>{"use strict";var r=n(6518),i=n(4204);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("union")},{union:i})},3375:(e,t,n)=>{"use strict";n(7642)},9225:(e,t,n)=>{"use strict";n(8004)},3972:(e,t,n)=>{"use strict";n(3853)},9209:(e,t,n)=>{"use strict";n(5876)},5714:(e,t,n)=>{"use strict";n(2475)},7561:(e,t,n)=>{"use strict";n(5024)},6197:(e,t,n)=>{"use strict";n(1698)},4979:(e,t,n)=>{"use strict";var r=n(6518),i=n(4475),a=n(7751),o=n(6980),s=n(4913).f,c=n(9297),l=n(679),u=n(3167),d=n(2603),p=n(5002),h=n(6193),f=n(3724),m=n(6395),y="DOMException",g=a("Error"),v=a(y),b=function(){l(this,x);var e=arguments.length,t=d(e<1?void 0:arguments[0]),n=d(e<2?void 0:arguments[1],"Error"),r=new v(t,n),i=new g(t);return i.name=y,s(r,"stack",o(1,h(i.stack,1))),u(r,this,b),r},x=b.prototype=v.prototype,w="stack"in new g(y),C="stack"in new v(1,2),_=v&&f&&Object.getOwnPropertyDescriptor(i,y),S=!(!_||_.writable&&_.configurable),E=w&&!S&&!C;r({global:!0,constructor:!0,forced:m||E},{DOMException:E?b:v});var T=a(y),j=T.prototype;if(j.constructor!==T)for(var k in m||s(j,"constructor",o(1,T)),p)if(c(p,k)){var N=p[k],I=N.s;c(T,I)||s(T,I,o(6,N.c))}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var r={};(()=>{"use strict";n.r(r),n.d(r,{SeamlyStaticCore:()=>Lu,default:()=>zu}),n(4114);var e=n(2086),t=n.n(e),i=n(8785);class a extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.status=t?.status}}class o extends Error{action="";langKey="";constructor(e,...t){if(super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,e?.payload&&(this.originalEvent=e,this.originalError=e.payload.error,this.message=`Event of type ${e.payload.type} encountered`),!this.message&&e?.message){const t=function(e){try{return JSON.parse(e).error}catch(t){return e}}(e.message);this.message=t}e?.error&&(this.originalError=e.error)}}class s extends o{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class c extends o{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class l extends o{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class u extends o{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const d="cvco",p="seamly-client-participant",h=50,f=300;function m(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function y(e){const t=`cvco.${e}`;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let n;do{n=sessionStorage.getItem(e[0])}while(e.shift()&&!n);return n?JSON.parse(n):{}},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const g=(e,t)=>{let n;return function(...r){let i=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,i||e.apply(this,r),i=!1}),t),t=>{i=!0,t&&e.apply(this,r)}}},v=e=>Math.ceil(e/1e3),b=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},x=(e,t=2)=>{if(0===e)return"0 Bytes";const n=t<0?0:t,r=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/1024**r).toFixed(n))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}`},w={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},C={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},_=e=>e.code?C[e.code]:w[e.keyCode],S=e=>{e&&e.focus()},E=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function T(e){return"object"==typeof e}const j="message",k="text",N="text",I="upload",A="received",L="read",M="custom",O="typing",R="read",P="detach_service",D="dismiss",z="set_topic",U="click_cta",F="translation_proposal",B=F,H="window_api",$="assertive",V="polite",G={new_topic:"newTopic",new_translation:"newTranslation"},W="uploads",q="navigate";n(3375),n(9225),n(3972),n(9209),n(5714),n(7561),n(6197),n(4979);var K=e=>"function"==typeof e?e:function(){return e},J="undefined"!=typeof self?self:null,X="undefined"!=typeof window?window:null,Y=J||X||Y,Z="closed",Q="errored",ee="joined",te="joining",ne="leaving",re="phx_close",ie="phx_error",ae="phx_reply",oe="phx_leave",se="websocket",ce=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},le=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},ue=class{constructor(e,t,n){this.state=Z,this.topic=e,this.params=K(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ce(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new le((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=ee,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Z,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new ce(this,oe,K({}),this.timeout).send(),this.state=Q,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(ae,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(re,e)}onError(e){return this.on(ie,(t=>e(t)))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter((n=>!(n.event===e&&(void 0===t||t===n.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new ce(this,e,(function(){return t}),n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ne;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(re,"leave")},n=new ce(this,oe,K({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=te,this.joinPush.resend(e))}trigger(e,t,n,r){let i=this.onMessage(e,t,n,r);if(t&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let a=this.bindings.filter((t=>t.event===e));for(let e=0;e<a.length;e++)a[e].callback(i,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Z}isErrored(){return this.state===Q}isJoined(){return this.state===ee}isJoining(){return this.state===te}isLeaving(){return this.state===ne}},de=class{static request(e,t,n,r,i,a,o){if(Y.XDomainRequest){let n=new Y.XDomainRequest;return this.xdomainRequest(n,e,t,r,i,a,o)}{let s=new Y.XMLHttpRequest;return this.xhrRequest(s,e,t,n,r,i,a,o)}}static xdomainRequest(e,t,n,r,i,a,o){return e.timeout=i,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);o&&o(t)},a&&(e.ontimeout=a),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,i,a,o,s){return e.open(t,n,!0),e.timeout=a,e.setRequestHeader("Content-Type",r),e.onerror=()=>s&&s(null),e.onreadystatechange=()=>{if(4===e.readyState&&s){let t=this.parseJSON(e.responseText);s(t)}},o&&(e.ontimeout=o),e.send(i),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t?`${t}[${r}]`:r,a=e[r];"object"==typeof a?n.push(this.serialize(a,i)):n.push(encodeURIComponent(i)+"="+encodeURIComponent(a))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},pe=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,setTimeout((()=>this.poll()),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+se),"$1/longpoll")}endpointURL(){return de.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){this.ajax("GET","application/json",null,(()=>this.ontimeout()),(e=>{if(e){var{status:t,token:n,messages:r}=e;this.token=n}else t=0;switch(t){case 200:r.forEach((e=>{setTimeout((()=>this.onmessage({data:e})),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){"string"!=typeof e&&(e=(e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout((()=>{this.batchSend(this.currentBatch),this.currentBatch=null}),0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join("\n"),(()=>this.onerror("timeout")),(e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))}))}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=3;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,i){let a;a=de.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(a),r()}),(e=>{this.reqs.delete(a),this.isActive()&&i(e)})),this.reqs.add(a)}},he={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,i,a,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:i,event:a,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:i,payload:a}=e,o=this.META_LENGTH+t.length+n.length+i.length+r.length,s=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(s),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,i.length),c.setUint8(l++,r.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(i,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(s.byteLength+a.byteLength);return u.set(new Uint8Array(s),0),u.set(new Uint8Array(a),s.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,s=n.decode(e.slice(o,o+r));o+=r;let c=n.decode(e.slice(o,o+i));o+=i;let l=n.decode(e.slice(o,o+a));return o+=a,{join_ref:s,ref:null,topic:c,event:l,payload:e.slice(o,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4),s=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(s,s+r));s+=r;let l=n.decode(e.slice(s,s+i));s+=i;let u=n.decode(e.slice(s,s+a));s+=a;let d=n.decode(e.slice(s,s+o));s+=o;let p=e.slice(s,e.byteLength);return{join_ref:c,ref:l,topic:u,event:ae,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=this.HEADER_LENGTH+2,o=n.decode(e.slice(a,a+r));a+=r;let s=n.decode(e.slice(a,a+i));return a+=i,{join_ref:null,ref:null,topic:o,event:s,payload:e.slice(a,e.byteLength)}}},fe=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||Y.WebSocket||pe,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Y.sessionStorage,this.establishedConnections=0,this.defaultEncoder=he.encode.bind(he),this.defaultDecoder=he.decode.bind(he),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==pe?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;X&&X.addEventListener&&(X.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),X.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=K(t.params||{}),this.endPoint=`${e}/${se}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new le((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return pe}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=de.appendParams(de.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=K(e)),this.conn||(this.longPollFallbackMs&&this.transport!==pe?this.connectWithFallback(pe,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage((i=>{i.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n,r=!1,i=!0,a=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([void 0,n]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),n=this.onError((e=>{this.log("transport","error",e),i&&!r&&(clearTimeout(this.fallbackTimer),a(e))})),this.onOpen((()=>{if(r=!0,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping((e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)}))})),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown((()=>this.reconnectTimer.scheduleTimeout()),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()}))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&3!==this.conn.readyState?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,r])=>{r(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(ie)}))}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t!==e))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let n=new ue(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:i,join_ref:a}=e;this.log("push",`${t} ${n} (${a}, ${i})`,r)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:n,payload:r,ref:i,join_ref:a}=e;i&&i===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${i&&"("+i+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const o=this.channels[e];o.isMember(t,n,r,a)&&o.trigger(n,r,i,a)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,n]=this.stateChangeCallbacks.message[t];n(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};const me=()=>null,ye=new Set;class ge{#e=[];async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:i,params:a}=(e=>{const t=e.indexOf("?");return t<0?{url:e,params:{}}:{url:e.slice(0,t),params:e.slice(t+1).split("&").reduce((function(e,t){const[n,r]=t.split("=");return{...e,[n]:decodeURIComponent(r)}}),{})}})(this.url);this.socket=new fe(i,{params:{...a,v:"3"},reconnectAfterMs:e=>{const t=2**e*250;return Math.min(t,1e4)}}),this.socket.onError((e=>{me("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{me("[SOCKET]OPEN")})),this.socket.onClose((()=>{me("[SOCKET]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"socket_closed"})})),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName}),this.start(),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&this.#t({connected:!0,ready:!0,currentState:"attach_channel_succeeded"})})),this.channel.onClose((()=>{me("[CHANNEL]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{me("[CHANNEL][ERROR]",e),this.#t({connected:!1,ready:!1,currentState:"channel_erred"})})),this.#n("ack","ui","error","participant","message","service_data","system","info","sync")}start(){this.channel?.join().receive("ok",(()=>{me("[CHANNEL][JOIN] OK"),this.#t({connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{me("[CHANNEL][JOIN] ERROR",e),this.#t({connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{me("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){this.channel?.leave().receive("ok",(()=>{this.socket?.disconnect(),me("[CHANNEL][LEAVE] OK"),this.#e=[]}))}#n(...e){e.forEach((e=>{this.channel?.on(e,(t=>{me("[RECEIVE]",e,t)}))}))}onConnection(e){this.#e.push(e)}#t(e){this.#e=this.#e.filter((t=>!t(e))),ye.forEach((e=>e()))}pushToChannel(e,t,n=1e4){this.channel?.push(e,t,n)}static subscribe(e){return ye.add(e),()=>ye.delete(e)}}const ve=()=>null,be=async(e,t)=>{const n=new URL(e);n.searchParams.set("v","3");const r=await fetch(n.href,{mode:"cors",...t});if(!r.ok)throw new a(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function xe(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return null;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:null}class we{#r;#i;#a;#o="window";#s;conversation=new ge;constructor({layoutMode:e,namespace:t,config:n,context:r}){this.store=function(e,t){const n=t(e),r=n.get()||{};return{get:e=>void 0===e?r:r[e],set:(e,t)=>(r[e]=t,n.set(r),t),delete(e){const t=this.get(e);return delete r[e],n.set(r),t}}}(`${t}.connection${r?.userLocale?`.${r.userLocale}`:""}`,n.storageProvider||y),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},this.#s={...n,sendEnvironment:n.sendEnvironment??!0,context:{...r,channelName:r?.channelName||"web"}},this.#r=!1,this.connected=!1,this.configReady=!1,this.#i=n.externalId,e&&(this.#o=e),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}#c(){return this.store.get("accessToken")}#l(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}#u(e){this.store.set("conversationUrl",e)}hasConversation(){return!!this.getConversationUrl()}#d(){return this.store.get("channelTopic")||this.store.get("channelName")}#p(e){this.store.set("channelTopic",e)}#h=e=>e||this.locale;clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}#f(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}#m({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>(e[t]=n,e)),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversation?.disconnect&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}async#y(){if(!this.hasConversation())try{"function"==typeof this.#s?.getConversationAuthToken&&(this.#a=await this.#s.getConversationAuthToken());const e=await be(`${this.#f("http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#a?void 0:this.#i,token:this.#a})}),t=await e.json(),{conversation:n}=t,r={...n};return delete r.accessToken,delete r.channelTopic,this.#l(n.accessToken),this.#p(n.channelTopic),this.#m(t),this.URLS.conversation&&this.#u(this.URLS.conversation),this.locale=n.translation?.locale,this.userResponded=n.userResponded,r}catch(e){if(e.status>=500)throw new c(e);if(400===e.status)throw new u(e);if(404===e.status)throw new s(e);throw e}}async getConfig(){try{const e=await be(`${this.#f("http")}/client/${this.connectionInfo.apiKey}/configs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:{...this.#s.context,environment:!0===this.#s.sendEnvironment?this.getEnvironment():this.#s.sendEnvironment}})}),t=await e.json();return this.#m(t),this.configReady=!0,t.config}catch(e){if(404===e.status)throw new s(e);if(e.status>=500)throw new c(e);throw e}}async getConversation(){if(!this.hasConversation())return null;try{const e=await be(`${this.#f("http")}${this.URLS.history}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),t=await e.json();this.#m(t);const{messages:n,participants:r,activeServiceSessionId:i,activeServiceSettings:a,serviceData:o,ui:s,translation:c}=t.history;return{events:n.map((([e,t])=>({type:e,payload:{...t,type:"participant"===e?e:t.type}}))),participants:r,activeServiceSessionId:i,activeServiceSettings:a,serviceData:o,resumeConversationPrompt:!!s&&Boolean(s.resumeConversationPrompt),translationProposal:s.translationProposal,translation:c}}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw new a(e)}}async connect(){this.connected=!1;const e=await this.#y();return this.conversation.connect(`${this.#f("ws")}${this.URLS.socket}`,this.#s.context.channelName,this.#d(),this.#c()),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,this.#r=t})),e}uploadFile(e,t,n,r){const i=new FormData;i.append("upload",e);const a=new XMLHttpRequest;return a.open("POST",`${this.#f("http")}${this.URLS.uploads}`),a.setRequestHeader("Authorization",`Bearer ${this.#c()}`),a.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},a.onloadend=()=>{if(0!==a.status)if(200!==a.status&&201!==a.status||!n){if(!r)throw new Error(a.response);try{r(JSON.parse(a.response))}catch(e){r(a.response)}}else try{n(JSON.parse(a.response))}catch(e){n(a.response)}},a.send(i),a}async getConversationIntitialState(){try{const n=await be(`${this.#f("http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),r=await n.json();return this.#m(r),this.userResponded=r.conversation.userResponded,e=r.conversation,t=["accessToken","channelTopic"],Object.keys(e).reduce(((n,r)=>(t.includes(r)||(n[r]=e[r]),n)),{})}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw e}var e,t}async getTranslations(e){try{if(!this.URLS.translations)throw new s;const t=this.#h(e);if(!t)throw new c;const n=`${this.#f("http")}${this.URLS.translations}`.replace("{version}",String(4)).replace("{locale}",t),r=await be(n,{method:"GET"});return(await r.json()).translations}catch(e){if(e.status>=500)throw new c(e);throw new a(e)}}send(e,t=void 0,n=!0){!this.connected||n&&!this.#r?this.conversation?.onConnection((({connected:r,ready:i})=>(this.connected=r,this.#r=i,!!(n?i:r)&&(this.send(e,t,n),!0)))):(ve("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:i}=t;return i||(i=m()),{type:n,body:r,transactionId:i}}(e,t),1e4))}sendContext(e){const{contentLocale:t,source:n,userLocale:r,variables:i,environment:a}=e,o={};if(a&&(o.environment=a),t){if("string"!=typeof t)throw new Error("Content locale must be a string");o.contentLocale=t}if(n){if("string"!=typeof n)throw new Error("Source must be a string");o.source=n}if(r){if("string"!=typeof r)throw new Error("User locale must be a string");o.userLocale=r,this.#g(o,r)}if(i){if("object"!=typeof i)throw new Error("Variables must be an object");o.variables=i}0===Object.keys(o).length&&o.constructor===Object||this.send("context",o,!1)}#g(e,t){e.source||t==this.#s.context?.userLocale||(e.source=H)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#o,clientVersion:"23.0.6-alpha.1",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:xe(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}var Ce=Symbol.for("immer-nothing"),_e=Symbol.for("immer-draftable"),Se=Symbol.for("immer-state");function Ee(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Te=Object.getPrototypeOf;function je(e){return!!e&&!!e[Se]}function ke(e){return!!e&&(Ie(e)||Array.isArray(e)||!!e[_e]||!!e.constructor?.[_e]||Re(e)||Pe(e))}var Ne=Object.prototype.constructor.toString();function Ie(e){if(!e||"object"!=typeof e)return!1;const t=Te(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ne}function Ae(e,t){0===Le(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Le(e){const t=e[Se];return t?t.type_:Array.isArray(e)?1:Re(e)?2:Pe(e)?3:0}function Me(e,t){return 2===Le(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Oe(e,t,n){const r=Le(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Re(e){return e instanceof Map}function Pe(e){return e instanceof Set}function De(e){return e.copy_||e.base_}function ze(e,t){if(Re(e))return new Map(e);if(Pe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ie(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Se];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Te(e),t)}{const t=Te(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function Ue(e,t=!1){return Be(e)||je(e)||!ke(e)||(Le(e)>1&&(e.set=e.add=e.clear=e.delete=Fe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ue(t,!0)))),e}function Fe(){Ee(2)}function Be(e){return Object.isFrozen(e)}var He,$e={};function Ve(e){const t=$e[e];return t||Ee(0),t}function Ge(){return He}function We(e,t){t&&(Ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qe(e){Ke(e),e.drafts_.forEach(Xe),e.drafts_=null}function Ke(e){e===He&&(He=e.parent_)}function Je(e){return He={drafts_:[],parent_:He,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xe(e){const t=e[Se];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Se].modified_&&(qe(t),Ee(4)),ke(e)&&(e=Ze(t,e),t.parent_||et(t,e)),t.patches_&&Ve("Patches").generateReplacementPatches_(n[Se].base_,e,t.patches_,t.inversePatches_)):e=Ze(t,n,[]),qe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ce?e:void 0}function Ze(e,t,n){if(Be(t))return t;const r=t[Se];if(!r)return Ae(t,((i,a)=>Qe(e,r,t,i,a,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return et(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let i=t,a=!1;3===r.type_&&(i=new Set(t),t.clear(),a=!0),Ae(i,((i,o)=>Qe(e,r,t,i,o,n,a))),et(e,t,!1),n&&e.patches_&&Ve("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qe(e,t,n,r,i,a,o){if(je(i)){const o=Ze(e,i,a&&t&&3!==t.type_&&!Me(t.assigned_,r)?a.concat(r):void 0);if(Oe(n,r,o),!je(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(ke(i)&&!Be(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ze(e,i),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||et(e,i)}}function et(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ue(t,n)}var tt={get(e,t){if(t===Se)return e;const n=De(e);if(!Me(n,t))return function(e,t,n){const r=it(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!ke(r)?r:r===rt(e.base_,t)?(ot(e),e.copy_[t]=st(r,e)):r},has:(e,t)=>t in De(e),ownKeys:e=>Reflect.ownKeys(De(e)),set(e,t,n){const r=it(De(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=rt(De(e),t),o=r?.[Se];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||Me(e.base_,t)))return!0;ot(e),at(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==rt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ot(e),at(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=De(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ee(11)},getPrototypeOf:e=>Te(e.base_),setPrototypeOf(){Ee(12)}},nt={};function rt(e,t){const n=e[Se];return(n?De(n):e)[t]}function it(e,t){if(!(t in e))return;let n=Te(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Te(n)}}function at(e){e.modified_||(e.modified_=!0,e.parent_&&at(e.parent_))}function ot(e){e.copy_||(e.copy_=ze(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function st(e,t){const n=Re(e)?Ve("MapSet").proxyMap_(e,t):Pe(e)?Ve("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ge(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=tt;n&&(i=[r],a=nt);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:Ge()).drafts_.push(n),n}function ct(e){return je(e)||Ee(10),lt(e)}function lt(e){if(!ke(e)||Be(e))return e;const t=e[Se];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ze(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ze(e,!0);return Ae(n,((e,t)=>{Oe(n,e,lt(t))})),t&&(t.finalized_=!1),n}Ae(tt,((e,t)=>{nt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),nt.deleteProperty=function(e,t){return nt.set.call(this,e,t,void 0)},nt.set=function(e,t,n){return tt.set.call(this,e[0],t,n,e[0])};var ut=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,(e=>t.call(this,e,...i)))}}let r;if("function"!=typeof t&&Ee(6),void 0!==n&&"function"!=typeof n&&Ee(7),ke(e)){const i=Je(this),a=st(e,void 0);let o=!0;try{r=t(a),o=!1}finally{o?qe(i):Ke(i)}return We(i,n),Ye(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Ce&&(r=void 0),this.autoFreeze_&&Ue(r,!0),n){const t=[],i=[];Ve("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}Ee(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ke(e)||Ee(8),je(e)&&(e=ct(e));const t=Je(this),n=st(e,void 0);return n[Se].isManual_=!0,Ke(t),n}finishDraft(e,t){const n=e&&e[Se];n&&n.isManual_||Ee(9);const{scope_:r}=n;return We(r,t),Ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Ve("Patches").applyPatches_;return je(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},dt=ut.produce;ut.produceWithPatches.bind(ut),ut.setAutoFreeze.bind(ut),ut.setUseStrictShallowCopy.bind(ut),ut.applyPatches.bind(ut),ut.createDraft.bind(ut),ut.finishDraft.bind(ut);var pt=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},ft=0,mt=1;function yt(){return{s:ft,v:void 0,o:null,p:null}}function gt(e,t={}){let n=yt();const{resultEqualityCheck:r}=t;let i,a=0;function o(){let t=n;const{length:o}=arguments;for(let e=0,n=o;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}}const s=t;let c;if(t.s===mt)c=t.v;else if(c=e.apply(null,arguments),a++,r){const e=i?.deref?.()??i;null!=e&&r(e,c)&&(c=e,0!==a&&a--),i="object"==typeof c&&null!==c||"function"==typeof c?new ht(c):c}return s.s=mt,s.v=c,c}return o.clearCache=()=>{n=yt(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function vt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,a={},o=e.pop();"object"==typeof o&&(a=o,o=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);const s={...n,...a},{memoize:c,memoizeOptions:l=[],argsMemoize:u=gt,argsMemoizeOptions:d=[],devModeChecks:p={}}=s,h=pt(l),f=pt(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=c((function(){return r++,o.apply(null,arguments)}),...h),g=u((function(){i++;const e=function(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(m,arguments);return t=y.apply(null,e),t}),...f);return Object.assign(g,{resultFunc:o,memoizedResultFunc:y,dependencies:m,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var bt=vt(gt),xt=Object.assign(((e,t=bt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>xt});function wt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ct=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),_t=()=>Math.random().toString(36).substring(7).split("").join("."),St={INIT:`@@redux/INIT${_t()}`,REPLACE:`@@redux/REPLACE${_t()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_t()}`};function Et(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Tt(e,t,n){if("function"!=typeof e)throw new Error(wt(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(wt(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(wt(1));return n(Tt)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach(((e,t)=>{o.set(t,e)})))}function u(){if(c)throw new Error(wt(3));return i}function d(e){if("function"!=typeof e)throw new Error(wt(4));if(c)throw new Error(wt(5));let t=!0;l();const n=s++;return o.set(n,e),function(){if(t){if(c)throw new Error(wt(6));t=!1,l(),o.delete(n),a=null}}}function p(e){if(!Et(e))throw new Error(wt(7));if(void 0===e.type)throw new Error(wt(8));if("string"!=typeof e.type)throw new Error(wt(17));if(c)throw new Error(wt(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach((e=>{e()})),e}return p({type:St.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(wt(10));r=e,p({type:St.REPLACE})},[Ct]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(wt(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Ct](){return this}}}}}function jt(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:St.INIT}))throw new Error(wt(12));if(void 0===n(void 0,{type:St.PROBE_UNKNOWN_ACTION()}))throw new Error(wt(13))}))}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1;const o={};for(let i=0;i<r.length;i++){const s=r[i],c=n[s],l=e[s],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(wt(14));o[s]=u,a=a||u!==l}return a=a||r.length!==Object.keys(e).length,a?o:e}}function kt(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Nt(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var It=Nt(),At=Nt,Lt=(((...e)=>{const t=vt(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(je(e)?ct(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(gt),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?kt:kt.apply(null,arguments)}),Mt=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Ot(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(pn(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return Et(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Rt=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Pt(e){return ke(e)?dt(e,(()=>{})):e}function Dt(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error(pn(10));const r=n.insert(t,e);return e.set(t,r),r}var zt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let a=new Rt;return t&&("boolean"==typeof t?a.push(It):a.push(At(t.extraArgument))),a},Ut=e=>t=>{setTimeout(t,e)},Ft="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ut(10),Bt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Rt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const s=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?Ft:"callback"===e.type?e.queueNotification:Ut(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>i&&e()));return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})})("object"==typeof n?n:void 0)),r},Ht=!0;function $t(e){const t=zt(),{reducer:n,middleware:r,devTools:i=!0,preloadedState:a,enhancers:o}=e||{};let s,c;if("function"==typeof n)s=n;else{if(!Et(n))throw new Error(pn(1));s=jt(n)}if(!Ht&&r&&"function"!=typeof r)throw new Error(pn(2));if("function"==typeof r){if(c=r(t),!Ht&&!Array.isArray(c))throw new Error(pn(3))}else c=t();if(!Ht&&c.some((e=>"function"!=typeof e)))throw new Error(pn(4));let l=kt;i&&(l=Lt({trace:!Ht,..."object"==typeof i&&i}));const u=function(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(wt(15))};const o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)},s=e.map((e=>e(o)));return a=kt(...s)(i.dispatch),{...i,dispatch:a}}}(...c),d=Bt(u);if(!Ht&&o&&"function"!=typeof o)throw new Error(pn(5));let p="function"==typeof o?o(d):d();if(!Ht&&!Array.isArray(p))throw new Error(pn(6));if(!Ht&&p.some((e=>"function"!=typeof e)))throw new Error(pn(7));return Ht||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Tt(s,a,l(...p))}function Vt(e){const t={},n=[];let r;const i={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(pn(28));if(r in t)throw new Error(pn(29));return t[r]=n,i},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(r=e,i)};return e(i),[t,n,r]}var Gt=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Wt(...e){return t=>e.some((e=>((e,t)=>Mt(e)?e.match(t):e(t))(e,t)))}var qt=["name","message","stack","code"],Kt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Jt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Xt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of qt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Yt=(()=>{function e(e,t,n){const r=Ot(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),i=Ot(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),a=Ot(e+"/rejected",((e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||Xt)(e||"Rejected"),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(o,s,c)=>{const l=n?.idGenerator?n.idGenerator(e):Gt(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let a=n?.condition?.(e,{getState:s,extra:c});if(null!==(m=a)&&"object"==typeof m&&"function"==typeof m.then&&(a=await a),!1===a||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const y=new Promise(((e,t)=>{d=()=>{t({name:"AbortError",message:p||"Aborted"})},u.signal.addEventListener("abort",d)}));o(i(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:s,extra:c}))),f=await Promise.race([y,Promise.resolve(t(e,{dispatch:o,getState:s,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Kt(e,t),fulfillWithValue:(e,t)=>new Jt(e,t)})).then((t=>{if(t instanceof Kt)throw t;return t instanceof Jt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof Kt?a(null,l,e,t.payload,t.meta):a(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&a.match(f)&&f.meta.condition||o(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(Zt)})}}),{pending:i,rejected:a,fulfilled:r,settled:Wt(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Zt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Qt=Symbol.for("rtk-slice-createasyncthunk");function en(e,t){return`${e}/${t}`}function tn({creators:e}={}){const t=e?.asyncThunk?.[Qt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(pn(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(pn(12));if(n in o.sliceCaseReducersByType)throw new Error(pn(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),s),exposeAction:(e,t)=>(o.actionCreators[e]=t,s),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,s)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Vt(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return function(e,t){let a,[s,c,l]=Vt((e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}));if("function"==typeof e)a=()=>Pt(e());else{const t=Pt(e);a=()=>t}function u(e=a(),t){let n=[s[t.type],...c.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===n.filter((e=>!!e)).length&&(n=[l]),n.reduce(((e,n)=>{if(n){if(je(e)){const r=n(e,t);return void 0===r?e:r}if(ke(e))return dt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(pn(9))}return r}}return e}),e)}return u.getInitialState=a,u}(e.initialState)}a.forEach((r=>{const a=i[r],o={reducerName:r,type:en(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(a)?function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(pn(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Ot(e,o):Ot(e))}(o,a,s):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error(pn(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||an,pending:s||an,rejected:c||an,settled:l||an})}(o,a,s,t)}));const l=e=>e,u=new Map;let d;function p(e,t){return d||(d=c()),d(e,t)}function h(){return d||(d=c()),d.getInitialState()}function f(t,n=!1){function r(e){let r=e[t];return void 0===r&&n&&(r=h()),r}function i(t=l){const r=Dt(u,n,{insert:()=>new WeakMap});return Dt(r,t,{insert:()=>{const r={};for(const[i,a]of Object.entries(e.selectors??{}))r[i]=nn(a,t,h,n);return r}})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}const m={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:h,...f(r),injectInto(e,{reducerPath:t,...n}={}){const i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...m,...f(i,!0)}}};return m}}function nn(e,t,n,r){function i(i,...a){let o=t(i);return void 0===o&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var rn=tn();function an(){}var{assign:on}=Object,sn="listenerMiddleware",cn=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Ot(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(pn(21));return((e,t)=>{if("function"!=typeof e)throw new Error(pn(32))})(a),{predicate:i,type:t,effect:a}},ln=Object.assign((e=>{const{type:t,predicate:n,effect:r}=cn(e);return{id:Gt(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(pn(22))}}}),{withTypes:()=>ln}),un=Object.assign(Ot(`${sn}/add`),{withTypes:()=>un}),dn=(Ot(`${sn}/removeAll`),Object.assign(Ot(`${sn}/remove`),{withTypes:()=>dn}));function pn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");class hn extends o{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const fn=Yt("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,defaultLocale:r,preChat:i,agentParticipant:a,userParticipant:o,startChatIcon:s}=await t.getConfig(),c=n?.context?.userLocale||r,l=n?.context?.contentLocale||r,{connectWhenInView:u}=n;return{features:e,defaultLocale:r,preChat:i,agentParticipant:a,userParticipant:o,startChatIcon:s,defaultUserLocale:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})),mn=Yt("resetConfig",(async(e,{extra:{config:t}})=>t)),yn=bt((({app:e})=>e),(({userHasResponded:e})=>e)),gn="visibility",vn={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},bn=bt((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?vn.open:vn.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),xn=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:i,layoutMode:a,hideOnNoUserResponse:o}=r,{visible:s}=i||{};return"app"!==a||t?"window"===a&&o&&n!==vn.open?e?n||t||vn.open:vn.hidden:"inline"===a&&e&&!n?t||vn.open:n||t||s||vn.minimized:vn.open};var wn=n(7402),Cn=n(8418),_n=wn.default,Sn=Symbol.for("react-redux-context"),En="undefined"!=typeof globalThis?globalThis:{};function Tn(){if(!_n.createContext)return{};const e=En[Sn]??(En[Sn]=new Map);let t=e.get(_n.createContext);return t||(t=_n.createContext(null),e.set(_n.createContext,t)),t}var jn=Tn();function kn(e=jn){return function(){return _n.useContext(e)}}var Nn=kn(),In=()=>{throw new Error("uSES not initialized!")},An=(e,t)=>e===t;function Ln(e=jn){const t=e===jn?Nn:kn(e),n=(e,n={})=>{const{equalityFn:r=An,devModeChecks:i={}}="function"==typeof n?{equalityFn:n}:n,{store:a,subscription:o,getServerState:s,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(_n.useRef(!0),_n.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,i.stabilityCheck])),d=In(o.addNestedSub,a.getState,s||a.getState,u,r);return _n.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var Mn=Ln();Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen"),Symbol.for("react.client.reference");var On={notify(){},get:()=>[]};var Rn=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Pn="undefined"!=typeof navigator&&"ReactNative"===navigator.product,Dn=Rn||Pn?_n.useLayoutEffect:_n.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var zn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",identityFunctionCheck:a="once"}){const o=_n.useMemo((()=>{const t=function(e,t){let n,r=On,i=0,a=!1;function o(){l.onStateChange&&l.onStateChange()}function s(){i++,n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){r&&null!==e&&(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}())}function c(){i--,n&&0===i&&(n(),n=void 0,r.clear(),r=On)}const l={addNestedSub:function(e){s();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,s())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:i,identityFunctionCheck:a}}),[e,r,i,a]),s=_n.useMemo((()=>e.getState()),[e]);Dn((()=>{const{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[o,s]);const c=t||jn;return _n.createElement(c.Provider,{value:o},n)};function Un(e=jn){const t=e===jn?Nn:kn(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Fn=Un();function Bn(e=jn){const t=e===jn?Fn:Un(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Hn,$n=Bn();Hn=Cn.useSyncExternalStoreWithSelector,In=Hn,wn.useSyncExternalStore;const Vn=()=>Mn(bn),Gn=({state:e})=>e,Wn=()=>Mn(Gn),qn=bt(Gn,bn,yn,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),Kn=bt(qn,bn,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,i)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const a=i[n-1];if(!t?.occurredAt||!a.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const o=v(t.occurredAt-a.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:o}}})):e})),Jn=()=>Mn(Kn),Xn=(bt(Kn,(e=>e.map((e=>e.payload.id)))),()=>Wn().isLoading),Yn=()=>Wn().unreadEvents,Zn=()=>Wn().skiplinkTargetId,Qn=()=>Wn().serviceInfo,er=bt(Kn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),tr=()=>{const{participants:e,currentAgent:t}=Wn().participantInfo;return t?e[t]:null},nr=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=Wn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},rr=()=>{const{layoutMode:e}=Vn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},ir=bt((({visibility:e})=>e),(e=>e.visibility)),ar=bt((({visibility:e})=>e),(e=>e.showInlineView)),or=[vn.open,vn.minimized,vn.hidden],sr=Yt("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const i=t(),a=ir(i),o=yn(i),s=n.hasConversation(),c=bn(i),{visibilityCallback:l=xn,layoutMode:u}=c,{unreadEvents:d}=Gn(i),p=l({hasResponded:o,previousVisibility:a,requestedVisibility:e,config:c});if(p&&!or.includes(p))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),null;if(a===p)return null;const h=n.store.get(gn);return n.store.set(gn,{...h||{},[u]:e}),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:s,hasResponded:o,unreadMessageCount:d}),p})),cr=Yt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:i}=bn(n()),a=r.store.get(gn)?.[i]||vn.initialize;return t(sr(a)),a})),lr=Yt("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{let i=n?.context?.contentLocale,a=n?.context?.userLocale;const o=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=await t.getConversationIntitialState();return i=e.context?.contentLocale||i,a=e.context?.userLocale||a,t.sendContext({...e.context,environment:o}),{initialState:e,contentLocale:i,userLocale:a,config:n}}return n?.context?.topic&&t.send("action",{type:z,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext({...n.context,environment:o}),{initialState:void 0,contentLocale:i,userLocale:a,config:n}}catch(e){if(e instanceof l){const e=new l;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new hn;return r({name:t.name,message:t.message,langKey:t.langKey})}})),ur=((e,t,n)=>{const{wait:r=300,maxWait:i=0,leading:a=!1}=n??{};let o,s=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,o&&(o(!0),o=void 0)};return Yt(e,t,{condition:()=>{const e=a&&!s;return s&&clearTimeout(s),s=setTimeout((()=>{l(),s=null}),r),!!e||(o&&(o(!1),o=void 0),i&&!c&&(c=setTimeout(l,i)),new Promise((e=>{o=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(mn()),await t(fn()),await t(lr()),t(cr())}),{wait:2e3,leading:!0}),dr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],pr=(e,t)=>{const{messages:n,...r}=(i=t,dr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{}));var i;let a=e;return Object.keys(r).length>0&&(a={...a,...r}),n&&(a={...a,messages:{...a.messages,...n}}),a},hr=rn({name:"config",initialState:{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}},api:{domain:"",key:"",secure:!0,sendEnvironment:!0},context:{},notificationAudioURL:void 0,hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showSuggestions:!0,preChat:{enterDelay:1e3,exitAfter:4e3},continueChat:{enterDelay:0,exitAfter:2e3},customComponents:{},defaults:{visible:null},preChatEvents:[],parentElement:void 0,layoutMode:"window"},reducers:{setConfig:(e,{payload:t})=>pr(e,t),updateConfig:(e,{payload:t})=>pr(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(mn.fulfilled,(e=>e)).addCase(fn.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:i,defaultUserLocale:a,defaultContentLocale:o}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.userLocale=a,e.context.contentLocale=o,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=i}))}}),{setConfig:fr,updateConfig:mr,setPreChatEvents:yr}=hr.actions,gr=hr.reducer,vr={userHasResponded:!1},br=rn({name:"app",initialState:vr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>vr)).addCase(lr.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:xr}=br.actions,wr=br.reducer;class Cr extends o{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const _r={SeamlyGeneralError:c,SeamlyConfigurationError:s,SeamlySessionExpiredError:l,SeamlyOfflineError:Cr,SeamlyUnauthorizedError:u,SeamlyUnavailableError:hn},Sr=Ot("catch-error",(e=>({payload:e}))),Er={controls:{}},Tr={touched:!1},jr={controls:Tr},kr=rn({name:"forms",initialState:jr,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...Er,persistData:t}:{...Er,persistData:t};e[n]=r},deregisterForm:(e,{payload:{formId:t}})=>(e[t]?.persistData||delete e[t],e),registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:Tr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const i={...r.controls};return delete i[t],{...e,[n]:{...r,controls:i}}},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{e[t]?.controls&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{e[t]?.controls[n]&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(ur.pending,(()=>jr))}}),{registerForm:Nr,deregisterForm:Ir,registerControl:Ar,deregisterControl:Lr,updateControlValue:Mr,updateControlTouched:Or}=kr.actions,Rr=kr.reducer,Pr=Yt("setLocale",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return{translations:await t.getTranslations(e),userLocale:e}}catch(e){return n(e)}}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),Dr={translations:{"errors.configError.message":"We are sorry this happened, please retry at a later time.","errors.configError.srText":"A chat configuration error occurred. Our apologies, please retry at a later time.","errors.configError.title":"Chat configuration error.","errors.general.buttonText":"Restart chat","errors.general.message":"Do you want to start a new chat session?","errors.general.srText":"Something went wrong with the chat session. You can restart the chat.","errors.general.title":"Something went wrong","errors.seamlyOffline.message":"There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.","errors.seamlyOffline.srText":"The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.","errors.seamlyOffline.title":"Connection issues","errors.seamlyUnavailable.buttonText":"Try again","errors.seamlyUnavailable.message":"The server could not be reached. Try again in a little while.","errors.seamlyUnavailable.srText":"The chat server could not be reached. Try again in a little while.","errors.seamlyUnavailable.title":"Server unavailable"},isLoading:!1,initialLocale:void 0,userLocale:void 0},zr=rn({name:"app",initialState:Dr,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Dr)).addCase(fn.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(Pr.pending,(e=>{e.isLoading=!0})).addCase(Pr.rejected,(e=>{e.isLoading=!1})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t?.translations&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>{if(!t.translations)return e;const r=t.translations[n];return e[n]=r,e}),{}))}))}}),{setInitialLocale:Ur,setTranslations:Fr}=zr.actions,Br=zr.reducer,Hr=Yt("getConversation",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return t.getConversation()}catch(e){return n({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError})}}),{condition(e,{getState:t}){const{state:{events:n}}=t(),r=n[n.length-1],i=e?.lastEvent?.id;return r&&i!==r.payload.id}}),$r={error:void 0},Vr=rn({name:"interrupt",initialState:$r,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>$r},extraReducers:e=>{e.addCase(fn.pending,(()=>$r)).addMatcher(Wt(lr.rejected,fn.rejected,Pr.rejected,sr.rejected,cr.rejected,Hr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Gr,clearInterrupt:Wr}=Vr.actions,qr=Vr.reducer,Kr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],Jr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===j&&!t.fromClient||"info"===e&&t.type===k,Xr=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),Yr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:i,name:a,introduction:o}=t.participant,s=n[r],c={...n,[r]:s?{...s,...i?{avatar:i}:{},...a?{name:a}:{},...o?{introduction:o}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Zr=(e,t)=>{const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{},{blockAutoEntrySwitch:r}=e,i=t?.payload?.actions||{},a=t?.payload?.translatedActions||{};if(!n)return{...e,optionsOverride:{},actions:i,translatedActions:a};const{type:o,options:s}=n;let c=e.active;return r||o===e.userSelected||(c=o),{...e,active:c,optionsOverride:{...e.optionsOverride||{},...o?{[o]:s}:{}},actions:i,translatedActions:a}},Qr={events:[],isLastEventFromClient:!1,initialState:{userResponded:!1},unreadEvents:0,userHasResponded:!1,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1,remaining:void 0,wasStopped:void 0,count:void 0,timer:void 0},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:"",proactiveMessages:!1},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:m(),optionsButtonId:m(),headerCollapseButtonId:m(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:N,active:N,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{},actions:{},translatedActions:{}},seamlyContainerElement:null},ei=rn({name:"store",initialState:Qr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,i=e.options.features.hasOwnProperty(W);let a={...e.options};if(i&&(n===j||"participant"===n)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;a={...a,features:{...a.features,uploads:{enabled:a.features.uploads?.enabled||!1,...a.features?.uploads||{},enabledFromEntry:e===I}}}}const o=Jr(t.payload);if(e.events.find((e=>e.payload.id===r.id)))return;const s=Zr(e.entryMeta,t.payload);e.entryMeta=i||s.active!==I?s:{...e.entryMeta},e.options=a,o&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?L:A)),t.payload.payload.key=m(),e.events.push(t.payload),r.fromClient&&(e.isLastEventFromClient=r.fromClient)},ackEvent:(e,{payload:{payload:t}})=>{if(!t.transactionId)return void console.warn("ACK received without transaction ID.");const n=e.events.find((e=>e.payload.transactionId===t.transactionId&&(!t.type||e.type===t.type))),{id:r,occurredAt:i}=t;n&&(n.payload.id=r,n.payload.occurredAt=i,e.events=Xr(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(e.payload.id&&-1!==t.indexOf(e.payload.id)&&(e.payload={...e.payload,..."service_data"!==e.type&&e.payload.messageStatus===A&&{messageStatus:L}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:i,serviceData:a,resumeConversationPrompt:o}})=>{const s=((e,t)=>{const n=e.filter((e=>"message"===e.type&&!e.payload.optimisticallyInjected&&!t.some((t=>t.payload.id===e.payload.id)))),r=t.filter((e=>!("participant"===e.type&&!e.payload.participant?.introduction))).reverse();return Xr([...r,...n])})(e.events,t),c={...e.participantInfo.participants,...n},l=s.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let u=null;l&&("message"===l.type&&(u=l.payload.participant),"participant"===l.type&&(u=l.payload.participant?.id));const{entry:d}=i,p=d?.options?.upload,h=Zr({...e.entryMeta,...d,active:d?.default||k,options:{...d?.options?d.options:{}}},s[s.length-1]);let f={...e.options.features};const m=f.hasOwnProperty(W);if(m&&"message"===l?.type){const{payload:e}=l,t=e?.entry?.type||{};f={...f,uploads:{enabled:!(!p||!p?.enabled),enabledFromEntry:t===I}}}e.unreadEvents=s.filter((e=>"message"===e.type&&e.payload.messageStatus===A)).length,e.events=s.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...u?Yr(e.participantInfo,{participant:c[u]}):{},participants:c},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,activeServiceSessionId:r,proactiveMessages:i?.proactiveMessages?.enabled||!1},e.serviceData={...e.serviceData,...a},e.options={...e.options,features:f},e.entryMeta=m||h.active!==I?h:{...e.entryMeta},e.resumeConversationPrompt=o||!1,u&&(e.headerTitles.subTitle=c[u].name)},resetHistoryLoadedFlag:e=>{e.historyLoaded=!1},setIsLoading:(e,{payload:t})=>{e.isLoading=t},initIdleDetachCountdown:(e,{payload:t})=>{const{delaySeconds:n,delayTime:r}=t;e.idleDetachCountdown={hasCountdown:!0,isActive:!0,wasStopped:!1,count:n,remaining:n,timer:r}},decrementIdleDetachCountdownCounter:e=>{const{idleDetachCountdown:t}=e,{remaining:n=0}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=b(r)},stopIdleDetachCountdownCounter:e=>{e.idleDetachCountdown.isActive=!1,e.idleDetachCountdown.wasStopped=!0},clearIdleDetachCountdown:e=>{e.idleDetachCountdown.hasCountdown=!1,e.idleDetachCountdown.isActive=!1},initResumeConversationPrompt:e=>{e.resumeConversationPrompt=!0},clearResumeConversationPrompt:e=>{e.resumeConversationPrompt=!1},setParticipant:(e,{payload:t})=>{e.participantInfo=Yr(e.participantInfo,{participant:t.participant,fromClient:t.fromClient})},setActiveService:(e,{payload:t})=>{e.serviceInfo.activeServiceSessionId!==t&&(e.serviceInfo.activeServiceSessionId=t)},setHeaderTitle:(e,{payload:t})=>{e.headerTitles.title=t},setHeaderSubTitle:(e,{payload:t})=>{e.headerTitles.subTitle=t},setInitialState:(e,{payload:t})=>{e.initialState=t,e.unreadEvents=Qr.unreadEvents},setServiceDataItem:(e,{payload:t})=>{e.serviceData[t.type]=t},setFeatures:(e,{payload:t})=>{t.features&&(e.options.features=t.features)},setFeatureEnabledState:(e,{payload:t})=>{e.options.features.hasOwnProperty(t.key)&&(e.options.features[t.key].enabled=t.enabled)},clearFeatures:e=>{e.options.features={webNotifications:e.options.features.webNotifications}},showOption:(e,{payload:t})=>{e.options.panelActive=!0,e.options.optionActive=t},hideOption:e=>{e.options.panelActive=!1,e.options.optionActive=""},setUserSelectedOptions:(e,{payload:t})=>{e.options.userSelectedOptions=t},setUserSelectedOption:(e,{payload:t})=>{const{option:n,value:r}=t;e.options.userSelectedOptions[n]=r},setBlockAutoEntrySwitch:(e,{payload:t})=>{e.entryMeta.blockAutoEntrySwitch=t},setServiceEntryMetadata:(e,{payload:t})=>{e.entryMeta.active=t.default,e.entryMeta.options=t.options||{},e.entryMeta.optionsOverride={},e.entryMeta.actions={},e.entryMeta.translatedActions={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},clearAbortTransaction:e=>{e.entryMeta.actions={},e.entryMeta.translatedActions={}},registerUpload:(e,{payload:t})=>{e.currentUploads.push({id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle})},setUploadProgress:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}:e))},startProcessingImage:(e,{payload:t})=>{e.processingFileUploads.push(t)},doneProcessingImage:(e,{payload:t})=>{e.processingFileUploads=e.processingFileUploads.filter((e=>e!==t))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,error:t.errorText,progress:0,uploading:!1,uploadHandle:null}:e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?{...e,complete:!0}:e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t},setProactiveMessages:(e,{payload:t})=>{e.serviceInfo.proactiveMessages=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Qr)).addCase(lr.pending,(e=>{e.isLoading=!0})).addCase(fn.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name,t.features&&(e.options.features=t.features)})).addCase(lr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Wt(ui,di),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:ti,addEvent:ni,clearAllUploads:ri,clearEvents:ii,clearFeatures:ai,clearIdleDetachCountdown:oi,clearResumeConversationPrompt:si,decrementIdleDetachCountdownCounter:ci,hideOption:li,initIdleDetachCountdown:ui,initResumeConversationPrompt:di,registerUpload:pi,resetHistoryLoadedFlag:hi,setActiveEntryType:fi,setActiveService:mi,setBlockAutoEntrySwitch:yi,setEventsRead:gi,setFeatureEnabledState:vi,setFeatures:bi,setHeaderSubTitle:xi,setHeaderTitle:wi,setHistory:Ci,setInitialState:_i,setIsLoading:Si,setLoadedImageEventIds:Ei,setParticipant:Ti,setSeamlyContainerElement:ji,setServiceDataItem:ki,setServiceEntryMetadata:Ni,clearAbortTransaction:Ii,setUploadComplete:Ai,setUploadError:Li,setUploadProgress:Mi,startProcessingImage:Oi,doneProcessingImage:Ri,setUserEntryType:Pi,setUserSelectedOption:Di,setUserSelectedOptions:zi,showOption:Ui,stopIdleDetachCountdownCounter:Fi,setProactiveMessages:Bi}=ei.actions,Hi=ei.reducer,$i={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Gt(),translatedEventGroups:{},translationProposal:null},Vi=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},i,a)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return a.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,i]]=Object.entries(n);return{lastGroupId:e.filter((e=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:i}},Gi=rn({name:"translation",initialState:$i,reducers:{enableTranslation:(e,{payload:t})=>{e.isActive=!0,e.currentLocale=t},disableTranslation:e=>{e.isActive=!1,e.currentLocale=void 0},enableEventsTranslation:(e,{payload:{events:t,id:n}})=>{delete e.translatedEventGroups[n];const{lastGroupId:r}=Vi(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:i,eventIds:a}=Vi(t,n);e.lastGroupId=r,e.translatedEventGroups[i]=a},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>$i)).addCase(fn.fulfilled,((e,{payload:t})=>{const n=t?.features?.translation;n?.languages&&(e.isAvailable=!0===n.enabled,e.languages=[...n.languages].sort(((e,n)=>e.locale===t.defaultUserLocale?-1:n.locale===t.defaultUserLocale?1:e.nativeName?.localeCompare(n.nativeName||"",void 0,{sensitivity:"base"})||0)))})).addCase(Ci,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(ni,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:Wi,disableTranslation:qi,enableEventsTranslation:Ki,disableEventsTranslation:Ji,setTranslationProposalPrompt:Xi,disableTranslationProposalPrompt:Yi}=Gi.actions,Zi=Gi.reducer,Qi=({dispatch:e})=>t=>n=>{const r=t(n);if(Ci.match(n)&&n.payload?.translation?.enabled)return e(Wi(n.payload.translation.locale)),e(Pr(n.payload.translation.locale)),r;if(fn.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(Pr(n.payload.defaultUserLocale)),r;if(lr.fulfilled.match(n))return n.payload.userLocale&&e(Pr(n.payload.userLocale)),r;if(ni.match(n)&&"info"===n.payload.type&&n.payload.payload.body&&"subtype"in n.payload.payload.body&&"new_translation"===n.payload.payload.body.subtype){const{body:t}=n.payload.payload;if(t.translationLocale&&t.translationEnabled)return e(Pr(t.translationLocale)),r}return r},ea=rn({name:"visibility",initialState:{visibility:vn.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(sr.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(fn.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:ta}=ea.actions,na=ea.reducer,ra=jt({state:Hi,app:wr,config:gr,i18n:Br,translations:Zi,visibility:na,forms:Rr,interrupt:qr});const ia=$n;var aa=n(1162);function oa(e=""){const t=e=>/\s/.test(e),n=[],r={};let i=0,a=null,o=!1,s=0;for(;s<e.length;){if(o&&(t(e[s])||"{"===e[s]))o=!1,a=e.slice(i,s),"{"===e[s]&&s--;else if(!o&&!t(e[s])){const t="{"===e[s];if(a&&t){const t=sa(e,s);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[a]=e.slice(s+1,t),s=t,a=null}else a&&(n.push(a),a=null),o=!0,i=s}s++}return o&&(a=e.slice(i)),a&&n.push(a),{args:n,cases:r}}function sa(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if("}"===t){if(0===n)return r;n--}else"{"===t&&n++}return-1}function ca(e){return la(e.slice(1,-1),",",3)}function la(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let i=e.indexOf(t);if(-1===i)return r.push(e),r;let a=e.substring(0,i).trim(),o=e.substring(i+t.length+1).trim();return r.push(a),la(o,t,n-1,r)}let ua,da=0;const pa="other";function ha(e,t){let n=0,r="",i=0;const a={};for(;n<e.length;){if("#"!==e[n]||i)r+=e[n];else{let e="__hashToken"+da++;r+=`{${e}, number}`,a[e]=t}"{"===e[n]?i++:"}"===e[n]&&i--,n++}return{caseBody:r,numberValues:a}}const fa="other",ma=bt((({i18n:e})=>e),(({translations:e})=>e)),ya=bt((({i18n:e})=>e),(({initialLocale:e})=>e)),ga=bt((({i18n:e})=>e),(({userLocale:e})=>e)),va=bt((({i18n:e})=>e),(({isLoading:e})=>e)),ba=new class{constructor(e,t={}){this.locale=e,this.typeHandlers=t}format=function(e){const t={};return function(...n){let r=n.length?n.map((e=>null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e))).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,r))return t[r];let i=e(...n);return t[r]=i,i}}(((e,t={})=>this.process(e,t).flat(1/0).join("")));process(e,t={}){if(!e)return[];let n=e.indexOf("{");if(-1!==n){let r=sa(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let i=e.substring(n,r+1);if(i){let a=[],o=e.substring(0,n);o&&a.push(o);let[s,c,l]=ca(i),u=t[s];null==u&&(u="");let d=c&&this.typeHandlers[c];a.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&a.push(this.process(p,t)),a}}}return[e]}}("en-GB",{plural:function(e,t,n,r,i){const{args:a,cases:o}=oa(t);let s=parseInt(e);a.forEach((e=>{e.startsWith("offset:")&&(s-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==ua&&ua.resolvedOptions().locale===n||(ua=new Intl.PluralRules(n));const e=ua.select(s);e!==pa&&c.push(e)}1===s&&c.push("one"),c.push(`=${s}`,pa);for(let e=0;e<c.length;e++){const t=c[e];if(t in o){const{caseBody:e,numberValues:n}=ha(o[t],s);return i(e,{...r,...n})}}return e},select:function(e,t,n,r,i){const{cases:a}=oa(t);return e in a?i(a[e],r):fa in a?i(a[fa],r):e}});function xa(){const e=Mn(ma),t=Mn(ga),n=Mn(ya),r=Mn(va);return{t:(0,aa.useCallback)(((n,i={})=>{if(!e)return"";const a=e[n];return a?ba.format(a,i):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const wa=()=>{const e=ia(),t=Mn(ir),n=!!t&&t!==vn.hidden,r=t===vn.open,i=t===vn.minimized,a=(0,aa.useCallback)((t=>e(sr(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:i,visible:t,setVisibility:a,openChat:()=>{a(vn.open)},closeChat:()=>{a(vn.minimized)}}},Ca=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,i.createRef)()})=>{const[r,a]=(0,aa.useState)(null),o=!!r?.isIntersecting||!t,s=o&&e,c=([e])=>a(e);return(0,aa.useEffect)((()=>{const e=n?.current;if(!window.IntersectionObserver||s||!e||!t)return()=>{};const r=new IntersectionObserver(c,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,s]),{isVisible:o,containerRef:n}},_a=()=>Mn(yn),Sa=(0,i.createContext)(null),Ea=(0,i.createContext)(null),Ta=(0,i.createContext)(null),ja=()=>{const e=(0,aa.useContext)(Ea);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},ka=()=>{const e=(0,aa.useContext)(Sa);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},Na=()=>ka().store,Ia=()=>{const e=ka();return(0,aa.useCallback)((()=>e.hasConversation()),[e])},Aa=()=>{const e=ka(),t=ia(),n=ja(),r=_a(),i=Ia(),{visible:a,setVisibility:o}=wa(),s=Yn(),c=(0,aa.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,aa.useCallback)((()=>{c("ui.beforeStart",{visibility:a,hasConversation:i(),hasResponded:r,unreadMessageCount:s}),e.send("start"),c("ui.start",{visibility:a,hasConversation:i(),hasResponded:r,unreadMessageCount:s})}),[e,c,i,r,s,a]),u=(0,aa.useCallback)((async()=>{await t(ur())}),[t]),d=(0,aa.useCallback)((e=>({type:e,id:m(),transactionId:m(),participant:p,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,aa.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,aa.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const i={...h(n),...r};e.send("message",i),c("message",i),t(ni({type:"message",payload:{...i,optimisticallyInjected:!0}}))}),[e,t,c,h]),y=(0,aa.useCallback)(((e,n=m())=>{t(ni({type:"message",payload:{...h(e),transactionId:n}}))}),[t,h]),g=(0,aa.useCallback)(((e,n,r,i,a,o,s)=>{t(ni({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:p,fromClient:!0,occurredAt:r,body:{contentType:i,filename:a,filesize:o,url:s}}}))}),[t]),v=(0,aa.useCallback)(((e,n=m())=>{t(ni({type:"info",payload:{body:{subtype:e},fromClient:!1,fromHistory:!0,id:m(),transactionId:n,type:"divider"}}))}),[t]),b=(0,aa.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==O&&n!==R&&c(`action.${n}`,t)}),[e,c]),x=(0,aa.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,aa.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(_i(e)),e.userResponded&&(t(xr(e.userResponded)),o(vn.open)))})).catch((e=>{t(Gr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,o]);return{connect:w,start:l,sendMessage:f,sendAction:b,sendContext:x,reset:u,emitEvent:c,addMessageBubble:y,addUploadBubble:g,addDivider:v,apiConnected:e.connected,apiConfigReady:e.configReady}},La=()=>{const e=(()=>{const e=(0,aa.useContext)(Ta);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,aa.useCallback)((t=>{t&&e({ariaLive:V,messageText:t})}),[e]),sendAssertive:(0,aa.useCallback)((t=>{t&&e({ariaLive:$,messageText:t})}),[e])}},Ma=bt((({interrupt:e})=>e),(({error:e})=>e)),Oa=bt(Ma,(e=>Boolean(e)));function Ra(){const{t:e}=xa(),t=Mn(Ma);return{hasError:Mn(Oa),meta:(0,aa.useMemo)((()=>{if(!t)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0,action:void 0};const{langKey:n,action:r}=t,i=e(`${n}.title`),a=e(`${n}.message`),o=e(`${n}.srText`),s=r?e(`${n}.buttonText`):null;return{...n?{title:i,message:a,srText:o}:{},...r?{action:r}:{},...r&&n?{buttonText:s}:{},originalError:t}}),[t,e]),error:t}}const Pa=require("preact/compat"),Da=require("preact/jsx-runtime"),za=({children:e})=>((()=>{const{t:e}=xa(),{isInline:t,isWindow:n,isApp:r}=rr(),{isOpen:i,isVisible:a}=wa(),o=Mn(ar),{start:s,connect:l,apiConfigReady:u,apiConnected:d}=Aa(),p=(0,aa.useRef)(!1),{sendAssertive:h}=La();!function(){const{meta:{originalError:e,action:t}}=Ra(),n=ia(),{reset:r}=Aa(),i="SeamlySessionExpiredError"===e?.name,a=(0,aa.useRef)(0),o=(0,aa.useRef)(null);(0,aa.useEffect)((()=>{if(i&&"reset"===t){if(a.current>=10){o.current=setTimeout((()=>{a.current=0}),1e4);const e=new c;return n(Gr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}a.current+=1,r()}return()=>{o.current&&clearTimeout(o.current)}}),[t,r,i,n])}(),(0,aa.useEffect)((()=>{a&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[a,h,e]),(0,aa.useEffect)((()=>{a&&h(e(i?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[i,a,h,e]),(0,aa.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,aa.useCallback)((async()=>{d||(p.current=!0,await l()),(r||i||a&&t)&&s()}),[d,l,r,t,i,a,s]);(0,aa.useEffect)((()=>{!u||p.current||n&&!i||!(!t||a&&o)||f()}),[u,f,t,i,a,n,o])})(),(0,Da.jsx)(Da.Fragment,{children:e})),Ua=(0,i.createContext)(null),Fa=(e=0)=>new Promise((t=>{setTimeout(t,e)})),Ba=()=>{const{seamlyContainerElement:e}=Wn(),t=ia();return[e,(0,aa.useCallback)((e=>{t(ji(e))}),[t])]},Ha=e=>(0,aa.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await Fa(180);const e="string"==typeof t?document.getElementById(t):t;S(e)}))}),[e]),$a=()=>{const e=Zn();return Ha(e)},Va=e=>bt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function Ga(){const{sendContext:e}=Aa(),t=ia(),n=Vn(),r=(0,aa.useCallback)(((t,n)=>{e({userLocale:t,source:n})}),[e]),i=(0,aa.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(qi())}),[n.context?.contentLocale,t,e]),{languages:a,isActive:o,isAvailable:s,currentLocale:c}=Mn((({translations:e})=>e));return{languages:a,isActive:o,isAvailable:s,currentLocale:c,enableTranslations:r,disableTranslations:i}}const Wa=e=>{const t=Mn(Va(e));if(!e?.payload)return{body:void 0,hasTranslation:!1,isTranslated:!1,locale:""};const n=e.payload?.translatedBody&&"data"in e.payload.translatedBody?e.payload?.translatedBody.data:e.payload.translatedBody,{translation:r,body:i}={body:e.payload?.body,translation:e.payload?.translation},a=!!n;return{body:t&&a?n:i,hasTranslation:a,isTranslated:t&&a,locale:r?.locale}};function qa(e){const{languages:t}=Ga();return(0,aa.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const Ka=()=>{const{isActive:e,languages:t}=Ga(),n=ia(),{sendAction:r}=Aa(),{translationProposal:i}=Mn((e=>e.translations)),{enableTranslations:a}=Ga(),{isOpen:o}=wa(),{userLocale:s}=xa(),c=i?.proposedLocale,l=qa(c),u=(0,aa.useMemo)((()=>null!==i&&!e&&o&&s!==c&&t.some((e=>e.locale===c))),[i,e,o,s,c,t]);return{activateTranslationProposal:()=>{a(i?.proposedLocale,B)},dismissTranslationProposal:()=>{r({type:D,body:{type:F}}),n(Yi())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:i}},Ja=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e?.split(" "))).flat().filter((e=>e&&e.length)).map((e=>e&&e.indexOf(d)>-1?e:[d,e].join("-"))).join(" "),Xa=()=>Vn().appContainerClassNames,Ya=e=>{const{fromClient:t}=e.payload,n=["message"];return"info"===e.type?n.push("message--source-info"):t?n.push("message--source-user"):n.push("message--source-agent"),n},Za=(0,i.createContext)(null),Qa=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=Wn(),{allowedMimeTypes:i,maxSize:a}=n.upload||{},{enabled:o,enabledFromEntry:s}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...i?{allowedMimeTypes:i}:{},...a?{maxSize:a}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:s||o,allowedMimeTypes:c,maxSize:l}},eo=()=>{const{currentUploads:e}=Wn(),t=ia(),n=(()=>{const e=(0,aa.useContext)(Za);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,aa.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,aa.useCallback)((()=>{t(ri())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},to=()=>{const{t:e}=xa(),{options:t}=Wn(),{panelActive:n,optionActive:r,userSelectedOptions:i,features:a}=t,{extraMenuItem:o,sendTranscript:s}=a,c={extraMenuItem:o,sendTranscript:s},l=t=>"extraMenuItem"===t?"Extra menu item":e(`options.${t}.menuTitle`),u=Object.keys(c).filter((e=>c[e])).map((e=>({name:e,title:l(e),available:c[e].enabled}))),d=o||s,p=ia(),{get:h,set:f}=Na();return{allowOptionSelection:d,userSelectedOptions:i,features:a,menuOptions:u,initUserSelectedOptions:(0,aa.useCallback)((()=>{const e=h("options")||{};p(zi(e))}),[h,p]),setUserSelectedOptions:(0,aa.useCallback)((e=>{p(zi(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,aa.useCallback)(((e,t)=>{const n=h("options")||{};"object"==typeof n&&f("options",{...n,[e]:t}),p(Di({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(Ui(e))},hideOption:()=>{p(li())},panelActive:n,optionActive:r}},no=()=>{const{optionsButtonId:e}=Wn();return{id:e,focusButton:Ha(e)}},ro=(0,i.createContext)(null),io=()=>{const e=(0,aa.useContext)(ro);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},ao=()=>{const e=ia(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:i,timer:a,wasStopped:o}}=Wn(),{isOpen:s}=wa(),{emitEvent:c,sendAction:l}=Aa(),{t:u}=xa(),{sendAssertive:d,sendPolite:p}=La(),h=(0,aa.useCallback)((e=>{s&&d(e)}),[s,d]),f=(0,aa.useCallback)((e=>{s&&p(e)}),[s,p]),m=(0,aa.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=b(n);e(ui({delaySeconds:n,delayTime:r})),c("idleTimer.start"),h(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,h,u]),y=(0,aa.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:P}),h(u("idleDetachWarning.notifyTransferText"))),o||c("idleTimer.stop"),e(oi()))}),[e,c,t,l,h,u,o]),g=(0,aa.useCallback)((()=>{if(!i||i<=0)return;const t=i-1;t%10==0&&h(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",b(t))}`),e(ci())}),[e,i,h,u]),v=(0,aa.useCallback)((()=>{n&&(e(Fi()),i&&(c("idleTimer.stop"),f(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,i,f,u]);return{hasCountdown:t,isActive:n,count:r,remaining:i,timer:a,wasStopped:o,initCountdown:m,endCountdown:y,decrementCountdown:g,stopCountdown:v}},oo=()=>{const e=ia(),t=Wn().resumeConversationPrompt,{sendAction:n}=Aa(),{t:r}=xa(),{sendAssertive:i}=La();return{continueChat:()=>{n({type:D,body:{type:"resume_conversation_prompt"}}),e(si())},hasPrompt:t,restartChat:()=>{i(r("resumeConversationPrompt.srNotifyRestartText")),n({type:P}),e(si())}}},so=()=>{const[e]=(0,aa.useState)((()=>m()));return e},co=({eventPayload:e})=>{const{t}=xa(),{fromClient:n,participant:r}=e,i=(e=>Wn().participantInfo.participants[e])(r)||{},{messages:a}=Vn(),o=n?t("participants.user.name"):i&&i.name,{showAvatar:s,showName:c}=a&&a[n?"user":"agent"]||{};if(!s&&!c)return null;const l=[];return s&&o&&i.avatar&&l.push((0,Da.jsx)("span",{className:Ja("message__avatar"),children:(0,Da.jsx)("img",{src:i.avatar,className:Ja("avatar"),alt:""})})),c&&o&&l.push((0,Da.jsx)("span",{className:Ja("message__author-name"),children:o})),l.length>0?(0,Da.jsx)("div",{className:Ja("message__author"),children:l}):null},lo=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:i,bodyProps:a={},info:o,...s})=>{const c=Ya(t),{hasTranslation:l,isTranslated:u,locale:d}=Wa(t);return n&&c.push(`message--type-${n}`),r&&("string"==typeof r&&(r=r.split(" ").filter((e=>e.length))),r.forEach((e=>{c.push(`message--${e}`)}))),u&&c.push("message--is-translated"),l&&c.push("message--has-translation"),u&&(a={...a,lang:d}),(0,Da.jsx)(Da.Fragment,{children:(0,Da.jsxs)("div",{className:Ja(c),...s,children:[e&&(0,Da.jsx)(co,{eventPayload:t.payload}),(0,Da.jsx)("div",{className:Ja("message__body"),...a,children:i}),o&&(0,Da.jsx)("div",{"aria-hidden":"true",className:Ja("message__info"),children:o})]})})},uo=({id:e,action:t,buttonText:n,description:r,hasFocus:i,image:a,title:o,isCarouselItem:s})=>{const c=(0,aa.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=Aa(),p=so(),h=(0,aa.useRef)(!1),f=t?.type===q?"a":"button",m=(0,aa.useCallback)((()=>d("action.click_card",{type:U,originMessage:e,action:t})),[d,e,t]),y=(0,aa.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:z,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),g=(0,aa.useMemo)((()=>t?.type===q?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,aa.useEffect)((()=>{s&&(i&&h.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),h.current=!0}),[i,s]),(0,Da.jsxs)("div",{className:Ja("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[a?(0,Da.jsx)("img",{className:Ja("card__image"),src:a,alt:""}):null,(0,Da.jsxs)("div",{className:Ja("card__content"),id:e,children:[o&&(0,Da.jsx)("h2",{className:Ja("card__title"),children:o}),r&&(0,Da.jsx)("div",{className:Ja("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,Da.jsx)(f,{tabIndex:s&&!i?-1:void 0,className:Ja("button","button--primary"),"aria-describedby":p,...g,children:n})]})]})};function po({item:e,items:t,index:n,isActive:r}){const{t:i}=xa();return(0,Da.jsx)("div",{className:Ja("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":i("carousel.slide.label",{index:n+1,total:t.length}),children:(0,Da.jsx)(uo,{...e,isCarouselItem:!0,hasFocus:r})})}const ho={send:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>'},balloon:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>'},newTopic:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>'},newTranslation:{16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>'},avatar:{32:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">\n<path fill="#4A48C1" d="M10,14.8c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S11.1,14.8,10,14.8z M15.9,14.8c1.1,0,2-0.9,2-2s-0.9-2-2-2\n\ts-2,0.9-2,2S14.8,14.8,15.9,14.8z M21.8,10.8c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S22.9,10.8,21.8,10.8z M21.3,18.1H10.7\n\tC11.7,23.9,20.2,23.9,21.3,18.1z"/>\n</svg>\n'},chevronDown:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>'},chevronRight:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>'},close:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>'},enlarge:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>'},options:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>'},file:{32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>'},upload:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>'},download:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>'},error:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>'},arrowLeft:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n'},arrowRight:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},check:{16:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="16px"\n height="16px"\n x="0px"\n y="0px"\n viewBox="0 0 16 16"\n>\n <path\n fill="currentColor"\n d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8\n\tc0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"\n />\n</svg>\n',32:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="32px"\n height="32px"\n x="0px"\n y="0px"\n viewBox="0 0 32 32"\n>\n <path\n fill="currentColor"\n d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6\n\tc0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"\n />\n</svg>\n'}},fo=({name:e,size:t="32",className:n,alt:r})=>(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("div",{"aria-hidden":"true",className:n||Ja("icon"),dangerouslySetInnerHTML:{__html:ho[e][t]}}),r&&(0,Da.jsx)("span",{className:Ja("visually-hidden"),children:r})]});function mo({items:e,currentIndex:t,onChange:n,children:r}){const{t:i}=xa(),a=e.length;return(0,Da.jsxs)("div",{className:Ja("carousel-controls"),children:[(0,Da.jsx)("button",{className:Ja("button","button--previous"),"aria-label":i("carousel.controls.previous"),onClick:()=>{n((t-1+a)%a)},children:(0,Da.jsx)(fo,{name:"arrowLeft",size:"16",alt:""})}),r,(0,Da.jsx)("button",{className:Ja("button","button--next"),"aria-label":i("carousel.controls.next"),onClick:()=>{n((t+1)%a)},children:(0,Da.jsx)(fo,{name:"arrowRight",size:"16",alt:""})})]})}function yo({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:i}){const a=e.length,o=(0,aa.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),i=Math.min(a-1,Math.max(0,r));i!==t&&n(i)}),[a,t,n]);return(0,Da.jsx)("div",{className:Ja("carousel-pagination__wrapper"),role:"group",children:(0,Da.jsx)("ul",{className:Ja("carousel-pagination"),children:e.map(((e,n)=>{const a=t===n;return(0,Da.jsx)("li",{className:Ja("carousel-pagination__item",a?"is-active":void 0),children:(0,Da.jsx)("button",{className:Ja("carousel-pagination__button"),type:"button",onClick:o,"data-item":n,"aria-disabled":a?"true":void 0,"aria-label":i(e,n)})},r(e,n,"pagination-item-"))}))})})}const go=(e,t,n)=>`${n}${t}`,vo=e=>e.label,bo=({target:e})=>{e.scrollLeft=0};function xo({currentIndex:e=0,onChange:t=(()=>{}),getItemKey:n=go,getItemLabel:r=vo,items:a}){const o=so(),s=a.length,[c,l]=(0,aa.useState)(Number(e||0));(0,aa.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,aa.useRef)([]);u.current=(0,aa.useMemo)((()=>Array(s).fill(1).map((()=>(0,i.createRef)()))),[s]);const d=(0,aa.useRef)(!0),p=(0,aa.useRef)(null);return p.current=t,(0,aa.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,Da.jsxs)("div",{className:Ja("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,Da.jsx)("div",{className:Ja("carousel__slides-wrapper"),onScroll:bo,children:(0,Da.jsx)("div",{id:o,className:Ja("carousel__slides"),style:{width:100*s+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:a.map(((e,t)=>{const r=c===t;return(0,Da.jsx)("div",{ref:u.current[t],className:Ja("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,Da.jsx)(po,{item:e,items:a,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,Da.jsx)("div",{className:Ja("carousel__controls"),children:(0,Da.jsx)(mo,{currentIndex:c,items:a,onChange:l,children:(0,Da.jsx)("div",{className:Ja("carousel__pagination"),children:(0,Da.jsx)(yo,{currentIndex:c,items:a,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const wo=(e,t,n="")=>`${n}${e.title}:${t}`,Co=e=>e.title,_o=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,So=({id:e,categories:t=[],question:n,onClick:r,hasIcon:i})=>{const a=(0,aa.useMemo)((()=>["suggestions__item",...t.map(_o)]),[t]),o=(0,aa.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,Da.jsx)("li",{className:Ja(a),children:(0,Da.jsxs)("button",{type:"button",onClick:o,className:Ja("button","button--primary"),children:[i&&(0,Da.jsx)(fo,{name:"chevronRight",size:"8",alt:""}),n]})})},Eo=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,Da.jsx)("ul",{className:Ja("suggestions__list",e||""),children:t.map((e=>(0,Da.jsx)(So,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),To=e=>{const{sendAction:t}=Aa();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}},jo=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:i,iconSize:a,iconClassName:o,dividerType:s,title:c,description:l})=>{const u=Boolean(i||n);return(0,Da.jsxs)("div",{className:Ja("divider",s&&`divider--type-${s}`,t),children:[u&&(0,Da.jsx)("span",{className:Ja("divider__graphic"),children:i?(0,Da.jsx)(fo,{name:i,size:a,className:o,alt:""}):(0,Da.jsx)("img",{src:n,className:Ja({icon:"icon"===r,avatar:"avatar"===r},o)})}),(0,Da.jsxs)("div",{className:Ja("divider__body"),children:[c?(0,Da.jsx)("h2",{className:Ja("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,Da.jsx)("p",{className:Ja("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},ko={[G.new_topic]:"new-topic"},No={default:({event:e})=>{const{t}=xa(),{subtype:n}=e.payload.body,r=ko[G[n]];return G[n]?(0,Da.jsx)(jo,{dividerType:r,iconName:G[n],title:t(`dividerKeys.${G[n]}`)}):null},[G.new_translation]:({event:e})=>{const{t}=xa(),n=Jn(),{body:{translationEnabled:r,text:i,title:a},id:o}=e.payload,s=Mn((e=>e.translations.translatedEventGroups)),c=ia(),l=(0,aa.useCallback)((()=>{s[o]?c(Ki({events:n,id:o})):c(Ji({events:n,id:o}))}),[c,n,o,s]);return(0,Da.jsx)(jo,{iconName:"newTranslation",dividerType:"new-translation",title:a,description:i,children:r?(0,Da.jsx)(Da.Fragment,{children:(0,Da.jsx)("button",{className:Ja("button","button--secondary"),onClick:l,children:t(s[o]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},Io={month:"long",day:"numeric",year:"numeric"},Ao={hour:"numeric",minute:"numeric"},Lo=({event:e})=>{const t=(()=>{const[e,t]=(0,aa.useReducer)((e=>e+1),0);return(0,aa.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:i,srText:a}=(e=>{const{t}=xa(),n=Vn(),r=n?.context?.userLocale??[],i=new Date(e),a=new Date,o=new Date(a);o.setHours(24,0,0,0);const s=o.valueOf()-a.valueOf(),c=i.toString(),l=new Intl.DateTimeFormat(r,Ao).format(i);let u=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),i=864e5;return r>=n+i?e:r>n?"today":r>n-i?"yesterday":e})(i,a);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,Io).format(i)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:s}})(v(e.payload.timeIndicator));return(0,aa.useEffect)((()=>{const e=setTimeout((()=>{t()}),i);return()=>{clearTimeout(e)}}),[t,i]),(0,Da.jsxs)(jo,{dividerType:"time-indicator",children:[(0,Da.jsxs)("h2",{className:Ja("divider__time"),"aria-hidden":"true",children:[(0,Da.jsx)("span",{className:Ja("divider__time--date"),children:n}),(0,Da.jsx)("span",{className:Ja("divider__time--time"),children:r})]}),(0,Da.jsx)("p",{className:Ja("visually-hidden"),children:a})]})};var Mo=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Oo=Mo.join(","),Ro="undefined"==typeof Element,Po=Ro?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Do=!Ro&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},zo=function e(t,n){var r;void 0===n&&(n=!0);var i=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===i||"true"===i||n&&t&&e(t.parentNode)},Uo=function(e,t,n){if(zo(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Oo));return t&&Po.call(e,Oo)&&r.unshift(e),r.filter(n)},Fo=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var o=a.shift();if(!zo(o,!1))if("SLOT"===o.tagName){var s=o.assignedElements(),c=e(s.length?s:o.children,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{Po.call(o,Oo)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(o),u=!zo(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(l&&u){var d=e(!0===l?o.children:l.children,!0,r);r.flatten?i.push.apply(i,d):i.push({scopeParent:o,candidates:d})}else a.unshift.apply(a,o.children)}}return i},Bo=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ho=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Bo(e)?0:e.tabIndex},$o=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Vo=function(e){return"INPUT"===e.tagName},Go=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Wo=function(e,t){return!(t.disabled||zo(t)||function(e){return Vo(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var i=Po.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Po.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Go(e)}else{if("function"==typeof r){for(var a=e;e;){var o=e.parentElement,s=Do(e);if(o&&!o.shadowRoot&&!0===r(o))return Go(e);e=e.assignedSlot?e.assignedSlot:o||s===e.ownerDocument?o:s.host}e=a}if(function(e){var t,n,r,i,a=e&&Do(e),o=null===(t=a)||void 0===t?void 0:t.host,s=!1;if(a&&a!==e)for(s=!!(null!==(n=o)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(o)||null!=e&&null!==(i=e.ownerDocument)&&void 0!==i&&i.contains(e));!s&&o;){var c,l,u;s=!(null===(l=o=null===(c=a=Do(o))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(o))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Po.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},qo=function(e,t){return!(function(e){return function(e){return Vo(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Do(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var i=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!i||i===e}(e)}(t)||Ho(t)<0||!Wo(e,t))},Ko=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Jo=function e(t){var n=[],r=[];return t.forEach((function(t,i){var a=!!t.scopeParent,o=a?t.scopeParent:t,s=function(e,t){var n=Ho(e);return n<0&&t&&!Bo(e)?0:n}(o,a),c=a?e(t.candidates):o;0===s?a?n.push.apply(n,c):n.push(o):r.push({documentOrder:i,tabIndex:s,item:t,isScope:a,content:c})})),r.sort($o).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Xo=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Po.call(e,Oo)&&qo(t,e)},Yo=Mo.concat("iframe").join(","),Zo=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Po.call(e,Yo)&&Wo(t,e)};function Qo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function es(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qo(Object(n),!0).forEach((function(t){var r,i,a;r=e,i=t,a=n[t],i=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(i),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ts=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},ns=function(e){return ts(e)&&!e.shiftKey},rs=function(e){return ts(e)&&e.shiftKey},is=function(e){return setTimeout(e,0)},as=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},os=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},ss=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},cs=[],ls=function(e,t){var n,r=(null==t?void 0:t.document)||document,i=(null==t?void 0:t.trapStack)||cs,a=es({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ns,isKeyBackward:rs},t),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},s=function(e,t,n){return e&&void 0!==e[t]?e[t]:a[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return o.containerGroups.findIndex((function(t){var r=t.container,i=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||i.find((function(t){return t===e}))}))},l=function(e){var t=a[e];if("function"==typeof t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];t=t.apply(void 0,i)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var s=t;if("string"==typeof t&&!(s=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return s},u=function(){var e=l("initialFocus");if(!1===e)return!1;if(void 0===e||!Zo(e,a.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=o.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(o.containerGroups=o.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Fo([e],t.includeContainer,{filter:qo.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ko}):Uo(e,t.includeContainer,qo.bind(null,t)),Jo(n)}(e,a.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Fo([e],t.includeContainer,{filter:Wo.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Uo(e,t.includeContainer,Wo.bind(null,t))}(e,a.tabbableOptions),r=t.length>0?t[0]:void 0,i=t.length>0?t[t.length-1]:void 0,o=n.find((function(e){return Xo(e)})),s=n.slice().reverse().find((function(e){return Xo(e)})),c=!!t.find((function(e){return Ho(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:o,lastDomTabbableNode:s,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=t.indexOf(e);return i<0?r?n.slice(n.indexOf(e)+1).find((function(e){return Xo(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return Xo(e)})):t[i+(r?1:-1)]}}})),o.tabbableGroups=o.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),o.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find((function(e){return e.posTabIndexesFound}))&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},h=function e(t){!1!==t&&t!==p(document)&&(t&&t.focus?(t.focus({preventScroll:!!a.preventScroll}),o.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},f=function(e){var t=l("setReturnFocus",e);return t||!1!==t&&e},m=function(e){var t=e.target,n=e.event,r=e.isBackward,i=void 0!==r&&r;t=t||ss(n),d();var s=null;if(o.tabbableGroups.length>0){var u=c(t,n),p=u>=0?o.containerGroups[u]:void 0;if(u<0)s=i?o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:o.tabbableGroups[0].firstTabbableNode;else if(i){var h=as(o.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||Zo(t,a.tabbableOptions)&&!Xo(t,a.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?o.tabbableGroups.length-1:h-1,m=o.tabbableGroups[f];s=Ho(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else ts(n)||(s=p.nextTabbableNode(t,!1))}else{var y=as(o.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||Zo(t,a.tabbableOptions)&&!Xo(t,a.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var g=y===o.tabbableGroups.length-1?0:y+1,v=o.tabbableGroups[g];s=Ho(t)>=0?v.firstTabbableNode:v.firstDomTabbableNode}else ts(n)||(s=p.nextTabbableNode(t))}}else s=l("fallbackFocus");return s},y=function(e){var t=ss(e);c(t,e)>=0||(os(a.clickOutsideDeactivates,e)?n.deactivate({returnFocus:a.returnFocusOnDeactivate}):os(a.allowOutsideClick,e)||e.preventDefault())},g=function(e){var t=ss(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(o.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var i=!0;if(o.mostRecentlyFocusedNode)if(Ho(o.mostRecentlyFocusedNode)>0){var s=c(o.mostRecentlyFocusedNode),l=o.containerGroups[s].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===o.mostRecentlyFocusedNode}));d>=0&&(a.isKeyForward(o.recentNavEvent)?d+1<l.length&&(r=l[d+1],i=!1):d-1>=0&&(r=l[d-1],i=!1))}}else o.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return Ho(e)>0}))}))||(i=!1);else i=!1;i&&(r=m({target:o.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(o.recentNavEvent)})),h(r||o.mostRecentlyFocusedNode||u())}o.recentNavEvent=void 0},v=function(e){if(("Escape"===(null==(t=e)?void 0:t.key)||"Esc"===(null==t?void 0:t.key)||27===(null==t?void 0:t.keyCode))&&!1!==os(a.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(a.isKeyForward(e)||a.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];o.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(ts(e)&&e.preventDefault(),h(n))}(e,a.isKeyBackward(e))},b=function(e){var t=ss(e);c(t,e)>=0||os(a.clickOutsideDeactivates,e)||os(a.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(o.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var r=e.indexOf(t);-1===r||e.splice(r,1),e.push(t)}(i,n),o.delayInitialFocusTimer=a.delayInitialFocus?is((function(){h(u())})):h(u()),r.addEventListener("focusin",g,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",v,{capture:!0,passive:!1}),n},w=function(){if(o.active)return r.removeEventListener("focusin",g,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",v,!0),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===o.mostRecentlyFocusedNode}))}))&&h(u())})):void 0,_=function(){C&&(C.disconnect(),o.active&&!o.paused&&o.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return o.active},get paused(){return o.paused},activate:function(e){if(o.active)return this;var t=s(e,"onActivate"),n=s(e,"onPostActivate"),i=s(e,"checkCanFocusTrap");i||d(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var a=function(){i&&d(),x(),_(),null==n||n()};return i?(i(o.containers.concat()).then(a,a),this):(a(),this)},deactivate:function(e){if(!o.active)return this;var t=es({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},e);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,w(),o.active=!1,o.paused=!1,_(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}(i,n);var r=s(t,"onDeactivate"),c=s(t,"onPostDeactivate"),l=s(t,"checkCanReturnFocus"),u=s(t,"returnFocus","returnFocusOnDeactivate");null==r||r();var d=function(){is((function(){u&&h(f(o.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(f(o.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(o.paused||!o.active)return this;var t=s(e,"onPause"),n=s(e,"onPostPause");return o.paused=!0,null==t||t(),w(),_(),null==n||n(),this},unpause:function(e){if(!o.paused||!o.active)return this;var t=s(e,"onUnpause"),n=s(e,"onPostUnpause");return o.paused=!1,null==t||t(),d(),x(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return o.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),o.active&&d(),_(),this}},n.updateContainerElements(e),n};const us=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":a})=>{const o=so(),s=(0,aa.useRef)(null),c=(0,aa.useRef)(null),[l,u]=(0,aa.useState)(!1);return(0,aa.useEffect)((()=>(l&&s.current&&(c.current=ls(s.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,aa.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(null!==r&&e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[l]),(0,aa.useEffect)((()=>{l&&s.current&&s.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,aa.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",o),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),r&&t.setAttribute("aria-label",r),a&&t.setAttribute("aria-labelledby",a),e.appendChild(t),s.current=t,u(!0),()=>{s.current&&(e.removeChild(s.current),s.current=null)}}),[r,a,o]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>s.current&&(0,i.render)(e,s.current)}):s.current&&(0,i.render)((0,i.toChildArray)(e).filter(T).map((e=>(e.props={...e.props,onClose:t},e))),s.current)},ds=({url:e,description:t,onClose:n})=>{const r=Vn(),i=io(),a=Xa(),o=(0,aa.useRef)(null),{t:s}=xa(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof a?c.push(...a):c.push(...a(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,Da.jsx)(us,{onClose:n,"aria-label":s("lightbox.heading"),fallBackFocusRef:o,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,Da.jsx)("div",{className:Ja(c),onClick:u,style:d,children:(0,Da.jsxs)("div",{className:Ja("modal__float"),tabIndex:-1,onMouseDown:i,onKeyDown:i,onTouchStart:i,onMouseMove:i,onWheel:i,onPointerDown:i,onPointerMove:i,ref:o,children:[(0,Da.jsx)("div",{className:Ja("modal__inner"),onClick:l,children:(0,Da.jsx)("img",{className:Ja("modal__image"),src:e,alt:t})}),(0,Da.jsxs)("button",{type:"button",className:Ja("modal__close"),onClick:n,children:[(0,Da.jsx)(fo,{name:"close",size:"16",alt:""}),s("lightbox.closeLabel")]})]})}))(n))})},ps=({description:e,url:t})=>{const{t:n}=xa(),[r,i]=(0,aa.useState)(!1);return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsxs)("button",{type:"button",className:Ja("modal__enlarge"),onClick:()=>{i(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,Da.jsx)(fo,{name:"enlarge",size:"32",alt:""})]}),r&&(0,Da.jsx)(ds,{url:t,description:e,onClose:()=>{i(!1)}})]})},hs=({event:e,...t})=>{const{body:n}=Wa(e),r=To(e.payload.id),i=(0,aa.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,Da.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,Da.jsx)(lo,{type:"text",event:e,onClick:r,...t,...i})},fs="PROCESSING_IMAGE",ms=({img:e,filename:t})=>{const{t:n}=xa(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,Da.jsx)(Da.Fragment,{children:(0,Da.jsxs)("span",{className:Ja(["download","download--preview"]),children:[(0,Da.jsx)("img",{src:e,alt:r}),(0,Da.jsx)("span",{"aria-hidden":"true",className:Ja("file-download"),children:t})]})})},ys=({children:e,url:t,target:n})=>t?(0,Da.jsx)("a",{href:t,download:!0,target:n,className:Ja(["download","download-link"]),children:e}):(0,Da.jsx)("span",{className:Ja("download"),children:e}),gs={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=xa(),a=so(),{body:o,subEvent:s,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=(e=>{const{payload:t}=e,[n,r]=(0,aa.useState)(!1),{sendAction:i,addMessageBubble:a,addDivider:o}=Aa(),{activeServiceSessionId:s}=Qn(),c=Mn(er),{body:l}=Wa(e),{service:u}=t,d=(0,aa.useMemo)((()=>{if("choice_prompt"===e.payload.type)return{...e,payload:{...e.payload,body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&{...e.payload.translatedBody,data:e.payload.translatedBody?.prompt}}}}),[e]),p=l?.chooseAgain&&s===u?.serviceSessionId&&t.id!==c;return(0,aa.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:d,showOptions:n,chooseAgain:p,onChoiceClickHandler:e=>{const n=m();p&&o("new_topic",n),a(e.text,n),i({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:p},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}})(e);return(0,Da.jsxs)(Da.Fragment,{children:[(0,i.toChildArray)(t).filter(T).map((e=>(e.props={...e.props,event:s,descriptorId:a,showTranslationToggle:!1},e))),l&&(0,Da.jsxs)("button",{type:"button",className:Ja("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":a,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,Da.jsx)(fo,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,Da.jsx)(lo,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,Da.jsx)("ul",{className:Ja("choice-prompt","choice-prompt--many"),children:o?.choices?.map((e=>(0,Da.jsx)("li",{className:Ja("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:hs,image:({event:e,descriptorId:t,...n})=>{const{body:r}=Wa(e),[i,a]=(0,aa.useState)(!1),o=ia();return(0,Da.jsxs)(lo,{event:e,type:"image",...n,children:[(0,Da.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{o(Ei(e.payload.id)),a(!0)}}),r?.isZoomable&&i&&(0,Da.jsx)(ps,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=Wa(e),i=To(n.id);return(0,Da.jsx)(lo,{type:"splash",event:e,onClick:i,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=Wa(e);return Ya(e).push("message--type-video"),(0,Da.jsxs)(lo,{event:e,type:"video",...n,children:[(0,Da.jsx)("div",{id:t,className:Ja("visually-hidden"),children:r?.description}),(0,Da.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=xa(),{body:r}=Wa(e),{fromClient:i,id:a}=e.payload,{filename:o,url:s}=r,c=(e=>{const{processingFileUploads:t}=Mn((({state:e})=>e));return(0,aa.useMemo)((()=>{if(t.some((t=>t===e)))return fs;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(a),l=(0,aa.useMemo)((()=>n(s?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:o})),[s,o,n]);return(0,Da.jsx)(lo,{event:e,type:"upload",...t,children:c&&c!==fs?(0,Da.jsx)(ms,{img:c,filename:o}):(0,Da.jsxs)(ys,{url:s,target:i?void 0:"_blank",children:[(0,Da.jsx)(fo,{name:"download",size:"16",alt:l}),(0,Da.jsx)("span",{"aria-hidden":"true",className:Ja("file-download"),children:o})]})})},cta:({event:e})=>{const{body:t}=Wa(e),n=To(e.payload.id),{emitEvent:r}=Aa(),i=so(),a=(0,aa.useCallback)((()=>r(`action.${U}`,{type:U,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,Da.jsxs)(lo,{type:"cta",event:e,children:[(0,Da.jsx)("div",{className:Ja("cta__content"),id:i,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,Da.jsx)("a",{className:Ja("button","button--primary"),"aria-describedby":i,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:a,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=Wa(e),n=t.cards;return(0,Da.jsx)(lo,{event:e,modifiers:"type-carousel",children:(0,Da.jsx)(xo,{items:n,getItemKey:wo,getItemLabel:Co})})},card:({event:e})=>{const{body:t}=Wa(e),n=so();return(0,Da.jsx)(lo,{type:"card",event:e,children:(0,Da.jsx)(uo,{id:n,...t})})}},info:{text:hs,divider:({event:e,...t})=>{const n=No[G[e.payload.body.subtype]]||No.default;return(0,Da.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=xa(),{body:r}=Wa(e);return(0,Da.jsx)(lo,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:Lo},participant:{participant:({event:e})=>{const{participant:t}=e.payload,{body:n}=(e=>{const{translatedBody:t,translation:n,body:r}={body:e.payload?.participant?.introduction,translatedBody:e.payload?.participant?.translatedIntroduction,translation:e.payload?.participant?.translation},i=!!t,a=Mn(Va(e));return{body:a&&i?t:r,hasTranslation:i,isTranslated:a&&i,locale:n?.locale}})(e);return n?(0,Da.jsx)(jo,{graphicSrc:t?.avatar,graphicType:t?.avatar?"avatar":void 0,iconName:t?.avatar?void 0:"balloon",dividerType:"participant",title:n}):null}},service_data:{suggestion:({event:e,...t})=>{const[n,r]=(0,aa.useState)(!0),i=ia(),a=_a(),{sendAction:o,addMessageBubble:s}=Aa(),{suggestions:c,payload:l}=(e=>{const{payload:t}=e,{body:n}=Wa(e);return{suggestions:n,payload:t}})(e),{showSuggestions:u}=Vn(),d=Jn(),{t:p}=xa(),h=p("suggestions.headingText"),f=p("suggestions.footerText"),m=(0,aa.useMemo)((()=>d.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[d]),y=(0,aa.useCallback)((({id:e,question:t})=>{r(!1),i(xr(!0)),o({type:M,originMessage:l.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),s(t)}),[i,o,l.id,s]);return n&&!a&&m&&u?(0,Da.jsxs)("div",{className:Ja("suggestions","suggestions--conversation"),children:[h&&(0,Da.jsx)("p",{className:Ja("suggestions__heading"),children:h}),(0,Da.jsxs)(lo,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,Da.jsx)(Eo,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:c}),f&&(0,Da.jsx)("p",{className:Ja("suggestions__footer"),children:f})]})]}):null}}},vs=({children:e})=>{const{customComponents:t}=Vn(),n=(0,aa.useMemo)((()=>Object.keys(gs).reduce(((e,n)=>(e[n]={...gs[n],...t?t[n]:{}},e)),{fallback:hs})),[t]);return(0,Da.jsx)(Ua.Provider,{value:n,children:e})},bs=({children:e})=>{const{isMinimized:t}=wa(),n=(0,aa.useRef)(0),{sendAction:r}=Aa(),{hasCountdown:i,isActive:a,stopCountdown:o}=ao(),s=(0,aa.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),s=()=>{r({type:"interactivity_update"}),n.current=e};i&&a&&(s(),o()),e-n.current>15e3&&s()}),[r,i,a,o,t]);return(0,Da.jsx)("div",{className:Ja("activity-monitor"),tabIndex:-1,onMouseDown:s,onKeyUp:s,onTouchStart:s,onMouseMove:s,onWheel:s,onPointerDown:s,onPointerMove:s,children:(0,Da.jsx)(ro.Provider,{value:s,children:e})})},xs=["text","choice_prompt","image","video"],ws=()=>{const e=(()=>{const e=ka();return(0,Pa.useSyncExternalStore)(ge.subscribe,(()=>e.conversation))})(),t=(0,aa.useRef)(),n=(0,aa.useRef)(),r=ia(),i=ja(),a=(0,aa.useRef)(null),{initCountdown:o,endCountdown:s}=ao(),{emitEvent:u}=Aa();return(0,aa.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new Cr(e);r(Gr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(ii())})),t.onOpen((()=>{r(Wr())}))}}),[e,r]),(0,aa.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new c;return r(Gr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,aa.useEffect)((()=>{const t=e=>{if("participant"!==e.type)return;const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:i}=t;!n&&"string"!=typeof i&&i?.name&&r(xi(i.name)),r(Ti({participant:i,fromClient:n})),"string"!=typeof i&&i.introduction&&r(ni(e))};e.onConnection((({connected:n})=>{const{channel:a}=e;return!(!n||!a||(a.onMessage=(e,n)=>{const a={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(Si(n.state.loading)),n.type){case"idle_detach_countdown":o(n.body.duration);break;case"idle_detach_countdown_elapsed":s(void 0,!0);break;case"resume_conversation_prompt":r(di());break;case"translation_proposal":r(Xi(n.body));break;case"user_first_response":r(xr(!0)),i.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(Pr(n.userLocale));break;case"message":switch(t(n),n.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":n.service&&n.service.serviceSessionId&&r(mi(n.service.serviceSessionId)),r(ni(a))}break;case"participant":t(a);break;case"service_data":n.persist&&r(ki(n));break;case"ack":r(ti(a));break;case"system":if("service_changed"===n.type){const{serviceSettings:e,...t}=n,{entry:i,proactiveMessages:a}=e,{upload:o}=i.options;r(vi({key:W,enabled:!(!o||!o.enabled)})),r(Bi(a.enabled||!1)),r(Ni(i)),n.serviceSessionId&&r(mi(n.serviceSessionId)),u("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(ni(a));break;case"error":switch(n.type){case"find_conversation_erred":const e=new l(a);r(Gr({name:e.name,action:e.action,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError}));break;case"conversation_erred":case"attach_channel_erred":const t=new c(a);r(Gr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError,action:t.action}))}}return n},1))}))}),[e,r,u,s,i,o]),(0,aa.useEffect)((()=>{e.onConnection((({connected:t})=>{const{channel:r}=e;return!(!t||!r||(n.current&&r.off("message",n.current),n.current=r.on("message",(e=>xs.includes(e.type)?(e.id!==a.current&&i.emit("message",e),a.current=e.id,e):e)),0))}))}),[e,i]),(0,aa.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.channel?.off("sync",t.current),t.current=e.channel?.on("sync",(async e=>{try{const t=await r(Hr(e)).unwrap();if(!t)return;r(Ci(t))}catch(e){}})),!0)))}),[e,r]),null},Cs=({children:e})=>{const{t}=xa(),n=ia(),r=ka(),{addUploadBubble:i}=Aa(),a=(0,aa.useCallback)((async(e,t)=>{n(Oi(t));const r=await(e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>"string"==typeof r.result?t(r.result):void 0,r.onerror=e=>n(e)})))(e),i=new Image;i.src=r,await i.decode();const a=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,i]=(e=>{const{height:t,width:n}=e;return n>t&&n>600?[600,600*t/n]:t>600?[600*n/t,600]:[n,t]})(e);return t.width=r,t.height=i,n?.drawImage(e,0,0,r,i),t.toDataURL()})(i);try{sessionStorage.setItem(`image-${t}`,a)}catch(e){}finally{n(Ri(t))}}),[n]),o=(0,aa.useCallback)((e=>{const o=m(),s=r.uploadFile(e,(e=>{n(Mi({fileId:o,progress:Math.ceil(e)}))}),(async t=>{const{id:r,transactionId:s,occurredAt:c,body:{contentType:l,filename:u,filesize:d,url:p}}=t;n(Ai(o)),i(r,s,c,l,u,d,p),await a(e,r)}),(e=>{let r;switch(e?.error||""){case"file_uploads_are_disabled":r=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":r=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":r=t("fileUpload.errors.wrongType");break;case"virus_found":r=t("fileUpload.errors.virusFound");break;default:r=t("fileUpload.errors.general")}n(Li({fileId:o,errorText:r}))}));n(pi({fileId:o,fileName:e.name,uploadHandle:s}))}),[a,i,r,n,t]);return(0,Da.jsx)(Za.Provider,{value:o,children:e})},_s=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=ao();return((e,t)=>{const n=(0,aa.useRef)(e);(0,aa.useEffect)((()=>{n.current=e}),[e]),(0,aa.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},Ss=()=>{const{initUserSelectedOptions:e}=to(),t=(0,aa.useRef)(!1),n=Vn();return(0,aa.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function Es(e,t,n=[]){const r=ja(),i=(0,aa.useRef)(t);(0,aa.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>i.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const Ts=()=>{const e=Vn(),{sendMessage:t,sendContext:n,sendAction:r}=Aa(),i=ia(),{setVisibility:a,visible:o}=wa(),s=(0,aa.useRef)(o),c=ja(),l=ka(),u=Yn(),d=(0,aa.useRef)(null),h=(0,aa.useRef)(null),{isInline:f,isResolving:m}=rr(),y=Mn(Oa),g=(()=>{const{get:e}=Na();return e?e("conversationUrl"):null})(),v=(0,aa.useRef)(null),b=io(),{enableTranslations:x,disableTranslations:w}=Ga();return(0,aa.useEffect)((()=>{s.current=o}),[o]),Es("askText",(e=>{t({body:e})}),[l.send]),Es("setVariables",(e=>{n({variables:e})}),[l.send]),Es("getVisibility",(e=>{e?e(s.current):console.warn("A callback function is required for the getVisibility action.")})),Es("setVisibility",(e=>{Object.values(vn).includes(e)?(b(),a(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),Es("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Es("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&i(mr({showSuggestions:!1})),e&&t?r({type:z,body:{name:e,fallbackMessage:t,participant:n?p:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),Es("setContext",(e=>{n(e)}),[l.send]),Es("setTranslation",(({enabled:e,locale:t})=>{e?x(t,H):w()}),[l.send]),(0,aa.useEffect)((()=>{m||y||(v.current&&v.current!==g&&c.emit("unreadMessageCount",u),o===vn.open&&o!==h.current&&0!==d.current&&c.emit("unreadMessageCount",0),o!==vn.open&&u!==d.current&&c.emit("unreadMessageCount",u),h.current=o,d.current=u,"string"==typeof g&&(v.current=g))}),[u,o,c,f,m,y,g]),null},js=({children:e})=>{const t=ja(),n=(0,aa.useRef)(null),[r,i]=(0,aa.useState)(),a=(0,aa.useRef)(!0),o=(0,aa.useCallback)((e=>{a.current&&(i(e),t.emit("aria-live",e))}),[i,t]);return(0,aa.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{o({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,o]),(0,aa.useEffect)((()=>()=>{a.current=!1}),[]),(0,Da.jsxs)(Ta.Provider,{value:o,children:[e,(0,Da.jsxs)("div",{className:Ja("app__live-container"),children:[(0,Da.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Ja("visually-hidden"),children:r?.ariaLive===$?r?.messageText:null}),(0,Da.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Ja("visually-hidden"),children:r?.ariaLive===V?r?.messageText:null})]})]})},ks=()=>{const{t:e}=xa(),t=Jn(),n=(0,aa.useRef)(0),r=(0,aa.useRef)(0),i=Wn().historyLoaded,{sendPolite:a}=La(),{isOpen:o}=wa(),s=(0,aa.useRef)(null),c=(0,aa.useRef)(null),l=(0,aa.useMemo)((()=>g((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(a(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[a,e]);return(0,aa.useEffect)((()=>{t.length>n.current&&(o&&(c.current=l(t)),n.current=t.length)}),[t,l,o]),(0,aa.useEffect)((()=>{s.current&&!o&&c.current&&(c.current(!0),c.current=null)}),[o]),(0,aa.useEffect)((()=>{i&&setTimeout((()=>{a(e("window.srTexts.onHistoryLoad"))}),500)}),[i,e,a]),null},Ns=()=>{const{t:e}=xa(),{isOpen:t,isVisible:n}=wa(),r=Yn(),{sendPolite:i}=La(),a=(0,aa.useMemo)((()=>g(i,2e3)),[i]),o=(0,aa.useRef)(null),s=(0,aa.useRef)(null);return(0,aa.useEffect)((()=>{o.current!==n&&!n&&s.current&&s.current(),0!==r&&!t&&n&&(s.current=a(e("message.srTextUnreadCount",{unreadCount:r}))),o.current=n}),[r,t,n,a,e]),null},Is=({store:e,children:t,eventBus:n,api:r})=>((0,aa.useErrorBoundary)((t=>{console.error(t),e.dispatch(Sr(t))})),(0,Da.jsx)(zn,{store:e,children:(0,Da.jsx)(Ea.Provider,{value:n,children:(0,Da.jsx)(Sa.Provider,{value:r,children:(0,Da.jsx)(js,{children:(0,Da.jsx)(za,{children:(0,Da.jsxs)(vs,{children:[(0,Da.jsx)(Ss,{}),(0,Da.jsx)(ws,{}),(0,Da.jsx)(Ns,{}),(0,Da.jsx)(ks,{}),(0,Da.jsx)(_s,{}),(0,Da.jsxs)(bs,{children:[(0,Da.jsx)(Ts,{}),(0,Da.jsx)(Cs,{children:t})]})]})})})})})})),As=bt(Kn,(e=>e.filter((e=>Jr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===A)))),Ls=bt([As],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),Ms=bt(As,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),Os=bt((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),Rs=()=>{const{t:e}=xa(),{showDisclaimer:t}=Vn();return t?(0,Da.jsxs)("div",{className:Ja("disclaimer"),tabIndex:0,children:[(0,Da.jsx)("h2",{className:Ja("disclaimer__title"),children:e("disclaimer.title")}),(0,Da.jsx)("div",{className:Ja("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},Ps=bt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),Ds=bt(Ps,(e=>e?.controls||{})),zs=bt(Ds,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Us=bt([Ds,(e,{name:t})=>t],((e,t)=>e[t]?.value)),Fs=bt([Ds,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),Bs=(0,i.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:Hs,Consumer:$s}=Bs,Vs=Bs;function Gs(){return(0,aa.useContext)(Vs)}function Ws(e){const t=ia(),{formId:n,updateControlValue:r,updateControlTouched:i,errors:a}=Gs(),o=!!Mn((e=>Ps(e,{formId:n}))),s=Mn((t=>Us(t,{formId:n,name:e}))),c=Mn((t=>Fs(t,{formId:n,name:e}))),l=a?.[e],u=!l;(0,aa.useEffect)((()=>{o&&t(Ar({formId:n,name:e}))}),[o,n,e,t]),(0,aa.useLayoutEffect)((()=>()=>{t(Lr({formId:n,name:e}))}),[o,n,e,t]);const d=(0,aa.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,aa.useCallback)((()=>{i(e,!0)}),[i,e]);return[(0,aa.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:s})),[e,d,p,s]),(0,aa.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function qs(e){const{t}=xa(),{sendAssertive:n}=La(),{hasLimit:r,limit:i}=nr(),a=(0,aa.useMemo)((()=>g(n,f)),[n]),o=(0,aa.useMemo)((()=>g(((e,n)=>{e&&a(t("input.srCharacterLimitText",{limit:n}))}),f)),[a,t]),[{value:s}]=Ws(e),c=i&&r&&s?i-s.length:i,l=!(!r||!c)&&c<=h,u=!(!r||!c)&&c<0;return(0,aa.useEffect)((()=>{o(l,c)}),[l,c,o]),{hasCharacterLimit:r,characterLimit:i,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Ks=e=>{const{hasCharacterLimit:t,characterLimit:n}=qs(e),{entryMeta:{optionsOverride:{text:r}}}=Wn(),{t:i}=xa();return{placeholder:(0,aa.useMemo)((()=>i("input.inputPlaceholder",{hasLimit:t,text:r?.placeholder||i("input.inputPlaceholderText"),limit:t?n:null})),[i,t,n,r?.placeholder]),label:(0,aa.useMemo)((()=>i("input.inputLabel",{hasLimit:!r?.label&&t,text:r?.label||i("input.inputLabelText"),limit:!r?.label&&t?n:null})),[i,t,n,r?.label]),labelClass:(0,aa.useMemo)((()=>r?.label?"label":"visually-hidden"),[r?.label])}};function Js(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=ia(),{entryMeta:{actions:t,translatedActions:n}}=Wn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(Ii())}}})(),n=ka();return e?(0,Da.jsx)("li",{className:Ja(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,Da.jsx)("button",{className:Ja(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:z,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const Xs=(0,i.createContext)(null),Ys=()=>{const e=(0,aa.useContext)(Xs);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},Zs=Xs,Qs=e=>{const t=(()=>{const e=(0,aa.useContext)(Ua);if(!e)throw new Error("useComponentContext has to be used within <ComponentContext.Provider>");return e})(),n=t[e.type];let r=n[e.payload.type],i=null;return"choice_prompt"===e.payload.type&&(i=n[e.payload.body.prompt.type]),"participant"===e.type&&(r=n[e.type]),r&&"function"!=typeof r&&(r=r[e.payload.body.type]),[r||t?.fallback,i]},ec=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=Ys(),{sendAction:i}=Aa(),a=e.payload.id?n[e.payload.id]:void 0,{containerRef:o,isVisible:s}=Ca({containerRef:a,freezeOnceVisible:!0}),c=ia(),[l,u]=Qs(e);if((0,Pa.useEffect)((()=>{if(s&&r?.includes(e.payload.id)){const t=r.reduce(((t,n)=>e?.payload?.id&&n&&!t.includes(e.payload.id)?t.concat(n):t),[]);c(gi(t)),i({type:R,events:t})}}),[c,e.payload.id,s,i,r]),!l)return null;const d=["conversation__item"];return"info"===e.type?d.push("conversation__item--source-info"):e.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),t&&d.push("conversation__item--new-participant"),(0,Da.jsxs)("li",{className:Ja(d),ref:o,children:[e.payload.timeIndicator&&(0,Da.jsx)(Lo,{event:e}),(0,Da.jsx)(l,{event:e,children:(0,Da.jsx)(u,{event:e})})]})},tc=()=>{const{id:e}=tr()||{};return(0,Da.jsx)("li",{className:Ja("conversation__item","conversation__item--source-agent"),children:(0,Da.jsxs)("div",{className:Ja("message","message--source-agent","message--type-loading"),children:[(0,Da.jsx)(co,{eventPayload:{fromClient:!1,participant:e}}),(0,Da.jsx)("div",{className:Ja("message__body"),children:(0,Da.jsxs)("span",{className:Ja("loader"),children:[(0,Da.jsx)("span",{className:Ja("loader__part","one")}),(0,Da.jsx)("span",{className:Ja("loader__part","two")}),(0,Da.jsx)("span",{className:Ja("loader__part","three")}),(0,Da.jsx)("span",{className:Ja("loader__part","four")})]})})]})})},nc=()=>{const e=Jn();let t;return(0,Da.jsx)(Da.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let i=!1;if("participant"!==n&&"service_data"!==n){const{participant:n,fromClient:a}=r,o=a?"seamly-client-participant":n;"info"!==e.type&&t!==o&&(i=!0),t=o}return(0,Da.jsx)(ec,{event:e,newParticipant:i},e.payload.key||e.payload.id)}))})},rc=()=>{const{t:e}=xa(),t=Xn(),n=((e,t=20)=>{const[n,r]=(0,aa.useState)(e),i=(0,aa.useRef)(null);return(0,aa.useEffect)((()=>(i.current=setTimeout((()=>r(e)),t),()=>{i.current&&clearTimeout(i.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=wa(),i=Zn(),a=$a();return(0,Da.jsxs)(Da.Fragment,{children:[r&&(0,Da.jsx)("a",{className:Ja("skip-link"),href:`#${i}`,onClick:e=>{e.preventDefault(),a()},children:e("skiplinkText")}),(0,Da.jsx)("div",{className:Ja("chat__body"),children:(0,Da.jsxs)("div",{className:Ja("conversation__container"),children:[(0,Da.jsx)(Rs,{}),(0,Da.jsxs)("ol",{className:Ja("conversation"),children:[(0,Da.jsx)(vs,{children:(0,Da.jsx)(nc,{})}),n?(0,Da.jsx)(tc,{}):null,(0,Da.jsx)(Js,{})]})]})})]})};function ic(e,t){const n=(0,aa.useRef)(null),r=(0,aa.useRef)(e);return(0,aa.useEffect)((()=>{r.current=e}),[e]),(0,aa.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const ac={visible:Ja("transition--visible"),in:Ja("transition--in"),visuallyHidden:Ja("visually-hidden")},oc=Object.values(ac),sc=e=>{const t=(0,aa.useRef)(null);t.current=e;const n="function"==typeof e;return(0,aa.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},cc={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},lc=({children:e,isActive:t,timeout:n=300,transitionStartState:r=cc.notRendered,onInTransitionComplete:a=(()=>{}),onOutTransitionComplete:o=(()=>{}),exitAfter:s,enterDelay:c=0})=>{const l=(0,aa.useRef)(!1),u=(0,aa.useRef)(null),d=(0,aa.useRef)(null),p=r===cc.visuallyHidden,[h,f]=(0,aa.useState)((()=>p?[ac.visuallyHidden]:[])),[m,y]=(0,aa.useState)((()=>0===c)),g=(0,aa.useMemo)((()=>s?s+c:s),[c,s]);ic((()=>y(!1)),t?g:void 0),ic((()=>y(!0)),t?c:void 0);const v=(0,aa.useMemo)((()=>m&&t),[t,m]),b=sc(a),x=sc(o),w="notRendered"!==r||h.length>0;return(0,aa.useEffect)((()=>(l.current&&!v&&(f([ac.visible]),u.current=setTimeout((()=>{f([...p?[ac.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&v&&(f([ac.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{f([ac.visible,ac.in]),b&&(u.current=setTimeout((()=>{b()}),n))}))}))),l.current=v,()=>{u.current&&clearTimeout(u.current),d.current&&cancelAnimationFrame(d.current)})),[p,b,x,n,v]),(0,Da.jsx)(Da.Fragment,{children:w&&(0,i.toChildArray)(e).filter(T).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!oc.includes(e)));return(0,i.cloneElement)(e,{className:[...n,...h].join(" ")})}))})},uc=({isAside:e=!1})=>{const{isInline:t}=rr(),{t:n}=xa(),{sendAction:r,addMessageBubble:i}=Aa(),{isOpen:a,setVisibility:o}=wa(),{showSuggestions:s}=Vn(),c=so(),l=$a(),u=(0,aa.useRef)(null),{sendPolite:d}=La(),p=Mn(Oa),{hasCountdown:h,endCountdown:f}=ao(),{hasPrompt:m,continueChat:y}=oo(),g=_a(),v=Wn().serviceData.suggestion;const{body:b}=Wa({payload:v,type:"service_data"}),x=(0,aa.useMemo)((()=>p?[]:Array.isArray(b)?b:b?.data),[b,p]),w=(0,aa.useRef)(),C=(0,aa.useRef)(!1),_=(0,aa.useRef)(),S=!!x?.length,T=t?(g||a)&&!e:g,j=(0,aa.useRef)(T),k=S&&!T&&s,N=S?x:_.current;_.current=N;const I=(0,aa.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Ja(t)}),[e]),A=(0,aa.useCallback)((({id:e,question:t})=>{h&&f(!0),m&&y(),r({type:M,originMessage:v.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),i(t),a||o(vn.open),l()}),[i,y,f,l,h,m,v,r,o,a]);(0,aa.useEffect)((()=>{if(w.current!==x&&!T){if(S){const e=C.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{d(e)}),30)}else C.current&&d(n("suggestions.srUnavailableText"));w.current=x}!j.current&&T?(E(u.current,l),d(n("suggestions.srUnavailableText"))):!S&&C.current&&E(u.current,l),C.current=S,j.current=T}),[x,S,T,l,d,n]);const L=n("suggestions.headingText"),O=n("suggestions.footerText"),R=L?"section":"div";return(0,Da.jsx)(lc,{isActive:!!k,transitionStartState:cc.notRendered,children:(0,Da.jsxs)(R,{className:I,"aria-labelledby":L?c:void 0,ref:u,children:[L&&(0,Da.jsx)("p",{id:c,className:Ja("suggestions__heading"),children:L}),!!N&&(0,Da.jsx)(Eo,{suggestions:N,onClickSuggestion:A}),O&&!a&&(0,Da.jsx)("p",{className:Ja("suggestions__footer"),children:O})]})})},dc=(0,Pa.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:i,setVisibility:a}=wa(),{namespace:o,layoutMode:s}=Vn(),{isInline:c}=rr(),l=Xa(),u=_a(),{t:d}=xa(),p=["chat",`chat--layout-${s}`,`namespace--${o}`,t];return"function"!=typeof l&&p.push(...l),r||"app"===s||p.push("chat--collapsed"),u&&p.push("chat--user-responded"),i&&(0,Da.jsxs)("section",{className:Ja(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&a(vn.minimized)},tabIndex:-1,ref:n,"aria-label":d("chat.srLabel"),children:[(0,Da.jsx)("div",{className:Ja("chat-wrapper"),children:e}),"inline"===s&&r&&(0,Da.jsx)(uc,{isAside:!0})]})})),pc=dc,hc=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:i,id:a})=>{const o=so();return(0,Da.jsxs)("section",{tabIndex:-1,id:a,"aria-labelledby":n?o:void 0,className:Ja("chat-status",n?void 0:"chat-status--condensed"),children:[(0,Da.jsxs)("div",{className:Ja("chat-status__body"),children:[n?(0,Da.jsx)("h2",{className:Ja("chat-status__title"),id:o,children:n}):null,e]}),"function"==typeof t&&(0,Da.jsxs)("button",{type:"button",onClick:t,className:Ja("button","button--tertiary","chat-status__close"),children:[r||(0,Da.jsx)(fo,{name:"close",size:"16",alt:""}),i&&(0,Da.jsx)("span",{className:Ja("visually-hidden"),children:i})]})]})},fc=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,Da.jsxs)("button",{type:"button",onClick:e,className:Ja("button","button--primary","chat-status__button"),children:[(0,Da.jsx)(fo,{name:t,size:"16",alt:""}),n,r&&(0,Da.jsx)("span",{className:Ja("visually-hidden"),children:r})]});function mc(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=Ka(),{id:i}=function(){const e=Mn((({translations:e})=>e.containerId));return{id:e,focusContainer:Ha(e)}}();return e&&t?(0,Da.jsx)(hc,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:i,title:t.titleLabel,children:(0,Da.jsx)(fc,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function yc(){const e=Mn(Oa),{isActive:t}=Ga();return e||t?null:(0,Da.jsx)(mc,{})}const gc=({label:e,checked:t,description:n,onChange:r,id:i,itemClassName:a})=>(0,Da.jsxs)("li",{className:Ja([a||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:i,children:[(0,Da.jsx)(fo,{name:"check",size:"16",alt:""}),e," ",n&&(0,Da.jsxs)("span",{children:["(",n,")"]})]}),vc=({onChange:e,describedById:t})=>{const{context:n}=Vn(),r=(0,Pa.useMemo)((()=>n?.contentLocale),[n?.contentLocale]),{t:i}=xa(),{languages:a,currentLocale:o,enableTranslations:s,disableTranslations:c}=Ga(),l=$a(),u=t=>()=>{t===o||r===t?c():s(t,"translation_choice"),e(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,Pa.useMemo)((()=>a.reduce(((e,t)=>{const n=t.locale===r,i=((e,t,n)=>t===e.locale||!t&&n)(t,o,n);t.locale!==r&&e.remainingLanguages.push({...t,checked:i,isOriginal:n});const a=e.remainingLanguages.findIndex((e=>e.locale===o));return(n||i&&a>4)&&e.primaryLanguages.push({...t,checked:i,isOriginal:n}),e}),{primaryLanguages:[],remainingLanguages:[]})),[o,r,a]);return(0,Da.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Ja("translation-options"),children:[d.map((({locale:e,nativeName:t,checked:n,isOriginal:r},a)=>(0,Da.jsx)(gc,{id:e,label:t,checked:n,description:r?i("translations.settings.original"):void 0,onChange:u(e),itemClassName:Ja({"translation-options__item--original":r,"translation-options__item--selected":n&&0!==a})},e))),p.map((({locale:e,nativeName:t,checked:n,isOriginal:r})=>(0,Da.jsx)(gc,{id:e,label:t,checked:n,description:r?i("translations.settings.original"):void 0,onChange:u(e)},e)))]})},bc=({className:e,children:t,onCancel:n,headingText:r,description:i,descriptionId:a,cancelButtonText:o,cancelButtonRef:s,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=so(),{hideOption:d}=to(),{focusButton:p}=no(),h=(0,aa.useCallback)((()=>{d(),c||p()}),[c,p,d]),f=(0,aa.useCallback)((()=>{n&&n(),h()}),[h,n]),m=(e=>{const t=(0,aa.useRef)(null);return(0,aa.useEffect)((()=>{const n=n=>{t.current&&n.target instanceof HTMLElement&&!t.current.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),e())};return document.addEventListener("click",n,!0),document.addEventListener("touchstart",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("touchstart",n,!0)}}),[e,t]),t})(f);return(0,aa.useEffect)((()=>{S(m.current)}),[m]),(0,Da.jsx)("section",{className:Ja("options",{"options--right":"right"===l.horizontal,"options--left":"left"===l.horizontal,"options--top":"top"===l.vertical,"options--bottom":"bottom"===l.vertical},e||""),"aria-labelledby":u,tabIndex:-1,ref:m,children:(0,Da.jsxs)("div",{className:Ja("options__body"),children:[(0,Da.jsx)("h2",{id:u,className:Ja("options__title"),children:r}),(0,Da.jsxs)("button",{type:"button",onClick:f,"aria-describedby":u,className:Ja("button","options__close"),ref:e=>{s&&(s.current=e)},children:[(0,Da.jsx)(fo,{name:"close",size:"16",alt:""}),(0,Da.jsx)("span",{children:o})]}),i?(0,Da.jsx)("p",{className:Ja("options__description"),id:a,children:i}):null,(0,Da.jsx)("div",{className:Ja("options__wrapper"),children:t})]})})},xc=function({onClose:e,position:t}){const{t:n}=xa(),r=so();return(0,Da.jsx)(bc,{onCancel:e,headingText:n("translations.menu.title"),cancelButtonText:n("translations.settings.cancelButtonText"),description:n("translations.menu.description"),descriptionId:r,position:t,disableButtonFocusing:!0,children:(0,Da.jsx)(vc,{describedById:r,onChange:e})})};function wc({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,i]=(0,aa.useState)(!1),a=(0,aa.useRef)(null),o=so();return(0,Da.jsxs)("div",{className:Ja("translations__container"),onKeyDown:e=>{r&&_(e)===C.Escape&&(i(!1),S(a.current))},children:[(0,Da.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Da.jsx)("div",{className:Ja("options__dialog"),role:"dialog",children:(0,Da.jsx)(xc,{onClose:()=>{i(!1)},position:t})})}),(0,Da.jsx)("button",{type:"button",className:Ja(["button","chat__options__button",...n]),id:o,onClick:()=>{i(!r)},onKeyDown:e=>{_(e)===C.ArrowDown&&(i(!0),e.preventDefault())},ref:a,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const Cc=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:i,validationSchema:a={},...o})=>{const s=ia(),c=Mn((e=>zs(e,{formId:t}))),[l,u]=(0,aa.useState)(!1),[d,p]=(0,aa.useState)({}),{isValid:h,errors:f}=function(e,t){const n=(0,aa.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const i=Array.isArray(r)?r:[r];for(let r=0;r<i?.length;r++)if(!i[r].fn(e[n],i[r].compareValue)){t[n]=i[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,a),m=(0,aa.useMemo)((()=>({...f,...d})),[f,d]);(0,aa.useLayoutEffect)((()=>{s(Nr({formId:t,persistData:n}))}),[t,n,s]),(0,aa.useEffect)((()=>()=>{s(Ir({formId:t}))}),[t,n,s]);const y=(0,aa.useCallback)(((e,n)=>{s(Mr({formId:t,name:e,value:n}))}),[t,s]),g=(0,aa.useCallback)(((e,n)=>{s(Or({formId:t,name:e,touched:n}))}),[s,t]),v=(0,aa.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,aa.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&h&&(s(xr(!0)),i(c,{updateControlValue:y,setError:v}))}),[h,s,i,c,y,v]);(0,aa.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,aa.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:a,updateControlValue:y,updateControlTouched:g})),[t,c,m,l,b,a,y,g]);return t?i?(0,Da.jsx)(Hs,{...o,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},_c=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),Sc=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},Ec=e=>!!e?.length,Tc=e=>{const t=e&&e.trim();return!(!t||!t.match(/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i))},jc=e=>!!e,kc=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:i,isSubmitted:a}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Gs();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),o=["form"];return!t&&a&&(o.push("form--submitted"),i?o.push("form--valid"):o.push("form--invalid")),(0,Da.jsx)("form",{onSubmit:r,className:Ja([...o,e]),...n})};function Nc({id:e,error:t}){const[n,r]=(0,aa.useState)(!1);return(0,aa.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,Da.jsx)("div",{className:Ja("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,Da.jsxs)("span",{id:e,className:Ja("error__message"),children:[(0,Da.jsx)(fo,{name:"error",size:"16",alt:""}),t]})})}const Ic=({contentHint:e,id:t,labelText:n,labelClass:r,validity:i,errorText:a,children:o})=>(0,Da.jsxs)(Da.Fragment,{children:[e&&(0,Da.jsx)("span",{id:`${t}-content-hint`,className:Ja("input__content-hint"),children:e}),(0,Da.jsx)(Nc,{id:`${t}-error`,error:!i&&a}),(0,Da.jsxs)("div",{className:Ja("form-control__wrapper"),children:[(0,Da.jsx)("label",{htmlFor:t,className:Ja(r),children:n}),o]})]}),Ac=function({id:e,name:t,type:n,labelText:r,labelClass:i,contentHint:a=null,"aria-invalid":o,"aria-describedby":s,...c}){const{isSubmitted:l}=Gs(),[u,{error:d}]=Ws(t),p=l&&d,h=[];return s&&h.push(s),a&&h.push(`${e}-content-hint`),p&&h.push(`${e}-error`),(0,Da.jsx)(Ic,{id:e,contentHint:a,validity:!p,errorText:d,labelText:r,labelClass:i,children:(0,Da.jsx)("input",{...u,...c,id:e,type:n,"aria-invalid":o||p?"true":"false","aria-describedby":h.join(" ")||void 0,name:t})})};function Lc({controlName:e,describedById:t}){const{t:n}=xa();return(0,Da.jsxs)(kc,{noValidate:"true",className:Ja("options__form"),children:[(0,Da.jsx)(Ac,{id:"email-id",name:e,type:"email",className:Ja("transcript__input"),"aria-describedby":t,labelClass:Ja("label"),labelText:n("options.sendTranscript.label")}),(0,Da.jsx)("div",{className:Ja("options__actions"),children:(0,Da.jsx)("button",{type:"submit",className:Ja("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const Mc="email",Oc={sendTranscript:()=>{const[e,t]=(0,aa.useState)(void 0),{hideOption:n}=to(),{focusButton:r}=no(),{t:i}=xa(),a=so(),{sendAction:o}=Aa(),s=(0,aa.useMemo)((()=>({[Mc]:[_c(jc,i("options.sendTranscript.noEmailText")),_c(Tc,i("options.sendTranscript.invalidEmailText"))]})),[i]),c=(0,aa.useCallback)((e=>{const t=e[Mc].trim();o({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[o,n,r]),l=(0,aa.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,Da.jsx)(bc,{className:e,headingText:i("options.sendTranscript.title"),cancelButtonText:i("options.cancelButtonText"),description:i("options.sendTranscript.description"),descriptionId:a,position:{vertical:"top",horizontal:"right"},children:(0,Da.jsx)(Cc,{formId:"sendTranscript",onSubmit:c,validationSchema:s,onError:l,children:(0,Da.jsx)(Lc,{controlName:Mc,describedById:a})})})}},Rc=()=>{const{optionActive:e}=to(),t=(0,aa.useRef)(),n=Oc[t.current??e];return e&&(t.current=e),n?(0,Da.jsx)(n,{}):null},Pc=()=>{const{t:e}=xa(),{menuOptions:t,showOption:n,panelActive:r,hideOption:i}=to(),{id:a}=no(),o=(0,aa.useRef)(null),[s,c]=(0,aa.useState)(!1),l=(0,aa.useRef)(null),u=t.length,d=(0,aa.useRef)([]),p=(0,aa.useRef)(!1),h=u>1,f=t[0],m=(0,aa.useMemo)((()=>f?.name?.trim().replace(/\s+/g,"")),[f]);return(0,aa.useEffect)((()=>()=>{o.current&&clearTimeout(o.current)}),[]),(0,aa.useEffect)((()=>{s&&!p.current&&requestAnimationFrame((async()=>{await Fa(60);const e=t.findIndex((e=>e.available)),n=-1===e?0:e;d.current&&S(d.current[n])})),p.current=s}),[s,t]),u?(0,Da.jsxs)("div",{className:Ja("options__container"),onKeyDown:e=>{s&&(_(e)===C.Escape&&(c(!1),S(l.current)),_(e)===C.Home&&(d.current&&S(d.current[0]),e.preventDefault()),_(e)===C.End&&(d.current&&S(d.current[u-1]),e.preventDefault()))},onFocusOut:()=>{h&&(o.current=setTimeout((()=>{c(!1)}),200))},onFocusIn:()=>{o.current&&clearTimeout(o.current)},children:[(0,Da.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Da.jsx)("div",{className:Ja("options__dialog"),children:(0,Da.jsx)(Rc,{})})}),h&&(0,Da.jsx)(lc,{isActive:s,transitionStartState:cc.notRendered,children:(0,Da.jsx)("ul",{className:Ja(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":a,children:t.map((({name:r,title:i,available:a},o)=>(0,Da.jsx)("li",{className:Ja("options__menu__item"),role:"menuitem","data-testid":r,children:(0,Da.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[o]=e)},className:Ja(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(_(e)===C.ArrowDown){const n=Math.min(u-1,t+1);d.current&&S(d.current[t===n?0:n]),e.preventDefault()}if(_(e)===C.ArrowUp){const n=Math.max(0,t-1);d.current&&S(d.current[t===n?u-1:n]),e.preventDefault()}})(e,o),onKeyPress:e=>((e,n)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let i=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===i&&(i=t)})),-1!==i&&d.current&&S(d.current[i])})(e,o),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,a),"aria-disabled":!a,children:[(0,Da.jsxs)("span",{className:Ja("button__text"),children:[i,!a&&" "]}),a?null:(0,Da.jsx)("span",{className:Ja("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,Da.jsxs)("button",{type:"button",className:Ja(["button","button--secondary","chat__options__button",...!h&&m?[`chat__options__button--${m}`]:[]]),id:a,onClick:()=>{r&&i(),h?c((e=>!e)):f.available&&!r&&n(f.name)},onKeyDown:h?e=>{_(e)===C.ArrowDown&&(c(!0),e.preventDefault())}:void 0,ref:l,"aria-haspopup":!!h&&"menu","aria-expanded":!!h&&s,"aria-disabled":!h&&!f.available,children:[h?(0,Da.jsx)(fo,{name:"options",size:"32",alt:""}):null,(0,Da.jsx)("span",{className:Ja("button__text"),children:h?e("options.openButtonText"):`${f.title}${f.available?"":" "}`}),h||f.available?null:(0,Da.jsx)("span",{className:Ja("button__state"),children:e("options.unavailableText")})]})]}):null};function Dc(){const{menuOptions:e,allowOptionSelection:t}=to(),{isAvailable:n}=Ga(),r=Mn(Oa),{t:i,userLocale:a}=xa(),o=qa(a);if(!n&&(!t||!e.length)||r)return null;const s=i("translations.settings.openButtonText",{hasLanguage:!!o,language:o});return(0,Da.jsxs)("div",{className:Ja("chat__options"),children:[n&&(0,Da.jsx)("div",{className:Ja("chat__options-item","chat__options-item--left"),children:(0,Da.jsxs)(wc,{classNames:["button--secondary"],children:[(0,Da.jsx)(fo,{alt:s,name:"newTranslation",size:"16"}),(0,Da.jsx)("span",{className:Ja("button__text"),children:s})]})}),t&&(0,Da.jsx)("div",{className:Ja("chat__options-item","chat__options-item--right"),children:(0,Da.jsx)(Pc,{})})]})}const zc=()=>{const{scrollToRef:e,unreadIds:t}=Ys(),{isMinimized:n}=wa(),{t:r}=xa();return(0,Da.jsx)(lc,{isActive:!!t.length&&!n,children:(0,Da.jsx)("div",{className:Ja("unread-messages"),children:(0,Da.jsxs)("button",{type:"button",className:Ja("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,Da.jsx)(fo,{name:"chevronDown",size:"32",alt:""})]})})})},Uc=({children:e})=>{const t=Jn(),n=(0,aa.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,i.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:a,containerRef:o,unreadIds:s}=(e=>{const t=(0,aa.useRef)(null),[n,r]=(0,aa.useState)(!0),i=Mn(Ms),a=Jn(),o=Xn(),{isOpen:s}=wa(),c=Wn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=Mn((({state:e})=>e));(0,aa.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:i}=e,a=Math.abs(t-n-i)>10;r(!a)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,aa.useCallback)((()=>{requestAnimationFrame((async()=>{await Fa(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,aa.useEffect)((()=>{u&&d()}),[u,d]),(0,aa.useEffect)((()=>{n&&d()}),[n,i,a,o,s,c,l,d]),{containerRef:t,unreadIds:i,scrollToRef:()=>{const n=i.at(0);if(void 0!==n){const r=e[n]?.current;t.current?.scrollTo({top:r?.offsetTop,behavior:"auto",left:0})}},scrollToBottom:d}})(n);return(0,Da.jsx)(Zs.Provider,{value:{eventRefs:n,unreadIds:s,scrollToRef:r,scrollToBottom:a,containerRef:o},children:(0,Da.jsxs)("div",{className:Ja("chat__container"),children:[(0,Da.jsx)("div",{className:Ja("chat__container__scroll-area"),ref:o,children:e}),(0,Da.jsx)(zc,{})]})})},Fc=({baseClassName:e,children:t,title:n})=>{const r=Zn(),i=so();return(0,Da.jsxs)("section",{id:r,className:Ja(e),"aria-describedby":i,tabIndex:-1,children:[(0,Da.jsx)("h2",{className:Ja(`${e}__title`),id:i,children:n}),t]})},Bc=()=>{const{t:e}=xa(),t=$a(),n=io(),{emitEvent:r}=Aa(),{isActive:i,remaining:a,timer:o,endCountdown:s}=ao(),c=!!a&&a>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,Da.jsx)(Fc,{baseClassName:"idle",title:l,children:c&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("div",{className:Ja("idle__count-container"),children:i&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("span",{className:Ja("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,Da.jsx)("span",{className:Ja("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",o)})]})}),(0,Da.jsxs)("div",{className:Ja("idle__options"),children:[(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{n(),s(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{s(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},Hc=()=>{const{t:e}=xa(),t=io(),{name:n}=tr()||{},{continueChat:r,restartChat:i}=oo();return(0,Da.jsx)(Fc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,Da.jsxs)("div",{className:Ja("prompt__options"),children:[(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:i,children:e("resumeConversationPrompt.detachButton")})]})})},$c=()=>{const{sendAction:e}=Aa(),{features:t}=to(),{typingPeekahead:n}=t||{},r=(0,aa.useRef)(null),i=(0,aa.useRef)(null),a=(0,aa.useRef)(!1),o=(0,aa.useRef)(null);(0,aa.useEffect)((()=>()=>{o.current&&clearInterval(o.current),r.current&&clearTimeout(r.current),i.current&&clearTimeout(i.current)}),[]);const s=(t,r)=>{e({type:O,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(a.current=!0,o.current||(s(!0,e.target.value),o.current=setInterval((()=>{!a.current&&o.current?(clearInterval(o.current),o.current=null):n&&n.enabled&&s(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),i.current&&clearTimeout(i.current),r.current=setTimeout((()=>{a.current=!1}),300),i.current=setTimeout((()=>{s(!1,e.target.value)}),2e3))}},Vc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:i}=Wn().entryMeta,a=ia(),o=n||t||e,s=i[o]||r[o]||{},c=(0,aa.useCallback)((e=>{a(yi(e))}),[a]),l=(0,aa.useCallback)((e=>{a(fi(e))}),[a]),u=(0,aa.useCallback)((e=>{a(Pi(e))}),[a]),d=(0,aa.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:o,activeEntryOptions:s,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Gc({controlName:e,skipLinkId:t}){const{t:n}=xa(),{sendAssertive:r}=La(),{emitEvent:i}=Aa(),a=$c(),{setBlockAutoEntrySwitch:o}=Vc(),{placeholder:s,label:c,labelClass:l}=Ks(e),{hasCharacterLimit:u,reachedCharacterWarning:d,reachedCharacterLimit:p,remainingChars:h}=qs(e),[{value:f}]=Ws(e),m=!!f,y=(0,aa.useCallback)((()=>{d&&r(n("input.srCharacterLimitText",{limit:h})),i("ui.inputFocus")}),[n,r,d,h,i]);return(0,aa.useLayoutEffect)((()=>(o(m),()=>{o(!1)})),[o,m]),(0,Da.jsxs)(kc,{className:Ja("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,Da.jsxs)("div",{className:Ja(["input--text__container",...d&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,Da.jsx)(Ac,{id:t,type:"text",name:e,className:Ja("input__text"),autocomplete:"off",placeholder:s,labelText:c,labelClass:Ja(l),"aria-invalid":!!u&&p,onKeyUp:a,onFocus:y}),(0,Da.jsx)("div",{className:Ja("character-count"),children:d&&(0,Da.jsx)("span",{children:h})})]}),(0,Da.jsx)("button",{className:Ja("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!m||p,children:(0,Da.jsx)(fo,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const Wc="textMessageEntry";function qc({...e}){const{isOpen:t,setVisibility:n}=wa(),r=Zn(),i=$a(),{sendMessage:a}=Aa(),o=(0,aa.useCallback)(((e,{updateControlValue:r})=>{a({body:e[Wc]}),r(Wc,""),i(),t||n(vn.open)}),[a,i,t,n]);return(0,Da.jsx)(Cc,{...e,formId:"textEntry",persistData:!0,onSubmit:o,children:(0,Da.jsx)(Gc,{controlName:Wc,skipLinkId:r})})}const Kc=()=>{const{t:e}=xa(),{currentUploads:t}=eo();return(0,Da.jsx)("div",{className:Ja("progress"),children:t.map((({id:t,name:n,progress:r,uploading:i,error:a})=>(0,Da.jsxs)("div",{className:Ja("progress_container"),children:[(0,Da.jsxs)("div",{className:Ja("progress__text"),children:[(0,Da.jsx)("span",{className:Ja("progress__text--file-name"),children:n}),(0,Da.jsx)("span",{className:Ja("progress__text--percentage"),children:`${r}%`})]}),(0,Da.jsx)(Nc,{error:a,id:"progress-error"}),(0,Da.jsx)("progress",{className:Ja("progress__bar"),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-label":e("fileUpload.srProgressLabel",{fileName:n}),max:"100","aria-valuenow":r,value:r,"aria-busy":i,children:`${r}%`})]},t)))})};function Jc({id:e,name:t,labelText:n,contentHint:r,outputText:i,accept:a}){const{isSubmitted:o}=Gs(),[s,c]=(0,aa.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=Ws(t),p=so(),h=so(),f=so(),m=o&&d,y=[f];r&&y.push(h),m&&y.push(p);const g=(0,aa.useCallback)((()=>{c(!0)}),[c]),v=(0,aa.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,aa.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,Da.jsxs)("div",{className:Ja("upload__container"),children:[r&&(0,Da.jsx)("span",{className:Ja("upload__content-hint"),id:h,children:r}),(0,Da.jsx)(Nc,{id:p,error:m&&d}),(0,Da.jsx)("div",{className:Ja(["file-upload",...s?["focus-within"]:[]]),children:(0,Da.jsxs)("label",{htmlFor:e,className:Ja("upload__label"),children:[(0,Da.jsx)(fo,{name:"upload",size:"32",alt:""}),(0,Da.jsxs)("div",{children:[(0,Da.jsx)("span",{className:Ja(["upload__label--text"]),children:n}),(0,Da.jsx)("input",{id:e,className:Ja("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:a||null,onFocus:g,onBlur:v}),(0,Da.jsx)("span",{className:Ja("upload__output"),"aria-hidden":"true",id:f,children:i})]})]})})]})}const Xc=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:i,isComplete:a,onClickCancel:o})=>{const{t:s}=xa(),[{value:c}]=Ws(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,Da.jsxs)(kc,{className:Ja("upload-form"),children:[(0,Da.jsx)(Jc,{name:t,id:e,accept:n,labelText:s("fileUpload.labelText"),outputText:s("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,Da.jsxs)("div",{className:Ja("upload__button-container"),children:[(0,Da.jsx)("button",{id:i||!a?e:void 0,type:"button",onClick:o,className:Ja("button","button--secondary","upload__cancel"),children:s("fileUpload.cancelButtonText")}),(0,Da.jsx)("button",{className:Ja("button","button--primary"),type:"submit",children:s("fileUpload.uploadButtonText")})]})]})},Yc="fileListForm",Zc="fileList",Qc=()=>{const{t:e}=xa(),{sendPolite:t,sendAssertive:n}=La(),r=Zn(),i=$a(),{serviceAllowsUploads:a,allowedMimeTypes:o,maxSize:s}=Qa(),c=(0,aa.useRef)(null),l=(0,aa.useRef)(a),{cancelEntrySelection:u}=Vc(),{uploadFile:d,clearUploads:p,isUploading:h,isComplete:f}=eo(),{uploadHandle:m,hasServerError:y,progress:g}=((e,t)=>{const n=Mn((n=>Us(n,{formId:e,name:t}))),{currentUploads:r}=eo(),i=n&&n.length>0;let a=null,o=!1,s=0;if(r&&r.length>0){const e=r[0];a=e.uploadHandle,o=!!e.error,s=e.progress}return{hasFile:i,selectedFileName:i?n[0].name:"",uploadHandle:a,hasServerError:o,progress:s}})(Yc,Zc),v=so(),b=(0,aa.useRef)(!0),w=e("fileUpload.contentHint",{size:x(s)}),C=(0,aa.useRef)(""),_=(0,aa.useRef)(null);(0,aa.useEffect)((()=>{C.current&&_.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(w),C.current=w}),[w,n]),(0,aa.useEffect)((()=>{g>0&&t(1===g?e("fileUpload.srStartedText"):`${g}%`)}),[g,t,e]),(0,aa.useEffect)((()=>{b.current||h||!f||(p(),u(),i(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=f}),[h,f,p,u,i,t,e]);const S=(0,aa.useCallback)((({fileList:e})=>{d(e[0]),i()}),[d,!1,i]),E=(0,aa.useCallback)((()=>{m&&m.abort(),p(),u(),i()}),[m,p,u,i]),T=(0,aa.useMemo)((()=>({[Zc]:[_c((()=>a),e("fileUpload.errors.unavailable")),_c(Ec,e("fileUpload.errors.noFile")),_c(Sc,e("fileUpload.errors.tooLarge"),s)]})),[s,a,e]);return(0,Da.jsx)("div",{className:Ja(["upload",...y?["upload--error"]:[]]),ref:_,children:(0,Da.jsxs)(Cc,{formId:Yc,persistData:!0,onSubmit:S,validationSchema:T,children:[(h||!f)&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(Kc,{}),(0,Da.jsx)("div",{className:Ja("upload__button-container"),children:(0,Da.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:E,ref:c,className:Ja("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&f&&(0,Da.jsx)(Xc,{controlName:Zc,skiplinkId:r,accept:o?.join(", ")||"",contentHint:w,isComplete:f,isUploading:h,onClickCancel:E}),!l.current&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("span",{className:Ja("notification"),id:v,children:e("fileUpload.unavailableText")}),(0,Da.jsx)("div",{className:Ja("upload__button-container"),children:(0,Da.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:E,className:Ja("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},el=()=>{const{t:e}=xa(),{showFileUpload:t,serviceAllowsUploads:n}=Qa(),[r,i]=(0,aa.useState)(n||!1),a=$a(),o=(0,aa.useRef)(null),{setUserEntryType:s,activeEntry:c}=Vc(),l=(0,aa.useRef)(null),{sendPolite:u}=La(),d=!!tr();return(0,aa.useEffect)((()=>{E(l.current,(()=>{n||a()})),i(n||!1)}),[n,a]),(0,aa.useEffect)((()=>{o.current&&!n&&u(e("fileUpload.srUnavailableText")),!1===o.current&&n&&u(e("fileUpload.srAvailableText")),d&&(o.current=n)}),[n,d,u,e]),t||c===I?null:(0,Da.jsx)(lc,{isActive:r,transitionStartState:cc.rendered,children:(0,Da.jsx)("div",{className:Ja("upload-toggle-wrapper"),children:(0,Da.jsx)(lc,{isActive:r,transitionStartState:cc.visuallyHidden,children:(0,Da.jsx)("button",{className:Ja(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{s(I),a()}:void 0,children:(0,Da.jsx)(fo,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},tl=()=>{const{isOpen:e}=wa(),t=(0,aa.useRef)(null),{hasCountdown:n}=ao(),[r,i]=(0,aa.useState)(n),{hasPrompt:a}=oo(),[o,s]=(0,aa.useState)(a),c=$a(),l=(0,aa.useRef)(!1),{activeEntry:u}=Vc(),[d,p]=(0,aa.useState)({text:qc,upload:Qc}),[h,f]=(0,aa.useState)((()=>u)),m=Vn(),{accountAllowsUploads:y}=Qa(),g=(0,aa.useCallback)((()=>{E(t.current,c)}),[c]);(0,aa.useEffect)((()=>{const{customComponents:e}=m,{entry:t}=e||{};t&&p((e=>({...e,...t})))}),[m]),(0,aa.useEffect)((()=>{g(),i(n),s(a)}),[n,a,g]),(0,aa.useEffect)((()=>{f(u),g()}),[u,g,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const v=d[h];return(0,Da.jsxs)("div",{className:Ja("chat__entry"),ref:t,children:[r&&(0,Da.jsx)(Bc,{}),o&&(0,Da.jsx)(Hc,{}),(0,Da.jsxs)("div",{className:Ja(["entry__body",...n||a?["entry__body--hidden"]:[]]),children:[h!==I&&y&&e?(0,Da.jsx)(el,{}):null,(0,Da.jsx)(v,{})]})]})},nl=()=>{const{t:e}=xa(),{isOpen:t,closeChat:n}=wa(),{isWindow:r}=rr();return t&&r?(0,Da.jsx)("button",{type:"button",className:Ja("button","collapse-button"),onClick:n,children:(0,Da.jsx)(fo,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},rl=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:i,srText:a}}=Ra(),o=Aa(),s=so(),{sendPolite:c}=La(),l=$a(),u="SeamlySessionExpiredError"===e?.name;return(0,aa.useEffect)((()=>{!u&&a&&setTimeout((()=>{c(a)}),200)}),[c,a,u]),u?(0,Da.jsx)(Da.Fragment,{}):(0,Da.jsxs)("section",{className:Ja("interrupt"),"aria-labelledby":s,children:[(0,Da.jsx)(nl,{}),(0,Da.jsxs)("div",{className:Ja("interrupt__body"),children:[(0,Da.jsx)("h2",{id:s,className:Ja("interrupt__title"),children:t}),(0,Da.jsx)("p",{className:Ja("interrupt__message"),children:n}),r&&i&&(0,Da.jsx)("div",{className:Ja("interrupt__actions"),children:(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{i&&o[i]&&o[i](),l()},children:r})})]})]})},il=function({children:e}){const t=Mn(Oa),{isOpen:n}=wa();return t?(0,Da.jsx)(rl,{}):(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsxs)(Uc,{children:[(0,Da.jsxs)("div",{className:Ja("chat__container__header"),children:[(0,Da.jsx)(yc,{}),(0,Da.jsx)(nl,{})]}),e]}),(0,Da.jsx)(tl,{}),n&&(0,Da.jsx)(Dc,{})]})};function al({event:e}){const[t]=Qs(e);return(0,Da.jsx)("li",{children:(0,Da.jsx)(t,{event:e})})}function ol({events:e}){return(0,Da.jsx)("ul",{className:Ja("collapsed-chat-messages"),children:e.map((e=>(0,Da.jsx)(al,{event:e},e.payload.id)))})}function sl(){const{preChatEvents:e}=Vn(),t=Mn(Oa),{isOpen:n}=wa();return t||!e?.length||n?null:(0,Da.jsx)(ol,{events:e})}function cl(){const{t:e}=xa(),t=e("window.chat.continue"),n=(0,aa.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t}}})),[t]);return(0,Da.jsx)(ol,{events:[n]})}const ll=()=>{const e=function(){const{startChatIcon:e}=Vn();return e}(),t=tr(),n=Mn(Oa),r=t&&!n,i=r?t.avatar:e;return i?(0,Da.jsx)("img",{className:Ja(r?"avatar":"icon"),src:i,alt:""}):(0,Da.jsx)(fo,{name:"avatar",size:"32",alt:""})},ul=({onClick:e})=>{const t=Ia(),{t:n}=xa(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),i=$a(),{isOpen:a}=wa(),o=Yn(),s=(0,aa.useCallback)((()=>{e(),i()}),[i,e]);return(0,Da.jsx)(lc,{isActive:!a,transitionStartState:cc.rendered,children:(0,Da.jsxs)("button",{className:Ja("window-open-button"),"aria-label":r,"aria-hidden":a,onClick:s,children:[(0,Da.jsx)(lc,{isActive:!!o,transitionStartState:cc.notRendered,children:(0,Da.jsx)("span",{className:Ja("message-count"),"aria-hidden":"true",children:o})}),(0,Da.jsx)(ll,{})]})})},dl=(e,t,n)=>"object"==typeof e?e[t]:n,pl=n.p+"sounds/beep.mp3",hl=!!window.Notification,fl={app:()=>(0,Da.jsx)(pc,{children:(0,Da.jsx)(il,{children:(0,Da.jsx)(rc,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=ia(),{connectWhenInView:t}=Vn(),n=Mn(ar),{containerRef:r,isVisible:i}=Ca({enabled:t,freezeOnceVisible:!0});return(0,aa.useEffect)((()=>{i&&e(ta())}),[e,i]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=wa();return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(lc,{isActive:!n,transitionStartState:cc.rendered,children:(0,Da.jsxs)("div",{ref:t,className:Ja("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,Da.jsx)(sl,{}),(0,Da.jsx)(uc,{})]})}),(0,Da.jsx)(lc,{isActive:n,transitionStartState:cc.rendered,children:(0,Da.jsx)(pc,{ref:t,children:e&&(0,Da.jsx)(il,{children:n&&(0,Da.jsx)(rc,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=wa(),n=_a(),{continueChat:r,preChat:i}=Vn();return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(ul,{onClick:t}),(0,Da.jsx)(lc,{isActive:!!i&&!e&&!n,exitAfter:dl(i,"exitAfter"),enterDelay:dl(i,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Da.jsx)("div",{className:Ja("unstarted-wrapper","unstarted-wrapper--window"),children:(0,Da.jsx)(sl,{})})}),(0,Da.jsx)(lc,{isActive:r&&!e&&n,exitAfter:dl(r,"exitAfter"),enterDelay:dl(r,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Da.jsx)("div",{className:Ja("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,Da.jsx)(cl,{})})}),(0,Da.jsx)(lc,{isActive:e,transitionStartState:cc.notRendered,children:(0,Da.jsx)(pc,{children:(0,Da.jsx)(il,{children:(0,Da.jsx)(rc,{})})})})]})}};function ml(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const yl=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=Qn(),{notificationAudioURL:t}=Vn(),[n,r]=(0,aa.useState)(hl?Notification.permission:"default"),[i,a]=(0,aa.useState)(document.visibilityState),o=Mn(Os),s=(0,aa.useCallback)((async()=>{if(hl&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,aa.useMemo)((()=>"granted"===n),[n]),l=(0,aa.useMemo)((()=>"hidden"===i),[i]);(0,aa.useEffect)((()=>{"default"===n&&e&&s()}),[n,e,s]);const u=(0,aa.useCallback)((async(e,r)=>{if(o&&hl){if("default"===n&&s(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||pl);await e.play()}catch(e){console.warn(e)}if(c&&(l||!document.hasFocus())){const t=new Notification(e,r);t.onclick=function(){window.parent.focus(),window.focus(),t.close();const e=document.querySelector(`input[name=${Wc}]`);e&&e.focus()}}}}),[t,n,c,s,o,l]);return(0,aa.useEffect)((()=>{if(!o)return()=>{};function e(){a(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[o]),{permission:n,requestPermission:s,sendNotification:u}})(),[,n]=Ba(),r=Vn(),i=tr(),{proactiveMessages:a}=Qn(),{isOpen:o,isVisible:s}=wa(),c=Xa(),l=_a(),u=Mn(Ls),{body:d}=Wa(u),{userLocale:p}=xa(),h=(0,aa.useRef)(void 0),f=(0,aa.useMemo)((()=>d?"string"==typeof d?ml(d):"text"in d?ml(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?ml(d.prompt?.text):"":""),[d]);(0,aa.useEffect)((()=>{i?.name&&f&&a&&u&&h.current!==u.payload?.id&&(t(i.name,{body:f,icon:i?.avatar}),h.current=u.payload.id)}),[i?.avatar,i?.name,u,f,a,t]);const m=fl[r.layoutMode],y=(0,aa.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),g=(0,aa.useMemo)((()=>{if(p){const e=document.querySelector("html")?.getAttribute("lang");if(e!==p)return p}}),[p]);if(!m)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const v=["app",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];return"function"!=typeof c?v.push(...c):v.push(...c(r)),o||"app"===r.layoutMode||v.push("app--collapsed"),l&&v.push("app--user-responded"),s?(0,Da.jsx)("div",{className:Ja(v),lang:g,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,Da.jsx)(m,{})}):null},gl=e=>(0,Da.jsx)(Is,{...e,children:(0,Da.jsx)(yl,{})});class vl{constructor(e,n){const{namespace:r="",parentElement:i,...a}=e;this.config={...a,namespace:r},this.namespace=r,this.parentElement=i,this.externalApi=n,this.api=new we({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(t()),this.functions={},this.registerFunctions({on:this.eventBus.on,off:this.eventBus.off}),this.eventBus.on("function.register",((e,t)=>this.registerFunction(e,t))),this.eventBus.on("function.unregister",((e,t)=>this.unregisterFunction(e,t)))}async render(){const{view:e,...t}=this.config.customComponents||{},n={...this.config,parentElement:this.parentElement,customComponents:Object.keys(t).length?t:void 0},r=function({initialState:e,api:t,eventBus:n,config:r}){const i=$t({reducer:ra,preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat(function({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:i,api:a,layoutMode:s}=bn(t()),{error:c,type:l}=n,u=_r[c?.name]?new _r[c.name](c):new o(c);r?.(u,{namespace:i,api:a,layoutMode:s,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{try{return t.payload?.originalEvent?.payload?n({error:t.payload,type:t.payload?.originalEvent?.payload?.type}):t.payload?.originalError&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}({api:t}),function({api:e}){return()=>t=>n=>{const{payload:r,type:i}=n;if(i===Gr.type){if(!Kr.includes(r.name))throw new c(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}({api:t}),function({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case zi.toString():e.store.set("options",n.payload);break;case Di.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Qi)});return i}({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(fr(n)),await r.dispatch(fn()),await r.dispatch(lr()),r.dispatch(cr()),e?(0,i.render)((0,Da.jsx)(Is,{eventBus:this.eventBus,store:r,api:this.api,children:(0,Da.jsx)(e,{})}),this.parentElement):(0,i.render)((0,Da.jsx)(gl,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,i.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),this.functions={}}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}const bl=e=>"object"==typeof e&&"action"in e,xl=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),wl=class{constructor(e){this._waitingActions=[],this._instances={},this._timeoutId=void 0,this.appConfig=e,this.context={}}push(...e){(e=e.filter(bl).map(xl)).length&&(this._waitingActions.push(...e),this.handleActions())}handleActions(){const e=this._waitingActions;this._waitingActions=[],e.forEach((e=>{switch(e.action){case"init":this.handleInit(e);break;case"destroy":this.handleDestroy(e);break;default:this.handleAction(e)||this.setContext(e.action,...e.args)||this._waitingActions.push(e)}}))}instanceInitializing(e){const t=Object.keys(this._instances);return!e&&t.length>0||t.includes(e)}setContext(e,t){const{instance:n}=t;if(this.instanceInitializing(n))return!1;switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:n,locale:r}=t;return n&&r&&(this.context.userLocale=r,this.context.source=H),!0;case"setContext":const{userLocale:i,contentLocale:a}=t;return this.context.userLocale=i,this.context.contentLocale=a,i&&i!=this.appConfig?.userLocale&&(this.context.source=H),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables={...t}),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace:i}=n||t;if(i?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==i||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},window.clearTimeout(this._timeoutId),this._timeoutId=window.setTimeout((()=>{e.render()}),60)}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,i=Object.values(this._instances);return!n&&i.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),i.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new vl(e,this)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){const t={...e.context||this.appConfig.context,...this.context},n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r={...this.appConfig.defaults,...e.defaults},i={...this.appConfig,...e,api:{...this.appConfig.api,...e.api},context:Object.keys(t).length?t:void 0,defaults:Object.keys(r).length?r:void 0};return"function"==typeof this.appConfig?this.appConfig(i):i}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},Cl=()=>{const e=new URLSearchParams(window.location.search);return Array.from(e.entries()).reduce(((e,[t,n])=>({...e,[t]:n})),{})},_l=e=>new URLSearchParams(e).toString(),Sl={direction:"to_translation_locale",locale:"nl",translatedBy:"deep_l",data:{}};function El(e){switch(e.payload.type){case"cta":case"image":case"text":case"choice_prompt":return{...e,payload:{...e.payload,translatedBody:{...Sl,data:{...e.payload.body,text:e.payload.body.text?`NL - ${e.payload.body.text}`:void 0,description:e.payload.body.description?`NL - ${e.payload.body.description}`:void 0,buttonText:e.payload.body.buttonText?`NL - ${e.payload.body.buttonText}`:void 0,choices:e.payload.body.choices?e.payload.body.choices.map((e=>({...e,text:`NL - ${e.text}`}))):void 0,prompt:e.payload.body.prompt?{...e.payload.body.prompt,text:`NL - ${e.payload.body.prompt.text}`}:void 0}}}};default:return e}}const Tl={events:[],config:{layoutMode:"inline",accountConfig:{},hideOnNoUserResponse:!1,showDisclaimer:!1,showSuggestions:!0,preChat:!0},context:{},initialState:{},unreadEvents:0,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1},resumeConversationPrompt:!1,visibility:{visibility:vn.open},serviceInfo:{activeServiceSessionId:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:"Test title",subTitle:"Test subtitle"},interrupt:{error:void 0},historyLoaded:!1,skiplinkTargetId:m(),optionsButtonId:m(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},entryMeta:{default:"text",active:"text",userSelected:null,options:{},optionsOverride:{}},currentUploads:[],processingFileUploads:[]},jl={participants:{agent:{id:"agent",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}},user:{id:"user",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}}},currentAgent:"agent"},kl={type:"info",payload:{body:{subtype:"new_topic",type:"divider"},fromClient:!1,fromHistory:!0,id:m(),transactionId:"_1y9pz5fbyly",type:"divider"}},Nl={type:"info",payload:{body:{language:"Nederlands",restartButtonText:null,subtype:"new_translation",text:"[NL] Automatic translation to Dutch started. Please note that automatic translations may contain errors.",title:"[NL] Translating to Dutch",translationEnabled:!0,userLocale:"nl"},fromClient:!1,fromHistory:!0,id:m(),occurredAt:0x5c68711878df3,participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,translatedBody:null,type:"divider"}},Il={type:"info",payload:{body:{language:"Nederlands",subtype:"new_translation",text:"[NL] Automatic translation to Dutch started. Please note that automatic translations may contain errors.",translationEnabled:!0,userLocale:"nl"},fromClient:!1,fromHistory:!0,id:m(),occurredAt:0x5c68711878df3,participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,translatedBody:null,type:"divider"}},Al={type:"info",payload:{body:{language:"Nederlands",restartButtonText:"[NL] Start again",subtype:"new_translation",text:null,title:"[NL] Automatic translation to Dutch ended",translationEnabled:!1,userLocale:"nl"},fromClient:!1,fromHistory:!0,id:m(),occurredAt:0x5c68711878df3,participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,translatedBody:null,type:"divider"}},Ll={type:"info",payload:{body:{text:"This is a system generated info message",type:"text"},fromClient:!1,id:m(),participant:null,service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:null,type:"text"}},Ml={type:"info",payload:{body:{key:["info","sendTranscript","accepted"],variables:{emailAddress:"test@test.com"}},fromClient:!1,id:m(),participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,type:"translation"}},Ol={title:"You're talking to",subTitle:"Mrs. Bot"},Rl={type:"participant",payload:{fromClient:!1,fromHistory:!0,id:m(),messageStatus:"received",participant:{avatar:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMTAsMTQuOGMtMS4xLDAtMi0wLjktMi0yczAuOS0yLDItMnMyLDAuOSwyLDJTMTEuMSwxNC44LDEwLDE0Ljh6IE0xNS45LDE0LjhjMS4xLDAsMi0wLjksMi0ycy0wLjktMi0yLTIKCXMtMiwwLjktMiwyUzE0LjgsMTQuOCwxNS45LDE0Ljh6IE0yMS44LDEwLjhjLTEuMSwwLTIsMC45LTIsMnMwLjksMiwyLDJzMi0wLjksMi0yUzIyLjksMTAuOCwyMS44LDEwLjh6IE0yMS4zLDE4LjFIMTAuNwoJQzExLjcsMjMuOSwyMC4yLDIzLjksMjEuMywxOC4xeiIvPgo8L3N2Zz4K",id:"agent",introduction:"You're now talking to Mrs. Bot gimme a minit",name:"Mrs. Bot",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}},transactionId:"d63655bf-1d3d-42cf-b14e-4da9e2b6a642",type:"participant"}},Pl={type:"participant",payload:{fromClient:!1,fromHistory:!0,id:m(),messageStatus:"received",participant:{introduction:"Welcome, you are now chatting with Mrs. Bot 2, give me a minit to read back the chat history.",id:"agent",avatar:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMTAuMSwxNC45Yy0xLjEsMC0yLTAuOS0yLTJzMC45LTIsMi0yczIsMC45LDIsMlMxMS4yLDE0LjksMTAuMSwxNC45eiBNMjEuOSwxMC45Yy0xLjEsMC0yLDAuOS0yLDIKCXMwLjksMiwyLDJzMi0wLjksMi0yUzIzLDEwLjksMjEuOSwxMC45eiBNMjEuNCwxOC4ySDEwLjhDMTEuOCwyNCwyMC4zLDI0LDIxLjQsMTguMnogTTE3LjIsMjUuM2gtMi40Yy0wLjYsMC0xLjIsMC40LTEuNCwxCgljLTUuMS0wLjItOS4yLTQuNC05LjQtOS42YzAuMSwwLDAuMiwwLjEsMC40LDAuMWgwLjFjMC44LDAsMS40LTAuNiwxLjQtMS40di00LjdjMC0wLjgtMC42LTEuNC0xLjQtMS40aDBjLTAuOCwwLTEuNCwwLjYtMS40LDEuNAoJdjIuN3YydjEuMWMwLDUuOSw0LjcsMTAuNiwxMC41LDEwLjhjMC4yLDAuNSwwLjcsMC44LDEuMiwwLjhoMi40YzAuOCwwLDEuNC0wLjYsMS40LTEuNFMxOCwyNS4zLDE3LjIsMjUuM3oiLz4KPC9zdmc+Cg==",name:"Two",service:{expose:{map:{},version:3},meta:{},name:"new service",serviceSessionId:m(),settings:{}}},transactionId:m(),type:"participant"}},Dl={type:"participant",payload:{fromClient:!1,fromHistory:!0,id:m(),messageStatus:"received",participant:{id:"user",introduction:"You're now talking to Mrs. Bot gimme a minit",name:"Mrs. Bot",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}},transactionId:"d63655bf-1d3d-42cf-b14e-4da9e2b6a642",type:"participant"}},zl=({type:e,data:t,text:n})=>({type:"message",payload:{body:{type:e,text:n,data:t},participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},fromClient:!1,fromHistory:!0,id:"4efacb4d-28a0-454e-8e36-3f17eb598c5d",messageStatus:"read",transactionId:"6f9beee7-ce82-418e-9bec-8001079aa769",transactionLast:!0,type:"custom"}}),Ul={type:"message",payload:{body:{text:"What do you want to do?",type:"text",data:void 0},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"b947b684-93df-4bd9-a8ea-e2f1b5a7a480",transactionLast:!1,type:"text"}},Fl={type:"message",payload:{type:"splash",id:m(),body:{text:"Example splash message ✨",type:"text",variables:{}}}},Bl={type:"message",payload:{body:{description:"Thanks for chatting!\n\nMore info about our <strong>products</strong>?",buttonLink:"https://seamly.ai",buttonText:"View website",buttonNewTab:!0},type:"cta",fromClient:!1,fromHistory:!0,id:"f5351010-0def-452d-818f-ca22ac61792z",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1}},Hl={type:"message",payload:{body:{text:"What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am.",type:"text"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"b947b684-93df-4bd9-a8ea-e2f1b5a7a480",transactionLast:!1,type:"text"}},$l={type:"message",payload:{body:{text:"Bubble with <strong>bold</strong> <em>italic</em> <u>underline</u>",type:"text"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Vl={type:"message",payload:{body:{text:'<a href="https://google.com" data-link-id="1">Link in same window</a> and <a href="https://google.com" data-link-id="2" target="_blank">link in new window</a> embedded in text',type:"text"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Gl={type:"message",payload:{body:{text:'Here is a long link <a href="https://google.com" data-link-id="1">click me click me please click me yoohoooo please please click me here I am click me now what are you waiting for click me now now now now now click meeeeeeeeeeeeee</a> embedded in text',type:"text"},fromClient:!1,fromHistory:!0,id:"a964e54e-ea98-46ff-a952-979a47f162c0",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Wl={type:"message",payload:{body:{text:"\n <ul>\n <li>Short list item</li>\n <li>This list item is longer to showcase different type lengths of text in list items and how they reflow in the browser</li>\n <li>\n This list item has a nested list with 3 items in it.\n <ul>\n <li>First item</li>\n <li>second item</li>\n <li>Third item</li>\n </ul>\n </li>\n <li>Another one just to be sure :)</li>\n </ul>\n ",type:"text"},fromClient:!1,fromHistory:!0,id:"f5351010-0def-452d-818f-ca22ac61792a",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},ql={type:"message",payload:{body:{text:"\n <ol>\n <li>Short list item</li>\n <li>This list item is longer to showcase different type lengths of text in list items and how they reflow in the browser</li>\n <li>\n This list item has a nested list with 3 items in it.\n <ol>\n <li>First item</li>\n <li>second item</li>\n <li>Third item</li>\n </ol>\n </li>\n <li>Another one just to be sure :)</li>\n </ol>\n ",type:"text"},fromClient:!1,fromHistory:!0,id:"f5351010-0def-452d-818f-ca22ac61792a",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Kl={type:"message",payload:{body:{description:"Plaatje",isZoomable:!1,type:"image",url:"https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg"},fromClient:!1,fromHistory:!0,id:"b44ef42c-880c-43ff-b067-499e7f2e81f7",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"image"}},Jl={type:"message",payload:{body:{description:"Plaatje",isZoomable:!0,type:"image",url:"https://developers.seamly.ai/clients/web-ui/static/photos/image-portrait.jpg"},fromClient:!1,fromHistory:!0,id:"b44ef42c-880c-43ff-b067-499e7f2e81f8",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"image"}},Xl={type:"message",payload:{body:{description:"test",source:"youtube",type:"video",url:"https://www.youtube.com/embed/K7Hn1rPQouU"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"video"}},Yl={type:"message",payload:{body:{choices:[{id:"703db9b3-2157-4d4a-9f9b-c382c6a10531",text:"Dialog (this is intentionally made longer for testing purposes)",type:"choice"},{id:"1eff6098-f14f-4683-a2b8-30d1c573d45e",text:"T-Dialog",type:"choice"},{id:"a8ba3ce8-3324-4e7a-accc-944ff78ac890",text:"Customers",type:"choice"},{id:"c89956ab-cf98-4b7e-9282-7087c988153d",text:"Features",type:"choice"},{id:"9fd9a28f-462d-4f07-9661-606dbe3b9466",category:"secondary",text:"Something else",type:"choice"}],chooseAgain:!0,prompt:{text:"Type &quot;start&quot; at any time to see this menu again",type:"text",variables:{}},type:"choice_prompt"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"b947b684-93df-4bd9-a8ea-e2f1b5a7a480",transactionLast:!0,type:"choice_prompt"}},Zl={type:"message",payload:{body:{text:"This is what the user typed",type:"text"},fromClient:!0,fromHistory:!0,id:m(),messageStatus:"read",participant:"user",transactionId:"1cdefea9-7437-4672-bcf8-2c75dc99244c",transactionLast:null,type:"text"}},Ql={type:"message",payload:{body:{text:"This is what the user typed. And sometimes the user has quite a lot to say and then we get longer lines that need to wrap well and not break the styling so here goes with just such a line right here!!",type:"text"},fromClient:!0,fromHistory:!0,id:m(),messageStatus:"read",participant:"user",transactionId:"1cdefea9-7437-4672-bcf8-2c75dc99244c",transactionLast:null,type:"text"}},eu={type:"message",payload:{body:{text:'<a href="https://google.com" data-link-id="1">Link in same window</a> and <a href="https://google.com" data-link-id="2" target="_blank">link in new window</a> embedded in text',type:"text"},fromClient:!0,fromHistory:!0,id:m(),messageStatus:"read",participant:"user",transactionId:"1cdefea9-7437-4672-bcf8-2c75dc99244c",transactionLast:null,type:"text"}},tu={type:"upload",transactionId:"_vzhvnol0egf",meta:{},body:{contentType:"image/jpg",filename:"placeholder.jpg",filesize:991078,url:"https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg"}},nu={type:"message",payload:{...tu,fromClient:!1,participant:"agent",id:m()}},ru={type:"message",payload:{...tu,fromClient:!1,participant:"agent",id:m()}};sessionStorage.setItem(`image-${nu.payload.id}`,nu.payload.body.url);const iu={...nu,payload:{...nu.payload,body:{...nu.payload.body,url:void 0},id:m()}},au={type:"message",payload:{...tu,fromClient:!0,participant:"user",id:m()}};sessionStorage.setItem(`image-${au.payload.id}`,au.payload.body.url);const ou={...au,payload:{...au.payload,id:m(),body:{...au.payload.body,url:null}}},su={isActive:!1,currentLocale:void 0,isAvailable:!1,showTranslationProposal:!1,languages:[],translatedEventGroups:{},containerId:m()},cu=[{id:"1",question:"Invoices",categories:["mixed","short"]},{id:"2",question:"Temporary subscription pause",categories:["mixed","medium"]},{id:"3",question:"Cancellation",categories:["mixed","short"]},{id:"4",question:"Apps",categories:["mixed","medium"]},{id:"5",question:"At what date will my subscription end?",categories:["mixed","long"]},{id:"A",question:"Quotes",categories:["short"]},{id:"B",question:"How to get in touch with us",categories:["long"]}],lu="unstarted",uu="messages",du="errors",pu="uploads",hu="features",fu="options",mu="suggestions",yu="minimizedWindow",gu="minimizedInline",vu="translations",bu={[lu]:{heading:"Unstarted UI",description:"Test the loader here"},[uu]:{heading:"Messages",description:""},[du]:{heading:"UI errors",description:""},[pu]:{heading:"File uploads",description:""},[hu]:{heading:"Other features",description:""},[fu]:{heading:"Options",description:""},[mu]:{heading:"Suggestions",description:""},[yu]:{heading:"Minimized window",desciption:""},[gu]:{heading:"Minimized Inline",description:""},[vu]:{heading:"Translations",description:""}},xu={type:"message",payload:{type:"card",id:m(),body:{action:{ask:"",type:"ask"},buttonText:"Ask about pizzas!",description:"Pizza Margherita is a <strong>typical Neapolitan pizza</strong>.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.",image:"https://developers.seamly.ai/clients/web-ui/static/photos/card-square.jpg",title:"Pizza Margherita"}}},wu={type:"message",payload:{type:"card",id:m(),body:{action:{link:"https://seamly.ai",newTab:!0,type:"navigate"},buttonText:"Order now!",description:"Pizza Margherita is a <strong>typical Neapolitan pizza</strong>.",image:"https://developers.seamly.ai/clients/web-ui/static/photos/card-landscape.jpg",title:"Pizza Margherita"}}},Cu={type:"message",payload:{type:"card",id:m(),body:{action:{topic:"Set topic",type:"topic"},buttonText:"Set topic! (title & description optional)",image:"https://developers.seamly.ai/clients/web-ui/static/photos/card-portrait.jpg"}}},_u={type:"message",payload:{type:"card",id:m(),body:{action:{ask:"",type:"ask"},buttonText:"Ask about pizzas!",description:"Pizza Margherita is a <strong>typical Neapolitan pizza</strong>.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.",title:"Pizza Margherita"}}},Su={base:{category:lu,headingText:"Standard with loader",description:"",...Tl,isLoading:!0},fullConversation:{category:uu,headingText:"Full demo conversation",description:"",...Tl,participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[Rl,Ll,Ul,{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Hl,Pl,Zl,$l,eu,kl,Kl,ru,nu,iu,Ql,Xl,Vl,Gl,Jl,au,ou,Wl,ql,Yl,Bl]},userMessages:{category:uu,headingText:"User messages",description:"",...Tl,participantInfo:jl,events:[Zl,Ql,au,ou,eu]},withParticipants:{category:uu,headingText:"Messages with participant info",description:"",...Tl,config:{...Tl.config,overrideMessages:{agent:{showAvatar:!0,showName:!0},user:{showName:!0,showAvatar:!0}}},participantInfo:jl,events:[Ul,Zl,Hl,Ql]},textMessages:{category:uu,headingText:"Text messages",description:"",...Tl,participantInfo:jl,events:[Ul,Hl,$l,Vl,Gl,Wl,ql]},ctaMessages:{category:uu,headingText:"CTA (call to action) messages",description:"",...Tl,participantInfo:jl,events:[Bl]},imageVideoMessages:{category:uu,headingText:"Download, image and video messages",description:"",...Tl,participantInfo:jl,events:[Kl,Xl,Jl,ru,nu,au]},systemMessages:{category:uu,headingText:"System messages",description:"",...Tl,config:{overrideMessages:{timeIndicator:{enabled:!0,threshold:36e5}}},participantInfo:jl,events:[{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-432e6),id:m(),body:{text:"Long ago when a dialog started",type:"text"}}},Rl,Dl,Pl,kl,Ml,...[Nl,Al].map(El),Ll]},choicePromptMessages:{category:uu,headingText:"Choice prompt messages",description:"",...Tl,participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Ul,Yl]},timeIndicators:{category:uu,headingText:"Time Indicators",description:"",...Tl,config:{overrideMessages:{timeIndicator:{enabled:!0,threshold:36e5}}},participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-432e6),id:m(),body:{text:"Long ago when a dialog started",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-3456e5),id:m(),body:{text:"Above me should be a time indicator showing the full date",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+1-3456e5),id:m(),body:{text:"Another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+2-3456e5),id:m(),body:{text:"And another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-864e5),id:m(),body:{text:'Above me should be a time indicator showing "yesterday"',type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+1-864e5),id:m(),body:{text:"Another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+2-864e5),id:m(),body:{text:"And another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*Date.now(),id:m(),body:{text:"Above me should be a time indicator showing me the dialog continues today",type:"text"}}}]},cards:{category:uu,headingText:"Cards",description:"",...Tl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[xu,wu,Cu,_u]},carousel:{category:uu,headingText:"Carousel",description:"",...Tl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[{type:"message",payload:{type:"carousel",id:m(),body:{cards:[xu.payload.body,wu.payload.body,Cu.payload.body,_u.payload.body]}}}]},errorWithAction:{category:du,headingText:"Error with a user action",description:"",...Tl,interrupt:{error:new c(new Error("general error"))}},errorWithoutAction:{category:du,headingText:"Error without a user action",description:"",...Tl,interrupt:{error:new Cr(new Error("seamly offline error"))}},privacyDisclaimer:{category:hu,headingText:"Privacy disclaimer",description:"",...Tl,config:{...Tl.config,showDisclaimer:!0}},characterLimit:{category:hu,headingText:"Input character limit",description:"",...Tl,entryMeta:{default:"text",active:"text",userSelected:null,options:{text:{limit:120}},optionsOverride:{}}},inputLabel:{category:hu,headingText:"Input label",...Tl,entryMeta:{default:"text",active:"text",options:{text:{limit:null}},optionsOverride:{text:{label:"What is your name?",limit:null,placeholder:"Please enter your name"}}}},inputLabelWithFileUploadToggle:{category:hu,headingText:"Input label with file upload toggle button",...Tl,options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",options:{text:{limit:null}},optionsOverride:{text:{label:"What is the title of the uploaded document?",limit:null,placeholder:"Please enter the title of the document"}}}},abortTransactional:{category:hu,headingText:"Abort transaction",...Tl,events:[Ul,Zl],entryMeta:{default:"text",active:"text",options:{text:{limit:null}},optionsOverride:{},actions:{abortTransaction:{label:"Ask for another question",topicFallbackMessage:"Oops...",topicName:"abort_transaction"}},translatedActions:{}}},fileUploadToggle:{category:pu,headingText:"File upload toggle button",description:"",...Tl,options:{...Tl.options,features:{uploads:{enabled:!0}}}},fileUploadToggleHidden:{category:pu,headingText:"File upload toggle button hidden",description:"",...Tl,options:{...Tl.options,features:{uploads:{enabled:!1}}}},fileUploadInput:{category:pu,headingText:"File upload input",description:"Click on upload button to see an error",styleGuideReset:!0,...Tl,config:{...Tl.config,accountConfig:{features:{uploads:!0}}},options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",userSelected:"upload",options:{upload:{allowedMimeTypes:["image/*","application/pdf"],maxSize:10485760}},optionsOverride:{}}},fileUploadBusy:{category:pu,headingText:"File upload in progress",description:"",styleGuideReset:!0,...Tl,config:{...Tl.config,accountConfig:{features:{uploads:!0}}},options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",userSelected:"upload",options:{upload:{allowedMimeTypes:["image/*","application/pdf"],maxSize:10485760}},optionsOverride:{}},currentUploads:[{id:"_2olggurqhb4",name:"gGeyr3WepujbGn7khx.gif",progress:29,uploading:!0,complete:!1,error:"",uploadHandle:{abort:()=>{}}}]},fileUploadError:{category:pu,headingText:"File upload errored",description:"",styleGuideReset:!0,...Tl,config:{...Tl.config,accountConfig:{features:{uploads:!0}}},options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",userSelected:"upload",options:{upload:{allowedMimeTypes:["image/*","application/pdf"],maxSize:10485760}},optionsOverride:{}},currentUploads:[{id:"_2olggurqhb4",name:"gGeyr3WepujbGn7khx.gif",progress:0,uploading:!1,complete:!1,error:"Something went wrong with the upload",uploadHandle:{abort:()=>{}}}]},idleTimerCountdown:{category:hu,headingText:"Idle timer with countdown",description:"",...Tl,idleDetachCountdown:{hasCountdown:!0,isActive:!0,count:120,remaining:91,timer:{minutes:1,seconds:31}}},idleTimerNoCountdown:{category:hu,headingText:"Idle timer without countdown",description:"",...Tl,idleDetachCountdown:{hasCountdown:!0,isActive:!1,count:120,remaining:91,timer:{minutes:1,seconds:31}}},resumeConversationPrompt:{category:hu,headingText:"Resume conversation prompt",description:"",...Tl,participantInfo:jl,resumeConversationPrompt:!0},optionsSingleTriggerAvailable:{category:fu,headingText:"Single option available",description:"",...Tl,options:{...Tl.options,features:{sendTranscript:{enabled:!0}}}},optionsSingleTriggerUnavailable:{category:fu,headingText:"Single option",description:"Option unavailable",...Tl,options:{...Tl.options,features:{sendTranscript:{enabled:!1}}}},optionsMultiple:{category:fu,headingText:"Multiple options",description:"All options available",...Tl,options:{...Tl.options,features:{extraMenuItem:{enabled:!0},sendTranscript:{enabled:!0}}}},optionsMultipleUnavailable:{category:fu,headingText:"Multiple options",description:"Some unavailable",...Tl,options:{...Tl.options,features:{extraMenuItem:{enabled:!1},sendTranscript:{enabled:!0}}}},optionSendTranscript:{category:fu,headingText:"Send transcript option",description:"Press submit to view error message",...Tl,options:{...Tl.options,optionActive:"sendTranscript",panelActive:!0,features:{sendTranscript:{enabled:!0}}}},translationsAvailable:{category:vu,headingText:"Show translations available",description:"",...Tl,translations:{...su,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"}]}},translationsAvailableWithOptions:{category:vu,headingText:"Show translations available with other options available",description:"",...Tl,options:{...Tl.options,features:{sendTranscript:{enabled:!0}}},config:{...Tl.config,context:{...Tl.context,contentLocale:"nl",userLocale:"en"}},translations:{...su,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"},{locale:"ar",nativeName:"Arabic"},{locale:"bg",nativeName:"Bulgarian"},{locale:"zh",nativeName:"Chinese"},{locale:"cs",nativeName:"Czech"},{locale:"da",nativeName:"Danish"},{locale:"et",nativeName:"Estonian"},{locale:"fi",nativeName:"Finnish"},{locale:"fr",nativeName:"French"},{locale:"de-informal",nativeName:"German"},{locale:"el",nativeName:"Greek"},{locale:"hu",nativeName:"Hungarian"},{locale:"it",nativeName:"Italian"},{locale:"ja",nativeName:"Japanese"},{locale:"lv",nativeName:"Latvian"},{locale:"pl",nativeName:"Polish"},{locale:"ro",nativeName:"Romanian"},{locale:"ru",nativeName:"Russian"},{locale:"sk",nativeName:"Slovak"},{locale:"sl",nativeName:"Slovenian"},{locale:"es-informal",nativeName:"Spanish"},{locale:"sv",nativeName:"Swedish"},{locale:"ti",nativeName:"Tigrinya"},{locale:"tr",nativeName:"Turkish"},{locale:"uk",nativeName:"Ukrainian"}]}},translationsActive:{category:vu,headingText:"Show translations active",description:"",...Tl,translations:{...su,currentLocale:"nl",isActive:!0,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"}]}},translationsActiveLarge:{category:vu,headingText:"Show translations active (large list)",description:"",...Tl,config:{...Tl.config,context:{...Tl.context,contentLocale:"nl",userLocale:"en"}},translations:{...su,currentLocale:"lv",isActive:!0,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"},{locale:"ar",nativeName:"Arabic"},{locale:"bg",nativeName:"Bulgarian"},{locale:"zh",nativeName:"Chinese"},{locale:"cs",nativeName:"Czech"},{locale:"da",nativeName:"Danish"},{locale:"et",nativeName:"Estonian"},{locale:"fi",nativeName:"Finnish"},{locale:"fr",nativeName:"French"},{locale:"de-informal",nativeName:"German"},{locale:"el",nativeName:"Greek"},{locale:"hu",nativeName:"Hungarian"},{locale:"it",nativeName:"Italian"},{locale:"ja",nativeName:"Japanese"},{locale:"lv",nativeName:"Latvian"},{locale:"pl",nativeName:"Polish"},{locale:"ro",nativeName:"Romanian"},{locale:"ru",nativeName:"Russian"},{locale:"sk",nativeName:"Slovak"},{locale:"sl",nativeName:"Slovenian"},{locale:"es-informal",nativeName:"Spanish"},{locale:"sv",nativeName:"Swedish"},{locale:"ti",nativeName:"Tigrinya"},{locale:"tr",nativeName:"Turkish"},{locale:"uk",nativeName:"Ukrainian"}]}},translationsFullConversation:{category:vu,headingText:"Show translated messages",description:"",...Tl,participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[Nl,Ll,Ul,{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Hl,Zl,$l,kl,Il,Al,Kl,nu,iu,Ql,Xl,Vl,Gl,Jl,au,ou,Wl,ql,Yl,Bl,Al].map(El),translations:{...su,currentLocale:"nl",isActive:!0,isAvailable:!0,translatedEventGroups:{[Nl.payload.id]:[Ll,Ul,{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Hl,Zl,$l,kl].map((e=>e.payload.id)),[Il.payload.id]:[Kl,nu,iu,Ql,Xl,Vl,Gl,Jl,au,ou,Wl,ql,Yl,Bl].map((e=>e.payload.id))},languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"}]}},translationProposal:{category:vu,headingText:"Show translation proposal",description:"",...Tl,events:[Ul,Zl,Ql],config:{...Tl.config,showDisclaimer:!0,context:{contentLocale:"nl-informal",userLocale:"en-GB"}},translations:{...su,translationProposal:{buttonLabel:"Activate",proposedLocale:"en-GB",srDismissButtonText:"Dismiss translation proposal",titleLabel:"Do you want to chat in English?"},isAvailable:!0,isActive:!1,languages:[{locale:"nl-informal",nativeName:"Dutch"},{locale:"en-GB",nativeName:"English"}]}},translationProposalWithoutTitle:{category:vu,headingText:"Show translation proposal without title",description:"",...Tl,events:[Ul,Zl,Ql],config:{...Tl.config,showDisclaimer:!0,context:{contentLocale:"nl-informal",userLocale:"en-GB"}},translations:{...su,translationProposal:{buttonLabel:"Activate",proposedLocale:"en-GB",srDismissButtonText:"Dismiss translation proposal"},isAvailable:!0,isActive:!1,languages:[{locale:"nl-informal",nativeName:"Dutch"},{locale:"en-GB",nativeName:"English"}]}}},Eu={minimizedInline:{category:gu,headingText:"Inline minimized",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.minimized}}},minimizedInlineCharacterLimit:{category:gu,headingText:"Inline minimized with limited characters",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.minimized},entryMeta:{...Tl.entryMeta,options:{text:{limit:120}}}}},minimizedInlinePrechat:{category:gu,headingText:"Inline minimized with pre-chat messages",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline",preChatEvents:[Fl]},visibility:{...Tl.visibility,visibility:vn.minimized}}},minimizedInlinePrechatSuggestions:{category:gu,headingText:"Inline minimized with pre-chat messages & suggestions",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline",preChatEvents:[Fl]},serviceData:{suggestion:{body:cu}},visibility:{...Tl.visibility,visibility:vn.minimized}}},inlineWithSuggestions:{category:mu,headingText:"Suggestions",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.open},serviceData:{suggestion:{body:cu}}}},minimizedInlineWithError:{category:gu,headingText:"Inline minimized with error",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.minimized},interrupt:{error:new Cr(new Error("seamly offline error"))}}}},Tu={minimizedWindow:{category:yu,headingText:"Unstarted minimized",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window"},visibility:{...Tl.visibility,visibility:vn.minimized}}},minimizedWindowStarted:{category:yu,headingText:"Started minimized",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window"},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}},minimizedWindowStartedUnread:{category:yu,headingText:"Minimized with unread messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window"},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol,unreadEvents:12}}},ju={suggestionsMessage:{category:uu,headingText:"Suggestions message",description:"",...Tl,events:[zl(Ul.payload.body),{type:"service_data",payload:{type:"suggestion",body:cu}}]}},ku=(e,t=[])=>{const n={...Su,fullConversation:{...Su.fullConversation,events:[Fl,...Su.fullConversation.events]},...ju,...t.reduce(((e,t)=>{const{key:n,headingText:r,description:i,body:a}=t;return{...e,[n]:{category:uu,headingText:r,description:i,...Tl,participantInfo:jl,events:[zl(a)]}}}),{})};return Object.keys(n).reduce(((t,r)=>{const{headingText:i,category:a,description:o,...s}=n[r];return{...t,[r]:{headingText:i,description:o,category:a,...e.reduce(((e,t)=>({...e,[t]:{...s,config:{...s.config,layoutMode:t}}})),{})}}}),{})},Nu=({setSelectedState:e,states:t,headingLevel:n})=>{const r=`h${n.toString()}`,i=`h${(parseInt(n,10)+1).toString()}`,a=Cl();return(0,Da.jsx)("nav",{"aria-label":"Style guide navigation",className:"nav--styleguide",children:(0,Da.jsx)("ol",{className:"list--styleguidestates",children:Object.keys(bu).map((n=>{const{heading:o,description:s}=bu[n],c=Object.keys(t).filter((e=>{const{category:r}=t[e];return r===n}));return c.length>0&&(0,Da.jsxs)("li",{children:[(0,Da.jsx)(r,{children:o}),(0,Da.jsx)("span",{className:"category__description",children:s}),(0,Da.jsx)("ol",{children:c.map((n=>{const r={...t[n]};delete r.category;const{headingText:o,descriptionId:s,description:c,...l}=r;return(0,Da.jsxs)("li",{children:[(0,Da.jsx)(i,{id:s,children:o}),c&&(0,Da.jsx)("span",{className:"feature__description",children:c}),(0,Da.jsx)("ul",{className:"list--styleguidelayouts",children:Object.keys(l).map((t=>(0,Da.jsx)("li",{className:t===a?.layoutMode&&n===a?.feature?"state__selected":void 0,children:(0,Da.jsx)("a",{"aria-describedby":s,href:`${window.location.pathname}?${_l({layoutMode:t,feature:n})}`,"aria-current":t===a?.layoutMode&&n===a?.feature?"page":void 0,onClick:r=>{if(r.preventDefault(),"inline"===t){const e=window.document.querySelector(".chat-inline");e&&window.scroll({top:e.offsetTop,behavior:"smooth"})}var i;i={layoutMode:t,feature:n},window.history.pushState(null,"",`${window.location.pathname}?${_l(i)}`),e(i)},children:t.charAt(0).toUpperCase()+t.slice(1)})},t)))})]},n)}))})]},n)}))})})},Iu=require("@seamly/web-ui"),Au={send:()=>{},reset:()=>Promise.resolve({api:{key:"wilson-faqs-on-attach",domain:"api.uat.seamly-app.com",secure:!0},connectWhenInView:!0,layoutMode:"inline",preChatEvents:[],defaults:{visible:"open"},hideOnNoUserResponse:!0,showDisclaimer:!0,notificationAudioURL:void 0,agentParticipant:{}}),store:{get:e=>e,set:e=>e,delete:e=>e},sendContext:()=>{},hasConversation:()=>!1,connected:!1},Lu=({state:e,translations:t,participants:n=[],children:r})=>{const i=(0,aa.useRef)((()=>{})),a=(0,aa.useRef)({emit:()=>{},on:()=>{},off:()=>{}}),o=(0,aa.useMemo)((()=>{const{translations:r,interrupt:i,config:o={},visibility:s,...c}=e||{},l=$t({reducer:{state:Hi,app:wr,config:gr,i18n:Br,translations:Zi,visibility:na,forms:Rr,interrupt:qr},preloadedState:{state:c,config:o,translations:r,interrupt:i,visibility:s},middleware:e=>e({thunk:{extraArgument:{api:Au,eventBus:a.current}},serializableCheck:!1})}),{config:u}=l.getState();return l.dispatch(fr(u)),u.preChatEvents&&l.dispatch(yr(u.preChatEvents)),l.dispatch(Ur("en-GB")),l.dispatch(Fr(t)),n.forEach((e=>{l.dispatch(Ti({participant:e,fromClient:"user"===e?.id}))})),l}),[n,e,t]);return e&&(0,Da.jsx)(Iu.SeamlyStoreProvider,{store:o,children:(0,Da.jsx)(Iu.SeamlyEventBusContext.Provider,{value:a.current,children:(0,Da.jsx)(Iu.SeamlyApiContext.Provider,{value:Au,children:(0,Da.jsx)(Iu.SeamlyLiveRegionContext.Provider,{value:i.current,children:(0,Da.jsx)(Iu.ComponentFilter,{children:(0,Da.jsx)(Iu.SeamlyActivityMonitor,{children:(0,Da.jsx)(Iu.SeamlyFileUpload,{children:r})})})})})})})},Mu=({state:e,customComponents:t={},translations:n,participants:r})=>{const[i,a]=(0,aa.useState)(!0),{config:o}=e||{},{layoutMode:s}=o||{},c=t[s];return(0,aa.useEffect)((()=>{a(!1),requestAnimationFrame((async()=>{await Fa(60),a(!0)}))}),[e]),i?c?(0,Da.jsx)(Lu,{state:e,translations:n,participants:r,children:(0,Da.jsx)(c,{})}):(0,Da.jsx)(Lu,{state:e,translations:n,participants:r,children:(0,Da.jsx)(Iu.View,{})}):null},Ou=({tag:e,id:t,children:n})=>{const r=e;return(0,Da.jsx)(r,{id:t,children:n})},Ru=({config:e,styleGuideConfig:t,translations:n,headingLevel:r=2,participants:i})=>{const[a,o]=(0,aa.useState)(null),[s,c]=(0,aa.useState)(""),[l,u]=(0,aa.useState)(!0),[d]=(0,aa.useState)(m()),{stateUpdateCallback:p,customMessageEventBodies:h}=t,[f]=(0,aa.useState)((()=>{const e=(n=t.showLayoutModes||["inline","window"],{...ku(n,h),...-1!==n.indexOf("window")?{...Tu,minimizedWindowPrechat:{category:yu,headingText:"Minimized with pre-chat messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window",preChatEvents:[Fl]},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}},minimizedWindowPrechatDelayed:{category:yu,headingText:"Minimized with delayed pre-chat messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window",preChatEvents:[Fl],preChat:{enterDelay:1e3,exitAfter:3e3}},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}},minimizedWindowPrechatDisabled:{category:yu,headingText:"Minimized with disabled pre-chat messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window",preChatEvents:[Fl],preChat:!1},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}}}:{},...Eu});var n;return Object.keys(e).reduce(((t,n)=>({...t,[n]:{...e[n],descriptionId:m()}})),{})})),y=(0,aa.useCallback)((e=>{o(p?p(e):e)}),[o,p]),g=(0,aa.useCallback)(((t,n)=>{const r=((...e)=>{const t=new URL(window.location.href);return e.reduce(((e,n)=>{const r=t.searchParams.get(n)||sessionStorage.getItem(n);return r&&(e[n]=r),e}),{})})("apiKey","locale"),a=new URLSearchParams({...r,layoutMode:t,feature:n});window.history.replaceState(null,"",`?${a}`);const{headingText:o}=f[n];c(o);const s=f[n][t],{overrideMessages:l,showSuggestions:u}=s.config,d=i.find((e=>"agent"===e.id));return{...s,config:{...s.config,...e,showDisclaimer:s.config.showDisclaimer||e.showDisclaimer,context:{...e.context,...s.config?.context},layoutMode:s.config.layoutMode,...l?{messages:l}:{},showSuggestions:u},headerTitles:{...s.headerTitles,subTitle:d?.name||s.headerTitles.subTitle}}}),[f,i,e]);(0,aa.useEffect)((()=>{if(l){const e=document.querySelector('[aria-modal="true"]');e&&e.addEventListener("click",(()=>{o((e=>e?{...e,visibility:{...e.visibility,visible:"minimized"}}:e))}))}}),[a,o,l]);const v=(0,aa.useCallback)((()=>{const e=Cl(),{layoutMode:t,feature:n}={layoutMode:"inline",feature:"base",...e};y(g(t,n)),window.document.title="Style"}),[g,y]);return(0,aa.useEffect)((()=>{v()}),[v]),(0,aa.useEffect)((()=>{window.onpopstate=()=>{v()}}),[v]),(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsxs)("section",{className:"chat-inline","aria-labelledby":d,children:[(0,Da.jsxs)(Ou,{tag:`h${r.toString()}`,id:d,children:[(0,Da.jsx)("span",{className:"heading__context",children:"Current selected state:"}),`${s}`]}),(0,Da.jsx)("div",{children:l&&(0,Da.jsx)(Mu,{customComponents:t.customComponents,translations:n,state:a,participants:i})})]}),(0,Da.jsx)("aside",{className:"page-aside markdown",children:(0,Da.jsx)("nav",{className:"page-controls",children:(0,Da.jsx)(Nu,{headingLevel:r,setSelectedState:({layoutMode:e,feature:t})=>{const n=g(e,t);y(n),n.styleGuideReset&&(u(!1),setTimeout((()=>{u(!0)})))},states:f})})})]})},Pu=class extends vl{constructor({styleGuideConfig:e,...t},n){super(t,n),this.styleGuideConfig=e||{}}async render(){const e={...this.config.customComponents||{},view:void 0},t=new we({namespace:this.config.namespace,config:this.config.api,context:this.config.context,layoutMode:this.config.layoutMode});t.URLS={translations:`/client/${this.config.api.key}/translations/{version}/{locale}.json`};const n=await t.getTranslations(this.config.context?.userLocale||"en-GB"),{agentParticipant:r,userParticipant:a}=await t.getConfig(),o=[{id:"user",...a},{id:"agent",introduction:"I am {{name}}",...r}],s={...this.config,customComponents:Object.keys(e).length?e:void 0};(0,i.render)((0,Da.jsx)(Ru,{config:s,styleGuideConfig:this.styleGuideConfig,translations:n,participants:o}),this.parentElement)}},Du=class extends wl{constructor(e,t){super(e),this.styleGuideConfig=t}createInstance(e){const{userStyleGuideConfig:t,...n}=e;return new Pu({styleGuideConfig:{...this.styleGuideConfig,...t},...n},this)}getUserConfig(e={},t){return super.getUserConfig({...e,...t})}},zu=function(e,t){if(window.seamlyStyleGuide&&!Array.isArray(window.seamlyStyleGuide))throw new Error("Seamly UI has already been initialised. Use the window.seamly object to start new instances instead.");const n=Array.isArray(window.seamlyStyleGuide)?window.seamlyStyleGuide:[],r=new Du(e,t);window.seamly=r,window.seamlyStyleGuide={push:r.push.bind(r)},r.push(...n)}})(),module.exports=r})();
2
+ (()=>{var e={2086:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,i){return(t[n]=t[n]||[]).push([r,i]),e},e.off=function(r,i){r||(t={});for(var a=t[r]||n,o=a.length=i?a.length:0;o--;)i==a[o][0]&&a.splice(o,1);return e},e.emit=function(r){for(var i,a=t[r]||n,o=a.length>0?a.slice(0,a.length):a,s=0;i=o[s++];)i[0].apply(i[1],n.slice.call(arguments,1));return e}}},7402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>f,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>c,StrictMode:()=>te,Suspense:()=>b,SuspenseList:()=>C,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>V,cloneElement:()=>X,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>W,createPortal:()=>T,createRef:()=>r.createRef,default:()=>le,findDOMNode:()=>Z,flushSync:()=>ee,forwardRef:()=>p,hydrate:()=>O,isElement:()=>oe,isFragment:()=>K,isMemo:()=>J,isValidElement:()=>q,lazy:()=>w,memo:()=>l,render:()=>M,startTransition:()=>ne,unmountComponentAtNode:()=>Y,unstable_batchedUpdates:()=>Q,useDeferredValue:()=>re,useInsertionEffect:()=>ae,useSyncExternalStore:()=>se,useTransition:()=>ie,version:()=>G});var r=n(8785),i=n(1162),a={};for(const e in i)["default","Component","Fragment","createContext","createElement","createRef","Children","PureComponent","StrictMode","Suspense","SuspenseList","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","cloneElement","createFactory","createPortal","findDOMNode","flushSync","forwardRef","hydrate","isElement","isFragment","isMemo","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(a[e]=()=>i[e]);function o(e,t){for(var n in t)e[n]=t[n];return e}function s(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}function l(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:s(this.props,e)}function i(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return i.displayName="Memo("+(e.displayName||e.name)+")",i.prototype.isReactComponent=!0,i.__f=!0,i}n.d(t,a),(c.prototype=new r.Component).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return s(this.props,e)||s(this.state,t)};var u=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),u&&u(e)};var d="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function p(e){function t(t){var n=o({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=d,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var h=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},f={map:h,forEach:h,count:function(e){return e?(0,r.toChildArray)(e).length:0},only:function(e){var t=(0,r.toChildArray)(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:r.toChildArray},m=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);m(e,t,n,r)};var y=r.options.unmount;function g(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=o({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return g(e,t,n)}))),e}function v(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function b(){this.__u=0,this.t=null,this.__b=null}function x(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function w(e){var t,n,i;function a(a){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){i=e})),i)throw i;if(!n)throw t;return(0,r.createElement)(n,a)}return a.displayName="Lazy",a.__f=!0,a}function C(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),y&&y(e)},(b.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=x(r.__v),a=!1,o=function(){a||(a=!0,n.__R=null,i?i(s):s())};n.__R=o;var s=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=v(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},b.prototype.componentWillUnmount=function(){this.t=[]},b.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=g(this.__b,n,i.__O=i.__P)}this.__b=null}var a=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return a&&(a.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),a]};var _=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function S(e){return this.getChildContext=function(){return e.context},e.children}function E(e){var t=this,n=e.i;t.componentWillUnmount=function(){(0,r.render)(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),(0,r.render)((0,r.createElement)(S,{context:t.context},e.__v),t.l)}function T(e,t){var n=(0,r.createElement)(E,{__v:e,i:t});return n.containerInfo=t,n}(C.prototype=new r.Component).__a=function(e){var t=this,n=x(t.__v),r=t.o.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),_(t,e,r)):i()};n?n(a):a()}},C.prototype.render=function(e){this.u=null,this.o=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},C.prototype.componentDidUpdate=C.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var j="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,k=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,N=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,I=/[A-Z0-9]/g,A="undefined"!=typeof document,L=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function M(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function O(e,t,n){return(0,r.hydrate)(e,t),"function"==typeof n&&n(),e?e.__c:null}r.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(r.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var R=r.options.event;function P(){}function D(){return this.cancelBubble}function z(){return this.defaultPrevented}r.options.event=function(e){return R&&(e=R(e)),e.persist=P,e.isPropagationStopped=D,e.isDefaultPrevented=z,e.nativeEvent=e};var U,F={enumerable:!1,configurable:!0,get:function(){return this.class}},B=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var a in t){var o=t[a];if(!("value"===a&&"defaultValue"in t&&null==o||A&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var s=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===o?o="":"translate"===s&&"no"===o?o=!1:"ondoubleclick"===s?a="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||L(t.type)?"onfocus"===s?a="onfocusin":"onblur"===s?a="onfocusout":N.test(a)?a=s:-1===n.indexOf("-")&&k.test(a)?a=a.replace(I,"-$&").toLowerCase():null===o&&(o=void 0):s=a="oninput","oninput"===s&&i[a=s]&&(a="oninputCapture"),i[a]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",F)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=j,B&&B(e)};var H=r.options.__r;r.options.__r=function(e){H&&H(e),U=e.__c};var $=r.options.diffed;r.options.diffed=function(e){$&&$(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),U=null};var V={ReactCurrentDispatcher:{current:{readContext:function(e){return U.__n[e.__c].props.value},useCallback:i.useCallback,useContext:i.useContext,useDebugValue:i.useDebugValue,useDeferredValue:re,useEffect:i.useEffect,useId:i.useId,useImperativeHandle:i.useImperativeHandle,useInsertionEffect:ae,useLayoutEffect:i.useLayoutEffect,useMemo:i.useMemo,useReducer:i.useReducer,useRef:i.useRef,useState:i.useState,useSyncExternalStore:se,useTransition:ie}}},G="17.0.2";function W(e){return r.createElement.bind(null,e)}function q(e){return!!e&&e.$$typeof===j}function K(e){return q(e)&&e.type===r.Fragment}function J(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function X(e){return q(e)?r.cloneElement.apply(null,arguments):e}function Y(e){return!!e.__k&&((0,r.render)(null,e),!0)}function Z(e){return e&&(e.base||1===e.nodeType&&e)||null}var Q=function(e,t){return e(t)},ee=function(e,t){return e(t)},te=r.Fragment;function ne(e){e()}function re(e){return e}function ie(){return[!1,ne]}var ae=i.useLayoutEffect,oe=q;function se(e,t){var n=t(),r=(0,i.useState)({h:{__:n,v:t}}),a=r[0].h,o=r[1];return(0,i.useLayoutEffect)((function(){a.__=n,a.v=t,ce(a)&&o({h:a})}),[e,n,t]),(0,i.useEffect)((function(){return ce(a)&&o({h:a}),e((function(){ce(a)&&o({h:a})}))}),[e]),n}function ce(e){var t,n,r=e.v,i=e.__;try{var a=r();return!((t=i)===(n=a)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var le={useState:i.useState,useId:i.useId,useReducer:i.useReducer,useEffect:i.useEffect,useLayoutEffect:i.useLayoutEffect,useInsertionEffect:ae,useTransition:ie,useDeferredValue:re,useSyncExternalStore:se,startTransition:ne,useRef:i.useRef,useImperativeHandle:i.useImperativeHandle,useMemo:i.useMemo,useCallback:i.useCallback,useContext:i.useContext,useDebugValue:i.useDebugValue,version:"17.0.2",Children:f,render:M,hydrate:O,unmountComponentAtNode:Y,createPortal:T,createElement:r.createElement,createContext:r.createContext,createFactory:W,cloneElement:X,createRef:r.createRef,Fragment:r.Fragment,isValidElement:q,isElement:oe,isFragment:K,isMemo:J,findDOMNode:Z,Component:r.Component,PureComponent:c,memo:l,forwardRef:p,flushSync:ee,unstable_batchedUpdates:Q,StrictMode:te,Suspense:b,SuspenseList:C,lazy:w,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:V}},7154:(e,t,n)=>{"use strict";var r=n(7402),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useSyncExternalStore,o=r.useRef,s=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c((function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return o=t}return o=e}if(t=o,i(a,e))return t;var n=r(e);return void 0!==u&&u(t,n)?t:(a=e,o=n)}var a,o,s=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,u]);var h=a(e,d[0],d[1]);return s((function(){p.hasValue=!0,p.value=h}),[h]),l(h),h}},8418:(e,t,n)=>{"use strict";e.exports=n(7154)},8785:e=>{"use strict";e.exports=require("preact")},1162:e=>{"use strict";e.exports=require("preact/hooks")},9306:(e,t,n)=>{"use strict";var r=n(4901),i=n(6823),a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+" is not a function")}},3506:(e,t,n)=>{"use strict";var r=n(3925),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a("Can't set "+i(e)+" as a prototype")}},7080:(e,t,n)=>{"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},679:(e,t,n)=>{"use strict";var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),i=String,a=TypeError;e.exports=function(e){if(r(e))return e;throw new a(i(e)+" is not an object")}},9617:(e,t,n)=>{"use strict";var r=n(5397),i=n(5610),a=n(6198),o=function(e){return function(t,n,o){var s=r(t),c=a(s);if(0===c)return!e&&-1;var l,u=i(o,c);if(e&&n!=n){for(;c>u;)if((l=s[u++])!=l)return!0}else for(;c>u;u++)if((e||u in s)&&s[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},4527:(e,t,n)=>{"use strict";var r=n(3724),i=n(4376),a=TypeError,o=Object.getOwnPropertyDescriptor,s=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=s?function(e,t){if(i(e)&&!o(e,"length").writable)throw new a("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4576:(e,t,n)=>{"use strict";var r=n(9504),i=r({}.toString),a=r("".slice);e.exports=function(e){return a(i(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),i=n(4901),a=n(4576),o=n(8227)("toStringTag"),s=Object,c="Arguments"===a(function(){return arguments}());e.exports=r?a:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),o))?n:c?a(t):"Object"===(r=a(t))&&i(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),i=n(5031),a=n(7347),o=n(4913);e.exports=function(e,t,n){for(var s=i(t),c=o.f,l=a.f,u=0;u<s.length;u++){var d=s[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},6699:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),a=n(6980);e.exports=r?function(e,t,n){return i.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6840:(e,t,n)=>{"use strict";var r=n(4901),i=n(4913),a=n(283),o=n(9433);e.exports=function(e,t,n,s){s||(s={});var c=s.enumerable,l=void 0!==s.name?s.name:t;if(r(n)&&a(n,l,s),s.global)c?e[t]=n:o(t,n);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},9433:(e,t,n)=>{"use strict";var r=n(4475),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,n)=>{"use strict";var r=n(4475),i=n(34),a=r.document,o=i(a)&&i(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},5002:e=>{"use strict";e.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},9392:e=>{"use strict";e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7388:(e,t,n)=>{"use strict";var r,i,a=n(4475),o=n(9392),s=a.process,c=a.Deno,l=s&&s.versions||c&&c.version,u=l&&l.v8;u&&(i=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&o&&(!(r=o.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(e,t,n)=>{"use strict";var r=n(9504),i=Error,a=r("".replace),o=String(new i("zxcasd").stack),s=/\n\s*at [^:]*:[^\n]*/,c=s.test(o);e.exports=function(e,t){if(c&&"string"==typeof e&&!i.prepareStackTrace)for(;t--;)e=a(e,s,"");return e}},6518:(e,t,n)=>{"use strict";var r=n(4475),i=n(7347).f,a=n(6699),o=n(6840),s=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,p,h,f=e.target,m=e.global,y=e.stat;if(n=m?r:y?r[f]||s(f,{}):r[f]&&r[f].prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(h=i(n,u))&&h.value:n[u],!l(m?u:f+(y?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&a(p,"sham",!0),o(n,u,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),i=n(9297),a=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,s=i(a,"name"),c=s&&"something"===function(){}.name,l=s&&(!r||r&&o(a,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:l}},6706:(e,t,n)=>{"use strict";var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},9504:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,a=i.call,o=r&&i.bind.bind(a,a);e.exports=r?o:function(e){return function(){return a.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4475),i=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],i(n)?n:void 0):r[e]&&r[e][t];var n}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},5966:(e,t,n)=>{"use strict";var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},3789:(e,t,n)=>{"use strict";var r=n(9306),i=n(8551),a=n(9565),o=n(1291),s=n(1767),c="Invalid size",l=RangeError,u=TypeError,d=Math.max,p=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return s(i(a(this.keys,this.set)))},includes:function(e){return a(this.has,this.set,e)}},e.exports=function(e){i(e);var t=+e.size;if(t!=t)throw new u(c);var n=o(t);if(n<0)throw new l(c);return new p(e,n)}},4475:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),a=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},421:e=>{"use strict";e.exports={}},5917:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039),a=n(4055);e.exports=!r&&!i((function(){return 7!==Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),a=n(4576),o=Object,s=r("".split);e.exports=i((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"===a(e)?s(e,""):o(e)}:o},3167:(e,t,n)=>{"use strict";var r=n(4901),i=n(34),a=n(2967);e.exports=function(e,t,n){var o,s;return a&&r(o=t.constructor)&&o!==n&&i(s=o.prototype)&&s!==n.prototype&&a(e,s),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),i=n(4901),a=n(7629),o=r(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},1181:(e,t,n)=>{"use strict";var r,i,a,o=n(8622),s=n(4475),c=n(34),l=n(6699),u=n(9297),d=n(7629),p=n(6119),h=n(421),f="Object already initialized",m=s.TypeError,y=s.WeakMap;if(o||d.state){var g=d.state||(d.state=new y);g.get=g.get,g.has=g.has,g.set=g.set,r=function(e,t){if(g.has(e))throw new m(f);return t.facade=e,g.set(e,t),t},i=function(e){return g.get(e)||{}},a=function(e){return g.has(e)}}else{var v=p("state");h[v]=!0,r=function(e,t){if(u(e,v))throw new m(f);return t.facade=e,l(e,v,t),t},i=function(e){return u(e,v)?e[v]:{}},a=function(e){return u(e,v)}}e.exports={set:r,get:i,has:a,enforce:function(e){return a(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=i(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},4376:(e,t,n)=>{"use strict";var r=n(4576);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},2796:(e,t,n)=>{"use strict";var r=n(9039),i=n(4901),a=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n===u||n!==l&&(i(t)?r(t):!!t)},s=o.normalize=function(e){return String(e).replace(a,".").toLowerCase()},c=o.data={},l=o.NATIVE="N",u=o.POLYFILL="P";e.exports=o},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:e=>{"use strict";e.exports=!1},757:(e,t,n)=>{"use strict";var r=n(7751),i=n(4901),a=n(1625),o=n(7040),s=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&a(t.prototype,s(e))}},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var i,a,o=n?e:e.iterator,s=e.next;!(i=r(s,o)).done;)if(void 0!==(a=t(i.value)))return a}},9539:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),a=n(5966);e.exports=function(e,t,n){var o,s;i(e);try{if(!(o=a(e,"return"))){if("throw"===t)throw n;return n}o=r(o,e)}catch(e){s=!0,o=e}if("throw"===t)throw n;if(s)throw o;return i(o),n}},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),a=n(4901),o=n(9297),s=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,p=u.get,h=String,f=Object.defineProperty,m=r("".slice),y=r("".replace),g=r([].join),v=s&&!i((function(){return 8!==f((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===m(h(t),0,7)&&(t="["+y(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!o(e,"name")||c&&e.name!==t)&&(s?f(e,"name",{value:t,configurable:!0}):e.name=t),v&&n&&o(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&o(n,"constructor")&&n.constructor?s&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return o(r,"source")||(r.source=g(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return a(this)&&p(this).source||l(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},2603:(e,t,n)=>{"use strict";var r=n(655);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},4913:(e,t,n)=>{"use strict";var r=n(3724),i=n(5917),a=n(8686),o=n(8551),s=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",h="writable";t.f=r?a?function(e,t,n){if(o(e),t=s(t),o(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var r=u(e,t);r&&r[h]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(o(e),t=s(t),o(n),i)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),i=n(9565),a=n(8773),o=n(6980),s=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return o(!i(a.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),i=n(9297),a=n(5397),o=n(9617).indexOf,s=n(421),c=r([].push);e.exports=function(e,t){var n,r=a(e),l=0,u=[];for(n in r)!i(s,n)&&i(r,n)&&c(u,n);for(;t.length>l;)i(r,n=t[l++])&&(~o(u,n)||c(u,n));return u}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),i=n(34),a=n(7750),o=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return a(n),o(r),i(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),i=n(4901),a=n(34),o=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&i(n=e.toString)&&!a(s=r(n,e)))return s;if(i(n=e.valueOf)&&!a(s=r(n,e)))return s;if("string"!==t&&i(n=e.toString)&&!a(s=r(n,e)))return s;throw new o("Can't convert object to primitive value")}},5031:(e,t,n)=>{"use strict";var r=n(7751),i=n(9504),a=n(8480),o=n(3717),s=n(8551),c=i([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=a.f(s(e)),n=o.f;return n?c(t,n(e)):t}},7750:(e,t,n)=>{"use strict";var r=n(4117),i=TypeError;e.exports=function(e){if(r(e))throw new i("Can't call method on "+e);return e}},9286:(e,t,n)=>{"use strict";var r=n(4402),i=n(8469),a=r.Set,o=r.add;e.exports=function(e){var t=new a;return i(e,(function(e){o(t,e)})),t}},3440:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402),a=n(9286),o=n(5170),s=n(3789),c=n(8469),l=n(507),u=i.has,d=i.remove;e.exports=function(e){var t=r(this),n=s(e),i=a(t);return o(t)<=n.size?c(t,(function(e){n.includes(e)&&d(i,e)})):l(n.getIterator(),(function(e){u(t,e)&&d(i,e)})),i}},4402:(e,t,n)=>{"use strict";var r=n(9504),i=Set.prototype;e.exports={Set,add:r(i.add),has:r(i.has),remove:r(i.delete),proto:i}},8750:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402),a=n(5170),o=n(3789),s=n(8469),c=n(507),l=i.Set,u=i.add,d=i.has;e.exports=function(e){var t=r(this),n=o(e),i=new l;return a(t)>n.size?c(n.getIterator(),(function(e){d(t,e)&&u(i,e)})):s(t,(function(e){n.includes(e)&&u(i,e)})),i}},4449:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402).has,a=n(5170),o=n(3789),s=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=o(e);if(a(t)<=n.size)return!1!==s(t,(function(e){if(n.includes(e))return!1}),!0);var u=n.getIterator();return!1!==c(u,(function(e){if(i(t,e))return l(u,"normal",!1)}))}},3838:(e,t,n)=>{"use strict";var r=n(7080),i=n(5170),a=n(8469),o=n(3789);e.exports=function(e){var t=r(this),n=o(e);return!(i(t)>n.size)&&!1!==a(t,(function(e){if(!n.includes(e))return!1}),!0)}},8527:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402).has,a=n(5170),o=n(3789),s=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=o(e);if(a(t)<n.size)return!1;var l=n.getIterator();return!1!==s(l,(function(e){if(!i(t,e))return c(l,"normal",!1)}))}},8469:(e,t,n)=>{"use strict";var r=n(9504),i=n(507),a=n(4402),o=a.Set,s=a.proto,c=r(s.forEach),l=r(s.keys),u=l(new o).next;e.exports=function(e,t,n){return n?i({iterator:l(e),next:u},t):c(e,t)}},4916:(e,t,n)=>{"use strict";var r=n(7751),i=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};e.exports=function(e){var t=r("Set");try{(new t)[e](i(0));try{return(new t)[e](i(-1)),!1}catch(e){return!0}}catch(e){return!1}}},5170:(e,t,n)=>{"use strict";var r=n(6706),i=n(4402);e.exports=r(i.proto,"size","get")||function(e){return e.size}},3650:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402),a=n(9286),o=n(3789),s=n(507),c=i.add,l=i.has,u=i.remove;e.exports=function(e){var t=r(this),n=o(e).getIterator(),i=a(t);return s(n,(function(e){l(t,e)?u(i,e):c(i,e)})),i}},4204:(e,t,n)=>{"use strict";var r=n(7080),i=n(4402).add,a=n(9286),o=n(3789),s=n(507);e.exports=function(e){var t=r(this),n=o(e).getIterator(),c=a(t);return s(n,(function(e){i(c,e)})),c}},6119:(e,t,n)=>{"use strict";var r=n(5745),i=n(3392),a=r("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),i=n(4475),a=n(9433),o="__core-js_shared__",s=e.exports=i[o]||a(o,{});(s.versions||(s.versions=[])).push({version:"3.37.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},4495:(e,t,n)=>{"use strict";var r=n(7388),i=n(9039),a=n(4475).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:(e,t,n)=>{"use strict";var r=n(1291),i=Math.max,a=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):a(n,t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),i=n(7750);e.exports=function(e){return r(i(e))}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},8014:(e,t,n)=>{"use strict";var r=n(1291),i=Math.min;e.exports=function(e){var t=r(e);return t>0?i(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),i=Object;e.exports=function(e){return i(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),i=n(34),a=n(757),o=n(5966),s=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!i(e)||a(e))return e;var n,c=o(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!i(n)||a(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:(e,t,n)=>{"use strict";var r=n(2777),i=n(757);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},655:(e,t,n)=>{"use strict";var r=n(6955),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,n)=>{"use strict";var r=n(9504),i=0,a=Math.random(),o=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++i+a,36)}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039);e.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:(e,t,n)=>{"use strict";var r=n(4475),i=n(4901),a=r.WeakMap;e.exports=i(a)&&/native code/.test(String(a))},8227:(e,t,n)=>{"use strict";var r=n(4475),i=n(5745),a=n(9297),o=n(3392),s=n(4495),c=n(7040),l=r.Symbol,u=i("wks"),d=c?l.for||l:l&&l.withoutSetter||o;e.exports=function(e){return a(u,e)||(u[e]=s&&a(l,e)?l[e]:d("Symbol."+e)),u[e]}},4114:(e,t,n)=>{"use strict";var r=n(6518),i=n(8981),a=n(6198),o=n(4527),s=n(6837);r({target:"Array",proto:!0,arity:1,forced:n(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=i(this),n=a(t),r=arguments.length;s(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return o(t,n),n}})},7642:(e,t,n)=>{"use strict";var r=n(6518),i=n(3440);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("difference")},{difference:i})},8004:(e,t,n)=>{"use strict";var r=n(6518),i=n(9039),a=n(8750);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("intersection")||i((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:a})},3853:(e,t,n)=>{"use strict";var r=n(6518),i=n(4449);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isDisjointFrom")},{isDisjointFrom:i})},5876:(e,t,n)=>{"use strict";var r=n(6518),i=n(3838);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSubsetOf")},{isSubsetOf:i})},2475:(e,t,n)=>{"use strict";var r=n(6518),i=n(8527);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSupersetOf")},{isSupersetOf:i})},5024:(e,t,n)=>{"use strict";var r=n(6518),i=n(3650);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("symmetricDifference")},{symmetricDifference:i})},1698:(e,t,n)=>{"use strict";var r=n(6518),i=n(4204);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("union")},{union:i})},3375:(e,t,n)=>{"use strict";n(7642)},9225:(e,t,n)=>{"use strict";n(8004)},3972:(e,t,n)=>{"use strict";n(3853)},9209:(e,t,n)=>{"use strict";n(5876)},5714:(e,t,n)=>{"use strict";n(2475)},7561:(e,t,n)=>{"use strict";n(5024)},6197:(e,t,n)=>{"use strict";n(1698)},4979:(e,t,n)=>{"use strict";var r=n(6518),i=n(4475),a=n(7751),o=n(6980),s=n(4913).f,c=n(9297),l=n(679),u=n(3167),d=n(2603),p=n(5002),h=n(6193),f=n(3724),m=n(6395),y="DOMException",g=a("Error"),v=a(y),b=function(){l(this,x);var e=arguments.length,t=d(e<1?void 0:arguments[0]),n=d(e<2?void 0:arguments[1],"Error"),r=new v(t,n),i=new g(t);return i.name=y,s(r,"stack",o(1,h(i.stack,1))),u(r,this,b),r},x=b.prototype=v.prototype,w="stack"in new g(y),C="stack"in new v(1,2),_=v&&f&&Object.getOwnPropertyDescriptor(i,y),S=!(!_||_.writable&&_.configurable),E=w&&!S&&!C;r({global:!0,constructor:!0,forced:m||E},{DOMException:E?b:v});var T=a(y),j=T.prototype;if(j.constructor!==T)for(var k in m||s(j,"constructor",o(1,T)),p)if(c(p,k)){var N=p[k],I=N.s;c(T,I)||s(T,I,o(6,N.c))}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var r={};(()=>{"use strict";n.r(r),n.d(r,{SeamlyStaticCore:()=>Lu,default:()=>zu}),n(4114);var e=n(2086),t=n.n(e),i=n(8785);class a extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.status=t?.status}}class o extends Error{action="";langKey="";constructor(e,...t){if(super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,e?.payload&&(this.originalEvent=e,this.originalError=e.payload.error,this.message=`Event of type ${e.payload.type} encountered`),!this.message&&e?.message){const t=function(e){try{return JSON.parse(e).error}catch(t){return e}}(e.message);this.message=t}e?.error&&(this.originalError=e.error)}}class s extends o{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class c extends o{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class l extends o{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class u extends o{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const d="cvco",p="seamly-client-participant",h=50,f=300;function m(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function y(e){const t=`cvco.${e}`;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let n;do{n=sessionStorage.getItem(e[0])}while(e.shift()&&!n);return n?JSON.parse(n):{}},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const g=(e,t)=>{let n;return function(...r){let i=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,i||e.apply(this,r),i=!1}),t),t=>{i=!0,t&&e.apply(this,r)}}},v=e=>Math.ceil(e/1e3),b=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},x=(e,t=2)=>{if(0===e)return"0 Bytes";const n=t<0?0:t,r=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/1024**r).toFixed(n))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}`},w={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},C={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},_=e=>e.code?C[e.code]:w[e.keyCode],S=e=>{e&&e.focus()},E=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function T(e){return"object"==typeof e}const j="message",k="text",N="text",I="upload",A="received",L="read",M="custom",O="typing",R="read",P="detach_service",D="dismiss",z="set_topic",U="click_cta",F="translation_proposal",B=F,H="window_api",$="assertive",V="polite",G={new_topic:"newTopic",new_translation:"newTranslation"},W="uploads",q="navigate";n(3375),n(9225),n(3972),n(9209),n(5714),n(7561),n(6197),n(4979);var K=e=>"function"==typeof e?e:function(){return e},J="undefined"!=typeof self?self:null,X="undefined"!=typeof window?window:null,Y=J||X||Y,Z="closed",Q="errored",ee="joined",te="joining",ne="leaving",re="phx_close",ie="phx_error",ae="phx_reply",oe="phx_leave",se="websocket",ce=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},le=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},ue=class{constructor(e,t,n){this.state=Z,this.topic=e,this.params=K(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ce(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new le((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=ee,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Z,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=Q,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new ce(this,oe,K({}),this.timeout).send(),this.state=Q,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(ae,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(re,e)}onError(e){return this.on(ie,(t=>e(t)))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter((n=>!(n.event===e&&(void 0===t||t===n.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new ce(this,e,(function(){return t}),n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ne;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(re,"leave")},n=new ce(this,oe,K({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=te,this.joinPush.resend(e))}trigger(e,t,n,r){let i=this.onMessage(e,t,n,r);if(t&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let a=this.bindings.filter((t=>t.event===e));for(let e=0;e<a.length;e++)a[e].callback(i,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Z}isErrored(){return this.state===Q}isJoined(){return this.state===ee}isJoining(){return this.state===te}isLeaving(){return this.state===ne}},de=class{static request(e,t,n,r,i,a,o){if(Y.XDomainRequest){let n=new Y.XDomainRequest;return this.xdomainRequest(n,e,t,r,i,a,o)}{let s=new Y.XMLHttpRequest;return this.xhrRequest(s,e,t,n,r,i,a,o)}}static xdomainRequest(e,t,n,r,i,a,o){return e.timeout=i,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);o&&o(t)},a&&(e.ontimeout=a),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,i,a,o,s){return e.open(t,n,!0),e.timeout=a,e.setRequestHeader("Content-Type",r),e.onerror=()=>s&&s(null),e.onreadystatechange=()=>{if(4===e.readyState&&s){let t=this.parseJSON(e.responseText);s(t)}},o&&(e.ontimeout=o),e.send(i),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t?`${t}[${r}]`:r,a=e[r];"object"==typeof a?n.push(this.serialize(a,i)):n.push(encodeURIComponent(i)+"="+encodeURIComponent(a))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},pe=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,setTimeout((()=>this.poll()),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+se),"$1/longpoll")}endpointURL(){return de.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){this.ajax("GET","application/json",null,(()=>this.ontimeout()),(e=>{if(e){var{status:t,token:n,messages:r}=e;this.token=n}else t=0;switch(t){case 200:r.forEach((e=>{setTimeout((()=>this.onmessage({data:e})),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){"string"!=typeof e&&(e=(e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout((()=>{this.batchSend(this.currentBatch),this.currentBatch=null}),0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join("\n"),(()=>this.onerror("timeout")),(e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))}))}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=3;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,i){let a;a=de.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(a),r()}),(e=>{this.reqs.delete(a),this.isActive()&&i(e)})),this.reqs.add(a)}},he={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,i,a,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:i,event:a,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:i,payload:a}=e,o=this.META_LENGTH+t.length+n.length+i.length+r.length,s=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(s),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,i.length),c.setUint8(l++,r.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(i,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(s.byteLength+a.byteLength);return u.set(new Uint8Array(s),0),u.set(new Uint8Array(a),s.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,s=n.decode(e.slice(o,o+r));o+=r;let c=n.decode(e.slice(o,o+i));o+=i;let l=n.decode(e.slice(o,o+a));return o+=a,{join_ref:s,ref:null,topic:c,event:l,payload:e.slice(o,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4),s=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(s,s+r));s+=r;let l=n.decode(e.slice(s,s+i));s+=i;let u=n.decode(e.slice(s,s+a));s+=a;let d=n.decode(e.slice(s,s+o));s+=o;let p=e.slice(s,e.byteLength);return{join_ref:c,ref:l,topic:u,event:ae,payload:{status:d,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=this.HEADER_LENGTH+2,o=n.decode(e.slice(a,a+r));a+=r;let s=n.decode(e.slice(a,a+i));return a+=i,{join_ref:null,ref:null,topic:o,event:s,payload:e.slice(a,e.byteLength)}}},fe=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||Y.WebSocket||pe,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Y.sessionStorage,this.establishedConnections=0,this.defaultEncoder=he.encode.bind(he),this.defaultDecoder=he.decode.bind(he),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==pe?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;X&&X.addEventListener&&(X.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),X.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=K(t.params||{}),this.endPoint=`${e}/${se}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new le((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return pe}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=de.appendParams(de.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=K(e)),this.conn||(this.longPollFallbackMs&&this.transport!==pe?this.connectWithFallback(pe,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage((i=>{i.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n,r=!1,i=!0,a=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([void 0,n]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),n=this.onError((e=>{this.log("transport","error",e),i&&!r&&(clearTimeout(this.fallbackTimer),a(e))})),this.onOpen((()=>{if(r=!0,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping((e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)}))})),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown((()=>this.reconnectTimer.scheduleTimeout()),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()}))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&3!==this.conn.readyState?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,r])=>{r(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(ie)}))}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t!==e))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let n=new ue(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:i,join_ref:a}=e;this.log("push",`${t} ${n} (${a}, ${i})`,r)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:n,payload:r,ref:i,join_ref:a}=e;i&&i===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${i&&"("+i+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const o=this.channels[e];o.isMember(t,n,r,a)&&o.trigger(n,r,i,a)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,n]=this.stateChangeCallbacks.message[t];n(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};const me=()=>null,ye=new Set;class ge{#e=[];async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:i,params:a}=(e=>{const t=e.indexOf("?");return t<0?{url:e,params:{}}:{url:e.slice(0,t),params:e.slice(t+1).split("&").reduce((function(e,t){const[n,r]=t.split("=");return{...e,[n]:decodeURIComponent(r)}}),{})}})(this.url);this.socket=new fe(i,{params:{...a,v:"3"},reconnectAfterMs:e=>{const t=2**e*250;return Math.min(t,1e4)}}),this.socket.onError((e=>{me("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{me("[SOCKET]OPEN")})),this.socket.onClose((()=>{me("[SOCKET]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"socket_closed"})})),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName}),this.start(),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&this.#t({connected:!0,ready:!0,currentState:"attach_channel_succeeded"})})),this.channel.onClose((()=>{me("[CHANNEL]CLOSE"),this.#t({connected:!1,ready:!1,currentState:"channel_closed"})})),this.channel.onError((e=>{me("[CHANNEL][ERROR]",e),this.#t({connected:!1,ready:!1,currentState:"channel_erred"})})),this.#n("ack","ui","error","participant","message","service_data","system","info","sync")}start(){this.channel?.join().receive("ok",(()=>{me("[CHANNEL][JOIN] OK"),this.#t({connected:!0,ready:!1,currentState:"join_channel_succeeded"})})).receive("error",(e=>{me("[CHANNEL][JOIN] ERROR",e),this.#t({connected:!1,ready:!1,currentState:"join_channel_erred"})})).receive("timeout",(()=>{me("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){this.channel?.leave().receive("ok",(()=>{this.socket?.disconnect(),me("[CHANNEL][LEAVE] OK"),this.#e=[]}))}#n(...e){e.forEach((e=>{this.channel?.on(e,(t=>{me("[RECEIVE]",e,t)}))}))}onConnection(e){this.#e.push(e)}#t(e){this.#e=this.#e.filter((t=>!t(e))),ye.forEach((e=>e()))}pushToChannel(e,t,n=1e4){this.channel?.push(e,t,n)}static subscribe(e){return ye.add(e),()=>ye.delete(e)}}const ve=()=>null,be=async(e,t)=>{const n=new URL(e);n.searchParams.set("v","3");const r=await fetch(n.href,{mode:"cors",...t});if(!r.ok)throw new a(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function xe(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return null;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:null}class we{#r;#i;#a;#o="window";#s;conversation=new ge;constructor({layoutMode:e,namespace:t,config:n,context:r}){this.store=function(e,t){const n=t(e),r=n.get()||{};return{get:e=>void 0===e?r:r[e],set:(e,t)=>(r[e]=t,n.set(r),t),delete(e){const t=this.get(e);return delete r[e],n.set(r),t}}}(`${t}.connection${r?.userLocale?`.${r.userLocale}`:""}`,n.storageProvider||y),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},this.#s={...n,sendEnvironment:n.sendEnvironment??!0,context:{...r,channelName:r?.channelName||"web"}},this.#r=!1,this.connected=!1,this.configReady=!1,this.#i=n.externalId,e&&(this.#o=e),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}#c(){return this.store.get("accessToken")}#l(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}#u(e){this.store.set("conversationUrl",e)}hasConversation(){return!!this.getConversationUrl()}#d(){return this.store.get("channelTopic")||this.store.get("channelName")}#p(e){this.store.set("channelTopic",e)}#h=e=>e||this.locale;clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}#f(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}#m({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>(e[t]=n,e)),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversation?.disconnect&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}async#y(){if(!this.hasConversation())try{"function"==typeof this.#s?.getConversationAuthToken&&(this.#a=await this.#s.getConversationAuthToken());const e=await be(`${this.#f("http")}${this.URLS.conversations}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#a?void 0:this.#i,token:this.#a})}),t=await e.json(),{conversation:n}=t,r={...n};return delete r.accessToken,delete r.channelTopic,this.#l(n.accessToken),this.#p(n.channelTopic),this.#m(t),this.URLS.conversation&&this.#u(this.URLS.conversation),this.locale=n.translation?.locale,this.userResponded=n.userResponded,r}catch(e){if(e.status>=500)throw new c(e);if(400===e.status)throw new u(e);if(404===e.status)throw new s(e);throw e}}async getConfig(){try{const e=await be(`${this.#f("http")}/client/${this.connectionInfo.apiKey}/configs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:{...this.#s.context,environment:!0===this.#s.sendEnvironment?this.getEnvironment():this.#s.sendEnvironment}})}),t=await e.json();return this.#m(t),delete this.URLS.socket,this.configReady=!0,t.config}catch(e){if(404===e.status)throw new s(e);if(e.status>=500)throw new c(e);throw e}}async getConversation(){if(!this.hasConversation())return null;try{const e=await be(`${this.#f("http")}${this.URLS.history}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),t=await e.json();this.#m(t);const{messages:n,participants:r,activeServiceSessionId:i,activeServiceSettings:a,serviceData:o,ui:s,translation:c}=t.history;return{events:n.map((([e,t])=>({type:e,payload:{...t,type:"participant"===e?e:t.type}}))),participants:r,activeServiceSessionId:i,activeServiceSettings:a,serviceData:o,resumeConversationPrompt:!!s&&Boolean(s.resumeConversationPrompt),translationProposal:s.translationProposal,translation:c}}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw new a(e)}}async connect(){this.connected=!1;const e=await this.#y();return this.URLS.socket&&(this.conversation.connect(`${this.#f("ws")}${this.URLS.socket}`,this.#s.context.channelName,this.#d(),this.#c()),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,this.#r=t}))),e}uploadFile(e,t,n,r){const i=new FormData;i.append("upload",e);const a=new XMLHttpRequest;return a.open("POST",`${this.#f("http")}${this.URLS.uploads}`),a.setRequestHeader("Authorization",`Bearer ${this.#c()}`),a.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},a.onloadend=()=>{if(0!==a.status)if(200!==a.status&&201!==a.status||!n){if(!r)throw new Error(a.response);try{r(JSON.parse(a.response))}catch(e){r(a.response)}}else try{n(JSON.parse(a.response))}catch(e){n(a.response)}},a.send(i),a}async getConversationIntitialState(){try{const n=await be(`${this.#f("http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${this.#c()}`}}),r=await n.json();return this.#m(r),this.userResponded=r.conversation.userResponded,e=r.conversation,t=["accessToken","channelTopic"],Object.keys(e).reduce(((n,r)=>(t.includes(r)||(n[r]=e[r]),n)),{})}catch(e){if(401===e.status)throw new u(e);if(404===e.status)throw new l(e);if(e.status>=500)throw new c(e);throw e}var e,t}async getTranslations(e){try{if(!this.URLS.translations)throw new s;const t=this.#h(e);if(!t)throw new c;const n=`${this.#f("http")}${this.URLS.translations}`.replace("{version}",String(4)).replace("{locale}",t),r=await be(n,{method:"GET"});return(await r.json()).translations}catch(e){if(e.status>=500)throw new c(e);throw new a(e)}}send(e,t=void 0,n=!0){!this.connected||n&&!this.#r?this.conversation?.onConnection((({connected:r,ready:i})=>(this.connected=r,this.#r=i,!!(n?i:r)&&(this.send(e,t,n),!0)))):(ve("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:i}=t;return i||(i=m()),{type:n,body:r,transactionId:i}}(e,t),1e4))}sendContext(e){const{contentLocale:t,source:n,userLocale:r,variables:i,environment:a}=e,o={};if(a&&(o.environment=a),t){if("string"!=typeof t)throw new Error("Content locale must be a string");o.contentLocale=t}if(n){if("string"!=typeof n)throw new Error("Source must be a string");o.source=n}if(r){if("string"!=typeof r)throw new Error("User locale must be a string");o.userLocale=r,this.#g(o,r)}if(i){if("object"!=typeof i)throw new Error("Variables must be an object");o.variables=i}0===Object.keys(o).length&&o.constructor===Object||this.send("context",o,!1)}#g(e,t){e.source||t==this.#s.context?.userLocale||(e.source=H)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#o,clientVersion:"23.0.6-alpha.2",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:xe(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}var Ce=Symbol.for("immer-nothing"),_e=Symbol.for("immer-draftable"),Se=Symbol.for("immer-state");function Ee(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Te=Object.getPrototypeOf;function je(e){return!!e&&!!e[Se]}function ke(e){return!!e&&(Ie(e)||Array.isArray(e)||!!e[_e]||!!e.constructor?.[_e]||Re(e)||Pe(e))}var Ne=Object.prototype.constructor.toString();function Ie(e){if(!e||"object"!=typeof e)return!1;const t=Te(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ne}function Ae(e,t){0===Le(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Le(e){const t=e[Se];return t?t.type_:Array.isArray(e)?1:Re(e)?2:Pe(e)?3:0}function Me(e,t){return 2===Le(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Oe(e,t,n){const r=Le(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Re(e){return e instanceof Map}function Pe(e){return e instanceof Set}function De(e){return e.copy_||e.base_}function ze(e,t){if(Re(e))return new Map(e);if(Pe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ie(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Se];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Te(e),t)}{const t=Te(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function Ue(e,t=!1){return Be(e)||je(e)||!ke(e)||(Le(e)>1&&(e.set=e.add=e.clear=e.delete=Fe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ue(t,!0)))),e}function Fe(){Ee(2)}function Be(e){return Object.isFrozen(e)}var He,$e={};function Ve(e){const t=$e[e];return t||Ee(0),t}function Ge(){return He}function We(e,t){t&&(Ve("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qe(e){Ke(e),e.drafts_.forEach(Xe),e.drafts_=null}function Ke(e){e===He&&(He=e.parent_)}function Je(e){return He={drafts_:[],parent_:He,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xe(e){const t=e[Se];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Se].modified_&&(qe(t),Ee(4)),ke(e)&&(e=Ze(t,e),t.parent_||et(t,e)),t.patches_&&Ve("Patches").generateReplacementPatches_(n[Se].base_,e,t.patches_,t.inversePatches_)):e=Ze(t,n,[]),qe(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ce?e:void 0}function Ze(e,t,n){if(Be(t))return t;const r=t[Se];if(!r)return Ae(t,((i,a)=>Qe(e,r,t,i,a,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return et(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let i=t,a=!1;3===r.type_&&(i=new Set(t),t.clear(),a=!0),Ae(i,((i,o)=>Qe(e,r,t,i,o,n,a))),et(e,t,!1),n&&e.patches_&&Ve("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qe(e,t,n,r,i,a,o){if(je(i)){const o=Ze(e,i,a&&t&&3!==t.type_&&!Me(t.assigned_,r)?a.concat(r):void 0);if(Oe(n,r,o),!je(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(ke(i)&&!Be(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ze(e,i),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||et(e,i)}}function et(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ue(t,n)}var tt={get(e,t){if(t===Se)return e;const n=De(e);if(!Me(n,t))return function(e,t,n){const r=it(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!ke(r)?r:r===rt(e.base_,t)?(ot(e),e.copy_[t]=st(r,e)):r},has:(e,t)=>t in De(e),ownKeys:e=>Reflect.ownKeys(De(e)),set(e,t,n){const r=it(De(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=rt(De(e),t),o=r?.[Se];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||Me(e.base_,t)))return!0;ot(e),at(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==rt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ot(e),at(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=De(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ee(11)},getPrototypeOf:e=>Te(e.base_),setPrototypeOf(){Ee(12)}},nt={};function rt(e,t){const n=e[Se];return(n?De(n):e)[t]}function it(e,t){if(!(t in e))return;let n=Te(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Te(n)}}function at(e){e.modified_||(e.modified_=!0,e.parent_&&at(e.parent_))}function ot(e){e.copy_||(e.copy_=ze(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function st(e,t){const n=Re(e)?Ve("MapSet").proxyMap_(e,t):Pe(e)?Ve("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ge(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=tt;n&&(i=[r],a=nt);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:Ge()).drafts_.push(n),n}function ct(e){return je(e)||Ee(10),lt(e)}function lt(e){if(!ke(e)||Be(e))return e;const t=e[Se];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ze(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ze(e,!0);return Ae(n,((e,t)=>{Oe(n,e,lt(t))})),t&&(t.finalized_=!1),n}Ae(tt,((e,t)=>{nt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),nt.deleteProperty=function(e,t){return nt.set.call(this,e,t,void 0)},nt.set=function(e,t,n){return tt.set.call(this,e[0],t,n,e[0])};var ut=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,(e=>t.call(this,e,...i)))}}let r;if("function"!=typeof t&&Ee(6),void 0!==n&&"function"!=typeof n&&Ee(7),ke(e)){const i=Je(this),a=st(e,void 0);let o=!0;try{r=t(a),o=!1}finally{o?qe(i):Ke(i)}return We(i,n),Ye(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Ce&&(r=void 0),this.autoFreeze_&&Ue(r,!0),n){const t=[],i=[];Ve("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}Ee(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ke(e)||Ee(8),je(e)&&(e=ct(e));const t=Je(this),n=st(e,void 0);return n[Se].isManual_=!0,Ke(t),n}finishDraft(e,t){const n=e&&e[Se];n&&n.isManual_||Ee(9);const{scope_:r}=n;return We(r,t),Ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Ve("Patches").applyPatches_;return je(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},dt=ut.produce;ut.produceWithPatches.bind(ut),ut.setAutoFreeze.bind(ut),ut.setUseStrictShallowCopy.bind(ut),ut.applyPatches.bind(ut),ut.createDraft.bind(ut),ut.finishDraft.bind(ut);var pt=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},ft=0,mt=1;function yt(){return{s:ft,v:void 0,o:null,p:null}}function gt(e,t={}){let n=yt();const{resultEqualityCheck:r}=t;let i,a=0;function o(){let t=n;const{length:o}=arguments;for(let e=0,n=o;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=yt(),e.set(n,t)):t=r}}const s=t;let c;if(t.s===mt)c=t.v;else if(c=e.apply(null,arguments),a++,r){const e=i?.deref?.()??i;null!=e&&r(e,c)&&(c=e,0!==a&&a--),i="object"==typeof c&&null!==c||"function"==typeof c?new ht(c):c}return s.s=mt,s.v=c,c}return o.clearCache=()=>{n=yt(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function vt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,a={},o=e.pop();"object"==typeof o&&(a=o,o=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);const s={...n,...a},{memoize:c,memoizeOptions:l=[],argsMemoize:u=gt,argsMemoizeOptions:d=[],devModeChecks:p={}}=s,h=pt(l),f=pt(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=c((function(){return r++,o.apply(null,arguments)}),...h),g=u((function(){i++;const e=function(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(m,arguments);return t=y.apply(null,e),t}),...f);return Object.assign(g,{resultFunc:o,memoizedResultFunc:y,dependencies:m,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var bt=vt(gt),xt=Object.assign(((e,t=bt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>xt});function wt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ct=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),_t=()=>Math.random().toString(36).substring(7).split("").join("."),St={INIT:`@@redux/INIT${_t()}`,REPLACE:`@@redux/REPLACE${_t()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_t()}`};function Et(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Tt(e,t,n){if("function"!=typeof e)throw new Error(wt(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(wt(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(wt(1));return n(Tt)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach(((e,t)=>{o.set(t,e)})))}function u(){if(c)throw new Error(wt(3));return i}function d(e){if("function"!=typeof e)throw new Error(wt(4));if(c)throw new Error(wt(5));let t=!0;l();const n=s++;return o.set(n,e),function(){if(t){if(c)throw new Error(wt(6));t=!1,l(),o.delete(n),a=null}}}function p(e){if(!Et(e))throw new Error(wt(7));if(void 0===e.type)throw new Error(wt(8));if("string"!=typeof e.type)throw new Error(wt(17));if(c)throw new Error(wt(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach((e=>{e()})),e}return p({type:St.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(wt(10));r=e,p({type:St.REPLACE})},[Ct]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(wt(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Ct](){return this}}}}}function jt(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:St.INIT}))throw new Error(wt(12));if(void 0===n(void 0,{type:St.PROBE_UNKNOWN_ACTION()}))throw new Error(wt(13))}))}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1;const o={};for(let i=0;i<r.length;i++){const s=r[i],c=n[s],l=e[s],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(wt(14));o[s]=u,a=a||u!==l}return a=a||r.length!==Object.keys(e).length,a?o:e}}function kt(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Nt(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var It=Nt(),At=Nt,Lt=(((...e)=>{const t=vt(...e),n=Object.assign(((...e)=>{const n=t(...e),r=(e,...t)=>n(je(e)?ct(e):e,...t);return Object.assign(r,n),r}),{withTypes:()=>n})})(gt),"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?kt:kt.apply(null,arguments)}),Mt=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Ot(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(pn(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return Et(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Rt=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Pt(e){return ke(e)?dt(e,(()=>{})):e}function Dt(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error(pn(10));const r=n.insert(t,e);return e.set(t,r),r}var zt=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let a=new Rt;return t&&("boolean"==typeof t?a.push(It):a.push(At(t.extraArgument))),a},Ut=e=>t=>{setTimeout(t,e)},Ft="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ut(10),Bt=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Rt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const s=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?Ft:"callback"===e.type?e.queueNotification:Ut(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>i&&e()));return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})})("object"==typeof n?n:void 0)),r},Ht=!0;function $t(e){const t=zt(),{reducer:n,middleware:r,devTools:i=!0,preloadedState:a,enhancers:o}=e||{};let s,c;if("function"==typeof n)s=n;else{if(!Et(n))throw new Error(pn(1));s=jt(n)}if(!Ht&&r&&"function"!=typeof r)throw new Error(pn(2));if("function"==typeof r){if(c=r(t),!Ht&&!Array.isArray(c))throw new Error(pn(3))}else c=t();if(!Ht&&c.some((e=>"function"!=typeof e)))throw new Error(pn(4));let l=kt;i&&(l=Lt({trace:!Ht,..."object"==typeof i&&i}));const u=function(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(wt(15))};const o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)},s=e.map((e=>e(o)));return a=kt(...s)(i.dispatch),{...i,dispatch:a}}}(...c),d=Bt(u);if(!Ht&&o&&"function"!=typeof o)throw new Error(pn(5));let p="function"==typeof o?o(d):d();if(!Ht&&!Array.isArray(p))throw new Error(pn(6));if(!Ht&&p.some((e=>"function"!=typeof e)))throw new Error(pn(7));return Ht||!c.length||p.includes(u)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),Tt(s,a,l(...p))}function Vt(e){const t={},n=[];let r;const i={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(pn(28));if(r in t)throw new Error(pn(29));return t[r]=n,i},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(r=e,i)};return e(i),[t,n,r]}var Gt=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Wt(...e){return t=>e.some((e=>((e,t)=>Mt(e)?e.match(t):e(t))(e,t)))}var qt=["name","message","stack","code"],Kt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Jt=class{constructor(e,t){this.payload=e,this.meta=t}_type},Xt=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of qt)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Yt=(()=>{function e(e,t,n){const r=Ot(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),i=Ot(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),a=Ot(e+"/rejected",((e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||Xt)(e||"Rejected"),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(o,s,c)=>{const l=n?.idGenerator?n.idGenerator(e):Gt(),u=new AbortController;let d,p;function h(e){p=e,u.abort()}const f=async function(){let f;try{let a=n?.condition?.(e,{getState:s,extra:c});if(null!==(m=a)&&"object"==typeof m&&"function"==typeof m.then&&(a=await a),!1===a||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const y=new Promise(((e,t)=>{d=()=>{t({name:"AbortError",message:p||"Aborted"})},u.signal.addEventListener("abort",d)}));o(i(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:s,extra:c}))),f=await Promise.race([y,Promise.resolve(t(e,{dispatch:o,getState:s,extra:c,requestId:l,signal:u.signal,abort:h,rejectWithValue:(e,t)=>new Kt(e,t),fulfillWithValue:(e,t)=>new Jt(e,t)})).then((t=>{if(t instanceof Kt)throw t;return t instanceof Jt?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof Kt?a(null,l,e,t.payload,t.meta):a(t,l,e)}finally{d&&u.signal.removeEventListener("abort",d)}var m;return n&&!n.dispatchConditionRejection&&a.match(f)&&f.meta.condition||o(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(Zt)})}}),{pending:i,rejected:a,fulfilled:r,settled:Wt(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function Zt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Qt=Symbol.for("rtk-slice-createasyncthunk");function en(e,t){return`${e}/${t}`}function tn({creators:e}={}){const t=e?.asyncThunk?.[Qt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(pn(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(pn(12));if(n in o.sliceCaseReducersByType)throw new Error(pn(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),s),exposeAction:(e,t)=>(o.actionCreators[e]=t,s),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,s)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?Vt(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return function(e,t){let a,[s,c,l]=Vt((e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}));if("function"==typeof e)a=()=>Pt(e());else{const t=Pt(e);a=()=>t}function u(e=a(),t){let n=[s[t.type],...c.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===n.filter((e=>!!e)).length&&(n=[l]),n.reduce(((e,n)=>{if(n){if(je(e)){const r=n(e,t);return void 0===r?e:r}if(ke(e))return dt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error(pn(9))}return r}}return e}),e)}return u.getInitialState=a,u}(e.initialState)}a.forEach((r=>{const a=i[r],o={reducerName:r,type:en(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(a)?function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(pn(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Ot(e,o):Ot(e))}(o,a,s):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error(pn(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||an,pending:s||an,rejected:c||an,settled:l||an})}(o,a,s,t)}));const l=e=>e,u=new Map;let d;function p(e,t){return d||(d=c()),d(e,t)}function h(){return d||(d=c()),d.getInitialState()}function f(t,n=!1){function r(e){let r=e[t];return void 0===r&&n&&(r=h()),r}function i(t=l){const r=Dt(u,n,{insert:()=>new WeakMap});return Dt(r,t,{insert:()=>{const r={};for(const[i,a]of Object.entries(e.selectors??{}))r[i]=nn(a,t,h,n);return r}})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}const m={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:h,...f(r),injectInto(e,{reducerPath:t,...n}={}){const i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...m,...f(i,!0)}}};return m}}function nn(e,t,n,r){function i(i,...a){let o=t(i);return void 0===o&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var rn=tn();function an(){}var{assign:on}=Object,sn="listenerMiddleware",cn=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Ot(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(pn(21));return((e,t)=>{if("function"!=typeof e)throw new Error(pn(32))})(a),{predicate:i,type:t,effect:a}},ln=Object.assign((e=>{const{type:t,predicate:n,effect:r}=cn(e);return{id:Gt(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(pn(22))}}}),{withTypes:()=>ln}),un=Object.assign(Ot(`${sn}/add`),{withTypes:()=>un}),dn=(Ot(`${sn}/removeAll`),Object.assign(Ot(`${sn}/remove`),{withTypes:()=>dn}));function pn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");class hn extends o{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const fn=Yt("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,defaultLocale:r,preChat:i,agentParticipant:a,userParticipant:o,startChatIcon:s}=await t.getConfig(),c=n?.context?.userLocale||r,l=n?.context?.contentLocale||r,{connectWhenInView:u}=n;return{features:e,defaultLocale:r,preChat:i,agentParticipant:a,userParticipant:o,startChatIcon:s,defaultUserLocale:c,defaultContentLocale:l,connectWhenInView:u}}catch(e){return r(e)}})),mn=Yt("resetConfig",(async(e,{extra:{config:t}})=>t)),yn=bt((({app:e})=>e),(({userHasResponded:e})=>e)),gn="visibility",vn={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},bn=bt((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?vn.open:vn.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),xn=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:i,layoutMode:a,hideOnNoUserResponse:o}=r,{visible:s}=i||{};return"app"!==a||t?"window"===a&&o&&n!==vn.open?e?n||t||vn.open:vn.hidden:"inline"===a&&e&&!n?t||vn.open:n||t||s||vn.minimized:vn.open};var wn=n(7402),Cn=n(8418),_n=wn.default,Sn=Symbol.for("react-redux-context"),En="undefined"!=typeof globalThis?globalThis:{};function Tn(){if(!_n.createContext)return{};const e=En[Sn]??(En[Sn]=new Map);let t=e.get(_n.createContext);return t||(t=_n.createContext(null),e.set(_n.createContext,t)),t}var jn=Tn();function kn(e=jn){return function(){return _n.useContext(e)}}var Nn=kn(),In=()=>{throw new Error("uSES not initialized!")},An=(e,t)=>e===t;function Ln(e=jn){const t=e===jn?Nn:kn(e),n=(e,n={})=>{const{equalityFn:r=An,devModeChecks:i={}}="function"==typeof n?{equalityFn:n}:n,{store:a,subscription:o,getServerState:s,stabilityCheck:c,identityFunctionCheck:l}=t(),u=(_n.useRef(!0),_n.useCallback({[e.name]:t=>e(t)}[e.name],[e,c,i.stabilityCheck])),d=In(o.addNestedSub,a.getState,s||a.getState,u,r);return _n.useDebugValue(d),d};return Object.assign(n,{withTypes:()=>n}),n}var Mn=Ln();Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen"),Symbol.for("react.client.reference");var On={notify(){},get:()=>[]};var Rn=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Pn="undefined"!=typeof navigator&&"ReactNative"===navigator.product,Dn=Rn||Pn?_n.useLayoutEffect:_n.useEffect;Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var zn=function({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",identityFunctionCheck:a="once"}){const o=_n.useMemo((()=>{const t=function(e,t){let n,r=On,i=0,a=!1;function o(){l.onStateChange&&l.onStateChange()}function s(){i++,n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){r&&null!==e&&(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}())}function c(){i--,n&&0===i&&(n(),n=void 0,r.clear(),r=On)}const l={addNestedSub:function(e){s();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,s())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>r};return l}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0,stabilityCheck:i,identityFunctionCheck:a}}),[e,r,i,a]),s=_n.useMemo((()=>e.getState()),[e]);Dn((()=>{const{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[o,s]);const c=t||jn;return _n.createElement(c.Provider,{value:o},n)};function Un(e=jn){const t=e===jn?Nn:kn(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Fn=Un();function Bn(e=jn){const t=e===jn?Fn:Un(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Hn,$n=Bn();Hn=Cn.useSyncExternalStoreWithSelector,In=Hn,wn.useSyncExternalStore;const Vn=()=>Mn(bn),Gn=({state:e})=>e,Wn=()=>Mn(Gn),qn=bt(Gn,bn,yn,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),Kn=bt(qn,bn,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,i)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const a=i[n-1];if(!t?.occurredAt||!a.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const o=v(t.occurredAt-a.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:o}}})):e})),Jn=()=>Mn(Kn),Xn=(bt(Kn,(e=>e.map((e=>e.payload.id)))),()=>Wn().isLoading),Yn=()=>Wn().unreadEvents,Zn=()=>Wn().skiplinkTargetId,Qn=()=>Wn().serviceInfo,er=bt(Kn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),tr=()=>{const{participants:e,currentAgent:t}=Wn().participantInfo;return t?e[t]:null},nr=()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=Wn(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},rr=()=>{const{layoutMode:e}=Vn();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},ir=bt((({visibility:e})=>e),(e=>e.visibility)),ar=bt((({visibility:e})=>e),(e=>e.showInlineView)),or=[vn.open,vn.minimized,vn.hidden],sr=Yt("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const i=t(),a=ir(i),o=yn(i),s=n.hasConversation(),c=bn(i),{visibilityCallback:l=xn,layoutMode:u}=c,{unreadEvents:d}=Gn(i),p=l({hasResponded:o,previousVisibility:a,requestedVisibility:e,config:c});if(p&&!or.includes(p))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),null;if(a===p)return null;const h=n.store.get(gn);return n.store.set(gn,{...h||{},[u]:e}),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:s,hasResponded:o,unreadMessageCount:d}),p})),cr=Yt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:i}=bn(n()),a=r.store.get(gn)?.[i]||vn.initialize;return t(sr(a)),a})),lr=Yt("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{let i=n?.context?.contentLocale,a=n?.context?.userLocale;const o=!1!==n.api.sendEnvironment?t.getEnvironment():n.api.sendEnvironment;try{if(t.hasConversation()){const e=await t.getConversationIntitialState();return i=e.context?.contentLocale||i,a=e.context?.userLocale||a,t.sendContext({...e.context,environment:o}),{initialState:e,contentLocale:i,userLocale:a,config:n}}return n?.context?.topic&&t.send("action",{type:z,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),t.sendContext({...n.context,environment:o}),{initialState:void 0,contentLocale:i,userLocale:a,config:n}}catch(e){if(e instanceof l){const e=new l;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new hn;return r({name:t.name,message:t.message,langKey:t.langKey})}})),ur=((e,t,n)=>{const{wait:r=300,maxWait:i=0,leading:a=!1}=n??{};let o,s=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,o&&(o(!0),o=void 0)};return Yt(e,t,{condition:()=>{const e=a&&!s;return s&&clearTimeout(s),s=setTimeout((()=>{l(),s=null}),r),!!e||(o&&(o(!1),o=void 0),i&&!c&&(c=setTimeout(l,i)),new Promise((e=>{o=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(mn()),await t(fn()),await t(lr()),t(cr())}),{wait:2e3,leading:!0}),dr=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],pr=(e,t)=>{const{messages:n,...r}=(i=t,dr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{}));var i;let a=e;return Object.keys(r).length>0&&(a={...a,...r}),n&&(a={...a,messages:{...a.messages,...n}}),a},hr=rn({name:"config",initialState:{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}},api:{domain:"",key:"",secure:!0,sendEnvironment:!0},context:{},notificationAudioURL:void 0,hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showSuggestions:!0,preChat:{enterDelay:1e3,exitAfter:4e3},continueChat:{enterDelay:0,exitAfter:2e3},customComponents:{},defaults:{visible:null},preChatEvents:[],parentElement:void 0,layoutMode:"window"},reducers:{setConfig:(e,{payload:t})=>pr(e,t),updateConfig:(e,{payload:t})=>pr(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(mn.fulfilled,(e=>e)).addCase(fn.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:i,defaultUserLocale:a,defaultContentLocale:o}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.userLocale=a,e.context.contentLocale=o,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=i}))}}),{setConfig:fr,updateConfig:mr,setPreChatEvents:yr}=hr.actions,gr=hr.reducer,vr={userHasResponded:!1},br=rn({name:"app",initialState:vr,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>vr)).addCase(lr.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:xr}=br.actions,wr=br.reducer;class Cr extends o{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const _r={SeamlyGeneralError:c,SeamlyConfigurationError:s,SeamlySessionExpiredError:l,SeamlyOfflineError:Cr,SeamlyUnauthorizedError:u,SeamlyUnavailableError:hn},Sr=Ot("catch-error",(e=>({payload:e}))),Er={controls:{}},Tr={touched:!1},jr={controls:Tr},kr=rn({name:"forms",initialState:jr,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...Er,persistData:t}:{...Er,persistData:t};e[n]=r},deregisterForm:(e,{payload:{formId:t}})=>(e[t]?.persistData||delete e[t],e),registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:Tr}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const i={...r.controls};return delete i[t],{...e,[n]:{...r,controls:i}}},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{e[t]?.controls&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{e[t]?.controls[n]&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(ur.pending,(()=>jr))}}),{registerForm:Nr,deregisterForm:Ir,registerControl:Ar,deregisterControl:Lr,updateControlValue:Mr,updateControlTouched:Or}=kr.actions,Rr=kr.reducer,Pr=Yt("setLocale",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return{translations:await t.getTranslations(e),userLocale:e}}catch(e){return n(e)}}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),Dr={translations:{"errors.configError.message":"We are sorry this happened, please retry at a later time.","errors.configError.srText":"A chat configuration error occurred. Our apologies, please retry at a later time.","errors.configError.title":"Chat configuration error.","errors.general.buttonText":"Restart chat","errors.general.message":"Do you want to start a new chat session?","errors.general.srText":"Something went wrong with the chat session. You can restart the chat.","errors.general.title":"Something went wrong","errors.seamlyOffline.message":"There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.","errors.seamlyOffline.srText":"The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.","errors.seamlyOffline.title":"Connection issues","errors.seamlyUnavailable.buttonText":"Try again","errors.seamlyUnavailable.message":"The server could not be reached. Try again in a little while.","errors.seamlyUnavailable.srText":"The chat server could not be reached. Try again in a little while.","errors.seamlyUnavailable.title":"Server unavailable"},isLoading:!1,initialLocale:void 0,userLocale:void 0},zr=rn({name:"app",initialState:Dr,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Dr)).addCase(fn.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(Pr.pending,(e=>{e.isLoading=!0})).addCase(Pr.rejected,(e=>{e.isLoading=!1})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t?.translations&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>{if(!t.translations)return e;const r=t.translations[n];return e[n]=r,e}),{}))}))}}),{setInitialLocale:Ur,setTranslations:Fr}=zr.actions,Br=zr.reducer,Hr=Yt("getConversation",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return t.getConversation()}catch(e){return n({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError})}}),{condition(e,{getState:t}){const{state:{events:n}}=t(),r=n[n.length-1],i=e?.lastEvent?.id;return r&&i!==r.payload.id}}),$r={error:void 0},Vr=rn({name:"interrupt",initialState:$r,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>$r},extraReducers:e=>{e.addCase(fn.pending,(()=>$r)).addMatcher(Wt(lr.rejected,fn.rejected,Pr.rejected,sr.rejected,cr.rejected,Hr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Gr,clearInterrupt:Wr}=Vr.actions,qr=Vr.reducer,Kr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"],Jr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===j&&!t.fromClient||"info"===e&&t.type===k,Xr=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),Yr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:i,name:a,introduction:o}=t.participant,s=n[r],c={...n,[r]:s?{...s,...i?{avatar:i}:{},...a?{name:a}:{},...o?{introduction:o}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Zr=(e,t)=>{const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{},{blockAutoEntrySwitch:r}=e,i=t?.payload?.actions||{},a=t?.payload?.translatedActions||{};if(!n)return{...e,optionsOverride:{},actions:i,translatedActions:a};const{type:o,options:s}=n;let c=e.active;return r||o===e.userSelected||(c=o),{...e,active:c,optionsOverride:{...e.optionsOverride||{},...o?{[o]:s}:{}},actions:i,translatedActions:a}},Qr={events:[],isLastEventFromClient:!1,initialState:{userResponded:!1},unreadEvents:0,userHasResponded:!1,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1,remaining:void 0,wasStopped:void 0,count:void 0,timer:void 0},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:"",proactiveMessages:!1},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:m(),optionsButtonId:m(),headerCollapseButtonId:m(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:N,active:N,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{},actions:{},translatedActions:{}},seamlyContainerElement:null},ei=rn({name:"store",initialState:Qr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,i=e.options.features.hasOwnProperty(W);let a={...e.options};if(i&&(n===j||"participant"===n)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;a={...a,features:{...a.features,uploads:{enabled:a.features.uploads?.enabled||!1,...a.features?.uploads||{},enabledFromEntry:e===I}}}}const o=Jr(t.payload);if(e.events.find((e=>e.payload.id===r.id)))return;const s=Zr(e.entryMeta,t.payload);e.entryMeta=i||s.active!==I?s:{...e.entryMeta},e.options=a,o&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?L:A)),t.payload.payload.key=m(),e.events.push(t.payload),r.fromClient&&(e.isLastEventFromClient=r.fromClient)},ackEvent:(e,{payload:{payload:t}})=>{if(!t.transactionId)return void console.warn("ACK received without transaction ID.");const n=e.events.find((e=>e.payload.transactionId===t.transactionId&&(!t.type||e.type===t.type))),{id:r,occurredAt:i}=t;n&&(n.payload.id=r,n.payload.occurredAt=i,e.events=Xr(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(e.payload.id&&-1!==t.indexOf(e.payload.id)&&(e.payload={...e.payload,..."service_data"!==e.type&&e.payload.messageStatus===A&&{messageStatus:L}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:i,serviceData:a,resumeConversationPrompt:o}})=>{const s=((e,t)=>{const n=e.filter((e=>"message"===e.type&&!e.payload.optimisticallyInjected&&!t.some((t=>t.payload.id===e.payload.id)))),r=t.filter((e=>!("participant"===e.type&&!e.payload.participant?.introduction))).reverse();return Xr([...r,...n])})(e.events,t),c={...e.participantInfo.participants,...n},l=s.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let u=null;l&&("message"===l.type&&(u=l.payload.participant),"participant"===l.type&&(u=l.payload.participant?.id));const{entry:d}=i,p=d?.options?.upload,h=Zr({...e.entryMeta,...d,active:d?.default||k,options:{...d?.options?d.options:{}}},s[s.length-1]);let f={...e.options.features};const m=f.hasOwnProperty(W);if(m&&"message"===l?.type){const{payload:e}=l,t=e?.entry?.type||{};f={...f,uploads:{enabled:!(!p||!p?.enabled),enabledFromEntry:t===I}}}e.unreadEvents=s.filter((e=>"message"===e.type&&e.payload.messageStatus===A)).length,e.events=s.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...u?Yr(e.participantInfo,{participant:c[u]}):{},participants:c},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,activeServiceSessionId:r,proactiveMessages:i?.proactiveMessages?.enabled||!1},e.serviceData={...e.serviceData,...a},e.options={...e.options,features:f},e.entryMeta=m||h.active!==I?h:{...e.entryMeta},e.resumeConversationPrompt=o||!1,u&&(e.headerTitles.subTitle=c[u].name)},resetHistoryLoadedFlag:e=>{e.historyLoaded=!1},setIsLoading:(e,{payload:t})=>{e.isLoading=t},initIdleDetachCountdown:(e,{payload:t})=>{const{delaySeconds:n,delayTime:r}=t;e.idleDetachCountdown={hasCountdown:!0,isActive:!0,wasStopped:!1,count:n,remaining:n,timer:r}},decrementIdleDetachCountdownCounter:e=>{const{idleDetachCountdown:t}=e,{remaining:n=0}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=b(r)},stopIdleDetachCountdownCounter:e=>{e.idleDetachCountdown.isActive=!1,e.idleDetachCountdown.wasStopped=!0},clearIdleDetachCountdown:e=>{e.idleDetachCountdown.hasCountdown=!1,e.idleDetachCountdown.isActive=!1},initResumeConversationPrompt:e=>{e.resumeConversationPrompt=!0},clearResumeConversationPrompt:e=>{e.resumeConversationPrompt=!1},setParticipant:(e,{payload:t})=>{e.participantInfo=Yr(e.participantInfo,{participant:t.participant,fromClient:t.fromClient})},setActiveService:(e,{payload:t})=>{e.serviceInfo.activeServiceSessionId!==t&&(e.serviceInfo.activeServiceSessionId=t)},setHeaderTitle:(e,{payload:t})=>{e.headerTitles.title=t},setHeaderSubTitle:(e,{payload:t})=>{e.headerTitles.subTitle=t},setInitialState:(e,{payload:t})=>{e.initialState=t,e.unreadEvents=Qr.unreadEvents},setServiceDataItem:(e,{payload:t})=>{e.serviceData[t.type]=t},setFeatures:(e,{payload:t})=>{t.features&&(e.options.features=t.features)},setFeatureEnabledState:(e,{payload:t})=>{e.options.features.hasOwnProperty(t.key)&&(e.options.features[t.key].enabled=t.enabled)},clearFeatures:e=>{e.options.features={webNotifications:e.options.features.webNotifications}},showOption:(e,{payload:t})=>{e.options.panelActive=!0,e.options.optionActive=t},hideOption:e=>{e.options.panelActive=!1,e.options.optionActive=""},setUserSelectedOptions:(e,{payload:t})=>{e.options.userSelectedOptions=t},setUserSelectedOption:(e,{payload:t})=>{const{option:n,value:r}=t;e.options.userSelectedOptions[n]=r},setBlockAutoEntrySwitch:(e,{payload:t})=>{e.entryMeta.blockAutoEntrySwitch=t},setServiceEntryMetadata:(e,{payload:t})=>{e.entryMeta.active=t.default,e.entryMeta.options=t.options||{},e.entryMeta.optionsOverride={},e.entryMeta.actions={},e.entryMeta.translatedActions={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},clearAbortTransaction:e=>{e.entryMeta.actions={},e.entryMeta.translatedActions={}},registerUpload:(e,{payload:t})=>{e.currentUploads.push({id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle})},setUploadProgress:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}:e))},startProcessingImage:(e,{payload:t})=>{e.processingFileUploads.push(t)},doneProcessingImage:(e,{payload:t})=>{e.processingFileUploads=e.processingFileUploads.filter((e=>e!==t))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,error:t.errorText,progress:0,uploading:!1,uploadHandle:null}:e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?{...e,complete:!0}:e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t},setProactiveMessages:(e,{payload:t})=>{e.serviceInfo.proactiveMessages=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>Qr)).addCase(lr.pending,(e=>{e.isLoading=!0})).addCase(fn.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name,t.features&&(e.options.features=t.features)})).addCase(lr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t.initialState&&(e.initialState=t.initialState)})).addMatcher(Wt(ui,di),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:ti,addEvent:ni,clearAllUploads:ri,clearEvents:ii,clearFeatures:ai,clearIdleDetachCountdown:oi,clearResumeConversationPrompt:si,decrementIdleDetachCountdownCounter:ci,hideOption:li,initIdleDetachCountdown:ui,initResumeConversationPrompt:di,registerUpload:pi,resetHistoryLoadedFlag:hi,setActiveEntryType:fi,setActiveService:mi,setBlockAutoEntrySwitch:yi,setEventsRead:gi,setFeatureEnabledState:vi,setFeatures:bi,setHeaderSubTitle:xi,setHeaderTitle:wi,setHistory:Ci,setInitialState:_i,setIsLoading:Si,setLoadedImageEventIds:Ei,setParticipant:Ti,setSeamlyContainerElement:ji,setServiceDataItem:ki,setServiceEntryMetadata:Ni,clearAbortTransaction:Ii,setUploadComplete:Ai,setUploadError:Li,setUploadProgress:Mi,startProcessingImage:Oi,doneProcessingImage:Ri,setUserEntryType:Pi,setUserSelectedOption:Di,setUserSelectedOptions:zi,showOption:Ui,stopIdleDetachCountdownCounter:Fi,setProactiveMessages:Bi}=ei.actions,Hi=ei.reducer,$i={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:Gt(),translatedEventGroups:{},translationProposal:null},Vi=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},i,a)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return a.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,i]]=Object.entries(n);return{lastGroupId:e.filter((e=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:i}},Gi=rn({name:"translation",initialState:$i,reducers:{enableTranslation:(e,{payload:t})=>{e.isActive=!0,e.currentLocale=t},disableTranslation:e=>{e.isActive=!1,e.currentLocale=void 0},enableEventsTranslation:(e,{payload:{events:t,id:n}})=>{delete e.translatedEventGroups[n];const{lastGroupId:r}=Vi(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:i,eventIds:a}=Vi(t,n);e.lastGroupId=r,e.translatedEventGroups[i]=a},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(ur.pending,(()=>$i)).addCase(fn.fulfilled,((e,{payload:t})=>{const n=t?.features?.translation;n?.languages&&(e.isAvailable=!0===n.enabled,e.languages=[...n.languages].sort(((e,n)=>e.locale===t.defaultUserLocale?-1:n.locale===t.defaultUserLocale?1:e.nativeName?.localeCompare(n.nativeName||"",void 0,{sensitivity:"base"})||0)))})).addCase(Ci,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(Pr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(ni,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:Wi,disableTranslation:qi,enableEventsTranslation:Ki,disableEventsTranslation:Ji,setTranslationProposalPrompt:Xi,disableTranslationProposalPrompt:Yi}=Gi.actions,Zi=Gi.reducer,Qi=({dispatch:e})=>t=>n=>{const r=t(n);if(Ci.match(n)&&n.payload?.translation?.enabled)return e(Wi(n.payload.translation.locale)),e(Pr(n.payload.translation.locale)),r;if(fn.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(Pr(n.payload.defaultUserLocale)),r;if(lr.fulfilled.match(n))return n.payload.userLocale&&e(Pr(n.payload.userLocale)),r;if(ni.match(n)&&"info"===n.payload.type&&n.payload.payload.body&&"subtype"in n.payload.payload.body&&"new_translation"===n.payload.payload.body.subtype){const{body:t}=n.payload.payload;if(t.translationLocale&&t.translationEnabled)return e(Pr(t.translationLocale)),r}return r},ea=rn({name:"visibility",initialState:{visibility:vn.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(sr.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(fn.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:ta}=ea.actions,na=ea.reducer,ra=jt({state:Hi,app:wr,config:gr,i18n:Br,translations:Zi,visibility:na,forms:Rr,interrupt:qr});const ia=$n;var aa=n(1162);function oa(e=""){const t=e=>/\s/.test(e),n=[],r={};let i=0,a=null,o=!1,s=0;for(;s<e.length;){if(o&&(t(e[s])||"{"===e[s]))o=!1,a=e.slice(i,s),"{"===e[s]&&s--;else if(!o&&!t(e[s])){const t="{"===e[s];if(a&&t){const t=sa(e,s);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[a]=e.slice(s+1,t),s=t,a=null}else a&&(n.push(a),a=null),o=!0,i=s}s++}return o&&(a=e.slice(i)),a&&n.push(a),{args:n,cases:r}}function sa(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if("}"===t){if(0===n)return r;n--}else"{"===t&&n++}return-1}function ca(e){return la(e.slice(1,-1),",",3)}function la(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let i=e.indexOf(t);if(-1===i)return r.push(e),r;let a=e.substring(0,i).trim(),o=e.substring(i+t.length+1).trim();return r.push(a),la(o,t,n-1,r)}let ua,da=0;const pa="other";function ha(e,t){let n=0,r="",i=0;const a={};for(;n<e.length;){if("#"!==e[n]||i)r+=e[n];else{let e="__hashToken"+da++;r+=`{${e}, number}`,a[e]=t}"{"===e[n]?i++:"}"===e[n]&&i--,n++}return{caseBody:r,numberValues:a}}const fa="other",ma=bt((({i18n:e})=>e),(({translations:e})=>e)),ya=bt((({i18n:e})=>e),(({initialLocale:e})=>e)),ga=bt((({i18n:e})=>e),(({userLocale:e})=>e)),va=bt((({i18n:e})=>e),(({isLoading:e})=>e)),ba=new class{constructor(e,t={}){this.locale=e,this.typeHandlers=t}format=function(e){const t={};return function(...n){let r=n.length?n.map((e=>null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e))).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,r))return t[r];let i=e(...n);return t[r]=i,i}}(((e,t={})=>this.process(e,t).flat(1/0).join("")));process(e,t={}){if(!e)return[];let n=e.indexOf("{");if(-1!==n){let r=sa(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let i=e.substring(n,r+1);if(i){let a=[],o=e.substring(0,n);o&&a.push(o);let[s,c,l]=ca(i),u=t[s];null==u&&(u="");let d=c&&this.typeHandlers[c];a.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&a.push(this.process(p,t)),a}}}return[e]}}("en-GB",{plural:function(e,t,n,r,i){const{args:a,cases:o}=oa(t);let s=parseInt(e);a.forEach((e=>{e.startsWith("offset:")&&(s-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==ua&&ua.resolvedOptions().locale===n||(ua=new Intl.PluralRules(n));const e=ua.select(s);e!==pa&&c.push(e)}1===s&&c.push("one"),c.push(`=${s}`,pa);for(let e=0;e<c.length;e++){const t=c[e];if(t in o){const{caseBody:e,numberValues:n}=ha(o[t],s);return i(e,{...r,...n})}}return e},select:function(e,t,n,r,i){const{cases:a}=oa(t);return e in a?i(a[e],r):fa in a?i(a[fa],r):e}});function xa(){const e=Mn(ma),t=Mn(ga),n=Mn(ya),r=Mn(va);return{t:(0,aa.useCallback)(((n,i={})=>{if(!e)return"";const a=e[n];return a?ba.format(a,i):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const wa=()=>{const e=ia(),t=Mn(ir),n=!!t&&t!==vn.hidden,r=t===vn.open,i=t===vn.minimized,a=(0,aa.useCallback)((t=>e(sr(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:i,visible:t,setVisibility:a,openChat:()=>{a(vn.open)},closeChat:()=>{a(vn.minimized)}}},Ca=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,i.createRef)()})=>{const[r,a]=(0,aa.useState)(null),o=!!r?.isIntersecting||!t,s=o&&e,c=([e])=>a(e);return(0,aa.useEffect)((()=>{const e=n?.current;if(!window.IntersectionObserver||s||!e||!t)return()=>{};const r=new IntersectionObserver(c,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,s]),{isVisible:o,containerRef:n}},_a=()=>Mn(yn),Sa=(0,i.createContext)(null),Ea=(0,i.createContext)(null),Ta=(0,i.createContext)(null),ja=()=>{const e=(0,aa.useContext)(Ea);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},ka=()=>{const e=(0,aa.useContext)(Sa);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},Na=()=>ka().store,Ia=()=>{const e=ka();return(0,aa.useCallback)((()=>e.hasConversation()),[e])},Aa=()=>{const e=ka(),t=ia(),n=ja(),r=_a(),i=Ia(),{visible:a,setVisibility:o}=wa(),s=Yn(),c=(0,aa.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,aa.useCallback)((()=>{c("ui.beforeStart",{visibility:a,hasConversation:i(),hasResponded:r,unreadMessageCount:s}),e.send("start"),c("ui.start",{visibility:a,hasConversation:i(),hasResponded:r,unreadMessageCount:s})}),[e,c,i,r,s,a]),u=(0,aa.useCallback)((async()=>{await t(ur())}),[t]),d=(0,aa.useCallback)((e=>({type:e,id:m(),transactionId:m(),participant:p,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,aa.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,aa.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const i={...h(n),...r};e.send("message",i),c("message",i),t(ni({type:"message",payload:{...i,optimisticallyInjected:!0}}))}),[e,t,c,h]),y=(0,aa.useCallback)(((e,n=m())=>{t(ni({type:"message",payload:{...h(e),transactionId:n}}))}),[t,h]),g=(0,aa.useCallback)(((e,n,r,i,a,o,s)=>{t(ni({type:"message",payload:{type:"upload",id:e,transactionId:n,participant:p,fromClient:!0,occurredAt:r,body:{contentType:i,filename:a,filesize:o,url:s}}}))}),[t]),v=(0,aa.useCallback)(((e,n=m())=>{t(ni({type:"info",payload:{body:{subtype:e},fromClient:!1,fromHistory:!0,id:m(),transactionId:n,type:"divider"}}))}),[t]),b=(0,aa.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==O&&n!==R&&c(`action.${n}`,t)}),[e,c]),x=(0,aa.useCallback)((t=>{e.sendContext(t)}),[e]),w=(0,aa.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(_i(e)),e.userResponded&&(t(xr(e.userResponded)),o(vn.open)))})).catch((e=>{t(Gr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,o]);return{connect:w,start:l,sendMessage:f,sendAction:b,sendContext:x,reset:u,emitEvent:c,addMessageBubble:y,addUploadBubble:g,addDivider:v,apiConnected:e.connected,apiConfigReady:e.configReady}},La=()=>{const e=(()=>{const e=(0,aa.useContext)(Ta);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,aa.useCallback)((t=>{t&&e({ariaLive:V,messageText:t})}),[e]),sendAssertive:(0,aa.useCallback)((t=>{t&&e({ariaLive:$,messageText:t})}),[e])}},Ma=bt((({interrupt:e})=>e),(({error:e})=>e)),Oa=bt(Ma,(e=>Boolean(e)));function Ra(){const{t:e}=xa(),t=Mn(Ma);return{hasError:Mn(Oa),meta:(0,aa.useMemo)((()=>{if(!t)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0,action:void 0};const{langKey:n,action:r}=t,i=e(`${n}.title`),a=e(`${n}.message`),o=e(`${n}.srText`),s=r?e(`${n}.buttonText`):null;return{...n?{title:i,message:a,srText:o}:{},...r?{action:r}:{},...r&&n?{buttonText:s}:{},originalError:t}}),[t,e]),error:t}}const Pa=require("preact/compat"),Da=require("preact/jsx-runtime"),za=({children:e})=>((()=>{const{t:e}=xa(),{isInline:t,isWindow:n,isApp:r}=rr(),{isOpen:i,isVisible:a}=wa(),o=Mn(ar),{start:s,connect:l,apiConfigReady:u,apiConnected:d}=Aa(),p=(0,aa.useRef)(!1),{sendAssertive:h}=La();!function(){const{meta:{originalError:e,action:t}}=Ra(),n=ia(),{reset:r}=Aa(),i="SeamlySessionExpiredError"===e?.name,a=(0,aa.useRef)(0),o=(0,aa.useRef)(null);(0,aa.useEffect)((()=>{if(i&&"reset"===t){if(a.current>=10){o.current=setTimeout((()=>{a.current=0}),1e4);const e=new c;return n(Gr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}a.current+=1,r()}return()=>{o.current&&clearTimeout(o.current)}}),[t,r,i,n])}(),(0,aa.useEffect)((()=>{a&&setTimeout((()=>{h(e("window.srTexts.onLoad"))}),500)}),[a,h,e]),(0,aa.useEffect)((()=>{a&&h(e(i?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[i,a,h,e]),(0,aa.useEffect)((()=>{u&&d||(p.current=!1)}),[u,d]);const f=(0,aa.useCallback)((async()=>{d||(p.current=!0,await l()),(r||i||a&&t)&&s()}),[d,l,r,t,i,a,s]);(0,aa.useEffect)((()=>{!u||p.current||n&&!i||!(!t||a&&o)||f()}),[u,f,t,i,a,n,o])})(),(0,Da.jsx)(Da.Fragment,{children:e})),Ua=(0,i.createContext)(null),Fa=(e=0)=>new Promise((t=>{setTimeout(t,e)})),Ba=()=>{const{seamlyContainerElement:e}=Wn(),t=ia();return[e,(0,aa.useCallback)((e=>{t(ji(e))}),[t])]},Ha=e=>(0,aa.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await Fa(180);const e="string"==typeof t?document.getElementById(t):t;S(e)}))}),[e]),$a=()=>{const e=Zn();return Ha(e)},Va=e=>bt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function Ga(){const{sendContext:e}=Aa(),t=ia(),n=Vn(),r=(0,aa.useCallback)(((t,n)=>{e({userLocale:t,source:n})}),[e]),i=(0,aa.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(qi())}),[n.context?.contentLocale,t,e]),{languages:a,isActive:o,isAvailable:s,currentLocale:c}=Mn((({translations:e})=>e));return{languages:a,isActive:o,isAvailable:s,currentLocale:c,enableTranslations:r,disableTranslations:i}}const Wa=e=>{const t=Mn(Va(e));if(!e?.payload)return{body:void 0,hasTranslation:!1,isTranslated:!1,locale:""};const n=e.payload?.translatedBody&&"data"in e.payload.translatedBody?e.payload?.translatedBody.data:e.payload.translatedBody,{translation:r,body:i}={body:e.payload?.body,translation:e.payload?.translation},a=!!n;return{body:t&&a?n:i,hasTranslation:a,isTranslated:t&&a,locale:r?.locale}};function qa(e){const{languages:t}=Ga();return(0,aa.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const Ka=()=>{const{isActive:e,languages:t}=Ga(),n=ia(),{sendAction:r}=Aa(),{translationProposal:i}=Mn((e=>e.translations)),{enableTranslations:a}=Ga(),{isOpen:o}=wa(),{userLocale:s}=xa(),c=i?.proposedLocale,l=qa(c),u=(0,aa.useMemo)((()=>null!==i&&!e&&o&&s!==c&&t.some((e=>e.locale===c))),[i,e,o,s,c,t]);return{activateTranslationProposal:()=>{a(i?.proposedLocale,B)},dismissTranslationProposal:()=>{r({type:D,body:{type:F}}),n(Yi())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:i}},Ja=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e?.split(" "))).flat().filter((e=>e&&e.length)).map((e=>e&&e.indexOf(d)>-1?e:[d,e].join("-"))).join(" "),Xa=()=>Vn().appContainerClassNames,Ya=e=>{const{fromClient:t}=e.payload,n=["message"];return"info"===e.type?n.push("message--source-info"):t?n.push("message--source-user"):n.push("message--source-agent"),n},Za=(0,i.createContext)(null),Qa=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=Wn(),{allowedMimeTypes:i,maxSize:a}=n.upload||{},{enabled:o,enabledFromEntry:s}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...i?{allowedMimeTypes:i}:{},...a?{maxSize:a}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:s||o,allowedMimeTypes:c,maxSize:l}},eo=()=>{const{currentUploads:e}=Wn(),t=ia(),n=(()=>{const e=(0,aa.useContext)(Za);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,aa.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,aa.useCallback)((()=>{t(ri())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},to=()=>{const{t:e}=xa(),{options:t}=Wn(),{panelActive:n,optionActive:r,userSelectedOptions:i,features:a}=t,{extraMenuItem:o,sendTranscript:s}=a,c={extraMenuItem:o,sendTranscript:s},l=t=>"extraMenuItem"===t?"Extra menu item":e(`options.${t}.menuTitle`),u=Object.keys(c).filter((e=>c[e])).map((e=>({name:e,title:l(e),available:c[e].enabled}))),d=o||s,p=ia(),{get:h,set:f}=Na();return{allowOptionSelection:d,userSelectedOptions:i,features:a,menuOptions:u,initUserSelectedOptions:(0,aa.useCallback)((()=>{const e=h("options")||{};p(zi(e))}),[h,p]),setUserSelectedOptions:(0,aa.useCallback)((e=>{p(zi(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,aa.useCallback)(((e,t)=>{const n=h("options")||{};"object"==typeof n&&f("options",{...n,[e]:t}),p(Di({option:e,value:t}))}),[p,h,f]),showOption:e=>{p(Ui(e))},hideOption:()=>{p(li())},panelActive:n,optionActive:r}},no=()=>{const{optionsButtonId:e}=Wn();return{id:e,focusButton:Ha(e)}},ro=(0,i.createContext)(null),io=()=>{const e=(0,aa.useContext)(ro);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},ao=()=>{const e=ia(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:i,timer:a,wasStopped:o}}=Wn(),{isOpen:s}=wa(),{emitEvent:c,sendAction:l}=Aa(),{t:u}=xa(),{sendAssertive:d,sendPolite:p}=La(),h=(0,aa.useCallback)((e=>{s&&d(e)}),[s,d]),f=(0,aa.useCallback)((e=>{s&&p(e)}),[s,p]),m=(0,aa.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=b(n);e(ui({delaySeconds:n,delayTime:r})),c("idleTimer.start"),h(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,h,u]),y=(0,aa.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:P}),h(u("idleDetachWarning.notifyTransferText"))),o||c("idleTimer.stop"),e(oi()))}),[e,c,t,l,h,u,o]),g=(0,aa.useCallback)((()=>{if(!i||i<=0)return;const t=i-1;t%10==0&&h(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",b(t))}`),e(ci())}),[e,i,h,u]),v=(0,aa.useCallback)((()=>{n&&(e(Fi()),i&&(c("idleTimer.stop"),f(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,i,f,u]);return{hasCountdown:t,isActive:n,count:r,remaining:i,timer:a,wasStopped:o,initCountdown:m,endCountdown:y,decrementCountdown:g,stopCountdown:v}},oo=()=>{const e=ia(),t=Wn().resumeConversationPrompt,{sendAction:n}=Aa(),{t:r}=xa(),{sendAssertive:i}=La();return{continueChat:()=>{n({type:D,body:{type:"resume_conversation_prompt"}}),e(si())},hasPrompt:t,restartChat:()=>{i(r("resumeConversationPrompt.srNotifyRestartText")),n({type:P}),e(si())}}},so=()=>{const[e]=(0,aa.useState)((()=>m()));return e},co=({eventPayload:e})=>{const{t}=xa(),{fromClient:n,participant:r}=e,i=(e=>Wn().participantInfo.participants[e])(r)||{},{messages:a}=Vn(),o=n?t("participants.user.name"):i&&i.name,{showAvatar:s,showName:c}=a&&a[n?"user":"agent"]||{};if(!s&&!c)return null;const l=[];return s&&o&&i.avatar&&l.push((0,Da.jsx)("span",{className:Ja("message__avatar"),children:(0,Da.jsx)("img",{src:i.avatar,className:Ja("avatar"),alt:""})})),c&&o&&l.push((0,Da.jsx)("span",{className:Ja("message__author-name"),children:o})),l.length>0?(0,Da.jsx)("div",{className:Ja("message__author"),children:l}):null},lo=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:i,bodyProps:a={},info:o,...s})=>{const c=Ya(t),{hasTranslation:l,isTranslated:u,locale:d}=Wa(t);return n&&c.push(`message--type-${n}`),r&&("string"==typeof r&&(r=r.split(" ").filter((e=>e.length))),r.forEach((e=>{c.push(`message--${e}`)}))),u&&c.push("message--is-translated"),l&&c.push("message--has-translation"),u&&(a={...a,lang:d}),(0,Da.jsx)(Da.Fragment,{children:(0,Da.jsxs)("div",{className:Ja(c),...s,children:[e&&(0,Da.jsx)(co,{eventPayload:t.payload}),(0,Da.jsx)("div",{className:Ja("message__body"),...a,children:i}),o&&(0,Da.jsx)("div",{"aria-hidden":"true",className:Ja("message__info"),children:o})]})})},uo=({id:e,action:t,buttonText:n,description:r,hasFocus:i,image:a,title:o,isCarouselItem:s})=>{const c=(0,aa.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=Aa(),p=so(),h=(0,aa.useRef)(!1),f=t?.type===q?"a":"button",m=(0,aa.useCallback)((()=>d("action.click_card",{type:U,originMessage:e,action:t})),[d,e,t]),y=(0,aa.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:z,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),g=(0,aa.useMemo)((()=>t?.type===q?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,aa.useEffect)((()=>{s&&(i&&h.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),h.current=!0}),[i,s]),(0,Da.jsxs)("div",{className:Ja("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[a?(0,Da.jsx)("img",{className:Ja("card__image"),src:a,alt:""}):null,(0,Da.jsxs)("div",{className:Ja("card__content"),id:e,children:[o&&(0,Da.jsx)("h2",{className:Ja("card__title"),children:o}),r&&(0,Da.jsx)("div",{className:Ja("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,Da.jsx)(f,{tabIndex:s&&!i?-1:void 0,className:Ja("button","button--primary"),"aria-describedby":p,...g,children:n})]})]})};function po({item:e,items:t,index:n,isActive:r}){const{t:i}=xa();return(0,Da.jsx)("div",{className:Ja("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":i("carousel.slide.label",{index:n+1,total:t.length}),children:(0,Da.jsx)(uo,{...e,isCarouselItem:!0,hasFocus:r})})}const ho={send:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>'},balloon:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>'},newTopic:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>'},newTranslation:{16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>'},avatar:{32:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">\n<path fill="#4A48C1" d="M10,14.8c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S11.1,14.8,10,14.8z M15.9,14.8c1.1,0,2-0.9,2-2s-0.9-2-2-2\n\ts-2,0.9-2,2S14.8,14.8,15.9,14.8z M21.8,10.8c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S22.9,10.8,21.8,10.8z M21.3,18.1H10.7\n\tC11.7,23.9,20.2,23.9,21.3,18.1z"/>\n</svg>\n'},chevronDown:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>'},chevronRight:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>'},close:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>'},enlarge:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>'},options:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>'},file:{32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>'},upload:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>'},download:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>'},error:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>'},arrowLeft:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n'},arrowRight:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},check:{16:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="16px"\n height="16px"\n x="0px"\n y="0px"\n viewBox="0 0 16 16"\n>\n <path\n fill="currentColor"\n d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8\n\tc0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"\n />\n</svg>\n',32:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="32px"\n height="32px"\n x="0px"\n y="0px"\n viewBox="0 0 32 32"\n>\n <path\n fill="currentColor"\n d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6\n\tc0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"\n />\n</svg>\n'}},fo=({name:e,size:t="32",className:n,alt:r})=>(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("div",{"aria-hidden":"true",className:n||Ja("icon"),dangerouslySetInnerHTML:{__html:ho[e][t]}}),r&&(0,Da.jsx)("span",{className:Ja("visually-hidden"),children:r})]});function mo({items:e,currentIndex:t,onChange:n,children:r}){const{t:i}=xa(),a=e.length;return(0,Da.jsxs)("div",{className:Ja("carousel-controls"),children:[(0,Da.jsx)("button",{className:Ja("button","button--previous"),"aria-label":i("carousel.controls.previous"),onClick:()=>{n((t-1+a)%a)},children:(0,Da.jsx)(fo,{name:"arrowLeft",size:"16",alt:""})}),r,(0,Da.jsx)("button",{className:Ja("button","button--next"),"aria-label":i("carousel.controls.next"),onClick:()=>{n((t+1)%a)},children:(0,Da.jsx)(fo,{name:"arrowRight",size:"16",alt:""})})]})}function yo({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:i}){const a=e.length,o=(0,aa.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),i=Math.min(a-1,Math.max(0,r));i!==t&&n(i)}),[a,t,n]);return(0,Da.jsx)("div",{className:Ja("carousel-pagination__wrapper"),role:"group",children:(0,Da.jsx)("ul",{className:Ja("carousel-pagination"),children:e.map(((e,n)=>{const a=t===n;return(0,Da.jsx)("li",{className:Ja("carousel-pagination__item",a?"is-active":void 0),children:(0,Da.jsx)("button",{className:Ja("carousel-pagination__button"),type:"button",onClick:o,"data-item":n,"aria-disabled":a?"true":void 0,"aria-label":i(e,n)})},r(e,n,"pagination-item-"))}))})})}const go=(e,t,n)=>`${n}${t}`,vo=e=>e.label,bo=({target:e})=>{e.scrollLeft=0};function xo({currentIndex:e=0,onChange:t=(()=>{}),getItemKey:n=go,getItemLabel:r=vo,items:a}){const o=so(),s=a.length,[c,l]=(0,aa.useState)(Number(e||0));(0,aa.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,aa.useRef)([]);u.current=(0,aa.useMemo)((()=>Array(s).fill(1).map((()=>(0,i.createRef)()))),[s]);const d=(0,aa.useRef)(!0),p=(0,aa.useRef)(null);return p.current=t,(0,aa.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,Da.jsxs)("div",{className:Ja("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,Da.jsx)("div",{className:Ja("carousel__slides-wrapper"),onScroll:bo,children:(0,Da.jsx)("div",{id:o,className:Ja("carousel__slides"),style:{width:100*s+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:a.map(((e,t)=>{const r=c===t;return(0,Da.jsx)("div",{ref:u.current[t],className:Ja("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,Da.jsx)(po,{item:e,items:a,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,Da.jsx)("div",{className:Ja("carousel__controls"),children:(0,Da.jsx)(mo,{currentIndex:c,items:a,onChange:l,children:(0,Da.jsx)("div",{className:Ja("carousel__pagination"),children:(0,Da.jsx)(yo,{currentIndex:c,items:a,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const wo=(e,t,n="")=>`${n}${e.title}:${t}`,Co=e=>e.title,_o=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,So=({id:e,categories:t=[],question:n,onClick:r,hasIcon:i})=>{const a=(0,aa.useMemo)((()=>["suggestions__item",...t.map(_o)]),[t]),o=(0,aa.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,Da.jsx)("li",{className:Ja(a),children:(0,Da.jsxs)("button",{type:"button",onClick:o,className:Ja("button","button--primary"),children:[i&&(0,Da.jsx)(fo,{name:"chevronRight",size:"8",alt:""}),n]})})},Eo=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,Da.jsx)("ul",{className:Ja("suggestions__list",e||""),children:t.map((e=>(0,Da.jsx)(So,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),To=e=>{const{sendAction:t}=Aa();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}},jo=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:i,iconSize:a,iconClassName:o,dividerType:s,title:c,description:l})=>{const u=Boolean(i||n);return(0,Da.jsxs)("div",{className:Ja("divider",s&&`divider--type-${s}`,t),children:[u&&(0,Da.jsx)("span",{className:Ja("divider__graphic"),children:i?(0,Da.jsx)(fo,{name:i,size:a,className:o,alt:""}):(0,Da.jsx)("img",{src:n,className:Ja({icon:"icon"===r,avatar:"avatar"===r},o)})}),(0,Da.jsxs)("div",{className:Ja("divider__body"),children:[c?(0,Da.jsx)("h2",{className:Ja("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,Da.jsx)("p",{className:Ja("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},ko={[G.new_topic]:"new-topic"},No={default:({event:e})=>{const{t}=xa(),{subtype:n}=e.payload.body,r=ko[G[n]];return G[n]?(0,Da.jsx)(jo,{dividerType:r,iconName:G[n],title:t(`dividerKeys.${G[n]}`)}):null},[G.new_translation]:({event:e})=>{const{t}=xa(),n=Jn(),{body:{translationEnabled:r,text:i,title:a},id:o}=e.payload,s=Mn((e=>e.translations.translatedEventGroups)),c=ia(),l=(0,aa.useCallback)((()=>{s[o]?c(Ki({events:n,id:o})):c(Ji({events:n,id:o}))}),[c,n,o,s]);return(0,Da.jsx)(jo,{iconName:"newTranslation",dividerType:"new-translation",title:a,description:i,children:r?(0,Da.jsx)(Da.Fragment,{children:(0,Da.jsx)("button",{className:Ja("button","button--secondary"),onClick:l,children:t(s[o]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},Io={month:"long",day:"numeric",year:"numeric"},Ao={hour:"numeric",minute:"numeric"},Lo=({event:e})=>{const t=(()=>{const[e,t]=(0,aa.useReducer)((e=>e+1),0);return(0,aa.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:i,srText:a}=(e=>{const{t}=xa(),n=Vn(),r=n?.context?.userLocale??[],i=new Date(e),a=new Date,o=new Date(a);o.setHours(24,0,0,0);const s=o.valueOf()-a.valueOf(),c=i.toString(),l=new Intl.DateTimeFormat(r,Ao).format(i);let u=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),i=864e5;return r>=n+i?e:r>n?"today":r>n-i?"yesterday":e})(i,a);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,Io).format(i)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:s}})(v(e.payload.timeIndicator));return(0,aa.useEffect)((()=>{const e=setTimeout((()=>{t()}),i);return()=>{clearTimeout(e)}}),[t,i]),(0,Da.jsxs)(jo,{dividerType:"time-indicator",children:[(0,Da.jsxs)("h2",{className:Ja("divider__time"),"aria-hidden":"true",children:[(0,Da.jsx)("span",{className:Ja("divider__time--date"),children:n}),(0,Da.jsx)("span",{className:Ja("divider__time--time"),children:r})]}),(0,Da.jsx)("p",{className:Ja("visually-hidden"),children:a})]})};var Mo=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Oo=Mo.join(","),Ro="undefined"==typeof Element,Po=Ro?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Do=!Ro&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},zo=function e(t,n){var r;void 0===n&&(n=!0);var i=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===i||"true"===i||n&&t&&e(t.parentNode)},Uo=function(e,t,n){if(zo(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Oo));return t&&Po.call(e,Oo)&&r.unshift(e),r.filter(n)},Fo=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var o=a.shift();if(!zo(o,!1))if("SLOT"===o.tagName){var s=o.assignedElements(),c=e(s.length?s:o.children,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{Po.call(o,Oo)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(o),u=!zo(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(l&&u){var d=e(!0===l?o.children:l.children,!0,r);r.flatten?i.push.apply(i,d):i.push({scopeParent:o,candidates:d})}else a.unshift.apply(a,o.children)}}return i},Bo=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ho=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Bo(e)?0:e.tabIndex},$o=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Vo=function(e){return"INPUT"===e.tagName},Go=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Wo=function(e,t){return!(t.disabled||zo(t)||function(e){return Vo(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var i=Po.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Po.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Go(e)}else{if("function"==typeof r){for(var a=e;e;){var o=e.parentElement,s=Do(e);if(o&&!o.shadowRoot&&!0===r(o))return Go(e);e=e.assignedSlot?e.assignedSlot:o||s===e.ownerDocument?o:s.host}e=a}if(function(e){var t,n,r,i,a=e&&Do(e),o=null===(t=a)||void 0===t?void 0:t.host,s=!1;if(a&&a!==e)for(s=!!(null!==(n=o)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(o)||null!=e&&null!==(i=e.ownerDocument)&&void 0!==i&&i.contains(e));!s&&o;){var c,l,u;s=!(null===(l=o=null===(c=a=Do(o))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(o))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Po.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},qo=function(e,t){return!(function(e){return function(e){return Vo(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Do(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var i=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!i||i===e}(e)}(t)||Ho(t)<0||!Wo(e,t))},Ko=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Jo=function e(t){var n=[],r=[];return t.forEach((function(t,i){var a=!!t.scopeParent,o=a?t.scopeParent:t,s=function(e,t){var n=Ho(e);return n<0&&t&&!Bo(e)?0:n}(o,a),c=a?e(t.candidates):o;0===s?a?n.push.apply(n,c):n.push(o):r.push({documentOrder:i,tabIndex:s,item:t,isScope:a,content:c})})),r.sort($o).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Xo=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Po.call(e,Oo)&&qo(t,e)},Yo=Mo.concat("iframe").join(","),Zo=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Po.call(e,Yo)&&Wo(t,e)};function Qo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function es(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qo(Object(n),!0).forEach((function(t){var r,i,a;r=e,i=t,a=n[t],i=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(i),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ts=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},ns=function(e){return ts(e)&&!e.shiftKey},rs=function(e){return ts(e)&&e.shiftKey},is=function(e){return setTimeout(e,0)},as=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},os=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},ss=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},cs=[],ls=function(e,t){var n,r=(null==t?void 0:t.document)||document,i=(null==t?void 0:t.trapStack)||cs,a=es({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ns,isKeyBackward:rs},t),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},s=function(e,t,n){return e&&void 0!==e[t]?e[t]:a[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return o.containerGroups.findIndex((function(t){var r=t.container,i=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||i.find((function(t){return t===e}))}))},l=function(e){var t=a[e];if("function"==typeof t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];t=t.apply(void 0,i)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var s=t;if("string"==typeof t&&!(s=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return s},u=function(){var e=l("initialFocus");if(!1===e)return!1;if(void 0===e||!Zo(e,a.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=o.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(o.containerGroups=o.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Fo([e],t.includeContainer,{filter:qo.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ko}):Uo(e,t.includeContainer,qo.bind(null,t)),Jo(n)}(e,a.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?Fo([e],t.includeContainer,{filter:Wo.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Uo(e,t.includeContainer,Wo.bind(null,t))}(e,a.tabbableOptions),r=t.length>0?t[0]:void 0,i=t.length>0?t[t.length-1]:void 0,o=n.find((function(e){return Xo(e)})),s=n.slice().reverse().find((function(e){return Xo(e)})),c=!!t.find((function(e){return Ho(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:o,lastDomTabbableNode:s,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=t.indexOf(e);return i<0?r?n.slice(n.indexOf(e)+1).find((function(e){return Xo(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return Xo(e)})):t[i+(r?1:-1)]}}})),o.tabbableGroups=o.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),o.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find((function(e){return e.posTabIndexesFound}))&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},h=function e(t){!1!==t&&t!==p(document)&&(t&&t.focus?(t.focus({preventScroll:!!a.preventScroll}),o.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},f=function(e){var t=l("setReturnFocus",e);return t||!1!==t&&e},m=function(e){var t=e.target,n=e.event,r=e.isBackward,i=void 0!==r&&r;t=t||ss(n),d();var s=null;if(o.tabbableGroups.length>0){var u=c(t,n),p=u>=0?o.containerGroups[u]:void 0;if(u<0)s=i?o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:o.tabbableGroups[0].firstTabbableNode;else if(i){var h=as(o.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(h<0&&(p.container===t||Zo(t,a.tabbableOptions)&&!Xo(t,a.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(h=u),h>=0){var f=0===h?o.tabbableGroups.length-1:h-1,m=o.tabbableGroups[f];s=Ho(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else ts(n)||(s=p.nextTabbableNode(t,!1))}else{var y=as(o.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||Zo(t,a.tabbableOptions)&&!Xo(t,a.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var g=y===o.tabbableGroups.length-1?0:y+1,v=o.tabbableGroups[g];s=Ho(t)>=0?v.firstTabbableNode:v.firstDomTabbableNode}else ts(n)||(s=p.nextTabbableNode(t))}}else s=l("fallbackFocus");return s},y=function(e){var t=ss(e);c(t,e)>=0||(os(a.clickOutsideDeactivates,e)?n.deactivate({returnFocus:a.returnFocusOnDeactivate}):os(a.allowOutsideClick,e)||e.preventDefault())},g=function(e){var t=ss(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(o.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var i=!0;if(o.mostRecentlyFocusedNode)if(Ho(o.mostRecentlyFocusedNode)>0){var s=c(o.mostRecentlyFocusedNode),l=o.containerGroups[s].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===o.mostRecentlyFocusedNode}));d>=0&&(a.isKeyForward(o.recentNavEvent)?d+1<l.length&&(r=l[d+1],i=!1):d-1>=0&&(r=l[d-1],i=!1))}}else o.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return Ho(e)>0}))}))||(i=!1);else i=!1;i&&(r=m({target:o.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(o.recentNavEvent)})),h(r||o.mostRecentlyFocusedNode||u())}o.recentNavEvent=void 0},v=function(e){if(("Escape"===(null==(t=e)?void 0:t.key)||"Esc"===(null==t?void 0:t.key)||27===(null==t?void 0:t.keyCode))&&!1!==os(a.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();var t;(a.isKeyForward(e)||a.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];o.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(ts(e)&&e.preventDefault(),h(n))}(e,a.isKeyBackward(e))},b=function(e){var t=ss(e);c(t,e)>=0||os(a.clickOutsideDeactivates,e)||os(a.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},x=function(){if(o.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var r=e.indexOf(t);-1===r||e.splice(r,1),e.push(t)}(i,n),o.delayInitialFocusTimer=a.delayInitialFocus?is((function(){h(u())})):h(u()),r.addEventListener("focusin",g,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",v,{capture:!0,passive:!1}),n},w=function(){if(o.active)return r.removeEventListener("focusin",g,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",v,!0),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===o.mostRecentlyFocusedNode}))}))&&h(u())})):void 0,_=function(){C&&(C.disconnect(),o.active&&!o.paused&&o.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return o.active},get paused(){return o.paused},activate:function(e){if(o.active)return this;var t=s(e,"onActivate"),n=s(e,"onPostActivate"),i=s(e,"checkCanFocusTrap");i||d(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var a=function(){i&&d(),x(),_(),null==n||n()};return i?(i(o.containers.concat()).then(a,a),this):(a(),this)},deactivate:function(e){if(!o.active)return this;var t=es({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},e);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,w(),o.active=!1,o.paused=!1,_(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}(i,n);var r=s(t,"onDeactivate"),c=s(t,"onPostDeactivate"),l=s(t,"checkCanReturnFocus"),u=s(t,"returnFocus","returnFocusOnDeactivate");null==r||r();var d=function(){is((function(){u&&h(f(o.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(f(o.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){if(o.paused||!o.active)return this;var t=s(e,"onPause"),n=s(e,"onPostPause");return o.paused=!0,null==t||t(),w(),_(),null==n||n(),this},unpause:function(e){if(!o.paused||!o.active)return this;var t=s(e,"onUnpause"),n=s(e,"onPostUnpause");return o.paused=!1,null==t||t(),d(),x(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return o.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),o.active&&d(),_(),this}},n.updateContainerElements(e),n};const us=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":a})=>{const o=so(),s=(0,aa.useRef)(null),c=(0,aa.useRef)(null),[l,u]=(0,aa.useState)(!1);return(0,aa.useEffect)((()=>(l&&s.current&&(c.current=ls(s.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,aa.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(null!==r&&e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[l]),(0,aa.useEffect)((()=>{l&&s.current&&s.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,aa.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",o),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),r&&t.setAttribute("aria-label",r),a&&t.setAttribute("aria-labelledby",a),e.appendChild(t),s.current=t,u(!0),()=>{s.current&&(e.removeChild(s.current),s.current=null)}}),[r,a,o]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>s.current&&(0,i.render)(e,s.current)}):s.current&&(0,i.render)((0,i.toChildArray)(e).filter(T).map((e=>(e.props={...e.props,onClose:t},e))),s.current)},ds=({url:e,description:t,onClose:n})=>{const r=Vn(),i=io(),a=Xa(),o=(0,aa.useRef)(null),{t:s}=xa(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof a?c.push(...a):c.push(...a(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,Da.jsx)(us,{onClose:n,"aria-label":s("lightbox.heading"),fallBackFocusRef:o,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,Da.jsx)("div",{className:Ja(c),onClick:u,style:d,children:(0,Da.jsxs)("div",{className:Ja("modal__float"),tabIndex:-1,onMouseDown:i,onKeyDown:i,onTouchStart:i,onMouseMove:i,onWheel:i,onPointerDown:i,onPointerMove:i,ref:o,children:[(0,Da.jsx)("div",{className:Ja("modal__inner"),onClick:l,children:(0,Da.jsx)("img",{className:Ja("modal__image"),src:e,alt:t})}),(0,Da.jsxs)("button",{type:"button",className:Ja("modal__close"),onClick:n,children:[(0,Da.jsx)(fo,{name:"close",size:"16",alt:""}),s("lightbox.closeLabel")]})]})}))(n))})},ps=({description:e,url:t})=>{const{t:n}=xa(),[r,i]=(0,aa.useState)(!1);return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsxs)("button",{type:"button",className:Ja("modal__enlarge"),onClick:()=>{i(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,Da.jsx)(fo,{name:"enlarge",size:"32",alt:""})]}),r&&(0,Da.jsx)(ds,{url:t,description:e,onClose:()=>{i(!1)}})]})},hs=({event:e,...t})=>{const{body:n}=Wa(e),r=To(e.payload.id),i=(0,aa.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,Da.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,Da.jsx)(lo,{type:"text",event:e,onClick:r,...t,...i})},fs="PROCESSING_IMAGE",ms=({img:e,filename:t})=>{const{t:n}=xa(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,Da.jsx)(Da.Fragment,{children:(0,Da.jsxs)("span",{className:Ja(["download","download--preview"]),children:[(0,Da.jsx)("img",{src:e,alt:r}),(0,Da.jsx)("span",{"aria-hidden":"true",className:Ja("file-download"),children:t})]})})},ys=({children:e,url:t,target:n})=>t?(0,Da.jsx)("a",{href:t,download:!0,target:n,className:Ja(["download","download-link"]),children:e}):(0,Da.jsx)("span",{className:Ja("download"),children:e}),gs={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=xa(),a=so(),{body:o,subEvent:s,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=(e=>{const{payload:t}=e,[n,r]=(0,aa.useState)(!1),{sendAction:i,addMessageBubble:a,addDivider:o}=Aa(),{activeServiceSessionId:s}=Qn(),c=Mn(er),{body:l}=Wa(e),{service:u}=t,d=(0,aa.useMemo)((()=>{if("choice_prompt"===e.payload.type)return{...e,payload:{...e.payload,body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&{...e.payload.translatedBody,data:e.payload.translatedBody?.prompt}}}}),[e]),p=l?.chooseAgain&&s===u?.serviceSessionId&&t.id!==c;return(0,aa.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:d,showOptions:n,chooseAgain:p,onChoiceClickHandler:e=>{const n=m();p&&o("new_topic",n),a(e.text,n),i({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:p},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}})(e);return(0,Da.jsxs)(Da.Fragment,{children:[(0,i.toChildArray)(t).filter(T).map((e=>(e.props={...e.props,event:s,descriptorId:a,showTranslationToggle:!1},e))),l&&(0,Da.jsxs)("button",{type:"button",className:Ja("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":a,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,Da.jsx)(fo,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,Da.jsx)(lo,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,Da.jsx)("ul",{className:Ja("choice-prompt","choice-prompt--many"),children:o?.choices?.map((e=>(0,Da.jsx)("li",{className:Ja("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:hs,image:({event:e,descriptorId:t,...n})=>{const{body:r}=Wa(e),[i,a]=(0,aa.useState)(!1),o=ia();return(0,Da.jsxs)(lo,{event:e,type:"image",...n,children:[(0,Da.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{o(Ei(e.payload.id)),a(!0)}}),r?.isZoomable&&i&&(0,Da.jsx)(ps,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=Wa(e),i=To(n.id);return(0,Da.jsx)(lo,{type:"splash",event:e,onClick:i,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=Wa(e);return Ya(e).push("message--type-video"),(0,Da.jsxs)(lo,{event:e,type:"video",...n,children:[(0,Da.jsx)("div",{id:t,className:Ja("visually-hidden"),children:r?.description}),(0,Da.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=xa(),{body:r}=Wa(e),{fromClient:i,id:a}=e.payload,{filename:o,url:s}=r,c=(e=>{const{processingFileUploads:t}=Mn((({state:e})=>e));return(0,aa.useMemo)((()=>{if(t.some((t=>t===e)))return fs;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(a),l=(0,aa.useMemo)((()=>n(s?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:o})),[s,o,n]);return(0,Da.jsx)(lo,{event:e,type:"upload",...t,children:c&&c!==fs?(0,Da.jsx)(ms,{img:c,filename:o}):(0,Da.jsxs)(ys,{url:s,target:i?void 0:"_blank",children:[(0,Da.jsx)(fo,{name:"download",size:"16",alt:l}),(0,Da.jsx)("span",{"aria-hidden":"true",className:Ja("file-download"),children:o})]})})},cta:({event:e})=>{const{body:t}=Wa(e),n=To(e.payload.id),{emitEvent:r}=Aa(),i=so(),a=(0,aa.useCallback)((()=>r(`action.${U}`,{type:U,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,Da.jsxs)(lo,{type:"cta",event:e,children:[(0,Da.jsx)("div",{className:Ja("cta__content"),id:i,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,Da.jsx)("a",{className:Ja("button","button--primary"),"aria-describedby":i,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:a,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=Wa(e),n=t.cards;return(0,Da.jsx)(lo,{event:e,modifiers:"type-carousel",children:(0,Da.jsx)(xo,{items:n,getItemKey:wo,getItemLabel:Co})})},card:({event:e})=>{const{body:t}=Wa(e),n=so();return(0,Da.jsx)(lo,{type:"card",event:e,children:(0,Da.jsx)(uo,{id:n,...t})})}},info:{text:hs,divider:({event:e,...t})=>{const n=No[G[e.payload.body.subtype]]||No.default;return(0,Da.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=xa(),{body:r}=Wa(e);return(0,Da.jsx)(lo,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:Lo},participant:{participant:({event:e})=>{const{participant:t}=e.payload,{body:n}=(e=>{const{translatedBody:t,translation:n,body:r}={body:e.payload?.participant?.introduction,translatedBody:e.payload?.participant?.translatedIntroduction,translation:e.payload?.participant?.translation},i=!!t,a=Mn(Va(e));return{body:a&&i?t:r,hasTranslation:i,isTranslated:a&&i,locale:n?.locale}})(e);return n?(0,Da.jsx)(jo,{graphicSrc:t?.avatar,graphicType:t?.avatar?"avatar":void 0,iconName:t?.avatar?void 0:"balloon",dividerType:"participant",title:n}):null}},service_data:{suggestion:({event:e,...t})=>{const[n,r]=(0,aa.useState)(!0),i=ia(),a=_a(),{sendAction:o,addMessageBubble:s}=Aa(),{suggestions:c,payload:l}=(e=>{const{payload:t}=e,{body:n}=Wa(e);return{suggestions:n,payload:t}})(e),{showSuggestions:u}=Vn(),d=Jn(),{t:p}=xa(),h=p("suggestions.headingText"),f=p("suggestions.footerText"),m=(0,aa.useMemo)((()=>d.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[d]),y=(0,aa.useCallback)((({id:e,question:t})=>{r(!1),i(xr(!0)),o({type:M,originMessage:l.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),s(t)}),[i,o,l.id,s]);return n&&!a&&m&&u?(0,Da.jsxs)("div",{className:Ja("suggestions","suggestions--conversation"),children:[h&&(0,Da.jsx)("p",{className:Ja("suggestions__heading"),children:h}),(0,Da.jsxs)(lo,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,Da.jsx)(Eo,{className:"suggestions__list--conversation",onClickSuggestion:y,suggestions:c}),f&&(0,Da.jsx)("p",{className:Ja("suggestions__footer"),children:f})]})]}):null}}},vs=({children:e})=>{const{customComponents:t}=Vn(),n=(0,aa.useMemo)((()=>Object.keys(gs).reduce(((e,n)=>(e[n]={...gs[n],...t?t[n]:{}},e)),{fallback:hs})),[t]);return(0,Da.jsx)(Ua.Provider,{value:n,children:e})},bs=({children:e})=>{const{isMinimized:t}=wa(),n=(0,aa.useRef)(0),{sendAction:r}=Aa(),{hasCountdown:i,isActive:a,stopCountdown:o}=ao(),s=(0,aa.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),s=()=>{r({type:"interactivity_update"}),n.current=e};i&&a&&(s(),o()),e-n.current>15e3&&s()}),[r,i,a,o,t]);return(0,Da.jsx)("div",{className:Ja("activity-monitor"),tabIndex:-1,onMouseDown:s,onKeyUp:s,onTouchStart:s,onMouseMove:s,onWheel:s,onPointerDown:s,onPointerMove:s,children:(0,Da.jsx)(ro.Provider,{value:s,children:e})})},xs=["text","choice_prompt","image","video"],ws=()=>{const e=(()=>{const e=ka();return(0,Pa.useSyncExternalStore)(ge.subscribe,(()=>e.conversation))})(),t=(0,aa.useRef)(),n=(0,aa.useRef)(),r=ia(),i=ja(),a=(0,aa.useRef)(null),{initCountdown:o,endCountdown:s}=ao(),{emitEvent:u}=Aa();return(0,aa.useEffect)((()=>{if(e.socket){const{socket:t}=e;t.onError((e=>{const t=new Cr(e);r(Gr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(ii())})),t.onOpen((()=>{r(Wr())}))}}),[e,r]),(0,aa.useEffect)((()=>{e.socket&&e.onConnection((({currentState:e})=>{if("join_channel_erred"===e){const e=new c;return r(Gr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1}))}),[e,r]),(0,aa.useEffect)((()=>{const t=e=>{if("participant"!==e.type)return;const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:i}=t;!n&&"string"!=typeof i&&i?.name&&r(xi(i.name)),r(Ti({participant:i,fromClient:n})),"string"!=typeof i&&i.introduction&&r(ni(e))};e.onConnection((({connected:n})=>{const{channel:a}=e;return!(!n||!a||(a.onMessage=(e,n)=>{const a={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&r(Si(n.state.loading)),n.type){case"idle_detach_countdown":o(n.body.duration);break;case"idle_detach_countdown_elapsed":s(void 0,!0);break;case"resume_conversation_prompt":r(di());break;case"translation_proposal":r(Xi(n.body));break;case"user_first_response":r(xr(!0)),i.emit("system.userFirstResponse",n.body)}break;case"context":n.contentLocale&&n.userLocale&&r(Pr(n.userLocale));break;case"message":switch(t(n),n.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":n.service&&n.service.serviceSessionId&&r(mi(n.service.serviceSessionId)),r(ni(a))}break;case"participant":t(a);break;case"service_data":n.persist&&r(ki(n));break;case"ack":r(ti(a));break;case"system":if("service_changed"===n.type){const{serviceSettings:e,...t}=n,{entry:i,proactiveMessages:a}=e,{upload:o}=i.options;r(vi({key:W,enabled:!(!o||!o.enabled)})),r(Bi(a.enabled||!1)),r(Ni(i)),n.serviceSessionId&&r(mi(n.serviceSessionId)),u("system.serviceChanged",t)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||r(ni(a));break;case"error":switch(n.type){case"find_conversation_erred":const e=new l(a);r(Gr({name:e.name,action:e.action,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError}));break;case"conversation_erred":case"attach_channel_erred":const t=new c(a);r(Gr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError,action:t.action}))}}return n},1))}))}),[e,r,u,s,i,o]),(0,aa.useEffect)((()=>{e.onConnection((({connected:t})=>{const{channel:r}=e;return!(!t||!r||(n.current&&r.off("message",n.current),n.current=r.on("message",(e=>xs.includes(e.type)?(e.id!==a.current&&i.emit("message",e),a.current=e.id,e):e)),0))}))}),[e,i]),(0,aa.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.channel?.off("sync",t.current),t.current=e.channel?.on("sync",(async e=>{try{const t=await r(Hr(e)).unwrap();if(!t)return;r(Ci(t))}catch(e){}})),!0)))}),[e,r]),null},Cs=({children:e})=>{const{t}=xa(),n=ia(),r=ka(),{addUploadBubble:i}=Aa(),a=(0,aa.useCallback)((async(e,t)=>{n(Oi(t));const r=await(e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>"string"==typeof r.result?t(r.result):void 0,r.onerror=e=>n(e)})))(e),i=new Image;i.src=r,await i.decode();const a=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,i]=(e=>{const{height:t,width:n}=e;return n>t&&n>600?[600,600*t/n]:t>600?[600*n/t,600]:[n,t]})(e);return t.width=r,t.height=i,n?.drawImage(e,0,0,r,i),t.toDataURL()})(i);try{sessionStorage.setItem(`image-${t}`,a)}catch(e){}finally{n(Ri(t))}}),[n]),o=(0,aa.useCallback)((e=>{const o=m(),s=r.uploadFile(e,(e=>{n(Mi({fileId:o,progress:Math.ceil(e)}))}),(async t=>{const{id:r,transactionId:s,occurredAt:c,body:{contentType:l,filename:u,filesize:d,url:p}}=t;n(Ai(o)),i(r,s,c,l,u,d,p),await a(e,r)}),(e=>{let r;switch(e?.error||""){case"file_uploads_are_disabled":r=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":r=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":r=t("fileUpload.errors.wrongType");break;case"virus_found":r=t("fileUpload.errors.virusFound");break;default:r=t("fileUpload.errors.general")}n(Li({fileId:o,errorText:r}))}));n(pi({fileId:o,fileName:e.name,uploadHandle:s}))}),[a,i,r,n,t]);return(0,Da.jsx)(Za.Provider,{value:o,children:e})},_s=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=ao();return((e,t)=>{const n=(0,aa.useRef)(e);(0,aa.useEffect)((()=>{n.current=e}),[e]),(0,aa.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},Ss=()=>{const{initUserSelectedOptions:e}=to(),t=(0,aa.useRef)(!1),n=Vn();return(0,aa.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function Es(e,t,n=[]){const r=ja(),i=(0,aa.useRef)(t);(0,aa.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>i.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const Ts=()=>{const e=Vn(),{sendMessage:t,sendContext:n,sendAction:r}=Aa(),i=ia(),{setVisibility:a,visible:o}=wa(),s=(0,aa.useRef)(o),c=ja(),l=ka(),u=Yn(),d=(0,aa.useRef)(null),h=(0,aa.useRef)(null),{isInline:f,isResolving:m}=rr(),y=Mn(Oa),g=(()=>{const{get:e}=Na();return e?e("conversationUrl"):null})(),v=(0,aa.useRef)(null),b=io(),{enableTranslations:x,disableTranslations:w}=Ga();return(0,aa.useEffect)((()=>{s.current=o}),[o]),Es("askText",(e=>{t({body:e})}),[l.send]),Es("setVariables",(e=>{n({variables:e})}),[l.send]),Es("getVisibility",(e=>{e?e(s.current):console.warn("A callback function is required for the getVisibility action.")})),Es("setVisibility",(e=>{Object.values(vn).includes(e)?(b(),a(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),Es("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Es("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&i(mr({showSuggestions:!1})),e&&t?r({type:z,body:{name:e,fallbackMessage:t,participant:n?p:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),Es("setContext",(e=>{n(e)}),[l.send]),Es("setTranslation",(({enabled:e,locale:t})=>{e?x(t,H):w()}),[l.send]),(0,aa.useEffect)((()=>{m||y||(v.current&&v.current!==g&&c.emit("unreadMessageCount",u),o===vn.open&&o!==h.current&&0!==d.current&&c.emit("unreadMessageCount",0),o!==vn.open&&u!==d.current&&c.emit("unreadMessageCount",u),h.current=o,d.current=u,"string"==typeof g&&(v.current=g))}),[u,o,c,f,m,y,g]),null},js=({children:e})=>{const t=ja(),n=(0,aa.useRef)(null),[r,i]=(0,aa.useState)(),a=(0,aa.useRef)(!0),o=(0,aa.useCallback)((e=>{a.current&&(i(e),t.emit("aria-live",e))}),[i,t]);return(0,aa.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{o({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,o]),(0,aa.useEffect)((()=>()=>{a.current=!1}),[]),(0,Da.jsxs)(Ta.Provider,{value:o,children:[e,(0,Da.jsxs)("div",{className:Ja("app__live-container"),children:[(0,Da.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Ja("visually-hidden"),children:r?.ariaLive===$?r?.messageText:null}),(0,Da.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Ja("visually-hidden"),children:r?.ariaLive===V?r?.messageText:null})]})]})},ks=()=>{const{t:e}=xa(),t=Jn(),n=(0,aa.useRef)(0),r=(0,aa.useRef)(0),i=Wn().historyLoaded,{sendPolite:a}=La(),{isOpen:o}=wa(),s=(0,aa.useRef)(null),c=(0,aa.useRef)(null),l=(0,aa.useMemo)((()=>g((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(a(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[a,e]);return(0,aa.useEffect)((()=>{t.length>n.current&&(o&&(c.current=l(t)),n.current=t.length)}),[t,l,o]),(0,aa.useEffect)((()=>{s.current&&!o&&c.current&&(c.current(!0),c.current=null)}),[o]),(0,aa.useEffect)((()=>{i&&setTimeout((()=>{a(e("window.srTexts.onHistoryLoad"))}),500)}),[i,e,a]),null},Ns=()=>{const{t:e}=xa(),{isOpen:t,isVisible:n}=wa(),r=Yn(),{sendPolite:i}=La(),a=(0,aa.useMemo)((()=>g(i,2e3)),[i]),o=(0,aa.useRef)(null),s=(0,aa.useRef)(null);return(0,aa.useEffect)((()=>{o.current!==n&&!n&&s.current&&s.current(),0!==r&&!t&&n&&(s.current=a(e("message.srTextUnreadCount",{unreadCount:r}))),o.current=n}),[r,t,n,a,e]),null},Is=({store:e,children:t,eventBus:n,api:r})=>((0,aa.useErrorBoundary)((t=>{console.error(t),e.dispatch(Sr(t))})),(0,Da.jsx)(zn,{store:e,children:(0,Da.jsx)(Ea.Provider,{value:n,children:(0,Da.jsx)(Sa.Provider,{value:r,children:(0,Da.jsx)(js,{children:(0,Da.jsx)(za,{children:(0,Da.jsxs)(vs,{children:[(0,Da.jsx)(Ss,{}),(0,Da.jsx)(ws,{}),(0,Da.jsx)(Ns,{}),(0,Da.jsx)(ks,{}),(0,Da.jsx)(_s,{}),(0,Da.jsxs)(bs,{children:[(0,Da.jsx)(Ts,{}),(0,Da.jsx)(Cs,{children:t})]})]})})})})})})),As=bt(Kn,(e=>e.filter((e=>Jr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===A)))),Ls=bt([As],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),Ms=bt(As,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),Os=bt((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),Rs=()=>{const{t:e}=xa(),{showDisclaimer:t}=Vn();return t?(0,Da.jsxs)("div",{className:Ja("disclaimer"),tabIndex:0,children:[(0,Da.jsx)("h2",{className:Ja("disclaimer__title"),children:e("disclaimer.title")}),(0,Da.jsx)("div",{className:Ja("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},Ps=bt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),Ds=bt(Ps,(e=>e?.controls||{})),zs=bt(Ds,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Us=bt([Ds,(e,{name:t})=>t],((e,t)=>e[t]?.value)),Fs=bt([Ds,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),Bs=(0,i.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:Hs,Consumer:$s}=Bs,Vs=Bs;function Gs(){return(0,aa.useContext)(Vs)}function Ws(e){const t=ia(),{formId:n,updateControlValue:r,updateControlTouched:i,errors:a}=Gs(),o=!!Mn((e=>Ps(e,{formId:n}))),s=Mn((t=>Us(t,{formId:n,name:e}))),c=Mn((t=>Fs(t,{formId:n,name:e}))),l=a?.[e],u=!l;(0,aa.useEffect)((()=>{o&&t(Ar({formId:n,name:e}))}),[o,n,e,t]),(0,aa.useLayoutEffect)((()=>()=>{t(Lr({formId:n,name:e}))}),[o,n,e,t]);const d=(0,aa.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,aa.useCallback)((()=>{i(e,!0)}),[i,e]);return[(0,aa.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:s})),[e,d,p,s]),(0,aa.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function qs(e){const{t}=xa(),{sendAssertive:n}=La(),{hasLimit:r,limit:i}=nr(),a=(0,aa.useMemo)((()=>g(n,f)),[n]),o=(0,aa.useMemo)((()=>g(((e,n)=>{e&&a(t("input.srCharacterLimitText",{limit:n}))}),f)),[a,t]),[{value:s}]=Ws(e),c=i&&r&&s?i-s.length:i,l=!(!r||!c)&&c<=h,u=!(!r||!c)&&c<0;return(0,aa.useEffect)((()=>{o(l,c)}),[l,c,o]),{hasCharacterLimit:r,characterLimit:i,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Ks=e=>{const{hasCharacterLimit:t,characterLimit:n}=qs(e),{entryMeta:{optionsOverride:{text:r}}}=Wn(),{t:i}=xa();return{placeholder:(0,aa.useMemo)((()=>i("input.inputPlaceholder",{hasLimit:t,text:r?.placeholder||i("input.inputPlaceholderText"),limit:t?n:null})),[i,t,n,r?.placeholder]),label:(0,aa.useMemo)((()=>i("input.inputLabel",{hasLimit:!r?.label&&t,text:r?.label||i("input.inputLabelText"),limit:!r?.label&&t?n:null})),[i,t,n,r?.label]),labelClass:(0,aa.useMemo)((()=>r?.label?"label":"visually-hidden"),[r?.label])}};function Js(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=ia(),{entryMeta:{actions:t,translatedActions:n}}=Wn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(Ii())}}})(),n=ka();return e?(0,Da.jsx)("li",{className:Ja(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,Da.jsx)("button",{className:Ja(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:z,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const Xs=(0,i.createContext)(null),Ys=()=>{const e=(0,aa.useContext)(Xs);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},Zs=Xs,Qs=e=>{const t=(()=>{const e=(0,aa.useContext)(Ua);if(!e)throw new Error("useComponentContext has to be used within <ComponentContext.Provider>");return e})(),n=t[e.type];let r=n[e.payload.type],i=null;return"choice_prompt"===e.payload.type&&(i=n[e.payload.body.prompt.type]),"participant"===e.type&&(r=n[e.type]),r&&"function"!=typeof r&&(r=r[e.payload.body.type]),[r||t?.fallback,i]},ec=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=Ys(),{sendAction:i}=Aa(),a=e.payload.id?n[e.payload.id]:void 0,{containerRef:o,isVisible:s}=Ca({containerRef:a,freezeOnceVisible:!0}),c=ia(),[l,u]=Qs(e);if((0,Pa.useEffect)((()=>{if(s&&r?.includes(e.payload.id)){const t=r.reduce(((t,n)=>e?.payload?.id&&n&&!t.includes(e.payload.id)?t.concat(n):t),[]);c(gi(t)),i({type:R,events:t})}}),[c,e.payload.id,s,i,r]),!l)return null;const d=["conversation__item"];return"info"===e.type?d.push("conversation__item--source-info"):e.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),t&&d.push("conversation__item--new-participant"),(0,Da.jsxs)("li",{className:Ja(d),ref:o,children:[e.payload.timeIndicator&&(0,Da.jsx)(Lo,{event:e}),(0,Da.jsx)(l,{event:e,children:(0,Da.jsx)(u,{event:e})})]})},tc=()=>{const{id:e}=tr()||{};return(0,Da.jsx)("li",{className:Ja("conversation__item","conversation__item--source-agent"),children:(0,Da.jsxs)("div",{className:Ja("message","message--source-agent","message--type-loading"),children:[(0,Da.jsx)(co,{eventPayload:{fromClient:!1,participant:e}}),(0,Da.jsx)("div",{className:Ja("message__body"),children:(0,Da.jsxs)("span",{className:Ja("loader"),children:[(0,Da.jsx)("span",{className:Ja("loader__part","one")}),(0,Da.jsx)("span",{className:Ja("loader__part","two")}),(0,Da.jsx)("span",{className:Ja("loader__part","three")}),(0,Da.jsx)("span",{className:Ja("loader__part","four")})]})})]})})},nc=()=>{const e=Jn();let t;return(0,Da.jsx)(Da.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let i=!1;if("participant"!==n&&"service_data"!==n){const{participant:n,fromClient:a}=r,o=a?"seamly-client-participant":n;"info"!==e.type&&t!==o&&(i=!0),t=o}return(0,Da.jsx)(ec,{event:e,newParticipant:i},e.payload.key||e.payload.id)}))})},rc=()=>{const{t:e}=xa(),t=Xn(),n=((e,t=20)=>{const[n,r]=(0,aa.useState)(e),i=(0,aa.useRef)(null);return(0,aa.useEffect)((()=>(i.current=setTimeout((()=>r(e)),t),()=>{i.current&&clearTimeout(i.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=wa(),i=Zn(),a=$a();return(0,Da.jsxs)(Da.Fragment,{children:[r&&(0,Da.jsx)("a",{className:Ja("skip-link"),href:`#${i}`,onClick:e=>{e.preventDefault(),a()},children:e("skiplinkText")}),(0,Da.jsx)("div",{className:Ja("chat__body"),children:(0,Da.jsxs)("div",{className:Ja("conversation__container"),children:[(0,Da.jsx)(Rs,{}),(0,Da.jsxs)("ol",{className:Ja("conversation"),children:[(0,Da.jsx)(vs,{children:(0,Da.jsx)(nc,{})}),n?(0,Da.jsx)(tc,{}):null,(0,Da.jsx)(Js,{})]})]})})]})};function ic(e,t){const n=(0,aa.useRef)(null),r=(0,aa.useRef)(e);return(0,aa.useEffect)((()=>{r.current=e}),[e]),(0,aa.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const ac={visible:Ja("transition--visible"),in:Ja("transition--in"),visuallyHidden:Ja("visually-hidden")},oc=Object.values(ac),sc=e=>{const t=(0,aa.useRef)(null);t.current=e;const n="function"==typeof e;return(0,aa.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},cc={notRendered:"notRendered",rendered:"rendered",visuallyHidden:"visuallyHidden"},lc=({children:e,isActive:t,timeout:n=300,transitionStartState:r=cc.notRendered,onInTransitionComplete:a=(()=>{}),onOutTransitionComplete:o=(()=>{}),exitAfter:s,enterDelay:c=0})=>{const l=(0,aa.useRef)(!1),u=(0,aa.useRef)(null),d=(0,aa.useRef)(null),p=r===cc.visuallyHidden,[h,f]=(0,aa.useState)((()=>p?[ac.visuallyHidden]:[])),[m,y]=(0,aa.useState)((()=>0===c)),g=(0,aa.useMemo)((()=>s?s+c:s),[c,s]);ic((()=>y(!1)),t?g:void 0),ic((()=>y(!0)),t?c:void 0);const v=(0,aa.useMemo)((()=>m&&t),[t,m]),b=sc(a),x=sc(o),w="notRendered"!==r||h.length>0;return(0,aa.useEffect)((()=>(l.current&&!v&&(f([ac.visible]),u.current=setTimeout((()=>{f([...p?[ac.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&v&&(f([ac.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{f([ac.visible,ac.in]),b&&(u.current=setTimeout((()=>{b()}),n))}))}))),l.current=v,()=>{u.current&&clearTimeout(u.current),d.current&&cancelAnimationFrame(d.current)})),[p,b,x,n,v]),(0,Da.jsx)(Da.Fragment,{children:w&&(0,i.toChildArray)(e).filter(T).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!oc.includes(e)));return(0,i.cloneElement)(e,{className:[...n,...h].join(" ")})}))})},uc=({isAside:e=!1})=>{const{isInline:t}=rr(),{t:n}=xa(),{sendAction:r,addMessageBubble:i}=Aa(),{isOpen:a,setVisibility:o}=wa(),{showSuggestions:s}=Vn(),c=so(),l=$a(),u=(0,aa.useRef)(null),{sendPolite:d}=La(),p=Mn(Oa),{hasCountdown:h,endCountdown:f}=ao(),{hasPrompt:m,continueChat:y}=oo(),g=_a(),v=Wn().serviceData.suggestion;const{body:b}=Wa({payload:v,type:"service_data"}),x=(0,aa.useMemo)((()=>p?[]:Array.isArray(b)?b:b?.data),[b,p]),w=(0,aa.useRef)(),C=(0,aa.useRef)(!1),_=(0,aa.useRef)(),S=!!x?.length,T=t?(g||a)&&!e:g,j=(0,aa.useRef)(T),k=S&&!T&&s,N=S?x:_.current;_.current=N;const I=(0,aa.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Ja(t)}),[e]),A=(0,aa.useCallback)((({id:e,question:t})=>{h&&f(!0),m&&y(),r({type:M,originMessage:v.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),i(t),a||o(vn.open),l()}),[i,y,f,l,h,m,v,r,o,a]);(0,aa.useEffect)((()=>{if(w.current!==x&&!T){if(S){const e=C.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{d(e)}),30)}else C.current&&d(n("suggestions.srUnavailableText"));w.current=x}!j.current&&T?(E(u.current,l),d(n("suggestions.srUnavailableText"))):!S&&C.current&&E(u.current,l),C.current=S,j.current=T}),[x,S,T,l,d,n]);const L=n("suggestions.headingText"),O=n("suggestions.footerText"),R=L?"section":"div";return(0,Da.jsx)(lc,{isActive:!!k,transitionStartState:cc.notRendered,children:(0,Da.jsxs)(R,{className:I,"aria-labelledby":L?c:void 0,ref:u,children:[L&&(0,Da.jsx)("p",{id:c,className:Ja("suggestions__heading"),children:L}),!!N&&(0,Da.jsx)(Eo,{suggestions:N,onClickSuggestion:A}),O&&!a&&(0,Da.jsx)("p",{className:Ja("suggestions__footer"),children:O})]})})},dc=(0,Pa.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:i,setVisibility:a}=wa(),{namespace:o,layoutMode:s}=Vn(),{isInline:c}=rr(),l=Xa(),u=_a(),{t:d}=xa(),p=["chat",`chat--layout-${s}`,`namespace--${o}`,t];return"function"!=typeof l&&p.push(...l),r||"app"===s||p.push("chat--collapsed"),u&&p.push("chat--user-responded"),i&&(0,Da.jsxs)("section",{className:Ja(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&a(vn.minimized)},tabIndex:-1,ref:n,"aria-label":d("chat.srLabel"),children:[(0,Da.jsx)("div",{className:Ja("chat-wrapper"),children:e}),"inline"===s&&r&&(0,Da.jsx)(uc,{isAside:!0})]})})),pc=dc,hc=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:i,id:a})=>{const o=so();return(0,Da.jsxs)("section",{tabIndex:-1,id:a,"aria-labelledby":n?o:void 0,className:Ja("chat-status",n?void 0:"chat-status--condensed"),children:[(0,Da.jsxs)("div",{className:Ja("chat-status__body"),children:[n?(0,Da.jsx)("h2",{className:Ja("chat-status__title"),id:o,children:n}):null,e]}),"function"==typeof t&&(0,Da.jsxs)("button",{type:"button",onClick:t,className:Ja("button","button--tertiary","chat-status__close"),children:[r||(0,Da.jsx)(fo,{name:"close",size:"16",alt:""}),i&&(0,Da.jsx)("span",{className:Ja("visually-hidden"),children:i})]})]})},fc=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,Da.jsxs)("button",{type:"button",onClick:e,className:Ja("button","button--primary","chat-status__button"),children:[(0,Da.jsx)(fo,{name:t,size:"16",alt:""}),n,r&&(0,Da.jsx)("span",{className:Ja("visually-hidden"),children:r})]});function mc(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=Ka(),{id:i}=function(){const e=Mn((({translations:e})=>e.containerId));return{id:e,focusContainer:Ha(e)}}();return e&&t?(0,Da.jsx)(hc,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:i,title:t.titleLabel,children:(0,Da.jsx)(fc,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function yc(){const e=Mn(Oa),{isActive:t}=Ga();return e||t?null:(0,Da.jsx)(mc,{})}const gc=({label:e,checked:t,description:n,onChange:r,id:i,itemClassName:a})=>(0,Da.jsxs)("li",{className:Ja([a||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:i,children:[(0,Da.jsx)(fo,{name:"check",size:"16",alt:""}),e," ",n&&(0,Da.jsxs)("span",{children:["(",n,")"]})]}),vc=({onChange:e,describedById:t})=>{const{context:n}=Vn(),r=(0,Pa.useMemo)((()=>n?.contentLocale),[n?.contentLocale]),{t:i}=xa(),{languages:a,currentLocale:o,enableTranslations:s,disableTranslations:c}=Ga(),l=$a(),u=t=>()=>{t===o||r===t?c():s(t,"translation_choice"),e(),l()},{primaryLanguages:d,remainingLanguages:p}=(0,Pa.useMemo)((()=>a.reduce(((e,t)=>{const n=t.locale===r,i=((e,t,n)=>t===e.locale||!t&&n)(t,o,n);t.locale!==r&&e.remainingLanguages.push({...t,checked:i,isOriginal:n});const a=e.remainingLanguages.findIndex((e=>e.locale===o));return(n||i&&a>4)&&e.primaryLanguages.push({...t,checked:i,isOriginal:n}),e}),{primaryLanguages:[],remainingLanguages:[]})),[o,r,a]);return(0,Da.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Ja("translation-options"),children:[d.map((({locale:e,nativeName:t,checked:n,isOriginal:r},a)=>(0,Da.jsx)(gc,{id:e,label:t,checked:n,description:r?i("translations.settings.original"):void 0,onChange:u(e),itemClassName:Ja({"translation-options__item--original":r,"translation-options__item--selected":n&&0!==a})},e))),p.map((({locale:e,nativeName:t,checked:n,isOriginal:r})=>(0,Da.jsx)(gc,{id:e,label:t,checked:n,description:r?i("translations.settings.original"):void 0,onChange:u(e)},e)))]})},bc=({className:e,children:t,onCancel:n,headingText:r,description:i,descriptionId:a,cancelButtonText:o,cancelButtonRef:s,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=so(),{hideOption:d}=to(),{focusButton:p}=no(),h=(0,aa.useCallback)((()=>{d(),c||p()}),[c,p,d]),f=(0,aa.useCallback)((()=>{n&&n(),h()}),[h,n]),m=(e=>{const t=(0,aa.useRef)(null);return(0,aa.useEffect)((()=>{const n=n=>{t.current&&n.target instanceof HTMLElement&&!t.current.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),e())};return document.addEventListener("click",n,!0),document.addEventListener("touchstart",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("touchstart",n,!0)}}),[e,t]),t})(f);return(0,aa.useEffect)((()=>{S(m.current)}),[m]),(0,Da.jsx)("section",{className:Ja("options",{"options--right":"right"===l.horizontal,"options--left":"left"===l.horizontal,"options--top":"top"===l.vertical,"options--bottom":"bottom"===l.vertical},e||""),"aria-labelledby":u,tabIndex:-1,ref:m,children:(0,Da.jsxs)("div",{className:Ja("options__body"),children:[(0,Da.jsx)("h2",{id:u,className:Ja("options__title"),children:r}),(0,Da.jsxs)("button",{type:"button",onClick:f,"aria-describedby":u,className:Ja("button","options__close"),ref:e=>{s&&(s.current=e)},children:[(0,Da.jsx)(fo,{name:"close",size:"16",alt:""}),(0,Da.jsx)("span",{children:o})]}),i?(0,Da.jsx)("p",{className:Ja("options__description"),id:a,children:i}):null,(0,Da.jsx)("div",{className:Ja("options__wrapper"),children:t})]})})},xc=function({onClose:e,position:t}){const{t:n}=xa(),r=so();return(0,Da.jsx)(bc,{onCancel:e,headingText:n("translations.menu.title"),cancelButtonText:n("translations.settings.cancelButtonText"),description:n("translations.menu.description"),descriptionId:r,position:t,disableButtonFocusing:!0,children:(0,Da.jsx)(vc,{describedById:r,onChange:e})})};function wc({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,i]=(0,aa.useState)(!1),a=(0,aa.useRef)(null),o=so();return(0,Da.jsxs)("div",{className:Ja("translations__container"),onKeyDown:e=>{r&&_(e)===C.Escape&&(i(!1),S(a.current))},children:[(0,Da.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Da.jsx)("div",{className:Ja("options__dialog"),role:"dialog",children:(0,Da.jsx)(xc,{onClose:()=>{i(!1)},position:t})})}),(0,Da.jsx)("button",{type:"button",className:Ja(["button","chat__options__button",...n]),id:o,onClick:()=>{i(!r)},onKeyDown:e=>{_(e)===C.ArrowDown&&(i(!0),e.preventDefault())},ref:a,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const Cc=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:i,validationSchema:a={},...o})=>{const s=ia(),c=Mn((e=>zs(e,{formId:t}))),[l,u]=(0,aa.useState)(!1),[d,p]=(0,aa.useState)({}),{isValid:h,errors:f}=function(e,t){const n=(0,aa.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const i=Array.isArray(r)?r:[r];for(let r=0;r<i?.length;r++)if(!i[r].fn(e[n],i[r].compareValue)){t[n]=i[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,a),m=(0,aa.useMemo)((()=>({...f,...d})),[f,d]);(0,aa.useLayoutEffect)((()=>{s(Nr({formId:t,persistData:n}))}),[t,n,s]),(0,aa.useEffect)((()=>()=>{s(Ir({formId:t}))}),[t,n,s]);const y=(0,aa.useCallback)(((e,n)=>{s(Mr({formId:t,name:e,value:n}))}),[t,s]),g=(0,aa.useCallback)(((e,n)=>{s(Or({formId:t,name:e,touched:n}))}),[s,t]),v=(0,aa.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,aa.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&h&&(s(xr(!0)),i(c,{updateControlValue:y,setError:v}))}),[h,s,i,c,y,v]);(0,aa.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,aa.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:a,updateControlValue:y,updateControlTouched:g})),[t,c,m,l,b,a,y,g]);return t?i?(0,Da.jsx)(Hs,{...o,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},_c=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),Sc=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},Ec=e=>!!e?.length,Tc=e=>{const t=e&&e.trim();return!(!t||!t.match(/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i))},jc=e=>!!e,kc=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:i,isSubmitted:a}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Gs();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),o=["form"];return!t&&a&&(o.push("form--submitted"),i?o.push("form--valid"):o.push("form--invalid")),(0,Da.jsx)("form",{onSubmit:r,className:Ja([...o,e]),...n})};function Nc({id:e,error:t}){const[n,r]=(0,aa.useState)(!1);return(0,aa.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,Da.jsx)("div",{className:Ja("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,Da.jsxs)("span",{id:e,className:Ja("error__message"),children:[(0,Da.jsx)(fo,{name:"error",size:"16",alt:""}),t]})})}const Ic=({contentHint:e,id:t,labelText:n,labelClass:r,validity:i,errorText:a,children:o})=>(0,Da.jsxs)(Da.Fragment,{children:[e&&(0,Da.jsx)("span",{id:`${t}-content-hint`,className:Ja("input__content-hint"),children:e}),(0,Da.jsx)(Nc,{id:`${t}-error`,error:!i&&a}),(0,Da.jsxs)("div",{className:Ja("form-control__wrapper"),children:[(0,Da.jsx)("label",{htmlFor:t,className:Ja(r),children:n}),o]})]}),Ac=function({id:e,name:t,type:n,labelText:r,labelClass:i,contentHint:a=null,"aria-invalid":o,"aria-describedby":s,...c}){const{isSubmitted:l}=Gs(),[u,{error:d}]=Ws(t),p=l&&d,h=[];return s&&h.push(s),a&&h.push(`${e}-content-hint`),p&&h.push(`${e}-error`),(0,Da.jsx)(Ic,{id:e,contentHint:a,validity:!p,errorText:d,labelText:r,labelClass:i,children:(0,Da.jsx)("input",{...u,...c,id:e,type:n,"aria-invalid":o||p?"true":"false","aria-describedby":h.join(" ")||void 0,name:t})})};function Lc({controlName:e,describedById:t}){const{t:n}=xa();return(0,Da.jsxs)(kc,{noValidate:"true",className:Ja("options__form"),children:[(0,Da.jsx)(Ac,{id:"email-id",name:e,type:"email",className:Ja("transcript__input"),"aria-describedby":t,labelClass:Ja("label"),labelText:n("options.sendTranscript.label")}),(0,Da.jsx)("div",{className:Ja("options__actions"),children:(0,Da.jsx)("button",{type:"submit",className:Ja("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const Mc="email",Oc={sendTranscript:()=>{const[e,t]=(0,aa.useState)(void 0),{hideOption:n}=to(),{focusButton:r}=no(),{t:i}=xa(),a=so(),{sendAction:o}=Aa(),s=(0,aa.useMemo)((()=>({[Mc]:[_c(jc,i("options.sendTranscript.noEmailText")),_c(Tc,i("options.sendTranscript.invalidEmailText"))]})),[i]),c=(0,aa.useCallback)((e=>{const t=e[Mc].trim();o({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[o,n,r]),l=(0,aa.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,Da.jsx)(bc,{className:e,headingText:i("options.sendTranscript.title"),cancelButtonText:i("options.cancelButtonText"),description:i("options.sendTranscript.description"),descriptionId:a,position:{vertical:"top",horizontal:"right"},children:(0,Da.jsx)(Cc,{formId:"sendTranscript",onSubmit:c,validationSchema:s,onError:l,children:(0,Da.jsx)(Lc,{controlName:Mc,describedById:a})})})}},Rc=()=>{const{optionActive:e}=to(),t=(0,aa.useRef)(),n=Oc[t.current??e];return e&&(t.current=e),n?(0,Da.jsx)(n,{}):null},Pc=()=>{const{t:e}=xa(),{menuOptions:t,showOption:n,panelActive:r,hideOption:i}=to(),{id:a}=no(),o=(0,aa.useRef)(null),[s,c]=(0,aa.useState)(!1),l=(0,aa.useRef)(null),u=t.length,d=(0,aa.useRef)([]),p=(0,aa.useRef)(!1),h=u>1,f=t[0],m=(0,aa.useMemo)((()=>f?.name?.trim().replace(/\s+/g,"")),[f]);return(0,aa.useEffect)((()=>()=>{o.current&&clearTimeout(o.current)}),[]),(0,aa.useEffect)((()=>{s&&!p.current&&requestAnimationFrame((async()=>{await Fa(60);const e=t.findIndex((e=>e.available)),n=-1===e?0:e;d.current&&S(d.current[n])})),p.current=s}),[s,t]),u?(0,Da.jsxs)("div",{className:Ja("options__container"),onKeyDown:e=>{s&&(_(e)===C.Escape&&(c(!1),S(l.current)),_(e)===C.Home&&(d.current&&S(d.current[0]),e.preventDefault()),_(e)===C.End&&(d.current&&S(d.current[u-1]),e.preventDefault()))},onFocusOut:()=>{h&&(o.current=setTimeout((()=>{c(!1)}),200))},onFocusIn:()=>{o.current&&clearTimeout(o.current)},children:[(0,Da.jsx)(lc,{transitionStartState:cc.notRendered,isActive:r,children:(0,Da.jsx)("div",{className:Ja("options__dialog"),children:(0,Da.jsx)(Rc,{})})}),h&&(0,Da.jsx)(lc,{isActive:s,transitionStartState:cc.notRendered,children:(0,Da.jsx)("ul",{className:Ja(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":a,children:t.map((({name:r,title:i,available:a},o)=>(0,Da.jsx)("li",{className:Ja("options__menu__item"),role:"menuitem","data-testid":r,children:(0,Da.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[o]=e)},className:Ja(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(_(e)===C.ArrowDown){const n=Math.min(u-1,t+1);d.current&&S(d.current[t===n?0:n]),e.preventDefault()}if(_(e)===C.ArrowUp){const n=Math.max(0,t-1);d.current&&S(d.current[t===n?u-1:n]),e.preventDefault()}})(e,o),onKeyPress:e=>((e,n)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let i=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===i&&(i=t)})),-1!==i&&d.current&&S(d.current[i])})(e,o),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,a),"aria-disabled":!a,children:[(0,Da.jsxs)("span",{className:Ja("button__text"),children:[i,!a&&" "]}),a?null:(0,Da.jsx)("span",{className:Ja("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,Da.jsxs)("button",{type:"button",className:Ja(["button","button--secondary","chat__options__button",...!h&&m?[`chat__options__button--${m}`]:[]]),id:a,onClick:()=>{r&&i(),h?c((e=>!e)):f.available&&!r&&n(f.name)},onKeyDown:h?e=>{_(e)===C.ArrowDown&&(c(!0),e.preventDefault())}:void 0,ref:l,"aria-haspopup":!!h&&"menu","aria-expanded":!!h&&s,"aria-disabled":!h&&!f.available,children:[h?(0,Da.jsx)(fo,{name:"options",size:"32",alt:""}):null,(0,Da.jsx)("span",{className:Ja("button__text"),children:h?e("options.openButtonText"):`${f.title}${f.available?"":" "}`}),h||f.available?null:(0,Da.jsx)("span",{className:Ja("button__state"),children:e("options.unavailableText")})]})]}):null};function Dc(){const{menuOptions:e,allowOptionSelection:t}=to(),{isAvailable:n}=Ga(),r=Mn(Oa),{t:i,userLocale:a}=xa(),o=qa(a);if(!n&&(!t||!e.length)||r)return null;const s=i("translations.settings.openButtonText",{hasLanguage:!!o,language:o});return(0,Da.jsxs)("div",{className:Ja("chat__options"),children:[n&&(0,Da.jsx)("div",{className:Ja("chat__options-item","chat__options-item--left"),children:(0,Da.jsxs)(wc,{classNames:["button--secondary"],children:[(0,Da.jsx)(fo,{alt:s,name:"newTranslation",size:"16"}),(0,Da.jsx)("span",{className:Ja("button__text"),children:s})]})}),t&&(0,Da.jsx)("div",{className:Ja("chat__options-item","chat__options-item--right"),children:(0,Da.jsx)(Pc,{})})]})}const zc=()=>{const{scrollToRef:e,unreadIds:t}=Ys(),{isMinimized:n}=wa(),{t:r}=xa();return(0,Da.jsx)(lc,{isActive:!!t.length&&!n,children:(0,Da.jsx)("div",{className:Ja("unread-messages"),children:(0,Da.jsxs)("button",{type:"button",className:Ja("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,Da.jsx)(fo,{name:"chevronDown",size:"32",alt:""})]})})})},Uc=({children:e})=>{const t=Jn(),n=(0,aa.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,i.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:a,containerRef:o,unreadIds:s}=(e=>{const t=(0,aa.useRef)(null),[n,r]=(0,aa.useState)(!0),i=Mn(Ms),a=Jn(),o=Xn(),{isOpen:s}=wa(),c=Wn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=Mn((({state:e})=>e));(0,aa.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:i}=e,a=Math.abs(t-n-i)>10;r(!a)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,aa.useCallback)((()=>{requestAnimationFrame((async()=>{await Fa(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,aa.useEffect)((()=>{u&&d()}),[u,d]),(0,aa.useEffect)((()=>{n&&d()}),[n,i,a,o,s,c,l,d]),{containerRef:t,unreadIds:i,scrollToRef:()=>{const n=i.at(0);if(void 0!==n){const r=e[n]?.current;t.current?.scrollTo({top:r?.offsetTop,behavior:"auto",left:0})}},scrollToBottom:d}})(n);return(0,Da.jsx)(Zs.Provider,{value:{eventRefs:n,unreadIds:s,scrollToRef:r,scrollToBottom:a,containerRef:o},children:(0,Da.jsxs)("div",{className:Ja("chat__container"),children:[(0,Da.jsx)("div",{className:Ja("chat__container__scroll-area"),ref:o,children:e}),(0,Da.jsx)(zc,{})]})})},Fc=({baseClassName:e,children:t,title:n})=>{const r=Zn(),i=so();return(0,Da.jsxs)("section",{id:r,className:Ja(e),"aria-describedby":i,tabIndex:-1,children:[(0,Da.jsx)("h2",{className:Ja(`${e}__title`),id:i,children:n}),t]})},Bc=()=>{const{t:e}=xa(),t=$a(),n=io(),{emitEvent:r}=Aa(),{isActive:i,remaining:a,timer:o,endCountdown:s}=ao(),c=!!a&&a>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,Da.jsx)(Fc,{baseClassName:"idle",title:l,children:c&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("div",{className:Ja("idle__count-container"),children:i&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("span",{className:Ja("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,Da.jsx)("span",{className:Ja("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",o)})]})}),(0,Da.jsxs)("div",{className:Ja("idle__options"),children:[(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{n(),s(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{s(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},Hc=()=>{const{t:e}=xa(),t=io(),{name:n}=tr()||{},{continueChat:r,restartChat:i}=oo();return(0,Da.jsx)(Fc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,Da.jsxs)("div",{className:Ja("prompt__options"),children:[(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:i,children:e("resumeConversationPrompt.detachButton")})]})})},$c=()=>{const{sendAction:e}=Aa(),{features:t}=to(),{typingPeekahead:n}=t||{},r=(0,aa.useRef)(null),i=(0,aa.useRef)(null),a=(0,aa.useRef)(!1),o=(0,aa.useRef)(null);(0,aa.useEffect)((()=>()=>{o.current&&clearInterval(o.current),r.current&&clearTimeout(r.current),i.current&&clearTimeout(i.current)}),[]);const s=(t,r)=>{e({type:O,state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(a.current=!0,o.current||(s(!0,e.target.value),o.current=setInterval((()=>{!a.current&&o.current?(clearInterval(o.current),o.current=null):n&&n.enabled&&s(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),i.current&&clearTimeout(i.current),r.current=setTimeout((()=>{a.current=!1}),300),i.current=setTimeout((()=>{s(!1,e.target.value)}),2e3))}},Vc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:i}=Wn().entryMeta,a=ia(),o=n||t||e,s=i[o]||r[o]||{},c=(0,aa.useCallback)((e=>{a(yi(e))}),[a]),l=(0,aa.useCallback)((e=>{a(fi(e))}),[a]),u=(0,aa.useCallback)((e=>{a(Pi(e))}),[a]),d=(0,aa.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:o,activeEntryOptions:s,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Gc({controlName:e,skipLinkId:t}){const{t:n}=xa(),{sendAssertive:r}=La(),{emitEvent:i}=Aa(),a=$c(),{setBlockAutoEntrySwitch:o}=Vc(),{placeholder:s,label:c,labelClass:l}=Ks(e),{hasCharacterLimit:u,reachedCharacterWarning:d,reachedCharacterLimit:p,remainingChars:h}=qs(e),[{value:f}]=Ws(e),m=!!f,y=(0,aa.useCallback)((()=>{d&&r(n("input.srCharacterLimitText",{limit:h})),i("ui.inputFocus")}),[n,r,d,h,i]);return(0,aa.useLayoutEffect)((()=>(o(m),()=>{o(!1)})),[o,m]),(0,Da.jsxs)(kc,{className:Ja("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,Da.jsxs)("div",{className:Ja(["input--text__container",...d&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,Da.jsx)(Ac,{id:t,type:"text",name:e,className:Ja("input__text"),autocomplete:"off",placeholder:s,labelText:c,labelClass:Ja(l),"aria-invalid":!!u&&p,onKeyUp:a,onFocus:y}),(0,Da.jsx)("div",{className:Ja("character-count"),children:d&&(0,Da.jsx)("span",{children:h})})]}),(0,Da.jsx)("button",{className:Ja("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!m||p,children:(0,Da.jsx)(fo,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const Wc="textMessageEntry";function qc({...e}){const{isOpen:t,setVisibility:n}=wa(),r=Zn(),i=$a(),{sendMessage:a}=Aa(),o=(0,aa.useCallback)(((e,{updateControlValue:r})=>{a({body:e[Wc]}),r(Wc,""),i(),t||n(vn.open)}),[a,i,t,n]);return(0,Da.jsx)(Cc,{...e,formId:"textEntry",persistData:!0,onSubmit:o,children:(0,Da.jsx)(Gc,{controlName:Wc,skipLinkId:r})})}const Kc=()=>{const{t:e}=xa(),{currentUploads:t}=eo();return(0,Da.jsx)("div",{className:Ja("progress"),children:t.map((({id:t,name:n,progress:r,uploading:i,error:a})=>(0,Da.jsxs)("div",{className:Ja("progress_container"),children:[(0,Da.jsxs)("div",{className:Ja("progress__text"),children:[(0,Da.jsx)("span",{className:Ja("progress__text--file-name"),children:n}),(0,Da.jsx)("span",{className:Ja("progress__text--percentage"),children:`${r}%`})]}),(0,Da.jsx)(Nc,{error:a,id:"progress-error"}),(0,Da.jsx)("progress",{className:Ja("progress__bar"),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-label":e("fileUpload.srProgressLabel",{fileName:n}),max:"100","aria-valuenow":r,value:r,"aria-busy":i,children:`${r}%`})]},t)))})};function Jc({id:e,name:t,labelText:n,contentHint:r,outputText:i,accept:a}){const{isSubmitted:o}=Gs(),[s,c]=(0,aa.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=Ws(t),p=so(),h=so(),f=so(),m=o&&d,y=[f];r&&y.push(h),m&&y.push(p);const g=(0,aa.useCallback)((()=>{c(!0)}),[c]),v=(0,aa.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,aa.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,Da.jsxs)("div",{className:Ja("upload__container"),children:[r&&(0,Da.jsx)("span",{className:Ja("upload__content-hint"),id:h,children:r}),(0,Da.jsx)(Nc,{id:p,error:m&&d}),(0,Da.jsx)("div",{className:Ja(["file-upload",...s?["focus-within"]:[]]),children:(0,Da.jsxs)("label",{htmlFor:e,className:Ja("upload__label"),children:[(0,Da.jsx)(fo,{name:"upload",size:"32",alt:""}),(0,Da.jsxs)("div",{children:[(0,Da.jsx)("span",{className:Ja(["upload__label--text"]),children:n}),(0,Da.jsx)("input",{id:e,className:Ja("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:a||null,onFocus:g,onBlur:v}),(0,Da.jsx)("span",{className:Ja("upload__output"),"aria-hidden":"true",id:f,children:i})]})]})})]})}const Xc=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:i,isComplete:a,onClickCancel:o})=>{const{t:s}=xa(),[{value:c}]=Ws(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,Da.jsxs)(kc,{className:Ja("upload-form"),children:[(0,Da.jsx)(Jc,{name:t,id:e,accept:n,labelText:s("fileUpload.labelText"),outputText:s("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,Da.jsxs)("div",{className:Ja("upload__button-container"),children:[(0,Da.jsx)("button",{id:i||!a?e:void 0,type:"button",onClick:o,className:Ja("button","button--secondary","upload__cancel"),children:s("fileUpload.cancelButtonText")}),(0,Da.jsx)("button",{className:Ja("button","button--primary"),type:"submit",children:s("fileUpload.uploadButtonText")})]})]})},Yc="fileListForm",Zc="fileList",Qc=()=>{const{t:e}=xa(),{sendPolite:t,sendAssertive:n}=La(),r=Zn(),i=$a(),{serviceAllowsUploads:a,allowedMimeTypes:o,maxSize:s}=Qa(),c=(0,aa.useRef)(null),l=(0,aa.useRef)(a),{cancelEntrySelection:u}=Vc(),{uploadFile:d,clearUploads:p,isUploading:h,isComplete:f}=eo(),{uploadHandle:m,hasServerError:y,progress:g}=((e,t)=>{const n=Mn((n=>Us(n,{formId:e,name:t}))),{currentUploads:r}=eo(),i=n&&n.length>0;let a=null,o=!1,s=0;if(r&&r.length>0){const e=r[0];a=e.uploadHandle,o=!!e.error,s=e.progress}return{hasFile:i,selectedFileName:i?n[0].name:"",uploadHandle:a,hasServerError:o,progress:s}})(Yc,Zc),v=so(),b=(0,aa.useRef)(!0),w=e("fileUpload.contentHint",{size:x(s)}),C=(0,aa.useRef)(""),_=(0,aa.useRef)(null);(0,aa.useEffect)((()=>{C.current&&_.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(w),C.current=w}),[w,n]),(0,aa.useEffect)((()=>{g>0&&t(1===g?e("fileUpload.srStartedText"):`${g}%`)}),[g,t,e]),(0,aa.useEffect)((()=>{b.current||h||!f||(p(),u(),i(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=f}),[h,f,p,u,i,t,e]);const S=(0,aa.useCallback)((({fileList:e})=>{d(e[0]),i()}),[d,!1,i]),E=(0,aa.useCallback)((()=>{m&&m.abort(),p(),u(),i()}),[m,p,u,i]),T=(0,aa.useMemo)((()=>({[Zc]:[_c((()=>a),e("fileUpload.errors.unavailable")),_c(Ec,e("fileUpload.errors.noFile")),_c(Sc,e("fileUpload.errors.tooLarge"),s)]})),[s,a,e]);return(0,Da.jsx)("div",{className:Ja(["upload",...y?["upload--error"]:[]]),ref:_,children:(0,Da.jsxs)(Cc,{formId:Yc,persistData:!0,onSubmit:S,validationSchema:T,children:[(h||!f)&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(Kc,{}),(0,Da.jsx)("div",{className:Ja("upload__button-container"),children:(0,Da.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:E,ref:c,className:Ja("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&f&&(0,Da.jsx)(Xc,{controlName:Zc,skiplinkId:r,accept:o?.join(", ")||"",contentHint:w,isComplete:f,isUploading:h,onClickCancel:E}),!l.current&&(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("span",{className:Ja("notification"),id:v,children:e("fileUpload.unavailableText")}),(0,Da.jsx)("div",{className:Ja("upload__button-container"),children:(0,Da.jsx)("button",{id:h||!f?r:void 0,type:"button",onClick:E,className:Ja("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},el=()=>{const{t:e}=xa(),{showFileUpload:t,serviceAllowsUploads:n}=Qa(),[r,i]=(0,aa.useState)(n||!1),a=$a(),o=(0,aa.useRef)(null),{setUserEntryType:s,activeEntry:c}=Vc(),l=(0,aa.useRef)(null),{sendPolite:u}=La(),d=!!tr();return(0,aa.useEffect)((()=>{E(l.current,(()=>{n||a()})),i(n||!1)}),[n,a]),(0,aa.useEffect)((()=>{o.current&&!n&&u(e("fileUpload.srUnavailableText")),!1===o.current&&n&&u(e("fileUpload.srAvailableText")),d&&(o.current=n)}),[n,d,u,e]),t||c===I?null:(0,Da.jsx)(lc,{isActive:r,transitionStartState:cc.rendered,children:(0,Da.jsx)("div",{className:Ja("upload-toggle-wrapper"),children:(0,Da.jsx)(lc,{isActive:r,transitionStartState:cc.visuallyHidden,children:(0,Da.jsx)("button",{className:Ja(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{s(I),a()}:void 0,children:(0,Da.jsx)(fo,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},tl=()=>{const{isOpen:e}=wa(),t=(0,aa.useRef)(null),{hasCountdown:n}=ao(),[r,i]=(0,aa.useState)(n),{hasPrompt:a}=oo(),[o,s]=(0,aa.useState)(a),c=$a(),l=(0,aa.useRef)(!1),{activeEntry:u}=Vc(),[d,p]=(0,aa.useState)({text:qc,upload:Qc}),[h,f]=(0,aa.useState)((()=>u)),m=Vn(),{accountAllowsUploads:y}=Qa(),g=(0,aa.useCallback)((()=>{E(t.current,c)}),[c]);(0,aa.useEffect)((()=>{const{customComponents:e}=m,{entry:t}=e||{};t&&p((e=>({...e,...t})))}),[m]),(0,aa.useEffect)((()=>{g(),i(n),s(a)}),[n,a,g]),(0,aa.useEffect)((()=>{f(u),g()}),[u,g,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const v=d[h];return(0,Da.jsxs)("div",{className:Ja("chat__entry"),ref:t,children:[r&&(0,Da.jsx)(Bc,{}),o&&(0,Da.jsx)(Hc,{}),(0,Da.jsxs)("div",{className:Ja(["entry__body",...n||a?["entry__body--hidden"]:[]]),children:[h!==I&&y&&e?(0,Da.jsx)(el,{}):null,(0,Da.jsx)(v,{})]})]})},nl=()=>{const{t:e}=xa(),{isOpen:t,closeChat:n}=wa(),{isWindow:r}=rr();return t&&r?(0,Da.jsx)("button",{type:"button",className:Ja("button","collapse-button"),onClick:n,children:(0,Da.jsx)(fo,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},rl=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:i,srText:a}}=Ra(),o=Aa(),s=so(),{sendPolite:c}=La(),l=$a(),u="SeamlySessionExpiredError"===e?.name;return(0,aa.useEffect)((()=>{!u&&a&&setTimeout((()=>{c(a)}),200)}),[c,a,u]),u?(0,Da.jsx)(Da.Fragment,{}):(0,Da.jsxs)("section",{className:Ja("interrupt"),"aria-labelledby":s,children:[(0,Da.jsx)(nl,{}),(0,Da.jsxs)("div",{className:Ja("interrupt__body"),children:[(0,Da.jsx)("h2",{id:s,className:Ja("interrupt__title"),children:t}),(0,Da.jsx)("p",{className:Ja("interrupt__message"),children:n}),r&&i&&(0,Da.jsx)("div",{className:Ja("interrupt__actions"),children:(0,Da.jsx)("button",{type:"button",className:Ja("button","button--primary"),onClick:()=>{i&&o[i]&&o[i](),l()},children:r})})]})]})},il=function({children:e}){const t=Mn(Oa),{isOpen:n}=wa();return t?(0,Da.jsx)(rl,{}):(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsxs)(Uc,{children:[(0,Da.jsxs)("div",{className:Ja("chat__container__header"),children:[(0,Da.jsx)(yc,{}),(0,Da.jsx)(nl,{})]}),e]}),(0,Da.jsx)(tl,{}),n&&(0,Da.jsx)(Dc,{})]})};function al({event:e}){const[t]=Qs(e);return(0,Da.jsx)("li",{children:(0,Da.jsx)(t,{event:e})})}function ol({events:e}){return(0,Da.jsx)("ul",{className:Ja("collapsed-chat-messages"),children:e.map((e=>(0,Da.jsx)(al,{event:e},e.payload.id)))})}function sl(){const{preChatEvents:e}=Vn(),t=Mn(Oa),{isOpen:n}=wa();return t||!e?.length||n?null:(0,Da.jsx)(ol,{events:e})}function cl(){const{t:e}=xa(),t=e("window.chat.continue"),n=(0,aa.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t}}})),[t]);return(0,Da.jsx)(ol,{events:[n]})}const ll=()=>{const e=function(){const{startChatIcon:e}=Vn();return e}(),t=tr(),n=Mn(Oa),r=t&&!n,i=r?t.avatar:e;return i?(0,Da.jsx)("img",{className:Ja(r?"avatar":"icon"),src:i,alt:""}):(0,Da.jsx)(fo,{name:"avatar",size:"32",alt:""})},ul=({onClick:e})=>{const t=Ia(),{t:n}=xa(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),i=$a(),{isOpen:a}=wa(),o=Yn(),s=(0,aa.useCallback)((()=>{e(),i()}),[i,e]);return(0,Da.jsx)(lc,{isActive:!a,transitionStartState:cc.rendered,children:(0,Da.jsxs)("button",{className:Ja("window-open-button"),"aria-label":r,"aria-hidden":a,onClick:s,children:[(0,Da.jsx)(lc,{isActive:!!o,transitionStartState:cc.notRendered,children:(0,Da.jsx)("span",{className:Ja("message-count"),"aria-hidden":"true",children:o})}),(0,Da.jsx)(ll,{})]})})},dl=(e,t,n)=>"object"==typeof e?e[t]:n,pl=n.p+"sounds/beep.mp3",hl=!!window.Notification,fl={app:()=>(0,Da.jsx)(pc,{children:(0,Da.jsx)(il,{children:(0,Da.jsx)(rc,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=ia(),{connectWhenInView:t}=Vn(),n=Mn(ar),{containerRef:r,isVisible:i}=Ca({enabled:t,freezeOnceVisible:!0});return(0,aa.useEffect)((()=>{i&&e(ta())}),[e,i]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=wa();return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(lc,{isActive:!n,transitionStartState:cc.rendered,children:(0,Da.jsxs)("div",{ref:t,className:Ja("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,Da.jsx)(sl,{}),(0,Da.jsx)(uc,{})]})}),(0,Da.jsx)(lc,{isActive:n,transitionStartState:cc.rendered,children:(0,Da.jsx)(pc,{ref:t,children:e&&(0,Da.jsx)(il,{children:n&&(0,Da.jsx)(rc,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=wa(),n=_a(),{continueChat:r,preChat:i}=Vn();return(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)(ul,{onClick:t}),(0,Da.jsx)(lc,{isActive:!!i&&!e&&!n,exitAfter:dl(i,"exitAfter"),enterDelay:dl(i,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Da.jsx)("div",{className:Ja("unstarted-wrapper","unstarted-wrapper--window"),children:(0,Da.jsx)(sl,{})})}),(0,Da.jsx)(lc,{isActive:r&&!e&&n,exitAfter:dl(r,"exitAfter"),enterDelay:dl(r,"enterDelay"),transitionStartState:cc.notRendered,children:(0,Da.jsx)("div",{className:Ja("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,Da.jsx)(cl,{})})}),(0,Da.jsx)(lc,{isActive:e,transitionStartState:cc.notRendered,children:(0,Da.jsx)(pc,{children:(0,Da.jsx)(il,{children:(0,Da.jsx)(rc,{})})})})]})}};function ml(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const yl=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=Qn(),{notificationAudioURL:t}=Vn(),[n,r]=(0,aa.useState)(hl?Notification.permission:"default"),[i,a]=(0,aa.useState)(document.visibilityState),o=Mn(Os),s=(0,aa.useCallback)((async()=>{if(hl&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,aa.useMemo)((()=>"granted"===n),[n]),l=(0,aa.useMemo)((()=>"hidden"===i),[i]);(0,aa.useEffect)((()=>{"default"===n&&e&&s()}),[n,e,s]);const u=(0,aa.useCallback)((async(e,r)=>{if(o&&hl){if("default"===n&&s(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||pl);await e.play()}catch(e){console.warn(e)}if(c&&(l||!document.hasFocus())){const t=new Notification(e,r);t.onclick=function(){window.parent.focus(),window.focus(),t.close();const e=document.querySelector(`input[name=${Wc}]`);e&&e.focus()}}}}),[t,n,c,s,o,l]);return(0,aa.useEffect)((()=>{if(!o)return()=>{};function e(){a(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[o]),{permission:n,requestPermission:s,sendNotification:u}})(),[,n]=Ba(),r=Vn(),i=tr(),{proactiveMessages:a}=Qn(),{isOpen:o,isVisible:s}=wa(),c=Xa(),l=_a(),u=Mn(Ls),{body:d}=Wa(u),{userLocale:p}=xa(),h=(0,aa.useRef)(void 0),f=(0,aa.useMemo)((()=>d?"string"==typeof d?ml(d):"text"in d?ml(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?ml(d.prompt?.text):"":""),[d]);(0,aa.useEffect)((()=>{i?.name&&f&&a&&u&&h.current!==u.payload?.id&&(t(i.name,{body:f,icon:i?.avatar}),h.current=u.payload.id)}),[i?.avatar,i?.name,u,f,a,t]);const m=fl[r.layoutMode],y=(0,aa.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),g=(0,aa.useMemo)((()=>{if(p){const e=document.querySelector("html")?.getAttribute("lang");if(e!==p)return p}}),[p]);if(!m)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const v=["app",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];return"function"!=typeof c?v.push(...c):v.push(...c(r)),o||"app"===r.layoutMode||v.push("app--collapsed"),l&&v.push("app--user-responded"),s?(0,Da.jsx)("div",{className:Ja(v),lang:g,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,Da.jsx)(m,{})}):null},gl=e=>(0,Da.jsx)(Is,{...e,children:(0,Da.jsx)(yl,{})});class vl{constructor(e,n){const{namespace:r="",parentElement:i,...a}=e;this.config={...a,namespace:r},this.namespace=r,this.parentElement=i,this.externalApi=n,this.api=new we({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(t()),this.functions={},this.registerFunctions({on:this.eventBus.on,off:this.eventBus.off}),this.eventBus.on("function.register",((e,t)=>this.registerFunction(e,t))),this.eventBus.on("function.unregister",((e,t)=>this.unregisterFunction(e,t)))}async render(){const{view:e,...t}=this.config.customComponents||{},n={...this.config,parentElement:this.parentElement,customComponents:Object.keys(t).length?t:void 0},r=function({initialState:e,api:t,eventBus:n,config:r}){const i=$t({reducer:ra,preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat(function({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:i,api:a,layoutMode:s}=bn(t()),{error:c,type:l}=n,u=_r[c?.name]?new _r[c.name](c):new o(c);r?.(u,{namespace:i,api:a,layoutMode:s,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{try{return t.payload?.originalEvent?.payload?n({error:t.payload,type:t.payload?.originalEvent?.payload?.type}):t.payload?.originalError&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}({api:t}),function({api:e}){return()=>t=>n=>{const{payload:r,type:i}=n;if(i===Gr.type){if(!Kr.includes(r.name))throw new c(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}({api:t}),function({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case zi.toString():e.store.set("options",n.payload);break;case Di.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),Qi)});return i}({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(fr(n)),await r.dispatch(fn()),await r.dispatch(lr()),r.dispatch(cr()),e?(0,i.render)((0,Da.jsx)(Is,{eventBus:this.eventBus,store:r,api:this.api,children:(0,Da.jsx)(e,{})}),this.parentElement):(0,i.render)((0,Da.jsx)(gl,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,i.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),this.functions={}}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}const bl=e=>"object"==typeof e&&"action"in e,xl=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),wl=class{constructor(e){this._waitingActions=[],this._instances={},this.timeoutId=void 0,this.appConfig=e,this.context={}}push(...e){(e=e.filter(bl).map(xl)).length&&(this._waitingActions.push(...e),this.handleActions())}handleActions(){const e=this._waitingActions;this._waitingActions=[],e.forEach((e=>{switch(e.action){case"init":this.handleInit(e);break;case"destroy":this.handleDestroy(e);break;default:this.handleAction(e)||this.setContext(e.action,...e.args)||this._waitingActions.push(e)}}))}instanceInitializing(e){const t=Object.keys(this._instances);return!e&&t.length>0||t.includes(e)}setContext(e,t){const{instance:n}=t;if(this.instanceInitializing(n))return!1;switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:n,locale:r}=t;return n&&r&&(this.context.userLocale=r,this.context.source=H),!0;case"setContext":const{userLocale:i,contentLocale:a}=t;return this.context.userLocale=i,this.context.contentLocale=a,i&&i!=this.appConfig?.userLocale&&(this.context.source=H),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables={...t}),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace:i}=n||t;if(i?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==i||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout((()=>{e.render()}),60)}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,i=Object.values(this._instances);return!n&&i.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),i.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new vl(e,this)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){const t={...e.context||this.appConfig.context,...this.context},n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r={...this.appConfig.defaults,...e.defaults},i={...this.appConfig,...e,api:{...this.appConfig.api,...e.api},context:Object.keys(t).length?t:void 0,defaults:Object.keys(r).length?r:void 0};return"function"==typeof this.appConfig?this.appConfig(i):i}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},Cl=()=>{const e=new URLSearchParams(window.location.search);return Array.from(e.entries()).reduce(((e,[t,n])=>({...e,[t]:n})),{})},_l=e=>new URLSearchParams(e).toString(),Sl={direction:"to_translation_locale",locale:"nl",translatedBy:"deep_l",data:{}};function El(e){switch(e.payload.type){case"cta":case"image":case"text":case"choice_prompt":return{...e,payload:{...e.payload,translatedBody:{...Sl,data:{...e.payload.body,text:e.payload.body.text?`NL - ${e.payload.body.text}`:void 0,description:e.payload.body.description?`NL - ${e.payload.body.description}`:void 0,buttonText:e.payload.body.buttonText?`NL - ${e.payload.body.buttonText}`:void 0,choices:e.payload.body.choices?e.payload.body.choices.map((e=>({...e,text:`NL - ${e.text}`}))):void 0,prompt:e.payload.body.prompt?{...e.payload.body.prompt,text:`NL - ${e.payload.body.prompt.text}`}:void 0}}}};default:return e}}const Tl={events:[],config:{layoutMode:"inline",accountConfig:{},hideOnNoUserResponse:!1,showDisclaimer:!1,showSuggestions:!0,preChat:!0},context:{},initialState:{},unreadEvents:0,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1},resumeConversationPrompt:!1,visibility:{visibility:vn.open},serviceInfo:{activeServiceSessionId:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:"Test title",subTitle:"Test subtitle"},interrupt:{error:void 0},historyLoaded:!1,skiplinkTargetId:m(),optionsButtonId:m(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},entryMeta:{default:"text",active:"text",userSelected:null,options:{},optionsOverride:{}},currentUploads:[],processingFileUploads:[]},jl={participants:{agent:{id:"agent",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}},user:{id:"user",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}}},currentAgent:"agent"},kl={type:"info",payload:{body:{subtype:"new_topic",type:"divider"},fromClient:!1,fromHistory:!0,id:m(),transactionId:"_1y9pz5fbyly",type:"divider"}},Nl={type:"info",payload:{body:{language:"Nederlands",restartButtonText:null,subtype:"new_translation",text:"[NL] Automatic translation to Dutch started. Please note that automatic translations may contain errors.",title:"[NL] Translating to Dutch",translationEnabled:!0,userLocale:"nl"},fromClient:!1,fromHistory:!0,id:m(),occurredAt:0x5c68711878df3,participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,translatedBody:null,type:"divider"}},Il={type:"info",payload:{body:{language:"Nederlands",subtype:"new_translation",text:"[NL] Automatic translation to Dutch started. Please note that automatic translations may contain errors.",translationEnabled:!0,userLocale:"nl"},fromClient:!1,fromHistory:!0,id:m(),occurredAt:0x5c68711878df3,participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,translatedBody:null,type:"divider"}},Al={type:"info",payload:{body:{language:"Nederlands",restartButtonText:"[NL] Start again",subtype:"new_translation",text:null,title:"[NL] Automatic translation to Dutch ended",translationEnabled:!1,userLocale:"nl"},fromClient:!1,fromHistory:!0,id:m(),occurredAt:0x5c68711878df3,participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,translatedBody:null,type:"divider"}},Ll={type:"info",payload:{body:{text:"This is a system generated info message",type:"text"},fromClient:!1,id:m(),participant:null,service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:null,type:"text"}},Ml={type:"info",payload:{body:{key:["info","sendTranscript","accepted"],variables:{emailAddress:"test@test.com"}},fromClient:!1,id:m(),participant:null,service:{meta:{},name:null,serviceSessionId:null},transactionId:null,type:"translation"}},Ol={title:"You're talking to",subTitle:"Mrs. Bot"},Rl={type:"participant",payload:{fromClient:!1,fromHistory:!0,id:m(),messageStatus:"received",participant:{avatar:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMTAsMTQuOGMtMS4xLDAtMi0wLjktMi0yczAuOS0yLDItMnMyLDAuOSwyLDJTMTEuMSwxNC44LDEwLDE0Ljh6IE0xNS45LDE0LjhjMS4xLDAsMi0wLjksMi0ycy0wLjktMi0yLTIKCXMtMiwwLjktMiwyUzE0LjgsMTQuOCwxNS45LDE0Ljh6IE0yMS44LDEwLjhjLTEuMSwwLTIsMC45LTIsMnMwLjksMiwyLDJzMi0wLjksMi0yUzIyLjksMTAuOCwyMS44LDEwLjh6IE0yMS4zLDE4LjFIMTAuNwoJQzExLjcsMjMuOSwyMC4yLDIzLjksMjEuMywxOC4xeiIvPgo8L3N2Zz4K",id:"agent",introduction:"You're now talking to Mrs. Bot gimme a minit",name:"Mrs. Bot",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}},transactionId:"d63655bf-1d3d-42cf-b14e-4da9e2b6a642",type:"participant"}},Pl={type:"participant",payload:{fromClient:!1,fromHistory:!0,id:m(),messageStatus:"received",participant:{introduction:"Welcome, you are now chatting with Mrs. Bot 2, give me a minit to read back the chat history.",id:"agent",avatar:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNEE0OEMxIiBkPSJNMTAuMSwxNC45Yy0xLjEsMC0yLTAuOS0yLTJzMC45LTIsMi0yczIsMC45LDIsMlMxMS4yLDE0LjksMTAuMSwxNC45eiBNMjEuOSwxMC45Yy0xLjEsMC0yLDAuOS0yLDIKCXMwLjksMiwyLDJzMi0wLjksMi0yUzIzLDEwLjksMjEuOSwxMC45eiBNMjEuNCwxOC4ySDEwLjhDMTEuOCwyNCwyMC4zLDI0LDIxLjQsMTguMnogTTE3LjIsMjUuM2gtMi40Yy0wLjYsMC0xLjIsMC40LTEuNCwxCgljLTUuMS0wLjItOS4yLTQuNC05LjQtOS42YzAuMSwwLDAuMiwwLjEsMC40LDAuMWgwLjFjMC44LDAsMS40LTAuNiwxLjQtMS40di00LjdjMC0wLjgtMC42LTEuNC0xLjQtMS40aDBjLTAuOCwwLTEuNCwwLjYtMS40LDEuNAoJdjIuN3YydjEuMWMwLDUuOSw0LjcsMTAuNiwxMC41LDEwLjhjMC4yLDAuNSwwLjcsMC44LDEuMiwwLjhoMi40YzAuOCwwLDEuNC0wLjYsMS40LTEuNFMxOCwyNS4zLDE3LjIsMjUuM3oiLz4KPC9zdmc+Cg==",name:"Two",service:{expose:{map:{},version:3},meta:{},name:"new service",serviceSessionId:m(),settings:{}}},transactionId:m(),type:"participant"}},Dl={type:"participant",payload:{fromClient:!1,fromHistory:!0,id:m(),messageStatus:"received",participant:{id:"user",introduction:"You're now talking to Mrs. Bot gimme a minit",name:"Mrs. Bot",service:{expose:{map:{},version:2},meta:{},name:null,service_session_id:null,settings:{}}},transactionId:"d63655bf-1d3d-42cf-b14e-4da9e2b6a642",type:"participant"}},zl=({type:e,data:t,text:n})=>({type:"message",payload:{body:{type:e,text:n,data:t},participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},fromClient:!1,fromHistory:!0,id:"4efacb4d-28a0-454e-8e36-3f17eb598c5d",messageStatus:"read",transactionId:"6f9beee7-ce82-418e-9bec-8001079aa769",transactionLast:!0,type:"custom"}}),Ul={type:"message",payload:{body:{text:"What do you want to do?",type:"text",data:void 0},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"b947b684-93df-4bd9-a8ea-e2f1b5a7a480",transactionLast:!1,type:"text"}},Fl={type:"message",payload:{type:"splash",id:m(),body:{text:"Example splash message ✨",type:"text",variables:{}}}},Bl={type:"message",payload:{body:{description:"Thanks for chatting!\n\nMore info about our <strong>products</strong>?",buttonLink:"https://seamly.ai",buttonText:"View website",buttonNewTab:!0},type:"cta",fromClient:!1,fromHistory:!0,id:"f5351010-0def-452d-818f-ca22ac61792z",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1}},Hl={type:"message",payload:{body:{text:"What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am. What do you want to do? This is a really long message from a bot that has a lot to say about a lot of things. Currently I am contemplating my own bot existence and constantly asking myself who I am.",type:"text"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"b947b684-93df-4bd9-a8ea-e2f1b5a7a480",transactionLast:!1,type:"text"}},$l={type:"message",payload:{body:{text:"Bubble with <strong>bold</strong> <em>italic</em> <u>underline</u>",type:"text"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Vl={type:"message",payload:{body:{text:'<a href="https://google.com" data-link-id="1">Link in same window</a> and <a href="https://google.com" data-link-id="2" target="_blank">link in new window</a> embedded in text',type:"text"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Gl={type:"message",payload:{body:{text:'Here is a long link <a href="https://google.com" data-link-id="1">click me click me please click me yoohoooo please please click me here I am click me now what are you waiting for click me now now now now now click meeeeeeeeeeeeee</a> embedded in text',type:"text"},fromClient:!1,fromHistory:!0,id:"a964e54e-ea98-46ff-a952-979a47f162c0",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Wl={type:"message",payload:{body:{text:"\n <ul>\n <li>Short list item</li>\n <li>This list item is longer to showcase different type lengths of text in list items and how they reflow in the browser</li>\n <li>\n This list item has a nested list with 3 items in it.\n <ul>\n <li>First item</li>\n <li>second item</li>\n <li>Third item</li>\n </ul>\n </li>\n <li>Another one just to be sure :)</li>\n </ul>\n ",type:"text"},fromClient:!1,fromHistory:!0,id:"f5351010-0def-452d-818f-ca22ac61792a",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},ql={type:"message",payload:{body:{text:"\n <ol>\n <li>Short list item</li>\n <li>This list item is longer to showcase different type lengths of text in list items and how they reflow in the browser</li>\n <li>\n This list item has a nested list with 3 items in it.\n <ol>\n <li>First item</li>\n <li>second item</li>\n <li>Third item</li>\n </ol>\n </li>\n <li>Another one just to be sure :)</li>\n </ol>\n ",type:"text"},fromClient:!1,fromHistory:!0,id:"f5351010-0def-452d-818f-ca22ac61792a",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"text"}},Kl={type:"message",payload:{body:{description:"Plaatje",isZoomable:!1,type:"image",url:"https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg"},fromClient:!1,fromHistory:!0,id:"b44ef42c-880c-43ff-b067-499e7f2e81f7",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"image"}},Jl={type:"message",payload:{body:{description:"Plaatje",isZoomable:!0,type:"image",url:"https://developers.seamly.ai/clients/web-ui/static/photos/image-portrait.jpg"},fromClient:!1,fromHistory:!0,id:"b44ef42c-880c-43ff-b067-499e7f2e81f8",messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"image"}},Xl={type:"message",payload:{body:{description:"test",source:"youtube",type:"video",url:"https://www.youtube.com/embed/K7Hn1rPQouU"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{hideFeedback:"true"}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"d0cc13da-337a-4108-9db1-cb8a3b3a1446",transactionLast:!1,type:"video"}},Yl={type:"message",payload:{body:{choices:[{id:"703db9b3-2157-4d4a-9f9b-c382c6a10531",text:"Dialog (this is intentionally made longer for testing purposes)",type:"choice"},{id:"1eff6098-f14f-4683-a2b8-30d1c573d45e",text:"T-Dialog",type:"choice"},{id:"a8ba3ce8-3324-4e7a-accc-944ff78ac890",text:"Customers",type:"choice"},{id:"c89956ab-cf98-4b7e-9282-7087c988153d",text:"Features",type:"choice"},{id:"9fd9a28f-462d-4f07-9661-606dbe3b9466",category:"secondary",text:"Something else",type:"choice"}],chooseAgain:!0,prompt:{text:"Type &quot;start&quot; at any time to see this menu again",type:"text",variables:{}},type:"choice_prompt"},fromClient:!1,fromHistory:!0,id:m(),messageStatus:"read",participant:"agent",service:{meta:{additions:{}},name:"bot",serviceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},transactionId:"b947b684-93df-4bd9-a8ea-e2f1b5a7a480",transactionLast:!0,type:"choice_prompt"}},Zl={type:"message",payload:{body:{text:"This is what the user typed",type:"text"},fromClient:!0,fromHistory:!0,id:m(),messageStatus:"read",participant:"user",transactionId:"1cdefea9-7437-4672-bcf8-2c75dc99244c",transactionLast:null,type:"text"}},Ql={type:"message",payload:{body:{text:"This is what the user typed. And sometimes the user has quite a lot to say and then we get longer lines that need to wrap well and not break the styling so here goes with just such a line right here!!",type:"text"},fromClient:!0,fromHistory:!0,id:m(),messageStatus:"read",participant:"user",transactionId:"1cdefea9-7437-4672-bcf8-2c75dc99244c",transactionLast:null,type:"text"}},eu={type:"message",payload:{body:{text:'<a href="https://google.com" data-link-id="1">Link in same window</a> and <a href="https://google.com" data-link-id="2" target="_blank">link in new window</a> embedded in text',type:"text"},fromClient:!0,fromHistory:!0,id:m(),messageStatus:"read",participant:"user",transactionId:"1cdefea9-7437-4672-bcf8-2c75dc99244c",transactionLast:null,type:"text"}},tu={type:"upload",transactionId:"_vzhvnol0egf",meta:{},body:{contentType:"image/jpg",filename:"placeholder.jpg",filesize:991078,url:"https://developers.seamly.ai/clients/web-ui/static/photos/image-square-small.jpg"}},nu={type:"message",payload:{...tu,fromClient:!1,participant:"agent",id:m()}},ru={type:"message",payload:{...tu,fromClient:!1,participant:"agent",id:m()}};sessionStorage.setItem(`image-${nu.payload.id}`,nu.payload.body.url);const iu={...nu,payload:{...nu.payload,body:{...nu.payload.body,url:void 0},id:m()}},au={type:"message",payload:{...tu,fromClient:!0,participant:"user",id:m()}};sessionStorage.setItem(`image-${au.payload.id}`,au.payload.body.url);const ou={...au,payload:{...au.payload,id:m(),body:{...au.payload.body,url:null}}},su={isActive:!1,currentLocale:void 0,isAvailable:!1,showTranslationProposal:!1,languages:[],translatedEventGroups:{},containerId:m()},cu=[{id:"1",question:"Invoices",categories:["mixed","short"]},{id:"2",question:"Temporary subscription pause",categories:["mixed","medium"]},{id:"3",question:"Cancellation",categories:["mixed","short"]},{id:"4",question:"Apps",categories:["mixed","medium"]},{id:"5",question:"At what date will my subscription end?",categories:["mixed","long"]},{id:"A",question:"Quotes",categories:["short"]},{id:"B",question:"How to get in touch with us",categories:["long"]}],lu="unstarted",uu="messages",du="errors",pu="uploads",hu="features",fu="options",mu="suggestions",yu="minimizedWindow",gu="minimizedInline",vu="translations",bu={[lu]:{heading:"Unstarted UI",description:"Test the loader here"},[uu]:{heading:"Messages",description:""},[du]:{heading:"UI errors",description:""},[pu]:{heading:"File uploads",description:""},[hu]:{heading:"Other features",description:""},[fu]:{heading:"Options",description:""},[mu]:{heading:"Suggestions",description:""},[yu]:{heading:"Minimized window",desciption:""},[gu]:{heading:"Minimized Inline",description:""},[vu]:{heading:"Translations",description:""}},xu={type:"message",payload:{type:"card",id:m(),body:{action:{ask:"",type:"ask"},buttonText:"Ask about pizzas!",description:"Pizza Margherita is a <strong>typical Neapolitan pizza</strong>.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.",image:"https://developers.seamly.ai/clients/web-ui/static/photos/card-square.jpg",title:"Pizza Margherita"}}},wu={type:"message",payload:{type:"card",id:m(),body:{action:{link:"https://seamly.ai",newTab:!0,type:"navigate"},buttonText:"Order now!",description:"Pizza Margherita is a <strong>typical Neapolitan pizza</strong>.",image:"https://developers.seamly.ai/clients/web-ui/static/photos/card-landscape.jpg",title:"Pizza Margherita"}}},Cu={type:"message",payload:{type:"card",id:m(),body:{action:{topic:"Set topic",type:"topic"},buttonText:"Set topic! (title & description optional)",image:"https://developers.seamly.ai/clients/web-ui/static/photos/card-portrait.jpg"}}},_u={type:"message",payload:{type:"card",id:m(),body:{action:{ask:"",type:"ask"},buttonText:"Ask about pizzas!",description:"Pizza Margherita is a <strong>typical Neapolitan pizza</strong>.\n\nIt is made with San Marzano tomatoes, mozzarella cheese, fresh basil, salt, and extra-virgin olive oil.",title:"Pizza Margherita"}}},Su={base:{category:lu,headingText:"Standard with loader",description:"",...Tl,isLoading:!0},fullConversation:{category:uu,headingText:"Full demo conversation",description:"",...Tl,participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[Rl,Ll,Ul,{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Hl,Pl,Zl,$l,eu,kl,Kl,ru,nu,iu,Ql,Xl,Vl,Gl,Jl,au,ou,Wl,ql,Yl,Bl]},userMessages:{category:uu,headingText:"User messages",description:"",...Tl,participantInfo:jl,events:[Zl,Ql,au,ou,eu]},withParticipants:{category:uu,headingText:"Messages with participant info",description:"",...Tl,config:{...Tl.config,overrideMessages:{agent:{showAvatar:!0,showName:!0},user:{showName:!0,showAvatar:!0}}},participantInfo:jl,events:[Ul,Zl,Hl,Ql]},textMessages:{category:uu,headingText:"Text messages",description:"",...Tl,participantInfo:jl,events:[Ul,Hl,$l,Vl,Gl,Wl,ql]},ctaMessages:{category:uu,headingText:"CTA (call to action) messages",description:"",...Tl,participantInfo:jl,events:[Bl]},imageVideoMessages:{category:uu,headingText:"Download, image and video messages",description:"",...Tl,participantInfo:jl,events:[Kl,Xl,Jl,ru,nu,au]},systemMessages:{category:uu,headingText:"System messages",description:"",...Tl,config:{overrideMessages:{timeIndicator:{enabled:!0,threshold:36e5}}},participantInfo:jl,events:[{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-432e6),id:m(),body:{text:"Long ago when a dialog started",type:"text"}}},Rl,Dl,Pl,kl,Ml,...[Nl,Al].map(El),Ll]},choicePromptMessages:{category:uu,headingText:"Choice prompt messages",description:"",...Tl,participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Ul,Yl]},timeIndicators:{category:uu,headingText:"Time Indicators",description:"",...Tl,config:{overrideMessages:{timeIndicator:{enabled:!0,threshold:36e5}}},participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-432e6),id:m(),body:{text:"Long ago when a dialog started",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-3456e5),id:m(),body:{text:"Above me should be a time indicator showing the full date",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+1-3456e5),id:m(),body:{text:"Another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+2-3456e5),id:m(),body:{text:"And another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()-864e5),id:m(),body:{text:'Above me should be a time indicator showing "yesterday"',type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+1-864e5),id:m(),body:{text:"Another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*(Date.now()+2-864e5),id:m(),body:{text:"And another message",type:"text"}}},{type:"message",payload:{...Ul.payload,occurredAt:1e3*Date.now(),id:m(),body:{text:"Above me should be a time indicator showing me the dialog continues today",type:"text"}}}]},cards:{category:uu,headingText:"Cards",description:"",...Tl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[xu,wu,Cu,_u]},carousel:{category:uu,headingText:"Carousel",description:"",...Tl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[{type:"message",payload:{type:"carousel",id:m(),body:{cards:[xu.payload.body,wu.payload.body,Cu.payload.body,_u.payload.body]}}}]},errorWithAction:{category:du,headingText:"Error with a user action",description:"",...Tl,interrupt:{error:new c(new Error("general error"))}},errorWithoutAction:{category:du,headingText:"Error without a user action",description:"",...Tl,interrupt:{error:new Cr(new Error("seamly offline error"))}},privacyDisclaimer:{category:hu,headingText:"Privacy disclaimer",description:"",...Tl,config:{...Tl.config,showDisclaimer:!0}},characterLimit:{category:hu,headingText:"Input character limit",description:"",...Tl,entryMeta:{default:"text",active:"text",userSelected:null,options:{text:{limit:120}},optionsOverride:{}}},inputLabel:{category:hu,headingText:"Input label",...Tl,entryMeta:{default:"text",active:"text",options:{text:{limit:null}},optionsOverride:{text:{label:"What is your name?",limit:null,placeholder:"Please enter your name"}}}},inputLabelWithFileUploadToggle:{category:hu,headingText:"Input label with file upload toggle button",...Tl,options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",options:{text:{limit:null}},optionsOverride:{text:{label:"What is the title of the uploaded document?",limit:null,placeholder:"Please enter the title of the document"}}}},abortTransactional:{category:hu,headingText:"Abort transaction",...Tl,events:[Ul,Zl],entryMeta:{default:"text",active:"text",options:{text:{limit:null}},optionsOverride:{},actions:{abortTransaction:{label:"Ask for another question",topicFallbackMessage:"Oops...",topicName:"abort_transaction"}},translatedActions:{}}},fileUploadToggle:{category:pu,headingText:"File upload toggle button",description:"",...Tl,options:{...Tl.options,features:{uploads:{enabled:!0}}}},fileUploadToggleHidden:{category:pu,headingText:"File upload toggle button hidden",description:"",...Tl,options:{...Tl.options,features:{uploads:{enabled:!1}}}},fileUploadInput:{category:pu,headingText:"File upload input",description:"Click on upload button to see an error",styleGuideReset:!0,...Tl,config:{...Tl.config,accountConfig:{features:{uploads:!0}}},options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",userSelected:"upload",options:{upload:{allowedMimeTypes:["image/*","application/pdf"],maxSize:10485760}},optionsOverride:{}}},fileUploadBusy:{category:pu,headingText:"File upload in progress",description:"",styleGuideReset:!0,...Tl,config:{...Tl.config,accountConfig:{features:{uploads:!0}}},options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",userSelected:"upload",options:{upload:{allowedMimeTypes:["image/*","application/pdf"],maxSize:10485760}},optionsOverride:{}},currentUploads:[{id:"_2olggurqhb4",name:"gGeyr3WepujbGn7khx.gif",progress:29,uploading:!0,complete:!1,error:"",uploadHandle:{abort:()=>{}}}]},fileUploadError:{category:pu,headingText:"File upload errored",description:"",styleGuideReset:!0,...Tl,config:{...Tl.config,accountConfig:{features:{uploads:!0}}},options:{...Tl.options,features:{uploads:{enabled:!0}}},entryMeta:{default:"text",active:"text",userSelected:"upload",options:{upload:{allowedMimeTypes:["image/*","application/pdf"],maxSize:10485760}},optionsOverride:{}},currentUploads:[{id:"_2olggurqhb4",name:"gGeyr3WepujbGn7khx.gif",progress:0,uploading:!1,complete:!1,error:"Something went wrong with the upload",uploadHandle:{abort:()=>{}}}]},idleTimerCountdown:{category:hu,headingText:"Idle timer with countdown",description:"",...Tl,idleDetachCountdown:{hasCountdown:!0,isActive:!0,count:120,remaining:91,timer:{minutes:1,seconds:31}}},idleTimerNoCountdown:{category:hu,headingText:"Idle timer without countdown",description:"",...Tl,idleDetachCountdown:{hasCountdown:!0,isActive:!1,count:120,remaining:91,timer:{minutes:1,seconds:31}}},resumeConversationPrompt:{category:hu,headingText:"Resume conversation prompt",description:"",...Tl,participantInfo:jl,resumeConversationPrompt:!0},optionsSingleTriggerAvailable:{category:fu,headingText:"Single option available",description:"",...Tl,options:{...Tl.options,features:{sendTranscript:{enabled:!0}}}},optionsSingleTriggerUnavailable:{category:fu,headingText:"Single option",description:"Option unavailable",...Tl,options:{...Tl.options,features:{sendTranscript:{enabled:!1}}}},optionsMultiple:{category:fu,headingText:"Multiple options",description:"All options available",...Tl,options:{...Tl.options,features:{extraMenuItem:{enabled:!0},sendTranscript:{enabled:!0}}}},optionsMultipleUnavailable:{category:fu,headingText:"Multiple options",description:"Some unavailable",...Tl,options:{...Tl.options,features:{extraMenuItem:{enabled:!1},sendTranscript:{enabled:!0}}}},optionSendTranscript:{category:fu,headingText:"Send transcript option",description:"Press submit to view error message",...Tl,options:{...Tl.options,optionActive:"sendTranscript",panelActive:!0,features:{sendTranscript:{enabled:!0}}}},translationsAvailable:{category:vu,headingText:"Show translations available",description:"",...Tl,translations:{...su,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"}]}},translationsAvailableWithOptions:{category:vu,headingText:"Show translations available with other options available",description:"",...Tl,options:{...Tl.options,features:{sendTranscript:{enabled:!0}}},config:{...Tl.config,context:{...Tl.context,contentLocale:"nl",userLocale:"en"}},translations:{...su,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"},{locale:"ar",nativeName:"Arabic"},{locale:"bg",nativeName:"Bulgarian"},{locale:"zh",nativeName:"Chinese"},{locale:"cs",nativeName:"Czech"},{locale:"da",nativeName:"Danish"},{locale:"et",nativeName:"Estonian"},{locale:"fi",nativeName:"Finnish"},{locale:"fr",nativeName:"French"},{locale:"de-informal",nativeName:"German"},{locale:"el",nativeName:"Greek"},{locale:"hu",nativeName:"Hungarian"},{locale:"it",nativeName:"Italian"},{locale:"ja",nativeName:"Japanese"},{locale:"lv",nativeName:"Latvian"},{locale:"pl",nativeName:"Polish"},{locale:"ro",nativeName:"Romanian"},{locale:"ru",nativeName:"Russian"},{locale:"sk",nativeName:"Slovak"},{locale:"sl",nativeName:"Slovenian"},{locale:"es-informal",nativeName:"Spanish"},{locale:"sv",nativeName:"Swedish"},{locale:"ti",nativeName:"Tigrinya"},{locale:"tr",nativeName:"Turkish"},{locale:"uk",nativeName:"Ukrainian"}]}},translationsActive:{category:vu,headingText:"Show translations active",description:"",...Tl,translations:{...su,currentLocale:"nl",isActive:!0,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"}]}},translationsActiveLarge:{category:vu,headingText:"Show translations active (large list)",description:"",...Tl,config:{...Tl.config,context:{...Tl.context,contentLocale:"nl",userLocale:"en"}},translations:{...su,currentLocale:"lv",isActive:!0,isAvailable:!0,languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"},{locale:"ar",nativeName:"Arabic"},{locale:"bg",nativeName:"Bulgarian"},{locale:"zh",nativeName:"Chinese"},{locale:"cs",nativeName:"Czech"},{locale:"da",nativeName:"Danish"},{locale:"et",nativeName:"Estonian"},{locale:"fi",nativeName:"Finnish"},{locale:"fr",nativeName:"French"},{locale:"de-informal",nativeName:"German"},{locale:"el",nativeName:"Greek"},{locale:"hu",nativeName:"Hungarian"},{locale:"it",nativeName:"Italian"},{locale:"ja",nativeName:"Japanese"},{locale:"lv",nativeName:"Latvian"},{locale:"pl",nativeName:"Polish"},{locale:"ro",nativeName:"Romanian"},{locale:"ru",nativeName:"Russian"},{locale:"sk",nativeName:"Slovak"},{locale:"sl",nativeName:"Slovenian"},{locale:"es-informal",nativeName:"Spanish"},{locale:"sv",nativeName:"Swedish"},{locale:"ti",nativeName:"Tigrinya"},{locale:"tr",nativeName:"Turkish"},{locale:"uk",nativeName:"Ukrainian"}]}},translationsFullConversation:{category:vu,headingText:"Show translated messages",description:"",...Tl,participantInfo:jl,serviceInfo:{activeServiceSessionId:"3942159e-9878-469e-9120-f44fd6be0f35"},events:[Nl,Ll,Ul,{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Hl,Zl,$l,kl,Il,Al,Kl,nu,iu,Ql,Xl,Vl,Gl,Jl,au,ou,Wl,ql,Yl,Bl,Al].map(El),translations:{...su,currentLocale:"nl",isActive:!0,isAvailable:!0,translatedEventGroups:{[Nl.payload.id]:[Ll,Ul,{...Yl,payload:{...Yl.payload,id:`${Yl.payload.id}XXX`}},Hl,Zl,$l,kl].map((e=>e.payload.id)),[Il.payload.id]:[Kl,nu,iu,Ql,Xl,Vl,Gl,Jl,au,ou,Wl,ql,Yl,Bl].map((e=>e.payload.id))},languages:[{locale:"nl",nativeName:"Dutch"},{locale:"en",nativeName:"English"}]}},translationProposal:{category:vu,headingText:"Show translation proposal",description:"",...Tl,events:[Ul,Zl,Ql],config:{...Tl.config,showDisclaimer:!0,context:{contentLocale:"nl-informal",userLocale:"en-GB"}},translations:{...su,translationProposal:{buttonLabel:"Activate",proposedLocale:"en-GB",srDismissButtonText:"Dismiss translation proposal",titleLabel:"Do you want to chat in English?"},isAvailable:!0,isActive:!1,languages:[{locale:"nl-informal",nativeName:"Dutch"},{locale:"en-GB",nativeName:"English"}]}},translationProposalWithoutTitle:{category:vu,headingText:"Show translation proposal without title",description:"",...Tl,events:[Ul,Zl,Ql],config:{...Tl.config,showDisclaimer:!0,context:{contentLocale:"nl-informal",userLocale:"en-GB"}},translations:{...su,translationProposal:{buttonLabel:"Activate",proposedLocale:"en-GB",srDismissButtonText:"Dismiss translation proposal"},isAvailable:!0,isActive:!1,languages:[{locale:"nl-informal",nativeName:"Dutch"},{locale:"en-GB",nativeName:"English"}]}}},Eu={minimizedInline:{category:gu,headingText:"Inline minimized",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.minimized}}},minimizedInlineCharacterLimit:{category:gu,headingText:"Inline minimized with limited characters",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.minimized},entryMeta:{...Tl.entryMeta,options:{text:{limit:120}}}}},minimizedInlinePrechat:{category:gu,headingText:"Inline minimized with pre-chat messages",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline",preChatEvents:[Fl]},visibility:{...Tl.visibility,visibility:vn.minimized}}},minimizedInlinePrechatSuggestions:{category:gu,headingText:"Inline minimized with pre-chat messages & suggestions",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline",preChatEvents:[Fl]},serviceData:{suggestion:{body:cu}},visibility:{...Tl.visibility,visibility:vn.minimized}}},inlineWithSuggestions:{category:mu,headingText:"Suggestions",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.open},serviceData:{suggestion:{body:cu}}}},minimizedInlineWithError:{category:gu,headingText:"Inline minimized with error",description:"",inline:{...Tl,config:{...Tl.config,layoutMode:"inline"},visibility:{...Tl.visibility,visibility:vn.minimized},interrupt:{error:new Cr(new Error("seamly offline error"))}}}},Tu={minimizedWindow:{category:yu,headingText:"Unstarted minimized",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window"},visibility:{...Tl.visibility,visibility:vn.minimized}}},minimizedWindowStarted:{category:yu,headingText:"Started minimized",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window"},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}},minimizedWindowStartedUnread:{category:yu,headingText:"Minimized with unread messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window"},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol,unreadEvents:12}}},ju={suggestionsMessage:{category:uu,headingText:"Suggestions message",description:"",...Tl,events:[zl(Ul.payload.body),{type:"service_data",payload:{type:"suggestion",body:cu}}]}},ku=(e,t=[])=>{const n={...Su,fullConversation:{...Su.fullConversation,events:[Fl,...Su.fullConversation.events]},...ju,...t.reduce(((e,t)=>{const{key:n,headingText:r,description:i,body:a}=t;return{...e,[n]:{category:uu,headingText:r,description:i,...Tl,participantInfo:jl,events:[zl(a)]}}}),{})};return Object.keys(n).reduce(((t,r)=>{const{headingText:i,category:a,description:o,...s}=n[r];return{...t,[r]:{headingText:i,description:o,category:a,...e.reduce(((e,t)=>({...e,[t]:{...s,config:{...s.config,layoutMode:t}}})),{})}}}),{})},Nu=({setSelectedState:e,states:t,headingLevel:n})=>{const r=`h${n.toString()}`,i=`h${(parseInt(n,10)+1).toString()}`,a=Cl();return(0,Da.jsx)("nav",{"aria-label":"Style guide navigation",className:"nav--styleguide",children:(0,Da.jsx)("ol",{className:"list--styleguidestates",children:Object.keys(bu).map((n=>{const{heading:o,description:s}=bu[n],c=Object.keys(t).filter((e=>{const{category:r}=t[e];return r===n}));return c.length>0&&(0,Da.jsxs)("li",{children:[(0,Da.jsx)(r,{children:o}),(0,Da.jsx)("span",{className:"category__description",children:s}),(0,Da.jsx)("ol",{children:c.map((n=>{const r={...t[n]};delete r.category;const{headingText:o,descriptionId:s,description:c,...l}=r;return(0,Da.jsxs)("li",{children:[(0,Da.jsx)(i,{id:s,children:o}),c&&(0,Da.jsx)("span",{className:"feature__description",children:c}),(0,Da.jsx)("ul",{className:"list--styleguidelayouts",children:Object.keys(l).map((t=>(0,Da.jsx)("li",{className:t===a?.layoutMode&&n===a?.feature?"state__selected":void 0,children:(0,Da.jsx)("a",{"aria-describedby":s,href:`${window.location.pathname}?${_l({layoutMode:t,feature:n})}`,"aria-current":t===a?.layoutMode&&n===a?.feature?"page":void 0,onClick:r=>{if(r.preventDefault(),"inline"===t){const e=window.document.querySelector(".chat-inline");e&&window.scroll({top:e.offsetTop,behavior:"smooth"})}var i;i={layoutMode:t,feature:n},window.history.pushState(null,"",`${window.location.pathname}?${_l(i)}`),e(i)},children:t.charAt(0).toUpperCase()+t.slice(1)})},t)))})]},n)}))})]},n)}))})})},Iu=require("@seamly/web-ui"),Au={send:()=>{},reset:()=>Promise.resolve({api:{key:"wilson-faqs-on-attach",domain:"api.uat.seamly-app.com",secure:!0},connectWhenInView:!0,layoutMode:"inline",preChatEvents:[],defaults:{visible:"open"},hideOnNoUserResponse:!0,showDisclaimer:!0,notificationAudioURL:void 0,agentParticipant:{}}),store:{get:e=>e,set:e=>e,delete:e=>e},sendContext:()=>{},hasConversation:()=>!1,connected:!1},Lu=({state:e,translations:t,participants:n=[],children:r})=>{const i=(0,aa.useRef)((()=>{})),a=(0,aa.useRef)({emit:()=>{},on:()=>{},off:()=>{}}),o=(0,aa.useMemo)((()=>{const{translations:r,interrupt:i,config:o={},visibility:s,...c}=e||{},l=$t({reducer:{state:Hi,app:wr,config:gr,i18n:Br,translations:Zi,visibility:na,forms:Rr,interrupt:qr},preloadedState:{state:c,config:o,translations:r,interrupt:i,visibility:s},middleware:e=>e({thunk:{extraArgument:{api:Au,eventBus:a.current}},serializableCheck:!1})}),{config:u}=l.getState();return l.dispatch(fr(u)),u.preChatEvents&&l.dispatch(yr(u.preChatEvents)),l.dispatch(Ur("en-GB")),l.dispatch(Fr(t)),n.forEach((e=>{l.dispatch(Ti({participant:e,fromClient:"user"===e?.id}))})),l}),[n,e,t]);return e&&(0,Da.jsx)(Iu.SeamlyStoreProvider,{store:o,children:(0,Da.jsx)(Iu.SeamlyEventBusContext.Provider,{value:a.current,children:(0,Da.jsx)(Iu.SeamlyApiContext.Provider,{value:Au,children:(0,Da.jsx)(Iu.SeamlyLiveRegionContext.Provider,{value:i.current,children:(0,Da.jsx)(Iu.ComponentFilter,{children:(0,Da.jsx)(Iu.SeamlyActivityMonitor,{children:(0,Da.jsx)(Iu.SeamlyFileUpload,{children:r})})})})})})})},Mu=({state:e,customComponents:t={},translations:n,participants:r})=>{const[i,a]=(0,aa.useState)(!0),{config:o}=e||{},{layoutMode:s}=o||{},c=t[s];return(0,aa.useEffect)((()=>{a(!1),requestAnimationFrame((async()=>{await Fa(60),a(!0)}))}),[e]),i?c?(0,Da.jsx)(Lu,{state:e,translations:n,participants:r,children:(0,Da.jsx)(c,{})}):(0,Da.jsx)(Lu,{state:e,translations:n,participants:r,children:(0,Da.jsx)(Iu.View,{})}):null},Ou=({tag:e,id:t,children:n})=>{const r=e;return(0,Da.jsx)(r,{id:t,children:n})},Ru=({config:e,styleGuideConfig:t,translations:n,headingLevel:r=2,participants:i})=>{const[a,o]=(0,aa.useState)(null),[s,c]=(0,aa.useState)(""),[l,u]=(0,aa.useState)(!0),[d]=(0,aa.useState)(m()),{stateUpdateCallback:p,customMessageEventBodies:h}=t,[f]=(0,aa.useState)((()=>{const e=(n=t.showLayoutModes||["inline","window"],{...ku(n,h),...-1!==n.indexOf("window")?{...Tu,minimizedWindowPrechat:{category:yu,headingText:"Minimized with pre-chat messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window",preChatEvents:[Fl]},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}},minimizedWindowPrechatDelayed:{category:yu,headingText:"Minimized with delayed pre-chat messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window",preChatEvents:[Fl],preChat:{enterDelay:1e3,exitAfter:3e3}},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}},minimizedWindowPrechatDisabled:{category:yu,headingText:"Minimized with disabled pre-chat messages",description:"",window:{...Tl,config:{...Tl.config,layoutMode:"window",preChatEvents:[Fl],preChat:!1},visibility:{...Tl.visibility,visibility:vn.minimized},participantInfo:jl,headerTitles:Ol}}}:{},...Eu});var n;return Object.keys(e).reduce(((t,n)=>({...t,[n]:{...e[n],descriptionId:m()}})),{})})),y=(0,aa.useCallback)((e=>{o(p?p(e):e)}),[o,p]),g=(0,aa.useCallback)(((t,n)=>{const r=((...e)=>{const t=new URL(window.location.href);return e.reduce(((e,n)=>{const r=t.searchParams.get(n)||sessionStorage.getItem(n);return r&&(e[n]=r),e}),{})})("apiKey","locale"),a=new URLSearchParams({...r,layoutMode:t,feature:n});window.history.replaceState(null,"",`?${a}`);const{headingText:o}=f[n];c(o);const s=f[n][t],{overrideMessages:l,showSuggestions:u}=s.config,d=i.find((e=>"agent"===e.id));return{...s,config:{...s.config,...e,showDisclaimer:s.config.showDisclaimer||e.showDisclaimer,context:{...e.context,...s.config?.context},layoutMode:s.config.layoutMode,...l?{messages:l}:{},showSuggestions:u},headerTitles:{...s.headerTitles,subTitle:d?.name||s.headerTitles.subTitle}}}),[f,i,e]);(0,aa.useEffect)((()=>{if(l){const e=document.querySelector('[aria-modal="true"]');e&&e.addEventListener("click",(()=>{o((e=>e?{...e,visibility:{...e.visibility,visible:"minimized"}}:e))}))}}),[a,o,l]);const v=(0,aa.useCallback)((()=>{const e=Cl(),{layoutMode:t,feature:n}={layoutMode:"inline",feature:"base",...e};y(g(t,n)),window.document.title="Style"}),[g,y]);return(0,aa.useEffect)((()=>{v()}),[v]),(0,aa.useEffect)((()=>{window.onpopstate=()=>{v()}}),[v]),(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsxs)("section",{className:"chat-inline","aria-labelledby":d,children:[(0,Da.jsxs)(Ou,{tag:`h${r.toString()}`,id:d,children:[(0,Da.jsx)("span",{className:"heading__context",children:"Current selected state:"}),`${s}`]}),(0,Da.jsx)("div",{children:l&&(0,Da.jsx)(Mu,{customComponents:t.customComponents,translations:n,state:a,participants:i})})]}),(0,Da.jsx)("aside",{className:"page-aside markdown",children:(0,Da.jsx)("nav",{className:"page-controls",children:(0,Da.jsx)(Nu,{headingLevel:r,setSelectedState:({layoutMode:e,feature:t})=>{const n=g(e,t);y(n),n.styleGuideReset&&(u(!1),setTimeout((()=>{u(!0)})))},states:f})})})]})},Pu=class extends vl{constructor({styleGuideConfig:e,...t},n){super(t,n),this.styleGuideConfig=e||{}}async render(){const e={...this.config.customComponents||{},view:void 0},t=new we({namespace:this.config.namespace,config:this.config.api,context:this.config.context,layoutMode:this.config.layoutMode});t.URLS={translations:`/client/${this.config.api.key}/translations/{version}/{locale}.json`};const n=await t.getTranslations(this.config.context?.userLocale||"en-GB"),{agentParticipant:r,userParticipant:a}=await t.getConfig(),o=[{id:"user",...a},{id:"agent",introduction:"I am {{name}}",...r}],s={...this.config,customComponents:Object.keys(e).length?e:void 0};(0,i.render)((0,Da.jsx)(Ru,{config:s,styleGuideConfig:this.styleGuideConfig,translations:n,participants:o}),this.parentElement)}},Du=class extends wl{constructor(e,t){super(e),this.styleGuideConfig=t}createInstance(e){const{userStyleGuideConfig:t,...n}=e;return new Pu({styleGuideConfig:{...this.styleGuideConfig,...t},...n},this)}getUserConfig(e={},t){return super.getUserConfig({...e,...t})}},zu=function(e,t){if(window.seamlyStyleGuide&&!Array.isArray(window.seamlyStyleGuide))throw new Error("Seamly UI has already been initialised. Use the window.seamly object to start new instances instead.");const n=Array.isArray(window.seamlyStyleGuide)?window.seamlyStyleGuide:[],r=new Du(e,t);window.seamly=r,window.seamlyStyleGuide={push:r.push.bind(r)},r.push(...n)}})(),module.exports=r})();
3
3
  //# sourceMappingURL=~/style-guide.min.js.map