@seamly/web-ui 21.0.1-beta.1 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.min.js.LICENSE.txt */
2
- (()=>{var e={574:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(){this._defaults=[]}for(var r=0,o=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];r<o.length;r++){const e=o[r];n.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this._defaults.push({fn:e,args:n}),this}}n.prototype._setDefaults=function(e){var n,r=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}(this._defaults);try{for(r.s();!(n=r.n()).done;){const t=n.value;e[t.fn](...t.args)}}catch(e){r.e(e)}finally{r.f()}},e.exports=n},766:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;const i=n(767),s=n(445),a=n(129),c=n(842),l=n(244),u=l.isObject,p=l.mixin,d=l.hasOwn,f=n(253),h=n(574);function y(){}e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1===arguments.length?new t.Request("GET",e):new t.Request(e,n)};const b=t=e.exports;t.Request=x,b.getXHR=()=>{if(o.XMLHttpRequest)return new o.XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};const m="".trim?e=>e.trim():e=>e.replace(/(^\s*|\s*$)/g,"");function v(e){if(!u(e))return e;const t=[];for(const n in e)d(e,n)&&g(t,n,e[n]);return t.join("&")}function g(e,t,n){if(void 0!==n)if(null!==n)if(Array.isArray(n)){var o,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}(n);try{for(i.s();!(o=i.n()).done;)g(e,t,o.value)}catch(e){i.e(e)}finally{i.f()}}else if(u(n))for(const r in n)d(n,r)&&g(e,`${t}[${r}]`,n[r]);else e.push(encodeURI(t)+"="+encodeURIComponent(n));else e.push(encodeURI(t))}function w(e){const t={},n=e.split("&");let r,o;for(let e=0,i=n.length;e<i;++e)r=n[e],o=r.indexOf("="),-1===o?t[decodeURIComponent(r)]="":t[decodeURIComponent(r.slice(0,o))]=decodeURIComponent(r.slice(o+1));return t}function O(e){return/[/+]json($|[^-\w])/i.test(e)}function j(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;let t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){const t=e.split(/\r?\n/),n={};let r,o,i,s;for(let e=0,a=t.length;e<a;++e)o=t[e],r=o.indexOf(":"),-1!==r&&(i=o.slice(0,r).toLowerCase(),s=m(o.slice(r+1)),n[i]=s);return n}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function x(e,t){const n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(()=>{let e,t=null,r=null;try{r=new j(n)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,n.xhr?(t.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",r);try{n._isResponseOK(r)||(e=new Error(r.statusText||r.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=r,e.status=e.status||r.status,n.callback(e,r)):n.callback(null,r)}))}b.serializeObject=v,b.parseString=w,b.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},b.serialize={"application/x-www-form-urlencoded":a.stringify,"application/json":s},b.parse={"application/x-www-form-urlencoded":w,"application/json":JSON.parse},p(j.prototype,f.prototype),j.prototype._parseBody=function(e){let t=b.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&O(this.type)&&(t=b.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},j.prototype.toError=function(){const e=this.req,t=e.method,n=e.url,r=`cannot ${t} ${n} (${this.status})`,o=new Error(r);return o.status=this.status,o.method=t,o.url=n,o},b.Response=j,i(x.prototype),p(x.prototype,c.prototype),x.prototype.type=function(e){return this.set("Content-Type",b.types[e]||e),this},x.prototype.accept=function(e){return this.set("Accept",b.types[e]||e),this},x.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"==typeof t&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});const r=n.encoder?n.encoder:e=>{if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,r)},x.prototype.query=function(e){return"string"!=typeof e&&(e=v(e)),e&&this._query.push(e),this},x.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},x.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},x.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();const n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},x.prototype.crossDomainError=function(){const e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},x.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},x.prototype.ca=x.prototype.agent,x.prototype.buffer=x.prototype.ca,x.prototype.write=()=>{throw new Error("Streaming is not supported in browser version of superagent")},x.prototype.pipe=x.prototype.write,x.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},x.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||y,this._finalizeQueryString(),this._end()},x.prototype._setUploadTimeout=function(){const e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((()=>{e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},x.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));const e=this;this.xhr=b.getXHR();const t=this.xhr;let n=this._formData||this._data;this._setTimeouts(),t.addEventListener("readystatechange",(()=>{const n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4!==n)return;let r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}));const r=(t,n)=>{n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){const e=this._header["content-type"];let t=this._serializer||b.serialize[e?e.split(";")[0]:""];!t&&O(e)&&(t=b.serialize["application/json"]),t&&(n=t(n))}for(const e in this.header)null!==this.header[e]&&d(this.header,e)&&t.setRequestHeader(e,this.header[e]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},b.agent=()=>new h;for(var _=0,C=["GET","POST","OPTIONS","PATCH","PUT","DELETE"];_<C.length;_++){const e=C[_];h.prototype[e.toLowerCase()]=function(t,n){const r=new b.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}function S(e,t,n){const r=b("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}h.prototype.del=h.prototype.delete,b.get=(e,t,n)=>{const r=b("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},b.head=(e,t,n)=>{const r=b("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},b.options=(e,t,n)=>{const r=b("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},b.del=S,b.delete=S,b.patch=(e,t,n)=>{const r=b("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},b.post=(e,t,n)=>{const r=b("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},b.put=(e,t,n)=>{const r=b("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},842:(e,t,n)=>{"use strict";const r=n(695),o=n(244),i=o.isObject,s=o.hasOwn;function a(){}e.exports=a,a.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},a.prototype.parse=function(e){return this._parser=e,this},a.prototype.responseType=function(e){return this._responseType=e,this},a.prototype.serialize=function(e){return this._serializer=e,this},a.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(const t in e)if(s(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},a.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};const c=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),l=new Set([408,413,429,500,502,503,504,521,522,524]);a.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{const n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&l.has(t.status))return!0;if(e){if(e.code&&c.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},a.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},a.prototype.then=function(e,t){if(!this._fullfilledPromise){const e=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(((t,n)=>{e.on("abort",(()=>{if(this._maxRetries&&this._maxRetries>this._retries)return;if(this.timedout&&this.timedoutError)return void n(this.timedoutError);const e=new Error("Aborted");e.code="ABORTED",e.status=this.status,e.method=this.method,e.url=this.url,n(e)})),e.end(((e,r)=>{e?n(e):t(r)}))}))}return this._fullfilledPromise.then(e,t)},a.prototype.catch=function(e){return this.then(void 0,e)},a.prototype.use=function(e){return e(this),this},a.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},a.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},a.prototype.get=function(e){return this._header[e.toLowerCase()]},a.prototype.getHeader=a.prototype.get,a.prototype.set=function(e,t){if(i(e)){for(const t in e)s(e,t)&&this.set(t,e[t]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},a.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},a.prototype.field=function(e,t,n){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(i(e)){for(const t in e)s(e,t)&&this.field(t,e[t]);return this}if(Array.isArray(t)){for(const n in t)s(t,n)&&this.field(e,t[n]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),n?this._getFormData().append(e,t,n):this._getFormData().append(e,t),this},a.prototype.abort=function(){if(this._aborted)return this;if(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req){if(r.gte(process.version,"v13.0.0")&&r.lt(process.version,"v14.0.0"))throw new Error("Superagent does not work in v13 properly with abort() due to Node.js core changes");r.gte(process.version,"v14.0.0")&&(this.req.destroyed=!0),this.req.abort()}return this.clearTimeout(),this.emit("abort"),this},a.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization",`Basic ${r(`${e}:${t}`)}`);break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization",`Bearer ${e}`)}return this},a.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},a.prototype.redirects=function(e){return this._maxRedirects=e,this},a.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},a.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},a.prototype.send=function(e){const t=i(e);let n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&i(this._data))for(const t in e)s(e,t)&&(this._data[t]=e[t]);else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],n&&(n=n.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===n?this._data?`${this._data}&${e}`:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},a.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},a.prototype._finalizeQueryString=function(){const e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){const e=this.url.indexOf("?");if(e>=0){const t=this.url.slice(e+1).split("&");"function"==typeof this._sort?t.sort(this._sort):t.sort(),this.url=this.url.slice(0,e)+"?"+t.join("&")}}},a.prototype._appendQueryString=()=>{console.warn("Unsupported")},a.prototype._timeoutError=function(e,t,n){if(this._aborted)return;const r=new Error(`${e+t}ms exceeded`);r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.timedoutError=r,this.abort(),this.callback(r)},a.prototype._setTimeouts=function(){const e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((()=>{e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((()=>{e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},253:(e,t,n)=>{"use strict";const r=n(244);function o(){}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){const t=e["content-type"]||"";this.type=r.type(t);const n=r.params(t);for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(this[e]=n[e]);this.links={};try{e.link&&(this.links=r.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){const t=Math.trunc(e/100);this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},244:(e,t)=>{"use strict";function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.type=e=>e.split(/ *; */).shift(),t.params=e=>{const t={};var r,o=n(e.split(/ *; */));try{for(o.s();!(r=o.n()).done;){const e=r.value.split(/ *= */),n=e.shift(),o=e.shift();n&&o&&(t[n]=o)}}catch(e){o.e(e)}finally{o.f()}return t},t.parseLinks=e=>{const t={};var r,o=n(e.split(/ *, */));try{for(o.s();!(r=o.n()).done;){const e=r.value.split(/ *; */),n=e[0].slice(1,-1);t[e[1].split(/ *= */)[1].slice(1,-1)]=n}}catch(e){o.e(e)}finally{o.f()}return t},t.cleanHeader=(e,t)=>(delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e),t.isObject=e=>null!==e&&"object"==typeof e,t.hasOwn=Object.hasOwn||function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(e),t)},t.mixin=(e,n)=>{for(const r in n)t.hasOwn(n,r)&&(e[r]=n[r])}},905:e=>{e.exports=()=>()=>null},924:(e,t,n)=>{"use strict";var r=n(210),o=n(559),i=o(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&i(e,".prototype.")>-1?o(n):n}},559:(e,t,n)=>{"use strict";var r=n(612),o=n(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||r.call(s,i),c=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),u=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=a(r,s,arguments);if(c&&l){var n=c(t,"length");n.configurable&&l(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(r,i,arguments)};l?l(e.exports,"apply",{value:p}):e.exports.apply=p},767:e=>{function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},445:e=>{e.exports=s,s.default=s,s.stable=u,s.stableStringify=u;var t="[...]",n="[Circular]",r=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,n,s){var a;void 0===s&&(s=i()),c(e,"",0,[],void 0,0,s);try{a=0===o.length?JSON.stringify(e,t,n):JSON.stringify(e,d(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var l=r.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function a(e,t,n,i){var s=Object.getOwnPropertyDescriptor(i,n);void 0!==s.get?s.configurable?(Object.defineProperty(i,n,{value:e}),r.push([i,n,t,s])):o.push([t,n,e]):(i[n]=e,r.push([i,n,t]))}function c(e,r,o,i,s,l,u){var p;if(l+=1,"object"==typeof e&&null!==e){for(p=0;p<i.length;p++)if(i[p]===e)return void a(n,e,r,s);if(void 0!==u.depthLimit&&l>u.depthLimit)return void a(t,e,r,s);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void a(t,e,r,s);if(i.push(e),Array.isArray(e))for(p=0;p<e.length;p++)c(e[p],p,p,i,e,l,u);else{var d=Object.keys(e);for(p=0;p<d.length;p++){var f=d[p];c(e[f],f,p,i,e,l,u)}}i.pop()}}function l(e,t){return e<t?-1:e>t?1:0}function u(e,t,n,s){void 0===s&&(s=i());var a,c=p(e,"",0,[],void 0,0,s)||e;try{a=0===o.length?JSON.stringify(c,t,n):JSON.stringify(c,d(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var l=r.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function p(e,o,i,s,c,u,d){var f;if(u+=1,"object"==typeof e&&null!==e){for(f=0;f<s.length;f++)if(s[f]===e)return void a(n,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==d.depthLimit&&u>d.depthLimit)return void a(t,e,o,c);if(void 0!==d.edgesLimit&&i+1>d.edgesLimit)return void a(t,e,o,c);if(s.push(e),Array.isArray(e))for(f=0;f<e.length;f++)p(e[f],f,f,s,e,u,d);else{var h={},y=Object.keys(e).sort(l);for(f=0;f<y.length;f++){var b=y[f];p(e[b],b,f,s,e,u,d),h[b]=e[b]}if(void 0===c)return h;r.push([c,o,e]),c[o]=h}s.pop()}}function d(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(o.length>0)for(var r=0;r<o.length;r++){var i=o[r];if(i[1]===t&&i[0]===n){n=i[2],o.splice(r,1);break}}return e.call(this,t,n)}}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,r=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||r.call(i)!==o)throw new TypeError(t+i);for(var s,a=n.call(arguments,1),c=function(){if(this instanceof s){var t=i.apply(this,a.concat(n.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(n.call(arguments)))},l=Math.max(0,i.length-a.length),u=[],p=0;p<l;p++)u.push("$"+p);if(s=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(c),i.prototype){var d=function(){};d.prototype=i.prototype,s.prototype=new d,d.prototype=null}return s}},612:(e,t,n)=>{"use strict";var r=n(648);e.exports=Function.prototype.bind||r},210:(e,t,n)=>{"use strict";var r,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var l=function(){throw new s},u=c?function(){try{return l}catch(e){try{return c(arguments,"callee").get}catch(e){return l}}}():l,p=n(405)(),d=Object.getPrototypeOf||function(e){return e.__proto__},f={},h="undefined"==typeof Uint8Array?r:d(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":p?d([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?d(d([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?d((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?d((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?d(""[Symbol.iterator]()):r,"%Symbol%":p?Symbol:r,"%SyntaxError%":o,"%ThrowTypeError%":u,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet},b=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(n=d(o.prototype))}return y[t]=n,n},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},v=n(612),g=n(642),w=v.call(Function.call,Array.prototype.concat),O=v.call(Function.apply,Array.prototype.splice),j=v.call(Function.call,String.prototype.replace),x=v.call(Function.call,String.prototype.slice),_=v.call(Function.call,RegExp.prototype.exec),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,E=function(e){var t=x(e,0,1),n=x(e,-1);if("%"===t&&"%"!==n)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var r=[];return j(e,C,(function(e,t,n,o){r[r.length]=n?j(o,S,"$1"):t||e})),r},P=function(e,t){var n,r=e;if(g(m,r)&&(r="%"+(n=m[r])[0]+"%"),g(y,r)){var i=y[r];if(i===f&&(i=b(r)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===_(/^%?[^%]*%?$/,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=E(e),r=n.length>0?n[0]:"",i=P("%"+r+"%",t),a=i.name,l=i.value,u=!1,p=i.alias;p&&(r=p[0],O(n,w([0,1],p)));for(var d=1,f=!0;d<n.length;d+=1){var h=n[d],b=x(h,0,1),m=x(h,-1);if(('"'===b||"'"===b||"`"===b||'"'===m||"'"===m||"`"===m)&&b!==m)throw new o("property names with quotes must have matching quotes");if("constructor"!==h&&f||(u=!0),g(y,a="%"+(r+="."+h)+"%"))l=y[a];else if(null!=l){if(!(h in l)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&d+1>=n.length){var v=c(l,h);l=(f=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:l[h]}else f=g(l,h),l=l[h];f&&!u&&(y[a]=l)}}return l}},405:(e,t,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,o=n(419);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,n)=>{"use strict";var r=n(612);e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},545:(e,t,n)=>{"use strict";var r=n(864),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function c(e){return r.isMemo(e)?s:a[e.$$typeof]||o}a[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[r.Memo]=s;var l=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var o=f(n);o&&o!==h&&e(t,o,r)}var s=u(n);p&&(s=s.concat(p(n)));for(var a=c(t),y=c(n),b=0;b<s.length;++b){var m=s[b];if(!(i[m]||r&&r[m]||y&&y[m]||a&&a[m])){var v=d(n,m);try{l(t,m,v)}catch(e){}}}}return t}},679:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,o){return(t[n]=t[n]||[]).push([r,o]),e},e.off=function(r,o){r||(t={});for(var i=t[r]||n,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(r){for(var o,i=t[r]||n,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},631:(e,t,n)=>{var r="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=r&&o&&"function"==typeof o.get?o.get:null,s=r&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=a&&c&&"function"==typeof c.get?c.get:null,u=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,f="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,m=String.prototype.match,v=String.prototype.slice,g=String.prototype.replace,w=String.prototype.toUpperCase,O=String.prototype.toLowerCase,j=RegExp.prototype.test,x=Array.prototype.concat,_=Array.prototype.join,C=Array.prototype.slice,S=Math.floor,E="function"==typeof BigInt?BigInt.prototype.valueOf:null,P=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,k="function"==typeof Symbol&&"object"==typeof Symbol.iterator,A="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,I=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function R(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||j.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var r=e<0?-S(-e):S(e);if(r!==e){var o=String(r),i=v.call(t,o.length+1);return g.call(o,n,"$&_")+"."+g.call(g.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return g.call(t,n,"$&_")}var D=n(654),M=D.custom,L=z(M)?M:null;function U(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function F(e){return g.call(String(e),/"/g,"&quot;")}function B(e){return!("[object Array]"!==q(e)||A&&"object"==typeof e&&A in e)}function $(e){return!("[object RegExp]"!==q(e)||A&&"object"==typeof e&&A in e)}function z(e){if(k)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!T)return!1;try{return T.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,r,o){var a=n||{};if(V(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var y=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return G(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var w=String(t);return y?R(t,w):w}if("bigint"==typeof t){var j=String(t)+"n";return y?R(t,j):j}var S=void 0===a.depth?5:a.depth;if(void 0===r&&(r=0),r>=S&&S>0&&"object"==typeof t)return B(t)?"[Array]":"[Object]";var P,M=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=_.call(Array(e.indent+1)," ")}return{base:n,prev:_.call(Array(t+1),n)}}(a,r);if(void 0===o)o=[];else if(W(o,t)>=0)return"[Circular]";function H(t,n,i){if(n&&(o=C.call(o)).push(n),i){var s={depth:a.depth};return V(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,r+1,o)}return e(t,a,r+1,o)}if("function"==typeof t&&!$(t)){var K=function(e){if(e.name)return e.name;var t=m.call(b.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ee=Z(t,H);return"[Function"+(K?": "+K:" (anonymous)")+"]"+(ee.length>0?" { "+_.call(ee,", ")+" }":"")}if(z(t)){var te=k?g.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):T.call(t);return"object"!=typeof t||k?te:J(te)}if((P=t)&&"object"==typeof P&&("undefined"!=typeof HTMLElement&&P instanceof HTMLElement||"string"==typeof P.nodeName&&"function"==typeof P.getAttribute)){for(var ne="<"+O.call(String(t.nodeName)),re=t.attributes||[],oe=0;oe<re.length;oe++)ne+=" "+re[oe].name+"="+U(F(re[oe].value),"double",a);return ne+=">",t.childNodes&&t.childNodes.length&&(ne+="..."),ne+"</"+O.call(String(t.nodeName))+">"}if(B(t)){if(0===t.length)return"[]";var ie=Z(t,H);return M&&!function(e){for(var t=0;t<e.length;t++)if(W(e[t],"\n")>=0)return!1;return!0}(ie)?"["+Y(ie,M)+"]":"[ "+_.call(ie,", ")+" ]"}if(function(e){return!("[object Error]"!==q(e)||A&&"object"==typeof e&&A in e)}(t)){var se=Z(t,H);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+_.call(se,", ")+" }":"{ ["+String(t)+"] "+_.call(x.call("[cause]: "+H(t.cause),se),", ")+" }"}if("object"==typeof t&&c){if(L&&"function"==typeof t[L]&&D)return D(t,{depth:S-r});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ae=[];return s.call(t,(function(e,n){ae.push(H(n,t,!0)+" => "+H(e,t))})),Q("Map",i.call(t),ae,M)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ce=[];return u.call(t,(function(e){ce.push(H(e,t))})),Q("Set",l.call(t),ce,M)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return X("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return X("WeakSet");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{return f.call(e),!0}catch(e){}return!1}(t))return X("WeakRef");if(function(e){return!("[object Number]"!==q(e)||A&&"object"==typeof e&&A in e)}(t))return J(H(Number(t)));if(function(e){if(!e||"object"!=typeof e||!E)return!1;try{return E.call(e),!0}catch(e){}return!1}(t))return J(H(E.call(t)));if(function(e){return!("[object Boolean]"!==q(e)||A&&"object"==typeof e&&A in e)}(t))return J(h.call(t));if(function(e){return!("[object String]"!==q(e)||A&&"object"==typeof e&&A in e)}(t))return J(H(String(t)));if(!function(e){return!("[object Date]"!==q(e)||A&&"object"==typeof e&&A in e)}(t)&&!$(t)){var le=Z(t,H),ue=I?I(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",de=!ue&&A&&Object(t)===t&&A in t?v.call(q(t),8,-1):pe?"Object":"",fe=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(de||pe?"["+_.call(x.call([],de||[],pe||[]),": ")+"] ":"");return 0===le.length?fe+"{}":M?fe+"{"+Y(le,M)+"}":fe+"{ "+_.call(le,", ")+" }"}return String(t)};var H=Object.prototype.hasOwnProperty||function(e){return e in this};function V(e,t){return H.call(e,t)}function q(e){return y.call(e)}function W(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function G(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return G(v.call(e,0,t.maxStringLength),t)+r}return U(g.call(g.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K),"single",t)}function K(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+w.call(t.toString(16))}function J(e){return"Object("+e+")"}function X(e){return e+" { ? }"}function Q(e,t,n,r){return e+" ("+t+") {"+(r?Y(n,r):_.call(n,", "))+"}"}function Y(e,t){if(0===e.length)return"";var n="\n"+t.prev+t.base;return n+_.call(e,","+n)+"\n"+t.prev}function Z(e,t){var n=B(e),r=[];if(n){r.length=e.length;for(var o=0;o<e.length;o++)r[o]=V(e,o)?t(e[o],e):""}var i,s="function"==typeof P?P(e):[];if(k){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var c in e)V(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&i["$"+c]instanceof Symbol||(j.call(/[^\w$]/,c)?r.push(t(c,e)+": "+t(e[c],e)):r.push(c+": "+t(e[c],e))));if("function"==typeof P)for(var l=0;l<s.length;l++)N.call(e,s[l])&&r.push("["+t(s[l])+"]: "+t(e[s[l]],e));return r}},661:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>y,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>l,StrictMode:()=>Q,Suspense:()=>w,SuspenseList:()=>x,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>z,cloneElement:()=>W,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>V,createPortal:()=>E,createRef:()=>r.createRef,default:()=>re,findDOMNode:()=>K,flushSync:()=>X,forwardRef:()=>f,hydrate:()=>I,isValidElement:()=>q,lazy:()=>j,memo:()=>u,render:()=>N,startTransition:()=>Y,unmountComponentAtNode:()=>G,unstable_batchedUpdates:()=>J,useDeferredValue:()=>Z,useInsertionEffect:()=>te,useSyncExternalStore:()=>ne,useTransition:()=>ee,version:()=>H});var r=n(710),o=n(207),i={};for(const e in o)["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","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(i[e]=()=>o[e]);function s(e,t){for(var n in t)e[n]=t[n];return e}function a(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){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t}function l(e){this.props=e}function u(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:a(this.props,e)}function o(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}n.d(t,i),(l.prototype=new r.Component).isPureReactComponent=!0,l.prototype.shouldComponentUpdate=function(e,t){return a(this.props,e)||a(this.state,t)};var p=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),p&&p(e)};var d="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function f(e){function t(t){var n=s({},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))},y={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},b=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);b(e,t,n,r)};var m=r.options.unmount;function v(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=s({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)}))),e}function g(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return g(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function w(){this.__u=0,this.t=null,this.__b=null}function O(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function j(e){var t,n,o;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){o=e})),o)throw o;if(!n)throw t;return(0,r.createElement)(n,i)}return i.displayName="Lazy",i.__f=!0,i}function x(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&!0===e.__h&&(e.type=null),m&&m(e)},(w.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var o=O(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=g(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}},c=!0===t.__h;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},w.prototype.componentWillUnmount=function(){this.t=[]},w.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return i&&(i.__h=null),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),i]};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 C(e){return this.getChildContext=function(){return e.context},e.children}function S(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(),e.__v?(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)(C,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function E(e,t){var n=(0,r.createElement)(S,{__v:e,i:t});return n.containerInfo=t,n}(x.prototype=new r.Component).__a=function(e){var t=this,n=O(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),_(t,e,r)):o()};n?n(i):i()}},x.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},x.prototype.componentDidUpdate=x.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var P="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,T=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|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]/,k="undefined"!=typeof document,A=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(e)};function N(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function I(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 D(){}function M(){return this.cancelBubble}function L(){return this.defaultPrevented}r.options.event=function(e){return R&&(e=R(e)),e.persist=D,e.isPropagationStopped=M,e.isDefaultPrevented=L,e.nativeEvent=e};var U,F={configurable:!0,get:function(){return this.class}},B=r.options.vnode;r.options.vnode=function(e){var t=e.type,n=e.props,o=n;if("string"==typeof t){var i=-1===t.indexOf("-");for(var s in o={},n){var a=n[s];k&&"children"===s&&"noscript"===t||"value"===s&&"defaultValue"in n&&null==a||("defaultValue"===s&&"value"in n&&null==n.value?s="value":"download"===s&&!0===a?a="":/ondoubleclick/i.test(s)?s="ondblclick":/^onchange(textarea|input)/i.test(s+t)&&!A(n.type)?s="oninput":/^onfocus$/i.test(s)?s="onfocusin":/^onblur$/i.test(s)?s="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(s)?s=s.toLowerCase():i&&T.test(s)?s=s.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===a&&(a=void 0),/^oninput$/i.test(s)&&(s=s.toLowerCase(),o[s]&&(s="oninputCapture")),o[s]=a)}"select"==t&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(n.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==t&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(n.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),e.props=o,n.class!=n.className&&(F.enumerable="className"in n,null!=n.className&&(o.class=n.className),Object.defineProperty(o,"className",F))}e.$$typeof=P,B&&B(e)};var $=r.options.__r;r.options.__r=function(e){$&&$(e),U=e.__c};var z={ReactCurrentDispatcher:{current:{readContext:function(e){return U.__n[e.__c].props.value}}}},H="17.0.2";function V(e){return r.createElement.bind(null,e)}function q(e){return!!e&&e.$$typeof===P}function W(e){return q(e)?r.cloneElement.apply(null,arguments):e}function G(e){return!!e.__k&&((0,r.render)(null,e),!0)}function K(e){return e&&(e.base||1===e.nodeType&&e)||null}var J=function(e,t){return e(t)},X=function(e,t){return e(t)},Q=r.Fragment;function Y(e){e()}function Z(e){return e}function ee(){return[!1,Y]}var te=o.useLayoutEffect;function ne(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),i=r[0].h,s=r[1];return(0,o.useLayoutEffect)((function(){i.__=n,i.v=t,c(i.__,t())||s({h:i})}),[e,n,t]),(0,o.useEffect)((function(){return c(i.__,i.v())||s({h:i}),e((function(){c(i.__,i.v())||s({h:i})}))}),[e]),n}var re={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:te,useTransition:ee,useDeferredValue:Z,useSyncExternalStore:ne,startTransition:Y,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"17.0.2",Children:y,render:N,hydrate:I,unmountComponentAtNode:G,createPortal:E,createElement:r.createElement,createContext:r.createContext,createFactory:V,cloneElement:W,createRef:r.createRef,Fragment:r.Fragment,isValidElement:q,findDOMNode:K,Component:r.Component,PureComponent:l,memo:u,forwardRef:f,flushSync:X,unstable_batchedUpdates:J,StrictMode:Q,Suspense:w,SuspenseList:x,lazy:j,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:z}},798:e=>{"use strict";var t=String.prototype.replace,n=/%20/g,r="RFC3986";e.exports={default:r,formatters:{RFC1738:function(e){return t.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:r}},129:(e,t,n)=>{"use strict";var r=n(261),o=n(235),i=n(798);e.exports={formats:i,parse:o,stringify:r}},235:(e,t,n)=>{"use strict";var r=n(769),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,n,r){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=n.depth>0&&/(\[[^[\]]*])/.exec(i),l=a?i.slice(0,a.index):i,u=[];if(l){if(!n.plainObjects&&o.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var p=0;n.depth>0&&null!==(a=s.exec(i))&&p<n.depth;){if(p+=1,!n.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+i.slice(a.index)+"]"),function(e,t,n,r){for(var o=r?t:c(t,n),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&n.parseArrays)s=[].concat(o);else{s=n.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(l,10);n.parseArrays||""!==l?!isNaN(u)&&a!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(s=[])[u]=o:"__proto__"!==l&&(s[l]=o):s={0:o}}o=s}return o}(u,t,n,r)}};e.exports=function(e,t){var n=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var n,l={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,d=u.split(t.delimiter,p),f=-1,h=t.charset;if(t.charsetSentinel)for(n=0;n<d.length;++n)0===d[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===d[n]?h="utf-8":"utf8=%26%2310003%3B"===d[n]&&(h="iso-8859-1"),f=n,n=d.length);for(n=0;n<d.length;++n)if(n!==f){var y,b,m=d[n],v=m.indexOf("]="),g=-1===v?m.indexOf("="):v+1;-1===g?(y=t.decoder(m,s.decoder,h,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(m.slice(0,g),s.decoder,h,"key"),b=r.maybeMap(c(m.slice(g+1),t),(function(e){return t.decoder(e,s.decoder,h,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===h&&(b=a(b)),m.indexOf("[]=")>-1&&(b=i(b)?[b]:b),o.call(l,y)?l[y]=r.combine(l[y],b):l[y]=b}return l}(e,n):e,p=n.plainObjects?Object.create(null):{},d=Object.keys(u),f=0;f<d.length;++f){var h=d[f],y=l(h,u[h],n,"string"==typeof e);p=r.merge(p,y,n)}return!0===n.allowSparse?p:r.compact(p)}},261:(e,t,n)=>{"use strict";var r=n(478),o=n(769),i=n(798),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,l=String.prototype.split,u=Array.prototype.push,p=function(e,t){u.apply(e,c(t)?t:[t])},d=Date.prototype.toISOString,f=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:f,formatter:i.formatters[f],indices:!1,serializeDate:function(e){return d.call(e)},skipNulls:!1,strictNullHandling:!1},y={},b=function e(t,n,i,s,a,u,d,f,b,m,v,g,w,O,j,x){for(var _,C=t,S=x,E=0,P=!1;void 0!==(S=S.get(y))&&!P;){var T=S.get(t);if(E+=1,void 0!==T){if(T===E)throw new RangeError("Cyclic object value");P=!0}void 0===S.get(y)&&(E=0)}if("function"==typeof f?C=f(n,C):C instanceof Date?C=v(C):"comma"===i&&c(C)&&(C=o.maybeMap(C,(function(e){return e instanceof Date?v(e):e}))),null===C){if(a)return d&&!O?d(n,h.encoder,j,"key",g):n;C=""}if("string"==typeof(_=C)||"number"==typeof _||"boolean"==typeof _||"symbol"==typeof _||"bigint"==typeof _||o.isBuffer(C)){if(d){var k=O?n:d(n,h.encoder,j,"key",g);if("comma"===i&&O){for(var A=l.call(String(C),","),N="",I=0;I<A.length;++I)N+=(0===I?"":",")+w(d(A[I],h.encoder,j,"value",g));return[w(k)+(s&&c(C)&&1===A.length?"[]":"")+"="+N]}return[w(k)+"="+w(d(C,h.encoder,j,"value",g))]}return[w(n)+"="+w(String(C))]}var R,D=[];if(void 0===C)return D;if("comma"===i&&c(C))R=[{value:C.length>0?C.join(",")||null:void 0}];else if(c(f))R=f;else{var M=Object.keys(C);R=b?M.sort(b):M}for(var L=s&&c(C)&&1===C.length?n+"[]":n,U=0;U<R.length;++U){var F=R[U],B="object"==typeof F&&void 0!==F.value?F.value:C[F];if(!u||null!==B){var $=c(C)?"function"==typeof i?i(L,F):L:L+(m?"."+F:"["+F+"]");x.set(t,E);var z=r();z.set(y,x),p(D,e(B,$,i,s,a,u,d,f,b,m,v,g,w,O,j,z))}}return D};e.exports=function(e,t){var n,o=e,l=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var r=i.formatters[n],o=h.filter;return("function"==typeof e.filter||c(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(n=l.filter);var u,d=[];if("object"!=typeof o||null===o)return"";u=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var f=a[u];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var y="comma"===f&&t&&t.commaRoundTrip;n||(n=Object.keys(o)),l.sort&&n.sort(l.sort);for(var m=r(),v=0;v<n.length;++v){var g=n[v];l.skipNulls&&null===o[g]||p(d,b(o[g],g,f,y,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,m))}var w=d.join(l.delimiter),O=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?O+="utf8=%26%2310003%3B&":O+="utf8=%E2%9C%93&"),w.length>0?O+w:""}},769:(e,t,n)=>{"use strict";var r=n(798),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)void 0!==e[r]&&(n[r]=e[r]);return n};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,n){return e[n]=t[n],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r<t.length;++r)for(var o=t[r],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];"object"==typeof u&&null!==u&&-1===n.indexOf(u)&&(t.push({obj:s,prop:l}),n.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],o=0;o<n.length;++o)void 0!==n[o]&&r.push(n[o]);t.obj[t.prop]=r}}}(t),e},decode:function(e,t,n){var r=e.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(e){return r}},encode:function(e,t,n,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===n)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",l=0;l<a.length;++l){var u=a.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===r.RFC1738&&(40===u||41===u)?c+=a.charAt(l):u<128?c+=s[u]:u<2048?c+=s[192|u>>6]+s[128|63&u]:u<55296||u>=57344?c+=s[224|u>>12]+s[128|u>>6&63]+s[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(l)),c+=s[240|u>>18]+s[128|u>>12&63]+s[128|u>>6&63]+s[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var n=[],r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)},merge:function e(t,n,r){if(!n)return t;if("object"!=typeof n){if(i(t))t.push(n);else{if(!t||"object"!=typeof t)return[t,n];(r&&(r.plainObjects||r.allowPrototypes)||!o.call(Object.prototype,n))&&(t[n]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(n);var s=t;return i(t)&&!i(n)&&(s=a(t,r)),i(t)&&i(n)?(n.forEach((function(n,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&n&&"object"==typeof n?t[i]=e(s,n,r):t.push(n)}else t[i]=n})),t):Object.keys(n).reduce((function(t,i){var s=n[i];return o.call(t,i)?t[i]=e(t[i],s,r):t[i]=s,t}),s)}}},921:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,g=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function O(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case i:case a:case s:case f:return e;default:switch(e=e&&e.$$typeof){case l:case d:case b:case y:case c:return e;default:return t}}case o:return t}}}function j(e){return O(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=l,t.ContextProvider=c,t.Element=r,t.ForwardRef=d,t.Fragment=i,t.Lazy=b,t.Memo=y,t.Portal=o,t.Profiler=a,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return j(e)||O(e)===u},t.isConcurrentMode=j,t.isContextConsumer=function(e){return O(e)===l},t.isContextProvider=function(e){return O(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return O(e)===d},t.isFragment=function(e){return O(e)===i},t.isLazy=function(e){return O(e)===b},t.isMemo=function(e){return O(e)===y},t.isPortal=function(e){return O(e)===o},t.isProfiler=function(e){return O(e)===a},t.isStrictMode=function(e){return O(e)===s},t.isSuspense=function(e){return O(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===p||e===a||e===s||e===f||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===c||e.$$typeof===l||e.$$typeof===d||e.$$typeof===v||e.$$typeof===g||e.$$typeof===w||e.$$typeof===m)},t.typeOf=O},864:(e,t,n)=>{"use strict";e.exports=n(921)},359:(e,t)=>{"use strict";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.module.reference")},973:(e,t,n)=>{"use strict";n(359)},478:(e,t,n)=>{"use strict";var r=n(210),o=n(924),i=n(631),s=r("%TypeError%"),a=r("%WeakMap%",!0),c=r("%Map%",!0),l=o("WeakMap.prototype.get",!0),u=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),d=o("Map.prototype.get",!0),f=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new s("Side channel does not contain "+i(e))},get:function(r){if(a&&r&&("object"==typeof r||"function"==typeof r)){if(e)return l(e,r)}else if(c){if(t)return d(t,r)}else if(n)return function(e,t){var n=y(e,t);return n&&n.value}(n,r)},has:function(r){if(a&&r&&("object"==typeof r||"function"==typeof r)){if(e)return p(e,r)}else if(c){if(t)return h(t,r)}else if(n)return function(e,t){return!!y(e,t)}(n,r);return!1},set:function(r,o){a&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new a),u(e,r,o)):c?(t||(t=new c),f(t,r,o)):(n||(n={key:{},next:null}),function(e,t,n){var r=y(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,o))}};return r}},250:(e,t,n)=>{"use strict";var r=n(661),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,s=r.useEffect,a=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return a((function(){o.value=n,o.getSnapshot=t,l(o)&&u({inst:o})}),[e,n,t]),s((function(){return l(o)&&u({inst:o}),e((function(){l(o)&&u({inst:o})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},139:(e,t,n)=>{"use strict";var r=n(661),o=n(688),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,a=r.useRef,c=r.useEffect,l=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var p=a(null);if(null===p.current){var d={hasValue:!1,value:null};p.current=d}else d=p.current;p=l((function(){function e(e){if(!c){if(c=!0,s=e,e=r(e),void 0!==o&&d.hasValue){var t=d.value;if(o(t,e))return a=t}return a=e}if(t=a,i(s,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(s=e,a=n)}var s,a,c=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]}),[t,n,r,o]);var f=s(e,p[0],p[1]);return c((function(){d.hasValue=!0,d.value=f}),[f]),u(f),f}},688:(e,t,n)=>{"use strict";e.exports=n(250)},738:(e,t,n)=>{"use strict";e.exports=n(139)},710:e=>{"use strict";e.exports=require("preact")},207:e=>{"use strict";e.exports=require("preact/hooks")},654:()=>{},695:()=>{}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.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 r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>we,AgentInfo:()=>Tp,Chat:()=>Ul,ChatFrame:()=>sp,ComponentFilter:()=>al,Conversation:()=>Tl,DeprecatedToggleButton:()=>Pp,DeprecatedView:()=>$p,Engine:()=>Op,EntryContainer:()=>Qu,EventParticipant:()=>Ys,ExternalApi:()=>Ep,Header:()=>kp,Icon:()=>ba,Interrupt:()=>ap,MessageContainer:()=>ra,SeamlyApiContext:()=>qe,SeamlyEventBusContext:()=>We,SeamlyGeneralError:()=>u,SeamlyLiveRegionContext:()=>hs,SeamlyOfflineError:()=>Jo,Text:()=>Hc,View:()=>yp,calculateVisibility:()=>Ar,className:()=>Qs,default:()=>Hp,eventTypes:()=>Ge,randomId:()=>_,useChoicePrompt:()=>Ta,useEvents:()=>jr,useGeneratedId:()=>Vs,useI18n:()=>fs,useSeamlyActions:()=>zp,useSeamlyChat:()=>bs,useSeamlyCommands:()=>Ki,useSeamlyConfig:()=>br,useSeamlyEventStream:()=>Ws,useSeamlyIdleDetachCountdown:()=>zs,useSeamlyMessageContainerClassNames:()=>ws,useSeamlyOptions:()=>Ds,useSeamlyVisibility:()=>Fi,useTranslatedEventData:()=>Ks,useTranslations:()=>Gs,useTranslationsContainer:()=>Js,visibilityStates:()=>hr});const e=require("preact/jsx-runtime");var t=n(766),o=n.n(t);const i="cvco",s="2",a="seamly-client-participant";class c 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 l extends c{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class u extends c{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class p extends c{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class d extends c{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const f=(e,t)=>{let n;return function(...r){let o=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,o||e.apply(this,r),o=!1}),t),t=>{o=!0,t&&e.apply(this,r)}}},h=e=>Math.ceil(e/1e3),y=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},b=(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]}`},m={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},v={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},g=e=>e.code?v[e.code]:m[e.keyCode],w=e=>{e&&e.focus()},O=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};var j=n(905),x=n.n(j);function _(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function C(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 JSON.parse(n)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}var S=e=>"function"==typeof e?e:function(){return e},E="undefined"!=typeof self?self:null,P="undefined"!=typeof window?window:null,T=E||P||T,k="closed",A="errored",N="joined",I="joining",R="leaving",D="phx_close",M="phx_error",L="phx_reply",U="phx_leave",F=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})}},B=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))}},$=class{static request(e,t,n,r,o,i,s){if(T.XDomainRequest){let n=new T.XDomainRequest;return this.xdomainRequest(n,e,t,r,o,i,s)}{let a=new T.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,o,i,s)}}static xdomainRequest(e,t,n,r,o,i,s){return e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,o,i,s,a){return e.open(t,n,!0),e.timeout=i,e.setRequestHeader("Content-Type",r),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(4===e.readyState&&a){let t=this.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(o),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 o=t?`${t}[${r}]`:r,i=e[r];"object"==typeof i?n.push(this.serialize(i,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}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)}`}},z=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/websocket"),"$1/longpoll")}endpointURL(){return $.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",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){this.ajax("POST",e,(()=>this.onerror("timeout")),(e=>{e&&200===e.status||(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});"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r){let o;o=$.request(e,this.endpointURL(),"application/json",t,this.timeout,(()=>{this.reqs.delete(o),n()}),(e=>{this.reqs.delete(o),this.isActive()&&r(e)})),this.reqs.add(o)}},H={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,o,i,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+n.length+o.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),c=new DataView(a),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,o.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(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.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),o=t.getUint8(2),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(s,s+r));s+=r;let c=n.decode(e.slice(s,s+o));s+=o;let l=n.decode(e.slice(s,s+i));return s+=i,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(a,a+r));a+=r;let l=n.decode(e.slice(a,a+o));a+=o;let u=n.decode(e.slice(a,a+i));a+=i;let p=n.decode(e.slice(a,a+s));a+=s;let d=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:L,payload:{status:p,response:d}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=n.decode(e.slice(i,i+r));i+=r;let a=n.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}};function V(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 q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){W(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G,K,J,X,Q=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};const Y=x()("seamly");class Z{constructor(){G.add(this),K.set(this,[])}connect(e,t,n,r){return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o,params:i}=(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 q(q({},e),{},{[n]:decodeURIComponent(r)})}),{})}})(this.url);this.socket=new 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||T.WebSocket||z,this.establishedConnections=0,this.defaultEncoder=H.encode.bind(H),this.defaultDecoder=H.decode.bind(H),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==z?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;P&&P.addEventListener&&(P.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),P.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.longpollerTimeout=t.longpollerTimeout||2e4,this.params=S(t.params||{}),this.endPoint=`${e}/websocket`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new B((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return z}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=$.appendParams($.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,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=S(e)),this.conn||(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))}log(e,t,n){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((o=>{o.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`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(M)}))}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.joinRef()!==e.joinRef()))}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 class{constructor(e,t,n){this.state=k,this.topic=e,this.params=S(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new F(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new B((()=>{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=N,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=A,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=k,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=A,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 F(this,U,S({}),this.timeout).send(),this.state=A,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(L,((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(D,e)}onError(e){return this.on(M,(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 F(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=R;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(D,"leave")},n=new F(this,U,S({}),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=I,this.joinPush.resend(e))}trigger(e,t,n,r){let o=this.onMessage(e,t,n,r);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter((t=>t.event===e));for(let e=0;e<i.length;e++)i[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===k}isErrored(){return this.state===A}isJoined(){return this.state===N}isJoining(){return this.state===I}isLeaving(){return this.state===R}}(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:o,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${o})`,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:o,join_ref:i}=e;o&&o===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${o&&"("+o+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const s=this.channels[e];s.isMember(t,n,r,i)&&s.trigger(n,r,o,i)}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())}}(o,{params:Object.assign(Object.assign({},i),{v:s})}),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName}),this.start(),this.socket.onError((e=>{Y("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{Y("[SOCKET]OPEN")})),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&Q(this,G,"m",X).call(this,"attach_channel_succeeded")})),this.socket.onClose((()=>{Y("[SOCKET]CLOSE"),Q(this,G,"m",X).call(this,"socket_closed")})),this.channel.onClose((()=>{Y("[CHANNEL]CLOSE"),Q(this,G,"m",X).call(this,"channel_closed")})),this.channel.onError((e=>{Y("[CHANNEL][ERROR]",e),Q(this,G,"m",X).call(this,"channel_erred")})),Q(this,G,"m",J).call(this,"ack","ui","error","participant","message","service_data","system","info","sync")}))}start(){this.channel.join().receive("ok",(()=>{Y("[CHANNEL][JOIN] OK"),Q(this,G,"m",X).call(this,"join_channel_succeeded")})).receive("error",(e=>{Y("[CHANNEL][JOIN] ERROR",e),Q(this,G,"m",X).call(this,"join_channel_erred"),this.channel.socket.disconnect()})).receive("timeout",(()=>{Y("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){var e,t,n;(function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)})(this,K,[],"f"),null===(e=this.channel)||void 0===e||e.leave(),null===(t=this.socket)||void 0===t||t.remove(this.channel),null===(n=this.socket)||void 0===n||n.disconnect()}onConnection(e){Q(this,K,"f").push(e)}pushToChannel(e,t,n=1e4){this.channel.push(e,t,n)}}K=new WeakMap,G=new WeakSet,J=function(...e){e.forEach((e=>{this.channel.on(e,(t=>{Y("[RECEIVE]",e,t)}))}))},X=function(e){Q(this,K,"f").forEach((t=>t(e)))};var ee,te,ne,re,oe,ie,se,ae,ce,le,ue,pe,de,fe,he,ye=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},be=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},me=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};const ve=x()("seamly");function ge(){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{constructor({layoutMode:e,namespace:t,config:n,context:r}){var o;ee.add(this),te.set(this,void 0),ne.set(this,void 0),re.set(this,void 0),oe.set(this,void 0),this.conversation=new Z,ue.set(this,(e=>e||this.locale)),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.locale?`.${r.locale}`:""}`,n.storageProvider||C),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},be(this,oe,Object.assign(Object.assign({},n),{sendEnvironment:null===(o=n.sendEnvironment)||void 0===o||o,context:Object.assign(Object.assign({},r),{channelName:r.channelName||"web"})}),"f"),be(this,te,!1,"f"),this.connected=!1,this.configReady=!1,be(this,ne,n.externalId,"f"),be(this,re,e,"f"),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getConversationUrl(){return this.store.get("conversationUrl")}hasConversation(){return!!this.getConversationUrl()}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}reset(){return ye(this,void 0,void 0,(function*(){return yield this.disconnect(),this.clearStore(),this.getConfig()}))}disconnect(){var e;return ye(this,void 0,void 0,(function*(){(null===(e=this.conversation)||void 0===e?void 0:e.disconnect)&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}))}getConfig(){return o().post(`${me(this,ee,"m",pe).call(this,"http")}/client/${this.connectionInfo.apiKey}/configs`).set("Content-Type","application/json").query({v:s}).send({context:Object.assign(Object.assign({},me(this,oe,"f").context),{environment:!0===me(this,oe,"f").sendEnvironment?me(this,ee,"m",he).call(this):me(this,oe,"f").sendEnvironment})}).then((({body:e})=>(me(this,ee,"m",de).call(this,e),this.configReady=!0,e.config))).catch((e=>{if(404===e.status)throw new l(e);if(e.status>=500)throw new u(e);throw e}))}getConversation(){return ye(this,void 0,void 0,(function*(){if(!this.hasConversation())return null;try{const{body:e}=yield o().get(`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.history}`).set("Authorization",`Bearer ${me(this,ee,"m",ie).call(this)}`).query({v:s});me(this,ee,"m",de).call(this,e);const{messages:t,participants:n,activeServiceSessionId:r,activeServiceSettings:i,serviceData:a,ui:c,translation:l}=e.history;return{events:t.map((([e,t])=>({type:e,payload:Object.assign(Object.assign({},t),{type:"participant"===e?e:t.type})}))),participants:n,activeServiceSessionId:r,activeServiceSettings:i,serviceData:a,resumeConversationPrompt:!!c&&Boolean(c.resumeConversationPrompt),translationProposal:c.translationProposal,translation:l}}catch(e){if(401===e.status)throw new d(e);if(404===e.status)throw new p(e);if(e.status>=500)throw new u(e);throw e}}))}connect(){return ye(this,void 0,void 0,(function*(){this.connected=!1;let e={};return this.hasConversation()||(e=yield me(this,ee,"m",fe).call(this)),this.conversation.connect(`${me(this,ee,"m",pe).call(this,"ws")}${this.URLS.socket}`,me(this,oe,"f").context.channelName,me(this,ee,"m",ce).call(this),me(this,ee,"m",ie).call(this)),this.conversation.onConnection((e=>{this.connected=["attach_channel_succeeded","join_channel_succeeded"].includes(e),be(this,te,"attach_channel_succeeded"===e,"f")})),me(this,oe,"f").sendEnvironment&&this.send("context",{environment:!0===me(this,oe,"f").sendEnvironment?me(this,ee,"m",he).call(this):me(this,oe,"f").sendEnvironment},!1),e}))}uploadFile(e,t,n,r){const i=new FormData;i.append("upload",e);const s=o().post(`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.uploads}`).set("Authorization",`Bearer ${me(this,ee,"m",ie).call(this)}`).send(i);return s.on("progress",(function(e){const{direction:n,percent:r}=e;"upload"===n&&"function"==typeof t&&t(r)})),s.then((e=>{n&&n(e)})).catch((e=>{if(!r)throw e;r(e.response)})),s}getConversationIntitialState(){return o().get(`${me(this,ee,"m",pe).call(this,"http")}${this.getConversationUrl()}`).set("Authorization",`Bearer ${me(this,ee,"m",ie).call(this)}`).query({v:s}).then((({body:e})=>{return me(this,ee,"m",de).call(this,e),this.userResponded=e.conversation.userResponded,t=e.conversation,n=["accessToken","channelTopic"],Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{});var t,n})).catch((e=>{if(401===e.status)throw new d(e);if(404===e.status)throw new p(e);if(e.status>=500)throw new u(e);throw e}))}getTranslations(e){return ye(this,void 0,void 0,(function*(){try{if(!this.URLS.translations)throw new l;const t=`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.translations}`.replace("{version}",String(2)).replace("{locale}",me(this,ue,"f").call(this,e)),n=o().get(t),{body:r}=yield n;return r.translations}catch(e){if(e.status>=500)throw new u(e);throw e}}))}send(e,t,n=!0){var r;!this.connected||n&&!me(this,te,"f")?null===(r=this.conversation)||void 0===r||r.onConnection((r=>{const o="attach_channel_succeeded"===r;(n?o:"join_channel_succeeded"===r||o)&&this.send(e,t,n)})):(ve("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:o}=t;return o||(o=_()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e){const{locale:t,variables:n}=e,r={};if(t){if("string"!=typeof t)throw new Error("Locale must be a string");r.locale=t}if(n){if("object"!=typeof n)throw new Error("Variables must be an object");r.variables=n}0===Object.keys(r).length&&r.constructor===Object||this.send("context",r,!1)}}te=new WeakMap,ne=new WeakMap,re=new WeakMap,oe=new WeakMap,ue=new WeakMap,ee=new WeakSet,ie=function(){return this.store.get("accessToken")},se=function(e){this.store.set("accessToken",e)},ae=function(e){this.store.set("conversationUrl",e)},ce=function(){return this.store.get("channelTopic")||this.store.get("channelName")},le=function(e){this.store.set("channelTopic",e)},pe=function(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`},de=function({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>Object.assign(Object.assign({},e),{[t]:n})),this.URLS)},fe=function(){var e;return ye(this,void 0,void 0,(function*(){try{const t=o().post(`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.conversations}`).set("Content-Type","application/json").query({v:s}).withCredentials().send({externalId:me(this,ne,"f")||void 0}),{body:n}=yield t,{conversation:r}=n,i=Object.assign({},r);return delete i.accessToken,delete i.channelTopic,me(this,ee,"m",se).call(this,r.accessToken),me(this,ee,"m",le).call(this,r.channelTopic),me(this,ee,"m",de).call(this,n),me(this,ee,"m",ae).call(this,this.URLS.conversation),this.locale=null===(e=r.translation)||void 0===e?void 0:e.locale,this.userResponded=r.userResponded,i}catch(e){if(e.status>=500)throw new u(e);throw e}}))},he=function(){return{clientName:"@seamly/web-ui",clientVariant:me(this,re,"f"),clientVersion:"21.0.0",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:ge(),userAgent:navigator.userAgent,preferredLocale:navigator.language}};var Oe=n(679),je=n.n(Oe),xe=n(710),_e=n(207),Ce=n(688),Se=n(738),Ee=n(661);let Pe=function(e){e()};const Te=()=>Pe,ke=(0,Ee.createContext)(null);function Ae(){return(0,Ee.useContext)(ke)}let Ne=()=>{throw new Error("uSES not initialized!")};const Ie=(e,t)=>e===t;function Re(e=ke){const t=e===ke?Ae:()=>(0,Ee.useContext)(e);return function(e,n=Ie){const{store:r,subscription:o,getServerState:i}=t(),s=Ne(o.addNestedSub,r.getState,i||r.getState,e,n);return(0,Ee.useDebugValue)(s),s}}const De=Re();n(545),n(973);const Me={notify(){},get:()=>[]};const Le="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?Ee.useLayoutEffect:Ee.useEffect;let Ue=null;const Fe=function({store:e,context:t,children:n,serverState:r}){const o=(0,Ee.useMemo)((()=>{const t=function(e,t){let n,r=Me;function o(){s.onStateChange&&s.onStateChange()}function i(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){const e=Te();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const s={addNestedSub:function(e){return i(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=Me)},getListeners:()=>r};return s}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0}}),[e,r]),i=(0,Ee.useMemo)((()=>e.getState()),[e]);Le((()=>{const{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),i!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[o,i]);const s=t||ke;return Ee.default.createElement(s.Provider,{value:o},n)};function Be(e=ke){const t=e===ke?Ae:()=>(0,Ee.useContext)(e);return function(){const{store:e}=t();return e}}const $e=Be();function ze(e=ke){const t=e===ke?$e:Be(e);return function(){return t().dispatch}}const He=ze();var Ve;(e=>{Ne=e})(Se.useSyncExternalStoreWithSelector),(e=>{Ue=e})(Ce.useSyncExternalStore),Ve=Ee.unstable_batchedUpdates,Pe=Ve;const qe=(0,xe.createContext)(null),We=(0,xe.createContext)(null),Ge={info:"info",message:"message",participant:"participant",system:"system"},Ke="text",Je="text",Xe="upload",Qe="received",Ye="read",Ze="custom",et="typing",tt="read",nt="detach_service",rt="dismiss",ot="set_topic",it="set_translation",st="click_cta",at="translation_proposal",ct="assertive",lt="polite",ut={new_topic:"newTopic",new_translation:"newTranslation"},pt="uploads",dt="navigate";function ft(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function ht(e){return!!e&&!!e[en]}function yt(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===tn}(e)||Array.isArray(e)||!!e[Zt]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Zt])||Ot(e)||jt(e))}function bt(e,t,n){void 0===n&&(n=!1),0===mt(e)?(n?Object.keys:nn)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function mt(e){var t=e[en];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Ot(e)?2:jt(e)?3:0}function vt(e,t){return 2===mt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function gt(e,t,n){var r=mt(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function wt(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Ot(e){return Jt&&e instanceof Map}function jt(e){return Xt&&e instanceof Set}function xt(e){return e.o||e.t}function _t(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=rn(e);delete t[en];for(var n=nn(t),r=0;r<n.length;r++){var o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Ct(e,t){return void 0===t&&(t=!1),Et(e)||ht(e)||!yt(e)||(mt(e)>1&&(e.set=e.add=e.clear=e.delete=St),Object.freeze(e),t&&bt(e,(function(e,t){return Ct(t,!0)}),!0)),e}function St(){ft(2)}function Et(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Pt(e){var t=on[e];return t||ft(18,e),t}function Tt(){return Gt}function kt(e,t){t&&(Pt("Patches"),e.u=[],e.s=[],e.v=t)}function At(e){Nt(e),e.p.forEach(Rt),e.p=null}function Nt(e){e===Gt&&(Gt=e.l)}function It(e){return Gt={p:[],l:Gt,h:e,m:!0,_:0}}function Rt(e){var t=e[en];0===t.i||1===t.i?t.j():t.O=!0}function Dt(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||Pt("ES5").S(t,e,r),r?(n[en].P&&(At(t),ft(4)),yt(e)&&(e=Mt(t,e),t.l||Ut(t,e)),t.u&&Pt("Patches").M(n[en].t,e,t.u,t.s)):e=Mt(t,n,[]),At(t),t.u&&t.v(t.u,t.s),e!==Yt?e:void 0}function Mt(e,t,n){if(Et(t))return t;var r=t[en];if(!r)return bt(t,(function(o,i){return Lt(e,r,t,o,i,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return Ut(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=_t(r.k):r.o;bt(3===r.i?new Set(o):o,(function(t,i){return Lt(e,r,o,t,i,n)})),Ut(e,o,!1),n&&e.u&&Pt("Patches").R(r,n,e.u,e.s)}return r.o}function Lt(e,t,n,r,o,i){if(ht(o)){var s=Mt(e,o,i&&t&&3!==t.i&&!vt(t.D,r)?i.concat(r):void 0);if(gt(n,r,s),!ht(s))return;e.m=!1}if(yt(o)&&!Et(o)){if(!e.h.F&&e._<1)return;Mt(e,o),t&&t.A.l||Ut(e,o)}}function Ut(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Ct(t,n)}function Ft(e,t){var n=e[en];return(n?xt(n):e)[t]}function Bt(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function $t(e){e.P||(e.P=!0,e.l&&$t(e.l))}function zt(e){e.o||(e.o=_t(e.t))}function Ht(e,t,n){var r=Ot(t)?Pt("MapSet").N(t,n):jt(t)?Pt("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:Tt(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,i=sn;n&&(o=[r],i=an);var s=Proxy.revocable(o,i),a=s.revoke,c=s.proxy;return r.k=c,r.j=a,c}(t,n):Pt("ES5").J(t,n);return(n?n.A:Tt()).p.push(r),r}function Vt(e){return ht(e)||ft(22,e),function e(t){if(!yt(t))return t;var n,r=t[en],o=mt(t);if(r){if(!r.P&&(r.i<4||!Pt("ES5").K(r)))return r.t;r.I=!0,n=qt(t,o),r.I=!1}else n=qt(t,o);return bt(n,(function(t,o){r&&function(e,t){return 2===mt(e)?e.get(t):e[t]}(r.t,t)===o||gt(n,t,e(o))})),3===o?new Set(n):n}(e)}function qt(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return _t(e)}var Wt,Gt,Kt="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Jt="undefined"!=typeof Map,Xt="undefined"!=typeof Set,Qt="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Yt=Kt?Symbol.for("immer-nothing"):((Wt={})["immer-nothing"]=!0,Wt),Zt=Kt?Symbol.for("immer-draftable"):"__$immer_draftable",en=Kt?Symbol.for("immer-state"):"__$immer_state",tn=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(e){var t={};return nn(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},on={},sn={get:function(e,t){if(t===en)return e;var n=xt(e);if(!vt(n,t))return function(e,t,n){var r,o=Bt(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!yt(r)?r:r===Ft(e.t,t)?(zt(e),e.o[t]=Ht(e.A.h,r,e)):r},has:function(e,t){return t in xt(e)},ownKeys:function(e){return Reflect.ownKeys(xt(e))},set:function(e,t,n){var r=Bt(xt(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=Ft(xt(e),t),i=null==o?void 0:o[en];if(i&&i.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(wt(n,o)&&(void 0!==n||vt(e.t,t)))return!0;zt(e),$t(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==Ft(e.t,t)||t in e.t?(e.D[t]=!1,zt(e),$t(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=xt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){ft(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ft(12)}},an={};bt(sn,(function(e,t){an[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),an.deleteProperty=function(e,t){return an.set.call(this,e,t,void 0)},an.set=function(e,t,n){return sn.set.call(this,e[0],t,n,e[0])};var cn=function(){function e(e){var t=this;this.g=Qt,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var i=t;return function(e){var t=this;void 0===e&&(e=o);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return i.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&ft(6),void 0!==r&&"function"!=typeof r&&ft(7),yt(e)){var a=It(t),c=Ht(t,e,void 0),l=!0;try{s=n(c),l=!1}finally{l?At(a):Nt(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return kt(a,r),Dt(e,a)}),(function(e){throw At(a),e})):(kt(a,r),Dt(s,a))}if(!e||"object"!=typeof e){if(void 0===(s=n(e))&&(s=e),s===Yt&&(s=void 0),t.F&&Ct(s,!0),r){var u=[],p=[];Pt("Patches").M(e,s,u,p),r(u,p)}return s}ft(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var r,o,i=t.produce(e,n,(function(e,t){r=e,o=t}));return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return[e,r,o]})):[i,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){yt(e)||ft(8),ht(e)&&(e=Vt(e));var t=It(this),n=Ht(this,e,void 0);return n[en].C=!0,Nt(t),n},t.finishDraft=function(e,t){var n=(e&&e[en]).A;return kt(n,t),Dt(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Qt&&ft(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var o=Pt("Patches").$;return ht(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),ln=new cn,un=ln.produce;ln.produceWithPatches.bind(ln),ln.setAutoFreeze.bind(ln),ln.setUseProxies.bind(ln),ln.applyPatches.bind(ln),ln.createDraft.bind(ln),ln.finishDraft.bind(ln);const pn=un;function dn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fn(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 hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){dn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yn(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 bn="function"==typeof Symbol&&Symbol.observable||"@@observable",mn=function(){return Math.random().toString(36).substring(7).split("").join(".")},vn={INIT:"@@redux/INIT"+mn(),REPLACE:"@@redux/REPLACE"+mn(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+mn()}};function gn(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function wn(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(yn(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(yn(1));return n(wn)(e,t)}if("function"!=typeof e)throw new Error(yn(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(yn(3));return i}function p(e){if("function"!=typeof e)throw new Error(yn(4));if(c)throw new Error(yn(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(yn(6));t=!1,l();var n=a.indexOf(e);a.splice(n,1),s=null}}}function d(e){if(!gn(e))throw new Error(yn(7));if(void 0===e.type)throw new Error(yn(8));if(c)throw new Error(yn(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(yn(10));o=e,d({type:vn.REPLACE})}function h(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(yn(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[bn]=function(){return this},e}return d({type:vn.INIT}),(r={dispatch:d,subscribe:p,getState:u,replaceReducer:f})[bn]=h,r}function On(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function jn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(yn(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return r=On.apply(void 0,i)(n.dispatch),hn(hn({},n),{},{dispatch:r})}}}function xn(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var _n=xn();_n.withExtraArgument=xn;const Cn=_n;var Sn,En=(Sn=function(e,t){return Sn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Sn(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Sn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Pn=function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},Tn=Object.defineProperty,kn=Object.defineProperties,An=Object.getOwnPropertyDescriptors,Nn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,Dn=function(e,t,n){return t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Mn=function(e,t){for(var n in t||(t={}))In.call(t,n)&&Dn(e,n,t[n]);if(Nn)for(var r=0,o=Nn(t);r<o.length;r++)n=o[r],Rn.call(t,n)&&Dn(e,n,t[n]);return e},Ln=function(e,t){return kn(e,An(t))},Un="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?On:On.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Fn=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return En(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Pn([void 0],e[0].concat(this)))):new(t.bind.apply(t,Pn([void 0],e.concat(this))))},t}(Array);function Bn(e){return yt(e)?pn(e,(function(){})):e}function $n(e){var t,n=function(e){return function(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=(e.immutableCheck,e.serializableCheck,new Fn);return n&&(function(e){return"boolean"==typeof e}(n)?r.push(Cn):r.push(Cn.withExtraArgument(n.extraArgument))),r}(e)},r=e||{},o=r.reducer,i=void 0===o?void 0:o,s=r.middleware,a=void 0===s?n():s,c=r.devTools,l=void 0===c||c,u=r.preloadedState,p=void 0===u?void 0:u,d=r.enhancers,f=void 0===d?void 0:d;if("function"==typeof i)t=i;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,s=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:vn.INIT}))throw new Error(yn(12));if(void 0===n(void 0,{type:vn.PROBE_UNKNOWN_ACTION()}))throw new Error(yn(13))}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},a=0;a<s.length;a++){var c=s[a],l=n[c],u=e[c],p=l(u,t);if(void 0===p)throw t&&t.type,new Error(yn(14));o[c]=p,r=r||p!==u}return(r=r||s.length!==Object.keys(e).length)?o:e}}(i)}var h=a;"function"==typeof h&&(h=h(n));var y=jn.apply(void 0,h),b=On;l&&(b=Un(Mn({trace:!1},"object"==typeof l&&l)));var m=[y];return Array.isArray(f)?m=Pn([y],f):"function"==typeof f&&(m=f(m)),wn(t,p,b.apply(void 0,m))}function zn(e,t){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Mn(Mn({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function Hn(e){var t,n={},r=[],o={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(r in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[r]=t,o},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,r,t]}function Vn(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,r="function"==typeof e.initialState?e.initialState:Bn(e.initialState),o=e.reducers||{},i=Object.keys(o),s={},a={},c={};function l(){var t="function"==typeof e.extraReducers?Hn(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,i=t[1],s=void 0===i?[]:i,c=t[2],l=void 0===c?void 0:c,u=Mn(Mn({},o),a);return function(e,t,n,r){void 0===n&&(n=[]);var o,i=Hn(t),s=i[0],a=i[1],c=i[2];if(function(e){return"function"==typeof e}(e))o=function(){return Bn(e())};else{var l=Bn(e);o=function(){return l}}function u(e,t){void 0===e&&(e=o());var n=Pn([s[t.type]],a.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){var r;if(ht(e))return void 0===(r=n(e,t))?e:r;if(yt(e))return pn(e,(function(e){return n(e,t)}));if(void 0===(r=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e}),e)}return u.getInitialState=o,u}(r,(function(e){for(var t in u)e.addCase(t,u[t]);for(var n=0,r=s;n<r.length;n++){var o=r[n];e.addMatcher(o.matcher,o.reducer)}l&&e.addDefaultCase(l)}))}return i.forEach((function(e){var n,r,i=o[e],l=function(e,t){return e+"/"+t}(t,e);"reducer"in i?(n=i.reducer,r=i.prepare):n=i,s[e]=n,a[l]=n,c[e]=r?zn(l,r):zn(l)})),{name:t,reducer:function(e,t){return n||(n=l()),n(e,t)},actions:c,caseReducers:s,getInitialState:function(){return n||(n=l()),n.getInitialState()}}}var qn=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},Wn=["name","message","stack","code"],Gn=function(e,t){this.payload=e,this.meta=t},Kn=function(e,t){this.payload=e,this.meta=t},Jn=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,r=Wn;n<r.length;n++){var o=r[n];"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}},Xn=function(){function e(e,t,n){var r=zn(e+"/fulfilled",(function(e,t,n,r){return{payload:e,meta:Ln(Mn({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}})),o=zn(e+"/pending",(function(e,t,n){return{payload:void 0,meta:Ln(Mn({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),i=zn(e+"/rejected",(function(e,t,r,o,i){return{payload:o,error:(n&&n.serializeError||Jn)(e||"Rejected"),meta:Ln(Mn({},i||{}),{arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),s="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,c,l){var u,p=(null==n?void 0:n.idGenerator)?n.idGenerator(e):qn(),d=new s,f=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:u||"Aborted"})}))})),h=!1;function y(e){h&&(u=e,d.abort())}var b=function(){return s=this,u=null,b=function(){var s,u,b,m,v;return function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(g){switch(g.label){case 0:return g.trys.push([0,4,,5]),null===(w=m=null==(s=null==n?void 0:n.condition)?void 0:s.call(n,e,{getState:c,extra:l}))||"object"!=typeof w||"function"!=typeof w.then?[3,2]:[4,m];case 1:m=g.sent(),g.label=2;case 2:if(!1===m)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return h=!0,a(o(p,e,null==(u=null==n?void 0:n.getPendingMeta)?void 0:u.call(n,{requestId:p,arg:e},{getState:c,extra:l}))),[4,Promise.race([f,Promise.resolve(t(e,{dispatch:a,getState:c,extra:l,requestId:p,signal:d.signal,abort:y,rejectWithValue:function(e,t){return new Gn(e,t)},fulfillWithValue:function(e,t){return new Kn(e,t)}})).then((function(t){if(t instanceof Gn)throw t;return t instanceof Kn?r(t.payload,p,e,t.meta):r(t,p,e)}))])];case 3:return b=g.sent(),[3,5];case 4:return v=g.sent(),b=v instanceof Gn?i(null,p,e,v.payload,v.meta):i(v,p,e),[3,5];case 5:return n&&!n.dispatchConditionRejection&&i.match(b)&&b.meta.condition||a(b),[2,b]}var w}))},new Promise((function(e,t){var n=function(e){try{o(b.next(e))}catch(e){t(e)}},r=function(e){try{o(b.throw(e))}catch(e){t(e)}},o=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,r)};o((b=b.apply(s,u)).next())}));var s,u,b}();return Object.assign(b,{abort:y,requestId:p,arg:e,unwrap:function(){return b.then(Qn)}})}}),{pending:o,rejected:i,fulfilled:r,typePrefix:e})}return e.withTypes=e,e}();function Qn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Yn=function(e,t){return function(e){return e&&"function"==typeof e.match}(e)?e.match(t):e(t)};function Zn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return e.some((function(e){return Yn(e,t)}))}}Object.assign;var er="listenerMiddleware";zn(er+"/add"),zn(er+"/removeAll"),zn(er+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:n.g),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[en];return sn.get(t,e)},set:function(t){var n=this[en];sn.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][en];if(!o.P)switch(o.i){case 5:r(o)&&$t(o);break;case 4:n(o)&&$t(o)}}}function n(e){for(var t=e.t,n=e.k,r=nn(n),o=r.length-1;o>=0;o--){var i=r[o];if(i!==en){var s=t[i];if(void 0===s&&!vt(t,i))return!0;var a=n[i],c=a&&a[en];if(c?c.t!==s:!wt(a,s))return!0}}var l=!!t[en];return r.length!==nn(t).length+(l?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var o={};!function(e,t){on[e]||(on[e]=t)}("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var i=rn(n);delete i[en];for(var s=nn(i),a=0;a<s.length;a++){var c=s[a];i[c]=e(c,t||!!i[c].enumerable)}return Object.create(Object.getPrototypeOf(n),i)}(r,t),i={i:r?5:4,A:n?n.A:Tt(),P:!1,I:!1,D:{},l:n,t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,en,{value:i,writable:!0}),o},S:function(e,n,o){o?ht(n)&&n[en].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[en];if(n){var o=n.t,i=n.k,s=n.D,a=n.i;if(4===a)bt(i,(function(t){t!==en&&(void 0!==o[t]||vt(o,t)?s[t]||e(i[t]):(s[t]=!0,$t(n)))})),bt(o,(function(e){void 0!==i[e]||vt(i,e)||(s[e]=!1,$t(n))}));else if(5===a){if(r(n)&&($t(n),s.length=!0),i.length<o.length)for(var c=i.length;c<o.length;c++)s[c]=!1;else for(var l=o.length;l<i.length;l++)s[l]=!0;for(var u=Math.min(i.length,o.length),p=0;p<u;p++)i.hasOwnProperty(p)||(s[p]=!0),void 0===s[p]&&e(i[p])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}();class tr extends c{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}var nr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const rr=Xn("initializeConfig",((e,{extra:{api:t,config:n},rejectWithValue:r})=>nr(void 0,void 0,void 0,(function*(){var e;try{const{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c}=yield t.getConfig(),l=(null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.locale)||o,{connectWhenInView:u}=n;return{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c,locale:l,connectWhenInView:u}}catch(e){return r(e)}})))),or=Xn("resetConfig",((e,{extra:{config:t}})=>nr(void 0,void 0,void 0,(function*(){return t}))));const ir=Xn("setLocale",((e,{extra:{api:t},rejectWithValue:n})=>function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){try{return{translations:yield t.getTranslations(e),locale:e}}catch(e){return n(e)}}))),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,locale:r}}=t();return e!==r&&!n}});var sr="NOT_FOUND",ar=function(e,t){return e===t};function cr(e,t){var n,r,o="object"==typeof t?t:{equalityCheck:t},i=o.equalityCheck,s=void 0===i?ar:i,a=o.maxSize,c=void 0===a?1:a,l=o.resultEqualityCheck,u=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(s),p=1===c?(n=u,{get:function(e){return r&&n(r.key,e)?r.value:sr},put:function(e,t){r={key:e,value:t}},getEntries:function(){return r?[r]:[]},clear:function(){r=void 0}}):function(e,t){var n=[];function r(e){var r=n.findIndex((function(n){return t(e,n.key)}));if(r>-1){var o=n[r];return r>0&&(n.splice(r,1),n.unshift(o)),o.value}return sr}return{get:r,put:function(t,o){r(t)===sr&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(c,u);function d(){var t=p.get(arguments);if(t===sr){if(t=e.apply(null,arguments),l){var n=p.getEntries(),r=n.find((function(e){return l(e.value,t)}));r&&(t=r.value)}p.put(arguments,t)}return t}return d.clearCache=function(){return p.clear()},d}function lr(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return"function"==typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+n+"]")}return t}function ur(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var i,s=0,a={memoizeOptions:void 0},c=r.pop();if("object"==typeof c&&(a=c,c=r.pop()),"function"!=typeof c)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof c+"]");var l=a,u=l.memoizeOptions,p=void 0===u?n:u,d=Array.isArray(p)?p:[p],f=lr(r),h=e.apply(void 0,[function(){return s++,c.apply(null,arguments)}].concat(d)),y=e((function(){for(var e=[],t=f.length,n=0;n<t;n++)e.push(f[n].apply(null,arguments));return i=h.apply(null,e)}));return Object.assign(y,{resultFunc:c,memoizedResultFunc:h,dependencies:f,lastResult:function(){return i},recomputations:function(){return s},resetRecomputations:function(){return s=0}}),y};return o}var pr=ur(cr);const dr=pr((({app:e})=>e),(({userHasResponded:e})=>e)),fr="visibility",hr={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},yr=pr((({config:e})=>e),(e=>{let t=Object.assign({visible:"inline"===(null==e?void 0:e.layoutMode)?hr.open:hr.minimized,appContainerClassNames:e.appContainerClassNames||[]},e);return"function"==typeof t.appContainerClassNames&&(t=Object.assign(Object.assign({},t),{appContainerClassNames:t.appContainerClassNames(t)})),t})),br=()=>De(yr);function mr(){const{startChatIcon:e}=br();return e}const vr=({state:e})=>e,gr=()=>De(vr),wr=pr(vr,yr,dr,(({events:e,serviceData:t},n,r)=>{var o;if(r||"inline"===n.layoutMode||!(null==t?void 0:t.suggestion)||!(null===(o=null==t?void 0:t.suggestion)||void 0===o?void 0:o.body.length))return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),Or=pr(wr,yr,((e,t)=>{var n,r;const{enabled:o,threshold:i}=null!==(r=null===(n=null==t?void 0:t.messages)||void 0===n?void 0:n.timeIndicator)&&void 0!==r?r:{};if(!o)return e;const s=[];let a=null;return e.forEach(((e,t)=>{if(0===t)s.push(Object.assign(Object.assign({},e),{timeIndicator:e.payload.occurredAt}));else{const t=a&&h(e.payload.occurredAt-a.payload.occurredAt)>=i?e.payload.occurredAt:void 0;s.push(Object.assign(Object.assign({},e),{timeIndicator:t}))}a=e})),s})),jr=()=>De(Or),xr=(pr(Or,(e=>e.map((e=>e.payload.id)))),()=>gr().isLoading),_r=()=>gr().headerTitles,Cr=()=>gr().unreadEvents,Sr=()=>gr().skiplinkTargetId,Er=pr(Or,(e=>{var t;const n=e.filter((e=>"message"===e.type));return null===(t=n[n.length-1])||void 0===t?void 0:t.payload.id})),Pr=()=>{const{participants:e,currentAgent:t}=gr().participantInfo;return t?e[t]:null},Tr=e=>gr().serviceData[e],kr=()=>{const{layoutMode:e}=br();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},Ar=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=r,{visible:a}=o||{};if("app"===i&&!t)return hr.open;if("window"===i&&s&&n!==hr.open)return e?n||t||hr.open:hr.hidden;if("inline"===i&&e&&!n)return t||hr.open;const c=hr.minimized;return n||t||a||c},Nr=pr((({visibility:e})=>e),(e=>e.visibility)),Ir=pr((({visibility:e})=>e),(e=>e.showInlineView));const Rr=[hr.open,hr.minimized,hr.hidden],Dr=Xn("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),i=Nr(o),s=dr(o),a=n.hasConversation(),c=yr(o),{visibilityCallback:l=Ar,layoutMode:u}=c,{unreadEvents:p}=vr(o),d=l({hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(Rr.includes(d)){if(i!==d)return n.store.set(fr,Object.assign(Object.assign({},n.store.get(fr)||{}),{[u]:e})),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:p}),d}else console.error('The visibilityCallback function should return "open", "minimized" or "hidden".')})),Mr=Xn("initialize",((e,{dispatch:t,getState:n,extra:{api:r}})=>function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){var e;const{layoutMode:o}=yr(n()),i=(null===(e=r.store.get(fr))||void 0===e?void 0:e[o])||hr.initialize;return t(Dr(i)),i}))));var Lr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const Ur=Xn("initializeApp",((e,{extra:{api:t,config:n},rejectWithValue:r})=>Lr(void 0,void 0,void 0,(function*(){var e,o,i,s;let a=null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.locale;try{if(t.hasConversation()){const e=yield t.getConversationIntitialState();return a=(null===(o=e.translation)||void 0===o?void 0:o.locale)||a,{initialState:e,locale:a,config:n}}return(null===(i=null==n?void 0:n.context)||void 0===i?void 0:i.topic)&&t.send("action",{type:ot,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),(null===(s=null==n?void 0:n.context)||void 0===s?void 0:s.translationLocale)&&(a=n.context.translationLocale,t.send("action",{type:it,body:{enabled:!0,locale:a}},!1)),{initialState:void 0,locale:a,config:n}}catch(e){if(e instanceof p){const e=new p;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new tr;return r({name:t.name,message:t.message,langKey:t.langKey})}})))),Fr=Xn("resetApp",((e,{dispatch:t,extra:{api:n}})=>Lr(void 0,void 0,void 0,(function*(){yield n.disconnect(),yield n.clearStore(),t(or()),yield t(rr());try{const{locale:e}=yield t(Ur()).unwrap();yield t(ir(e))}catch(e){}t(Mr())})))),Br=()=>De(dr),$r={userHasResponded:!1},zr=Vn({name:"app",initialState:$r,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(Fr.pending,(()=>$r)).addCase(Ur.fulfilled,((e,{payload:t})=>{var n;t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=null===(n=t.initialState)||void 0===n?void 0:n.userResponded)}))}}),{setHasResponded:Hr}=zr.actions,Vr=zr.reducer,qr={error:void 0},Wr=Vn({name:"interrupt",initialState:qr,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>qr},extraReducers:e=>{e.addCase(Fr.fulfilled,(()=>qr)).addMatcher(Zn(Ur.rejected,rr.rejected,ir.rejected,Dr.rejected,Mr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Gr,clearInterrupt:Kr}=Wr.actions,Jr=Wr.reducer,Xr=({type:e,payload:t})=>e===Ge.message&&!t.fromClient||e===Ge.info&&t.type===Ke,Qr=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),Yr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:i,introduction:s}=t.participant,a=n[r],c=Object.assign(Object.assign({},n),{[r]:a?Object.assign(Object.assign(Object.assign(Object.assign({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return Object.assign(Object.assign({},e),{participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r})},Zr=(e,t)=>{const n="message"===(null==t?void 0:t.type)?null==t?void 0:t.payload.entry:{},{blockAutoEntrySwitch:r}=e;if(!n)return Object.assign(Object.assign({},e),{optionsOverride:{}});const{type:o,options:i}=n;let s=e.active;return r||o===e.userSelected||(s=o),Object.assign(Object.assign({},e),{active:s,optionsOverride:Object.assign(Object.assign({},e.optionsOverride),{[o]:i||{}})})},eo={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:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:_(),optionsButtonId:_(),headerCollapseButtonId:_(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],entryMeta:{default:Je,active:Je,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{}},seamlyContainerElement:null},to=Vn({name:"store",initialState:eo,reducers:{addEvent:(e,t)=>{var n,r;const{type:o,payload:i}=t.payload,s=e.options.features.hasOwnProperty(pt);let a=Object.assign({},e.options);if(s&&(o===Ge.message||o===Ge.participant)&&!i.fromClient){const e="message"===o?null===(n=i.entry)||void 0===n?void 0:n.type:{};a=Object.assign(Object.assign({},a),{features:Object.assign(Object.assign({},a.features),{uploads:Object.assign(Object.assign({},null===(r=a.features)||void 0===r?void 0:r.uploads),{enabledFromEntry:e===Xe})})})}const c=Xr(t.payload);if(e.events.find((e=>e.payload.id===i.id)))return;const l=Zr(e.entryMeta,t.payload);e.entryMeta=s||l.active!==Xe?l:Object.assign({},e.entryMeta),e.options=a,c&&(e.unreadEvents+=1,"service_data"!==o&&(t.payload.payload.messageStatus=i.fromClient?Ye:Qe)),t.payload.payload.key=_(),e.events.push(t.payload),e.isLastEventFromClient=i.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:o}=t;n&&(n.payload.id=r,n.payload.occurredAt=o,e.events=Qr(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(-1!==t.indexOf(e.payload.id)&&(e.payload=Object.assign(Object.assign({},e.payload),"service_data"!==e.type&&e.payload.messageStatus===Qe&&{messageStatus:Ye})),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o={},serviceData:i,resumeConversationPrompt:s}})=>{var a,c;const l=((e,t)=>{const n=e.filter((e=>!t.some((t=>t.payload.id===e.payload.id)))),r=t.filter((e=>!("participant"===e.type&&!e.payload.participant.introduction))).reverse();return Qr([...r,...n])})(e.events,t),u=Object.assign(Object.assign({},e.participantInfo.participants),n),p=l.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let d=null;p&&("message"===p.type&&(d=p.payload.participant),"participant"===p.type&&(d=p.payload.participant.id));const{entry:f}=o,h=null===(a=null==f?void 0:f.options)||void 0===a?void 0:a.upload,y=Zr(Object.assign(Object.assign(Object.assign({},e.entryMeta),f),{active:(null==f?void 0:f.default)||Ke,options:Object.assign({},(null==f?void 0:f.options)?f.options:{})}),l[l.length-1]);let b=Object.assign({},e.options.features);const m=b.hasOwnProperty(pt);if(m&&"message"===(null==p?void 0:p.type)){const{payload:e}=p,t=(null===(c=null==e?void 0:e.entry)||void 0===c?void 0:c.type)||{};b=Object.assign(Object.assign({},b),{uploads:{enabled:!(!h||!(null==h?void 0:h.enabled)),enabledFromEntry:t===Xe}})}e.unreadEvents=l.filter((e=>"message"===e.type&&e.payload.messageStatus===Qe)).length,e.events=l.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),e.participantInfo=Object.assign(Object.assign(Object.assign({},e.participantInfo),d?Yr(e.participantInfo,{participant:u[d]}):{}),{participants:u}),e.historyLoaded=!0,e.serviceInfo=Object.assign(Object.assign({},e.serviceInfo),{activeServiceSessionId:r}),e.serviceData=Object.assign(Object.assign({},e.serviceData),i),e.options=Object.assign(Object.assign({},e.options),{features:b||{}}),e.entryMeta=m||y.active!==Xe?y:Object.assign({},e.entryMeta),e.resumeConversationPrompt=s||!1,d&&(e.headerTitles.subTitle=u[d].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}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=y(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.initialState,e.unreadEvents=eo.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={}},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={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},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?Object.assign(Object.assign({},e),{progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}):e))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?Object.assign(Object.assign({},e),{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?Object.assign(Object.assign({},e),{complete:!0}):e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t}},extraReducers:e=>{e.addCase(Fr.pending,(()=>eo)).addCase(rr.fulfilled,((e,{payload:t})=>{var n;e.headerTitles.subTitle=null===(n=t.agentParticipant)||void 0===n?void 0:n.name,t.features&&(e.options.features=t.features)})).addCase(Ur.fulfilled,((e,{payload:t})=>{t.initialState&&(e.initialState=t.initialState)})).addMatcher(Zn(po,fo),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:no,addEvent:ro,clearAllUploads:oo,clearEvents:io,clearFeatures:so,clearIdleDetachCountdown:ao,clearResumeConversationPrompt:co,decrementIdleDetachCountdownCounter:lo,hideOption:uo,initIdleDetachCountdown:po,initResumeConversationPrompt:fo,registerUpload:ho,resetHistoryLoadedFlag:yo,setActiveEntryType:bo,setActiveService:mo,setBlockAutoEntrySwitch:vo,setEventsRead:go,setFeatureEnabledState:wo,setFeatures:Oo,setHeaderSubTitle:jo,setHeaderTitle:xo,setHistory:_o,setInitialState:Co,setIsLoading:So,setLoadedImageEventIds:Eo,setParticipant:Po,setSeamlyContainerElement:To,setServiceDataItem:ko,setServiceEntryMetadata:Ao,setUploadComplete:No,setUploadError:Io,setUploadProgress:Ro,setUserEntryType:Do,setUserSelectedOption:Mo,setUserSelectedOptions:Lo,showOption:Uo,stopIdleDetachCountdownCounter:Fo}=to.actions,Bo=to.reducer;const $o=Object.assign(Object.assign({},{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},hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showFaq:!1,showSuggestions:!0,customComponents:{},defaults:{visible:null},preChatEvents:[]}),zo=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showFaq","showSuggestions","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon"],Ho=(e,t)=>{const n=(i=t,zo.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:r}=n,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["messages"]);var i;let s=e;return Object.keys(o).length>0&&(s=Object.assign(Object.assign({},s),o)),r&&(s=Object.assign(Object.assign({},s),{messages:Object.assign(Object.assign({},s.messages),r)})),s},Vo=Vn({name:"config",initialState:$o,reducers:{setConfig:(e,{payload:t})=>Ho(e,t),updateConfig:(e,{payload:t})=>Ho(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(or.fulfilled,(e=>e)).addCase(rr.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o}))}}),{setConfig:qo,updateConfig:Wo,setPreChatEvents:Go}=Vo.actions,Ko=Vo.reducer;class Jo extends c{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const Xo={SeamlyGeneralError:u,SeamlyConfigurationError:l,SeamlySessionExpiredError:p,SeamlyOfflineError:Jo,SeamlyUnauthorizedError:d,SeamlyUnavailableError:tr},Qo=zn("catch-error",(e=>({payload:e})));function Yo({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:o,api:i,layoutMode:s}=yr(t()),{error:a,type:l}=n,u=Xo[null==a?void 0:a.name]?new Xo[a.name](a):new c(a);null==r||r(u,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{var r,o,i,s,a,c;try{return(null===(o=null===(r=t.payload)||void 0===r?void 0:r.originalEvent)||void 0===o?void 0:o.payload)?n({error:t.payload,type:null===(a=null===(s=null===(i=t.payload)||void 0===i?void 0:i.originalEvent)||void 0===s?void 0:s.payload)||void 0===a?void 0:a.type}):(null===(c=t.payload)||void 0===c?void 0:c.originalError)&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}const Zo={controls:{}},ei={value:"",touched:!1},ti={controls:ei},ni=Vn({name:"forms",initialState:ti,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{var r;const o=t&&null!==(r=e[n])&&void 0!==r?r:Object.assign(Object.assign({},Zo),{persistData:t});e[n]=o},deregisterForm:(e,{payload:{formId:t}})=>{var n;return(null===(n=e[t])||void 0===n?void 0:n.persistData)||delete e[t],e},registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:ei}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o=Object.assign({},r.controls);return delete o[t],Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},r),{controls:o})})},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls)&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls[n])&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(Fr.pending,(()=>ti))}}),{registerForm:ri,deregisterForm:oi,registerControl:ii,deregisterControl:si,updateControlValue:ai,updateControlTouched:ci}=ni.actions,li=ni.reducer,ui=Vn({name:"app",initialState:{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,locale:void 0},reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(rr.fulfilled,((e,{payload:t})=>{e.initialLocale=t.locale})).addCase(ir.pending,(e=>{e.isLoading=!0})).addCase(ir.rejected,(e=>{e.isLoading=!1})).addCase(ir.fulfilled,((e,{payload:t})=>{e.isLoading=!1,(null==t?void 0:t.translations)&&(e.locale=t.locale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t.translations[n]})),{}))}))}}),{setInitialLocale:pi,setTranslations:di}=ui.actions,fi=ui.reducer,hi=[u,l,p,Jo,d,tr];function yi({api:e}){return()=>t=>n=>{const{payload:r,type:o}=n;if(o===Gr.type){if(!hi.some((e=>r.name===e.name)))throw new u(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}function bi(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 mi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach((function(t){vi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gi({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case Lo.toString():e.store.set("options",n.payload);break;case Mo.toString():e.store.set("options",mi(mi({},e.store.get("options")||{}),{},{[n.payload.option]:n.payload.value}))}return r}}const wi=pr((({i18n:e})=>e),(({translations:e})=>e)),Oi=pr((({i18n:e})=>e),(({initialLocale:e})=>e)),ji=pr((({i18n:e})=>e),(({locale:e})=>e)),xi=pr((({i18n:e})=>e),(({isLoading:e})=>e)),_i={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:qn(),translatedEventGroups:{},translationProposal:null},Ci=(e,t)=>{const n=[...e].reduce(((e,{payload:n},r,o)=>{var i;if(e[t]){if("divider"===(null==n?void 0:n.type)&&(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.translationEnabled))return o.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,o]]=Object.entries(n);return{lastGroupId:e.filter((e=>{var t;return"divider"===(null===(t=e.payload)||void 0===t?void 0:t.type)})).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},Si=Vn({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}=Ci(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:i}=Ci(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=i},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(rr.fulfilled,((e,{payload:t})=>{var n;const r=null===(n=null==t?void 0:t.features)||void 0===n?void 0:n.translation;r&&(e.isAvailable=!0===r.enabled,e.languages=r.languages)})).addCase(_o,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(ro,((e,{payload:t})=>{e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:Ei,disableTranslation:Pi,enableEventsTranslation:Ti,disableEventsTranslation:ki,setTranslationProposalPrompt:Ai,disableTranslationProposalPrompt:Ni}=Si.actions,Ii=Si.reducer;function Ri({dispatch:e,getState:t}){return n=>r=>{const o=n(r),{payload:i}=r;switch(r.type){case _o.type:i?.translation?.enabled&&(e(Ei(i.translation.locale)),e(ir(i.translation.locale)));break;case rr.fulfilled.type:i.locale&&e(ir(i.locale));break;case Co.type:i?.translation?.enabled&&(e(Ei(i.translation.locale)),e(ir(i.locale)));break;case ro.type:"info"===i.type&&"new_translation"===i?.payload?.body?.subtype&&i.payload.body.translationEnabled&&e(ir(i.payload.body.translationLocale));break;case Pi.type:const n=Oi(t());e(ir(n))}return o}}const Di=Vn({name:"visibility",initialState:{visibility:hr.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(Dr.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(rr.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:Mi}=Di.actions,Li=Di.reducer,Ui=He,Fi=()=>{const e=Ui(),t=De(Nr),n=!!t&&t!==hr.hidden,r=t===hr.open,o=t===hr.minimized,i=(0,_e.useCallback)((t=>e(Dr(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:o,visible:t,setVisibility:i,openChat:()=>{i(hr.open)},closeChat:()=>{i(hr.minimized)}}},Bi=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,xe.createRef)()})=>{const[r,o]=(0,_e.useState)(null),i=!!(null==r?void 0:r.isIntersecting)||!t,s=i&&e,a=([e])=>o(e);return(0,_e.useEffect)((()=>{const e=null==n?void 0:n.current;if(!window.IntersectionObserver||s||!e||!t)return()=>{};const r=new IntersectionObserver(a,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,s]),{isVisible:i,containerRef:n}},$i=()=>{const e=He(),{connectWhenInView:t}=br(),n=De(Ir),{containerRef:r,isVisible:o}=Bi({enabled:t,freezeOnceVisible:!0});return(0,_e.useEffect)((()=>{o&&e(Mi())}),[e,o]),{containerRef:r,showInlineView:n}},zi=()=>(0,_e.useContext)(qe),Hi=()=>zi().store||{},Vi=()=>{const e=zi();return(0,_e.useCallback)((()=>e.hasConversation()),[e])};function qi(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 Wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qi(Object(n),!0).forEach((function(t){Gi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ki=()=>{const e=zi(),t=br(),n=He(),r=(0,_e.useContext)(We),o=Br(),i=Vi(),{visible:s,setVisibility:c}=Fi(),l=Cr(),u=(0,_e.useCallback)(((...e)=>{r.emit(...e)}),[r]),p=(0,_e.useCallback)((()=>{e.sendContext(t.context||{}),u("ui.beforeStart",{visibility:s,hasConversation:i(),hasResponded:o,unreadMessageCount:l}),e.send("start"),u("ui.start",{visibility:s,hasConversation:i(),hasResponded:o,unreadMessageCount:l})}),[e,t.context,u,i,o,l,s]),d=(0,_e.useCallback)((async()=>{n(Fr())}),[n]),f=(0,_e.useCallback)((e=>({type:e,id:_(),transactionId:_(),participant:a,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,_e.useCallback)((e=>Wi(Wi({},f("text")),{},{body:{text:e}})),[f]),y=(0,_e.useCallback)((({body:t,config:r={}})=>{if(""===t.trim())return;const o=Wi(Wi({},h(t)),r);e.send("message",o),u("message",o),n(ro({type:"message",payload:Wi(Wi({},o),{},{optimisticallyInjected:!0})}))}),[e,n,u,h]),b=(0,_e.useCallback)(((e,t=_())=>{n(ro({type:"message",payload:Wi(Wi({},h(e)),{},{transactionId:t})}))}),[n,h]),m=(0,_e.useCallback)(((e,t,r,o,i,s,c)=>{n(ro({type:"message",payload:{type:"upload",id:e,transactionId:t,participant:a,fromClient:!0,occurredAt:r,meta:{},body:{contentType:o,filename:i,filesize:s,url:c}}}))}),[n]),v=(0,_e.useCallback)(((e,t=_())=>{const r={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:_(),transactionId:t,type:"divider"};n(ro({type:"info",payload:r}))}),[n]),g=(0,_e.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==et&&n!==tt&&u(`action.${n}`,t)}),[e,u]),w=(0,_e.useCallback)((t=>{e.sendContext(t)}),[e]),O=(0,_e.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(n(Co(e)),e.userResponded&&(n(Hr(e.userResponded)),c(hr.open)))})).catch((e=>{n(Gr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,n,c]);return{connect:O,start:p,sendMessage:y,sendAction:g,sendContext:w,reset:d,emitEvent:u,addMessageBubble:b,addUploadBubble:m,addDivider:v,apiConnected:e.connected,apiConfigReady:e.configReady}};function Ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ji(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zi(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Zi(t):t)}),[])}function es(e){var t={};return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=r.length?r.map((function(e){return 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,i))return t[i];var s=e.apply(void 0,r);return t[i]=s,s}}function ts(e){for(var t=function(e){return/\s/.test(e)},n=[],r={},o=0,i=null,s=!1,a=0;a<e.length;){if(s&&(t(e[a])||"{"===e[a]))s=!1,i=e.slice(o,a),"{"===e[a]&&a--;else if(!s&&!t(e[a])){var c="{"===e[a];if(i&&c){var l=ns(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));r[i]=e.slice(a+1,l),a=l,i=null}else i&&(n.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&n.push(i),{args:n,cases:r}}function ns(e,t){for(var n=0,r=t+1;r<e.length;r++){var o=e.charAt(r);if("}"===o){if(0===n)return r;n--}else"{"===o&&n++}return-1}function rs(e){return os(e.slice(1,-1),",",3)}function os(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return r;if(1===n)return r.push(e),r;var o=e.indexOf(t);if(-1===o)return r.push(e),r;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return r.push(i),os(s,t,n-1,r)}var is;function ss(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 as(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ss(Object(n),!0).forEach((function(t){dn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ss(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var cs=0,ls="other";function us(e,t){for(var n=0,r="",o=0,i={};n<e.length;){if("#"!==e[n]||o)r+=e[n];else{var s="__hashToken".concat(cs++);r+="{".concat(s,", number}"),i[s]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:i}}var ps="other";const ds=new(function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Qi(this,e),dn(this,"format",es((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zi(n.process(e,t)).join("")}))),this.locale=t,this.typeHandlers=r}var t,n;return t=e,n=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var n=e.indexOf("{");if(-1!==n){var r=ns(e,n);if(-1===r)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var o=e.substring(n,r+1);if(o){var i=[],s=e.substring(0,n);s&&i.push(s);var a=rs(o),c=Xi(a,3),l=c[0],u=c[1],p=c[2],d=t[l];null==d&&(d="");var f=u&&this.typeHandlers[u];i.push(f?f(d,p,this.locale,t,this.process.bind(this)):d);var h=e.substring(r+1);return h&&i.push(this.process(h,t)),i}}return[e]}}],n&&Yi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}())("en-GB",{plural:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=ts(t),s=i.args,a=i.cases,c=parseInt(e);s.forEach((function(e){e.startsWith("offset:")&&(c-=parseInt(e.slice("offset:".length)))}));var l=[];if("PluralRules"in Intl){void 0!==is&&is.resolvedOptions().locale===n||(is=new Intl.PluralRules(n));var u=is.select(c);u!==ls&&l.push(u)}1===c&&l.push("one"),l.push("=".concat(c),ls);for(var p=0;p<l.length;p++){var d=l[p];if(d in a){var f=us(a[d],c),h=f.caseBody,y=f.numberValues;return o(h,as(as({},r),y))}}return e},select:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=ts(t),i=o.cases;return e in i?r(i[e],n):ps in i?r(i.other,n):e}});function fs(){const e=De(wi),t=De(ji),n=De(Oi),r=De(xi),o=(0,_e.useCallback)(((n,o={})=>{const i=e[n];return i?ds.format(i,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),null)}),[e,t,r]);return{t:o,locale:t,initialLocale:n}}const hs=(0,xe.createContext)(null),ys=()=>{const e=(0,_e.useContext)(hs);return{sendPolite:(0,_e.useCallback)((t=>{t&&e({ariaLive:lt,messageText:t})}),[e]),sendAssertive:(0,_e.useCallback)((t=>{t&&e({ariaLive:ct,messageText:t})}),[e])}},bs=()=>{const e=jr(),{t}=fs(),{isInline:n,isWindow:r,isApp:o}=kr(),{isOpen:i,isVisible:s}=Fi(),a=De(Ir),c=He(),l=(0,_e.useRef)(null),{start:u,connect:p,apiConfigReady:d,apiConnected:f}=Ki(),h=Vi(),y=(0,_e.useRef)(null),b=(0,_e.useRef)(null),m=(0,_e.useRef)(!1),{sendAssertive:v}=ys();(0,_e.useEffect)((()=>{s&&setTimeout((()=>{v(t("window.srTexts.onLoad"))}),500)}),[s,v,t]),(0,_e.useEffect)((()=>{if(s!==b.current)return y.current=i,void(b.current=s);null!==y.current&&v(t(i?"window.srTexts.onOpen":"window.srTexts.onClose")),y.current=i,b.current=s}),[i,s,v,t]),(0,_e.useEffect)((()=>(l.current=setTimeout((()=>{c(So(!0))}),500),()=>{clearTimeout(l.current)})),[c]),(0,_e.useEffect)((()=>(e.length&&(l.current=setTimeout((()=>{c(So(!1))}),5e3)),()=>{clearTimeout(l.current)})),[e,c]),(0,_e.useEffect)((()=>{d&&f||(m.current=!1)}),[d,f]);const g=(0,_e.useCallback)((async()=>{f||(m.current=!0,await p()),(o||i||s&&n)&&u()}),[f,p,o,n,i,s,u]);(0,_e.useEffect)((()=>{d&&!m.current&&(!r||i||h())&&(!n||s&&a)&&(h()&&i&&(clearTimeout(l.current),c(So(!1))),g())}),[d,g,c,h,n,i,r,s,a])},ms=({children:t})=>(bs(),(0,e.jsx)(e.Fragment,{children:t})),vs=(0,xe.createContext)({}),gs=()=>br().appContainerClassNames,ws=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},Os=(e=0)=>new Promise((t=>{setTimeout(t,e)})),js=e=>{requestAnimationFrame((async()=>{await Os(180);const t="string"==typeof e?document.getElementById(e):e;w(t)}))},xs=()=>{const{seamlyContainerElement:e}=gr(),t=He();return[e,(0,_e.useCallback)((e=>{t(To(e))}),[t])]},_s=e=>(0,_e.useCallback)((()=>{js(e)}),[e]),Cs=()=>{const e=Sr();return _s(e)},Ss=(0,xe.createContext)({});function Es(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 Ps(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Es(Object(n),!0).forEach((function(t){Ts(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Es(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ts(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ks=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=gr(),{allowedMimeTypes:o,maxSize:i}=n.upload||{},{enabled:s,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}=Ps(Ps(Ps({},t.upload||{allowedMimeTypes:[],maxSize:0}),o?{allowedMimeTypes:o}:{}),i?{maxSize:i}:{});return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},As=()=>{const{currentUploads:e}=gr(),t=He(),n=(0,_e.useContext)(Ss);return{uploadFile:(0,_e.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,_e.useCallback)((()=>{t(oo())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}};function Ns(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 Is(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ns(Object(n),!0).forEach((function(t){Rs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ns(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ds=()=>{const{t:e}=fs(),{options:t}=gr(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:i}=t,{cobrowsing:s,sendTranscript:a}=i,c={cobrowsing:s,sendTranscript:a},l=Object.keys(c).filter((e=>c[e])).map((t=>({name:t,title:e(`options.${t}.menuTitle`),available:c[t].enabled}))),u=s||a,p=He(),{get:d,set:f}=Hi();return{allowOptionSelection:u,userSelectedOptions:o,features:i,menuOptions:l,initUserSelectedOptions:(0,_e.useCallback)((()=>{const e=d("options")||{};p(Lo(e))}),[d,p]),setUserSelectedOptions:(0,_e.useCallback)((e=>{p(Lo(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,_e.useCallback)(((e,t)=>{const n=d("options")||{};f("options",Is(Is({},n),{},{[e]:t})),p(Mo({option:e,value:t}))}),[p,d,f]),showOption:e=>{p(Uo(e))},hideOption:()=>{p(uo())},panelActive:n,optionActive:r}},Ms=()=>{const{optionsButtonId:e}=gr();return{id:e,focusButton:_s(e)}},Ls=(0,xe.createContext)(null),Us=()=>(0,_e.useContext)(Ls);function Fs(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 Bs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fs(Object(n),!0).forEach((function(t){$s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const zs=()=>{const e=He(),{idleDetachCountdown:t}=gr(),{isOpen:n}=Fi(),r=(0,_e.useRef)({});r.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:n};const{emitEvent:o,sendAction:i}=Ki(),{t:s}=fs(),{sendAssertive:a,sendPolite:c}=ys(),l=(0,_e.useCallback)((e=>{const{isOpen:t}=r.current;t&&a(e)}),[a]),u=(0,_e.useCallback)((e=>{const{isOpen:t}=r.current;t&&c(e)}),[c]),p=(0,_e.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=y(n);e(po({delaySeconds:n,delayTime:r})),o("idleTimer.start"),l(`${s("idleDetachWarning.countdownTitle")} ${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",r)}`)}),[e,o,l,s]),d=(0,_e.useCallback)(((t,n)=>{const{hasCountdown:a,wasStopped:c}=r.current;a&&(t||(n||i({type:nt}),l(s("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e(ao()))}),[e,i,o,l,s]),f=(0,_e.useCallback)((()=>{const{remaining:t}=r.current;if(t<=0)return;const n=t-1;n%10==0&&l(`${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",y(n))}`),e(lo())}),[e,l,s]),h=(0,_e.useCallback)((()=>{const{isActive:t,remaining:n}=r.current;t&&(e(Fo()),n&&(o("idleTimer.stop"),u(s("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,u,s]);return Bs(Bs({},t),{},{initCountdown:p,endCountdown:d,decrementCountdown:f,stopCountdown:h})},Hs=()=>{const e=He(),t=gr().resumeConversationPrompt,{sendAction:n}=Ki(),{t:r}=fs(),{sendAssertive:o}=ys();return{continueChat:()=>{n({type:rt,body:{type:"resume_conversation_prompt"}}),e(co())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:nt}),e(co())}}},Vs=()=>{const[e]=(0,_e.useState)((()=>_()));return e},qs=e=>{const t=(0,_e.useRef)(null);t.current=e;const n="function"==typeof e;return(0,_e.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Ws=(e,t)=>{const n=zi();(0,_e.useEffect)((()=>{if(n.connectionInfo&&n.conversation?.channel){const{channel:r}=n.conversation;r.onMessage=(n,r)=>(t&&!t({type:n,payload:r})||e({type:n,payload:r}),r)}}),[e,t,n.connectionInfo,n.conversation])};function Gs(){const{sendAction:e}=Ki(),t=He(),n=(0,_e.useCallback)(((n,r="translation_choice")=>{e({type:it,body:{enabled:!0,locale:n,source:r}}),t(Ei(n)),t(Ni())}),[e,t]),r=(0,_e.useCallback)((()=>{e({type:it,body:{enabled:!1}}),t(Pi())}),[e,t]),{languages:o,isActive:i,isAvailable:s,currentLocale:a}=De((({translations:e})=>e));return{languages:o,isActive:i,isAvailable:s,currentLocale:a,enableTranslations:n,disableTranslations:r}}function Ks(e){const{translatedBody:t,body:n}=e.payload?"participant"===e.type?{body:null===(r=e.payload)||void 0===r?void 0:r.participant.introduction,translatedBody:null===(i=null===(o=e.payload)||void 0===o?void 0:o.participant)||void 0===i?void 0:i.translatedIntroduction}:{body:e.payload.body,translatedBody:e.payload.translatedBody}:{body:void 0,translatedBody:void 0};var r,o,i;const s=!!t,a=De((e=>pr((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>{var n;return!t.includes(null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.id)})))))(e));return{body:s&&a?null==t?void 0:t.data:n,hasTranslation:s,isTranslated:a&&s,locale:null==t?void 0:t.locale}}function Js(){const e=De((({translations:e})=>e.containerId));return{id:e,focusContainer:_s(e)}}function Xs(e){const{languages:t}=Gs();return(0,_e.useMemo)((()=>{var n;return null===(n=null==t?void 0:t.find((t=>t.locale===e)))||void 0===n?void 0:n.nativeName}),[e,t])}const Qs=(...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.length)).map((e=>e.indexOf(i)>-1?e:[i,e].join("-"))).join(" "),Ys=({eventPayload:t})=>{const{t:n}=fs(),{fromClient:r,participant:o}=t,i=(e=>gr().participantInfo.participants[e])(o)||{},{messages:s}=br(),a=r?n("participants.user.name"):i&&i.name,{showAvatar:c,showName:l}=s[r?"user":"agent"]||{};if(!c&&!l)return null;const u=[];return c&&a&&i.avatar&&u.push((0,e.jsx)("span",{className:Qs("message__avatar"),children:(0,e.jsx)("img",{src:i.avatar,className:Qs("avatar"),alt:""})})),l&&u.push((0,e.jsx)("span",{className:Qs("message__author-name"),children:a})),u.length>0&&(0,e.jsx)("div",{className:Qs("message__author"),children:u})},Zs=["showParticipant","event","type","modifiers","children","bodyProps","info"];function ea(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 ta(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ea(Object(n),!0).forEach((function(t){na(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ea(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ra=function(t){let{showParticipant:n=!0,event:r,type:o,modifiers:i,children:s,bodyProps:a={},info:c}=t,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Zs);const u=ws(r),{hasTranslation:p,isTranslated:d,locale:f}=Ks(r);return o&&u.push(`message--type-${o}`),i&&("string"==typeof i&&(i=i.split(" ").filter((e=>e.length))),i.forEach((e=>{u.push(`message--${e}`)}))),d&&u.push("message--is-translated"),p&&u.push("message--has-translation"),d&&(a=ta(ta({},a),{},{lang:f})),(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",ta(ta({className:Qs(u)},l),{},{children:[n&&(0,e.jsx)(Ys,{eventPayload:r.payload}),(0,e.jsx)("div",ta(ta({className:Qs("message__body")},a),{},{children:s})),c&&(0,e.jsx)("div",{"aria-hidden":"true",className:Qs("message__info"),children:c})]}))})};function oa(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 ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oa(Object(n),!0).forEach((function(t){sa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function sa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const aa=({id:t,action:n,buttonText:r,description:o,hasFocus:i,image:s,title:a,isCarouselItem:c})=>{const l=(0,_e.useRef)(null),{sendMessage:u,sendAction:p,emitEvent:d}=Ki(),f=Vs(),h=(0,_e.useRef)(),y=n.type===dt?"a":"button",b=(0,_e.useCallback)((()=>d("action.click_card",{type:st,originMessage:t,action:n})),[d,t,n]),m=(0,_e.useCallback)((()=>{if(b(),"ask"===n.type)u({body:n.ask});else if("topic"===n.type){const{topic:e,fallbackMessage:t}=n;p({type:ot,body:{name:e,fallbackMessage:t}})}}),[u,n,p,b]),v=(0,_e.useMemo)((()=>n.type===dt?{href:n.link,rel:"noopener noreferrer",target:n.newTab?"_blank":"_self",onClick:b}:{onClick:m}),[n,m,b]);return(0,_e.useEffect)((()=>{c&&(i&&h.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),h.current=!0}),[i,c]),(0,e.jsxs)("div",{className:Qs("card__wrapper"),id:t,tabIndex:"-1",ref:l,children:[(0,e.jsx)("img",{className:Qs("card__image"),src:s,alt:""}),(0,e.jsxs)("div",{className:Qs("card__content"),id:t,children:[a&&(0,e.jsx)("h2",{className:Qs("card__title"),children:a}),o&&(0,e.jsx)("div",{className:Qs("card__description"),dangerouslySetInnerHTML:{__html:o}}),(0,e.jsx)(y,ia(ia({tabIndex:c&&!i?"-1":void 0,className:Qs("button","button--primary"),"aria-describedby":f},v),{},{children:r}))]})]})};function ca(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 la(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ca(Object(n),!0).forEach((function(t){ua(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ca(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pa(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 da(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pa(Object(n),!0).forEach((function(t){fa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ha({item:t,items:n,index:r,isActive:o}){const{t:i}=fs();return(0,e.jsx)("div",{className:Qs("carousel-item",`carousel-item--${t.type}`),role:"group","aria-roledescription":"slide","aria-label":i("carousel.slide.label",{index:r+1,total:n.length}),children:(0,e.jsx)(aa,da(da({},t),{},{isCarouselItem:!0,hasFocus:o}))})}const ya={send32:'<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>',balloon32:'<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>',newTopic32:'<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>',newTranslation16:'<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>',newTranslation32:'<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>',avatar32:'<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',chevronDown8:'<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>',chevronDown32:'<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>',chevronRight8:'<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>',chevronRight16:'<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>',close8:'<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>',close16:'<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>',enlarge32:'<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>',options32:'<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>',file32:'<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>',upload32:'<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>',download16:'<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>',error16:'<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>',arrowLeft16:'<?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',arrowRight16:'<?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',check32:'<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',check16:'<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'},ba=({name:t,size:n="32",className:r,alt:o})=>{const i=`${t}${n}`;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{"aria-hidden":"true",className:r||Qs("icon"),dangerouslySetInnerHTML:{__html:ya[i]}}),o&&(0,e.jsx)("span",{className:Qs("visually-hidden"),children:o})]})};function ma({items:t,currentIndex:n,onChange:r,children:o}){const{t:i}=fs(),s=t.length;return(0,e.jsxs)("div",{className:Qs("carousel-controls"),children:[(0,e.jsx)("button",{className:Qs("button","button--previous"),"aria-label":i("carousel.controls.previous"),onClick:()=>{r((n-1+s)%s)},children:(0,e.jsx)(ba,{name:"arrowLeft",size:"16"})}),o,(0,e.jsx)("button",{className:Qs("button","button--next"),"aria-label":i("carousel.controls.next"),onClick:()=>{r((n+1)%s)},children:(0,e.jsx)(ba,{name:"arrowRight",size:"16"})})]})}function va({items:t,currentIndex:n,onChange:r,getItemKey:o,getItemLabel:i}){const s=t.length,a=(0,_e.useCallback)((e=>{const t=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,t));o!==n&&r(o)}),[s,n,r]);return(0,e.jsx)("div",{className:Qs("carousel-pagination__wrapper"),role:"group",children:(0,e.jsx)("ul",{className:Qs("carousel-pagination"),children:t.map(((t,r)=>{const s=n===r;return(0,e.jsx)("li",{className:Qs("carousel-pagination__item",s?"is-active":void 0),children:(0,e.jsx)("button",{className:Qs("carousel-pagination__button"),type:"button",onClick:a,"data-item":r,"aria-disabled":s?"true":void 0,"aria-label":i(t,r)})},o(t,r,"pagination-item-"))}))})})}const ga=(e,t,n)=>`${n}${t}`,wa=e=>e.label,Oa=({target:e})=>{e.scrollLeft=0};function ja({currentIndex:t,onChange:n,getItemKey:r=ga,getItemLabel:o=wa,items:i}){const s=Vs(),a=i.length,[c,l]=(0,_e.useState)(Number(t||"0"));(0,_e.useEffect)((()=>{l(Number(t||"0"))}),[l,t]);const u=(0,_e.useRef)([]);u.current=(0,_e.useMemo)((()=>Array(a).fill(1).map((()=>(0,xe.createRef)()))),[a]);const p=(0,_e.useRef)(!0),d=(0,_e.useRef)();return d.current=n,(0,_e.useEffect)((()=>{p.current?p.current=!1:d.current&&d.current(c)}),[c]),(0,e.jsxs)("div",{className:Qs("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,e.jsx)("div",{className:Qs("carousel__slides-wrapper"),onScroll:Oa,children:(0,e.jsx)("div",{id:s,className:Qs("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:i.map(((t,n)=>{const o=c===n;return(0,e.jsx)("div",{ref:u.current[n],className:Qs("carousel__slide",o?"is-active":void 0),"aria-hidden":o?void 0:"true",children:(0,e.jsx)(ha,{item:t,items:i,currentIndex:c,index:n,isActive:o})},r(t,n,"item-"))}))})}),(0,e.jsx)("div",{className:Qs("carousel__controls"),children:(0,e.jsx)(ma,{currentIndex:c,items:i,onChange:l,controlId:s,children:(0,e.jsx)("div",{className:Qs("carousel__pagination"),children:(0,e.jsx)(va,{currentIndex:c,items:i,onChange:l,getItemKey:r,getItemLabel:o})})})})]})}const xa=(e,t,n="")=>`${n}${e.title}:${t}`,_a=e=>e.title,Ca=["event","children"];function Sa(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 Ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sa(Object(n),!0).forEach((function(t){Pa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ta=e=>{const{payload:t}=e,[n,r]=(0,_e.useState)(!1),{sendAction:o,addMessageBubble:i,addDivider:s}=Ki(),{activeServiceSessionId:a}=gr().serviceInfo,c=De(Er),{body:l}=Ks(e),{service:u}=t,p=(0,_e.useMemo)((()=>Ea(Ea({},e),{},{payload:Ea(Ea({},e.payload),{},{body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&Ea(Ea({},e.payload.translatedBody),{},{data:e.payload.translatedBody.data.prompt})})})),[e]),d=l.chooseAgain&&a===u.serviceSessionId&&t.id!==c;return(0,_e.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:p,showOptions:n,chooseAgain:d,onChoiceClickHandler:e=>{const n=_();d&&s("new_topic",n),i(e.text,n),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:d},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}},ka=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Aa=({id:t,categories:n=[],question:r,onClick:o,hasIcon:i})=>{const s=(0,_e.useMemo)((()=>["suggestions__item",...n.map(ka)]),[n]),a=(0,_e.useCallback)((()=>{o&&o({id:t,question:r})}),[t,r,o]);return(0,e.jsx)("li",{className:Qs(s),children:(0,e.jsxs)("button",{type:"button",onClick:a,className:Qs("button","button--primary"),children:[i&&(0,e.jsx)(ba,{name:"chevronRight",size:"8"}),r]})})};function Na(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 Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ra=({className:t,suggestions:n=[],onClickSuggestion:r,hasIcon:o=!0})=>(0,e.jsx)("ul",{className:Qs("suggestions__list",t),children:n.map((t=>(0,e.jsx)(Aa,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Na(Object(n),!0).forEach((function(t){Ia(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Na(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({hasIcon:o,onClick:r},t),t.id)))}),Da=["event"];function Ma(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 La(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ma(Object(n),!0).forEach((function(t){Ua(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ma(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fa=e=>{const{sendAction:t}=Ki();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}};function Ba(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 $a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ba(Object(n),!0).forEach((function(t){za(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ba(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function za(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ha({children:t,childrenHTML:n,className:r,graphicSrc:o,graphicType:i="icon",iconName:s,iconSize:a,iconClassName:c,dividerType:l}){const u=Boolean(s||o),p=n?{dangerouslySetInnerHTML:{__html:n}}:{children:t};return(0,e.jsxs)("div",{className:Qs("divider",l&&`divider--type-${l}`,r),children:[u&&(0,e.jsx)("span",{className:Qs("divider__graphic"),children:s?(0,e.jsx)(ba,{name:s,size:a,className:c}):(0,e.jsx)("img",{src:o,className:Qs({icon:"icon"===i,avatar:"avatar"===i},c)})}),(0,e.jsx)("div",$a({className:Qs("divider__body")},p))]})}const Va={[ut.new_topic]:"newtopic"},qa=["event"];function Wa(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 Ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ka={default:({event:t})=>{const{t:n}=fs(),{subtype:r}=t.payload.body,o=Va[ut[r]];return(0,e.jsx)(Ha,{dividerType:o,iconName:ut[r],children:(0,e.jsx)("p",{children:n(`dividerKeys.${ut[r]}`)})})},[ut.new_translation]:({event:t})=>{const{t:n}=fs(),r=jr(),{body:{restartButtonText:o,translationEnabled:i,translationLocale:s,text:a,title:c},id:l}=t.payload,{enableTranslations:u}=Gs(),p=De((e=>e.translations.translatedEventGroups)),d=He(),f=(0,_e.useCallback)((()=>{p[l]?d(Ti({events:r,id:l})):d(ki({events:r,id:l}))}),[d,r,l,p]);return(0,e.jsxs)(Ha,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,e.jsx)("p",{className:Qs("divider__title"),children:c}),a&&(0,e.jsx)("p",{children:a}),i?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:Qs("button","button--secondary"),onClick:f,children:n(p[l]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):(0,e.jsx)("button",{className:Qs("button","button--secondary"),"data-testid":"restartTranslationButton",onClick:()=>{u(s)},children:o})]})}},Ja={month:"long",day:"numeric",year:"numeric"},Xa={hour:"numeric",minute:"numeric"},Qa=({event:t})=>{const n=(()=>{const[e,t]=(0,_e.useReducer)((e=>e+1),0);return(0,_e.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:o,timeUntilMidnight:i,srText:s}=(e=>{const{t}=fs(),n=br()?.context?.locale??[],r=new Date(e),o=new Date,i=new Date(o);i.setHours(24,0,0,0);const s=i-o,a=r.toString(),c=new Intl.DateTimeFormat(n,Xa).format(r);let l=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),o=864e5;return r>=n+o?e:r>n?"today":r>n-o?"yesterday":e})(r,o);switch(l){case"today":l=t("dateTime.today");break;case"yesterday":l=t("dateTime.yesterday");break;default:l=new Intl.DateTimeFormat(n,Ja).format(r)}return{date:l,srText:t("dateTime.srText",{date:l,time:c}),time:c,fullDateTime:a,timeUntilMidnight:s}})(h(t.timeIndicator));return(0,_e.useEffect)((()=>{const e=setTimeout((()=>{n()}),i);return()=>{clearTimeout(e)}}),[n,i]),(0,e.jsxs)(Ha,{dividerType:"time-indicator",children:[(0,e.jsxs)("p",{className:Qs("divider__time"),"aria-hidden":"true",children:[(0,e.jsx)("span",{children:r}),(0,e.jsx)("span",{children:o})]}),(0,e.jsx)("p",{className:Qs("visually-hidden"),children:s})]})};var Ya=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],Za=Ya.join(","),ec="undefined"==typeof Element,tc=ec?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,nc=!ec&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},rc=function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(Za));return t&&tc.call(e,Za)&&r.unshift(e),r.filter(n)},oc=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if("SLOT"===s.tagName){var a=s.assignedElements(),c=e(a.length?a:s.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{tc.call(s,Za)&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var l=s.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(s),u=!r.shadowRootFilter||r.shadowRootFilter(s);if(l&&u){var p=e(!0===l?s.children:l.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return o},ic=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},sc=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ac=function(e){return"INPUT"===e.tagName},cc=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},lc=function(e,t){return!(t.disabled||function(e){return ac(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=tc.call(e,"details>summary:first-of-type")?e.parentElement:e;if(tc.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return cc(e)}else{if("function"==typeof r){for(var i=e;e;){var s=e.parentElement,a=nc(e);if(s&&!s.shadowRoot&&!0===r(s))return cc(e);e=e.assignedSlot?e.assignedSlot:s||a===e.ownerDocument?s:a.host}e=i}if(function(e){for(var t,n=nc(e).host,r=!!(null!==(t=n)&&void 0!==t&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!r&&n;){var o;r=!(null===(o=n=nc(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(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!!tc.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},uc=function(e,t){return!(function(e){return function(e){return ac(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||nc(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 o=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!o||o===e}(e)}(t)||ic(t)<0||!lc(e,t))},pc=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},dc=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,s=i?t.scopeParent:t,a=ic(s,i),c=i?e(t.candidates):s;0===a?i?n.push.apply(n,c):n.push(s):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:c})})),r.sort(sc).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},fc=function(e,t){var n;return n=(t=t||{}).getShadowRoot?oc([e],t.includeContainer,{filter:uc.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:pc}):rc(e,t.includeContainer,uc.bind(null,t)),dc(n)},hc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==tc.call(e,Za)&&uc(t,e)},yc=Ya.concat("iframe").join(","),bc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==tc.call(e,yc)&&lc(t,e)};function mc(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 vc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mc(Object(n),!0).forEach((function(t){gc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wc=[],Oc=function(e){return setTimeout(e,0)},jc=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},xc=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},_c=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target};function Cc(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 Sc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach((function(t){Ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Pc=({children:e,onClose:t,"aria-label":n,"aria-labelledby":r,fallBackFocusRef:o})=>{const i=Vs(),s=(0,_e.useRef)(null),a=(0,_e.useRef)(null),[c,l]=(0,_e.useState)(!1);return(0,_e.useEffect)((()=>{return c&&(a.current=(e=s.current,t={initialFocus:o&&o.current?o.current:null},r=(null==t?void 0:t.document)||document,i=(null==t?void 0:t.trapStack)||wc,l=vc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),u={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},p=function(e,t,n){return e&&void 0!==e[t]?e[t]:l[n||t]},d=function(e){return u.containerGroups.findIndex((function(t){var n=t.container,r=t.tabbableNodes;return n.contains(e)||r.find((function(t){return t===e}))}))},f=function(e){var t=l[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];t=t.apply(void 0,o)}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},h=function(){var e=f("initialFocus");if(!1===e)return!1;if(void 0===e)if(d(r.activeElement)>=0)e=r.activeElement;else{var t=u.tabbableGroups[0];e=t&&t.firstTabbableNode||f("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},y=function(){if(u.containerGroups=u.containers.map((function(e){var t=fc(e,l.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?oc([e],t.includeContainer,{filter:lc.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):rc(e,t.includeContainer,lc.bind(null,t))}(e,l.tabbableOptions);return{container:e,tabbableNodes:t,focusableNodes:n,firstTabbableNode:t.length>0?t[0]:null,lastTabbableNode:t.length>0?t[t.length-1]:null,nextTabbableNode:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=n.findIndex((function(t){return t===e}));if(!(r<0))return t?n.slice(r+1).find((function(e){return hc(e,l.tabbableOptions)})):n.slice(0,r).reverse().find((function(e){return hc(e,l.tabbableOptions)}))}}})),u.tabbableGroups=u.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),u.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},b=function e(t){!1!==t&&t!==r.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!l.preventScroll}),u.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(h()))},m=function(e){var t=f("setReturnFocus",e);return t||!1!==t&&e},v=function(e){var t=_c(e);d(t)>=0||(xc(l.clickOutsideDeactivates,e)?n.deactivate({returnFocus:l.returnFocusOnDeactivate&&!bc(t,l.tabbableOptions)}):xc(l.allowOutsideClick,e)||e.preventDefault())},g=function(e){var t=_c(e),n=d(t)>=0;n||t instanceof Document?n&&(u.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),b(u.mostRecentlyFocusedNode||h()))},w=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==xc(l.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=_c(e);y();var n=null;if(u.tabbableGroups.length>0){var r=d(t),o=r>=0?u.containerGroups[r]:void 0;if(r<0)n=e.shiftKey?u.tabbableGroups[u.tabbableGroups.length-1].lastTabbableNode:u.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var i=jc(u.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(i<0&&(o.container===t||bc(t,l.tabbableOptions)&&!hc(t,l.tabbableOptions)&&!o.nextTabbableNode(t,!1))&&(i=r),i>=0){var s=0===i?u.tabbableGroups.length-1:i-1;n=u.tabbableGroups[s].lastTabbableNode}}else{var a=jc(u.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(a<0&&(o.container===t||bc(t,l.tabbableOptions)&&!hc(t,l.tabbableOptions)&&!o.nextTabbableNode(t))&&(a=r),a>=0){var c=a===u.tabbableGroups.length-1?0:a+1;n=u.tabbableGroups[c].firstTabbableNode}}}else n=f("fallbackFocus");n&&(e.preventDefault(),b(n))}(e)},O=function(e){var t=_c(e);d(t)>=0||xc(l.clickOutsideDeactivates,e)||xc(l.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},j=function(){if(u.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),u.delayInitialFocusTimer=l.delayInitialFocus?Oc((function(){b(h())})):b(h()),r.addEventListener("focusin",g,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",O,{capture:!0,passive:!1}),r.addEventListener("keydown",w,{capture:!0,passive:!1}),n},x=function(){if(u.active)return r.removeEventListener("focusin",g,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",O,!0),r.removeEventListener("keydown",w,!0),n},n={get active(){return u.active},get paused(){return u.paused},activate:function(e){if(u.active)return this;var t=p(e,"onActivate"),n=p(e,"onPostActivate"),o=p(e,"checkCanFocusTrap");o||y(),u.active=!0,u.paused=!1,u.nodeFocusedBeforeActivation=r.activeElement,t&&t();var i=function(){o&&y(),j(),n&&n()};return o?(o(u.containers.concat()).then(i,i),this):(i(),this)},deactivate:function(e){if(!u.active)return this;var t=vc({onDeactivate:l.onDeactivate,onPostDeactivate:l.onPostDeactivate,checkCanReturnFocus:l.checkCanReturnFocus},e);clearTimeout(u.delayInitialFocusTimer),u.delayInitialFocusTimer=void 0,x(),u.active=!1,u.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=p(t,"onDeactivate"),o=p(t,"onPostDeactivate"),s=p(t,"checkCanReturnFocus"),a=p(t,"returnFocus","returnFocusOnDeactivate");r&&r();var c=function(){Oc((function(){a&&b(m(u.nodeFocusedBeforeActivation)),o&&o()}))};return a&&s?(s(m(u.nodeFocusedBeforeActivation)).then(c,c),this):(c(),this)},pause:function(){return u.paused||!u.active||(u.paused=!0,x()),this},unpause:function(){return u.paused&&u.active?(u.paused=!1,y(),j(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return u.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),u.active&&y(),this}},n.updateContainerElements(e),n),a.current.activate()),()=>{a.current&&a.current.deactivate()};var e,t,n,r,i,l,u,p,d,f,h,y,b,m,v,g,w,O,j,x}),[c,o]),(0,_e.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||(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()}}),[c]),(0,_e.useEffect)((()=>{c&&s.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[c,t]),(0,_e.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",i),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),r&&t.setAttribute("aria-labelledby",r),e.appendChild(t),s.current=t,l(!0),()=>{s.current&&(e.removeChild(s.current),s.current=null)}}),[n,r,i]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>s.current&&(0,xe.render)(e,s.current)}):s.current&&(0,xe.render)((0,xe.toChildArray)(e).map((e=>(e.props=Sc(Sc({},e.props),{},{onClose:t}),e))),s.current)},Tc=({url:t,description:n,onClose:r})=>{const{zIndex:o,layoutMode:i,namespace:s}=br(),a=Us(),c=gs(),l=(0,_e.useRef)(null),{t:u}=fs(),p=["modal",`app--layout-${i}`,`namespace--${s}`,...c],d=e=>{e.stopPropagation()},f=()=>{r()},h=o?{zIndex:o+1}:void 0;return(0,e.jsx)(Pc,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:r,modalRenderFn:o})=>o((r=>(0,e.jsx)("div",{className:Qs(p),onClick:f,style:h,children:(0,e.jsxs)("div",{className:Qs("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,e.jsx)("div",{className:Qs("modal__inner"),onClick:d,children:(0,e.jsx)("img",{className:Qs("modal__image"),src:t,alt:n})}),(0,e.jsxs)("button",{type:"button",className:Qs("modal__close"),onClick:r,children:[(0,e.jsx)(ba,{name:"close",size:"16"}),u("lightbox.closeLabel")]})]})}))(r))})},kc=({description:t,url:n})=>{const{t:r}=fs(),[o,i]=(0,_e.useState)(!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:Qs("modal__enlarge"),onClick:()=>{i(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:t}),(0,e.jsx)(ba,{name:"enlarge",size:"32"})]}),o&&(0,e.jsx)(Tc,{url:n,description:t,onClose:()=>{i(!1)}})]})},Ac=["event","descriptorId"];function Nc(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 Ic(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nc(Object(n),!0).forEach((function(t){Rc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dc=["event"];function Mc(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 Lc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mc(Object(n),!0).forEach((function(t){Uc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fc=["event"];function Bc(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 $c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bc(Object(n),!0).forEach((function(t){zc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hc=t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Fc);const{body:o}=Ks(n),i=Fa(n.payload.id),s=(0,_e.useMemo)((()=>n.payload.optimisticallyInjected?{children:(0,e.jsx)("p",{children:o.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:o.text}}}),[o,n]);return(0,e.jsx)(ra,$c($c({type:"text",event:n,onClick:i},r),s))},Vc=["event"];function qc(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 Wc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qc(Object(n),!0).forEach((function(t){Gc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Kc=["event"];function Jc(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 Xc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jc(Object(n),!0).forEach((function(t){Qc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Yc=({children:t,url:n,target:r})=>n?(0,e.jsx)("a",{href:n,download:!0,target:r||void 0,className:Qs(["download","download-link"]),children:t}):(0,e.jsx)("span",{className:Qs("download"),children:t}),Zc=["event","descriptorId"];function el(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 tl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?el(Object(n),!0).forEach((function(t){nl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rl(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 ol(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rl(Object(n),!0).forEach((function(t){il(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function il(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sl={message:{choice_prompt:t=>{let{event:n,children:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ca);const{t:i}=fs(),s=Vs(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:p,onChooseAgainClickHandler:d}=Ta(n);return(0,e.jsxs)(e.Fragment,{children:[(0,xe.toChildArray)(r).map((e=>(e.props=Ea(Ea({},e.props),{},{event:c,descriptorId:s,showTranslationToggle:!1}),e))),u&&(0,e.jsxs)("button",{type:"button",className:Qs("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:d,"aria-describedby":s,children:[i(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,e.jsx)(ba,{name:"chevronDown",size:"8"})]}),l&&(0,e.jsx)(ra,Ea(Ea({type:"choice-prompt",showParticipant:!1,event:n},o),{},{children:(0,e.jsx)("ul",{className:Qs("choice-prompt","choice-prompt--many"),children:a.choices.map((t=>(0,e.jsx)("li",{className:Qs("choice-prompt__item",{[`choice-prompt__item--${t.category}`]:t.category}),children:(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{p(t)},children:t.text})},t.id)))})}))]})},text:Hc,image:t=>{let{event:n,descriptorId:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ac);const{body:i}=Ks(n),{description:s,url:a,isZoomable:c}=i,[l,u]=(0,_e.useState)(!1),p=He();return(0,e.jsxs)(ra,Ic(Ic({event:n,type:"image"},o),{},{children:[(0,e.jsx)("img",{src:a,id:r,alt:s,onLoad:()=>{p(Eo(n.payload.id)),u(!0)}}),c&&l&&(0,e.jsx)(kc,{description:s,url:a})]}))},splash:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Dc);const{payload:o}=n,{body:i}=Ks(n),s=Fa(o.id);return(0,e.jsx)(ra,Lc(Lc({type:"splash",event:n,onClick:s},r),{},{bodyProps:{dangerouslySetInnerHTML:{__html:i.text}}}))},video:t=>{let{event:n,descriptorId:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Zc);const{body:i}=Ks(n),{description:s,url:a}=i;return ws(n).push("message--type-video"),(0,e.jsxs)(ra,tl(tl({event:n,type:"video"},o),{},{children:[(0,e.jsx)("div",{id:r,className:Qs("visually-hidden"),children:s}),(0,e.jsx)("iframe",{title:s,src:a,allow:"autoplay; encrypted-media",allowFullScreen:!0})]}))},upload:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Kc);const{t:o}=fs(),{body:i}=Ks(n),{fromClient:s}=n.payload,{filename:a,url:c}=i,l=(0,_e.useMemo)((()=>o(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,o]);return(0,e.jsx)(ra,Xc(Xc({event:n,type:"upload"},r),{},{children:(0,e.jsxs)(Yc,{url:c,target:s?void 0:"_blank",children:[(0,e.jsx)(ba,{name:"download",size:"16"}),(0,e.jsx)("span",{"aria-hidden":"true",className:Qs("file-download"),children:a}),(0,e.jsx)("span",{className:Qs("visually-hidden"),children:l})]})}))},cta:({event:t})=>{const{body:n}=Ks(t),r=Fa(t.payload.id),{emitEvent:o}=Ki(),i=Vs(),s=(0,_e.useCallback)((()=>o("action.click_cta",{type:st,originMessage:t.payload.id,link:{url:n.buttonLink}})),[o,n,t]);return(0,e.jsxs)(ra,{type:"cta",event:t,children:[(0,e.jsx)("div",{className:Qs("cta__content"),id:i,dangerouslySetInnerHTML:{__html:n.description},onClick:r}),(0,e.jsx)("a",{className:Qs("button","button--primary"),"aria-describedby":i,href:n.buttonLink,rel:"noreferrer",target:n.buttonNewTab?"_blank":"_self",onClick:s,children:n.buttonText})]})},carousel:({event:t})=>{const{body:n}=Ks(t),r=n.cards;return(0,e.jsx)(ra,{event:t,modifiers:"type-carousel",children:(0,e.jsx)(ja,{items:r,ItemComponent:ha,getItemKey:xa,getItemLabel:_a})})},card:({event:t})=>{const{body:n}=Ks(t),r=Vs();return(0,e.jsx)(ra,{type:"card",event:t,children:(0,e.jsx)(aa,la({id:r},n))})}},info:{text:Hc,divider:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,qa);const o=Ka[ut[n.payload.body.subtype]]||Ka.default;return(0,e.jsx)(o,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wa(Object(n),!0).forEach((function(t){Ga(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({event:n},r))},translation:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Vc);const{t:o}=fs(),{body:i}=Ks(n);return(0,e.jsx)(ra,Wc(Wc({type:"text",event:n},r),{},{children:o(i.key.join("."),i.variables)}))},timeIndicator:Qa},participant:{participant:({event:t})=>{const{participant:n}=t.payload,{body:r}=Ks(t);return r?(0,e.jsx)(Ha,{graphicSrc:n.avatar,graphicType:n.avatar?"avatar":void 0,iconName:n.avatar?void 0:"balloon",childrenHTML:r,dividerType:"participant"}):null}},service_data:{suggestion:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Da);const[o,i]=(0,_e.useState)(!0),s=He(),a=Br(),{sendAction:c,addMessageBubble:l}=Ki(),{suggestions:u,payload:p}=(e=>{const{payload:t}=e,{body:n}=Ks(e);return{suggestions:n,payload:t}})(n),{showSuggestions:d}=br(),f=jr(),{t:h}=fs(),y=h("suggestions.headingText"),b=h("suggestions.footerText"),m=(0,_e.useMemo)((()=>f.some((({payload:e})=>e?.transactionLast))),[f]),v=(0,_e.useCallback)((({id:e,question:t})=>{i(!1),s(Hr(!0)),c({type:Ze,originMessage:p.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),l(t)}),[s,c,p.id,l]);return o&&!a&&m&&d?(0,e.jsxs)("div",{className:Qs("suggestions","suggestions--conversation"),children:[y&&(0,e.jsx)("p",{className:Qs("suggestions__heading"),children:y}),(0,e.jsxs)(ra,La(La({type:"suggestions",showParticipant:!1,event:n},r),{},{children:[(0,e.jsx)(Ra,{className:"suggestions__list--conversation",onClickSuggestion:v,suggestions:u}),b&&(0,e.jsx)("p",{className:Qs("suggestions__footer"),children:b})]}))]}):null}}},al=({children:t})=>{const{customComponents:n}=br(),r=(0,_e.useMemo)((()=>Object.keys(sl).reduce(((e,t)=>ol(ol({},e),{},{[t]:ol(ol({},sl[t]),n?n[t]:{})})),{fallback:Hc})),[n]);return(0,e.jsx)(vs.Provider,{value:r,children:t})},cl=({children:t})=>{const{isMinimized:n}=Fi(),r=(0,_e.useRef)(0),{sendAction:o}=Ki(),{hasCountdown:i,isActive:s,stopCountdown:a}=zs(),c=(0,_e.useCallback)((()=>{if(n)return;const e=(new Date).getTime(),t=()=>{o({type:"interactivity_update"}),r.current=e};i&&s&&(t(),a()),e-r.current>15e3&&t()}),[o,i,s,a,n]);return(0,e.jsx)("div",Object.assign({className:Qs("activity-monitor"),tabIndex:-1,onMouseDown:c,onKeyUp:c,onTouchStart:c,onMouseMove:c,onWheel:c,onPointerDown:c,onPointerMove:c},{children:(0,e.jsx)(Ls.Provider,Object.assign({value:c},{children:t}))}))};const ll=["text","choice_prompt","image","video"],ul=()=>{const e=zi(),t=He(),n=jr(),r=(0,_e.useContext)(We),o=(0,_e.useRef)(null),{initCountdown:i,endCountdown:s}=zs(),{emitEvent:a}=Ki();return(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.socket){const{socket:n}=e.conversation;n.onError((e=>{const n=new Jo(e);t(Gr({name:n.name,message:n.message,langKey:n.langKey,originalEvent:n.originalEvent,originalError:n.originalError})),t(io())})),n.onOpen((()=>{t(Kr())}))}}),[e,e.connectionInfo,e.conversation.socket,t]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:t}=e.conversation;return()=>{null==t||t.leave()}}return()=>{}}),[e,e.connectionInfo,e.conversation]),(0,_e.useEffect)((()=>{e.conversation.onConnection((e=>{if("join_channel_erred"===e){const e=new u;t(Gr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action}))}}))}),[e.conversation,t]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:n}=e.conversation,o=e=>{const{payload:n}=e;if(!n||!n.participant)return;const{fromClient:r,participant:o}=n;!r&&"string"!=typeof o&&(null==o?void 0:o.name)&&t(jo(o.name)),t(Po({participant:o,fromClient:r})),"string"!=typeof o&&o.introduction&&t(ro(Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},n),{type:"participant"})})))};n.onMessage=(e,n)=>{const c={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&t(So(n.state.loading)),n.type){case"idle_detach_countdown":i(n.body.duration);break;case"idle_detach_countdown_elapsed":s(void 0,!0);break;case"resume_conversation_prompt":t(fo());break;case"translation_proposal":t(Ai(n.body));break;case"user_first_response":t(Hr(!0)),r.emit("system.userFirstResponse",n.body)}break;case"message":switch(o(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&&t(mo(n.service.serviceSessionId)),t(ro(c))}break;case"participant":o(c);break;case"service_data":n.persist&&t(ko(n));break;case"ack":t(no(c));break;case"system":if("service_changed"===n.type){const{serviceSettings:e}=n,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["serviceSettings"]),{entry:o}=e,{upload:i}=o.options;t(wo({key:pt,enabled:!(!i||!i.enabled)})),t(Ao(o)),n.serviceSessionId&&t(mo(n.serviceSessionId)),a("system.serviceChanged",r)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||t(ro(c));break;case"error":switch(n.type){case"find_conversation_erred":const e=new p(c);t(Gr({name:e.name,action:e.action,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError}));break;case"conversation_erred":const n=new u(c);t(Gr({name:n.name,message:n.message,langKey:n.langKey,originalEvent:n.originalEvent,originalError:n.originalError,action:n.action}))}}return n}}}),[e,e.connectionInfo,e.conversation.channel,t,a,s,r,i]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:t}=e.conversation;t.on("message",(e=>ll.includes(e.type)?(e.id!==o.current&&r.emit("message",e),o.current=e.id,e):e))}}),[e,e.connectionInfo,e.conversation.channel,r]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:r}=e.conversation,o=r.on("sync",(r=>{var o;const i=n[n.length-1],s=null===(o=null==r?void 0:r.lastEvent)||void 0===o?void 0:o.id;return i&&s===i.payload.id?r:e.getConversation().then((e=>{e&&t(_o(e))})).catch((e=>{t(Gr({name:null==e?void 0:e.name,message:null==e?void 0:e.message,langKey:null==e?void 0:e.langKey,action:null==e?void 0:e.action,originalEvent:null==e?void 0:e.originalEvent,originalError:null==e?void 0:e.originalError}))}))}));return()=>{r.off("sync",o)}}return()=>{}}),[e,e.connectionInfo,e.conversation.channel,n,t]),null},pl=({children:t})=>{const{t:n}=fs(),r=He(),o=zi(),{addUploadBubble:i}=Ki();return(0,e.jsx)(Ss.Provider,{value:e=>{const t=_(),s=o.uploadFile(e,(e=>{r(Ro({fileId:t,progress:Math.ceil(e)}))}),(e=>{const{id:n,transactionId:o,occurredAt:s,body:{contentType:a,filename:c,filesize:l,url:u}}=e.body;r(No(t)),i(n,o,s,a,c,l,u)}),(e=>{let o;switch(e&&e.body?e.body.error:""){case"file_uploads_are_disabled":o=n("fileUpload.errors.unavailable");break;case"request_entity_too_large":o=n("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":o=n("fileUpload.errors.wrongType");break;case"virus_found":o=n("fileUpload.errors.virusFound");break;default:o=n("fileUpload.errors.general")}r(Io({fileId:t,errorText:o}))}));r(ho({fileId:t,fileName:e.name,uploadHandle:s}))},children:t})},dl=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=zs();return((e,t)=>{const n=(0,_e.useRef)(e);(0,_e.useEffect)((()=>{n.current=e}),[e]),(0,_e.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n>0?1e3:null),null},fl=()=>{const{initUserSelectedOptions:e}=Ds(),t=(0,_e.useRef)(!1),n=br();return(0,_e.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null},hl=pr((({interrupt:e})=>e),(({error:e})=>e));function yl(){const{t:e}=fs(),t=De(hl);return{hasInterrupt:Boolean(t),meta:(0,_e.useMemo)((()=>{if(!t)return{};const{langKey:n,action:r}=t,o=e(`${n}.title`),i=e(`${n}.message`),s=e(`${n}.srText`),a=e(`${n}.buttonText`);return Object.assign(Object.assign(Object.assign(Object.assign({},n?{title:o,message:i,srText:s}:{}),r?{action:r}:{}),r&&n?{buttonText:a}:{}),{originalError:t})}),[e,t]),error:t}}function bl(e,t,n=[]){const r=(0,_e.useContext)(We),o=(0,_e.useRef)();o.current=t,(0,_e.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>o.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const ml=()=>{const e=br(),{sendMessage:t,sendContext:n,sendAction:r}=Ki(),o=He(),{setVisibility:i,visible:s}=Fi(),c=(0,_e.useRef)(s),l=(0,_e.useContext)(We),u=zi(),p=Cr(),d=(0,_e.useRef)(null),f=(0,_e.useRef)(null),{isInline:h,isResolving:y}=kr(),{hasInterrupt:b}=yl(),m=(()=>{const{get:e}=Hi();return e?e("conversationUrl"):null})(),v=(0,_e.useRef)(null),g=Us(),{enableTranslations:w,disableTranslations:O}=Gs();return(0,_e.useEffect)((()=>{c.current=s}),[s]),bl("askText",(e=>{t({body:e})}),[u?.send]),bl("setVariables",(e=>{n({variables:e})}),[u?.send]),bl("getVisibility",(e=>{e?e(c.current):console.warn("A callback function is required for the getVisibility action.")})),bl("setVisibility",(e=>{Object.values(hr).includes(e)?(g(),i(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e?.api]),bl("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[u.send]),bl("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&o(Wo({showSuggestions:!1})),e&&t?r({type:ot,body:{name:e,fallbackMessage:t,participant:n?a:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[u.send]),bl("setTranslation",(({enabled:e,locale:t})=>{e?w(t,"window_api"):O()}),[u.send]),(0,_e.useEffect)((()=>{y||b||(v.current&&v.current!==m&&l.emit("unreadMessageCount",p),s===hr.open&&s!==f.current&&0!==d.current&&l.emit("unreadMessageCount",0),s!==hr.open&&p!==d.current&&l.emit("unreadMessageCount",p),f.current=s,d.current=p,v.current=m)}),[p,s,l,h,y,b,m]),null},vl=({children:t})=>{const n=(0,_e.useContext)(We),[r,o]=(0,_e.useState)({}),i=(0,_e.useRef)(!0),s=(0,_e.useCallback)((e=>{i.current&&(o(e),n.emit("aria-live",e))}),[o,n]);(0,_e.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),500)),()=>{clearTimeout(e)}}),[r,s]),(0,_e.useEffect)((()=>()=>{i.current=!1}),[]);const{ariaLive:a,messageText:c}=r;return(0,e.jsxs)(hs.Provider,{value:s,children:[t,(0,e.jsxs)("div",{className:Qs("app__live-container"),children:[(0,e.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Qs("visually-hidden"),children:a===ct?c:null}),(0,e.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Qs("visually-hidden"),children:a===lt?c:null})]})]})},gl=()=>{const{t:e}=fs(),t=jr(),n=(0,_e.useRef)(0),r=(0,_e.useRef)(0),o=gr().historyLoaded,{sendPolite:i}=ys(),{isOpen:s}=Fi(),a=(0,_e.useRef)(null),c=(0,_e.useRef)(null),l=(0,_e.useMemo)((()=>f((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(i(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[i,e]);return(0,_e.useEffect)((()=>{t.length>n.current&&(s&&(c.current=l(t)),n.current=t.length)}),[t,l,s]),(0,_e.useEffect)((()=>{a.current&&!s&&c.current&&(c.current(!0),c.current=null)}),[s]),(0,_e.useEffect)((()=>{o&&setTimeout((()=>{i(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,i]),null},wl=()=>{const{t:e}=fs(),{isOpen:t,isVisible:n}=Fi(),r=Cr(),{sendPolite:o}=ys(),i=(0,_e.useMemo)((()=>f(o,2e3)),[o]),s=(0,_e.useRef)(null),a=(0,_e.useRef)(null);return(0,_e.useEffect)((()=>{s.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=i(e("message.srTextUnreadCount",{unreadCount:r}))),s.current=n}),[r,t,n,i,e]),null},Ol=({store:t,children:n,eventBus:r,api:o})=>((0,_e.useErrorBoundary)((e=>{t.dispatch(Qo(e))})),(0,e.jsx)(Fe,Object.assign({store:t},{children:(0,e.jsx)(We.Provider,Object.assign({value:r},{children:(0,e.jsx)(qe.Provider,Object.assign({value:o},{children:(0,e.jsx)(vl,{children:(0,e.jsx)(ms,{children:(0,e.jsxs)(al,{children:[(0,e.jsx)(fl,{}),(0,e.jsx)(ul,{}),(0,e.jsx)(wl,{}),(0,e.jsx)(gl,{}),(0,e.jsx)(dl,{}),(0,e.jsxs)(cl,{children:[(0,e.jsx)(ml,{}),(0,e.jsx)(pl,{children:n})]})]})})})}))}))}))),jl=()=>{const{t}=fs(),{showDisclaimer:n}=br();return n&&(0,e.jsxs)("div",{className:Qs("disclaimer"),tabIndex:"0",children:[(0,e.jsx)("h2",{className:Qs("disclaimer__title"),children:t("disclaimer.title")}),(0,e.jsx)("div",{className:Qs("disclaimer__message"),dangerouslySetInnerHTML:{__html:t("disclaimer.content")}})]})},xl=require("preact/compat"),_l=(0,xe.createContext)(null),Cl=e=>{const t=(0,_e.useContext)(vs),n=t[e.type];let r=n[e.payload.type],o=null;return"choice_prompt"===e.payload.type&&(o=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,o]},Sl=({event:t,newParticipant:n})=>{const{eventRefs:r,unreadIds:o}=(0,xl.useContext)(_l),{sendAction:i}=Ki(),s=r[t.payload.id],{containerRef:a,isVisible:c}=Bi({containerRef:s,freezeOnceVisible:!0}),l=He(),[u,p]=Cl(t);if((0,xl.useEffect)((()=>{if(c&&(null==o?void 0:o.includes(t.payload.id))){const e=o.reduce(((e,n)=>e.includes(t.payload.id)?e:e.concat(n)),[]);l(go(e)),i({type:tt,events:e})}}),[l,t.payload.id,c,i,o]),!u)return null;const d=["conversation__item"];return"info"===t.type?d.push("conversation__item--source-info"):t.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),n&&d.push("conversation__item--new-participant"),(0,e.jsxs)("li",Object.assign({className:Qs(d),ref:a},{children:[t.timeIndicator&&(0,e.jsx)(Qa,{event:t}),(0,e.jsx)(u,Object.assign({event:t},{children:(0,e.jsx)(p,{event:t})}))]}))},El=()=>{const{id:t}=Pr()||{};return(0,e.jsx)("li",{className:Qs("conversation__item","conversation__item--source-agent"),children:(0,e.jsxs)("div",{className:Qs("message","message--source-agent","message--type-loading"),children:[(0,e.jsx)(Ys,{eventPayload:{fromClient:!1,participant:t}}),(0,e.jsx)("div",{className:Qs("message__body"),children:(0,e.jsxs)("span",{className:Qs("loader"),children:[(0,e.jsx)("span",{className:Qs("loader__part","one")}),(0,e.jsx)("span",{className:Qs("loader__part","two")}),(0,e.jsx)("span",{className:Qs("loader__part","three")}),(0,e.jsx)("span",{className:Qs("loader__part","four")})]})})]})})},Pl=()=>{const t=jr();let n=null;return(0,e.jsx)(e.Fragment,{children:t.map((t=>{const{type:r,payload:o}=t;let i=!1;if("participant"!==r&&"service_data"!==r){const{participant:e,fromClient:r}=o,s=r?"seamly-client-participant":e;"info"!==t.type&&n!==s&&(i=!0),n=s}return(0,e.jsx)(Sl,{event:t,newParticipant:i},t.payload.key||t.payload.id)}))})},Tl=()=>{const{t}=fs(),n=xr(),{isOpen:r}=Fi(),o=Sr(),i=Cs();return(0,e.jsxs)(e.Fragment,{children:[r&&(0,e.jsx)("a",Object.assign({className:Qs("skip-link"),href:`#${o}`,onClick:e=>{e.preventDefault(),i()}},{children:t("skiplinkText")})),(0,e.jsx)("div",Object.assign({className:Qs("chat__body")},{children:(0,e.jsxs)("div",Object.assign({className:Qs("conversation__container")},{children:[(0,e.jsx)(jl,{}),(0,e.jsxs)("ol",Object.assign({className:Qs("conversation")},{children:[(0,e.jsx)(al,{children:(0,e.jsx)(Pl,{})}),n&&(0,e.jsx)(El,{})]}))]}))}))]})},kl={visible:Qs("transition--visible"),in:Qs("transition--in"),visuallyHidden:Qs("visually-hidden")},Al=Object.values(kl),Nl="notRendered",Il="rendered",Rl="visuallyHidden",Dl=({children:t,isActive:n,timeout:r=300,transitionStartState:o="notRendered",onInTransitionComplete:i=(()=>{}),onOutTransitionComplete:s=(()=>{})})=>{const a=(0,_e.useRef)(!1),c=parseInt(r,10),l=qs(i),u=qs(s),p=o===Rl,[d,f]=(0,_e.useState)((()=>p?[kl.visuallyHidden]:[])),h="notRendered"!==o||d.length>0;return(0,_e.useEffect)((()=>{let e=null,t=null;return a.current&&!n&&(f([kl.visible]),e=setTimeout((()=>{f([...p?[kl.visuallyHidden]:[]]),u&&(t=requestAnimationFrame((()=>{u()})))}),c)),!a.current&&n&&(f([kl.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{f([kl.visible,kl.in]),l&&(e=setTimeout((()=>{l()}),c))}))}))),a.current=n,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[n,p,c,l,u]),(0,e.jsx)(e.Fragment,{children:h&&(0,xe.toChildArray)(t).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!Al.includes(e)));return(0,xe.cloneElement)(e,{className:[...n,...d].join(" ")})}))})},Ml=({isAside:t=!1})=>{const{isInline:n}=kr(),{t:r}=fs(),{sendAction:o,addMessageBubble:i}=Ki(),{isOpen:s,setVisibility:a}=Fi(),{showSuggestions:c}=br(),l=Vs(),u=Cs(),p=(0,_e.useRef)(null),{sendPolite:d}=ys(),{hasInterrupt:f}=yl(),{hasCountdown:h,endCountdown:y}=zs(),{hasPrompt:b,continueChat:m}=Hs(),v=Br(),g=Tr("suggestion"),{body:w}=Ks({payload:g}),j=(0,_e.useMemo)((()=>g&&!f?w:[]),[g,f,w]),x=(0,_e.useRef)(null),_=(0,_e.useRef)(!1),C=(0,_e.useRef)([]),S=!!j.length,E=n?(v||s)&&!t:v,P=(0,_e.useRef)(E),T=S&&!E&&c,k=S?j:C.current;C.current=k;const A=(0,_e.useMemo)((()=>{const e=["suggestions"];return t&&e.push("suggestions--aside"),Qs(e)}),[t]),N=(0,_e.useCallback)((({id:e,question:t})=>{h&&y(!0),b&&m(),o({type:Ze,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),i(t),s||a(hr.open),u()}),[i,m,y,u,h,b,g,o,a,s]);(0,_e.useEffect)((()=>{if(x.current!==j&&!E){if(S){const e=_.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{d(e)}),30)}else _.current&&d(r("suggestions.srUnavailableText"));x.current=j}!P.current&&E?(O(p.current,u),d(r("suggestions.srUnavailableText"))):!S&&_.current&&O(p.current,u),_.current=S,P.current=E}),[j,S,E,u,d,r]);const I=r("suggestions.headingText"),R=r("suggestions.footerText"),D=I?"section":"div";return(0,e.jsx)(Dl,{isActive:T,transitionStartState:Nl,children:(0,e.jsxs)(D,{className:A,"aria-labelledby":I?l:null,ref:p,children:[I&&(0,e.jsx)("p",{id:l,className:Qs("suggestions__heading"),children:I}),!!k.length&&(0,e.jsx)(Ra,{suggestions:k,onClickSuggestion:N}),R&&!s&&(0,e.jsx)("p",{className:Qs("suggestions__footer"),children:R})]})})},Ll=(0,xl.forwardRef)((({children:t,className:n=""},r)=>{const{isOpen:o,isVisible:i,setVisibility:s}=Fi(),{namespace:a,layoutMode:c}=br(),{isInline:l}=kr(),u=gs(),p=Br(),{t:d}=fs(),f=["chat",`chat--layout-${c}`,`namespace--${a}`,...u,n];return o||"app"===c||f.push("chat--collapsed"),p&&f.push("chat--user-responded"),i&&(0,e.jsxs)("section",{className:Qs(f),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&o&&s(hr.minimized)},tabIndex:"-1",ref:r,"aria-label":d("chat.srLabel"),children:[(0,e.jsx)("div",{className:Qs("chat-wrapper"),children:t}),"inline"===c&&o&&(0,e.jsx)(Ml,{isAside:!0})]})})),Ul=Ll,Fl=({className:t,children:n,onCancel:r,headingText:o,description:i,descriptionId:s,cancelButtonText:a,cancelButtonRef:c,disableButtonFocusing:l,position:u={horizontal:"left",vertical:"top"}})=>{const p=Vs(),{hideOption:d}=Ds(),{focusButton:f}=Ms(),h=(0,_e.useCallback)((()=>{d(),l||f()}),[l,f,d]),y=(0,_e.useCallback)((()=>{r&&r(),h()}),[h,r]),b=(e=>{const t=(0,_e.useRef)(null);return(0,_e.useEffect)((()=>{const n=({target:n})=>{t.current&&n instanceof HTMLElement&&!t.current.contains(n)&&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})(y);return(0,_e.useEffect)((()=>{w(b.current)}),[b]),(0,e.jsx)("section",Object.assign({className:Qs("options",{"options--right":"right"===u.horizontal,"options--left":"left"===u.horizontal,"options--top":"top"===u.vertical,"options--bottom":"bottom"===u.vertical},t),"aria-labelledby":p,tabIndex:-1,ref:b},{children:(0,e.jsxs)("div",Object.assign({className:Qs("options__body")},{children:[(0,e.jsx)("h2",Object.assign({id:p,className:Qs("options__title")},{children:o})),(0,e.jsxs)("button",Object.assign({type:"button",onClick:y,"aria-describedby":p,className:Qs("button","options__close"),ref:e=>{c&&(c.current=e)}},{children:[(0,e.jsx)(ba,{name:"close",size:"16",alt:""}),(0,e.jsx)("span",{children:a})]})),i?(0,e.jsx)("p",Object.assign({className:Qs("options__description"),id:s},{children:i})):null,(0,e.jsx)("div",Object.assign({className:Qs("options__wrapper")},{children:n}))]}))}))},Bl=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),$l=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},zl=e=>!!e?.length>0,Hl=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))},Vl=e=>!!e,ql=(0,xe.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),Wl=ql,{Provider:Gl,Consumer:Kl}=ql,Jl=pr((({forms:e})=>e),((e,{formId:t})=>t),((e,t)=>e[t])),Xl=pr(Jl,(e=>(null==e?void 0:e.controls)||{})),Ql=pr(Xl,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Yl=pr(Xl,((e,{name:t})=>t),((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.value})),Zl=pr(Xl,((e,{name:t})=>t),((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.touched}));function eu(){return(0,_e.useContext)(Wl)}function tu(e){const t=He(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:i}=eu(),s=!!De((e=>Jl(e,{formId:n}))),a=De((t=>Yl(t,{formId:n,name:e}))),c=De((t=>Zl(t,{formId:n,name:e}))),l=null==i?void 0:i[e],u=!l;(0,_e.useEffect)((()=>{s&&t(ii({formId:n,name:e}))}),[s,n,e,t]),(0,_e.useLayoutEffect)((()=>()=>{t(si({formId:n,name:e}))}),[s,n,e,t]);const p=(0,_e.useCallback)((t=>r(e,t.target.value)),[e,r]),d=(0,_e.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,_e.useMemo)((()=>({name:e,onInput:p,onBlur:d,value:a})),[e,p,d,a]),(0,_e.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function nu(t){var{children:n,formId:r,persistData:o,onError:i,onSubmit:s,validationSchema:a}=t,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["children","formId","persistData","onError","onSubmit","validationSchema"]);const l=He(),u=De((e=>Ql(e,{formId:r}))),[p,d]=(0,_e.useState)(!1),[f,h]=(0,_e.useState)({}),{isValid:y,errors:b}=function(e,t){const n=(0,_e.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{var o;const i=Array.isArray(r)?r:[r];for(let r=0;null!==(o=r<(null==i?void 0:i.length))&&void 0!==o&&o;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}}(u,a),m=(0,_e.useMemo)((()=>Object.assign(Object.assign({},b),f)),[b,f]);(0,_e.useLayoutEffect)((()=>{l(ri({formId:r,persistData:o}))}),[r,o,l]),(0,_e.useEffect)((()=>()=>{l(oi({formId:r}))}),[r,o,l]);const v=(0,_e.useCallback)(((e,t)=>{l(ai({formId:r,name:e,value:t}))}),[r,l]),g=(0,_e.useCallback)(((e,t)=>{l(ci({formId:r,name:e,touched:t}))}),[l,r]),w=(0,_e.useCallback)(((e,t)=>{h((n=>Object.assign(Object.assign({},n),{[e]:t})))}),[h]),O=(0,_e.useCallback)((e=>{var t;e.preventDefault();const n="true"===(null===(t=e.submitter)||void 0===t?void 0:t.ariaDisabled);d(!n),!n&&y&&(l(Hr(!0)),s(u,{updateControlValue:v,setError:w}))}),[y,l,s,u,v,w]);(0,_e.useEffect)((()=>{i&&i({errors:m,isSubmitted:p,isValid:0===Object.keys(m).length})}),[p,m,i]);const j=(0,_e.useMemo)((()=>({formId:r,values:u,errors:m,isValid:0===Object.keys(m).length,isSubmitted:p,handleSubmit:O,validationSchema:a,updateControlValue:v,updateControlTouched:g})),[r,u,m,p,O,a,v,g]);return r?s?(0,e.jsx)(Gl,Object.assign({},c,{value:j},{children:n})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}const ru=["className","disableValidationClasses"];function ou(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 iu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const su=function(t){let{className:n,disableValidationClasses:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,ru);const{handleSubmit:i,isValid:s,isSubmitted:a}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=eu();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),c=["form"];return!r&&a&&(c.push("form--submitted"),s?c.push("form--valid"):c.push("form--invalid")),(0,e.jsx)("form",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ou(Object(n),!0).forEach((function(t){iu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({onSubmit:i,className:Qs([...c,n])},o))};function au({id:t,error:n}){const[r,o]=(0,_e.useState)(!1);return(0,_e.useEffect)((()=>{const e=setTimeout((()=>o(!0)),300);return()=>clearTimeout(e)}),[]),(0,e.jsx)("div",{className:Qs("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&n&&(0,e.jsxs)("span",{id:t,className:Qs("error__message"),children:[(0,e.jsx)(ba,{name:"error",size:"16"}),n]})})}const cu=({contentHint:t,id:n,labelText:r,labelClass:o=Qs("label"),validity:i,errorText:s,children:a})=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("label",{htmlFor:n,className:o,children:r}),t&&(0,e.jsx)("span",{id:`${n}-content-hint`,className:Qs("input__content-hint"),children:t}),(0,e.jsx)(au,{id:`${n}-error`,error:!i&&s}),a]}),lu=["id","name","type","labelText","labelClass","contentHint","aria-describedby"];function uu(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 pu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uu(Object(n),!0).forEach((function(t){du(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function du(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const fu=function(t){let{id:n,name:r,type:o,labelText:i,labelClass:s,contentHint:a,"aria-describedby":c}=t,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,lu);const{isSubmitted:u}=eu(),[p,{error:d}]=tu(r),f=u&&d,h=[];return c&&h.push(c),a&&h.push(`${n}-content-hint`),f&&h.push(`${n}-error`),(0,e.jsx)(cu,{id:n,contentHint:a,validity:!f,errorText:d,labelText:i,labelClass:s,children:(0,e.jsx)("input",pu(pu({id:n,name:r,type:o,"aria-invalid":f?"true":"false","aria-describedby":h.join(" ")||null},p),l))})};function hu({controlName:t,describedById:n}){const{t:r}=fs();return(0,e.jsxs)(su,{noValidate:"true",className:Qs("options__form"),children:[(0,e.jsx)(fu,{name:t,type:"email",className:Qs("transcript__input"),"aria-describedby":n,labelClass:Qs("label"),labelText:r("options.sendTranscript.label")}),(0,e.jsx)("div",{className:Qs("options__actions"),children:(0,e.jsx)("button",{type:"submit",className:Qs("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const yu="email",bu={sendTranscript:()=>{const[t,n]=(0,_e.useState)(void 0),{hideOption:r}=Ds(),{focusButton:o}=Ms(),{t:i}=fs(),s=Vs(),{sendAction:a}=Ki(),c=(0,_e.useMemo)((()=>({[yu]:[Bl(Vl,i("options.sendTranscript.noEmailText")),Bl(Hl,i("options.sendTranscript.invalidEmailText"))]})),[i]),l=(0,_e.useCallback)((e=>{const t=e.email.trim();a({type:"send_transcript",body:{emailAddress:t}}),r(),o()}),[a,r,o]),u=(0,_e.useCallback)((({isValid:e,isSubmitted:t})=>{n(t&&!e?"options--error":void 0)}),[n]);return(0,e.jsx)(Fl,{className:t,headingText:i("options.sendTranscript.title"),cancelButtonText:i("options.cancelButtonText"),description:i("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,e.jsx)(nu,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,e.jsx)(hu,{controlName:yu,describedById:s})})})}},mu=()=>{const{optionActive:t}=Ds(),n=(0,_e.useRef)(null),r=bu[t||n.current];return t&&(n.current=t),r?(0,e.jsx)(r,{}):null},vu=()=>{const{t}=fs(),{menuOptions:n,showOption:r,panelActive:o,hideOption:i}=Ds(),{id:s}=Ms(),a=(0,_e.useRef)(null),[c,l]=(0,_e.useState)(!1),u=(0,_e.useRef)(null),p=n.length,d=(0,_e.useRef)(Array.from({length:p},(()=>(0,xe.createRef)()))),f=(0,_e.useRef)(!1),h=p>1,y=n[0],b=(0,_e.useMemo)((()=>y?.name?.trim().replace(/\s+/g,"")),[y]);return(0,_e.useEffect)((()=>()=>{clearTimeout(a.current)}),[]),(0,_e.useEffect)((()=>{c&&!f.current&&requestAnimationFrame((async()=>{await Os(60);const e=n.findIndex((e=>e.available)),t=-1===e?0:e;w(d.current[t])})),f.current=c}),[c,n]),p?(0,e.jsxs)("div",{className:Qs("options__container"),onKeyDown:e=>{c&&(g(e)===v.Escape&&(l(!1),w(u.current)),g(e)===v.Home&&(w(d.current[0]),e.preventDefault()),g(e)===v.End&&(w(d.current[p-1]),e.preventDefault()))},onfocusout:()=>{h&&(a.current=setTimeout((()=>{l(!1)}),200))},onfocusin:()=>{clearTimeout(a.current)},children:[(0,e.jsx)(Dl,{transitionStartState:Nl,isActive:o,children:(0,e.jsx)("div",{className:Qs("options__dialog"),children:(0,e.jsx)(mu,{})})}),h&&(0,e.jsx)(Dl,{isActive:c,transitionStartState:Nl,children:(0,e.jsx)("ul",{className:Qs(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":s,children:n.map((({name:o,title:i,available:s},a)=>(0,e.jsx)("li",{className:Qs("options__menu__item"),role:"menuitem","data-testid":o,children:(0,e.jsxs)("button",{type:"button",ref:e=>{d.current[a]=e},className:Qs(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(g(e)===v.ArrowDown){const n=Math.min(p-1,t+1);w(d.current[t===n?0:n]),e.preventDefault()}if(g(e)===v.ArrowUp){const n=Math.max(0,t-1);w(d.current[t===n?p-1:n]),e.preventDefault()}})(e,a),onKeyPress:e=>((e,t)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;n.forEach(((e,n)=>{n>t&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=n)})),-1!==o&&w(d.current[o])})(e,a),onClick:()=>((e,t)=>{t&&(l(!1),r(e))})(o,s),"aria-disabled":s?null:"true",children:[(0,e.jsxs)("span",{className:Qs("button__text"),children:[i,!s&&" "]}),!s&&(0,e.jsx)("span",{className:Qs("button__state"),children:t("options.unavailableText")})]})},o)))})}),(0,e.jsxs)("button",{type:"button",className:Qs(["button","button--secondary","chat__options__button",...!h&&b?[`chat__options__button--${b}`]:[]]),id:s,onClick:()=>{o&&i(),h?l((e=>!e)):y.available&&r(y.name)},onKeyDown:h?e=>{g(e)===v.ArrowDown&&(l(!0),e.preventDefault())}:null,ref:u,"aria-haspopup":h?"menu":null,"aria-expanded":h?c.toString():null,"aria-disabled":h||y.available?null:"true",children:[h&&(0,e.jsx)(ba,{name:"options",size:"32"}),(0,e.jsx)("span",{className:Qs("button__text"),children:h?t("options.openButtonText"):`${y.title}${y.available?"":" "}`}),!h&&!y.available&&(0,e.jsx)("span",{className:Qs("button__state"),children:t("options.unavailableText")})]})]}):null},gu=({label:t,checked:n,description:r,onChange:o,id:i})=>(0,e.jsxs)("li",Object.assign({className:Qs("translation-options__item",{"translation-options__item--checked":n})},{children:[(0,e.jsx)("input",{id:i,type:"radio",value:t,checked:n,className:Qs("visually-hidden"),onChange:o,name:"language"}),(0,e.jsxs)("label",Object.assign({htmlFor:i},{children:[(0,e.jsx)(ba,{alt:"",name:"check",size:"16"}),t," ",r&&(0,e.jsxs)("span",{children:["(",r,")"]})]}))]})),wu=({onChange:t,describedById:n})=>{const{context:{locale:r}}=br(),{t:o}=fs(),{focusContainer:i}=Js(),{languages:s,currentLocale:a,enableTranslations:c,disableTranslations:l}=Gs(),u=({locale:e})=>()=>{e===a||r===e?l():c(e),t(),i()},p=(0,_e.useMemo)((()=>[...s].sort(((e,t)=>e.locale===r?-1:t.locale===r?1:e.nativeName.localeCompare(t.nativeName,void 0,{sensitivity:"base"})))),[s,r]);return(0,e.jsx)("ul",Object.assign({"aria-describedby":n,className:Qs("translation-options")},{children:p.map(((t,n)=>{const r=0===n,i=a===t.locale||!a&&r;return(0,e.jsx)(gu,{id:t.locale,label:t.nativeName,checked:i,description:r&&o("translations.settings.original"),onChange:u(t)},t.locale)}))}))},Ou=function({onClose:t,position:n}){const{t:r}=fs(),o=Vs();return(0,e.jsx)(Fl,Object.assign({onCancel:t,headingText:r("translations.menu.title"),cancelButtonText:r("translations.settings.cancelButtonText"),description:r("translations.menu.description"),descriptionId:o,position:n,disableButtonFocusing:!0},{children:(0,e.jsx)(wu,{describedById:o,onChange:t})}))};function ju({children:t,position:n={horizontal:"left",vertical:"top"},classNames:r}){const[o,i]=(0,_e.useState)(!1),s=(0,_e.useRef)(null),a=Vs();return(0,e.jsxs)("div",Object.assign({className:Qs("translations__container"),onKeyDown:e=>{o&&g(e)===v.Escape&&(i(!1),w(s.current))}},{children:[(0,e.jsx)(Dl,Object.assign({onOutTransitionComplete:()=>{},onInTransitionComplete:()=>{},timeout:0,transitionStartState:Nl,isActive:o},{children:(0,e.jsx)("div",Object.assign({className:Qs("options__dialog"),role:"dialog"},{children:(0,e.jsx)(Ou,{onClose:()=>{i(!1)},position:n})}))})),(0,e.jsx)("button",Object.assign({type:"button",className:Qs(["button","chat__options__button",...r]),id:a,onClick:()=>{i((e=>!e))},onKeyDown:e=>{g(e)===v.ArrowDown&&(i(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":o.toString()},{children:t}))]}))}function xu(){const{menuOptions:t,allowOptionSelection:n}=Ds(),{isAvailable:r}=Gs(),{hasInterrupt:o}=yl(),{t:i,locale:s}=fs(),a=Xs(s);if(!r&&(!n||!t.length)||o)return null;const c=i("translations.settings.openButtonText",{hasLanguage:!!a,language:a});return(0,e.jsxs)("div",{className:Qs("chat__options"),children:[r&&(0,e.jsx)("div",{className:Qs("chat__options-item","chat__options-item--left"),children:(0,e.jsxs)(ju,{classNames:["button--secondary"],children:[(0,e.jsx)(ba,{alt:c,name:"newTranslation",size:"16"}),(0,e.jsx)("span",{className:Qs("button__text"),children:c})]})}),n&&(0,e.jsx)("div",{className:Qs("chat__options-item","chat__options-item--right"),children:(0,e.jsx)(vu,{})})]})}const _u=()=>{const{scrollToRef:t,unreadIds:n}=(0,_e.useContext)(_l),{isMinimized:r}=Fi(),{t:o}=fs();return(0,e.jsx)(Dl,Object.assign({isActive:!!n.length&&!r},{children:(0,e.jsx)("div",Object.assign({className:Qs("unread-messages")},{children:(0,e.jsxs)("button",Object.assign({type:"button",className:Qs("button","button--primary"),onClick:t},{children:[o("message.unreadMessagesCount",{unreadCount:n.length}),(0,e.jsx)(ba,{name:"chevronDown",size:"32",alt:""})]}))}))}))},Cu=pr(Or,(e=>e.filter((e=>{var t;return Xr(e)&&"service_data"!==e.type&&(null===(t=e.payload)||void 0===t?void 0:t.messageStatus)===Qe})).map((e=>e.payload.id))));const Su=e=>{const t=(0,_e.useRef)(),[n,r]=(0,_e.useState)(!0),o=De(Cu),i=jr(),s=xr(),{isOpen:a}=Fi(),c=gr().loadedImageEventIds,l=De((e=>e.state.isLastEventFromClient));(0,_e.useEffect)((()=>{const e=t.current,n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,i=Math.abs(t-n-o)>10;r(!i)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const u=(0,_e.useCallback)((()=>{requestAnimationFrame((()=>function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){var e,n;yield Os(30),null===(e=t.current)||void 0===e||e.scrollTo({top:null===(n=t.current)||void 0===n?void 0:n.scrollHeight,left:0,behavior:"auto"})}))))}),[]);return(0,_e.useEffect)((()=>{l&&u()}),[l,u]),(0,_e.useEffect)((()=>{n&&u()}),[n,o,i,s,a,c,u]),{containerRef:t,unreadIds:o,scrollToRef:()=>{var n,r;const i=null===(n=e[null==o?void 0:o.at(0)])||void 0===n?void 0:n.current;null===(r=t.current)||void 0===r||r.scrollTo({top:null==i?void 0:i.offsetTop,behavior:"auto",left:0})},scrollToBottom:u}},Eu=({children:t})=>{const n=jr(),r=(0,_e.useMemo)((()=>n.reduce(((e,t)=>(e[t.payload.id]=(0,xe.createRef)(),e)),{})),[n]),{scrollToRef:o,scrollToBottom:i,containerRef:s,unreadIds:a}=Su(r);return(0,e.jsx)(_l.Provider,Object.assign({value:{eventRefs:r,unreadIds:a,scrollToRef:o,scrollToBottom:i,containerRef:s}},{children:(0,e.jsxs)("div",Object.assign({className:Qs("chat__container")},{children:[(0,e.jsx)("div",Object.assign({className:Qs("chat__container__scroll-area"),ref:s},{children:t})),(0,e.jsx)(_u,{})]}))}))},Pu=({baseClassName:t,children:n,title:r})=>{const o=Sr(),i=Vs();return(0,e.jsxs)("section",{id:o,className:Qs(t),"aria-describedby":i,tabIndex:"-1",children:[(0,e.jsx)("h2",{className:Qs(`${t}__title`),id:i,children:r}),n]})},Tu=()=>{const{t}=fs(),n=Cs(),r=Us(),{emitEvent:o}=Ki(),{isActive:i,remaining:s,timer:a,endCountdown:c}=zs(),l=s>0,u=t(l?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,e.jsx)(Pu,{baseClassName:"idle",title:u,children:l&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:Qs("idle__count-container"),children:i&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:Qs("idle__count-text"),children:t("idleDetachWarning.countdownText")}),(0,e.jsx)("span",{className:Qs("idle__count-timer"),children:t("idleDetachWarning.countdownTimer",a)})]})}),(0,e.jsxs)("div",{className:Qs("idle__options"),children:[(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{r(),c(!0),n(),o("idleTimer.selectContinue")},children:t("idleDetachWarning.continueButton")}),(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{c(),n(),o("idleTimer.selectEnd")},children:t("idleDetachWarning.detachButton")})]})]})})},ku=()=>{const{t}=fs(),n=Us(),{name:r}=Pr()||{},{continueChat:o,restartChat:i}=Hs();return(0,e.jsx)(Pu,{baseClassName:"prompt",title:t("resumeConversationPrompt.title",{name:r}),children:(0,e.jsxs)("div",{className:Qs("prompt__options"),children:[(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{n(),o()},children:t("resumeConversationPrompt.continueButton")}),(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:i,children:t("resumeConversationPrompt.detachButton")})]})})};function Au(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 Nu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Iu=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=gr().entryMeta,i=He(),s=n||t||e,a=o[s]||r[s]||{},c=(0,_e.useCallback)((e=>{i(vo(e))}),[i]),l=(0,_e.useCallback)((e=>{i(bo(e))}),[i]),u=(0,_e.useCallback)((e=>{i(Do(e))}),[i]),p=(0,_e.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:s,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:p,setBlockAutoEntrySwitch:c}};function Ru({controlName:t,skipLinkId:n}){const{t:r}=fs(),{sendAssertive:o}=ys(),{emitEvent:i}=Ki(),s=(()=>{const{sendAction:e}=Ki(),{features:t}=Ds(),{typingPeekahead:n}=t||{},r=(0,_e.useRef)(null),o=(0,_e.useRef)(null),i=(0,_e.useRef)(!1),s=(0,_e.useRef)(null);(0,_e.useEffect)((()=>()=>{clearInterval(s.current),clearTimeout(r.current),clearTimeout(o.current)}),[]);const a=(t,r)=>{e(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Au(Object(n),!0).forEach((function(t){Nu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:et,state:t},n&&n.enabled?{body:{currentMessage:r}}:{}))};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(i.current=!0,s.current||(a(!0,e.target.value),s.current=setInterval((()=>{i.current?n&&n.enabled&&a(!0,e.target.value):(clearInterval(s.current),s.current=null)}),2e3)),clearTimeout(r.current),clearTimeout(o.current),r.current=setTimeout((()=>{i.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}})(),{setBlockAutoEntrySwitch:a}=Iu(),{hasCharacterLimit:c,characterLimit:l,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:d}=function(e){const{t}=fs(),{sendAssertive:n}=ys(),{hasLimit:r,limit:o}=(()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=gr(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}})(),i=(0,_e.useMemo)((()=>f(n,300)),[n]),s=(0,_e.useMemo)((()=>f(((e,n)=>{e&&i(t("input.srCharacterLimitText",{limit:n}))}),300)),[i,t]),[{value:a}]=tu(e),c=r&&a?o-a.length:o,l=!!r&&c<=50,u=!!r&&c<0;return(0,_e.useEffect)((()=>{s(l,c)}),[l,c,s]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}(t),[{value:h}]=tu(t),y=!!h,b=(0,_e.useCallback)((()=>{u&&o(r("input.srCharacterLimitText",{limit:d})),i("ui.inputFocus")}),[r,o,u,d,i]),m=(0,_e.useMemo)((()=>r("input.inputPlaceholder",{hasLimit:c,limit:c?l:null})),[r,c,l]),v=(0,_e.useMemo)((()=>r("input.inputLabel",{hasLimit:c,limit:c?l:null})),[r,c,l]);return(0,_e.useLayoutEffect)((()=>(a(y),()=>{a(!1)})),[a,y]),(0,e.jsxs)(su,{className:Qs("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,e.jsxs)("div",{className:Qs(["input--text__container",...u&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,e.jsx)(fu,{id:n,type:"text",name:t,className:Qs("input__text"),autocomplete:"off",placeholder:m,labelText:v,labelClass:Qs("visually-hidden"),"aria-invalid":c?p:null,onKeyUp:s,onFocus:b}),(0,e.jsx)("div",{className:Qs("character-count"),children:u&&(0,e.jsx)("span",{children:d})})]}),(0,e.jsx)("button",{className:Qs("button","input__submit"),type:"submit",onPointerDown:e=>{e.preventDefault()},"aria-disabled":!y||p?"true":null,children:(0,e.jsx)(ba,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}function Du(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 Mu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Du(Object(n),!0).forEach((function(t){Lu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Du(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uu(){return Uu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uu.apply(this,arguments)}const Fu="textMessageEntry";function Bu(t){let n=Uu({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(t),t));const{isOpen:r,setVisibility:o}=Fi(),i=Sr(),s=Cs(),{sendMessage:a}=Ki(),c=(0,_e.useCallback)(((e,{updateControlValue:t})=>{a({body:e.textMessageEntry}),t(Fu,""),s(),r||o(hr.open)}),[a,s,r,o]);return(0,e.jsx)(nu,Mu(Mu({},n),{},{formId:"textEntry",persistData:!0,onSubmit:c,children:(0,e.jsx)(Ru,{controlName:Fu,skipLinkId:i})}))}const $u=()=>{const{t}=fs(),{currentUploads:n}=As();return(0,e.jsx)("div",{className:Qs("progress"),children:n.map((({id:n,name:r,progress:o,uploading:i,error:s})=>(0,e.jsxs)("div",{className:Qs("progress_container"),children:[(0,e.jsxs)("div",{className:Qs("progress__text"),children:[(0,e.jsx)("span",{className:Qs("progress__text--file-name"),children:r}),(0,e.jsx)("span",{className:Qs("progress__text--percentage"),children:`${o}%`})]}),(0,e.jsx)(au,{error:s}),(0,e.jsx)("progress",{className:Qs("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":t("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":o,value:o,"aria-busy":i,children:`${o}%`})]},n)))})};function zu({id:t,name:n,labelText:r,contentHint:o,outputText:i,accept:s}){const{isSubmitted:a}=eu(),[c,l]=(0,_e.useState)(!1),[{onInput:u,onBlur:p},{error:d}]=tu(n),f=Vs(),h=Vs(),y=Vs(),b=a&&d,m=[y];o&&m.push(h),b&&m.push(f);const v=(0,_e.useCallback)((()=>{l(!0)}),[l]),g=(0,_e.useCallback)((()=>{l(!1),p()}),[l,p]),w=(0,_e.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,e.jsxs)("div",{className:Qs("upload__container"),children:[o&&(0,e.jsx)("span",{className:Qs("upload__content-hint"),id:h,children:o}),(0,e.jsx)(au,{id:f,error:b&&d}),(0,e.jsx)("div",{className:Qs(["file-upload",...c?["focus-within"]:[]]),children:(0,e.jsxs)("label",{htmlFor:t,className:Qs("upload__label"),children:[(0,e.jsx)(ba,{name:"upload",size:"32"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:Qs(["upload__label--text"]),children:r}),(0,e.jsx)("input",{id:t,className:Qs("upload__input"),type:"file",name:n,onChange:w,"aria-invalid":b?"true":"false","aria-describedby":m.join(" "),accept:s||null,onFocus:v,onBlur:g}),(0,e.jsx)("span",{className:Qs("upload__output"),"aria-hidden":"true",id:y,children:i})]})]})})]})}function Hu({skiplinkId:t,controlName:n,accept:r,contentHint:o,isUploading:i,isComplete:s,onClickCancel:a}){const{t:c}=fs(),[{value:l}]=tu(n),u=l&&l.length>0,p=u?l[0].name:"";return(0,e.jsxs)(su,{className:Qs("upload-form"),children:[(0,e.jsx)(zu,{name:n,id:t,accept:r,labelText:c("fileUpload.labelText"),outputText:c("fileUpload.selectedText",{hasFile:u,filename:p}),contentHint:o}),(0,e.jsxs)("div",{className:Qs("upload__button-container"),children:[(0,e.jsx)("button",{id:i||!s?t:void 0,type:"button",onClick:a,className:Qs("button","button--secondary","upload__cancel"),children:c("fileUpload.cancelButtonText")}),(0,e.jsx)("button",{className:Qs("button","button--primary"),type:"submit",children:c("fileUpload.uploadButtonText")})]})]})}const Vu="fileListForm",qu="fileList",Wu=()=>{const{t}=fs(),{sendPolite:n,sendAssertive:r}=ys(),o=Sr(),i=Cs(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=ks(),l=(0,_e.useRef)(null),u=(0,_e.useRef)(s),{cancelEntrySelection:p}=Iu(),{uploadFile:d,clearUploads:f,isUploading:h,isComplete:y}=As(),{hasFile:m,selectedFileName:v,uploadHandle:g,hasServerError:w,progress:O}=((e,t)=>{const n=De((n=>Yl(n,{formId:e,name:t}))),{currentUploads:r}=As(),o=n&&n.length>0;let i=null,s=!1,a=0;if(r&&r.length>0){const e=r[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(Vu,qu),j=Vs(),x=(0,_e.useRef)(!0),_=t("fileUpload.contentHint",{size:b(c)}),C=(0,_e.useRef)(""),S=(0,_e.useRef)(null);(0,_e.useEffect)((()=>{C.current&&S.current?.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(_),C.current=_}),[_,r]),(0,_e.useEffect)((()=>{O>0&&n(1===O?t("fileUpload.srStartedText"):`${O}%`)}),[O,n,t]),(0,_e.useEffect)((()=>{x.current||h||!y||(f(),p(),i(),setTimeout((()=>{n(t("fileUpload.srCompleteText"))}),300)),x.current=y}),[h,y,f,p,i,n,t]);const E=(0,_e.useCallback)((({fileList:e})=>{d(e[0]),i()}),[d,!1,i]),P=(0,_e.useCallback)((()=>{g&&g.abort(),f(),p(),i()}),[g,f,p,i]),T=(0,_e.useMemo)((()=>({[qu]:[Bl((()=>s),t("fileUpload.errors.unavailable")),Bl(zl,t("fileUpload.errors.noFile")),Bl($l,t("fileUpload.errors.tooLarge"),c)]})),[c,s,t]);return(0,e.jsx)("div",{className:Qs(["upload",...w?["upload--error"]:[]]),ref:S,children:(0,e.jsxs)(nu,{formId:Vu,persistData:!0,onSubmit:E,validationSchema:T,children:[(h||!y)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)($u,{}),(0,e.jsx)("div",{className:Qs("upload__button-container"),children:(0,e.jsx)("button",{id:h||!y?o:void 0,type:"button",onClick:P,ref:l,className:Qs("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]}),!h&&y&&(0,e.jsx)(Hu,{controlName:qu,skiplinkId:o,accept:a.join(", "),contentHint:_,isComplete:y,isUploading:h,outputText:t("fileUpload.selectedText",{hasFile:m,filename:v}),onClickCancel:P}),!u.current&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:Qs("notification"),id:j,children:t("fileUpload.unavailableText")}),(0,e.jsx)("div",{className:Qs("upload__button-container"),children:(0,e.jsx)("button",{id:h||!y?o:void 0,type:"button",onClick:P,className:Qs("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]})]})})},Gu=()=>{const{t}=fs(),{showFileUpload:n,serviceAllowsUploads:r}=ks(),[o,i]=(0,_e.useState)(r),s=Cs(),a=(0,_e.useRef)(null),{setUserEntryType:c,activeEntry:l}=Iu(),u=(0,_e.useRef)(null),{sendPolite:p}=ys(),d=!!Pr();return(0,_e.useEffect)((()=>{O(u.current,(()=>{r||s()})),i(r)}),[r,s]),(0,_e.useEffect)((()=>{a.current&&!r&&p(t("fileUpload.srUnavailableText")),!1===a.current&&r&&p(t("fileUpload.srAvailableText")),d&&(a.current=r)}),[r,d,p,t]),!n&&l!==Xe&&(0,e.jsx)(Dl,{isActive:o,transitionStartState:Il,children:(0,e.jsx)("div",{className:Qs("upload-toggle-wrapper"),children:(0,e.jsx)(Dl,{isActive:o,transitionStartState:Rl,children:(0,e.jsx)("button",{className:Qs(["button","button--secondary","upload-toggle"]),ref:u,"aria-disabled":o?null:"true",type:"button",onClick:o?()=>{c(Xe),s()}:null,children:(0,e.jsx)(ba,{name:"file",size:"32",alt:t("fileUpload.toggleButtonText")})})})})})};function Ku(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 Ju(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ku(Object(n),!0).forEach((function(t){Xu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ku(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qu=()=>{const{isOpen:t}=Fi(),n=(0,_e.useRef)(null),{hasCountdown:r}=zs(),[o,i]=(0,_e.useState)(r),{hasPrompt:s}=Hs(),[a,c]=(0,_e.useState)(s),l=Cs(),u=(0,_e.useRef)(!1),{activeEntry:p}=Iu(),[d,f]=(0,_e.useState)({text:Bu,upload:Wu}),[h,y]=(0,_e.useState)((()=>p)),b=br(),{accountAllowsUploads:m}=ks(),v=(0,_e.useCallback)((()=>{O(n.current,l)}),[l]);(0,_e.useEffect)((()=>{const{customComponents:e}=b,{entry:t}=e||{};t&&f((e=>Ju(Ju({},e),t)))}),[b]),(0,_e.useEffect)((()=>{v(),i(r),c(s)}),[r,s,v]),(0,_e.useEffect)((()=>{y(p),v()}),[p,v,n]),u.current=!(!n.current||!n.current.contains(document.activeElement));const g=d[h];return(0,e.jsxs)("div",{className:Qs("chat__entry"),ref:n,children:[o&&(0,e.jsx)(Tu,{}),a&&(0,e.jsx)(ku,{}),(0,e.jsxs)("div",{className:Qs(["entry__body",...r||s?["entry__body--hidden"]:[]]),children:[h!==Xe&&m&&t&&(0,e.jsx)(Gu,{}),(0,e.jsx)(g,{})]})]})},Yu=({onClick:t})=>{const{t:n}=fs(),r=(0,_e.useCallback)((()=>t()),[t]);return(0,e.jsx)("button",{type:"button",className:Qs("button","collapse-button"),onClick:r,children:(0,e.jsx)(ba,{name:"chevronDown",size:"32",alt:n("window.srCollapseButton")})})},Zu=({children:t,handleClose:n,title:r,closeButtonText:o,srCloseButtonText:i,id:s})=>{const a=Vs();return(0,e.jsxs)("section",Object.assign({tabIndex:-1,id:s,"aria-labelledby":r?a:void 0,className:Qs("chat-status",!r&&"chat-status--condensed")},{children:[(0,e.jsxs)("div",Object.assign({className:Qs("chat-status__body")},{children:[r?(0,e.jsx)("h2",Object.assign({className:Qs("chat-status__title"),id:a},{children:r})):null,t]})),"function"==typeof n&&(0,e.jsxs)("button",Object.assign({type:"button",onClick:n,className:Qs("button","button--tertiary","chat-status__close")},{children:[o||(0,e.jsx)(ba,{name:"close",size:"16",alt:""}),i&&(0,e.jsx)("span",Object.assign({className:Qs("visually-hidden")},{children:i}))]}))]}))};function ep(){const{t}=fs(),{id:n}=Js(),{hasInterrupt:r}=yl(),{disableTranslations:o,currentLocale:i}=Gs(),s=Xs(i),a=Cs(),c=t("translations.status.label",{language:s}),l=(0,_e.useCallback)((()=>{o(),a()}),[o,a]);return r?null:(0,e.jsx)(Zu,{handleClose:l,title:c,id:n,closeButtonText:t("translations.status.stopText"),srCloseButtonText:t("translations.status.srStopText")})}const tp=({handleClick:t,icon:n,title:r,srButtonText:o})=>(0,e.jsxs)("button",Object.assign({type:"button",onClick:t,className:Qs("button","button--primary","chat-status__button")},{children:[(0,e.jsx)(ba,{name:n,size:"16",alt:""}),r,o&&(0,e.jsx)("span",Object.assign({className:Qs("visually-hidden")},{children:o}))]}));function np(){const{showProposal:t,translationProposal:n,dismissTranslationProposal:r,activateTranslationProposal:o}=(()=>{const{isActive:e,languages:t}=Gs(),n=He(),{sendAction:r}=Ki(),{translationProposal:o}=De((e=>e.translations)),{enableTranslations:i}=Gs(),{isOpen:s}=Fi(),{locale:a}=fs(),c=null==o?void 0:o.proposedLocale,l=Xs(c),u=(0,_e.useMemo)((()=>null!==o&&!e&&s&&a!==c&&t.some((e=>e.locale===c))),[o,e,s,a,c,t]);return{activateTranslationProposal:()=>{i(null==o?void 0:o.proposedLocale,"translation_proposal")},dismissTranslationProposal:()=>{r({type:rt,body:{type:at}}),n(Ni())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}})(),{id:i}=Js();return t?(0,e.jsx)(Zu,Object.assign({handleClose:r,srCloseButtonText:n.srDismissButtonText,id:i,title:n.titleLabel},{children:(0,e.jsx)(tp,{handleClick:o,icon:"newTranslation",title:n.buttonLabel})})):null}function rp(){const{hasInterrupt:t}=yl(),{isActive:n}=Gs();return t?null:n?(0,e.jsx)(ep,{}):(0,e.jsx)(np,{})}function op(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 ip(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sp=function({children:t,interruptComponent:n}){const{hasInterrupt:r,meta:o}=yl(),{isOpen:i,closeChat:s}=Fi(),{isWindow:a}=kr();return r?i?(0,e.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?op(Object(n),!0).forEach((function(t){ip(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):op(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o)):null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Eu,{children:[(0,e.jsxs)("div",{className:Qs("chat__container__header"),children:[(0,e.jsx)(rp,{}),i&&a&&(0,e.jsx)(Yu,{onClick:s})]}),t]}),(0,e.jsx)(Qu,{}),i&&(0,e.jsx)(xu,{})]})},ap=({originalError:t,title:n,message:r,buttonText:o,action:i,srText:s})=>{const a=Ki(),c=Vs(),{sendPolite:l}=ys(),u=Cs(),p="SeamlySessionExpiredError"===t.name;return(0,_e.useEffect)((()=>{p&&a[i]&&a[i]()}),[i,a,p]),(0,_e.useEffect)((()=>{!p&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,p]),p?(0,e.jsx)(e.Fragment,{}):(0,e.jsx)("section",{className:Qs("interrupt"),"aria-labelledby":c,children:(0,e.jsxs)("div",{className:Qs("interrupt__body"),children:[(0,e.jsx)("h2",{id:c,className:Qs("interrupt__title"),children:n}),(0,e.jsx)("p",{className:Qs("interrupt__message"),children:r}),o&&i&&(0,e.jsx)("div",{className:Qs("interrupt__actions"),children:(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{a[i]&&a[i](),u()},children:o})})]})})};function cp({event:t}){const[n]=Cl(t);return(0,e.jsx)(n,{event:t})}function lp(){const{preChatEvents:t,layoutMode:n}=br(),{hasInterrupt:r}=yl(),{isOpen:o}=Fi(),i=!(r||!t?.length||o);return i&&(0,e.jsx)("ul",{className:Qs("pre-chat-messages",`pre-chat-messages--${n}`),"aria-hidden":!i,children:t.map((t=>(0,e.jsx)("li",{className:Qs("pre-chat-messages__message"),children:(0,e.jsx)(cp,{event:t})},t.payload.id)))})}function up(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 pp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dp=()=>{const t=mr(),n=Pr(),{hasInterrupt:r}=yl(),o=n&&!r,i=o?n.avatar:t;return i?(0,e.jsx)("img",{className:Qs(o?"avatar":"icon"),src:i,alt:""}):(0,e.jsx)(ba,{name:"avatar",size:"32"})},fp=({onClick:t})=>{const n=Vi(),{t:r}=fs(),o=n()?r("window.openButton.srContinue"):r("window.openButton.srStart"),i=Cs(),{isOpen:s}=Fi(),a=Cr(),c=(0,_e.useCallback)((()=>{t(),i()}),[i,t]);return(0,e.jsx)(Dl,{isActive:!s,transitionStartState:Il,children:(0,e.jsxs)("button",{className:Qs("window-open-button"),"aria-label":o,"aria-hidden":s,onClick:c,children:[(0,e.jsx)("span",{className:Qs("message-count"),"aria-hidden":"true",children:!!a&&a}),(0,e.jsx)(dp,{})]})})},hp={app:()=>(0,e.jsx)(Ul,{children:(0,e.jsx)(sp,{interruptComponent:ap,children:(0,e.jsx)(Tl,{})})}),inline:()=>{const{showInlineView:t,containerRef:n}=$i(),{isOpen:r}=Fi(),{hasInterrupt:o,meta:i}=yl();return o&&!r?(0,e.jsx)(ap,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?up(Object(n),!0).forEach((function(t){pp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):up(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},i)):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Dl,{isActive:!r,transitionStartState:Il,children:(0,e.jsxs)("div",{ref:n,className:Qs("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,e.jsx)(lp,{}),(0,e.jsx)(Ml,{})]})}),(0,e.jsx)(Dl,{isActive:r,transitionStartState:Il,children:(0,e.jsx)(Ul,{ref:n,children:t&&(0,e.jsx)(sp,{interruptComponent:ap,children:r&&(0,e.jsx)(Tl,{})})})})]})},window:()=>{const{isOpen:t,openChat:n}=Fi(),r=Br(),{t:o}=fs(),i=o("window.chat.continue"),s=(0,_e.useMemo)((()=>({payload:{body:{text:i}}})),[i]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(fp,{onClick:n}),(0,e.jsx)(Dl,{isActive:!t&&!r,transitionStartState:Il,children:(0,e.jsx)("div",{className:Qs("unstarted-wrapper","unstarted-wrapper--window"),children:(0,e.jsx)(lp,{})})}),(0,e.jsx)(Dl,{isActive:!t&&r,transitionStartState:Nl,children:(0,e.jsx)("div",{className:Qs("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,e.jsx)(Hc,{event:s})})}),(0,e.jsx)(Dl,{isActive:t,transitionStartState:Nl,children:(0,e.jsx)(Ul,{children:(0,e.jsx)(sp,{interruptComponent:ap,children:(0,e.jsx)(Tl,{})})})})]})}},yp=({children:t})=>{const[,n]=xs(),{namespace:r,layoutMode:o,zIndex:i}=br(),{isOpen:s,isVisible:a}=Fi(),c=gs(),l=Br(),{locale:u}=fs(),p=hp[o],d=(0,_e.useCallback)((e=>{n(e)}),[n]),f=(0,_e.useMemo)((()=>{if(u&&document.querySelector("html").getAttribute("lang")!==u)return u}),[u]);if(!p)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const h=["app",`app--layout-${o}`,`namespace--${r}`,...c];return s||"app"===o||h.push("app--collapsed"),l&&h.push("app--user-responded"),a&&(0,e.jsx)("div",{className:Qs(h),lang:f,tabIndex:"-1","data-nosnippet":!0,style:{zIndex:i},ref:d,children:t||(0,e.jsx)(p,{})})};function bp(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 mp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bp(Object(n),!0).forEach((function(t){vp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const gp=t=>(0,e.jsx)(Ol,mp(mp({},t),{},{children:(0,e.jsx)(yp,{})}));var wp=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};class Op{constructor(e,t){const{namespace:n="",parentElement:r,showFaq:o}=e,i=wp(e,["namespace","parentElement","showFaq"]);this.config=Object.assign(Object.assign({},i),{namespace:n,showFaq:!1!==o}),this.namespace=n,this.parentElement=r,this.externalApi=t,this.api=new we({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(je()),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)))}render(){return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const t=this.config.customComponents||{},{view:n}=t,r=wp(t,["view"]),o=Object.assign(Object.assign({},this.config),{customComponents:Object.keys(r).length?r:void 0}),i=function({initialState:e,api:t,eventBus:n,config:r}){return $n({reducer:{state:Bo,app:Vr,config:Ko,i18n:fi,translations:Ii,visibility:Li,forms:li,interrupt:Jr},preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat([Yo({api:t}),yi({api:t}),gi({api:t}),Ri])})}({api:this.api,eventBus:this.eventBus,config:o,initialState:void 0});i.dispatch(qo(o)),yield i.dispatch(rr());try{const{locale:e}=yield i.dispatch(Ur()).unwrap();yield i.dispatch(ir(e))}catch(e){}i.dispatch(Mr()),n?(0,xe.render)((0,e.jsx)(Ol,Object.assign({eventBus:this.eventBus,store:i,api:this.api},{children:(0,e.jsx)(n,{})})),this.parentElement):(0,xe.render)((0,e.jsx)(gp,{config:o,eventBus:this.eventBus,store:i,api:this.api}),this.parentElement)}))}destroy(){(0,xe.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),delete 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))}}function jp(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 xp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jp(Object(n),!0).forEach((function(t){_p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cp=e=>"object"==typeof e&&"action"in e,Sp=e=>xp(xp({},e),{},{args:Array.isArray(e.args)?e.args:[e.args]}),Ep=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(Cp).map(Sp)).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)}}))}setContext(e,t){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.translationLocale=r),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables=xp({},t)),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace:o}=n||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==o||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,o=Object.values(this._instances);return!n&&o.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),o.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new Op(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=xp(xp({},e.context||this.appConfig.context),this.context),n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r=xp(xp({},this.appConfig.defaults),e.defaults),o=xp(xp(xp({},this.appConfig),e),{},{api:xp(xp({},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(o):o}getMergedVariables(e){return xp(xp(xp({},this.appConfig.context?.variables||{}),e.context?.variables||{}),this.context.variables||{})}},Pp=({onOpenChat:t})=>{const{t:n}=fs(),r=Vs(),{isOpen:o}=Fi(),i=(0,_e.useRef)(null),s=(0,_e.useRef)(null),a=(0,_e.useRef)(),c=Cs(),l=(()=>{const e=(0,_e.useRef)(null),[t]=xs();return e.current=t,(0,_e.useCallback)((t=>{O(e.current,(()=>{js(t)}))}),[])})(),u=Pr(),p=_r().subTitle,{hasInterrupt:d}=yl(),{headerCollapseButtonId:f}=gr(),h=u&&!d;return(0,_e.useLayoutEffect)((()=>{!1===o&&!0===i.current&&l(s.current),i.current=o}),[o,l]),(0,e.jsxs)("div",{className:Qs("toggle-button"),children:[(0,e.jsxs)("div",{id:r,children:[(0,e.jsx)("p",{className:Qs("toggle-button__title"),children:n(h?"toggleButton.resumeTitle":"toggleButton.title")}),(0,e.jsx)("p",{className:Qs("toggle-button__subtitle"),children:h?p:n("toggleButton.subtitle")})]}),(0,e.jsx)("button",{type:"button","aria-labelledby":r,className:Qs("toggle-button__button"),ref:s,onMouseUp:()=>{a.current="mouse"},onKeyUp:()=>{a.current="key"},onClick:()=>{t(),"mouse"===a.current?c():"key"===a.current&&l(f)}})]})},Tp=()=>{const{t}=fs(),{title:n,subTitle:r}=_r(),o=Cr(),{isOpen:i}=Fi(),s=Pr(),{hasInterrupt:a}=yl(),c=mr(),l=s?.avatar??c,u=a?"":r,p=["message-count"];return i&&p.push("message-count__hide"),0===o&&p.push("message-count__empty"),(u||!i)&&(0,e.jsxs)("div",{className:Qs("agent-info"),children:[(0,e.jsxs)("div",{className:Qs("agent-info__graphic"),children:[l?(0,e.jsx)("img",{className:Qs(s?.avatar?"avatar":"icon"),src:l,alt:""}):(0,e.jsx)(ba,{name:"avatar",size:"32"}),(0,e.jsx)("span",{className:Qs(p),"aria-hidden":"true",children:o})]}),(0,e.jsxs)("div",{className:Qs("agent-info__body"),children:[(0,e.jsx)("p",{className:Qs("agent-info__heading"),children:n??t("header.title")}),(0,e.jsx)("p",{className:Qs("agent-info__text"),children:u})]})]})},kp=({children:t,onCloseChat:n})=>{const{headerCollapseButtonId:r}=gr(),o=(0,_e.useRef)(null),{t:i}=fs();return(0,e.jsxs)("header",{className:Qs("chat__header"),children:[t,(0,e.jsx)("div",{className:Qs("header-controls"),children:(0,e.jsx)("button",{type:"button",className:Qs("button","header-controls__collapse"),onClick:n,ref:o,id:r,children:(0,e.jsx)(ba,{name:"chevronDown",size:"32",alt:i("header.collapseApp")})})})]})};function Ap(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 Np(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ip=function({children:t,interruptComponent:n}){const{hasInterrupt:r,meta:o}=yl(),{isOpen:i}=Fi();return r?i?(0,e.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ap(Object(n),!0).forEach((function(t){Np(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ap(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o)):null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Eu,{children:[(0,e.jsx)("div",{className:Qs("chat__container__header"),children:(0,e.jsx)(rp,{})}),t]}),(0,e.jsx)(Qu,{}),i&&(0,e.jsx)(xu,{})]})},Rp=["categories"];function Dp(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 Mp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dp(Object(n),!0).forEach((function(t){Lp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Up=()=>{const{t}=fs(),{sendAction:n,addMessageBubble:r}=Ki(),o=Vs(),i=Cs(),{sendPolite:s}=ys(),{hasInterrupt:a}=yl(),{hasCountdown:c,endCountdown:l}=zs(),{hasPrompt:u,continueChat:p}=Hs(),d=Tr("suggestion"),{body:f}=Ks({payload:d}),h=(0,_e.useMemo)((()=>(d&&!a?f:[]).map((e=>{let{categories:t=[]}=e;return Mp(Mp({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Rp)),{},{categories:t,classNames:["faqs__item",...t.map((e=>`faqs__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`))]})}))),[d,a,f]),y=(0,_e.useRef)(null),b=(0,_e.useRef)(!1),{isInline:m}=kr(),v=Br(),g=!m&&v,w=(0,_e.useRef)(g),j=!!h.length,x=j&&!g,_=(0,_e.useRef)([]),C=j?h:_.current;_.current=C;const S=(0,_e.useRef)(null);(0,_e.useEffect)((()=>{if(y.current!==h&&!g){if(j){const e=b.current?t("faq.srUpdatedText"):t("faq.srAvailableText");setTimeout((()=>{s(e)}),30)}else b.current&&s(t("faq.srUnavailableText"));y.current=h}!w.current&&g?(O(S.current,i),s(t("faq.srUnavailableText"))):!j&&b.current&&O(S.current,i),b.current=j,w.current=g}),[j,h,g,i,s,t]);const E=t("faq.headingText"),P=E?"section":"div";return(0,e.jsx)(Dl,{isActive:x,transitionStartState:Nl,children:(0,e.jsxs)(P,{className:Qs("faqs"),"aria-labelledby":E?o:null,ref:S,children:[E&&(0,e.jsx)("h2",{id:o,className:Qs("faqs__heading"),children:E}),!!C.length&&(0,e.jsx)("ul",{className:Qs("faqs__list"),children:C.map((t=>(0,e.jsx)("li",{className:Qs(t.classNames),children:(0,e.jsxs)("button",{type:"button",onClick:()=>{(({id:e,question:t})=>{c&&l(!0),u&&p(),n({type:Ze,originMessage:d.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),r(t),i()})(t)},className:Qs("button","button--secondary"),children:[(0,e.jsx)(ba,{name:"chevronRight",size:"8"}),t.question]})},t.id.toString())))})]})})},Fp=({children:t})=>{const[,n]=xs(),{isOpen:r,isVisible:o,setVisibility:i}=Fi(),{zIndex:s,showFaq:a,layoutMode:c}=br(),{isInline:l}=kr(),u=gs(),p=Br(),{locale:d}=fs(),f=(0,_e.useCallback)((e=>{n(e)}),[n]),h=(0,_e.useMemo)((()=>{if(d&&document.querySelector("html").getAttribute("lang")!==d)return d}),[d]),y=["app","app--deprecated",...u];return r||"window"!==c||y.push("app--collapsed"),p&&y.push("app--user-responded"),y.push(`app--layout-${c}`),o&&(0,e.jsxs)("section",{className:Qs(y),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&r&&i(hr.minimized)},lang:h,tabIndex:"-1",ref:f,style:{zIndex:s},"data-nosnippet":!0,children:[(0,e.jsx)("div",{className:Qs("app-wrapper"),children:t}),a&&(0,e.jsx)(Up,{})]})},Bp=({children:t})=>{const{showInlineView:n,containerRef:r}=$i();return(0,e.jsx)("div",{ref:r,children:n&&t})},$p=()=>{bs();const{isVisible:t,openChat:n,closeChat:r}=Fi();return t&&(0,e.jsx)(Bp,{children:(0,e.jsxs)(Fp,{children:[(0,e.jsx)(Pp,{onOpenChat:n}),(0,e.jsx)(kp,{onCloseChat:r,children:(0,e.jsx)(Tp,{})}),(0,e.jsx)(Ip,{interruptComponent:ap,children:(0,e.jsx)(Tl,{})})]})})},zp=()=>{const e=He();return{addEvent:t=>e(ro(t)),clearEvents:()=>e(io()),setHistory:t=>e(_o(t)),setEventsRead:t=>e(go(t)),setLoadedImageEventIds:t=>e(Eo(t)),ackEvent:t=>e(no(t)),setIsLoading:t=>e(So(t)),setParticipant:t=>e(Po(t)),setHeaderTitle:t=>e(xo(t)),setHeaderSubTitle:t=>e(jo(t)),resetHistoryLoadedFlag:()=>e(yo()),setActiveService:()=>e(mo()),initIdleDetachCountdown:t=>e(po(t)),decrementIdleDetachCountdownCounter:()=>e(lo()),stopIdleDetachCountdownCounter:()=>e(Fo()),clearIdleDetachCountdown:()=>e(ao()),initResumeConversationPrompt:()=>e(fo()),clearResumeConversationPrompt:()=>e(co()),setServiceDataItem:t=>e(ko(t)),setFeatures:t=>e(Oo(t)),setFeatureEnabledState:t=>e(wo(t)),clearFeatures:()=>e(so()),setInitialState:t=>e(Co(t)),setUserSelectedOptions:t=>e(Lo(t)),setUserSelectedOption:t=>e(Mo(t)),showOption:t=>e(Uo(t)),hideOption:()=>e(uo()),setServiceEntryMetadata:t=>e(Ao(t)),setBlockAutoEntrySwitch:t=>e(vo(t)),setActiveEntryType:t=>e(bo(t)),setUserEntryType:t=>e(Do(t)),registerUpload:t=>e(ho(t)),setUploadProgress:t=>e(Ro(t)),setUploadComplete:t=>e(No(t)),setUploadError:t=>e(Io(t)),clearAllUploads:()=>e(oo()),setSeamlyContainerElement:t=>e(To(t))}},Hp=function(e){if(window.seamly&&!Array.isArray(window.seamly))throw new Error("Seamly UI has already been initialised. Use the window.seamly object to start new instances instead.");const t=Array.isArray(window.seamly)?window.seamly:[],n=new Ep(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
2
+ (()=>{var e={574:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(){this._defaults=[]}for(var r=0,o=["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"];r<o.length;r++){const e=o[r];n.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this._defaults.push({fn:e,args:n}),this}}n.prototype._setDefaults=function(e){var n,r=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}(this._defaults);try{for(r.s();!(n=r.n()).done;){const t=n.value;e[t.fn](...t.args)}}catch(e){r.e(e)}finally{r.f()}},e.exports=n},766:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;const i=n(767),s=n(445),a=n(129),c=n(842),l=n(244),u=l.isObject,p=l.mixin,d=l.hasOwn,f=n(253),h=n(574);function y(){}e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1===arguments.length?new t.Request("GET",e):new t.Request(e,n)};const b=t=e.exports;t.Request=x,b.getXHR=()=>{if(o.XMLHttpRequest)return new o.XMLHttpRequest;throw new Error("Browser-only version of superagent could not find XHR")};const m="".trim?e=>e.trim():e=>e.replace(/(^\s*|\s*$)/g,"");function v(e){if(!u(e))return e;const t=[];for(const n in e)d(e,n)&&g(t,n,e[n]);return t.join("&")}function g(e,t,n){if(void 0!==n)if(null!==n)if(Array.isArray(n)){var o,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}(n);try{for(i.s();!(o=i.n()).done;)g(e,t,o.value)}catch(e){i.e(e)}finally{i.f()}}else if(u(n))for(const r in n)d(n,r)&&g(e,`${t}[${r}]`,n[r]);else e.push(encodeURI(t)+"="+encodeURIComponent(n));else e.push(encodeURI(t))}function w(e){const t={},n=e.split("&");let r,o;for(let e=0,i=n.length;e<i;++e)r=n[e],o=r.indexOf("="),-1===o?t[decodeURIComponent(r)]="":t[decodeURIComponent(r.slice(0,o))]=decodeURIComponent(r.slice(o+1));return t}function O(e){return/[/+]json($|[^-\w])/i.test(e)}function j(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;let t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){const t=e.split(/\r?\n/),n={};let r,o,i,s;for(let e=0,a=t.length;e<a;++e)o=t[e],r=o.indexOf(":"),-1!==r&&(i=o.slice(0,r).toLowerCase(),s=m(o.slice(r+1)),n[i]=s);return n}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function x(e,t){const n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(()=>{let e,t=null,r=null;try{r=new j(n)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,n.xhr?(t.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",r);try{n._isResponseOK(r)||(e=new Error(r.statusText||r.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=r,e.status=e.status||r.status,n.callback(e,r)):n.callback(null,r)}))}b.serializeObject=v,b.parseString=w,b.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},b.serialize={"application/x-www-form-urlencoded":a.stringify,"application/json":s},b.parse={"application/x-www-form-urlencoded":w,"application/json":JSON.parse},p(j.prototype,f.prototype),j.prototype._parseBody=function(e){let t=b.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&O(this.type)&&(t=b.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},j.prototype.toError=function(){const e=this.req,t=e.method,n=e.url,r=`cannot ${t} ${n} (${this.status})`,o=new Error(r);return o.status=this.status,o.method=t,o.url=n,o},b.Response=j,i(x.prototype),p(x.prototype,c.prototype),x.prototype.type=function(e){return this.set("Content-Type",b.types[e]||e),this},x.prototype.accept=function(e){return this.set("Accept",b.types[e]||e),this},x.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"==typeof t&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});const r=n.encoder?n.encoder:e=>{if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,r)},x.prototype.query=function(e){return"string"!=typeof e&&(e=v(e)),e&&this._query.push(e),this},x.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},x.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},x.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();const n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},x.prototype.crossDomainError=function(){const e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},x.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},x.prototype.ca=x.prototype.agent,x.prototype.buffer=x.prototype.ca,x.prototype.write=()=>{throw new Error("Streaming is not supported in browser version of superagent")},x.prototype.pipe=x.prototype.write,x.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},x.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||y,this._finalizeQueryString(),this._end()},x.prototype._setUploadTimeout=function(){const e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((()=>{e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},x.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));const e=this;this.xhr=b.getXHR();const t=this.xhr;let n=this._formData||this._data;this._setTimeouts(),t.addEventListener("readystatechange",(()=>{const n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4!==n)return;let r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}));const r=(t,n)=>{n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){const e=this._header["content-type"];let t=this._serializer||b.serialize[e?e.split(";")[0]:""];!t&&O(e)&&(t=b.serialize["application/json"]),t&&(n=t(n))}for(const e in this.header)null!==this.header[e]&&d(this.header,e)&&t.setRequestHeader(e,this.header[e]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},b.agent=()=>new h;for(var _=0,C=["GET","POST","OPTIONS","PATCH","PUT","DELETE"];_<C.length;_++){const e=C[_];h.prototype[e.toLowerCase()]=function(t,n){const r=new b.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}function S(e,t,n){const r=b("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}h.prototype.del=h.prototype.delete,b.get=(e,t,n)=>{const r=b("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},b.head=(e,t,n)=>{const r=b("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},b.options=(e,t,n)=>{const r=b("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},b.del=S,b.delete=S,b.patch=(e,t,n)=>{const r=b("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},b.post=(e,t,n)=>{const r=b("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},b.put=(e,t,n)=>{const r=b("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},842:(e,t,n)=>{"use strict";const r=n(695),o=n(244),i=o.isObject,s=o.hasOwn;function a(){}e.exports=a,a.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},a.prototype.parse=function(e){return this._parser=e,this},a.prototype.responseType=function(e){return this._responseType=e,this},a.prototype.serialize=function(e){return this._serializer=e,this},a.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(const t in e)if(s(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},a.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};const c=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),l=new Set([408,413,429,500,502,503,504,521,522,524]);a.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{const n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&l.has(t.status))return!0;if(e){if(e.code&&c.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},a.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},a.prototype.then=function(e,t){if(!this._fullfilledPromise){const e=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(((t,n)=>{e.on("abort",(()=>{if(this._maxRetries&&this._maxRetries>this._retries)return;if(this.timedout&&this.timedoutError)return void n(this.timedoutError);const e=new Error("Aborted");e.code="ABORTED",e.status=this.status,e.method=this.method,e.url=this.url,n(e)})),e.end(((e,r)=>{e?n(e):t(r)}))}))}return this._fullfilledPromise.then(e,t)},a.prototype.catch=function(e){return this.then(void 0,e)},a.prototype.use=function(e){return e(this),this},a.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},a.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},a.prototype.get=function(e){return this._header[e.toLowerCase()]},a.prototype.getHeader=a.prototype.get,a.prototype.set=function(e,t){if(i(e)){for(const t in e)s(e,t)&&this.set(t,e[t]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},a.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},a.prototype.field=function(e,t,n){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(i(e)){for(const t in e)s(e,t)&&this.field(t,e[t]);return this}if(Array.isArray(t)){for(const n in t)s(t,n)&&this.field(e,t[n]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),n?this._getFormData().append(e,t,n):this._getFormData().append(e,t),this},a.prototype.abort=function(){if(this._aborted)return this;if(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req){if(r.gte(process.version,"v13.0.0")&&r.lt(process.version,"v14.0.0"))throw new Error("Superagent does not work in v13 properly with abort() due to Node.js core changes");r.gte(process.version,"v14.0.0")&&(this.req.destroyed=!0),this.req.abort()}return this.clearTimeout(),this.emit("abort"),this},a.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization",`Basic ${r(`${e}:${t}`)}`);break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization",`Bearer ${e}`)}return this},a.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},a.prototype.redirects=function(e){return this._maxRedirects=e,this},a.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},a.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},a.prototype.send=function(e){const t=i(e);let n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&i(this._data))for(const t in e)s(e,t)&&(this._data[t]=e[t]);else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],n&&(n=n.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===n?this._data?`${this._data}&${e}`:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},a.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},a.prototype._finalizeQueryString=function(){const e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){const e=this.url.indexOf("?");if(e>=0){const t=this.url.slice(e+1).split("&");"function"==typeof this._sort?t.sort(this._sort):t.sort(),this.url=this.url.slice(0,e)+"?"+t.join("&")}}},a.prototype._appendQueryString=()=>{console.warn("Unsupported")},a.prototype._timeoutError=function(e,t,n){if(this._aborted)return;const r=new Error(`${e+t}ms exceeded`);r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.timedoutError=r,this.abort(),this.callback(r)},a.prototype._setTimeouts=function(){const e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((()=>{e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((()=>{e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},253:(e,t,n)=>{"use strict";const r=n(244);function o(){}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){const t=e["content-type"]||"";this.type=r.type(t);const n=r.params(t);for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(this[e]=n[e]);this.links={};try{e.link&&(this.links=r.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){const t=Math.trunc(e/100);this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},244:(e,t)=>{"use strict";function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.type=e=>e.split(/ *; */).shift(),t.params=e=>{const t={};var r,o=n(e.split(/ *; */));try{for(o.s();!(r=o.n()).done;){const e=r.value.split(/ *= */),n=e.shift(),o=e.shift();n&&o&&(t[n]=o)}}catch(e){o.e(e)}finally{o.f()}return t},t.parseLinks=e=>{const t={};var r,o=n(e.split(/ *, */));try{for(o.s();!(r=o.n()).done;){const e=r.value.split(/ *; */),n=e[0].slice(1,-1);t[e[1].split(/ *= */)[1].slice(1,-1)]=n}}catch(e){o.e(e)}finally{o.f()}return t},t.cleanHeader=(e,t)=>(delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e),t.isObject=e=>null!==e&&"object"==typeof e,t.hasOwn=Object.hasOwn||function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(new Object(e),t)},t.mixin=(e,n)=>{for(const r in n)t.hasOwn(n,r)&&(e[r]=n[r])}},905:e=>{e.exports=()=>()=>null},924:(e,t,n)=>{"use strict";var r=n(210),o=n(559),i=o(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&i(e,".prototype.")>-1?o(n):n}},559:(e,t,n)=>{"use strict";var r=n(612),o=n(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||r.call(s,i),c=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),u=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=a(r,s,arguments);if(c&&l){var n=c(t,"length");n.configurable&&l(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(r,i,arguments)};l?l(e.exports,"apply",{value:p}):e.exports.apply=p},767:e=>{function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},445:e=>{e.exports=s,s.default=s,s.stable=u,s.stableStringify=u;var t="[...]",n="[Circular]",r=[],o=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,n,s){var a;void 0===s&&(s=i()),c(e,"",0,[],void 0,0,s);try{a=0===o.length?JSON.stringify(e,t,n):JSON.stringify(e,d(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var l=r.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function a(e,t,n,i){var s=Object.getOwnPropertyDescriptor(i,n);void 0!==s.get?s.configurable?(Object.defineProperty(i,n,{value:e}),r.push([i,n,t,s])):o.push([t,n,e]):(i[n]=e,r.push([i,n,t]))}function c(e,r,o,i,s,l,u){var p;if(l+=1,"object"==typeof e&&null!==e){for(p=0;p<i.length;p++)if(i[p]===e)return void a(n,e,r,s);if(void 0!==u.depthLimit&&l>u.depthLimit)return void a(t,e,r,s);if(void 0!==u.edgesLimit&&o+1>u.edgesLimit)return void a(t,e,r,s);if(i.push(e),Array.isArray(e))for(p=0;p<e.length;p++)c(e[p],p,p,i,e,l,u);else{var d=Object.keys(e);for(p=0;p<d.length;p++){var f=d[p];c(e[f],f,p,i,e,l,u)}}i.pop()}}function l(e,t){return e<t?-1:e>t?1:0}function u(e,t,n,s){void 0===s&&(s=i());var a,c=p(e,"",0,[],void 0,0,s)||e;try{a=0===o.length?JSON.stringify(c,t,n):JSON.stringify(c,d(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var l=r.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function p(e,o,i,s,c,u,d){var f;if(u+=1,"object"==typeof e&&null!==e){for(f=0;f<s.length;f++)if(s[f]===e)return void a(n,e,o,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==d.depthLimit&&u>d.depthLimit)return void a(t,e,o,c);if(void 0!==d.edgesLimit&&i+1>d.edgesLimit)return void a(t,e,o,c);if(s.push(e),Array.isArray(e))for(f=0;f<e.length;f++)p(e[f],f,f,s,e,u,d);else{var h={},y=Object.keys(e).sort(l);for(f=0;f<y.length;f++){var b=y[f];p(e[b],b,f,s,e,u,d),h[b]=e[b]}if(void 0===c)return h;r.push([c,o,e]),c[o]=h}s.pop()}}function d(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(o.length>0)for(var r=0;r<o.length;r++){var i=o[r];if(i[1]===t&&i[0]===n){n=i[2],o.splice(r,1);break}}return e.call(this,t,n)}}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,r=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||r.call(i)!==o)throw new TypeError(t+i);for(var s,a=n.call(arguments,1),c=function(){if(this instanceof s){var t=i.apply(this,a.concat(n.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(n.call(arguments)))},l=Math.max(0,i.length-a.length),u=[],p=0;p<l;p++)u.push("$"+p);if(s=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(c),i.prototype){var d=function(){};d.prototype=i.prototype,s.prototype=new d,d.prototype=null}return s}},612:(e,t,n)=>{"use strict";var r=n(648);e.exports=Function.prototype.bind||r},210:(e,t,n)=>{"use strict";var r,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var l=function(){throw new s},u=c?function(){try{return l}catch(e){try{return c(arguments,"callee").get}catch(e){return l}}}():l,p=n(405)(),d=Object.getPrototypeOf||function(e){return e.__proto__},f={},h="undefined"==typeof Uint8Array?r:d(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":p?d([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?d(d([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?d((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?d((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?d(""[Symbol.iterator]()):r,"%Symbol%":p?Symbol:r,"%SyntaxError%":o,"%ThrowTypeError%":u,"%TypedArray%":h,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet},b=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(n=d(o.prototype))}return y[t]=n,n},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},v=n(612),g=n(642),w=v.call(Function.call,Array.prototype.concat),O=v.call(Function.apply,Array.prototype.splice),j=v.call(Function.call,String.prototype.replace),x=v.call(Function.call,String.prototype.slice),_=v.call(Function.call,RegExp.prototype.exec),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,E=function(e){var t=x(e,0,1),n=x(e,-1);if("%"===t&&"%"!==n)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var r=[];return j(e,C,(function(e,t,n,o){r[r.length]=n?j(o,S,"$1"):t||e})),r},P=function(e,t){var n,r=e;if(g(m,r)&&(r="%"+(n=m[r])[0]+"%"),g(y,r)){var i=y[r];if(i===f&&(i=b(r)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===_(/^%?[^%]*%?$/,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=E(e),r=n.length>0?n[0]:"",i=P("%"+r+"%",t),a=i.name,l=i.value,u=!1,p=i.alias;p&&(r=p[0],O(n,w([0,1],p)));for(var d=1,f=!0;d<n.length;d+=1){var h=n[d],b=x(h,0,1),m=x(h,-1);if(('"'===b||"'"===b||"`"===b||'"'===m||"'"===m||"`"===m)&&b!==m)throw new o("property names with quotes must have matching quotes");if("constructor"!==h&&f||(u=!0),g(y,a="%"+(r+="."+h)+"%"))l=y[a];else if(null!=l){if(!(h in l)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&d+1>=n.length){var v=c(l,h);l=(f=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:l[h]}else f=g(l,h),l=l[h];f&&!u&&(y[a]=l)}}return l}},405:(e,t,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,o=n(419);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,n)=>{"use strict";var r=n(612);e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},545:(e,t,n)=>{"use strict";var r=n(864),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function c(e){return r.isMemo(e)?s:a[e.$$typeof]||o}a[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[r.Memo]=s;var l=Object.defineProperty,u=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var o=f(n);o&&o!==h&&e(t,o,r)}var s=u(n);p&&(s=s.concat(p(n)));for(var a=c(t),y=c(n),b=0;b<s.length;++b){var m=s[b];if(!(i[m]||r&&r[m]||y&&y[m]||a&&a[m])){var v=d(n,m);try{l(t,m,v)}catch(e){}}}}return t}},679:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,o){return(t[n]=t[n]||[]).push([r,o]),e},e.off=function(r,o){r||(t={});for(var i=t[r]||n,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(r){for(var o,i=t[r]||n,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},631:(e,t,n)=>{var r="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=r&&o&&"function"==typeof o.get?o.get:null,s=r&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=a&&c&&"function"==typeof c.get?c.get:null,u=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,f="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,m=String.prototype.match,v=String.prototype.slice,g=String.prototype.replace,w=String.prototype.toUpperCase,O=String.prototype.toLowerCase,j=RegExp.prototype.test,x=Array.prototype.concat,_=Array.prototype.join,C=Array.prototype.slice,S=Math.floor,E="function"==typeof BigInt?BigInt.prototype.valueOf:null,P=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,k="function"==typeof Symbol&&"object"==typeof Symbol.iterator,A="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,N=Object.prototype.propertyIsEnumerable,I=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function R(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||j.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var r=e<0?-S(-e):S(e);if(r!==e){var o=String(r),i=v.call(t,o.length+1);return g.call(o,n,"$&_")+"."+g.call(g.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return g.call(t,n,"$&_")}var D=n(654),M=D.custom,L=z(M)?M:null;function U(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function F(e){return g.call(String(e),/"/g,"&quot;")}function B(e){return!("[object Array]"!==q(e)||A&&"object"==typeof e&&A in e)}function $(e){return!("[object RegExp]"!==q(e)||A&&"object"==typeof e&&A in e)}function z(e){if(k)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!T)return!1;try{return T.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,r,o){var a=n||{};if(V(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!V(a,"customInspect")||a.customInspect;if("boolean"!=typeof c&&"symbol"!==c)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(V(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(V(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var y=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return G(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var w=String(t);return y?R(t,w):w}if("bigint"==typeof t){var j=String(t)+"n";return y?R(t,j):j}var S=void 0===a.depth?5:a.depth;if(void 0===r&&(r=0),r>=S&&S>0&&"object"==typeof t)return B(t)?"[Array]":"[Object]";var P,M=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=_.call(Array(e.indent+1)," ")}return{base:n,prev:_.call(Array(t+1),n)}}(a,r);if(void 0===o)o=[];else if(W(o,t)>=0)return"[Circular]";function H(t,n,i){if(n&&(o=C.call(o)).push(n),i){var s={depth:a.depth};return V(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,r+1,o)}return e(t,a,r+1,o)}if("function"==typeof t&&!$(t)){var K=function(e){if(e.name)return e.name;var t=m.call(b.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ee=Z(t,H);return"[Function"+(K?": "+K:" (anonymous)")+"]"+(ee.length>0?" { "+_.call(ee,", ")+" }":"")}if(z(t)){var te=k?g.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):T.call(t);return"object"!=typeof t||k?te:J(te)}if((P=t)&&"object"==typeof P&&("undefined"!=typeof HTMLElement&&P instanceof HTMLElement||"string"==typeof P.nodeName&&"function"==typeof P.getAttribute)){for(var ne="<"+O.call(String(t.nodeName)),re=t.attributes||[],oe=0;oe<re.length;oe++)ne+=" "+re[oe].name+"="+U(F(re[oe].value),"double",a);return ne+=">",t.childNodes&&t.childNodes.length&&(ne+="..."),ne+"</"+O.call(String(t.nodeName))+">"}if(B(t)){if(0===t.length)return"[]";var ie=Z(t,H);return M&&!function(e){for(var t=0;t<e.length;t++)if(W(e[t],"\n")>=0)return!1;return!0}(ie)?"["+Y(ie,M)+"]":"[ "+_.call(ie,", ")+" ]"}if(function(e){return!("[object Error]"!==q(e)||A&&"object"==typeof e&&A in e)}(t)){var se=Z(t,H);return"cause"in Error.prototype||!("cause"in t)||N.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+_.call(se,", ")+" }":"{ ["+String(t)+"] "+_.call(x.call("[cause]: "+H(t.cause),se),", ")+" }"}if("object"==typeof t&&c){if(L&&"function"==typeof t[L]&&D)return D(t,{depth:S-r});if("symbol"!==c&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ae=[];return s.call(t,(function(e,n){ae.push(H(n,t,!0)+" => "+H(e,t))})),Q("Map",i.call(t),ae,M)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ce=[];return u.call(t,(function(e){ce.push(H(e,t))})),Q("Set",l.call(t),ce,M)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return X("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return X("WeakSet");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{return f.call(e),!0}catch(e){}return!1}(t))return X("WeakRef");if(function(e){return!("[object Number]"!==q(e)||A&&"object"==typeof e&&A in e)}(t))return J(H(Number(t)));if(function(e){if(!e||"object"!=typeof e||!E)return!1;try{return E.call(e),!0}catch(e){}return!1}(t))return J(H(E.call(t)));if(function(e){return!("[object Boolean]"!==q(e)||A&&"object"==typeof e&&A in e)}(t))return J(h.call(t));if(function(e){return!("[object String]"!==q(e)||A&&"object"==typeof e&&A in e)}(t))return J(H(String(t)));if(!function(e){return!("[object Date]"!==q(e)||A&&"object"==typeof e&&A in e)}(t)&&!$(t)){var le=Z(t,H),ue=I?I(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",de=!ue&&A&&Object(t)===t&&A in t?v.call(q(t),8,-1):pe?"Object":"",fe=(ue||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(de||pe?"["+_.call(x.call([],de||[],pe||[]),": ")+"] ":"");return 0===le.length?fe+"{}":M?fe+"{"+Y(le,M)+"}":fe+"{ "+_.call(le,", ")+" }"}return String(t)};var H=Object.prototype.hasOwnProperty||function(e){return e in this};function V(e,t){return H.call(e,t)}function q(e){return y.call(e)}function W(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function G(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return G(v.call(e,0,t.maxStringLength),t)+r}return U(g.call(g.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K),"single",t)}function K(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+w.call(t.toString(16))}function J(e){return"Object("+e+")"}function X(e){return e+" { ? }"}function Q(e,t,n,r){return e+" ("+t+") {"+(r?Y(n,r):_.call(n,", "))+"}"}function Y(e,t){if(0===e.length)return"";var n="\n"+t.prev+t.base;return n+_.call(e,","+n)+"\n"+t.prev}function Z(e,t){var n=B(e),r=[];if(n){r.length=e.length;for(var o=0;o<e.length;o++)r[o]=V(e,o)?t(e[o],e):""}var i,s="function"==typeof P?P(e):[];if(k){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var c in e)V(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&i["$"+c]instanceof Symbol||(j.call(/[^\w$]/,c)?r.push(t(c,e)+": "+t(e[c],e)):r.push(c+": "+t(e[c],e))));if("function"==typeof P)for(var l=0;l<s.length;l++)N.call(e,s[l])&&r.push("["+t(s[l])+"]: "+t(e[s[l]],e));return r}},661:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>y,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>l,StrictMode:()=>Q,Suspense:()=>w,SuspenseList:()=>x,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>z,cloneElement:()=>W,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>V,createPortal:()=>E,createRef:()=>r.createRef,default:()=>re,findDOMNode:()=>K,flushSync:()=>X,forwardRef:()=>f,hydrate:()=>I,isValidElement:()=>q,lazy:()=>j,memo:()=>u,render:()=>N,startTransition:()=>Y,unmountComponentAtNode:()=>G,unstable_batchedUpdates:()=>J,useDeferredValue:()=>Z,useInsertionEffect:()=>te,useSyncExternalStore:()=>ne,useTransition:()=>ee,version:()=>H});var r=n(710),o=n(207),i={};for(const e in o)["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","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(i[e]=()=>o[e]);function s(e,t){for(var n in t)e[n]=t[n];return e}function a(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){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t}function l(e){this.props=e}function u(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:a(this.props,e)}function o(t){return this.shouldComponentUpdate=n,(0,r.createElement)(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}n.d(t,i),(l.prototype=new r.Component).isPureReactComponent=!0,l.prototype.shouldComponentUpdate=function(e,t){return a(this.props,e)||a(this.state,t)};var p=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),p&&p(e)};var d="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function f(e){function t(t){var n=s({},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))},y={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},b=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);b(e,t,n,r)};var m=r.options.unmount;function v(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=s({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return v(e,t,n)}))),e}function g(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return g(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function w(){this.__u=0,this.t=null,this.__b=null}function O(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function j(e){var t,n,o;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){o=e})),o)throw o;if(!n)throw t;return(0,r.createElement)(n,i)}return i.displayName="Lazy",i.__f=!0,i}function x(){this.u=null,this.o=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&!0===e.__h&&(e.type=null),m&&m(e)},(w.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var o=O(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=g(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}},c=!0===t.__h;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},w.prototype.componentWillUnmount=function(){this.t=[]},w.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=v(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return i&&(i.__h=null),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),i]};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 C(e){return this.getChildContext=function(){return e.context},e.children}function S(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(),e.__v?(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)(C,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function E(e,t){var n=(0,r.createElement)(S,{__v:e,i:t});return n.containerInfo=t,n}(x.prototype=new r.Component).__a=function(e){var t=this,n=O(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),_(t,e,r)):o()};n?n(i):i()}},x.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},x.prototype.componentDidUpdate=x.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){_(e,n,t)}))};var P="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,T=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|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]/,k="undefined"!=typeof document,A=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(e)};function N(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function I(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 D(){}function M(){return this.cancelBubble}function L(){return this.defaultPrevented}r.options.event=function(e){return R&&(e=R(e)),e.persist=D,e.isPropagationStopped=M,e.isDefaultPrevented=L,e.nativeEvent=e};var U,F={configurable:!0,get:function(){return this.class}},B=r.options.vnode;r.options.vnode=function(e){var t=e.type,n=e.props,o=n;if("string"==typeof t){var i=-1===t.indexOf("-");for(var s in o={},n){var a=n[s];k&&"children"===s&&"noscript"===t||"value"===s&&"defaultValue"in n&&null==a||("defaultValue"===s&&"value"in n&&null==n.value?s="value":"download"===s&&!0===a?a="":/ondoubleclick/i.test(s)?s="ondblclick":/^onchange(textarea|input)/i.test(s+t)&&!A(n.type)?s="oninput":/^onfocus$/i.test(s)?s="onfocusin":/^onblur$/i.test(s)?s="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(s)?s=s.toLowerCase():i&&T.test(s)?s=s.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===a&&(a=void 0),/^oninput$/i.test(s)&&(s=s.toLowerCase(),o[s]&&(s="oninputCapture")),o[s]=a)}"select"==t&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(n.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==t&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(n.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),e.props=o,n.class!=n.className&&(F.enumerable="className"in n,null!=n.className&&(o.class=n.className),Object.defineProperty(o,"className",F))}e.$$typeof=P,B&&B(e)};var $=r.options.__r;r.options.__r=function(e){$&&$(e),U=e.__c};var z={ReactCurrentDispatcher:{current:{readContext:function(e){return U.__n[e.__c].props.value}}}},H="17.0.2";function V(e){return r.createElement.bind(null,e)}function q(e){return!!e&&e.$$typeof===P}function W(e){return q(e)?r.cloneElement.apply(null,arguments):e}function G(e){return!!e.__k&&((0,r.render)(null,e),!0)}function K(e){return e&&(e.base||1===e.nodeType&&e)||null}var J=function(e,t){return e(t)},X=function(e,t){return e(t)},Q=r.Fragment;function Y(e){e()}function Z(e){return e}function ee(){return[!1,Y]}var te=o.useLayoutEffect;function ne(e,t){var n=t(),r=(0,o.useState)({h:{__:n,v:t}}),i=r[0].h,s=r[1];return(0,o.useLayoutEffect)((function(){i.__=n,i.v=t,c(i.__,t())||s({h:i})}),[e,n,t]),(0,o.useEffect)((function(){return c(i.__,i.v())||s({h:i}),e((function(){c(i.__,i.v())||s({h:i})}))}),[e]),n}var re={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:te,useTransition:ee,useDeferredValue:Z,useSyncExternalStore:ne,startTransition:Y,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"17.0.2",Children:y,render:N,hydrate:I,unmountComponentAtNode:G,createPortal:E,createElement:r.createElement,createContext:r.createContext,createFactory:V,cloneElement:W,createRef:r.createRef,Fragment:r.Fragment,isValidElement:q,findDOMNode:K,Component:r.Component,PureComponent:l,memo:u,forwardRef:f,flushSync:X,unstable_batchedUpdates:J,StrictMode:Q,Suspense:w,SuspenseList:x,lazy:j,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:z}},798:e=>{"use strict";var t=String.prototype.replace,n=/%20/g,r="RFC3986";e.exports={default:r,formatters:{RFC1738:function(e){return t.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:r}},129:(e,t,n)=>{"use strict";var r=n(261),o=n(235),i=n(798);e.exports={formats:i,parse:o,stringify:r}},235:(e,t,n)=>{"use strict";var r=n(769),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,n,r){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=n.depth>0&&/(\[[^[\]]*])/.exec(i),l=a?i.slice(0,a.index):i,u=[];if(l){if(!n.plainObjects&&o.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var p=0;n.depth>0&&null!==(a=s.exec(i))&&p<n.depth;){if(p+=1,!n.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+i.slice(a.index)+"]"),function(e,t,n,r){for(var o=r?t:c(t,n),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&n.parseArrays)s=[].concat(o);else{s=n.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(l,10);n.parseArrays||""!==l?!isNaN(u)&&a!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(s=[])[u]=o:"__proto__"!==l&&(s[l]=o):s={0:o}}o=s}return o}(u,t,n,r)}};e.exports=function(e,t){var n=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var n,l={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,d=u.split(t.delimiter,p),f=-1,h=t.charset;if(t.charsetSentinel)for(n=0;n<d.length;++n)0===d[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===d[n]?h="utf-8":"utf8=%26%2310003%3B"===d[n]&&(h="iso-8859-1"),f=n,n=d.length);for(n=0;n<d.length;++n)if(n!==f){var y,b,m=d[n],v=m.indexOf("]="),g=-1===v?m.indexOf("="):v+1;-1===g?(y=t.decoder(m,s.decoder,h,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(m.slice(0,g),s.decoder,h,"key"),b=r.maybeMap(c(m.slice(g+1),t),(function(e){return t.decoder(e,s.decoder,h,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===h&&(b=a(b)),m.indexOf("[]=")>-1&&(b=i(b)?[b]:b),o.call(l,y)?l[y]=r.combine(l[y],b):l[y]=b}return l}(e,n):e,p=n.plainObjects?Object.create(null):{},d=Object.keys(u),f=0;f<d.length;++f){var h=d[f],y=l(h,u[h],n,"string"==typeof e);p=r.merge(p,y,n)}return!0===n.allowSparse?p:r.compact(p)}},261:(e,t,n)=>{"use strict";var r=n(478),o=n(769),i=n(798),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,l=String.prototype.split,u=Array.prototype.push,p=function(e,t){u.apply(e,c(t)?t:[t])},d=Date.prototype.toISOString,f=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:f,formatter:i.formatters[f],indices:!1,serializeDate:function(e){return d.call(e)},skipNulls:!1,strictNullHandling:!1},y={},b=function e(t,n,i,s,a,u,d,f,b,m,v,g,w,O,j,x){for(var _,C=t,S=x,E=0,P=!1;void 0!==(S=S.get(y))&&!P;){var T=S.get(t);if(E+=1,void 0!==T){if(T===E)throw new RangeError("Cyclic object value");P=!0}void 0===S.get(y)&&(E=0)}if("function"==typeof f?C=f(n,C):C instanceof Date?C=v(C):"comma"===i&&c(C)&&(C=o.maybeMap(C,(function(e){return e instanceof Date?v(e):e}))),null===C){if(a)return d&&!O?d(n,h.encoder,j,"key",g):n;C=""}if("string"==typeof(_=C)||"number"==typeof _||"boolean"==typeof _||"symbol"==typeof _||"bigint"==typeof _||o.isBuffer(C)){if(d){var k=O?n:d(n,h.encoder,j,"key",g);if("comma"===i&&O){for(var A=l.call(String(C),","),N="",I=0;I<A.length;++I)N+=(0===I?"":",")+w(d(A[I],h.encoder,j,"value",g));return[w(k)+(s&&c(C)&&1===A.length?"[]":"")+"="+N]}return[w(k)+"="+w(d(C,h.encoder,j,"value",g))]}return[w(n)+"="+w(String(C))]}var R,D=[];if(void 0===C)return D;if("comma"===i&&c(C))R=[{value:C.length>0?C.join(",")||null:void 0}];else if(c(f))R=f;else{var M=Object.keys(C);R=b?M.sort(b):M}for(var L=s&&c(C)&&1===C.length?n+"[]":n,U=0;U<R.length;++U){var F=R[U],B="object"==typeof F&&void 0!==F.value?F.value:C[F];if(!u||null!==B){var $=c(C)?"function"==typeof i?i(L,F):L:L+(m?"."+F:"["+F+"]");x.set(t,E);var z=r();z.set(y,x),p(D,e(B,$,i,s,a,u,d,f,b,m,v,g,w,O,j,z))}}return D};e.exports=function(e,t){var n,o=e,l=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var r=i.formatters[n],o=h.filter;return("function"==typeof e.filter||c(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(n=l.filter);var u,d=[];if("object"!=typeof o||null===o)return"";u=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var f=a[u];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var y="comma"===f&&t&&t.commaRoundTrip;n||(n=Object.keys(o)),l.sort&&n.sort(l.sort);for(var m=r(),v=0;v<n.length;++v){var g=n[v];l.skipNulls&&null===o[g]||p(d,b(o[g],g,f,y,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,m))}var w=d.join(l.delimiter),O=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?O+="utf8=%26%2310003%3B&":O+="utf8=%E2%9C%93&"),w.length>0?O+w:""}},769:(e,t,n)=>{"use strict";var r=n(798),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)void 0!==e[r]&&(n[r]=e[r]);return n};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,n){return e[n]=t[n],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r<t.length;++r)for(var o=t[r],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];"object"==typeof u&&null!==u&&-1===n.indexOf(u)&&(t.push({obj:s,prop:l}),n.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],o=0;o<n.length;++o)void 0!==n[o]&&r.push(n[o]);t.obj[t.prop]=r}}}(t),e},decode:function(e,t,n){var r=e.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(e){return r}},encode:function(e,t,n,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===n)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",l=0;l<a.length;++l){var u=a.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===r.RFC1738&&(40===u||41===u)?c+=a.charAt(l):u<128?c+=s[u]:u<2048?c+=s[192|u>>6]+s[128|63&u]:u<55296||u>=57344?c+=s[224|u>>12]+s[128|u>>6&63]+s[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(l)),c+=s[240|u>>18]+s[128|u>>12&63]+s[128|u>>6&63]+s[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var n=[],r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)},merge:function e(t,n,r){if(!n)return t;if("object"!=typeof n){if(i(t))t.push(n);else{if(!t||"object"!=typeof t)return[t,n];(r&&(r.plainObjects||r.allowPrototypes)||!o.call(Object.prototype,n))&&(t[n]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(n);var s=t;return i(t)&&!i(n)&&(s=a(t,r)),i(t)&&i(n)?(n.forEach((function(n,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&n&&"object"==typeof n?t[i]=e(s,n,r):t.push(n)}else t[i]=n})),t):Object.keys(n).reduce((function(t,i){var s=n[i];return o.call(t,i)?t[i]=e(t[i],s,r):t[i]=s,t}),s)}}},921:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,g=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function O(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case p:case i:case a:case s:case f:return e;default:switch(e=e&&e.$$typeof){case l:case d:case b:case y:case c:return e;default:return t}}case o:return t}}}function j(e){return O(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=l,t.ContextProvider=c,t.Element=r,t.ForwardRef=d,t.Fragment=i,t.Lazy=b,t.Memo=y,t.Portal=o,t.Profiler=a,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return j(e)||O(e)===u},t.isConcurrentMode=j,t.isContextConsumer=function(e){return O(e)===l},t.isContextProvider=function(e){return O(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return O(e)===d},t.isFragment=function(e){return O(e)===i},t.isLazy=function(e){return O(e)===b},t.isMemo=function(e){return O(e)===y},t.isPortal=function(e){return O(e)===o},t.isProfiler=function(e){return O(e)===a},t.isStrictMode=function(e){return O(e)===s},t.isSuspense=function(e){return O(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===p||e===a||e===s||e===f||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===c||e.$$typeof===l||e.$$typeof===d||e.$$typeof===v||e.$$typeof===g||e.$$typeof===w||e.$$typeof===m)},t.typeOf=O},864:(e,t,n)=>{"use strict";e.exports=n(921)},359:(e,t)=>{"use strict";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.module.reference")},973:(e,t,n)=>{"use strict";n(359)},478:(e,t,n)=>{"use strict";var r=n(210),o=n(924),i=n(631),s=r("%TypeError%"),a=r("%WeakMap%",!0),c=r("%Map%",!0),l=o("WeakMap.prototype.get",!0),u=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),d=o("Map.prototype.get",!0),f=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new s("Side channel does not contain "+i(e))},get:function(r){if(a&&r&&("object"==typeof r||"function"==typeof r)){if(e)return l(e,r)}else if(c){if(t)return d(t,r)}else if(n)return function(e,t){var n=y(e,t);return n&&n.value}(n,r)},has:function(r){if(a&&r&&("object"==typeof r||"function"==typeof r)){if(e)return p(e,r)}else if(c){if(t)return h(t,r)}else if(n)return function(e,t){return!!y(e,t)}(n,r);return!1},set:function(r,o){a&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new a),u(e,r,o)):c?(t||(t=new c),f(t,r,o)):(n||(n={key:{},next:null}),function(e,t,n){var r=y(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,o))}};return r}},250:(e,t,n)=>{"use strict";var r=n(661),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,s=r.useEffect,a=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return a((function(){o.value=n,o.getSnapshot=t,l(o)&&u({inst:o})}),[e,n,t]),s((function(){return l(o)&&u({inst:o}),e((function(){l(o)&&u({inst:o})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},139:(e,t,n)=>{"use strict";var r=n(661),o=n(688),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,a=r.useRef,c=r.useEffect,l=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var p=a(null);if(null===p.current){var d={hasValue:!1,value:null};p.current=d}else d=p.current;p=l((function(){function e(e){if(!c){if(c=!0,s=e,e=r(e),void 0!==o&&d.hasValue){var t=d.value;if(o(t,e))return a=t}return a=e}if(t=a,i(s,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(s=e,a=n)}var s,a,c=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]}),[t,n,r,o]);var f=s(e,p[0],p[1]);return c((function(){d.hasValue=!0,d.value=f}),[f]),u(f),f}},688:(e,t,n)=>{"use strict";e.exports=n(250)},738:(e,t,n)=>{"use strict";e.exports=n(139)},710:e=>{"use strict";e.exports=require("preact")},207:e=>{"use strict";e.exports=require("preact/hooks")},654:()=>{},695:()=>{}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.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 r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>we,AgentInfo:()=>Tp,Chat:()=>Ul,ChatFrame:()=>sp,ComponentFilter:()=>al,Conversation:()=>Tl,DeprecatedToggleButton:()=>Pp,DeprecatedView:()=>$p,Engine:()=>Op,EntryContainer:()=>Qu,EventParticipant:()=>Ys,ExternalApi:()=>Ep,Header:()=>kp,Icon:()=>ba,Interrupt:()=>ap,MessageContainer:()=>ra,SeamlyApiContext:()=>qe,SeamlyEventBusContext:()=>We,SeamlyGeneralError:()=>u,SeamlyLiveRegionContext:()=>hs,SeamlyOfflineError:()=>Jo,Text:()=>Hc,View:()=>yp,calculateVisibility:()=>Ar,className:()=>Qs,default:()=>Hp,eventTypes:()=>Ge,randomId:()=>_,useChoicePrompt:()=>Ta,useEvents:()=>jr,useGeneratedId:()=>Vs,useI18n:()=>fs,useSeamlyActions:()=>zp,useSeamlyChat:()=>bs,useSeamlyCommands:()=>Ki,useSeamlyConfig:()=>br,useSeamlyEventStream:()=>Ws,useSeamlyIdleDetachCountdown:()=>zs,useSeamlyMessageContainerClassNames:()=>ws,useSeamlyOptions:()=>Ds,useSeamlyVisibility:()=>Fi,useTranslatedEventData:()=>Ks,useTranslations:()=>Gs,useTranslationsContainer:()=>Js,visibilityStates:()=>hr});const e=require("preact/jsx-runtime");var t=n(766),o=n.n(t);const i="cvco",s="2",a="seamly-client-participant";class c 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 l extends c{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class u extends c{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class p extends c{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class d extends c{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const f=(e,t)=>{let n;return function(...r){let o=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,o||e.apply(this,r),o=!1}),t),t=>{o=!0,t&&e.apply(this,r)}}},h=e=>Math.ceil(e/1e3),y=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},b=(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]}`},m={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},v={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},g=e=>e.code?v[e.code]:m[e.keyCode],w=e=>{e&&e.focus()},O=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};var j=n(905),x=n.n(j);function _(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}function C(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 JSON.parse(n)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}var S=e=>"function"==typeof e?e:function(){return e},E="undefined"!=typeof self?self:null,P="undefined"!=typeof window?window:null,T=E||P||T,k="closed",A="errored",N="joined",I="joining",R="leaving",D="phx_close",M="phx_error",L="phx_reply",U="phx_leave",F=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})}},B=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))}},$=class{static request(e,t,n,r,o,i,s){if(T.XDomainRequest){let n=new T.XDomainRequest;return this.xdomainRequest(n,e,t,r,o,i,s)}{let a=new T.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,o,i,s)}}static xdomainRequest(e,t,n,r,o,i,s){return e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,o,i,s,a){return e.open(t,n,!0),e.timeout=i,e.setRequestHeader("Content-Type",r),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(4===e.readyState&&a){let t=this.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(o),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 o=t?`${t}[${r}]`:r,i=e[r];"object"==typeof i?n.push(this.serialize(i,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}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)}`}},z=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/websocket"),"$1/longpoll")}endpointURL(){return $.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",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){this.ajax("POST",e,(()=>this.onerror("timeout")),(e=>{e&&200===e.status||(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});"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r){let o;o=$.request(e,this.endpointURL(),"application/json",t,this.timeout,(()=>{this.reqs.delete(o),n()}),(e=>{this.reqs.delete(o),this.isActive()&&r(e)})),this.reqs.add(o)}},H={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,o,i,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+n.length+o.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),c=new DataView(a),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,o.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(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.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),o=t.getUint8(2),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(s,s+r));s+=r;let c=n.decode(e.slice(s,s+o));s+=o;let l=n.decode(e.slice(s,s+i));return s+=i,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(a,a+r));a+=r;let l=n.decode(e.slice(a,a+o));a+=o;let u=n.decode(e.slice(a,a+i));a+=i;let p=n.decode(e.slice(a,a+s));a+=s;let d=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:L,payload:{status:p,response:d}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=n.decode(e.slice(i,i+r));i+=r;let a=n.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}};function V(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 q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){W(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G,K,J,X,Q=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};const Y=x()("seamly");class Z{constructor(){G.add(this),K.set(this,[])}connect(e,t,n,r){return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o,params:i}=(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 q(q({},e),{},{[n]:decodeURIComponent(r)})}),{})}})(this.url);this.socket=new 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||T.WebSocket||z,this.establishedConnections=0,this.defaultEncoder=H.encode.bind(H),this.defaultDecoder=H.decode.bind(H),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==z?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;P&&P.addEventListener&&(P.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),P.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.longpollerTimeout=t.longpollerTimeout||2e4,this.params=S(t.params||{}),this.endPoint=`${e}/websocket`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new B((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}getLongPollTransport(){return z}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=$.appendParams($.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,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=S(e)),this.conn||(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))}log(e,t,n){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((o=>{o.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`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(M)}))}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.joinRef()!==e.joinRef()))}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 class{constructor(e,t,n){this.state=k,this.topic=e,this.params=S(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new F(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new B((()=>{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=N,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=A,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=k,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=A,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 F(this,U,S({}),this.timeout).send(),this.state=A,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(L,((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(D,e)}onError(e){return this.on(M,(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 F(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=R;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(D,"leave")},n=new F(this,U,S({}),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=I,this.joinPush.resend(e))}trigger(e,t,n,r){let o=this.onMessage(e,t,n,r);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter((t=>t.event===e));for(let e=0;e<i.length;e++)i[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===k}isErrored(){return this.state===A}isJoined(){return this.state===N}isJoining(){return this.state===I}isLeaving(){return this.state===R}}(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:o,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${o})`,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:o,join_ref:i}=e;o&&o===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${o&&"("+o+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const s=this.channels[e];s.isMember(t,n,r,i)&&s.trigger(n,r,o,i)}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())}}(o,{params:Object.assign(Object.assign({},i),{v:s})}),this.socket.connect(),this.channel=this.socket.channel(this.channelTopic,{authorization:`Bearer ${this.accessToken}`,channelName:this.channelName}),this.start(),this.socket.onError((e=>{Y("[SOCKET][ERROR]",e)})),this.socket.onOpen((()=>{Y("[SOCKET]OPEN")})),this.channel.on("system",(e=>{"attach_channel_succeeded"===e.type&&Q(this,G,"m",X).call(this,"attach_channel_succeeded")})),this.socket.onClose((()=>{Y("[SOCKET]CLOSE"),Q(this,G,"m",X).call(this,"socket_closed")})),this.channel.onClose((()=>{Y("[CHANNEL]CLOSE"),Q(this,G,"m",X).call(this,"channel_closed")})),this.channel.onError((e=>{Y("[CHANNEL][ERROR]",e),Q(this,G,"m",X).call(this,"channel_erred")})),Q(this,G,"m",J).call(this,"ack","ui","error","participant","message","service_data","system","info","sync")}))}start(){this.channel.join().receive("ok",(()=>{Y("[CHANNEL][JOIN] OK"),Q(this,G,"m",X).call(this,"join_channel_succeeded")})).receive("error",(e=>{Y("[CHANNEL][JOIN] ERROR",e),Q(this,G,"m",X).call(this,"join_channel_erred"),this.channel.socket.disconnect()})).receive("timeout",(()=>{Y("[CHANEL][JOIN] Networking issue. Still waiting...")}))}disconnect(){var e,t,n;(function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)})(this,K,[],"f"),null===(e=this.channel)||void 0===e||e.leave(),null===(t=this.socket)||void 0===t||t.remove(this.channel),null===(n=this.socket)||void 0===n||n.disconnect()}onConnection(e){Q(this,K,"f").push(e)}pushToChannel(e,t,n=1e4){this.channel.push(e,t,n)}}K=new WeakMap,G=new WeakSet,J=function(...e){e.forEach((e=>{this.channel.on(e,(t=>{Y("[RECEIVE]",e,t)}))}))},X=function(e){Q(this,K,"f").forEach((t=>t(e)))};var ee,te,ne,re,oe,ie,se,ae,ce,le,ue,pe,de,fe,he,ye=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},be=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},me=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};const ve=x()("seamly");function ge(){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{constructor({layoutMode:e,namespace:t,config:n,context:r}){var o;ee.add(this),te.set(this,void 0),ne.set(this,void 0),re.set(this,void 0),oe.set(this,void 0),this.conversation=new Z,ue.set(this,(e=>e||this.locale)),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.locale?`.${r.locale}`:""}`,n.storageProvider||C),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},be(this,oe,Object.assign(Object.assign({},n),{sendEnvironment:null===(o=n.sendEnvironment)||void 0===o||o,context:Object.assign(Object.assign({},r),{channelName:r.channelName||"web"})}),"f"),be(this,te,!1,"f"),this.connected=!1,this.configReady=!1,be(this,ne,n.externalId,"f"),be(this,re,e,"f"),this.userResponded=!1,this.URLS={},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getConversationUrl(){return this.store.get("conversationUrl")}hasConversation(){return!!this.getConversationUrl()}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}reset(){return ye(this,void 0,void 0,(function*(){return yield this.disconnect(),this.clearStore(),this.getConfig()}))}disconnect(){var e;return ye(this,void 0,void 0,(function*(){(null===(e=this.conversation)||void 0===e?void 0:e.disconnect)&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}))}getConfig(){return o().post(`${me(this,ee,"m",pe).call(this,"http")}/client/${this.connectionInfo.apiKey}/configs`).set("Content-Type","application/json").query({v:s}).send({context:Object.assign(Object.assign({},me(this,oe,"f").context),{environment:!0===me(this,oe,"f").sendEnvironment?me(this,ee,"m",he).call(this):me(this,oe,"f").sendEnvironment})}).then((({body:e})=>(me(this,ee,"m",de).call(this,e),this.configReady=!0,e.config))).catch((e=>{if(404===e.status)throw new l(e);if(e.status>=500)throw new u(e);throw e}))}getConversation(){return ye(this,void 0,void 0,(function*(){if(!this.hasConversation())return null;try{const{body:e}=yield o().get(`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.history}`).set("Authorization",`Bearer ${me(this,ee,"m",ie).call(this)}`).query({v:s});me(this,ee,"m",de).call(this,e);const{messages:t,participants:n,activeServiceSessionId:r,activeServiceSettings:i,serviceData:a,ui:c,translation:l}=e.history;return{events:t.map((([e,t])=>({type:e,payload:Object.assign(Object.assign({},t),{type:"participant"===e?e:t.type})}))),participants:n,activeServiceSessionId:r,activeServiceSettings:i,serviceData:a,resumeConversationPrompt:!!c&&Boolean(c.resumeConversationPrompt),translationProposal:c.translationProposal,translation:l}}catch(e){if(401===e.status)throw new d(e);if(404===e.status)throw new p(e);if(e.status>=500)throw new u(e);throw e}}))}connect(){return ye(this,void 0,void 0,(function*(){this.connected=!1;let e={};return this.hasConversation()||(e=yield me(this,ee,"m",fe).call(this)),this.conversation.connect(`${me(this,ee,"m",pe).call(this,"ws")}${this.URLS.socket}`,me(this,oe,"f").context.channelName,me(this,ee,"m",ce).call(this),me(this,ee,"m",ie).call(this)),this.conversation.onConnection((e=>{this.connected=["attach_channel_succeeded","join_channel_succeeded"].includes(e),be(this,te,"attach_channel_succeeded"===e,"f")})),me(this,oe,"f").sendEnvironment&&this.send("context",{environment:!0===me(this,oe,"f").sendEnvironment?me(this,ee,"m",he).call(this):me(this,oe,"f").sendEnvironment},!1),e}))}uploadFile(e,t,n,r){const i=new FormData;i.append("upload",e);const s=o().post(`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.uploads}`).set("Authorization",`Bearer ${me(this,ee,"m",ie).call(this)}`).send(i);return s.on("progress",(function(e){const{direction:n,percent:r}=e;"upload"===n&&"function"==typeof t&&t(r)})),s.then((e=>{n&&n(e)})).catch((e=>{if(!r)throw e;r(e.response)})),s}getConversationIntitialState(){return o().get(`${me(this,ee,"m",pe).call(this,"http")}${this.getConversationUrl()}`).set("Authorization",`Bearer ${me(this,ee,"m",ie).call(this)}`).query({v:s}).then((({body:e})=>{return me(this,ee,"m",de).call(this,e),this.userResponded=e.conversation.userResponded,t=e.conversation,n=["accessToken","channelTopic"],Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{});var t,n})).catch((e=>{if(401===e.status)throw new d(e);if(404===e.status)throw new p(e);if(e.status>=500)throw new u(e);throw e}))}getTranslations(e){return ye(this,void 0,void 0,(function*(){try{if(!this.URLS.translations)throw new l;const t=`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.translations}`.replace("{version}",String(2)).replace("{locale}",me(this,ue,"f").call(this,e)),n=o().get(t),{body:r}=yield n;return r.translations}catch(e){if(e.status>=500)throw new u(e);throw e}}))}send(e,t,n=!0){var r;!this.connected||n&&!me(this,te,"f")?null===(r=this.conversation)||void 0===r||r.onConnection((r=>{const o="attach_channel_succeeded"===r;(n?o:"join_channel_succeeded"===r||o)&&this.send(e,t,n)})):(ve("[SEND]",e,t),this.conversation.pushToChannel(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:o}=t;return o||(o=_()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e){const{locale:t,variables:n}=e,r={};if(t){if("string"!=typeof t)throw new Error("Locale must be a string");r.locale=t}if(n){if("object"!=typeof n)throw new Error("Variables must be an object");r.variables=n}0===Object.keys(r).length&&r.constructor===Object||this.send("context",r,!1)}}te=new WeakMap,ne=new WeakMap,re=new WeakMap,oe=new WeakMap,ue=new WeakMap,ee=new WeakSet,ie=function(){return this.store.get("accessToken")},se=function(e){this.store.set("accessToken",e)},ae=function(e){this.store.set("conversationUrl",e)},ce=function(){return this.store.get("channelTopic")||this.store.get("channelName")},le=function(e){this.store.set("channelTopic",e)},pe=function(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`},de=function({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>Object.assign(Object.assign({},e),{[t]:n})),this.URLS)},fe=function(){var e;return ye(this,void 0,void 0,(function*(){try{const t=o().post(`${me(this,ee,"m",pe).call(this,"http")}${this.URLS.conversations}`).set("Content-Type","application/json").query({v:s}).withCredentials().send({externalId:me(this,ne,"f")||void 0}),{body:n}=yield t,{conversation:r}=n,i=Object.assign({},r);return delete i.accessToken,delete i.channelTopic,me(this,ee,"m",se).call(this,r.accessToken),me(this,ee,"m",le).call(this,r.channelTopic),me(this,ee,"m",de).call(this,n),me(this,ee,"m",ae).call(this,this.URLS.conversation),this.locale=null===(e=r.translation)||void 0===e?void 0:e.locale,this.userResponded=r.userResponded,i}catch(e){if(e.status>=500)throw new u(e);throw e}}))},he=function(){return{clientName:"@seamly/web-ui",clientVariant:me(this,re,"f"),clientVersion:"21.0.1",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:ge(),userAgent:navigator.userAgent,preferredLocale:navigator.language}};var Oe=n(679),je=n.n(Oe),xe=n(710),_e=n(207),Ce=n(688),Se=n(738),Ee=n(661);let Pe=function(e){e()};const Te=()=>Pe,ke=(0,Ee.createContext)(null);function Ae(){return(0,Ee.useContext)(ke)}let Ne=()=>{throw new Error("uSES not initialized!")};const Ie=(e,t)=>e===t;function Re(e=ke){const t=e===ke?Ae:()=>(0,Ee.useContext)(e);return function(e,n=Ie){const{store:r,subscription:o,getServerState:i}=t(),s=Ne(o.addNestedSub,r.getState,i||r.getState,e,n);return(0,Ee.useDebugValue)(s),s}}const De=Re();n(545),n(973);const Me={notify(){},get:()=>[]};const Le="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?Ee.useLayoutEffect:Ee.useEffect;let Ue=null;const Fe=function({store:e,context:t,children:n,serverState:r}){const o=(0,Ee.useMemo)((()=>{const t=function(e,t){let n,r=Me;function o(){s.onStateChange&&s.onStateChange()}function i(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){const e=Te();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const s={addNestedSub:function(e){return i(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=Me)},getListeners:()=>r};return s}(e);return{store:e,subscription:t,getServerState:r?()=>r:void 0}}),[e,r]),i=(0,Ee.useMemo)((()=>e.getState()),[e]);Le((()=>{const{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),i!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[o,i]);const s=t||ke;return Ee.default.createElement(s.Provider,{value:o},n)};function Be(e=ke){const t=e===ke?Ae:()=>(0,Ee.useContext)(e);return function(){const{store:e}=t();return e}}const $e=Be();function ze(e=ke){const t=e===ke?$e:Be(e);return function(){return t().dispatch}}const He=ze();var Ve;(e=>{Ne=e})(Se.useSyncExternalStoreWithSelector),(e=>{Ue=e})(Ce.useSyncExternalStore),Ve=Ee.unstable_batchedUpdates,Pe=Ve;const qe=(0,xe.createContext)(null),We=(0,xe.createContext)(null),Ge={info:"info",message:"message",participant:"participant",system:"system"},Ke="text",Je="text",Xe="upload",Qe="received",Ye="read",Ze="custom",et="typing",tt="read",nt="detach_service",rt="dismiss",ot="set_topic",it="set_translation",st="click_cta",at="translation_proposal",ct="assertive",lt="polite",ut={new_topic:"newTopic",new_translation:"newTranslation"},pt="uploads",dt="navigate";function ft(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function ht(e){return!!e&&!!e[en]}function yt(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===tn}(e)||Array.isArray(e)||!!e[Zt]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Zt])||Ot(e)||jt(e))}function bt(e,t,n){void 0===n&&(n=!1),0===mt(e)?(n?Object.keys:nn)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function mt(e){var t=e[en];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Ot(e)?2:jt(e)?3:0}function vt(e,t){return 2===mt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function gt(e,t,n){var r=mt(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function wt(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Ot(e){return Jt&&e instanceof Map}function jt(e){return Xt&&e instanceof Set}function xt(e){return e.o||e.t}function _t(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=rn(e);delete t[en];for(var n=nn(t),r=0;r<n.length;r++){var o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Ct(e,t){return void 0===t&&(t=!1),Et(e)||ht(e)||!yt(e)||(mt(e)>1&&(e.set=e.add=e.clear=e.delete=St),Object.freeze(e),t&&bt(e,(function(e,t){return Ct(t,!0)}),!0)),e}function St(){ft(2)}function Et(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Pt(e){var t=on[e];return t||ft(18,e),t}function Tt(){return Gt}function kt(e,t){t&&(Pt("Patches"),e.u=[],e.s=[],e.v=t)}function At(e){Nt(e),e.p.forEach(Rt),e.p=null}function Nt(e){e===Gt&&(Gt=e.l)}function It(e){return Gt={p:[],l:Gt,h:e,m:!0,_:0}}function Rt(e){var t=e[en];0===t.i||1===t.i?t.j():t.O=!0}function Dt(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||Pt("ES5").S(t,e,r),r?(n[en].P&&(At(t),ft(4)),yt(e)&&(e=Mt(t,e),t.l||Ut(t,e)),t.u&&Pt("Patches").M(n[en].t,e,t.u,t.s)):e=Mt(t,n,[]),At(t),t.u&&t.v(t.u,t.s),e!==Yt?e:void 0}function Mt(e,t,n){if(Et(t))return t;var r=t[en];if(!r)return bt(t,(function(o,i){return Lt(e,r,t,o,i,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return Ut(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=_t(r.k):r.o;bt(3===r.i?new Set(o):o,(function(t,i){return Lt(e,r,o,t,i,n)})),Ut(e,o,!1),n&&e.u&&Pt("Patches").R(r,n,e.u,e.s)}return r.o}function Lt(e,t,n,r,o,i){if(ht(o)){var s=Mt(e,o,i&&t&&3!==t.i&&!vt(t.D,r)?i.concat(r):void 0);if(gt(n,r,s),!ht(s))return;e.m=!1}if(yt(o)&&!Et(o)){if(!e.h.F&&e._<1)return;Mt(e,o),t&&t.A.l||Ut(e,o)}}function Ut(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Ct(t,n)}function Ft(e,t){var n=e[en];return(n?xt(n):e)[t]}function Bt(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function $t(e){e.P||(e.P=!0,e.l&&$t(e.l))}function zt(e){e.o||(e.o=_t(e.t))}function Ht(e,t,n){var r=Ot(t)?Pt("MapSet").N(t,n):jt(t)?Pt("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:Tt(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,i=sn;n&&(o=[r],i=an);var s=Proxy.revocable(o,i),a=s.revoke,c=s.proxy;return r.k=c,r.j=a,c}(t,n):Pt("ES5").J(t,n);return(n?n.A:Tt()).p.push(r),r}function Vt(e){return ht(e)||ft(22,e),function e(t){if(!yt(t))return t;var n,r=t[en],o=mt(t);if(r){if(!r.P&&(r.i<4||!Pt("ES5").K(r)))return r.t;r.I=!0,n=qt(t,o),r.I=!1}else n=qt(t,o);return bt(n,(function(t,o){r&&function(e,t){return 2===mt(e)?e.get(t):e[t]}(r.t,t)===o||gt(n,t,e(o))})),3===o?new Set(n):n}(e)}function qt(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return _t(e)}var Wt,Gt,Kt="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Jt="undefined"!=typeof Map,Xt="undefined"!=typeof Set,Qt="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Yt=Kt?Symbol.for("immer-nothing"):((Wt={})["immer-nothing"]=!0,Wt),Zt=Kt?Symbol.for("immer-draftable"):"__$immer_draftable",en=Kt?Symbol.for("immer-state"):"__$immer_state",tn=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(e){var t={};return nn(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},on={},sn={get:function(e,t){if(t===en)return e;var n=xt(e);if(!vt(n,t))return function(e,t,n){var r,o=Bt(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!yt(r)?r:r===Ft(e.t,t)?(zt(e),e.o[t]=Ht(e.A.h,r,e)):r},has:function(e,t){return t in xt(e)},ownKeys:function(e){return Reflect.ownKeys(xt(e))},set:function(e,t,n){var r=Bt(xt(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=Ft(xt(e),t),i=null==o?void 0:o[en];if(i&&i.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(wt(n,o)&&(void 0!==n||vt(e.t,t)))return!0;zt(e),$t(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==Ft(e.t,t)||t in e.t?(e.D[t]=!1,zt(e),$t(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=xt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){ft(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ft(12)}},an={};bt(sn,(function(e,t){an[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),an.deleteProperty=function(e,t){return an.set.call(this,e,t,void 0)},an.set=function(e,t,n){return sn.set.call(this,e[0],t,n,e[0])};var cn=function(){function e(e){var t=this;this.g=Qt,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var i=t;return function(e){var t=this;void 0===e&&(e=o);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return i.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&ft(6),void 0!==r&&"function"!=typeof r&&ft(7),yt(e)){var a=It(t),c=Ht(t,e,void 0),l=!0;try{s=n(c),l=!1}finally{l?At(a):Nt(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return kt(a,r),Dt(e,a)}),(function(e){throw At(a),e})):(kt(a,r),Dt(s,a))}if(!e||"object"!=typeof e){if(void 0===(s=n(e))&&(s=e),s===Yt&&(s=void 0),t.F&&Ct(s,!0),r){var u=[],p=[];Pt("Patches").M(e,s,u,p),r(u,p)}return s}ft(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var r,o,i=t.produce(e,n,(function(e,t){r=e,o=t}));return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return[e,r,o]})):[i,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){yt(e)||ft(8),ht(e)&&(e=Vt(e));var t=It(this),n=Ht(this,e,void 0);return n[en].C=!0,Nt(t),n},t.finishDraft=function(e,t){var n=(e&&e[en]).A;return kt(n,t),Dt(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Qt&&ft(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var o=Pt("Patches").$;return ht(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),ln=new cn,un=ln.produce;ln.produceWithPatches.bind(ln),ln.setAutoFreeze.bind(ln),ln.setUseProxies.bind(ln),ln.applyPatches.bind(ln),ln.createDraft.bind(ln),ln.finishDraft.bind(ln);const pn=un;function dn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fn(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 hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){dn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yn(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 bn="function"==typeof Symbol&&Symbol.observable||"@@observable",mn=function(){return Math.random().toString(36).substring(7).split("").join(".")},vn={INIT:"@@redux/INIT"+mn(),REPLACE:"@@redux/REPLACE"+mn(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+mn()}};function gn(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function wn(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(yn(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(yn(1));return n(wn)(e,t)}if("function"!=typeof e)throw new Error(yn(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(yn(3));return i}function p(e){if("function"!=typeof e)throw new Error(yn(4));if(c)throw new Error(yn(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(yn(6));t=!1,l();var n=a.indexOf(e);a.splice(n,1),s=null}}}function d(e){if(!gn(e))throw new Error(yn(7));if(void 0===e.type)throw new Error(yn(8));if(c)throw new Error(yn(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(yn(10));o=e,d({type:vn.REPLACE})}function h(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(yn(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[bn]=function(){return this},e}return d({type:vn.INIT}),(r={dispatch:d,subscribe:p,getState:u,replaceReducer:f})[bn]=h,r}function On(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function jn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(yn(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return r=On.apply(void 0,i)(n.dispatch),hn(hn({},n),{},{dispatch:r})}}}function xn(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var _n=xn();_n.withExtraArgument=xn;const Cn=_n;var Sn,En=(Sn=function(e,t){return Sn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Sn(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Sn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Pn=function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},Tn=Object.defineProperty,kn=Object.defineProperties,An=Object.getOwnPropertyDescriptors,Nn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,Dn=function(e,t,n){return t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Mn=function(e,t){for(var n in t||(t={}))In.call(t,n)&&Dn(e,n,t[n]);if(Nn)for(var r=0,o=Nn(t);r<o.length;r++)n=o[r],Rn.call(t,n)&&Dn(e,n,t[n]);return e},Ln=function(e,t){return kn(e,An(t))},Un="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?On:On.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Fn=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return En(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Pn([void 0],e[0].concat(this)))):new(t.bind.apply(t,Pn([void 0],e.concat(this))))},t}(Array);function Bn(e){return yt(e)?pn(e,(function(){})):e}function $n(e){var t,n=function(e){return function(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=(e.immutableCheck,e.serializableCheck,new Fn);return n&&(function(e){return"boolean"==typeof e}(n)?r.push(Cn):r.push(Cn.withExtraArgument(n.extraArgument))),r}(e)},r=e||{},o=r.reducer,i=void 0===o?void 0:o,s=r.middleware,a=void 0===s?n():s,c=r.devTools,l=void 0===c||c,u=r.preloadedState,p=void 0===u?void 0:u,d=r.enhancers,f=void 0===d?void 0:d;if("function"==typeof i)t=i;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,s=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:vn.INIT}))throw new Error(yn(12));if(void 0===n(void 0,{type:vn.PROBE_UNKNOWN_ACTION()}))throw new Error(yn(13))}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},a=0;a<s.length;a++){var c=s[a],l=n[c],u=e[c],p=l(u,t);if(void 0===p)throw t&&t.type,new Error(yn(14));o[c]=p,r=r||p!==u}return(r=r||s.length!==Object.keys(e).length)?o:e}}(i)}var h=a;"function"==typeof h&&(h=h(n));var y=jn.apply(void 0,h),b=On;l&&(b=Un(Mn({trace:!1},"object"==typeof l&&l)));var m=[y];return Array.isArray(f)?m=Pn([y],f):"function"==typeof f&&(m=f(m)),wn(t,p,b.apply(void 0,m))}function zn(e,t){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Mn(Mn({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function Hn(e){var t,n={},r=[],o={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(r in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[r]=t,o},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,r,t]}function Vn(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,r="function"==typeof e.initialState?e.initialState:Bn(e.initialState),o=e.reducers||{},i=Object.keys(o),s={},a={},c={};function l(){var t="function"==typeof e.extraReducers?Hn(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,i=t[1],s=void 0===i?[]:i,c=t[2],l=void 0===c?void 0:c,u=Mn(Mn({},o),a);return function(e,t,n,r){void 0===n&&(n=[]);var o,i=Hn(t),s=i[0],a=i[1],c=i[2];if(function(e){return"function"==typeof e}(e))o=function(){return Bn(e())};else{var l=Bn(e);o=function(){return l}}function u(e,t){void 0===e&&(e=o());var n=Pn([s[t.type]],a.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){var r;if(ht(e))return void 0===(r=n(e,t))?e:r;if(yt(e))return pn(e,(function(e){return n(e,t)}));if(void 0===(r=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e}),e)}return u.getInitialState=o,u}(r,(function(e){for(var t in u)e.addCase(t,u[t]);for(var n=0,r=s;n<r.length;n++){var o=r[n];e.addMatcher(o.matcher,o.reducer)}l&&e.addDefaultCase(l)}))}return i.forEach((function(e){var n,r,i=o[e],l=function(e,t){return e+"/"+t}(t,e);"reducer"in i?(n=i.reducer,r=i.prepare):n=i,s[e]=n,a[l]=n,c[e]=r?zn(l,r):zn(l)})),{name:t,reducer:function(e,t){return n||(n=l()),n(e,t)},actions:c,caseReducers:s,getInitialState:function(){return n||(n=l()),n.getInitialState()}}}var qn=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},Wn=["name","message","stack","code"],Gn=function(e,t){this.payload=e,this.meta=t},Kn=function(e,t){this.payload=e,this.meta=t},Jn=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,r=Wn;n<r.length;n++){var o=r[n];"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}},Xn=function(){function e(e,t,n){var r=zn(e+"/fulfilled",(function(e,t,n,r){return{payload:e,meta:Ln(Mn({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}})),o=zn(e+"/pending",(function(e,t,n){return{payload:void 0,meta:Ln(Mn({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),i=zn(e+"/rejected",(function(e,t,r,o,i){return{payload:o,error:(n&&n.serializeError||Jn)(e||"Rejected"),meta:Ln(Mn({},i||{}),{arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),s="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,c,l){var u,p=(null==n?void 0:n.idGenerator)?n.idGenerator(e):qn(),d=new s,f=new Promise((function(e,t){return d.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:u||"Aborted"})}))})),h=!1;function y(e){h&&(u=e,d.abort())}var b=function(){return s=this,u=null,b=function(){var s,u,b,m,v;return function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(g){switch(g.label){case 0:return g.trys.push([0,4,,5]),null===(w=m=null==(s=null==n?void 0:n.condition)?void 0:s.call(n,e,{getState:c,extra:l}))||"object"!=typeof w||"function"!=typeof w.then?[3,2]:[4,m];case 1:m=g.sent(),g.label=2;case 2:if(!1===m)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return h=!0,a(o(p,e,null==(u=null==n?void 0:n.getPendingMeta)?void 0:u.call(n,{requestId:p,arg:e},{getState:c,extra:l}))),[4,Promise.race([f,Promise.resolve(t(e,{dispatch:a,getState:c,extra:l,requestId:p,signal:d.signal,abort:y,rejectWithValue:function(e,t){return new Gn(e,t)},fulfillWithValue:function(e,t){return new Kn(e,t)}})).then((function(t){if(t instanceof Gn)throw t;return t instanceof Kn?r(t.payload,p,e,t.meta):r(t,p,e)}))])];case 3:return b=g.sent(),[3,5];case 4:return v=g.sent(),b=v instanceof Gn?i(null,p,e,v.payload,v.meta):i(v,p,e),[3,5];case 5:return n&&!n.dispatchConditionRejection&&i.match(b)&&b.meta.condition||a(b),[2,b]}var w}))},new Promise((function(e,t){var n=function(e){try{o(b.next(e))}catch(e){t(e)}},r=function(e){try{o(b.throw(e))}catch(e){t(e)}},o=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,r)};o((b=b.apply(s,u)).next())}));var s,u,b}();return Object.assign(b,{abort:y,requestId:p,arg:e,unwrap:function(){return b.then(Qn)}})}}),{pending:o,rejected:i,fulfilled:r,typePrefix:e})}return e.withTypes=e,e}();function Qn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Yn=function(e,t){return function(e){return e&&"function"==typeof e.match}(e)?e.match(t):e(t)};function Zn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return e.some((function(e){return Yn(e,t)}))}}Object.assign;var er="listenerMiddleware";zn(er+"/add"),zn(er+"/removeAll"),zn(er+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:n.g),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[en];return sn.get(t,e)},set:function(t){var n=this[en];sn.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][en];if(!o.P)switch(o.i){case 5:r(o)&&$t(o);break;case 4:n(o)&&$t(o)}}}function n(e){for(var t=e.t,n=e.k,r=nn(n),o=r.length-1;o>=0;o--){var i=r[o];if(i!==en){var s=t[i];if(void 0===s&&!vt(t,i))return!0;var a=n[i],c=a&&a[en];if(c?c.t!==s:!wt(a,s))return!0}}var l=!!t[en];return r.length!==nn(t).length+(l?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var o={};!function(e,t){on[e]||(on[e]=t)}("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var i=rn(n);delete i[en];for(var s=nn(i),a=0;a<s.length;a++){var c=s[a];i[c]=e(c,t||!!i[c].enumerable)}return Object.create(Object.getPrototypeOf(n),i)}(r,t),i={i:r?5:4,A:n?n.A:Tt(),P:!1,I:!1,D:{},l:n,t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,en,{value:i,writable:!0}),o},S:function(e,n,o){o?ht(n)&&n[en].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[en];if(n){var o=n.t,i=n.k,s=n.D,a=n.i;if(4===a)bt(i,(function(t){t!==en&&(void 0!==o[t]||vt(o,t)?s[t]||e(i[t]):(s[t]=!0,$t(n)))})),bt(o,(function(e){void 0!==i[e]||vt(i,e)||(s[e]=!1,$t(n))}));else if(5===a){if(r(n)&&($t(n),s.length=!0),i.length<o.length)for(var c=i.length;c<o.length;c++)s[c]=!1;else for(var l=o.length;l<i.length;l++)s[l]=!0;for(var u=Math.min(i.length,o.length),p=0;p<u;p++)i.hasOwnProperty(p)||(s[p]=!0),void 0===s[p]&&e(i[p])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}();class tr extends c{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}var nr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const rr=Xn("initializeConfig",((e,{extra:{api:t,config:n},rejectWithValue:r})=>nr(void 0,void 0,void 0,(function*(){var e;try{const{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c}=yield t.getConfig(),l=(null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.locale)||o,{connectWhenInView:u}=n;return{features:r,defaultLocale:o,preChat:i,agentParticipant:s,userParticipant:a,startChatIcon:c,locale:l,connectWhenInView:u}}catch(e){return r(e)}})))),or=Xn("resetConfig",((e,{extra:{config:t}})=>nr(void 0,void 0,void 0,(function*(){return t}))));const ir=Xn("setLocale",((e,{extra:{api:t},rejectWithValue:n})=>function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){try{return{translations:yield t.getTranslations(e),locale:e}}catch(e){return n(e)}}))),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,locale:r}}=t();return e!==r&&!n}});var sr="NOT_FOUND",ar=function(e,t){return e===t};function cr(e,t){var n,r,o="object"==typeof t?t:{equalityCheck:t},i=o.equalityCheck,s=void 0===i?ar:i,a=o.maxSize,c=void 0===a?1:a,l=o.resultEqualityCheck,u=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(s),p=1===c?(n=u,{get:function(e){return r&&n(r.key,e)?r.value:sr},put:function(e,t){r={key:e,value:t}},getEntries:function(){return r?[r]:[]},clear:function(){r=void 0}}):function(e,t){var n=[];function r(e){var r=n.findIndex((function(n){return t(e,n.key)}));if(r>-1){var o=n[r];return r>0&&(n.splice(r,1),n.unshift(o)),o.value}return sr}return{get:r,put:function(t,o){r(t)===sr&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(c,u);function d(){var t=p.get(arguments);if(t===sr){if(t=e.apply(null,arguments),l){var n=p.getEntries(),r=n.find((function(e){return l(e.value,t)}));r&&(t=r.value)}p.put(arguments,t)}return t}return d.clearCache=function(){return p.clear()},d}function lr(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return"function"==typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+n+"]")}return t}function ur(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var i,s=0,a={memoizeOptions:void 0},c=r.pop();if("object"==typeof c&&(a=c,c=r.pop()),"function"!=typeof c)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof c+"]");var l=a,u=l.memoizeOptions,p=void 0===u?n:u,d=Array.isArray(p)?p:[p],f=lr(r),h=e.apply(void 0,[function(){return s++,c.apply(null,arguments)}].concat(d)),y=e((function(){for(var e=[],t=f.length,n=0;n<t;n++)e.push(f[n].apply(null,arguments));return i=h.apply(null,e)}));return Object.assign(y,{resultFunc:c,memoizedResultFunc:h,dependencies:f,lastResult:function(){return i},recomputations:function(){return s},resetRecomputations:function(){return s=0}}),y};return o}var pr=ur(cr);const dr=pr((({app:e})=>e),(({userHasResponded:e})=>e)),fr="visibility",hr={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},yr=pr((({config:e})=>e),(e=>{let t=Object.assign({visible:"inline"===(null==e?void 0:e.layoutMode)?hr.open:hr.minimized,appContainerClassNames:e.appContainerClassNames||[]},e);return"function"==typeof t.appContainerClassNames&&(t=Object.assign(Object.assign({},t),{appContainerClassNames:t.appContainerClassNames(t)})),t})),br=()=>De(yr);function mr(){const{startChatIcon:e}=br();return e}const vr=({state:e})=>e,gr=()=>De(vr),wr=pr(vr,yr,dr,(({events:e,serviceData:t},n,r)=>{var o;if(r||"inline"===n.layoutMode||!(null==t?void 0:t.suggestion)||!(null===(o=null==t?void 0:t.suggestion)||void 0===o?void 0:o.body.length))return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),Or=pr(wr,yr,((e,t)=>{var n,r;const{enabled:o,threshold:i}=null!==(r=null===(n=null==t?void 0:t.messages)||void 0===n?void 0:n.timeIndicator)&&void 0!==r?r:{};if(!o)return e;const s=[];let a=null;return e.forEach(((e,t)=>{if(0===t)s.push(Object.assign(Object.assign({},e),{timeIndicator:e.payload.occurredAt}));else{const t=a&&h(e.payload.occurredAt-a.payload.occurredAt)>=i?e.payload.occurredAt:void 0;s.push(Object.assign(Object.assign({},e),{timeIndicator:t}))}a=e})),s})),jr=()=>De(Or),xr=(pr(Or,(e=>e.map((e=>e.payload.id)))),()=>gr().isLoading),_r=()=>gr().headerTitles,Cr=()=>gr().unreadEvents,Sr=()=>gr().skiplinkTargetId,Er=pr(Or,(e=>{var t;const n=e.filter((e=>"message"===e.type));return null===(t=n[n.length-1])||void 0===t?void 0:t.payload.id})),Pr=()=>{const{participants:e,currentAgent:t}=gr().participantInfo;return t?e[t]:null},Tr=e=>gr().serviceData[e],kr=()=>{const{layoutMode:e}=br();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},Ar=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=r,{visible:a}=o||{};if("app"===i&&!t)return hr.open;if("window"===i&&s&&n!==hr.open)return e?n||t||hr.open:hr.hidden;if("inline"===i&&e&&!n)return t||hr.open;const c=hr.minimized;return n||t||a||c},Nr=pr((({visibility:e})=>e),(e=>e.visibility)),Ir=pr((({visibility:e})=>e),(e=>e.showInlineView));const Rr=[hr.open,hr.minimized,hr.hidden],Dr=Xn("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),i=Nr(o),s=dr(o),a=n.hasConversation(),c=yr(o),{visibilityCallback:l=Ar,layoutMode:u}=c,{unreadEvents:p}=vr(o),d=l({hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(Rr.includes(d)){if(i!==d)return n.store.set(fr,Object.assign(Object.assign({},n.store.get(fr)||{}),{[u]:e})),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:p}),d}else console.error('The visibilityCallback function should return "open", "minimized" or "hidden".')})),Mr=Xn("initialize",((e,{dispatch:t,getState:n,extra:{api:r}})=>function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){var e;const{layoutMode:o}=yr(n()),i=(null===(e=r.store.get(fr))||void 0===e?void 0:e[o])||hr.initialize;return t(Dr(i)),i}))));var Lr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))};const Ur=Xn("initializeApp",((e,{extra:{api:t,config:n},rejectWithValue:r})=>Lr(void 0,void 0,void 0,(function*(){var e,o,i,s;let a=null===(e=null==n?void 0:n.context)||void 0===e?void 0:e.locale;try{if(t.hasConversation()){const e=yield t.getConversationIntitialState();return a=(null===(o=e.translation)||void 0===o?void 0:o.locale)||a,{initialState:e,locale:a,config:n}}return(null===(i=null==n?void 0:n.context)||void 0===i?void 0:i.topic)&&t.send("action",{type:ot,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),(null===(s=null==n?void 0:n.context)||void 0===s?void 0:s.translationLocale)&&(a=n.context.translationLocale,t.send("action",{type:it,body:{enabled:!0,locale:a}},!1)),{initialState:void 0,locale:a,config:n}}catch(e){if(e instanceof p){const e=new p;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new tr;return r({name:t.name,message:t.message,langKey:t.langKey})}})))),Fr=Xn("resetApp",((e,{dispatch:t,extra:{api:n}})=>Lr(void 0,void 0,void 0,(function*(){yield n.disconnect(),yield n.clearStore(),t(or()),yield t(rr());try{const{locale:e}=yield t(Ur()).unwrap();yield t(ir(e))}catch(e){}t(Mr())})))),Br=()=>De(dr),$r={userHasResponded:!1},zr=Vn({name:"app",initialState:$r,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(Fr.pending,(()=>$r)).addCase(Ur.fulfilled,((e,{payload:t})=>{var n;t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=null===(n=t.initialState)||void 0===n?void 0:n.userResponded)}))}}),{setHasResponded:Hr}=zr.actions,Vr=zr.reducer,qr={error:void 0},Wr=Vn({name:"interrupt",initialState:qr,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>qr},extraReducers:e=>{e.addCase(Fr.fulfilled,(()=>qr)).addMatcher(Zn(Ur.rejected,rr.rejected,ir.rejected,Dr.rejected,Mr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:Gr,clearInterrupt:Kr}=Wr.actions,Jr=Wr.reducer,Xr=({type:e,payload:t})=>e===Ge.message&&!t.fromClient||e===Ge.info&&t.type===Ke,Qr=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),Yr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:i,introduction:s}=t.participant,a=n[r],c=Object.assign(Object.assign({},n),{[r]:a?Object.assign(Object.assign(Object.assign(Object.assign({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return Object.assign(Object.assign({},e),{participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r})},Zr=(e,t)=>{const n="message"===(null==t?void 0:t.type)?null==t?void 0:t.payload.entry:{},{blockAutoEntrySwitch:r}=e;if(!n)return Object.assign(Object.assign({},e),{optionsOverride:{}});const{type:o,options:i}=n;let s=e.active;return r||o===e.userSelected||(s=o),Object.assign(Object.assign({},e),{active:s,optionsOverride:Object.assign(Object.assign({},e.optionsOverride),{[o]:i||{}})})},eo={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:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:_(),optionsButtonId:_(),headerCollapseButtonId:_(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],entryMeta:{default:Je,active:Je,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{}},seamlyContainerElement:null},to=Vn({name:"store",initialState:eo,reducers:{addEvent:(e,t)=>{var n,r;const{type:o,payload:i}=t.payload,s=e.options.features.hasOwnProperty(pt);let a=Object.assign({},e.options);if(s&&(o===Ge.message||o===Ge.participant)&&!i.fromClient){const e="message"===o?null===(n=i.entry)||void 0===n?void 0:n.type:{};a=Object.assign(Object.assign({},a),{features:Object.assign(Object.assign({},a.features),{uploads:Object.assign(Object.assign({},null===(r=a.features)||void 0===r?void 0:r.uploads),{enabledFromEntry:e===Xe})})})}const c=Xr(t.payload);if(e.events.find((e=>e.payload.id===i.id)))return;const l=Zr(e.entryMeta,t.payload);e.entryMeta=s||l.active!==Xe?l:Object.assign({},e.entryMeta),e.options=a,c&&(e.unreadEvents+=1,"service_data"!==o&&(t.payload.payload.messageStatus=i.fromClient?Ye:Qe)),t.payload.payload.key=_(),e.events.push(t.payload),e.isLastEventFromClient=i.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:o}=t;n&&(n.payload.id=r,n.payload.occurredAt=o,e.events=Qr(e.events))},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(-1!==t.indexOf(e.payload.id)&&(e.payload=Object.assign(Object.assign({},e.payload),"service_data"!==e.type&&e.payload.messageStatus===Qe&&{messageStatus:Ye})),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setHistory:(e,{payload:{events:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o={},serviceData:i,resumeConversationPrompt:s}})=>{var a,c;const l=((e,t)=>{const n=e.filter((e=>!t.some((t=>t.payload.id===e.payload.id)))),r=t.filter((e=>!("participant"===e.type&&!e.payload.participant.introduction))).reverse();return Qr([...r,...n])})(e.events,t),u=Object.assign(Object.assign({},e.participantInfo.participants),n),p=l.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let d=null;p&&("message"===p.type&&(d=p.payload.participant),"participant"===p.type&&(d=p.payload.participant.id));const{entry:f}=o,h=null===(a=null==f?void 0:f.options)||void 0===a?void 0:a.upload,y=Zr(Object.assign(Object.assign(Object.assign({},e.entryMeta),f),{active:(null==f?void 0:f.default)||Ke,options:Object.assign({},(null==f?void 0:f.options)?f.options:{})}),l[l.length-1]);let b=Object.assign({},e.options.features);const m=b.hasOwnProperty(pt);if(m&&"message"===(null==p?void 0:p.type)){const{payload:e}=p,t=(null===(c=null==e?void 0:e.entry)||void 0===c?void 0:c.type)||{};b=Object.assign(Object.assign({},b),{uploads:{enabled:!(!h||!(null==h?void 0:h.enabled)),enabledFromEntry:t===Xe}})}e.unreadEvents=l.filter((e=>"message"===e.type&&e.payload.messageStatus===Qe)).length,e.events=l.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),e.participantInfo=Object.assign(Object.assign(Object.assign({},e.participantInfo),d?Yr(e.participantInfo,{participant:u[d]}):{}),{participants:u}),e.historyLoaded=!0,e.serviceInfo=Object.assign(Object.assign({},e.serviceInfo),{activeServiceSessionId:r}),e.serviceData=Object.assign(Object.assign({},e.serviceData),i),e.options=Object.assign(Object.assign({},e.options),{features:b||{}}),e.entryMeta=m||y.active!==Xe?y:Object.assign({},e.entryMeta),e.resumeConversationPrompt=s||!1,d&&(e.headerTitles.subTitle=u[d].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}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=y(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.initialState,e.unreadEvents=eo.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={}},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={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},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?Object.assign(Object.assign({},e),{progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}):e))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?Object.assign(Object.assign({},e),{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?Object.assign(Object.assign({},e),{complete:!0}):e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t}},extraReducers:e=>{e.addCase(Fr.pending,(()=>eo)).addCase(rr.fulfilled,((e,{payload:t})=>{var n;e.headerTitles.subTitle=null===(n=t.agentParticipant)||void 0===n?void 0:n.name,t.features&&(e.options.features=t.features)})).addCase(Ur.fulfilled,((e,{payload:t})=>{t.initialState&&(e.initialState=t.initialState)})).addMatcher(Zn(po,fo),(e=>{e.isLastEventFromClient=!1}))}}),{ackEvent:no,addEvent:ro,clearAllUploads:oo,clearEvents:io,clearFeatures:so,clearIdleDetachCountdown:ao,clearResumeConversationPrompt:co,decrementIdleDetachCountdownCounter:lo,hideOption:uo,initIdleDetachCountdown:po,initResumeConversationPrompt:fo,registerUpload:ho,resetHistoryLoadedFlag:yo,setActiveEntryType:bo,setActiveService:mo,setBlockAutoEntrySwitch:vo,setEventsRead:go,setFeatureEnabledState:wo,setFeatures:Oo,setHeaderSubTitle:jo,setHeaderTitle:xo,setHistory:_o,setInitialState:Co,setIsLoading:So,setLoadedImageEventIds:Eo,setParticipant:Po,setSeamlyContainerElement:To,setServiceDataItem:ko,setServiceEntryMetadata:Ao,setUploadComplete:No,setUploadError:Io,setUploadProgress:Ro,setUserEntryType:Do,setUserSelectedOption:Mo,setUserSelectedOptions:Lo,showOption:Uo,stopIdleDetachCountdownCounter:Fo}=to.actions,Bo=to.reducer;const $o=Object.assign(Object.assign({},{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},hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showFaq:!1,showSuggestions:!0,customComponents:{},defaults:{visible:null},preChatEvents:[]}),zo=["hideOnNoUserResponse","connectWhenInView","showDisclaimer","showFaq","showSuggestions","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon"],Ho=(e,t)=>{const n=(i=t,zo.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:r}=n,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["messages"]);var i;let s=e;return Object.keys(o).length>0&&(s=Object.assign(Object.assign({},s),o)),r&&(s=Object.assign(Object.assign({},s),{messages:Object.assign(Object.assign({},s.messages),r)})),s},Vo=Vn({name:"config",initialState:$o,reducers:{setConfig:(e,{payload:t})=>Ho(e,t),updateConfig:(e,{payload:t})=>Ho(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(or.fulfilled,(e=>e)).addCase(rr.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o}))}}),{setConfig:qo,updateConfig:Wo,setPreChatEvents:Go}=Vo.actions,Ko=Vo.reducer;class Jo extends c{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const Xo={SeamlyGeneralError:u,SeamlyConfigurationError:l,SeamlySessionExpiredError:p,SeamlyOfflineError:Jo,SeamlyUnauthorizedError:d,SeamlyUnavailableError:tr},Qo=zn("catch-error",(e=>({payload:e})));function Yo({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:o,api:i,layoutMode:s}=yr(t()),{error:a,type:l}=n,u=Xo[null==a?void 0:a.name]?new Xo[a.name](a):new c(a);null==r||r(u,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:l?n:void 0})};return e=>t=>{var r,o,i,s,a,c;try{return(null===(o=null===(r=t.payload)||void 0===r?void 0:r.originalEvent)||void 0===o?void 0:o.payload)?n({error:t.payload,type:null===(a=null===(s=null===(i=t.payload)||void 0===i?void 0:i.originalEvent)||void 0===s?void 0:s.payload)||void 0===a?void 0:a.type}):(null===(c=t.payload)||void 0===c?void 0:c.originalError)&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}const Zo={controls:{}},ei={value:"",touched:!1},ti={controls:ei},ni=Vn({name:"forms",initialState:ti,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{var r;const o=t&&null!==(r=e[n])&&void 0!==r?r:Object.assign(Object.assign({},Zo),{persistData:t});e[n]=o},deregisterForm:(e,{payload:{formId:t}})=>{var n;return(null===(n=e[t])||void 0===n?void 0:n.persistData)||delete e[t],e},registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:ei}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o=Object.assign({},r.controls);return delete o[t],Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},r),{controls:o})})},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls)&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{var o;(null===(o=e[t])||void 0===o?void 0:o.controls[n])&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(Fr.pending,(()=>ti))}}),{registerForm:ri,deregisterForm:oi,registerControl:ii,deregisterControl:si,updateControlValue:ai,updateControlTouched:ci}=ni.actions,li=ni.reducer,ui=Vn({name:"app",initialState:{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,locale:void 0},reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(rr.fulfilled,((e,{payload:t})=>{e.initialLocale=t.locale})).addCase(ir.pending,(e=>{e.isLoading=!0})).addCase(ir.rejected,(e=>{e.isLoading=!1})).addCase(ir.fulfilled,((e,{payload:t})=>{e.isLoading=!1,(null==t?void 0:t.translations)&&(e.locale=t.locale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:t.translations[n]})),{}))}))}}),{setInitialLocale:pi,setTranslations:di}=ui.actions,fi=ui.reducer,hi=[u,l,p,Jo,d,tr];function yi({api:e}){return()=>t=>n=>{const{payload:r,type:o}=n;if(o===Gr.type){if(!hi.some((e=>r.name===e.name)))throw new u(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}function bi(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 mi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach((function(t){vi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gi({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case Lo.toString():e.store.set("options",n.payload);break;case Mo.toString():e.store.set("options",mi(mi({},e.store.get("options")||{}),{},{[n.payload.option]:n.payload.value}))}return r}}const wi=pr((({i18n:e})=>e),(({translations:e})=>e)),Oi=pr((({i18n:e})=>e),(({initialLocale:e})=>e)),ji=pr((({i18n:e})=>e),(({locale:e})=>e)),xi=pr((({i18n:e})=>e),(({isLoading:e})=>e)),_i={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:qn(),translatedEventGroups:{},translationProposal:null},Ci=(e,t)=>{const n=[...e].reduce(((e,{payload:n},r,o)=>{var i;if(e[t]){if("divider"===(null==n?void 0:n.type)&&(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.translationEnabled))return o.splice(0),e;e[t].push(n.id)}return n.id===t&&(e[t]=[]),e}),{}),[[r,o]]=Object.entries(n);return{lastGroupId:e.filter((e=>{var t;return"divider"===(null===(t=e.payload)||void 0===t?void 0:t.type)})).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},Si=Vn({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}=Ci(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:i}=Ci(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=i},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(rr.fulfilled,((e,{payload:t})=>{var n;const r=null===(n=null==t?void 0:t.features)||void 0===n?void 0:n.translation;r&&(e.isAvailable=!0===r.enabled,e.languages=r.languages)})).addCase(_o,((e,{payload:t})=>{e.translationProposal=t.translationProposal})).addCase(ro,((e,{payload:t})=>{e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)}))}}),{enableTranslation:Ei,disableTranslation:Pi,enableEventsTranslation:Ti,disableEventsTranslation:ki,setTranslationProposalPrompt:Ai,disableTranslationProposalPrompt:Ni}=Si.actions,Ii=Si.reducer;function Ri({dispatch:e,getState:t}){return n=>r=>{const o=n(r),{payload:i}=r;switch(r.type){case _o.type:i?.translation?.enabled&&(e(Ei(i.translation.locale)),e(ir(i.translation.locale)));break;case rr.fulfilled.type:i.locale&&e(ir(i.locale));break;case Co.type:i?.translation?.enabled&&(e(Ei(i.translation.locale)),e(ir(i.locale)));break;case ro.type:"info"===i.type&&"new_translation"===i?.payload?.body?.subtype&&i.payload.body.translationEnabled&&e(ir(i.payload.body.translationLocale));break;case Pi.type:const n=Oi(t());e(ir(n))}return o}}const Di=Vn({name:"visibility",initialState:{visibility:hr.initialize,showInlineView:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(Dr.fulfilled,((e,{payload:t})=>{t&&(e.visibility=t)})).addCase(rr.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:Mi}=Di.actions,Li=Di.reducer,Ui=He,Fi=()=>{const e=Ui(),t=De(Nr),n=!!t&&t!==hr.hidden,r=t===hr.open,o=t===hr.minimized,i=(0,_e.useCallback)((t=>e(Dr(t))),[e]);return{isVisible:n,isOpen:r,isMinimized:o,visible:t,setVisibility:i,openChat:()=>{i(hr.open)},closeChat:()=>{i(hr.minimized)}}},Bi=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,xe.createRef)()})=>{const[r,o]=(0,_e.useState)(null),i=!!(null==r?void 0:r.isIntersecting)||!t,s=i&&e,a=([e])=>o(e);return(0,_e.useEffect)((()=>{const e=null==n?void 0:n.current;if(!window.IntersectionObserver||s||!e||!t)return()=>{};const r=new IntersectionObserver(a,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,s]),{isVisible:i,containerRef:n}},$i=()=>{const e=He(),{connectWhenInView:t}=br(),n=De(Ir),{containerRef:r,isVisible:o}=Bi({enabled:t,freezeOnceVisible:!0});return(0,_e.useEffect)((()=>{o&&e(Mi())}),[e,o]),{containerRef:r,showInlineView:n}},zi=()=>(0,_e.useContext)(qe),Hi=()=>zi().store||{},Vi=()=>{const e=zi();return(0,_e.useCallback)((()=>e.hasConversation()),[e])};function qi(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 Wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qi(Object(n),!0).forEach((function(t){Gi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ki=()=>{const e=zi(),t=br(),n=He(),r=(0,_e.useContext)(We),o=Br(),i=Vi(),{visible:s,setVisibility:c}=Fi(),l=Cr(),u=(0,_e.useCallback)(((...e)=>{r.emit(...e)}),[r]),p=(0,_e.useCallback)((()=>{e.sendContext(t.context||{}),u("ui.beforeStart",{visibility:s,hasConversation:i(),hasResponded:o,unreadMessageCount:l}),e.send("start"),u("ui.start",{visibility:s,hasConversation:i(),hasResponded:o,unreadMessageCount:l})}),[e,t.context,u,i,o,l,s]),d=(0,_e.useCallback)((async()=>{n(Fr())}),[n]),f=(0,_e.useCallback)((e=>({type:e,id:_(),transactionId:_(),participant:a,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,_e.useCallback)((e=>Wi(Wi({},f("text")),{},{body:{text:e}})),[f]),y=(0,_e.useCallback)((({body:t,config:r={}})=>{if(""===t.trim())return;const o=Wi(Wi({},h(t)),r);e.send("message",o),u("message",o),n(ro({type:"message",payload:Wi(Wi({},o),{},{optimisticallyInjected:!0})}))}),[e,n,u,h]),b=(0,_e.useCallback)(((e,t=_())=>{n(ro({type:"message",payload:Wi(Wi({},h(e)),{},{transactionId:t})}))}),[n,h]),m=(0,_e.useCallback)(((e,t,r,o,i,s,c)=>{n(ro({type:"message",payload:{type:"upload",id:e,transactionId:t,participant:a,fromClient:!0,occurredAt:r,meta:{},body:{contentType:o,filename:i,filesize:s,url:c}}}))}),[n]),v=(0,_e.useCallback)(((e,t=_())=>{const r={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:_(),transactionId:t,type:"divider"};n(ro({type:"info",payload:r}))}),[n]),g=(0,_e.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==et&&n!==tt&&u(`action.${n}`,t)}),[e,u]),w=(0,_e.useCallback)((t=>{e.sendContext(t)}),[e]),O=(0,_e.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(n(Co(e)),e.userResponded&&(n(Hr(e.userResponded)),c(hr.open)))})).catch((e=>{n(Gr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,n,c]);return{connect:O,start:p,sendMessage:y,sendAction:g,sendContext:w,reset:d,emitEvent:u,addMessageBubble:b,addUploadBubble:m,addDivider:v,apiConnected:e.connected,apiConfigReady:e.configReady}};function Ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ji(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zi(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Zi(t):t)}),[])}function es(e){var t={};return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=r.length?r.map((function(e){return 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,i))return t[i];var s=e.apply(void 0,r);return t[i]=s,s}}function ts(e){for(var t=function(e){return/\s/.test(e)},n=[],r={},o=0,i=null,s=!1,a=0;a<e.length;){if(s&&(t(e[a])||"{"===e[a]))s=!1,i=e.slice(o,a),"{"===e[a]&&a--;else if(!s&&!t(e[a])){var c="{"===e[a];if(i&&c){var l=ns(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));r[i]=e.slice(a+1,l),a=l,i=null}else i&&(n.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&n.push(i),{args:n,cases:r}}function ns(e,t){for(var n=0,r=t+1;r<e.length;r++){var o=e.charAt(r);if("}"===o){if(0===n)return r;n--}else"{"===o&&n++}return-1}function rs(e){return os(e.slice(1,-1),",",3)}function os(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return r;if(1===n)return r.push(e),r;var o=e.indexOf(t);if(-1===o)return r.push(e),r;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return r.push(i),os(s,t,n-1,r)}var is;function ss(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 as(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ss(Object(n),!0).forEach((function(t){dn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ss(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var cs=0,ls="other";function us(e,t){for(var n=0,r="",o=0,i={};n<e.length;){if("#"!==e[n]||o)r+=e[n];else{var s="__hashToken".concat(cs++);r+="{".concat(s,", number}"),i[s]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:i}}var ps="other";const ds=new(function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Qi(this,e),dn(this,"format",es((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zi(n.process(e,t)).join("")}))),this.locale=t,this.typeHandlers=r}var t,n;return t=e,n=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var n=e.indexOf("{");if(-1!==n){var r=ns(e,n);if(-1===r)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var o=e.substring(n,r+1);if(o){var i=[],s=e.substring(0,n);s&&i.push(s);var a=rs(o),c=Xi(a,3),l=c[0],u=c[1],p=c[2],d=t[l];null==d&&(d="");var f=u&&this.typeHandlers[u];i.push(f?f(d,p,this.locale,t,this.process.bind(this)):d);var h=e.substring(r+1);return h&&i.push(this.process(h,t)),i}}return[e]}}],n&&Yi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}())("en-GB",{plural:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=ts(t),s=i.args,a=i.cases,c=parseInt(e);s.forEach((function(e){e.startsWith("offset:")&&(c-=parseInt(e.slice("offset:".length)))}));var l=[];if("PluralRules"in Intl){void 0!==is&&is.resolvedOptions().locale===n||(is=new Intl.PluralRules(n));var u=is.select(c);u!==ls&&l.push(u)}1===c&&l.push("one"),l.push("=".concat(c),ls);for(var p=0;p<l.length;p++){var d=l[p];if(d in a){var f=us(a[d],c),h=f.caseBody,y=f.numberValues;return o(h,as(as({},r),y))}}return e},select:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=ts(t),i=o.cases;return e in i?r(i[e],n):ps in i?r(i.other,n):e}});function fs(){const e=De(wi),t=De(ji),n=De(Oi),r=De(xi),o=(0,_e.useCallback)(((n,o={})=>{const i=e[n];return i?ds.format(i,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),null)}),[e,t,r]);return{t:o,locale:t,initialLocale:n}}const hs=(0,xe.createContext)(null),ys=()=>{const e=(0,_e.useContext)(hs);return{sendPolite:(0,_e.useCallback)((t=>{t&&e({ariaLive:lt,messageText:t})}),[e]),sendAssertive:(0,_e.useCallback)((t=>{t&&e({ariaLive:ct,messageText:t})}),[e])}},bs=()=>{const e=jr(),{t}=fs(),{isInline:n,isWindow:r,isApp:o}=kr(),{isOpen:i,isVisible:s}=Fi(),a=De(Ir),c=He(),l=(0,_e.useRef)(null),{start:u,connect:p,apiConfigReady:d,apiConnected:f}=Ki(),h=Vi(),y=(0,_e.useRef)(null),b=(0,_e.useRef)(null),m=(0,_e.useRef)(!1),{sendAssertive:v}=ys();(0,_e.useEffect)((()=>{s&&setTimeout((()=>{v(t("window.srTexts.onLoad"))}),500)}),[s,v,t]),(0,_e.useEffect)((()=>{if(s!==b.current)return y.current=i,void(b.current=s);null!==y.current&&v(t(i?"window.srTexts.onOpen":"window.srTexts.onClose")),y.current=i,b.current=s}),[i,s,v,t]),(0,_e.useEffect)((()=>(l.current=setTimeout((()=>{c(So(!0))}),500),()=>{clearTimeout(l.current)})),[c]),(0,_e.useEffect)((()=>(e.length&&(l.current=setTimeout((()=>{c(So(!1))}),5e3)),()=>{clearTimeout(l.current)})),[e,c]),(0,_e.useEffect)((()=>{d&&f||(m.current=!1)}),[d,f]);const g=(0,_e.useCallback)((async()=>{f||(m.current=!0,await p()),(o||i||s&&n)&&u()}),[f,p,o,n,i,s,u]);(0,_e.useEffect)((()=>{d&&!m.current&&(!r||i||h())&&(!n||s&&a)&&(h()&&i&&(clearTimeout(l.current),c(So(!1))),g())}),[d,g,c,h,n,i,r,s,a])},ms=({children:t})=>(bs(),(0,e.jsx)(e.Fragment,{children:t})),vs=(0,xe.createContext)({}),gs=()=>br().appContainerClassNames,ws=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},Os=(e=0)=>new Promise((t=>{setTimeout(t,e)})),js=e=>{requestAnimationFrame((async()=>{await Os(180);const t="string"==typeof e?document.getElementById(e):e;w(t)}))},xs=()=>{const{seamlyContainerElement:e}=gr(),t=He();return[e,(0,_e.useCallback)((e=>{t(To(e))}),[t])]},_s=e=>(0,_e.useCallback)((()=>{js(e)}),[e]),Cs=()=>{const e=Sr();return _s(e)},Ss=(0,xe.createContext)({});function Es(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 Ps(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Es(Object(n),!0).forEach((function(t){Ts(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Es(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ts(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ks=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=gr(),{allowedMimeTypes:o,maxSize:i}=n.upload||{},{enabled:s,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}=Ps(Ps(Ps({},t.upload||{allowedMimeTypes:[],maxSize:0}),o?{allowedMimeTypes:o}:{}),i?{maxSize:i}:{});return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},As=()=>{const{currentUploads:e}=gr(),t=He(),n=(0,_e.useContext)(Ss);return{uploadFile:(0,_e.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,_e.useCallback)((()=>{t(oo())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}};function Ns(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 Is(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ns(Object(n),!0).forEach((function(t){Rs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ns(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ds=()=>{const{t:e}=fs(),{options:t}=gr(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:i}=t,{cobrowsing:s,sendTranscript:a}=i,c={cobrowsing:s,sendTranscript:a},l=Object.keys(c).filter((e=>c[e])).map((t=>({name:t,title:e(`options.${t}.menuTitle`),available:c[t].enabled}))),u=s||a,p=He(),{get:d,set:f}=Hi();return{allowOptionSelection:u,userSelectedOptions:o,features:i,menuOptions:l,initUserSelectedOptions:(0,_e.useCallback)((()=>{const e=d("options")||{};p(Lo(e))}),[d,p]),setUserSelectedOptions:(0,_e.useCallback)((e=>{p(Lo(e)),f("options",e)}),[f,p]),setUserSelectedOption:(0,_e.useCallback)(((e,t)=>{const n=d("options")||{};f("options",Is(Is({},n),{},{[e]:t})),p(Mo({option:e,value:t}))}),[p,d,f]),showOption:e=>{p(Uo(e))},hideOption:()=>{p(uo())},panelActive:n,optionActive:r}},Ms=()=>{const{optionsButtonId:e}=gr();return{id:e,focusButton:_s(e)}},Ls=(0,xe.createContext)(null),Us=()=>(0,_e.useContext)(Ls);function Fs(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 Bs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fs(Object(n),!0).forEach((function(t){$s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const zs=()=>{const e=He(),{idleDetachCountdown:t}=gr(),{isOpen:n}=Fi(),r=(0,_e.useRef)({});r.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:n};const{emitEvent:o,sendAction:i}=Ki(),{t:s}=fs(),{sendAssertive:a,sendPolite:c}=ys(),l=(0,_e.useCallback)((e=>{const{isOpen:t}=r.current;t&&a(e)}),[a]),u=(0,_e.useCallback)((e=>{const{isOpen:t}=r.current;t&&c(e)}),[c]),p=(0,_e.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=y(n);e(po({delaySeconds:n,delayTime:r})),o("idleTimer.start"),l(`${s("idleDetachWarning.countdownTitle")} ${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",r)}`)}),[e,o,l,s]),d=(0,_e.useCallback)(((t,n)=>{const{hasCountdown:a,wasStopped:c}=r.current;a&&(t||(n||i({type:nt}),l(s("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e(ao()))}),[e,i,o,l,s]),f=(0,_e.useCallback)((()=>{const{remaining:t}=r.current;if(t<=0)return;const n=t-1;n%10==0&&l(`${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",y(n))}`),e(lo())}),[e,l,s]),h=(0,_e.useCallback)((()=>{const{isActive:t,remaining:n}=r.current;t&&(e(Fo()),n&&(o("idleTimer.stop"),u(s("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,u,s]);return Bs(Bs({},t),{},{initCountdown:p,endCountdown:d,decrementCountdown:f,stopCountdown:h})},Hs=()=>{const e=He(),t=gr().resumeConversationPrompt,{sendAction:n}=Ki(),{t:r}=fs(),{sendAssertive:o}=ys();return{continueChat:()=>{n({type:rt,body:{type:"resume_conversation_prompt"}}),e(co())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:nt}),e(co())}}},Vs=()=>{const[e]=(0,_e.useState)((()=>_()));return e},qs=e=>{const t=(0,_e.useRef)(null);t.current=e;const n="function"==typeof e;return(0,_e.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Ws=(e,t)=>{const n=zi();(0,_e.useEffect)((()=>{if(n.connectionInfo&&n.conversation?.channel){const{channel:r}=n.conversation;r.onMessage=(n,r)=>(t&&!t({type:n,payload:r})||e({type:n,payload:r}),r)}}),[e,t,n.connectionInfo,n.conversation])};function Gs(){const{sendAction:e}=Ki(),t=He(),n=(0,_e.useCallback)(((n,r="translation_choice")=>{e({type:it,body:{enabled:!0,locale:n,source:r}}),t(Ei(n)),t(Ni())}),[e,t]),r=(0,_e.useCallback)((()=>{e({type:it,body:{enabled:!1}}),t(Pi())}),[e,t]),{languages:o,isActive:i,isAvailable:s,currentLocale:a}=De((({translations:e})=>e));return{languages:o,isActive:i,isAvailable:s,currentLocale:a,enableTranslations:n,disableTranslations:r}}function Ks(e){const{translatedBody:t,body:n}=e.payload?"participant"===e.type?{body:null===(r=e.payload)||void 0===r?void 0:r.participant.introduction,translatedBody:null===(i=null===(o=e.payload)||void 0===o?void 0:o.participant)||void 0===i?void 0:i.translatedIntroduction}:{body:e.payload.body,translatedBody:e.payload.translatedBody}:{body:void 0,translatedBody:void 0};var r,o,i;const s=!!t,a=De((e=>pr((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>{var n;return!t.includes(null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.id)})))))(e));return{body:s&&a?null==t?void 0:t.data:n,hasTranslation:s,isTranslated:a&&s,locale:null==t?void 0:t.locale}}function Js(){const e=De((({translations:e})=>e.containerId));return{id:e,focusContainer:_s(e)}}function Xs(e){const{languages:t}=Gs();return(0,_e.useMemo)((()=>{var n;return null===(n=null==t?void 0:t.find((t=>t.locale===e)))||void 0===n?void 0:n.nativeName}),[e,t])}const Qs=(...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.length)).map((e=>e.indexOf(i)>-1?e:[i,e].join("-"))).join(" "),Ys=({eventPayload:t})=>{const{t:n}=fs(),{fromClient:r,participant:o}=t,i=(e=>gr().participantInfo.participants[e])(o)||{},{messages:s}=br(),a=r?n("participants.user.name"):i&&i.name,{showAvatar:c,showName:l}=s[r?"user":"agent"]||{};if(!c&&!l)return null;const u=[];return c&&a&&i.avatar&&u.push((0,e.jsx)("span",{className:Qs("message__avatar"),children:(0,e.jsx)("img",{src:i.avatar,className:Qs("avatar"),alt:""})})),l&&u.push((0,e.jsx)("span",{className:Qs("message__author-name"),children:a})),u.length>0&&(0,e.jsx)("div",{className:Qs("message__author"),children:u})},Zs=["showParticipant","event","type","modifiers","children","bodyProps","info"];function ea(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 ta(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ea(Object(n),!0).forEach((function(t){na(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ea(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ra=function(t){let{showParticipant:n=!0,event:r,type:o,modifiers:i,children:s,bodyProps:a={},info:c}=t,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Zs);const u=ws(r),{hasTranslation:p,isTranslated:d,locale:f}=Ks(r);return o&&u.push(`message--type-${o}`),i&&("string"==typeof i&&(i=i.split(" ").filter((e=>e.length))),i.forEach((e=>{u.push(`message--${e}`)}))),d&&u.push("message--is-translated"),p&&u.push("message--has-translation"),d&&(a=ta(ta({},a),{},{lang:f})),(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",ta(ta({className:Qs(u)},l),{},{children:[n&&(0,e.jsx)(Ys,{eventPayload:r.payload}),(0,e.jsx)("div",ta(ta({className:Qs("message__body")},a),{},{children:s})),c&&(0,e.jsx)("div",{"aria-hidden":"true",className:Qs("message__info"),children:c})]}))})};function oa(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 ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oa(Object(n),!0).forEach((function(t){sa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function sa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const aa=({id:t,action:n,buttonText:r,description:o,hasFocus:i,image:s,title:a,isCarouselItem:c})=>{const l=(0,_e.useRef)(null),{sendMessage:u,sendAction:p,emitEvent:d}=Ki(),f=Vs(),h=(0,_e.useRef)(),y=n.type===dt?"a":"button",b=(0,_e.useCallback)((()=>d("action.click_card",{type:st,originMessage:t,action:n})),[d,t,n]),m=(0,_e.useCallback)((()=>{if(b(),"ask"===n.type)u({body:n.ask});else if("topic"===n.type){const{topic:e,fallbackMessage:t}=n;p({type:ot,body:{name:e,fallbackMessage:t}})}}),[u,n,p,b]),v=(0,_e.useMemo)((()=>n.type===dt?{href:n.link,rel:"noopener noreferrer",target:n.newTab?"_blank":"_self",onClick:b}:{onClick:m}),[n,m,b]);return(0,_e.useEffect)((()=>{c&&(i&&h.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),h.current=!0}),[i,c]),(0,e.jsxs)("div",{className:Qs("card__wrapper"),id:t,tabIndex:"-1",ref:l,children:[(0,e.jsx)("img",{className:Qs("card__image"),src:s,alt:""}),(0,e.jsxs)("div",{className:Qs("card__content"),id:t,children:[a&&(0,e.jsx)("h2",{className:Qs("card__title"),children:a}),o&&(0,e.jsx)("div",{className:Qs("card__description"),dangerouslySetInnerHTML:{__html:o}}),(0,e.jsx)(y,ia(ia({tabIndex:c&&!i?"-1":void 0,className:Qs("button","button--primary"),"aria-describedby":f},v),{},{children:r}))]})]})};function ca(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 la(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ca(Object(n),!0).forEach((function(t){ua(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ca(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pa(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 da(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pa(Object(n),!0).forEach((function(t){fa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ha({item:t,items:n,index:r,isActive:o}){const{t:i}=fs();return(0,e.jsx)("div",{className:Qs("carousel-item",`carousel-item--${t.type}`),role:"group","aria-roledescription":"slide","aria-label":i("carousel.slide.label",{index:r+1,total:n.length}),children:(0,e.jsx)(aa,da(da({},t),{},{isCarouselItem:!0,hasFocus:o}))})}const ya={send32:'<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>',balloon32:'<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>',newTopic32:'<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>',newTranslation16:'<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>',newTranslation32:'<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>',avatar32:'<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',chevronDown8:'<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>',chevronDown32:'<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>',chevronRight8:'<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>',chevronRight16:'<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>',close8:'<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>',close16:'<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>',enlarge32:'<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>',options32:'<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>',file32:'<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>',upload32:'<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>',download16:'<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>',error16:'<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>',arrowLeft16:'<?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',arrowRight16:'<?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',check32:'<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',check16:'<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'},ba=({name:t,size:n="32",className:r,alt:o})=>{const i=`${t}${n}`;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{"aria-hidden":"true",className:r||Qs("icon"),dangerouslySetInnerHTML:{__html:ya[i]}}),o&&(0,e.jsx)("span",{className:Qs("visually-hidden"),children:o})]})};function ma({items:t,currentIndex:n,onChange:r,children:o}){const{t:i}=fs(),s=t.length;return(0,e.jsxs)("div",{className:Qs("carousel-controls"),children:[(0,e.jsx)("button",{className:Qs("button","button--previous"),"aria-label":i("carousel.controls.previous"),onClick:()=>{r((n-1+s)%s)},children:(0,e.jsx)(ba,{name:"arrowLeft",size:"16"})}),o,(0,e.jsx)("button",{className:Qs("button","button--next"),"aria-label":i("carousel.controls.next"),onClick:()=>{r((n+1)%s)},children:(0,e.jsx)(ba,{name:"arrowRight",size:"16"})})]})}function va({items:t,currentIndex:n,onChange:r,getItemKey:o,getItemLabel:i}){const s=t.length,a=(0,_e.useCallback)((e=>{const t=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,t));o!==n&&r(o)}),[s,n,r]);return(0,e.jsx)("div",{className:Qs("carousel-pagination__wrapper"),role:"group",children:(0,e.jsx)("ul",{className:Qs("carousel-pagination"),children:t.map(((t,r)=>{const s=n===r;return(0,e.jsx)("li",{className:Qs("carousel-pagination__item",s?"is-active":void 0),children:(0,e.jsx)("button",{className:Qs("carousel-pagination__button"),type:"button",onClick:a,"data-item":r,"aria-disabled":s?"true":void 0,"aria-label":i(t,r)})},o(t,r,"pagination-item-"))}))})})}const ga=(e,t,n)=>`${n}${t}`,wa=e=>e.label,Oa=({target:e})=>{e.scrollLeft=0};function ja({currentIndex:t,onChange:n,getItemKey:r=ga,getItemLabel:o=wa,items:i}){const s=Vs(),a=i.length,[c,l]=(0,_e.useState)(Number(t||"0"));(0,_e.useEffect)((()=>{l(Number(t||"0"))}),[l,t]);const u=(0,_e.useRef)([]);u.current=(0,_e.useMemo)((()=>Array(a).fill(1).map((()=>(0,xe.createRef)()))),[a]);const p=(0,_e.useRef)(!0),d=(0,_e.useRef)();return d.current=n,(0,_e.useEffect)((()=>{p.current?p.current=!1:d.current&&d.current(c)}),[c]),(0,e.jsxs)("div",{className:Qs("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,e.jsx)("div",{className:Qs("carousel__slides-wrapper"),onScroll:Oa,children:(0,e.jsx)("div",{id:s,className:Qs("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:i.map(((t,n)=>{const o=c===n;return(0,e.jsx)("div",{ref:u.current[n],className:Qs("carousel__slide",o?"is-active":void 0),"aria-hidden":o?void 0:"true",children:(0,e.jsx)(ha,{item:t,items:i,currentIndex:c,index:n,isActive:o})},r(t,n,"item-"))}))})}),(0,e.jsx)("div",{className:Qs("carousel__controls"),children:(0,e.jsx)(ma,{currentIndex:c,items:i,onChange:l,controlId:s,children:(0,e.jsx)("div",{className:Qs("carousel__pagination"),children:(0,e.jsx)(va,{currentIndex:c,items:i,onChange:l,getItemKey:r,getItemLabel:o})})})})]})}const xa=(e,t,n="")=>`${n}${e.title}:${t}`,_a=e=>e.title,Ca=["event","children"];function Sa(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 Ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sa(Object(n),!0).forEach((function(t){Pa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ta=e=>{const{payload:t}=e,[n,r]=(0,_e.useState)(!1),{sendAction:o,addMessageBubble:i,addDivider:s}=Ki(),{activeServiceSessionId:a}=gr().serviceInfo,c=De(Er),{body:l}=Ks(e),{service:u}=t,p=(0,_e.useMemo)((()=>Ea(Ea({},e),{},{payload:Ea(Ea({},e.payload),{},{body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&Ea(Ea({},e.payload.translatedBody),{},{data:e.payload.translatedBody.data.prompt})})})),[e]),d=l.chooseAgain&&a===u.serviceSessionId&&t.id!==c;return(0,_e.useEffect)((()=>{r(t.id===c)}),[t,c]),{body:l,subEvent:p,showOptions:n,chooseAgain:d,onChoiceClickHandler:e=>{const n=_();d&&s("new_topic",n),i(e.text,n),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:d},transactionId:n}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}},ka=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Aa=({id:t,categories:n=[],question:r,onClick:o,hasIcon:i})=>{const s=(0,_e.useMemo)((()=>["suggestions__item",...n.map(ka)]),[n]),a=(0,_e.useCallback)((()=>{o&&o({id:t,question:r})}),[t,r,o]);return(0,e.jsx)("li",{className:Qs(s),children:(0,e.jsxs)("button",{type:"button",onClick:a,className:Qs("button","button--primary"),children:[i&&(0,e.jsx)(ba,{name:"chevronRight",size:"8"}),r]})})};function Na(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 Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ra=({className:t,suggestions:n=[],onClickSuggestion:r,hasIcon:o=!0})=>(0,e.jsx)("ul",{className:Qs("suggestions__list",t),children:n.map((t=>(0,e.jsx)(Aa,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Na(Object(n),!0).forEach((function(t){Ia(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Na(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({hasIcon:o,onClick:r},t),t.id)))}),Da=["event"];function Ma(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 La(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ma(Object(n),!0).forEach((function(t){Ua(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ma(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fa=e=>{const{sendAction:t}=Ki();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}};function Ba(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 $a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ba(Object(n),!0).forEach((function(t){za(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ba(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function za(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ha({children:t,childrenHTML:n,className:r,graphicSrc:o,graphicType:i="icon",iconName:s,iconSize:a,iconClassName:c,dividerType:l}){const u=Boolean(s||o),p=n?{dangerouslySetInnerHTML:{__html:n}}:{children:t};return(0,e.jsxs)("div",{className:Qs("divider",l&&`divider--type-${l}`,r),children:[u&&(0,e.jsx)("span",{className:Qs("divider__graphic"),children:s?(0,e.jsx)(ba,{name:s,size:a,className:c}):(0,e.jsx)("img",{src:o,className:Qs({icon:"icon"===i,avatar:"avatar"===i},c)})}),(0,e.jsx)("div",$a({className:Qs("divider__body")},p))]})}const Va={[ut.new_topic]:"newtopic"},qa=["event"];function Wa(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 Ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ka={default:({event:t})=>{const{t:n}=fs(),{subtype:r}=t.payload.body,o=Va[ut[r]];return(0,e.jsx)(Ha,{dividerType:o,iconName:ut[r],children:(0,e.jsx)("p",{children:n(`dividerKeys.${ut[r]}`)})})},[ut.new_translation]:({event:t})=>{const{t:n}=fs(),r=jr(),{body:{restartButtonText:o,translationEnabled:i,translationLocale:s,text:a,title:c},id:l}=t.payload,{enableTranslations:u}=Gs(),p=De((e=>e.translations.translatedEventGroups)),d=He(),f=(0,_e.useCallback)((()=>{p[l]?d(Ti({events:r,id:l})):d(ki({events:r,id:l}))}),[d,r,l,p]);return(0,e.jsxs)(Ha,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,e.jsx)("p",{className:Qs("divider__title"),children:c}),a&&(0,e.jsx)("p",{children:a}),i?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:Qs("button","button--secondary"),onClick:f,children:n(p[l]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):(0,e.jsx)("button",{className:Qs("button","button--secondary"),"data-testid":"restartTranslationButton",onClick:()=>{u(s)},children:o})]})}},Ja={month:"long",day:"numeric",year:"numeric"},Xa={hour:"numeric",minute:"numeric"},Qa=({event:t})=>{const n=(()=>{const[e,t]=(0,_e.useReducer)((e=>e+1),0);return(0,_e.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:o,timeUntilMidnight:i,srText:s}=(e=>{const{t}=fs(),n=br()?.context?.locale??[],r=new Date(e),o=new Date,i=new Date(o);i.setHours(24,0,0,0);const s=i-o,a=r.toString(),c=new Intl.DateTimeFormat(n,Xa).format(r);let l=((e,t)=>{const n=new Date(t).setHours(0,0,0,0),r=e.getTime(),o=864e5;return r>=n+o?e:r>n?"today":r>n-o?"yesterday":e})(r,o);switch(l){case"today":l=t("dateTime.today");break;case"yesterday":l=t("dateTime.yesterday");break;default:l=new Intl.DateTimeFormat(n,Ja).format(r)}return{date:l,srText:t("dateTime.srText",{date:l,time:c}),time:c,fullDateTime:a,timeUntilMidnight:s}})(h(t.timeIndicator));return(0,_e.useEffect)((()=>{const e=setTimeout((()=>{n()}),i);return()=>{clearTimeout(e)}}),[n,i]),(0,e.jsxs)(Ha,{dividerType:"time-indicator",children:[(0,e.jsxs)("p",{className:Qs("divider__time"),"aria-hidden":"true",children:[(0,e.jsx)("span",{children:r}),(0,e.jsx)("span",{children:o})]}),(0,e.jsx)("p",{className:Qs("visually-hidden"),children:s})]})};var Ya=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],Za=Ya.join(","),ec="undefined"==typeof Element,tc=ec?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,nc=!ec&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},rc=function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(Za));return t&&tc.call(e,Za)&&r.unshift(e),r.filter(n)},oc=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if("SLOT"===s.tagName){var a=s.assignedElements(),c=e(a.length?a:s.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{tc.call(s,Za)&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var l=s.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(s),u=!r.shadowRootFilter||r.shadowRootFilter(s);if(l&&u){var p=e(!0===l?s.children:l.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return o},ic=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},sc=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ac=function(e){return"INPUT"===e.tagName},cc=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},lc=function(e,t){return!(t.disabled||function(e){return ac(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=tc.call(e,"details>summary:first-of-type")?e.parentElement:e;if(tc.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return cc(e)}else{if("function"==typeof r){for(var i=e;e;){var s=e.parentElement,a=nc(e);if(s&&!s.shadowRoot&&!0===r(s))return cc(e);e=e.assignedSlot?e.assignedSlot:s||a===e.ownerDocument?s:a.host}e=i}if(function(e){for(var t,n=nc(e).host,r=!!(null!==(t=n)&&void 0!==t&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!r&&n;){var o;r=!(null===(o=n=nc(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(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!!tc.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},uc=function(e,t){return!(function(e){return function(e){return ac(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||nc(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 o=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!o||o===e}(e)}(t)||ic(t)<0||!lc(e,t))},pc=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},dc=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,s=i?t.scopeParent:t,a=ic(s,i),c=i?e(t.candidates):s;0===a?i?n.push.apply(n,c):n.push(s):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:c})})),r.sort(sc).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},fc=function(e,t){var n;return n=(t=t||{}).getShadowRoot?oc([e],t.includeContainer,{filter:uc.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:pc}):rc(e,t.includeContainer,uc.bind(null,t)),dc(n)},hc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==tc.call(e,Za)&&uc(t,e)},yc=Ya.concat("iframe").join(","),bc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==tc.call(e,yc)&&lc(t,e)};function mc(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 vc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mc(Object(n),!0).forEach((function(t){gc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wc=[],Oc=function(e){return setTimeout(e,0)},jc=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},xc=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},_c=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target};function Cc(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 Sc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach((function(t){Ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Pc=({children:e,onClose:t,"aria-label":n,"aria-labelledby":r,fallBackFocusRef:o})=>{const i=Vs(),s=(0,_e.useRef)(null),a=(0,_e.useRef)(null),[c,l]=(0,_e.useState)(!1);return(0,_e.useEffect)((()=>{return c&&(a.current=(e=s.current,t={initialFocus:o&&o.current?o.current:null},r=(null==t?void 0:t.document)||document,i=(null==t?void 0:t.trapStack)||wc,l=vc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),u={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},p=function(e,t,n){return e&&void 0!==e[t]?e[t]:l[n||t]},d=function(e){return u.containerGroups.findIndex((function(t){var n=t.container,r=t.tabbableNodes;return n.contains(e)||r.find((function(t){return t===e}))}))},f=function(e){var t=l[e];if("function"==typeof t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];t=t.apply(void 0,o)}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},h=function(){var e=f("initialFocus");if(!1===e)return!1;if(void 0===e)if(d(r.activeElement)>=0)e=r.activeElement;else{var t=u.tabbableGroups[0];e=t&&t.firstTabbableNode||f("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},y=function(){if(u.containerGroups=u.containers.map((function(e){var t=fc(e,l.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?oc([e],t.includeContainer,{filter:lc.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):rc(e,t.includeContainer,lc.bind(null,t))}(e,l.tabbableOptions);return{container:e,tabbableNodes:t,focusableNodes:n,firstTabbableNode:t.length>0?t[0]:null,lastTabbableNode:t.length>0?t[t.length-1]:null,nextTabbableNode:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=n.findIndex((function(t){return t===e}));if(!(r<0))return t?n.slice(r+1).find((function(e){return hc(e,l.tabbableOptions)})):n.slice(0,r).reverse().find((function(e){return hc(e,l.tabbableOptions)}))}}})),u.tabbableGroups=u.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),u.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},b=function e(t){!1!==t&&t!==r.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!l.preventScroll}),u.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(h()))},m=function(e){var t=f("setReturnFocus",e);return t||!1!==t&&e},v=function(e){var t=_c(e);d(t)>=0||(xc(l.clickOutsideDeactivates,e)?n.deactivate({returnFocus:l.returnFocusOnDeactivate&&!bc(t,l.tabbableOptions)}):xc(l.allowOutsideClick,e)||e.preventDefault())},g=function(e){var t=_c(e),n=d(t)>=0;n||t instanceof Document?n&&(u.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),b(u.mostRecentlyFocusedNode||h()))},w=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==xc(l.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=_c(e);y();var n=null;if(u.tabbableGroups.length>0){var r=d(t),o=r>=0?u.containerGroups[r]:void 0;if(r<0)n=e.shiftKey?u.tabbableGroups[u.tabbableGroups.length-1].lastTabbableNode:u.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var i=jc(u.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(i<0&&(o.container===t||bc(t,l.tabbableOptions)&&!hc(t,l.tabbableOptions)&&!o.nextTabbableNode(t,!1))&&(i=r),i>=0){var s=0===i?u.tabbableGroups.length-1:i-1;n=u.tabbableGroups[s].lastTabbableNode}}else{var a=jc(u.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(a<0&&(o.container===t||bc(t,l.tabbableOptions)&&!hc(t,l.tabbableOptions)&&!o.nextTabbableNode(t))&&(a=r),a>=0){var c=a===u.tabbableGroups.length-1?0:a+1;n=u.tabbableGroups[c].firstTabbableNode}}}else n=f("fallbackFocus");n&&(e.preventDefault(),b(n))}(e)},O=function(e){var t=_c(e);d(t)>=0||xc(l.clickOutsideDeactivates,e)||xc(l.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},j=function(){if(u.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),u.delayInitialFocusTimer=l.delayInitialFocus?Oc((function(){b(h())})):b(h()),r.addEventListener("focusin",g,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",O,{capture:!0,passive:!1}),r.addEventListener("keydown",w,{capture:!0,passive:!1}),n},x=function(){if(u.active)return r.removeEventListener("focusin",g,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",O,!0),r.removeEventListener("keydown",w,!0),n},n={get active(){return u.active},get paused(){return u.paused},activate:function(e){if(u.active)return this;var t=p(e,"onActivate"),n=p(e,"onPostActivate"),o=p(e,"checkCanFocusTrap");o||y(),u.active=!0,u.paused=!1,u.nodeFocusedBeforeActivation=r.activeElement,t&&t();var i=function(){o&&y(),j(),n&&n()};return o?(o(u.containers.concat()).then(i,i),this):(i(),this)},deactivate:function(e){if(!u.active)return this;var t=vc({onDeactivate:l.onDeactivate,onPostDeactivate:l.onPostDeactivate,checkCanReturnFocus:l.checkCanReturnFocus},e);clearTimeout(u.delayInitialFocusTimer),u.delayInitialFocusTimer=void 0,x(),u.active=!1,u.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=p(t,"onDeactivate"),o=p(t,"onPostDeactivate"),s=p(t,"checkCanReturnFocus"),a=p(t,"returnFocus","returnFocusOnDeactivate");r&&r();var c=function(){Oc((function(){a&&b(m(u.nodeFocusedBeforeActivation)),o&&o()}))};return a&&s?(s(m(u.nodeFocusedBeforeActivation)).then(c,c),this):(c(),this)},pause:function(){return u.paused||!u.active||(u.paused=!0,x()),this},unpause:function(){return u.paused&&u.active?(u.paused=!1,y(),j(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return u.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),u.active&&y(),this}},n.updateContainerElements(e),n),a.current.activate()),()=>{a.current&&a.current.deactivate()};var e,t,n,r,i,l,u,p,d,f,h,y,b,m,v,g,w,O,j,x}),[c,o]),(0,_e.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||(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()}}),[c]),(0,_e.useEffect)((()=>{c&&s.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[c,t]),(0,_e.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",i),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),r&&t.setAttribute("aria-labelledby",r),e.appendChild(t),s.current=t,l(!0),()=>{s.current&&(e.removeChild(s.current),s.current=null)}}),[n,r,i]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>s.current&&(0,xe.render)(e,s.current)}):s.current&&(0,xe.render)((0,xe.toChildArray)(e).map((e=>(e.props=Sc(Sc({},e.props),{},{onClose:t}),e))),s.current)},Tc=({url:t,description:n,onClose:r})=>{const{zIndex:o,layoutMode:i,namespace:s}=br(),a=Us(),c=gs(),l=(0,_e.useRef)(null),{t:u}=fs(),p=["modal",`app--layout-${i}`,`namespace--${s}`,...c],d=e=>{e.stopPropagation()},f=()=>{r()},h=o?{zIndex:o+1}:void 0;return(0,e.jsx)(Pc,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:r,modalRenderFn:o})=>o((r=>(0,e.jsx)("div",{className:Qs(p),onClick:f,style:h,children:(0,e.jsxs)("div",{className:Qs("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,e.jsx)("div",{className:Qs("modal__inner"),onClick:d,children:(0,e.jsx)("img",{className:Qs("modal__image"),src:t,alt:n})}),(0,e.jsxs)("button",{type:"button",className:Qs("modal__close"),onClick:r,children:[(0,e.jsx)(ba,{name:"close",size:"16"}),u("lightbox.closeLabel")]})]})}))(r))})},kc=({description:t,url:n})=>{const{t:r}=fs(),[o,i]=(0,_e.useState)(!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:Qs("modal__enlarge"),onClick:()=>{i(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:t}),(0,e.jsx)(ba,{name:"enlarge",size:"32"})]}),o&&(0,e.jsx)(Tc,{url:n,description:t,onClose:()=>{i(!1)}})]})},Ac=["event","descriptorId"];function Nc(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 Ic(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nc(Object(n),!0).forEach((function(t){Rc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dc=["event"];function Mc(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 Lc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mc(Object(n),!0).forEach((function(t){Uc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fc=["event"];function Bc(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 $c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bc(Object(n),!0).forEach((function(t){zc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hc=t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Fc);const{body:o}=Ks(n),i=Fa(n.payload.id),s=(0,_e.useMemo)((()=>n.payload.optimisticallyInjected?{children:(0,e.jsx)("p",{children:o.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:o.text}}}),[o,n]);return(0,e.jsx)(ra,$c($c({type:"text",event:n,onClick:i},r),s))},Vc=["event"];function qc(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 Wc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qc(Object(n),!0).forEach((function(t){Gc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Kc=["event"];function Jc(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 Xc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jc(Object(n),!0).forEach((function(t){Qc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Yc=({children:t,url:n,target:r})=>n?(0,e.jsx)("a",{href:n,download:!0,target:r||void 0,className:Qs(["download","download-link"]),children:t}):(0,e.jsx)("span",{className:Qs("download"),children:t}),Zc=["event","descriptorId"];function el(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 tl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?el(Object(n),!0).forEach((function(t){nl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rl(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 ol(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rl(Object(n),!0).forEach((function(t){il(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function il(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sl={message:{choice_prompt:t=>{let{event:n,children:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ca);const{t:i}=fs(),s=Vs(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:p,onChooseAgainClickHandler:d}=Ta(n);return(0,e.jsxs)(e.Fragment,{children:[(0,xe.toChildArray)(r).map((e=>(e.props=Ea(Ea({},e.props),{},{event:c,descriptorId:s,showTranslationToggle:!1}),e))),u&&(0,e.jsxs)("button",{type:"button",className:Qs("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:d,"aria-describedby":s,children:[i(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,e.jsx)(ba,{name:"chevronDown",size:"8"})]}),l&&(0,e.jsx)(ra,Ea(Ea({type:"choice-prompt",showParticipant:!1,event:n},o),{},{children:(0,e.jsx)("ul",{className:Qs("choice-prompt","choice-prompt--many"),children:a.choices.map((t=>(0,e.jsx)("li",{className:Qs("choice-prompt__item",{[`choice-prompt__item--${t.category}`]:t.category}),children:(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{p(t)},children:t.text})},t.id)))})}))]})},text:Hc,image:t=>{let{event:n,descriptorId:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ac);const{body:i}=Ks(n),{description:s,url:a,isZoomable:c}=i,[l,u]=(0,_e.useState)(!1),p=He();return(0,e.jsxs)(ra,Ic(Ic({event:n,type:"image"},o),{},{children:[(0,e.jsx)("img",{src:a,id:r,alt:s,onLoad:()=>{p(Eo(n.payload.id)),u(!0)}}),c&&l&&(0,e.jsx)(kc,{description:s,url:a})]}))},splash:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Dc);const{payload:o}=n,{body:i}=Ks(n),s=Fa(o.id);return(0,e.jsx)(ra,Lc(Lc({type:"splash",event:n,onClick:s},r),{},{bodyProps:{dangerouslySetInnerHTML:{__html:i.text}}}))},video:t=>{let{event:n,descriptorId:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Zc);const{body:i}=Ks(n),{description:s,url:a}=i;return ws(n).push("message--type-video"),(0,e.jsxs)(ra,tl(tl({event:n,type:"video"},o),{},{children:[(0,e.jsx)("div",{id:r,className:Qs("visually-hidden"),children:s}),(0,e.jsx)("iframe",{title:s,src:a,allow:"autoplay; encrypted-media",allowFullScreen:!0})]}))},upload:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Kc);const{t:o}=fs(),{body:i}=Ks(n),{fromClient:s}=n.payload,{filename:a,url:c}=i,l=(0,_e.useMemo)((()=>o(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,o]);return(0,e.jsx)(ra,Xc(Xc({event:n,type:"upload"},r),{},{children:(0,e.jsxs)(Yc,{url:c,target:s?void 0:"_blank",children:[(0,e.jsx)(ba,{name:"download",size:"16"}),(0,e.jsx)("span",{"aria-hidden":"true",className:Qs("file-download"),children:a}),(0,e.jsx)("span",{className:Qs("visually-hidden"),children:l})]})}))},cta:({event:t})=>{const{body:n}=Ks(t),r=Fa(t.payload.id),{emitEvent:o}=Ki(),i=Vs(),s=(0,_e.useCallback)((()=>o("action.click_cta",{type:st,originMessage:t.payload.id,link:{url:n.buttonLink}})),[o,n,t]);return(0,e.jsxs)(ra,{type:"cta",event:t,children:[(0,e.jsx)("div",{className:Qs("cta__content"),id:i,dangerouslySetInnerHTML:{__html:n.description},onClick:r}),(0,e.jsx)("a",{className:Qs("button","button--primary"),"aria-describedby":i,href:n.buttonLink,rel:"noreferrer",target:n.buttonNewTab?"_blank":"_self",onClick:s,children:n.buttonText})]})},carousel:({event:t})=>{const{body:n}=Ks(t),r=n.cards;return(0,e.jsx)(ra,{event:t,modifiers:"type-carousel",children:(0,e.jsx)(ja,{items:r,ItemComponent:ha,getItemKey:xa,getItemLabel:_a})})},card:({event:t})=>{const{body:n}=Ks(t),r=Vs();return(0,e.jsx)(ra,{type:"card",event:t,children:(0,e.jsx)(aa,la({id:r},n))})}},info:{text:Hc,divider:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,qa);const o=Ka[ut[n.payload.body.subtype]]||Ka.default;return(0,e.jsx)(o,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wa(Object(n),!0).forEach((function(t){Ga(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({event:n},r))},translation:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Vc);const{t:o}=fs(),{body:i}=Ks(n);return(0,e.jsx)(ra,Wc(Wc({type:"text",event:n},r),{},{children:o(i.key.join("."),i.variables)}))},timeIndicator:Qa},participant:{participant:({event:t})=>{const{participant:n}=t.payload,{body:r}=Ks(t);return r?(0,e.jsx)(Ha,{graphicSrc:n.avatar,graphicType:n.avatar?"avatar":void 0,iconName:n.avatar?void 0:"balloon",childrenHTML:r,dividerType:"participant"}):null}},service_data:{suggestion:t=>{let{event:n}=t,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Da);const[o,i]=(0,_e.useState)(!0),s=He(),a=Br(),{sendAction:c,addMessageBubble:l}=Ki(),{suggestions:u,payload:p}=(e=>{const{payload:t}=e,{body:n}=Ks(e);return{suggestions:n,payload:t}})(n),{showSuggestions:d}=br(),f=jr(),{t:h}=fs(),y=h("suggestions.headingText"),b=h("suggestions.footerText"),m=(0,_e.useMemo)((()=>f.some((({payload:e})=>e?.transactionLast))),[f]),v=(0,_e.useCallback)((({id:e,question:t})=>{i(!1),s(Hr(!0)),c({type:Ze,originMessage:p.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),l(t)}),[s,c,p.id,l]);return o&&!a&&m&&d?(0,e.jsxs)("div",{className:Qs("suggestions","suggestions--conversation"),children:[y&&(0,e.jsx)("p",{className:Qs("suggestions__heading"),children:y}),(0,e.jsxs)(ra,La(La({type:"suggestions",showParticipant:!1,event:n},r),{},{children:[(0,e.jsx)(Ra,{className:"suggestions__list--conversation",onClickSuggestion:v,suggestions:u}),b&&(0,e.jsx)("p",{className:Qs("suggestions__footer"),children:b})]}))]}):null}}},al=({children:t})=>{const{customComponents:n}=br(),r=(0,_e.useMemo)((()=>Object.keys(sl).reduce(((e,t)=>ol(ol({},e),{},{[t]:ol(ol({},sl[t]),n?n[t]:{})})),{fallback:Hc})),[n]);return(0,e.jsx)(vs.Provider,{value:r,children:t})},cl=({children:t})=>{const{isMinimized:n}=Fi(),r=(0,_e.useRef)(0),{sendAction:o}=Ki(),{hasCountdown:i,isActive:s,stopCountdown:a}=zs(),c=(0,_e.useCallback)((()=>{if(n)return;const e=(new Date).getTime(),t=()=>{o({type:"interactivity_update"}),r.current=e};i&&s&&(t(),a()),e-r.current>15e3&&t()}),[o,i,s,a,n]);return(0,e.jsx)("div",Object.assign({className:Qs("activity-monitor"),tabIndex:-1,onMouseDown:c,onKeyUp:c,onTouchStart:c,onMouseMove:c,onWheel:c,onPointerDown:c,onPointerMove:c},{children:(0,e.jsx)(Ls.Provider,Object.assign({value:c},{children:t}))}))};const ll=["text","choice_prompt","image","video"],ul=()=>{const e=zi(),t=He(),n=jr(),r=(0,_e.useContext)(We),o=(0,_e.useRef)(null),{initCountdown:i,endCountdown:s}=zs(),{emitEvent:a}=Ki();return(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.socket){const{socket:n}=e.conversation;n.onError((e=>{const n=new Jo(e);t(Gr({name:n.name,message:n.message,langKey:n.langKey,originalEvent:n.originalEvent,originalError:n.originalError})),t(io())})),n.onOpen((()=>{t(Kr())}))}}),[e,e.connectionInfo,e.conversation.socket,t]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:t}=e.conversation;return()=>{null==t||t.leave()}}return()=>{}}),[e,e.connectionInfo,e.conversation]),(0,_e.useEffect)((()=>{e.conversation.onConnection((e=>{if("join_channel_erred"===e){const e=new u;t(Gr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action}))}}))}),[e.conversation,t]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:n}=e.conversation,o=e=>{const{payload:n}=e;if(!n||!n.participant)return;const{fromClient:r,participant:o}=n;!r&&"string"!=typeof o&&(null==o?void 0:o.name)&&t(jo(o.name)),t(Po({participant:o,fromClient:r})),"string"!=typeof o&&o.introduction&&t(ro(Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},n),{type:"participant"})})))};n.onMessage=(e,n)=>{const c={type:e,payload:n};switch(e){case"ui":switch(n.state&&n.state.hasOwnProperty("loading")&&t(So(n.state.loading)),n.type){case"idle_detach_countdown":i(n.body.duration);break;case"idle_detach_countdown_elapsed":s(void 0,!0);break;case"resume_conversation_prompt":t(fo());break;case"translation_proposal":t(Ai(n.body));break;case"user_first_response":t(Hr(!0)),r.emit("system.userFirstResponse",n.body)}break;case"message":switch(o(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&&t(mo(n.service.serviceSessionId)),t(ro(c))}break;case"participant":o(c);break;case"service_data":n.persist&&t(ko(n));break;case"ack":t(no(c));break;case"system":if("service_changed"===n.type){const{serviceSettings:e}=n,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["serviceSettings"]),{entry:o}=e,{upload:i}=o.options;t(wo({key:pt,enabled:!(!i||!i.enabled)})),t(Ao(o)),n.serviceSessionId&&t(mo(n.serviceSessionId)),a("system.serviceChanged",r)}break;case"info":"divider"!==n.type&&"text"!==n.type&&"translation"!==n.type||t(ro(c));break;case"error":switch(n.type){case"find_conversation_erred":const e=new p(c);t(Gr({name:e.name,action:e.action,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError}));break;case"conversation_erred":const n=new u(c);t(Gr({name:n.name,message:n.message,langKey:n.langKey,originalEvent:n.originalEvent,originalError:n.originalError,action:n.action}))}}return n}}}),[e,e.connectionInfo,e.conversation.channel,t,a,s,r,i]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:t}=e.conversation;t.on("message",(e=>ll.includes(e.type)?(e.id!==o.current&&r.emit("message",e),o.current=e.id,e):e))}}),[e,e.connectionInfo,e.conversation.channel,r]),(0,_e.useEffect)((()=>{if(e.connectionInfo&&e.conversation.channel){const{channel:r}=e.conversation,o=r.on("sync",(r=>{var o;const i=n[n.length-1],s=null===(o=null==r?void 0:r.lastEvent)||void 0===o?void 0:o.id;return i&&s===i.payload.id?r:e.getConversation().then((e=>{e&&t(_o(e))})).catch((e=>{t(Gr({name:null==e?void 0:e.name,message:null==e?void 0:e.message,langKey:null==e?void 0:e.langKey,action:null==e?void 0:e.action,originalEvent:null==e?void 0:e.originalEvent,originalError:null==e?void 0:e.originalError}))}))}));return()=>{r.off("sync",o)}}return()=>{}}),[e,e.connectionInfo,e.conversation.channel,n,t]),null},pl=({children:t})=>{const{t:n}=fs(),r=He(),o=zi(),{addUploadBubble:i}=Ki();return(0,e.jsx)(Ss.Provider,{value:e=>{const t=_(),s=o.uploadFile(e,(e=>{r(Ro({fileId:t,progress:Math.ceil(e)}))}),(e=>{const{id:n,transactionId:o,occurredAt:s,body:{contentType:a,filename:c,filesize:l,url:u}}=e.body;r(No(t)),i(n,o,s,a,c,l,u)}),(e=>{let o;switch(e&&e.body?e.body.error:""){case"file_uploads_are_disabled":o=n("fileUpload.errors.unavailable");break;case"request_entity_too_large":o=n("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":o=n("fileUpload.errors.wrongType");break;case"virus_found":o=n("fileUpload.errors.virusFound");break;default:o=n("fileUpload.errors.general")}r(Io({fileId:t,errorText:o}))}));r(ho({fileId:t,fileName:e.name,uploadHandle:s}))},children:t})},dl=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=zs();return((e,t)=>{const n=(0,_e.useRef)(e);(0,_e.useEffect)((()=>{n.current=e}),[e]),(0,_e.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n>0?1e3:null),null},fl=()=>{const{initUserSelectedOptions:e}=Ds(),t=(0,_e.useRef)(!1),n=br();return(0,_e.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null},hl=pr((({interrupt:e})=>e),(({error:e})=>e));function yl(){const{t:e}=fs(),t=De(hl);return{hasInterrupt:Boolean(t),meta:(0,_e.useMemo)((()=>{if(!t)return{};const{langKey:n,action:r}=t,o=e(`${n}.title`),i=e(`${n}.message`),s=e(`${n}.srText`),a=e(`${n}.buttonText`);return Object.assign(Object.assign(Object.assign(Object.assign({},n?{title:o,message:i,srText:s}:{}),r?{action:r}:{}),r&&n?{buttonText:a}:{}),{originalError:t})}),[e,t]),error:t}}function bl(e,t,n=[]){const r=(0,_e.useContext)(We),o=(0,_e.useRef)();o.current=t,(0,_e.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>o.current?.(...e);return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const ml=()=>{const e=br(),{sendMessage:t,sendContext:n,sendAction:r}=Ki(),o=He(),{setVisibility:i,visible:s}=Fi(),c=(0,_e.useRef)(s),l=(0,_e.useContext)(We),u=zi(),p=Cr(),d=(0,_e.useRef)(null),f=(0,_e.useRef)(null),{isInline:h,isResolving:y}=kr(),{hasInterrupt:b}=yl(),m=(()=>{const{get:e}=Hi();return e?e("conversationUrl"):null})(),v=(0,_e.useRef)(null),g=Us(),{enableTranslations:w,disableTranslations:O}=Gs();return(0,_e.useEffect)((()=>{c.current=s}),[s]),bl("askText",(e=>{t({body:e})}),[u?.send]),bl("setVariables",(e=>{n({variables:e})}),[u?.send]),bl("getVisibility",(e=>{e?e(c.current):console.warn("A callback function is required for the getVisibility action.")})),bl("setVisibility",(e=>{Object.values(hr).includes(e)?(g(),i(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e?.api]),bl("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[u.send]),bl("setTopic",(({name:e,fallbackMessage:t,userTriggered:n})=>{n&&o(Wo({showSuggestions:!1})),e&&t?r({type:ot,body:{name:e,fallbackMessage:t,participant:n?a:void 0}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[u.send]),bl("setTranslation",(({enabled:e,locale:t})=>{e?w(t,"window_api"):O()}),[u.send]),(0,_e.useEffect)((()=>{y||b||(v.current&&v.current!==m&&l.emit("unreadMessageCount",p),s===hr.open&&s!==f.current&&0!==d.current&&l.emit("unreadMessageCount",0),s!==hr.open&&p!==d.current&&l.emit("unreadMessageCount",p),f.current=s,d.current=p,v.current=m)}),[p,s,l,h,y,b,m]),null},vl=({children:t})=>{const n=(0,_e.useContext)(We),[r,o]=(0,_e.useState)({}),i=(0,_e.useRef)(!0),s=(0,_e.useCallback)((e=>{i.current&&(o(e),n.emit("aria-live",e))}),[o,n]);(0,_e.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),500)),()=>{clearTimeout(e)}}),[r,s]),(0,_e.useEffect)((()=>()=>{i.current=!1}),[]);const{ariaLive:a,messageText:c}=r;return(0,e.jsxs)(hs.Provider,{value:s,children:[t,(0,e.jsxs)("div",{className:Qs("app__live-container"),children:[(0,e.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Qs("visually-hidden"),children:a===ct?c:null}),(0,e.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Qs("visually-hidden"),children:a===lt?c:null})]})]})},gl=()=>{const{t:e}=fs(),t=jr(),n=(0,_e.useRef)(0),r=(0,_e.useRef)(0),o=gr().historyLoaded,{sendPolite:i}=ys(),{isOpen:s}=Fi(),a=(0,_e.useRef)(null),c=(0,_e.useRef)(null),l=(0,_e.useMemo)((()=>f((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(i(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[i,e]);return(0,_e.useEffect)((()=>{t.length>n.current&&(s&&(c.current=l(t)),n.current=t.length)}),[t,l,s]),(0,_e.useEffect)((()=>{a.current&&!s&&c.current&&(c.current(!0),c.current=null)}),[s]),(0,_e.useEffect)((()=>{o&&setTimeout((()=>{i(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,i]),null},wl=()=>{const{t:e}=fs(),{isOpen:t,isVisible:n}=Fi(),r=Cr(),{sendPolite:o}=ys(),i=(0,_e.useMemo)((()=>f(o,2e3)),[o]),s=(0,_e.useRef)(null),a=(0,_e.useRef)(null);return(0,_e.useEffect)((()=>{s.current!==n&&!n&&a.current&&a.current(),0!==r&&!t&&n&&(a.current=i(e("message.srTextUnreadCount",{unreadCount:r}))),s.current=n}),[r,t,n,i,e]),null},Ol=({store:t,children:n,eventBus:r,api:o})=>((0,_e.useErrorBoundary)((e=>{t.dispatch(Qo(e))})),(0,e.jsx)(Fe,Object.assign({store:t},{children:(0,e.jsx)(We.Provider,Object.assign({value:r},{children:(0,e.jsx)(qe.Provider,Object.assign({value:o},{children:(0,e.jsx)(vl,{children:(0,e.jsx)(ms,{children:(0,e.jsxs)(al,{children:[(0,e.jsx)(fl,{}),(0,e.jsx)(ul,{}),(0,e.jsx)(wl,{}),(0,e.jsx)(gl,{}),(0,e.jsx)(dl,{}),(0,e.jsxs)(cl,{children:[(0,e.jsx)(ml,{}),(0,e.jsx)(pl,{children:n})]})]})})})}))}))}))),jl=()=>{const{t}=fs(),{showDisclaimer:n}=br();return n&&(0,e.jsxs)("div",{className:Qs("disclaimer"),tabIndex:"0",children:[(0,e.jsx)("h2",{className:Qs("disclaimer__title"),children:t("disclaimer.title")}),(0,e.jsx)("div",{className:Qs("disclaimer__message"),dangerouslySetInnerHTML:{__html:t("disclaimer.content")}})]})},xl=require("preact/compat"),_l=(0,xe.createContext)(null),Cl=e=>{const t=(0,_e.useContext)(vs),n=t[e.type];let r=n[e.payload.type],o=null;return"choice_prompt"===e.payload.type&&(o=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,o]},Sl=({event:t,newParticipant:n})=>{const{eventRefs:r,unreadIds:o}=(0,xl.useContext)(_l),{sendAction:i}=Ki(),s=r[t.payload.id],{containerRef:a,isVisible:c}=Bi({containerRef:s,freezeOnceVisible:!0}),l=He(),[u,p]=Cl(t);if((0,xl.useEffect)((()=>{if(c&&(null==o?void 0:o.includes(t.payload.id))){const e=o.reduce(((e,n)=>e.includes(t.payload.id)?e:e.concat(n)),[]);l(go(e)),i({type:tt,events:e})}}),[l,t.payload.id,c,i,o]),!u)return null;const d=["conversation__item"];return"info"===t.type?d.push("conversation__item--source-info"):t.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),n&&d.push("conversation__item--new-participant"),(0,e.jsxs)("li",Object.assign({className:Qs(d),ref:a},{children:[t.timeIndicator&&(0,e.jsx)(Qa,{event:t}),(0,e.jsx)(u,Object.assign({event:t},{children:(0,e.jsx)(p,{event:t})}))]}))},El=()=>{const{id:t}=Pr()||{};return(0,e.jsx)("li",{className:Qs("conversation__item","conversation__item--source-agent"),children:(0,e.jsxs)("div",{className:Qs("message","message--source-agent","message--type-loading"),children:[(0,e.jsx)(Ys,{eventPayload:{fromClient:!1,participant:t}}),(0,e.jsx)("div",{className:Qs("message__body"),children:(0,e.jsxs)("span",{className:Qs("loader"),children:[(0,e.jsx)("span",{className:Qs("loader__part","one")}),(0,e.jsx)("span",{className:Qs("loader__part","two")}),(0,e.jsx)("span",{className:Qs("loader__part","three")}),(0,e.jsx)("span",{className:Qs("loader__part","four")})]})})]})})},Pl=()=>{const t=jr();let n=null;return(0,e.jsx)(e.Fragment,{children:t.map((t=>{const{type:r,payload:o}=t;let i=!1;if("participant"!==r&&"service_data"!==r){const{participant:e,fromClient:r}=o,s=r?"seamly-client-participant":e;"info"!==t.type&&n!==s&&(i=!0),n=s}return(0,e.jsx)(Sl,{event:t,newParticipant:i},t.payload.key||t.payload.id)}))})},Tl=()=>{const{t}=fs(),n=xr(),{isOpen:r}=Fi(),o=Sr(),i=Cs();return(0,e.jsxs)(e.Fragment,{children:[r&&(0,e.jsx)("a",Object.assign({className:Qs("skip-link"),href:`#${o}`,onClick:e=>{e.preventDefault(),i()}},{children:t("skiplinkText")})),(0,e.jsx)("div",Object.assign({className:Qs("chat__body")},{children:(0,e.jsxs)("div",Object.assign({className:Qs("conversation__container")},{children:[(0,e.jsx)(jl,{}),(0,e.jsxs)("ol",Object.assign({className:Qs("conversation")},{children:[(0,e.jsx)(al,{children:(0,e.jsx)(Pl,{})}),n&&(0,e.jsx)(El,{})]}))]}))}))]})},kl={visible:Qs("transition--visible"),in:Qs("transition--in"),visuallyHidden:Qs("visually-hidden")},Al=Object.values(kl),Nl="notRendered",Il="rendered",Rl="visuallyHidden",Dl=({children:t,isActive:n,timeout:r=300,transitionStartState:o="notRendered",onInTransitionComplete:i=(()=>{}),onOutTransitionComplete:s=(()=>{})})=>{const a=(0,_e.useRef)(!1),c=parseInt(r,10),l=qs(i),u=qs(s),p=o===Rl,[d,f]=(0,_e.useState)((()=>p?[kl.visuallyHidden]:[])),h="notRendered"!==o||d.length>0;return(0,_e.useEffect)((()=>{let e=null,t=null;return a.current&&!n&&(f([kl.visible]),e=setTimeout((()=>{f([...p?[kl.visuallyHidden]:[]]),u&&(t=requestAnimationFrame((()=>{u()})))}),c)),!a.current&&n&&(f([kl.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{f([kl.visible,kl.in]),l&&(e=setTimeout((()=>{l()}),c))}))}))),a.current=n,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[n,p,c,l,u]),(0,e.jsx)(e.Fragment,{children:h&&(0,xe.toChildArray)(t).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!Al.includes(e)));return(0,xe.cloneElement)(e,{className:[...n,...d].join(" ")})}))})},Ml=({isAside:t=!1})=>{const{isInline:n}=kr(),{t:r}=fs(),{sendAction:o,addMessageBubble:i}=Ki(),{isOpen:s,setVisibility:a}=Fi(),{showSuggestions:c}=br(),l=Vs(),u=Cs(),p=(0,_e.useRef)(null),{sendPolite:d}=ys(),{hasInterrupt:f}=yl(),{hasCountdown:h,endCountdown:y}=zs(),{hasPrompt:b,continueChat:m}=Hs(),v=Br(),g=Tr("suggestion"),{body:w}=Ks({payload:g}),j=(0,_e.useMemo)((()=>g&&!f?w:[]),[g,f,w]),x=(0,_e.useRef)(null),_=(0,_e.useRef)(!1),C=(0,_e.useRef)([]),S=!!j.length,E=n?(v||s)&&!t:v,P=(0,_e.useRef)(E),T=S&&!E&&c,k=S?j:C.current;C.current=k;const A=(0,_e.useMemo)((()=>{const e=["suggestions"];return t&&e.push("suggestions--aside"),Qs(e)}),[t]),N=(0,_e.useCallback)((({id:e,question:t})=>{h&&y(!0),b&&m(),o({type:Ze,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),i(t),s||a(hr.open),u()}),[i,m,y,u,h,b,g,o,a,s]);(0,_e.useEffect)((()=>{if(x.current!==j&&!E){if(S){const e=_.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{d(e)}),30)}else _.current&&d(r("suggestions.srUnavailableText"));x.current=j}!P.current&&E?(O(p.current,u),d(r("suggestions.srUnavailableText"))):!S&&_.current&&O(p.current,u),_.current=S,P.current=E}),[j,S,E,u,d,r]);const I=r("suggestions.headingText"),R=r("suggestions.footerText"),D=I?"section":"div";return(0,e.jsx)(Dl,{isActive:T,transitionStartState:Nl,children:(0,e.jsxs)(D,{className:A,"aria-labelledby":I?l:null,ref:p,children:[I&&(0,e.jsx)("p",{id:l,className:Qs("suggestions__heading"),children:I}),!!k.length&&(0,e.jsx)(Ra,{suggestions:k,onClickSuggestion:N}),R&&!s&&(0,e.jsx)("p",{className:Qs("suggestions__footer"),children:R})]})})},Ll=(0,xl.forwardRef)((({children:t,className:n=""},r)=>{const{isOpen:o,isVisible:i,setVisibility:s}=Fi(),{namespace:a,layoutMode:c}=br(),{isInline:l}=kr(),u=gs(),p=Br(),{t:d}=fs(),f=["chat",`chat--layout-${c}`,`namespace--${a}`,...u,n];return o||"app"===c||f.push("chat--collapsed"),p&&f.push("chat--user-responded"),i&&(0,e.jsxs)("section",{className:Qs(f),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&o&&s(hr.minimized)},tabIndex:"-1",ref:r,"aria-label":d("chat.srLabel"),children:[(0,e.jsx)("div",{className:Qs("chat-wrapper"),children:t}),"inline"===c&&o&&(0,e.jsx)(Ml,{isAside:!0})]})})),Ul=Ll,Fl=({className:t,children:n,onCancel:r,headingText:o,description:i,descriptionId:s,cancelButtonText:a,cancelButtonRef:c,disableButtonFocusing:l,position:u={horizontal:"left",vertical:"top"}})=>{const p=Vs(),{hideOption:d}=Ds(),{focusButton:f}=Ms(),h=(0,_e.useCallback)((()=>{d(),l||f()}),[l,f,d]),y=(0,_e.useCallback)((()=>{r&&r(),h()}),[h,r]),b=(e=>{const t=(0,_e.useRef)(null);return(0,_e.useEffect)((()=>{const n=({target:n})=>{t.current&&n instanceof HTMLElement&&!t.current.contains(n)&&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})(y);return(0,_e.useEffect)((()=>{w(b.current)}),[b]),(0,e.jsx)("section",Object.assign({className:Qs("options",{"options--right":"right"===u.horizontal,"options--left":"left"===u.horizontal,"options--top":"top"===u.vertical,"options--bottom":"bottom"===u.vertical},t),"aria-labelledby":p,tabIndex:-1,ref:b},{children:(0,e.jsxs)("div",Object.assign({className:Qs("options__body")},{children:[(0,e.jsx)("h2",Object.assign({id:p,className:Qs("options__title")},{children:o})),(0,e.jsxs)("button",Object.assign({type:"button",onClick:y,"aria-describedby":p,className:Qs("button","options__close"),ref:e=>{c&&(c.current=e)}},{children:[(0,e.jsx)(ba,{name:"close",size:"16",alt:""}),(0,e.jsx)("span",{children:a})]})),i?(0,e.jsx)("p",Object.assign({className:Qs("options__description"),id:s},{children:i})):null,(0,e.jsx)("div",Object.assign({className:Qs("options__wrapper")},{children:n}))]}))}))},Bl=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),$l=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},zl=e=>!!e?.length>0,Hl=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))},Vl=e=>!!e,ql=(0,xe.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),Wl=ql,{Provider:Gl,Consumer:Kl}=ql,Jl=pr((({forms:e})=>e),((e,{formId:t})=>t),((e,t)=>e[t])),Xl=pr(Jl,(e=>(null==e?void 0:e.controls)||{})),Ql=pr(Xl,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Yl=pr(Xl,((e,{name:t})=>t),((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.value})),Zl=pr(Xl,((e,{name:t})=>t),((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.touched}));function eu(){return(0,_e.useContext)(Wl)}function tu(e){const t=He(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:i}=eu(),s=!!De((e=>Jl(e,{formId:n}))),a=De((t=>Yl(t,{formId:n,name:e}))),c=De((t=>Zl(t,{formId:n,name:e}))),l=null==i?void 0:i[e],u=!l;(0,_e.useEffect)((()=>{s&&t(ii({formId:n,name:e}))}),[s,n,e,t]),(0,_e.useLayoutEffect)((()=>()=>{t(si({formId:n,name:e}))}),[s,n,e,t]);const p=(0,_e.useCallback)((t=>r(e,t.target.value)),[e,r]),d=(0,_e.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,_e.useMemo)((()=>({name:e,onInput:p,onBlur:d,value:a})),[e,p,d,a]),(0,_e.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function nu(t){var{children:n,formId:r,persistData:o,onError:i,onSubmit:s,validationSchema:a}=t,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["children","formId","persistData","onError","onSubmit","validationSchema"]);const l=He(),u=De((e=>Ql(e,{formId:r}))),[p,d]=(0,_e.useState)(!1),[f,h]=(0,_e.useState)({}),{isValid:y,errors:b}=function(e,t){const n=(0,_e.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{var o;const i=Array.isArray(r)?r:[r];for(let r=0;null!==(o=r<(null==i?void 0:i.length))&&void 0!==o&&o;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}}(u,a),m=(0,_e.useMemo)((()=>Object.assign(Object.assign({},b),f)),[b,f]);(0,_e.useLayoutEffect)((()=>{l(ri({formId:r,persistData:o}))}),[r,o,l]),(0,_e.useEffect)((()=>()=>{l(oi({formId:r}))}),[r,o,l]);const v=(0,_e.useCallback)(((e,t)=>{l(ai({formId:r,name:e,value:t}))}),[r,l]),g=(0,_e.useCallback)(((e,t)=>{l(ci({formId:r,name:e,touched:t}))}),[l,r]),w=(0,_e.useCallback)(((e,t)=>{h((n=>Object.assign(Object.assign({},n),{[e]:t})))}),[h]),O=(0,_e.useCallback)((e=>{var t;e.preventDefault();const n="true"===(null===(t=e.submitter)||void 0===t?void 0:t.ariaDisabled);d(!n),!n&&y&&(l(Hr(!0)),s(u,{updateControlValue:v,setError:w}))}),[y,l,s,u,v,w]);(0,_e.useEffect)((()=>{i&&i({errors:m,isSubmitted:p,isValid:0===Object.keys(m).length})}),[p,m,i]);const j=(0,_e.useMemo)((()=>({formId:r,values:u,errors:m,isValid:0===Object.keys(m).length,isSubmitted:p,handleSubmit:O,validationSchema:a,updateControlValue:v,updateControlTouched:g})),[r,u,m,p,O,a,v,g]);return r?s?(0,e.jsx)(Gl,Object.assign({},c,{value:j},{children:n})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}const ru=["className","disableValidationClasses"];function ou(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 iu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const su=function(t){let{className:n,disableValidationClasses:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,ru);const{handleSubmit:i,isValid:s,isSubmitted:a}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=eu();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),c=["form"];return!r&&a&&(c.push("form--submitted"),s?c.push("form--valid"):c.push("form--invalid")),(0,e.jsx)("form",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ou(Object(n),!0).forEach((function(t){iu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({onSubmit:i,className:Qs([...c,n])},o))};function au({id:t,error:n}){const[r,o]=(0,_e.useState)(!1);return(0,_e.useEffect)((()=>{const e=setTimeout((()=>o(!0)),300);return()=>clearTimeout(e)}),[]),(0,e.jsx)("div",{className:Qs("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&n&&(0,e.jsxs)("span",{id:t,className:Qs("error__message"),children:[(0,e.jsx)(ba,{name:"error",size:"16"}),n]})})}const cu=({contentHint:t,id:n,labelText:r,labelClass:o=Qs("label"),validity:i,errorText:s,children:a})=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("label",{htmlFor:n,className:o,children:r}),t&&(0,e.jsx)("span",{id:`${n}-content-hint`,className:Qs("input__content-hint"),children:t}),(0,e.jsx)(au,{id:`${n}-error`,error:!i&&s}),a]}),lu=["id","name","type","labelText","labelClass","contentHint","aria-describedby"];function uu(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 pu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uu(Object(n),!0).forEach((function(t){du(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function du(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const fu=function(t){let{id:n,name:r,type:o,labelText:i,labelClass:s,contentHint:a,"aria-describedby":c}=t,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,lu);const{isSubmitted:u}=eu(),[p,{error:d}]=tu(r),f=u&&d,h=[];return c&&h.push(c),a&&h.push(`${n}-content-hint`),f&&h.push(`${n}-error`),(0,e.jsx)(cu,{id:n,contentHint:a,validity:!f,errorText:d,labelText:i,labelClass:s,children:(0,e.jsx)("input",pu(pu({id:n,name:r,type:o,"aria-invalid":f?"true":"false","aria-describedby":h.join(" ")||null},p),l))})};function hu({controlName:t,describedById:n}){const{t:r}=fs();return(0,e.jsxs)(su,{noValidate:"true",className:Qs("options__form"),children:[(0,e.jsx)(fu,{name:t,type:"email",className:Qs("transcript__input"),"aria-describedby":n,labelClass:Qs("label"),labelText:r("options.sendTranscript.label")}),(0,e.jsx)("div",{className:Qs("options__actions"),children:(0,e.jsx)("button",{type:"submit",className:Qs("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const yu="email",bu={sendTranscript:()=>{const[t,n]=(0,_e.useState)(void 0),{hideOption:r}=Ds(),{focusButton:o}=Ms(),{t:i}=fs(),s=Vs(),{sendAction:a}=Ki(),c=(0,_e.useMemo)((()=>({[yu]:[Bl(Vl,i("options.sendTranscript.noEmailText")),Bl(Hl,i("options.sendTranscript.invalidEmailText"))]})),[i]),l=(0,_e.useCallback)((e=>{const t=e.email.trim();a({type:"send_transcript",body:{emailAddress:t}}),r(),o()}),[a,r,o]),u=(0,_e.useCallback)((({isValid:e,isSubmitted:t})=>{n(t&&!e?"options--error":void 0)}),[n]);return(0,e.jsx)(Fl,{className:t,headingText:i("options.sendTranscript.title"),cancelButtonText:i("options.cancelButtonText"),description:i("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,e.jsx)(nu,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,e.jsx)(hu,{controlName:yu,describedById:s})})})}},mu=()=>{const{optionActive:t}=Ds(),n=(0,_e.useRef)(null),r=bu[t||n.current];return t&&(n.current=t),r?(0,e.jsx)(r,{}):null},vu=()=>{const{t}=fs(),{menuOptions:n,showOption:r,panelActive:o,hideOption:i}=Ds(),{id:s}=Ms(),a=(0,_e.useRef)(null),[c,l]=(0,_e.useState)(!1),u=(0,_e.useRef)(null),p=n.length,d=(0,_e.useRef)(Array.from({length:p},(()=>(0,xe.createRef)()))),f=(0,_e.useRef)(!1),h=p>1,y=n[0],b=(0,_e.useMemo)((()=>y?.name?.trim().replace(/\s+/g,"")),[y]);return(0,_e.useEffect)((()=>()=>{clearTimeout(a.current)}),[]),(0,_e.useEffect)((()=>{c&&!f.current&&requestAnimationFrame((async()=>{await Os(60);const e=n.findIndex((e=>e.available)),t=-1===e?0:e;w(d.current[t])})),f.current=c}),[c,n]),p?(0,e.jsxs)("div",{className:Qs("options__container"),onKeyDown:e=>{c&&(g(e)===v.Escape&&(l(!1),w(u.current)),g(e)===v.Home&&(w(d.current[0]),e.preventDefault()),g(e)===v.End&&(w(d.current[p-1]),e.preventDefault()))},onfocusout:()=>{h&&(a.current=setTimeout((()=>{l(!1)}),200))},onfocusin:()=>{clearTimeout(a.current)},children:[(0,e.jsx)(Dl,{transitionStartState:Nl,isActive:o,children:(0,e.jsx)("div",{className:Qs("options__dialog"),children:(0,e.jsx)(mu,{})})}),h&&(0,e.jsx)(Dl,{isActive:c,transitionStartState:Nl,children:(0,e.jsx)("ul",{className:Qs(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":s,children:n.map((({name:o,title:i,available:s},a)=>(0,e.jsx)("li",{className:Qs("options__menu__item"),role:"menuitem","data-testid":o,children:(0,e.jsxs)("button",{type:"button",ref:e=>{d.current[a]=e},className:Qs(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(g(e)===v.ArrowDown){const n=Math.min(p-1,t+1);w(d.current[t===n?0:n]),e.preventDefault()}if(g(e)===v.ArrowUp){const n=Math.max(0,t-1);w(d.current[t===n?p-1:n]),e.preventDefault()}})(e,a),onKeyPress:e=>((e,t)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;n.forEach(((e,n)=>{n>t&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=n)})),-1!==o&&w(d.current[o])})(e,a),onClick:()=>((e,t)=>{t&&(l(!1),r(e))})(o,s),"aria-disabled":s?null:"true",children:[(0,e.jsxs)("span",{className:Qs("button__text"),children:[i,!s&&" "]}),!s&&(0,e.jsx)("span",{className:Qs("button__state"),children:t("options.unavailableText")})]})},o)))})}),(0,e.jsxs)("button",{type:"button",className:Qs(["button","button--secondary","chat__options__button",...!h&&b?[`chat__options__button--${b}`]:[]]),id:s,onClick:()=>{o&&i(),h?l((e=>!e)):y.available&&r(y.name)},onKeyDown:h?e=>{g(e)===v.ArrowDown&&(l(!0),e.preventDefault())}:null,ref:u,"aria-haspopup":h?"menu":null,"aria-expanded":h?c.toString():null,"aria-disabled":h||y.available?null:"true",children:[h&&(0,e.jsx)(ba,{name:"options",size:"32"}),(0,e.jsx)("span",{className:Qs("button__text"),children:h?t("options.openButtonText"):`${y.title}${y.available?"":" "}`}),!h&&!y.available&&(0,e.jsx)("span",{className:Qs("button__state"),children:t("options.unavailableText")})]})]}):null},gu=({label:t,checked:n,description:r,onChange:o,id:i})=>(0,e.jsxs)("li",Object.assign({className:Qs("translation-options__item",{"translation-options__item--checked":n})},{children:[(0,e.jsx)("input",{id:i,type:"radio",value:t,checked:n,className:Qs("visually-hidden"),onChange:o,name:"language"}),(0,e.jsxs)("label",Object.assign({htmlFor:i},{children:[(0,e.jsx)(ba,{alt:"",name:"check",size:"16"}),t," ",r&&(0,e.jsxs)("span",{children:["(",r,")"]})]}))]})),wu=({onChange:t,describedById:n})=>{const{context:{locale:r}}=br(),{t:o}=fs(),{focusContainer:i}=Js(),{languages:s,currentLocale:a,enableTranslations:c,disableTranslations:l}=Gs(),u=({locale:e})=>()=>{e===a||r===e?l():c(e),t(),i()},p=(0,_e.useMemo)((()=>[...s].sort(((e,t)=>e.locale===r?-1:t.locale===r?1:e.nativeName.localeCompare(t.nativeName,void 0,{sensitivity:"base"})))),[s,r]);return(0,e.jsx)("ul",Object.assign({"aria-describedby":n,className:Qs("translation-options")},{children:p.map(((t,n)=>{const r=0===n,i=a===t.locale||!a&&r;return(0,e.jsx)(gu,{id:t.locale,label:t.nativeName,checked:i,description:r&&o("translations.settings.original"),onChange:u(t)},t.locale)}))}))},Ou=function({onClose:t,position:n}){const{t:r}=fs(),o=Vs();return(0,e.jsx)(Fl,Object.assign({onCancel:t,headingText:r("translations.menu.title"),cancelButtonText:r("translations.settings.cancelButtonText"),description:r("translations.menu.description"),descriptionId:o,position:n,disableButtonFocusing:!0},{children:(0,e.jsx)(wu,{describedById:o,onChange:t})}))};function ju({children:t,position:n={horizontal:"left",vertical:"top"},classNames:r}){const[o,i]=(0,_e.useState)(!1),s=(0,_e.useRef)(null),a=Vs();return(0,e.jsxs)("div",Object.assign({className:Qs("translations__container"),onKeyDown:e=>{o&&g(e)===v.Escape&&(i(!1),w(s.current))}},{children:[(0,e.jsx)(Dl,Object.assign({onOutTransitionComplete:()=>{},onInTransitionComplete:()=>{},timeout:0,transitionStartState:Nl,isActive:o},{children:(0,e.jsx)("div",Object.assign({className:Qs("options__dialog"),role:"dialog"},{children:(0,e.jsx)(Ou,{onClose:()=>{i(!1)},position:n})}))})),(0,e.jsx)("button",Object.assign({type:"button",className:Qs(["button","chat__options__button",...r]),id:a,onClick:()=>{i((e=>!e))},onKeyDown:e=>{g(e)===v.ArrowDown&&(i(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":o.toString()},{children:t}))]}))}function xu(){const{menuOptions:t,allowOptionSelection:n}=Ds(),{isAvailable:r}=Gs(),{hasInterrupt:o}=yl(),{t:i,locale:s}=fs(),a=Xs(s);if(!r&&(!n||!t.length)||o)return null;const c=i("translations.settings.openButtonText",{hasLanguage:!!a,language:a});return(0,e.jsxs)("div",{className:Qs("chat__options"),children:[r&&(0,e.jsx)("div",{className:Qs("chat__options-item","chat__options-item--left"),children:(0,e.jsxs)(ju,{classNames:["button--secondary"],children:[(0,e.jsx)(ba,{alt:c,name:"newTranslation",size:"16"}),(0,e.jsx)("span",{className:Qs("button__text"),children:c})]})}),n&&(0,e.jsx)("div",{className:Qs("chat__options-item","chat__options-item--right"),children:(0,e.jsx)(vu,{})})]})}const _u=()=>{const{scrollToRef:t,unreadIds:n}=(0,_e.useContext)(_l),{isMinimized:r}=Fi(),{t:o}=fs();return(0,e.jsx)(Dl,Object.assign({isActive:!!n.length&&!r},{children:(0,e.jsx)("div",Object.assign({className:Qs("unread-messages")},{children:(0,e.jsxs)("button",Object.assign({type:"button",className:Qs("button","button--primary"),onClick:t},{children:[o("message.unreadMessagesCount",{unreadCount:n.length}),(0,e.jsx)(ba,{name:"chevronDown",size:"32",alt:""})]}))}))}))},Cu=pr(Or,(e=>e.filter((e=>{var t;return Xr(e)&&"service_data"!==e.type&&(null===(t=e.payload)||void 0===t?void 0:t.messageStatus)===Qe})).map((e=>e.payload.id))));const Su=e=>{const t=(0,_e.useRef)(),[n,r]=(0,_e.useState)(!0),o=De(Cu),i=jr(),s=xr(),{isOpen:a}=Fi(),c=gr().loadedImageEventIds,l=De((e=>e.state.isLastEventFromClient));(0,_e.useEffect)((()=>{const e=t.current,n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,i=Math.abs(t-n-o)>10;r(!i)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const u=(0,_e.useCallback)((()=>{requestAnimationFrame((()=>function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){var e,n;yield Os(30),null===(e=t.current)||void 0===e||e.scrollTo({top:null===(n=t.current)||void 0===n?void 0:n.scrollHeight,left:0,behavior:"auto"})}))))}),[]);return(0,_e.useEffect)((()=>{l&&u()}),[l,u]),(0,_e.useEffect)((()=>{n&&u()}),[n,o,i,s,a,c,u]),{containerRef:t,unreadIds:o,scrollToRef:()=>{var n,r;const i=null===(n=e[null==o?void 0:o.at(0)])||void 0===n?void 0:n.current;null===(r=t.current)||void 0===r||r.scrollTo({top:null==i?void 0:i.offsetTop,behavior:"auto",left:0})},scrollToBottom:u}},Eu=({children:t})=>{const n=jr(),r=(0,_e.useMemo)((()=>n.reduce(((e,t)=>(e[t.payload.id]=(0,xe.createRef)(),e)),{})),[n]),{scrollToRef:o,scrollToBottom:i,containerRef:s,unreadIds:a}=Su(r);return(0,e.jsx)(_l.Provider,Object.assign({value:{eventRefs:r,unreadIds:a,scrollToRef:o,scrollToBottom:i,containerRef:s}},{children:(0,e.jsxs)("div",Object.assign({className:Qs("chat__container")},{children:[(0,e.jsx)("div",Object.assign({className:Qs("chat__container__scroll-area"),ref:s},{children:t})),(0,e.jsx)(_u,{})]}))}))},Pu=({baseClassName:t,children:n,title:r})=>{const o=Sr(),i=Vs();return(0,e.jsxs)("section",{id:o,className:Qs(t),"aria-describedby":i,tabIndex:"-1",children:[(0,e.jsx)("h2",{className:Qs(`${t}__title`),id:i,children:r}),n]})},Tu=()=>{const{t}=fs(),n=Cs(),r=Us(),{emitEvent:o}=Ki(),{isActive:i,remaining:s,timer:a,endCountdown:c}=zs(),l=s>0,u=t(l?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,e.jsx)(Pu,{baseClassName:"idle",title:u,children:l&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:Qs("idle__count-container"),children:i&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:Qs("idle__count-text"),children:t("idleDetachWarning.countdownText")}),(0,e.jsx)("span",{className:Qs("idle__count-timer"),children:t("idleDetachWarning.countdownTimer",a)})]})}),(0,e.jsxs)("div",{className:Qs("idle__options"),children:[(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{r(),c(!0),n(),o("idleTimer.selectContinue")},children:t("idleDetachWarning.continueButton")}),(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{c(),n(),o("idleTimer.selectEnd")},children:t("idleDetachWarning.detachButton")})]})]})})},ku=()=>{const{t}=fs(),n=Us(),{name:r}=Pr()||{},{continueChat:o,restartChat:i}=Hs();return(0,e.jsx)(Pu,{baseClassName:"prompt",title:t("resumeConversationPrompt.title",{name:r}),children:(0,e.jsxs)("div",{className:Qs("prompt__options"),children:[(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{n(),o()},children:t("resumeConversationPrompt.continueButton")}),(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:i,children:t("resumeConversationPrompt.detachButton")})]})})};function Au(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 Nu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Iu=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=gr().entryMeta,i=He(),s=n||t||e,a=o[s]||r[s]||{},c=(0,_e.useCallback)((e=>{i(vo(e))}),[i]),l=(0,_e.useCallback)((e=>{i(bo(e))}),[i]),u=(0,_e.useCallback)((e=>{i(Do(e))}),[i]),p=(0,_e.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:s,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:p,setBlockAutoEntrySwitch:c}};function Ru({controlName:t,skipLinkId:n}){const{t:r}=fs(),{sendAssertive:o}=ys(),{emitEvent:i}=Ki(),s=(()=>{const{sendAction:e}=Ki(),{features:t}=Ds(),{typingPeekahead:n}=t||{},r=(0,_e.useRef)(null),o=(0,_e.useRef)(null),i=(0,_e.useRef)(!1),s=(0,_e.useRef)(null);(0,_e.useEffect)((()=>()=>{clearInterval(s.current),clearTimeout(r.current),clearTimeout(o.current)}),[]);const a=(t,r)=>{e(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Au(Object(n),!0).forEach((function(t){Nu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:et,state:t},n&&n.enabled?{body:{currentMessage:r}}:{}))};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(i.current=!0,s.current||(a(!0,e.target.value),s.current=setInterval((()=>{i.current?n&&n.enabled&&a(!0,e.target.value):(clearInterval(s.current),s.current=null)}),2e3)),clearTimeout(r.current),clearTimeout(o.current),r.current=setTimeout((()=>{i.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}})(),{setBlockAutoEntrySwitch:a}=Iu(),{hasCharacterLimit:c,characterLimit:l,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:d}=function(e){const{t}=fs(),{sendAssertive:n}=ys(),{hasLimit:r,limit:o}=(()=>{const{entryMeta:{options:{text:e},optionsOverride:{text:t}}}=gr(),{limit:n}=t||e||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}})(),i=(0,_e.useMemo)((()=>f(n,300)),[n]),s=(0,_e.useMemo)((()=>f(((e,n)=>{e&&i(t("input.srCharacterLimitText",{limit:n}))}),300)),[i,t]),[{value:a}]=tu(e),c=r&&a?o-a.length:o,l=!!r&&c<=50,u=!!r&&c<0;return(0,_e.useEffect)((()=>{s(l,c)}),[l,c,s]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}(t),[{value:h}]=tu(t),y=!!h,b=(0,_e.useCallback)((()=>{u&&o(r("input.srCharacterLimitText",{limit:d})),i("ui.inputFocus")}),[r,o,u,d,i]),m=(0,_e.useMemo)((()=>r("input.inputPlaceholder",{hasLimit:c,limit:c?l:null})),[r,c,l]),v=(0,_e.useMemo)((()=>r("input.inputLabel",{hasLimit:c,limit:c?l:null})),[r,c,l]);return(0,_e.useLayoutEffect)((()=>(a(y),()=>{a(!1)})),[a,y]),(0,e.jsxs)(su,{className:Qs("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,e.jsxs)("div",{className:Qs(["input--text__container",...u&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,e.jsx)(fu,{id:n,type:"text",name:t,className:Qs("input__text"),autocomplete:"off",placeholder:m,labelText:v,labelClass:Qs("visually-hidden"),"aria-invalid":c?p:null,onKeyUp:s,onFocus:b}),(0,e.jsx)("div",{className:Qs("character-count"),children:u&&(0,e.jsx)("span",{children:d})})]}),(0,e.jsx)("button",{className:Qs("button","input__submit"),type:"submit",onPointerDown:e=>{e.preventDefault()},"aria-disabled":!y||p?"true":null,children:(0,e.jsx)(ba,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}function Du(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 Mu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Du(Object(n),!0).forEach((function(t){Lu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Du(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uu(){return Uu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uu.apply(this,arguments)}const Fu="textMessageEntry";function Bu(t){let n=Uu({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(t),t));const{isOpen:r,setVisibility:o}=Fi(),i=Sr(),s=Cs(),{sendMessage:a}=Ki(),c=(0,_e.useCallback)(((e,{updateControlValue:t})=>{a({body:e.textMessageEntry}),t(Fu,""),s(),r||o(hr.open)}),[a,s,r,o]);return(0,e.jsx)(nu,Mu(Mu({},n),{},{formId:"textEntry",persistData:!0,onSubmit:c,children:(0,e.jsx)(Ru,{controlName:Fu,skipLinkId:i})}))}const $u=()=>{const{t}=fs(),{currentUploads:n}=As();return(0,e.jsx)("div",{className:Qs("progress"),children:n.map((({id:n,name:r,progress:o,uploading:i,error:s})=>(0,e.jsxs)("div",{className:Qs("progress_container"),children:[(0,e.jsxs)("div",{className:Qs("progress__text"),children:[(0,e.jsx)("span",{className:Qs("progress__text--file-name"),children:r}),(0,e.jsx)("span",{className:Qs("progress__text--percentage"),children:`${o}%`})]}),(0,e.jsx)(au,{error:s}),(0,e.jsx)("progress",{className:Qs("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":t("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":o,value:o,"aria-busy":i,children:`${o}%`})]},n)))})};function zu({id:t,name:n,labelText:r,contentHint:o,outputText:i,accept:s}){const{isSubmitted:a}=eu(),[c,l]=(0,_e.useState)(!1),[{onInput:u,onBlur:p},{error:d}]=tu(n),f=Vs(),h=Vs(),y=Vs(),b=a&&d,m=[y];o&&m.push(h),b&&m.push(f);const v=(0,_e.useCallback)((()=>{l(!0)}),[l]),g=(0,_e.useCallback)((()=>{l(!1),p()}),[l,p]),w=(0,_e.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,e.jsxs)("div",{className:Qs("upload__container"),children:[o&&(0,e.jsx)("span",{className:Qs("upload__content-hint"),id:h,children:o}),(0,e.jsx)(au,{id:f,error:b&&d}),(0,e.jsx)("div",{className:Qs(["file-upload",...c?["focus-within"]:[]]),children:(0,e.jsxs)("label",{htmlFor:t,className:Qs("upload__label"),children:[(0,e.jsx)(ba,{name:"upload",size:"32"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:Qs(["upload__label--text"]),children:r}),(0,e.jsx)("input",{id:t,className:Qs("upload__input"),type:"file",name:n,onChange:w,"aria-invalid":b?"true":"false","aria-describedby":m.join(" "),accept:s||null,onFocus:v,onBlur:g}),(0,e.jsx)("span",{className:Qs("upload__output"),"aria-hidden":"true",id:y,children:i})]})]})})]})}function Hu({skiplinkId:t,controlName:n,accept:r,contentHint:o,isUploading:i,isComplete:s,onClickCancel:a}){const{t:c}=fs(),[{value:l}]=tu(n),u=l&&l.length>0,p=u?l[0].name:"";return(0,e.jsxs)(su,{className:Qs("upload-form"),children:[(0,e.jsx)(zu,{name:n,id:t,accept:r,labelText:c("fileUpload.labelText"),outputText:c("fileUpload.selectedText",{hasFile:u,filename:p}),contentHint:o}),(0,e.jsxs)("div",{className:Qs("upload__button-container"),children:[(0,e.jsx)("button",{id:i||!s?t:void 0,type:"button",onClick:a,className:Qs("button","button--secondary","upload__cancel"),children:c("fileUpload.cancelButtonText")}),(0,e.jsx)("button",{className:Qs("button","button--primary"),type:"submit",children:c("fileUpload.uploadButtonText")})]})]})}const Vu="fileListForm",qu="fileList",Wu=()=>{const{t}=fs(),{sendPolite:n,sendAssertive:r}=ys(),o=Sr(),i=Cs(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=ks(),l=(0,_e.useRef)(null),u=(0,_e.useRef)(s),{cancelEntrySelection:p}=Iu(),{uploadFile:d,clearUploads:f,isUploading:h,isComplete:y}=As(),{hasFile:m,selectedFileName:v,uploadHandle:g,hasServerError:w,progress:O}=((e,t)=>{const n=De((n=>Yl(n,{formId:e,name:t}))),{currentUploads:r}=As(),o=n&&n.length>0;let i=null,s=!1,a=0;if(r&&r.length>0){const e=r[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(Vu,qu),j=Vs(),x=(0,_e.useRef)(!0),_=t("fileUpload.contentHint",{size:b(c)}),C=(0,_e.useRef)(""),S=(0,_e.useRef)(null);(0,_e.useEffect)((()=>{C.current&&S.current?.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(_),C.current=_}),[_,r]),(0,_e.useEffect)((()=>{O>0&&n(1===O?t("fileUpload.srStartedText"):`${O}%`)}),[O,n,t]),(0,_e.useEffect)((()=>{x.current||h||!y||(f(),p(),i(),setTimeout((()=>{n(t("fileUpload.srCompleteText"))}),300)),x.current=y}),[h,y,f,p,i,n,t]);const E=(0,_e.useCallback)((({fileList:e})=>{d(e[0]),i()}),[d,!1,i]),P=(0,_e.useCallback)((()=>{g&&g.abort(),f(),p(),i()}),[g,f,p,i]),T=(0,_e.useMemo)((()=>({[qu]:[Bl((()=>s),t("fileUpload.errors.unavailable")),Bl(zl,t("fileUpload.errors.noFile")),Bl($l,t("fileUpload.errors.tooLarge"),c)]})),[c,s,t]);return(0,e.jsx)("div",{className:Qs(["upload",...w?["upload--error"]:[]]),ref:S,children:(0,e.jsxs)(nu,{formId:Vu,persistData:!0,onSubmit:E,validationSchema:T,children:[(h||!y)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)($u,{}),(0,e.jsx)("div",{className:Qs("upload__button-container"),children:(0,e.jsx)("button",{id:h||!y?o:void 0,type:"button",onClick:P,ref:l,className:Qs("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]}),!h&&y&&(0,e.jsx)(Hu,{controlName:qu,skiplinkId:o,accept:a.join(", "),contentHint:_,isComplete:y,isUploading:h,outputText:t("fileUpload.selectedText",{hasFile:m,filename:v}),onClickCancel:P}),!u.current&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:Qs("notification"),id:j,children:t("fileUpload.unavailableText")}),(0,e.jsx)("div",{className:Qs("upload__button-container"),children:(0,e.jsx)("button",{id:h||!y?o:void 0,type:"button",onClick:P,className:Qs("button","button--secondary","upload__cancel"),children:t("fileUpload.cancelButtonText")})})]})]})})},Gu=()=>{const{t}=fs(),{showFileUpload:n,serviceAllowsUploads:r}=ks(),[o,i]=(0,_e.useState)(r),s=Cs(),a=(0,_e.useRef)(null),{setUserEntryType:c,activeEntry:l}=Iu(),u=(0,_e.useRef)(null),{sendPolite:p}=ys(),d=!!Pr();return(0,_e.useEffect)((()=>{O(u.current,(()=>{r||s()})),i(r)}),[r,s]),(0,_e.useEffect)((()=>{a.current&&!r&&p(t("fileUpload.srUnavailableText")),!1===a.current&&r&&p(t("fileUpload.srAvailableText")),d&&(a.current=r)}),[r,d,p,t]),!n&&l!==Xe&&(0,e.jsx)(Dl,{isActive:o,transitionStartState:Il,children:(0,e.jsx)("div",{className:Qs("upload-toggle-wrapper"),children:(0,e.jsx)(Dl,{isActive:o,transitionStartState:Rl,children:(0,e.jsx)("button",{className:Qs(["button","button--secondary","upload-toggle"]),ref:u,"aria-disabled":o?null:"true",type:"button",onClick:o?()=>{c(Xe),s()}:null,children:(0,e.jsx)(ba,{name:"file",size:"32",alt:t("fileUpload.toggleButtonText")})})})})})};function Ku(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 Ju(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ku(Object(n),!0).forEach((function(t){Xu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ku(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qu=()=>{const{isOpen:t}=Fi(),n=(0,_e.useRef)(null),{hasCountdown:r}=zs(),[o,i]=(0,_e.useState)(r),{hasPrompt:s}=Hs(),[a,c]=(0,_e.useState)(s),l=Cs(),u=(0,_e.useRef)(!1),{activeEntry:p}=Iu(),[d,f]=(0,_e.useState)({text:Bu,upload:Wu}),[h,y]=(0,_e.useState)((()=>p)),b=br(),{accountAllowsUploads:m}=ks(),v=(0,_e.useCallback)((()=>{O(n.current,l)}),[l]);(0,_e.useEffect)((()=>{const{customComponents:e}=b,{entry:t}=e||{};t&&f((e=>Ju(Ju({},e),t)))}),[b]),(0,_e.useEffect)((()=>{v(),i(r),c(s)}),[r,s,v]),(0,_e.useEffect)((()=>{y(p),v()}),[p,v,n]),u.current=!(!n.current||!n.current.contains(document.activeElement));const g=d[h];return(0,e.jsxs)("div",{className:Qs("chat__entry"),ref:n,children:[o&&(0,e.jsx)(Tu,{}),a&&(0,e.jsx)(ku,{}),(0,e.jsxs)("div",{className:Qs(["entry__body",...r||s?["entry__body--hidden"]:[]]),children:[h!==Xe&&m&&t&&(0,e.jsx)(Gu,{}),(0,e.jsx)(g,{})]})]})},Yu=({onClick:t})=>{const{t:n}=fs(),r=(0,_e.useCallback)((()=>t()),[t]);return(0,e.jsx)("button",{type:"button",className:Qs("button","collapse-button"),onClick:r,children:(0,e.jsx)(ba,{name:"chevronDown",size:"32",alt:n("window.srCollapseButton")})})},Zu=({children:t,handleClose:n,title:r,closeButtonText:o,srCloseButtonText:i,id:s})=>{const a=Vs();return(0,e.jsxs)("section",Object.assign({tabIndex:-1,id:s,"aria-labelledby":r?a:void 0,className:Qs("chat-status",!r&&"chat-status--condensed")},{children:[(0,e.jsxs)("div",Object.assign({className:Qs("chat-status__body")},{children:[r?(0,e.jsx)("h2",Object.assign({className:Qs("chat-status__title"),id:a},{children:r})):null,t]})),"function"==typeof n&&(0,e.jsxs)("button",Object.assign({type:"button",onClick:n,className:Qs("button","button--tertiary","chat-status__close")},{children:[o||(0,e.jsx)(ba,{name:"close",size:"16",alt:""}),i&&(0,e.jsx)("span",Object.assign({className:Qs("visually-hidden")},{children:i}))]}))]}))};function ep(){const{t}=fs(),{id:n}=Js(),{hasInterrupt:r}=yl(),{disableTranslations:o,currentLocale:i}=Gs(),s=Xs(i),a=Cs(),c=t("translations.status.label",{language:s}),l=(0,_e.useCallback)((()=>{o(),a()}),[o,a]);return r?null:(0,e.jsx)(Zu,{handleClose:l,title:c,id:n,closeButtonText:t("translations.status.stopText"),srCloseButtonText:t("translations.status.srStopText")})}const tp=({handleClick:t,icon:n,title:r,srButtonText:o})=>(0,e.jsxs)("button",Object.assign({type:"button",onClick:t,className:Qs("button","button--primary","chat-status__button")},{children:[(0,e.jsx)(ba,{name:n,size:"16",alt:""}),r,o&&(0,e.jsx)("span",Object.assign({className:Qs("visually-hidden")},{children:o}))]}));function np(){const{showProposal:t,translationProposal:n,dismissTranslationProposal:r,activateTranslationProposal:o}=(()=>{const{isActive:e,languages:t}=Gs(),n=He(),{sendAction:r}=Ki(),{translationProposal:o}=De((e=>e.translations)),{enableTranslations:i}=Gs(),{isOpen:s}=Fi(),{locale:a}=fs(),c=null==o?void 0:o.proposedLocale,l=Xs(c),u=(0,_e.useMemo)((()=>null!==o&&!e&&s&&a!==c&&t.some((e=>e.locale===c))),[o,e,s,a,c,t]);return{activateTranslationProposal:()=>{i(null==o?void 0:o.proposedLocale,"translation_proposal")},dismissTranslationProposal:()=>{r({type:rt,body:{type:at}}),n(Ni())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}})(),{id:i}=Js();return t?(0,e.jsx)(Zu,Object.assign({handleClose:r,srCloseButtonText:n.srDismissButtonText,id:i,title:n.titleLabel},{children:(0,e.jsx)(tp,{handleClick:o,icon:"newTranslation",title:n.buttonLabel})})):null}function rp(){const{hasInterrupt:t}=yl(),{isActive:n}=Gs();return t?null:n?(0,e.jsx)(ep,{}):(0,e.jsx)(np,{})}function op(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 ip(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sp=function({children:t,interruptComponent:n}){const{hasInterrupt:r,meta:o}=yl(),{isOpen:i,closeChat:s}=Fi(),{isWindow:a}=kr();return r?i?(0,e.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?op(Object(n),!0).forEach((function(t){ip(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):op(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o)):null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Eu,{children:[(0,e.jsxs)("div",{className:Qs("chat__container__header"),children:[(0,e.jsx)(rp,{}),i&&a&&(0,e.jsx)(Yu,{onClick:s})]}),t]}),(0,e.jsx)(Qu,{}),i&&(0,e.jsx)(xu,{})]})},ap=({originalError:t,title:n,message:r,buttonText:o,action:i,srText:s})=>{const a=Ki(),c=Vs(),{sendPolite:l}=ys(),u=Cs(),p="SeamlySessionExpiredError"===t.name;return(0,_e.useEffect)((()=>{p&&a[i]&&a[i]()}),[i,a,p]),(0,_e.useEffect)((()=>{!p&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,p]),p?(0,e.jsx)(e.Fragment,{}):(0,e.jsx)("section",{className:Qs("interrupt"),"aria-labelledby":c,children:(0,e.jsxs)("div",{className:Qs("interrupt__body"),children:[(0,e.jsx)("h2",{id:c,className:Qs("interrupt__title"),children:n}),(0,e.jsx)("p",{className:Qs("interrupt__message"),children:r}),o&&i&&(0,e.jsx)("div",{className:Qs("interrupt__actions"),children:(0,e.jsx)("button",{type:"button",className:Qs("button","button--primary"),onClick:()=>{a[i]&&a[i](),u()},children:o})})]})})};function cp({event:t}){const[n]=Cl(t);return(0,e.jsx)(n,{event:t})}function lp(){const{preChatEvents:t,layoutMode:n}=br(),{hasInterrupt:r}=yl(),{isOpen:o}=Fi(),i=!(r||!t?.length||o);return i&&(0,e.jsx)("ul",{className:Qs("pre-chat-messages",`pre-chat-messages--${n}`),"aria-hidden":!i,children:t.map((t=>(0,e.jsx)("li",{className:Qs("pre-chat-messages__message"),children:(0,e.jsx)(cp,{event:t})},t.payload.id)))})}function up(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 pp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dp=()=>{const t=mr(),n=Pr(),{hasInterrupt:r}=yl(),o=n&&!r,i=o?n.avatar:t;return i?(0,e.jsx)("img",{className:Qs(o?"avatar":"icon"),src:i,alt:""}):(0,e.jsx)(ba,{name:"avatar",size:"32"})},fp=({onClick:t})=>{const n=Vi(),{t:r}=fs(),o=n()?r("window.openButton.srContinue"):r("window.openButton.srStart"),i=Cs(),{isOpen:s}=Fi(),a=Cr(),c=(0,_e.useCallback)((()=>{t(),i()}),[i,t]);return(0,e.jsx)(Dl,{isActive:!s,transitionStartState:Il,children:(0,e.jsxs)("button",{className:Qs("window-open-button"),"aria-label":o,"aria-hidden":s,onClick:c,children:[(0,e.jsx)("span",{className:Qs("message-count"),"aria-hidden":"true",children:!!a&&a}),(0,e.jsx)(dp,{})]})})},hp={app:()=>(0,e.jsx)(Ul,{children:(0,e.jsx)(sp,{interruptComponent:ap,children:(0,e.jsx)(Tl,{})})}),inline:()=>{const{showInlineView:t,containerRef:n}=$i(),{isOpen:r}=Fi(),{hasInterrupt:o,meta:i}=yl();return o&&!r?(0,e.jsx)(ap,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?up(Object(n),!0).forEach((function(t){pp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):up(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},i)):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Dl,{isActive:!r,transitionStartState:Il,children:(0,e.jsxs)("div",{ref:n,className:Qs("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,e.jsx)(lp,{}),(0,e.jsx)(Ml,{})]})}),(0,e.jsx)(Dl,{isActive:r,transitionStartState:Il,children:(0,e.jsx)(Ul,{ref:n,children:t&&(0,e.jsx)(sp,{interruptComponent:ap,children:r&&(0,e.jsx)(Tl,{})})})})]})},window:()=>{const{isOpen:t,openChat:n}=Fi(),r=Br(),{t:o}=fs(),i=o("window.chat.continue"),s=(0,_e.useMemo)((()=>({payload:{body:{text:i}}})),[i]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(fp,{onClick:n}),(0,e.jsx)(Dl,{isActive:!t&&!r,transitionStartState:Il,children:(0,e.jsx)("div",{className:Qs("unstarted-wrapper","unstarted-wrapper--window"),children:(0,e.jsx)(lp,{})})}),(0,e.jsx)(Dl,{isActive:!t&&r,transitionStartState:Nl,children:(0,e.jsx)("div",{className:Qs("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,e.jsx)(Hc,{event:s})})}),(0,e.jsx)(Dl,{isActive:t,transitionStartState:Nl,children:(0,e.jsx)(Ul,{children:(0,e.jsx)(sp,{interruptComponent:ap,children:(0,e.jsx)(Tl,{})})})})]})}},yp=({children:t})=>{const[,n]=xs(),{namespace:r,layoutMode:o,zIndex:i}=br(),{isOpen:s,isVisible:a}=Fi(),c=gs(),l=Br(),{locale:u}=fs(),p=hp[o],d=(0,_e.useCallback)((e=>{n(e)}),[n]),f=(0,_e.useMemo)((()=>{if(u&&document.querySelector("html").getAttribute("lang")!==u)return u}),[u]);if(!p)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const h=["app",`app--layout-${o}`,`namespace--${r}`,...c];return s||"app"===o||h.push("app--collapsed"),l&&h.push("app--user-responded"),a&&(0,e.jsx)("div",{className:Qs(h),lang:f,tabIndex:"-1","data-nosnippet":!0,style:{zIndex:i},ref:d,children:t||(0,e.jsx)(p,{})})};function bp(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 mp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bp(Object(n),!0).forEach((function(t){vp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const gp=t=>(0,e.jsx)(Ol,mp(mp({},t),{},{children:(0,e.jsx)(yp,{})}));var wp=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};class Op{constructor(e,t){const{namespace:n="",parentElement:r,showFaq:o}=e,i=wp(e,["namespace","parentElement","showFaq"]);this.config=Object.assign(Object.assign({},i),{namespace:n,showFaq:!1!==o}),this.namespace=n,this.parentElement=r,this.externalApi=t,this.api=new we({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(je()),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)))}render(){return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const t=this.config.customComponents||{},{view:n}=t,r=wp(t,["view"]),o=Object.assign(Object.assign({},this.config),{customComponents:Object.keys(r).length?r:void 0}),i=function({initialState:e,api:t,eventBus:n,config:r}){return $n({reducer:{state:Bo,app:Vr,config:Ko,i18n:fi,translations:Ii,visibility:Li,forms:li,interrupt:Jr},preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat([Yo({api:t}),yi({api:t}),gi({api:t}),Ri])})}({api:this.api,eventBus:this.eventBus,config:o,initialState:void 0});i.dispatch(qo(o)),yield i.dispatch(rr());try{const{locale:e}=yield i.dispatch(Ur()).unwrap();yield i.dispatch(ir(e))}catch(e){}i.dispatch(Mr()),n?(0,xe.render)((0,e.jsx)(Ol,Object.assign({eventBus:this.eventBus,store:i,api:this.api},{children:(0,e.jsx)(n,{})})),this.parentElement):(0,xe.render)((0,e.jsx)(gp,{config:o,eventBus:this.eventBus,store:i,api:this.api}),this.parentElement)}))}destroy(){(0,xe.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),delete 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))}}function jp(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 xp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jp(Object(n),!0).forEach((function(t){_p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cp=e=>"object"==typeof e&&"action"in e,Sp=e=>xp(xp({},e),{},{args:Array.isArray(e.args)?e.args:[e.args]}),Ep=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(Cp).map(Sp)).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)}}))}setContext(e,t){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.translationLocale=r),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables=xp({},t)),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace:o}=n||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==r&&e.namespace!==o||this.destroy(e)})):this.destroy(),n){const e=this.createInstance(n);this._instances[n.namespace]=e,this.context={},e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,o=Object.values(this._instances);return!n&&o.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),o.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new Op(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=xp(xp({},e.context||this.appConfig.context),this.context),n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r=xp(xp({},this.appConfig.defaults),e.defaults),o=xp(xp(xp({},this.appConfig),e),{},{api:xp(xp({},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(o):o}getMergedVariables(e){return xp(xp(xp({},this.appConfig.context?.variables||{}),e.context?.variables||{}),this.context.variables||{})}},Pp=({onOpenChat:t})=>{const{t:n}=fs(),r=Vs(),{isOpen:o}=Fi(),i=(0,_e.useRef)(null),s=(0,_e.useRef)(null),a=(0,_e.useRef)(),c=Cs(),l=(()=>{const e=(0,_e.useRef)(null),[t]=xs();return e.current=t,(0,_e.useCallback)((t=>{O(e.current,(()=>{js(t)}))}),[])})(),u=Pr(),p=_r().subTitle,{hasInterrupt:d}=yl(),{headerCollapseButtonId:f}=gr(),h=u&&!d;return(0,_e.useLayoutEffect)((()=>{!1===o&&!0===i.current&&l(s.current),i.current=o}),[o,l]),(0,e.jsxs)("div",{className:Qs("toggle-button"),children:[(0,e.jsxs)("div",{id:r,children:[(0,e.jsx)("p",{className:Qs("toggle-button__title"),children:n(h?"toggleButton.resumeTitle":"toggleButton.title")}),(0,e.jsx)("p",{className:Qs("toggle-button__subtitle"),children:h?p:n("toggleButton.subtitle")})]}),(0,e.jsx)("button",{type:"button","aria-labelledby":r,className:Qs("toggle-button__button"),ref:s,onMouseUp:()=>{a.current="mouse"},onKeyUp:()=>{a.current="key"},onClick:()=>{t(),"mouse"===a.current?c():"key"===a.current&&l(f)}})]})},Tp=()=>{const{t}=fs(),{title:n,subTitle:r}=_r(),o=Cr(),{isOpen:i}=Fi(),s=Pr(),{hasInterrupt:a}=yl(),c=mr(),l=s?.avatar??c,u=a?"":r,p=["message-count"];return i&&p.push("message-count__hide"),0===o&&p.push("message-count__empty"),(u||!i)&&(0,e.jsxs)("div",{className:Qs("agent-info"),children:[(0,e.jsxs)("div",{className:Qs("agent-info__graphic"),children:[l?(0,e.jsx)("img",{className:Qs(s?.avatar?"avatar":"icon"),src:l,alt:""}):(0,e.jsx)(ba,{name:"avatar",size:"32"}),(0,e.jsx)("span",{className:Qs(p),"aria-hidden":"true",children:o})]}),(0,e.jsxs)("div",{className:Qs("agent-info__body"),children:[(0,e.jsx)("p",{className:Qs("agent-info__heading"),children:n??t("header.title")}),(0,e.jsx)("p",{className:Qs("agent-info__text"),children:u})]})]})},kp=({children:t,onCloseChat:n})=>{const{headerCollapseButtonId:r}=gr(),o=(0,_e.useRef)(null),{t:i}=fs();return(0,e.jsxs)("header",{className:Qs("chat__header"),children:[t,(0,e.jsx)("div",{className:Qs("header-controls"),children:(0,e.jsx)("button",{type:"button",className:Qs("button","header-controls__collapse"),onClick:n,ref:o,id:r,children:(0,e.jsx)(ba,{name:"chevronDown",size:"32",alt:i("header.collapseApp")})})})]})};function Ap(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 Np(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ip=function({children:t,interruptComponent:n}){const{hasInterrupt:r,meta:o}=yl(),{isOpen:i}=Fi();return r?i?(0,e.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ap(Object(n),!0).forEach((function(t){Np(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ap(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o)):null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Eu,{children:[(0,e.jsx)("div",{className:Qs("chat__container__header"),children:(0,e.jsx)(rp,{})}),t]}),(0,e.jsx)(Qu,{}),i&&(0,e.jsx)(xu,{})]})},Rp=["categories"];function Dp(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 Mp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dp(Object(n),!0).forEach((function(t){Lp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Up=()=>{const{t}=fs(),{sendAction:n,addMessageBubble:r}=Ki(),o=Vs(),i=Cs(),{sendPolite:s}=ys(),{hasInterrupt:a}=yl(),{hasCountdown:c,endCountdown:l}=zs(),{hasPrompt:u,continueChat:p}=Hs(),d=Tr("suggestion"),{body:f}=Ks({payload:d}),h=(0,_e.useMemo)((()=>(d&&!a?f:[]).map((e=>{let{categories:t=[]}=e;return Mp(Mp({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Rp)),{},{categories:t,classNames:["faqs__item",...t.map((e=>`faqs__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`))]})}))),[d,a,f]),y=(0,_e.useRef)(null),b=(0,_e.useRef)(!1),{isInline:m}=kr(),v=Br(),g=!m&&v,w=(0,_e.useRef)(g),j=!!h.length,x=j&&!g,_=(0,_e.useRef)([]),C=j?h:_.current;_.current=C;const S=(0,_e.useRef)(null);(0,_e.useEffect)((()=>{if(y.current!==h&&!g){if(j){const e=b.current?t("faq.srUpdatedText"):t("faq.srAvailableText");setTimeout((()=>{s(e)}),30)}else b.current&&s(t("faq.srUnavailableText"));y.current=h}!w.current&&g?(O(S.current,i),s(t("faq.srUnavailableText"))):!j&&b.current&&O(S.current,i),b.current=j,w.current=g}),[j,h,g,i,s,t]);const E=t("faq.headingText"),P=E?"section":"div";return(0,e.jsx)(Dl,{isActive:x,transitionStartState:Nl,children:(0,e.jsxs)(P,{className:Qs("faqs"),"aria-labelledby":E?o:null,ref:S,children:[E&&(0,e.jsx)("h2",{id:o,className:Qs("faqs__heading"),children:E}),!!C.length&&(0,e.jsx)("ul",{className:Qs("faqs__list"),children:C.map((t=>(0,e.jsx)("li",{className:Qs(t.classNames),children:(0,e.jsxs)("button",{type:"button",onClick:()=>{(({id:e,question:t})=>{c&&l(!0),u&&p(),n({type:Ze,originMessage:d.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),r(t),i()})(t)},className:Qs("button","button--secondary"),children:[(0,e.jsx)(ba,{name:"chevronRight",size:"8"}),t.question]})},t.id.toString())))})]})})},Fp=({children:t})=>{const[,n]=xs(),{isOpen:r,isVisible:o,setVisibility:i}=Fi(),{zIndex:s,showFaq:a,layoutMode:c}=br(),{isInline:l}=kr(),u=gs(),p=Br(),{locale:d}=fs(),f=(0,_e.useCallback)((e=>{n(e)}),[n]),h=(0,_e.useMemo)((()=>{if(d&&document.querySelector("html").getAttribute("lang")!==d)return d}),[d]),y=["app","app--deprecated",...u];return r||"window"!==c||y.push("app--collapsed"),p&&y.push("app--user-responded"),y.push(`app--layout-${c}`),o&&(0,e.jsxs)("section",{className:Qs(y),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&r&&i(hr.minimized)},lang:h,tabIndex:"-1",ref:f,style:{zIndex:s},"data-nosnippet":!0,children:[(0,e.jsx)("div",{className:Qs("app-wrapper"),children:t}),a&&(0,e.jsx)(Up,{})]})},Bp=({children:t})=>{const{showInlineView:n,containerRef:r}=$i();return(0,e.jsx)("div",{ref:r,children:n&&t})},$p=()=>{bs();const{isVisible:t,openChat:n,closeChat:r}=Fi();return t&&(0,e.jsx)(Bp,{children:(0,e.jsxs)(Fp,{children:[(0,e.jsx)(Pp,{onOpenChat:n}),(0,e.jsx)(kp,{onCloseChat:r,children:(0,e.jsx)(Tp,{})}),(0,e.jsx)(Ip,{interruptComponent:ap,children:(0,e.jsx)(Tl,{})})]})})},zp=()=>{const e=He();return{addEvent:t=>e(ro(t)),clearEvents:()=>e(io()),setHistory:t=>e(_o(t)),setEventsRead:t=>e(go(t)),setLoadedImageEventIds:t=>e(Eo(t)),ackEvent:t=>e(no(t)),setIsLoading:t=>e(So(t)),setParticipant:t=>e(Po(t)),setHeaderTitle:t=>e(xo(t)),setHeaderSubTitle:t=>e(jo(t)),resetHistoryLoadedFlag:()=>e(yo()),setActiveService:()=>e(mo()),initIdleDetachCountdown:t=>e(po(t)),decrementIdleDetachCountdownCounter:()=>e(lo()),stopIdleDetachCountdownCounter:()=>e(Fo()),clearIdleDetachCountdown:()=>e(ao()),initResumeConversationPrompt:()=>e(fo()),clearResumeConversationPrompt:()=>e(co()),setServiceDataItem:t=>e(ko(t)),setFeatures:t=>e(Oo(t)),setFeatureEnabledState:t=>e(wo(t)),clearFeatures:()=>e(so()),setInitialState:t=>e(Co(t)),setUserSelectedOptions:t=>e(Lo(t)),setUserSelectedOption:t=>e(Mo(t)),showOption:t=>e(Uo(t)),hideOption:()=>e(uo()),setServiceEntryMetadata:t=>e(Ao(t)),setBlockAutoEntrySwitch:t=>e(vo(t)),setActiveEntryType:t=>e(bo(t)),setUserEntryType:t=>e(Do(t)),registerUpload:t=>e(ho(t)),setUploadProgress:t=>e(Ro(t)),setUploadComplete:t=>e(No(t)),setUploadError:t=>e(Io(t)),clearAllUploads:()=>e(oo()),setSeamlyContainerElement:t=>e(To(t))}},Hp=function(e){if(window.seamly&&!Array.isArray(window.seamly))throw new Error("Seamly UI has already been initialised. Use the window.seamly object to start new instances instead.");const t=Array.isArray(window.seamly)?window.seamly:[],n=new Ep(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();