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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.min.js.LICENSE.txt */
2
- (()=>{var e={34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},81:(e,t,n)=>{"use strict";var r=n(9565),o=n(9306),s=n(8551),a=n(6823),i=n(851),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?i(e):t;if(o(n))return s(r(n,e));throw new c(a(e)+" is not iterable")}},116:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;return s(t,(function(t,r){if(e(t,n++))return r(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),s=n(4901),a=n(9297),i=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,p=u.get,f=String,h=Object.defineProperty,m=r("".slice),y=r("".replace),v=r([].join),g=i&&!o((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===m(f(t),0,7)&&(t="["+y(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(i?h(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?i&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return a(r,"source")||(r.source=v(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return s(this)&&p(this).source||l(this)}),"toString")},350:(e,t,n)=>{"use strict";var r=n(3724),o=n(9297),s=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,i=o(s,"name"),c=i&&"something"===function(){}.name,l=i&&(!r||r&&a(s,"name").configurable);e.exports={EXISTS:i,PROPER:c,CONFIGURABLE:l}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},421:e=>{"use strict";e.exports={}},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var o,s,a=n?e:e.iterator,i=e.next;!(o=r(i,a)).done;)if(void 0!==(s=t(o.value)))return s}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},679:(e,t,n)=>{"use strict";var r=n(1625),o=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new o("Incorrect invocation")}},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},757:(e,t,n)=>{"use strict";var r=n(7751),o=n(4901),s=n(1625),a=n(7040),i=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&s(t.prototype,i(e))}},851:(e,t,n)=>{"use strict";var r=n(6955),o=n(5966),s=n(4117),a=n(6269),i=n(8227)("iterator");e.exports=function(e){if(!s(e))return o(e,i)||o(e,"@@iterator")||a[r(e)]}},1072:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727);e.exports=Object.keys||function(e){return r(e,o)}},1148:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;return!s(t,(function(t,r){if(!e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1162:e=>{"use strict";e.exports=require("preact/hooks")},1181:(e,t,n)=>{"use strict";var r,o,s,a=n(8622),i=n(4576),c=n(34),l=n(6699),u=n(9297),d=n(7629),p=n(6119),f=n(421),h="Object already initialized",m=i.TypeError,y=i.WeakMap;if(a||d.state){var v=d.state||(d.state=new y);v.get=v.get,v.has=v.has,v.set=v.set,r=function(e,t){if(v.has(e))throw new m(h);return t.facade=e,v.set(e,t),t},o=function(e){return v.get(e)||{}},s=function(e){return v.has(e)}}else{var g=p("state");f[g]=!0,r=function(e,t){if(u(e,g))throw new m(h);return t.facade=e,l(e,g,t),t},o=function(e){return u(e,g)?e[g]:{}},s=function(e){return u(e,g)}}e.exports={set:r,get:o,has:s,enforce:function(e){return s(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},1454:(e,t,n)=>{"use strict";n(1701)},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1698:(e,t,n)=>{"use strict";var r=n(6518),o=n(4204);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("union")},{union:o})},1701:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(9306),a=n(8551),i=n(1767),c=n(9462),l=n(6319),u=n(9539),d=n(4549),p=n(6395),f=!p&&d("map",TypeError),h=c((function(){var e=this.iterator,t=a(o(this.next,e));if(!(this.done=!!t.done))return l(e,this.mapper,[t.value,this.counter++],!0)}));r({target:"Iterator",proto:!0,real:!0,forced:p||f},{map:function(e){a(this);try{s(e)}catch(e){u(this,"throw",e)}return f?o(f,this,e):new h(i(this),{mapper:e})}})},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},1828:(e,t,n)=>{"use strict";var r=n(9504),o=n(9297),s=n(5397),a=n(9617).indexOf,i=n(421),c=r([].push);e.exports=function(e,t){var n,r=s(e),l=0,u=[];for(n in r)!o(i,n)&&o(r,n)&&c(u,n);for(;t.length>l;)o(r,n=t[l++])&&(~a(u,n)||c(u,n));return u}},2086: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 s=t[r]||n,a=s.length=o?s.length:0;a--;)o==s[a][0]&&s.splice(a,1);return e},e.emit=function(r){for(var o,s=t[r]||n,a=s.length>0?s.slice(0,s.length):s,i=0;o=a[i++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},2106:(e,t,n)=>{"use strict";var r=n(283),o=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),o.f(e,t,n)}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},2195:(e,t,n)=>{"use strict";var r=n(9504),o=r({}.toString),s=r("".slice);e.exports=function(e){return s(o(e),8,-1)}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2360:(e,t,n)=>{"use strict";var r,o=n(8551),s=n(6801),a=n(8727),i=n(421),c=n(397),l=n(4055),u=n(6119),d="prototype",p="script",f=u("IE_PROTO"),h=function(){},m=function(e){return"<"+p+">"+e+"</"+p+">"},y=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;v="undefined"!=typeof document?document.domain&&r?y(r):(t=l("iframe"),n="java"+p+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):y(r);for(var o=a.length;o--;)delete v[d][a[o]];return v()};i[f]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[d]=o(e),n=new h,h[d]=null,n[f]=e):n=v(),void 0===t?n:s.f(n,t)}},2475:(e,t,n)=>{"use strict";var r=n(6518),o=n(8527);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSupersetOf",(function(e){return!e}))},{isSupersetOf:o})},2489:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(9306),a=n(8551),i=n(1767),c=n(9462),l=n(6319),u=n(6395),d=n(9539),p=n(4549),f=!u&&p("filter",TypeError),h=c((function(){for(var e,t,n=this.iterator,r=this.predicate,s=this.next;;){if(e=a(o(s,n)),this.done=!!e.done)return;if(t=e.value,l(n,r,[t,this.counter++],!0))return t}}));r({target:"Iterator",proto:!0,real:!0,forced:u||f},{filter:function(e){a(this);try{s(e)}catch(e){d(this,"throw",e)}return f?o(f,this,e):new h(i(this),{predicate:e})}})},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},2577:(e,t,n)=>{"use strict";n(116)},2652:(e,t,n)=>{"use strict";var r=n(6080),o=n(9565),s=n(8551),a=n(6823),i=n(4209),c=n(6198),l=n(1625),u=n(81),d=n(851),p=n(9539),f=TypeError,h=function(e,t){this.stopped=e,this.result=t},m=h.prototype;e.exports=function(e,t,n){var y,v,g,b,x,w,_,C=n&&n.that,E=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),j=!(!n||!n.IS_ITERATOR),T=!(!n||!n.INTERRUPTED),N=r(t,C),I=function(e){return y&&p(y,"normal",e),new h(!0,e)},k=function(e){return E?(s(e),T?N(e[0],e[1],I):N(e[0],e[1])):T?N(e,I):N(e)};if(S)y=e.iterator;else if(j)y=e;else{if(!(v=d(e)))throw new f(a(e)+" is not iterable");if(i(v)){for(g=0,b=c(e);b>g;g++)if((x=k(e[g]))&&l(m,x))return x;return new h(!1)}y=u(e,v)}for(w=S?e.next:y.next;!(_=o(w,y)).done;){try{x=k(_.value)}catch(e){p(y,"throw",e)}if("object"==typeof x&&x&&l(m,x))return x}return new h(!1)}},2777:(e,t,n)=>{"use strict";var r=n(9565),o=n(34),s=n(757),a=n(5966),i=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var n,c=a(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||s(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),i(e,t)}},2787:(e,t,n)=>{"use strict";var r=n(9297),o=n(4901),s=n(8981),a=n(6119),i=n(2211),c=a("IE_PROTO"),l=Object,u=l.prototype;e.exports=i?l.getPrototypeOf:function(e){var t=s(e);if(r(t,c))return t[c];var n=t.constructor;return o(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},2796:(e,t,n)=>{"use strict";var r=n(9039),o=n(4901),s=/#|\.prototype\./,a=function(e,t){var n=c[i(e)];return n===u||n!==l&&(o(t)?r(t):!!t)},i=a.normalize=function(e){return String(e).replace(s,".").toLowerCase()},c=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},2839:(e,t,n)=>{"use strict";var r=n(4576).navigator,o=r&&r.userAgent;e.exports=o?String(o):""},3215:(e,t,n)=>{"use strict";n(1148)},3375:(e,t,n)=>{"use strict";n(7642)},3392:(e,t,n)=>{"use strict";var r=n(9504),o=0,s=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+s,36)}},3440:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402),s=n(9286),a=n(5170),i=n(3789),c=n(8469),l=n(507),u=o.has,d=o.remove;e.exports=function(e){var t=r(this),n=i(e),o=s(t);return a(t)<=n.size?c(t,(function(e){n.includes(e)&&d(o,e)})):l(n.getIterator(),(function(e){u(t,e)&&d(o,e)})),o}},3579:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;return s(t,(function(t,r){if(e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3650:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402),s=n(9286),a=n(3789),i=n(507),c=o.add,l=o.has,u=o.remove;e.exports=function(e){var t=r(this),n=a(e).getIterator(),o=s(t);return i(n,(function(e){l(t,e)?u(o,e):c(o,e)})),o}},3706:(e,t,n)=>{"use strict";var r=n(9504),o=n(4901),s=n(7629),a=r(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return a(e)}),e.exports=s.inspectSource},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3789:(e,t,n)=>{"use strict";var r=n(9306),o=n(8551),s=n(9565),a=n(1291),i=n(1767),c="Invalid size",l=RangeError,u=TypeError,d=Math.max,p=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return i(o(s(this.keys,this.set)))},includes:function(e){return s(this.has,this.set,e)}},e.exports=function(e){o(e);var t=+e.size;if(t!=t)throw new u(c);var n=a(t);if(n<0)throw new l(c);return new p(e,n)}},3838:(e,t,n)=>{"use strict";var r=n(7080),o=n(5170),s=n(8469),a=n(3789);e.exports=function(e){var t=r(this),n=a(e);return!(o(t)>n.size)&&!1!==s(t,(function(e){if(!n.includes(e))return!1}),!0)}},3853:(e,t,n)=>{"use strict";var r=n(6518),o=n(4449);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isDisjointFrom",(function(e){return!e}))},{isDisjointFrom:o})},3949:(e,t,n)=>{"use strict";n(7588)},3972:(e,t,n)=>{"use strict";n(3853)},4055:(e,t,n)=>{"use strict";var r=n(4576),o=n(34),s=r.document,a=o(s)&&o(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},4114:(e,t,n)=>{"use strict";var r=n(6518),o=n(8981),s=n(6198),a=n(4527),i=n(6837);r({target:"Array",proto:!0,arity:1,forced:n(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=o(this),n=s(t),r=arguments.length;i(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return a(t,n),n}})},4117:e=>{"use strict";e.exports=function(e){return null==e}},4204:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402).add,s=n(9286),a=n(3789),i=n(507);e.exports=function(e){var t=r(this),n=a(e).getIterator(),c=s(t);return i(n,(function(e){o(c,e)})),c}},4209:(e,t,n)=>{"use strict";var r=n(8227),o=n(6269),s=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[s]===e)}},4270:(e,t,n)=>{"use strict";var r=n(9565),o=n(4901),s=n(34),a=TypeError;e.exports=function(e,t){var n,i;if("string"===t&&o(n=e.toString)&&!s(i=r(n,e)))return i;if(o(n=e.valueOf)&&!s(i=r(n,e)))return i;if("string"!==t&&o(n=e.toString)&&!s(i=r(n,e)))return i;throw new a("Can't convert object to primitive value")}},4376:(e,t,n)=>{"use strict";var r=n(2195);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4402:(e,t,n)=>{"use strict";var r=n(9504),o=Set.prototype;e.exports={Set,add:r(o.add),has:r(o.has),remove:r(o.delete),proto:o}},4449:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402).has,s=n(5170),a=n(3789),i=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=a(e);if(s(t)<=n.size)return!1!==i(t,(function(e){if(n.includes(e))return!1}),!0);var u=n.getIterator();return!1!==c(u,(function(e){if(o(t,e))return l(u,"normal",!1)}))}},4495:(e,t,n)=>{"use strict";var r=n(9519),o=n(9039),s=n(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4520:(e,t,n)=>{"use strict";n(2489)},4527:(e,t,n)=>{"use strict";var r=n(3724),o=n(4376),s=TypeError,a=Object.getOwnPropertyDescriptor,i=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=i?function(e,t){if(o(e)&&!a(e,"length").writable)throw new s("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4549:(e,t,n)=>{"use strict";var r=n(4576);e.exports=function(e,t){var n=r.Iterator,o=n&&n.prototype,s=o&&o[e],a=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(e){e instanceof t||(a=!1)}if(!a)return s}},4576:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4659:(e,t,n)=>{"use strict";var r=n(3724),o=n(4913),s=n(6980);e.exports=function(e,t,n){r?o.f(e,t,s(0,n)):e[t]=n}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},4913:(e,t,n)=>{"use strict";var r=n(3724),o=n(5917),s=n(8686),a=n(8551),i=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",f="writable";t.f=r?s?function(e,t,n){if(a(e),t=i(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&f in n&&!n[f]){var r=u(e,t);r&&r[f]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(a(e),t=i(t),a(n),o)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},4916:(e,t,n)=>{"use strict";var r=n(7751),o=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(e){return{size:e,has:function(){return!0},keys:function(){throw new Error("e")}}};e.exports=function(e,t){var n=r("Set");try{(new n)[e](o(0));try{return(new n)[e](o(-1)),!1}catch(r){if(!t)return!0;try{return(new n)[e](s(-1/0)),!1}catch(r){var a=new n;return a.add(1),a.add(2),t(a[e](s(1/0)))}}}catch(e){return!1}}},5024:(e,t,n)=>{"use strict";var r=n(6518),o=n(3650);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("symmetricDifference")},{symmetricDifference:o})},5031:(e,t,n)=>{"use strict";var r=n(7751),o=n(9504),s=n(8480),a=n(3717),i=n(8551),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=s.f(i(e)),n=a.f;return n?c(t,n(e)):t}},5160:(e,t,n)=>{"use strict";var r=n(7402),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useSyncExternalStore,a=r.useRef,i=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=a(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c((function(){function e(e){if(!i){if(i=!0,s=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==u&&u(t,n)?(s=e,t):(s=e,a=n)}var s,a,i=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,u]);var f=s(e,d[0],d[1]);return i((function(){p.hasValue=!0,p.value=f}),[f]),l(f),f}},5170:(e,t,n)=>{"use strict";var r=n(6706),o=n(4402);e.exports=r(o.proto,"size","get")||function(e){return e.size}},5397:(e,t,n)=>{"use strict";var r=n(7055),o=n(7750);e.exports=function(e){return r(o(e))}},5610:(e,t,n)=>{"use strict";var r=n(1291),o=Math.max,s=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):s(n,t)}},5714:(e,t,n)=>{"use strict";n(2475)},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},5876:(e,t,n)=>{"use strict";var r=n(6518),o=n(3838);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSubsetOf",(function(e){return e}))},{isSubsetOf:o})},5917:(e,t,n)=>{"use strict";var r=n(3724),o=n(9039),s=n(4055);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},5966:(e,t,n)=>{"use strict";var r=n(9306),o=n(4117);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},6080:(e,t,n)=>{"use strict";var r=n(7476),o=n(9306),s=n(616),a=r(r.bind);e.exports=function(e,t){return o(e),void 0===t?e:s?a(e,t):function(){return e.apply(t,arguments)}}},6119:(e,t,n)=>{"use strict";var r=n(5745),o=n(3392),s=r("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},6197:(e,t,n)=>{"use strict";n(1698)},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},6269:e=>{"use strict";e.exports={}},6279:(e,t,n)=>{"use strict";var r=n(6840);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},6319:(e,t,n)=>{"use strict";var r=n(8551),o=n(9539);e.exports=function(e,t,n,s){try{return s?t(r(n)[0],n[1]):t(n)}catch(t){o(e,"throw",t)}}},6395:e=>{"use strict";e.exports=!1},6469:(e,t,n)=>{"use strict";var r=n(8227),o=n(2360),s=n(4913).f,a=r("unscopables"),i=Array.prototype;void 0===i[a]&&s(i,a,{configurable:!0,value:o(null)}),e.exports=function(e){i[a][e]=!0}},6518:(e,t,n)=>{"use strict";var r=n(4576),o=n(7347).f,s=n(6699),a=n(6840),i=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,p,f,h=e.target,m=e.global,y=e.stat;if(n=m?r:y?r[h]||i(h,{}):r[h]&&r[h].prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(f=o(n,u))&&f.value:n[u],!l(m?u:h+(y?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&s(p,"sham",!0),a(n,u,p,e)}}},6699:(e,t,n)=>{"use strict";var r=n(3724),o=n(4913),s=n(6980);e.exports=r?function(e,t,n){return o.f(e,t,s(1,n))}:function(e,t,n){return e[t]=n,e}},6706:(e,t,n)=>{"use strict";var r=n(9504),o=n(9306);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},6801:(e,t,n)=>{"use strict";var r=n(3724),o=n(8686),s=n(4913),a=n(8551),i=n(5397),c=n(1072);t.f=r&&!o?Object.defineProperties:function(e,t){a(e);for(var n,r=i(t),o=c(t),l=o.length,u=0;l>u;)s.f(e,n=o[u++],r[n]);return e}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},6840:(e,t,n)=>{"use strict";var r=n(4901),o=n(4913),s=n(283),a=n(9433);e.exports=function(e,t,n,i){i||(i={});var c=i.enumerable,l=void 0!==i.name?i.name:t;if(r(n)&&s(n,l,i),i.global)c?e[t]=n:a(t,n);else{try{i.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:o.f(e,t,{value:n,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e}},6955:(e,t,n)=>{"use strict";var r=n(2140),o=n(4901),s=n(2195),a=n(8227)("toStringTag"),i=Object,c="Arguments"===s(function(){return arguments}());e.exports=r?s:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=i(e),a))?n:c?s(t):"Object"===(r=s(t))&&o(t.callee)?"Arguments":r}},6969:(e,t,n)=>{"use strict";var r=n(2777),o=n(757);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7015:(e,t,n)=>{"use strict";var r=n(4576),o=n(9504);e.exports=function(e,t){return o(r[e].prototype[t])}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),s=n(2195),a=Object,i=r("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===s(e)?i(e,""):a(e)}:a},7080:(e,t,n)=>{"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),o=n(9565),s=n(8773),a=n(6980),i=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=i(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return a(!o(s.f,e,t),e[t])}},7402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>x,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>h,StrictMode:()=>ie,Suspense:()=>S,SuspenseList:()=>N,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>X,cloneElement:()=>ne,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>Q,createPortal:()=>L,createRef:()=>r.createRef,default:()=>le,findDOMNode:()=>oe,flushSync:()=>ae,forwardRef:()=>g,hydrate:()=>z,isElement:()=>ce,isFragment:()=>ee,isMemo:()=>te,isValidElement:()=>Z,lazy:()=>T,memo:()=>m,render:()=>F,startTransition:()=>u,unmountComponentAtNode:()=>re,unstable_batchedUpdates:()=>se,useDeferredValue:()=>d,useInsertionEffect:()=>f,useSyncExternalStore:()=>c,useTransition:()=>p,version:()=>Y});var r=n(8785),o=n(1162),s={};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","isElement","isFragment","isMemo","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(s[e]=()=>o[e]);function a(e,t){for(var n in t)e[n]=t[n];return e}function i(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){var n=t(),r=(0,o.useState)({t:{__:n,u:t}}),s=r[0].t,a=r[1];return(0,o.useLayoutEffect)((function(){s.__=n,s.u=t,l(s)&&a({t:s})}),[e,n,t]),(0,o.useEffect)((function(){return l(s)&&a({t:s}),e((function(){l(s)&&a({t:s})}))}),[e]),n}function l(e){var t,n,r=e.u,o=e.__;try{var s=r();return!((t=o)===(n=s)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}function u(e){e()}function d(e){return e}function p(){return[!1,u]}n.d(t,s);var f=o.useLayoutEffect;function h(e,t){this.props=e,this.context=t}function m(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:i(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}(h.prototype=new r.Component).isPureReactComponent=!0,h.prototype.shouldComponentUpdate=function(e,t){return i(this.props,e)||i(this.state,t)};var y=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),y&&y(e)};var v="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function g(e){function t(t){var n=a({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=v,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var b=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},x={map:b,forEach:b,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},w=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);w(e,t,n,r)};var _=r.options.unmount;function C(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=a({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return C(e,t,n)}))),e}function E(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return E(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function S(){this.__u=0,this.o=null,this.__b=null}function j(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function T(e){var t,n,o;function s(s){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,s)}return s.displayName="Lazy",s.__f=!0,s}function N(){this.i=null,this.l=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),_&&_(e)},(S.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var o=j(r.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(i):i())};n.__R=a;var i=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=E(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},S.prototype.componentWillUnmount=function(){this.o=[]},S.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]=C(this.__b,n,o.__O=o.__P)}this.__b=null}var s=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return s&&(s.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),s]};var I=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function k(e){return this.getChildContext=function(){return e.context},e.children}function O(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){(0,r.render)(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},appendChild:function(e){this.childNodes.push(e),t.h.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}(0,r.render)((0,r.createElement)(k,{context:t.context},e.__v),t.v)}function L(e,t){var n=(0,r.createElement)(O,{__v:e,h:t});return n.containerInfo=t,n}(N.prototype=new r.Component).__a=function(e){var t=this,n=j(t.__v),r=t.l.get(e);return r[0]++,function(o){var s=function(){t.props.revealOrder?(r.push(o),I(t,e,r)):o()};n?n(s):s()}},N.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},N.prototype.componentDidUpdate=N.prototype.componentDidMount=function(){var e=this;this.l.forEach((function(t,n){I(e,n,t)}))};var A="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,R=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,P=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,M=/[A-Z0-9]/g,D="undefined"!=typeof document,U=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function F(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function z(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 B=r.options.event;function V(){}function $(){return this.cancelBubble}function H(){return this.defaultPrevented}r.options.event=function(e){return B&&(e=B(e)),e.persist=V,e.isPropagationStopped=$,e.isDefaultPrevented=H,e.nativeEvent=e};var W,G={enumerable:!1,configurable:!0,get:function(){return this.class}},q=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},s=-1===n.indexOf("-");for(var a in t){var i=t[a];if(!("value"===a&&"defaultValue"in t&&null==i||D&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var c=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===i?i="":"translate"===c&&"no"===i?i=!1:"o"===c[0]&&"n"===c[1]?"ondoubleclick"===c?a="ondblclick":"onchange"!==c||"input"!==n&&"textarea"!==n||U(t.type)?"onfocus"===c?a="onfocusin":"onblur"===c?a="onfocusout":P.test(a)&&(a=c):c=a="oninput":s&&R.test(a)?a=a.replace(M,"-$&").toLowerCase():null===i&&(i=void 0),"oninput"===c&&o[a=c]&&(a="oninputCapture"),o[a]=i}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==n&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",G)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=A,q&&q(e)};var K=r.options.__r;r.options.__r=function(e){K&&K(e),W=e.__c};var J=r.options.diffed;r.options.diffed=function(e){J&&J(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),W=null};var X={ReactCurrentDispatcher:{current:{readContext:function(e){return W.__n[e.__c].props.value},useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,useDeferredValue:d,useEffect:o.useEffect,useId:o.useId,useImperativeHandle:o.useImperativeHandle,useInsertionEffect:f,useLayoutEffect:o.useLayoutEffect,useMemo:o.useMemo,useReducer:o.useReducer,useRef:o.useRef,useState:o.useState,useSyncExternalStore:c,useTransition:p}}},Y="18.3.1";function Q(e){return r.createElement.bind(null,e)}function Z(e){return!!e&&e.$$typeof===A}function ee(e){return Z(e)&&e.type===r.Fragment}function te(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function ne(e){return Z(e)?r.cloneElement.apply(null,arguments):e}function re(e){return!!e.__k&&((0,r.render)(null,e),!0)}function oe(e){return e&&(e.base||1===e.nodeType&&e)||null}var se=function(e,t){return e(t)},ae=function(e,t){return e(t)},ie=r.Fragment,ce=Z,le={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:f,useTransition:p,useDeferredValue:d,useSyncExternalStore:c,startTransition:u,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"18.3.1",Children:x,render:F,hydrate:z,unmountComponentAtNode:re,createPortal:L,createElement:r.createElement,createContext:r.createContext,createFactory:Q,cloneElement:ne,createRef:r.createRef,Fragment:r.Fragment,isValidElement:Z,isElement:ce,isFragment:ee,isMemo:te,findDOMNode:oe,Component:r.Component,PureComponent:h,memo:m,forwardRef:g,flushSync:ae,unstable_batchedUpdates:se,StrictMode:ie,Suspense:S,SuspenseList:N,lazy:T,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:X}},7476:(e,t,n)=>{"use strict";var r=n(2195),o=n(9504);e.exports=function(e){if("Function"===r(e))return o(e)}},7550:(e,t,n)=>{"use strict";n(3579)},7561:(e,t,n)=>{"use strict";n(5024)},7588:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("forEach",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;s(t,(function(t){e(t,n++)}),{IS_RECORD:!0})}})},7629:(e,t,n)=>{"use strict";var r=n(6395),o=n(4576),s=n(9433),a="__core-js_shared__",i=e.exports=o[a]||s(a,{});(i.versions||(i.versions=[])).push({version:"3.42.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})},7642:(e,t,n)=>{"use strict";var r=n(6518),o=n(3440);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("difference",(function(e){return 0===e.size}))},{difference:o})},7657:(e,t,n)=>{"use strict";var r,o,s,a=n(9039),i=n(4901),c=n(34),l=n(2360),u=n(2787),d=n(6840),p=n(8227),f=n(6395),h=p("iterator"),m=!1;[].keys&&("next"in(s=[].keys())?(o=u(u(s)))!==Object.prototype&&(r=o):m=!0),!c(r)||a((function(){var e={};return r[h].call(e)!==e}))?r={}:f&&(r=l(r)),i(r[h])||d(r,h,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},7740:(e,t,n)=>{"use strict";var r=n(9297),o=n(5031),s=n(7347),a=n(4913);e.exports=function(e,t,n){for(var i=o(t),c=a.f,l=s.f,u=0;u<i.length;u++){var d=i[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},7750:(e,t,n)=>{"use strict";var r=n(4117),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},7751:(e,t,n)=>{"use strict";var r=n(4576),o=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},8004:(e,t,n)=>{"use strict";var r=n(6518),o=n(9039),s=n(8750);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("intersection",(function(e){return 2===e.size&&e.has(1)&&e.has(2)}))||o((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:s})},8014:(e,t,n)=>{"use strict";var r=n(1291),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},8107:(e,t,n)=>{"use strict";var r=n(6518),o=n(8981),s=n(6198),a=n(1291),i=n(6469);r({target:"Array",proto:!0},{at:function(e){var t=o(this),n=s(t),r=a(e),i=r>=0?r:n+r;return i<0||i>=n?void 0:t[i]}}),i("at")},8111:(e,t,n)=>{"use strict";var r=n(6518),o=n(4576),s=n(679),a=n(8551),i=n(4901),c=n(2787),l=n(2106),u=n(4659),d=n(9039),p=n(9297),f=n(8227),h=n(7657).IteratorPrototype,m=n(3724),y=n(6395),v="constructor",g="Iterator",b=f("toStringTag"),x=TypeError,w=o[g],_=y||!i(w)||w.prototype!==h||!d((function(){w({})})),C=function(){if(s(this,h),c(this)===h)throw new x("Abstract class Iterator not directly constructable")},E=function(e,t){m?l(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new x("You can't redefine this property");p(this,e)?this[e]=t:u(this,e,t)}}):h[e]=t};p(h,b)||E(b,g),!_&&p(h,v)&&h[v]!==Object||E(v,C),C.prototype=h,r({global:!0,constructor:!0,forced:_},{Iterator:C})},8227:(e,t,n)=>{"use strict";var r=n(4576),o=n(5745),s=n(9297),a=n(3392),i=n(4495),c=n(7040),l=r.Symbol,u=o("wks"),d=c?l.for||l:l&&l.withoutSetter||a;e.exports=function(e){return s(u,e)||(u[e]=i&&s(l,e)?l[e]:d("Symbol."+e)),u[e]}},8237:(e,t,n)=>{"use strict";var r=n(6518),o=n(2652),s=n(9306),a=n(8551),i=n(1767),c=n(9539),l=n(4549),u=n(8745),d=n(9039),p=TypeError,f=d((function(){[].keys().reduce((function(){}),void 0)})),h=!f&&l("reduce",p);r({target:"Iterator",proto:!0,real:!0,forced:f||h},{reduce:function(e){a(this);try{s(e)}catch(e){c(this,"throw",e)}var t=arguments.length<2,n=t?void 0:arguments[1];if(h)return u(h,this,t?[e]:[e,n]);var r=i(this),l=0;if(o(r,(function(r){t?(t=!1,n=r):n=e(n,r,l),l++}),{IS_RECORD:!0}),t)throw new p("Reduce of empty iterator with no initial value");return n}})},8418:(e,t,n)=>{"use strict";e.exports=n(5160)},8469:(e,t,n)=>{"use strict";var r=n(9504),o=n(507),s=n(4402),a=s.Set,i=s.proto,c=r(i.forEach),l=r(i.keys),u=l(new a).next;e.exports=function(e,t,n){return n?o({iterator:l(e),next:u},t):c(e,t)}},8480:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},8527:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402).has,s=n(5170),a=n(3789),i=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=a(e);if(s(t)<n.size)return!1;var l=n.getIterator();return!1!==i(l,(function(e){if(!o(t,e))return c(l,"normal",!1)}))}},8551:(e,t,n)=>{"use strict";var r=n(34),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not an object")}},8622:(e,t,n)=>{"use strict";var r=n(4576),o=n(4901),s=r.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},8686:(e,t,n)=>{"use strict";var r=n(3724),o=n(9039);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8745:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype,s=o.apply,a=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(s):function(){return a.apply(s,arguments)})},8750:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402),s=n(5170),a=n(3789),i=n(8469),c=n(507),l=o.Set,u=o.add,d=o.has;e.exports=function(e){var t=r(this),n=a(e),o=new l;return s(t)>n.size?c(n.getIterator(),(function(e){d(t,e)&&u(o,e)})):i(t,(function(e){n.includes(e)&&u(o,e)})),o}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},8785:e=>{"use strict";e.exports=require("preact")},8872:(e,t,n)=>{"use strict";n(8237)},8981:(e,t,n)=>{"use strict";var r=n(7750),o=Object;e.exports=function(e){return o(r(e))}},8992:(e,t,n)=>{"use strict";n(8111)},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9209:(e,t,n)=>{"use strict";n(5876)},9225:(e,t,n)=>{"use strict";n(8004)},9286:(e,t,n)=>{"use strict";var r=n(4402),o=n(8469),s=r.Set,a=r.add;e.exports=function(e){var t=new s;return o(e,(function(e){a(t,e)})),t}},9297:(e,t,n)=>{"use strict";var r=n(9504),o=n(8981),s=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(o(e),t)}},9306:(e,t,n)=>{"use strict";var r=n(4901),o=n(6823),s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not a function")}},9433:(e,t,n)=>{"use strict";var r=n(4576),o=Object.defineProperty;e.exports=function(e,t){try{o(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},9462:(e,t,n)=>{"use strict";var r=n(9565),o=n(2360),s=n(6699),a=n(6279),i=n(8227),c=n(1181),l=n(5966),u=n(7657).IteratorPrototype,d=n(2529),p=n(9539),f=i("toStringTag"),h="IteratorHelper",m="WrapForValidIterator",y=c.set,v=function(e){var t=c.getterFor(e?m:h);return a(o(u),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return d(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:d(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),o=n.iterator;if(n.done=!0,e){var s=l(o,"return");return s?r(s,o):d(void 0,!0)}if(n.inner)try{p(n.inner.iterator,"normal")}catch(e){return p(o,"throw",e)}return o&&p(o,"normal"),d(void 0,!0)}})},g=v(!0),b=v(!1);s(b,f,"Iterator Helper"),e.exports=function(e,t,n){var r=function(r,o){o?(o.iterator=r.iterator,o.next=r.next):o=r,o.type=t?m:h,o.returnHandlerResult=!!n,o.nextHandler=e,o.counter=0,o.done=!1,y(this,o)};return r.prototype=t?g:b,r}},9497:(e,t,n)=>{"use strict";n(8107);var r=n(7015);e.exports=r("Array","at")},9504:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype,s=o.call,a=r&&o.bind.bind(s,s);e.exports=r?a:function(e){return function(){return s.apply(e,arguments)}}},9519:(e,t,n)=>{"use strict";var r,o,s=n(4576),a=n(2839),i=s.process,c=s.Deno,l=i&&i.versions||c&&c.version,u=l&&l.v8;u&&(o=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},9539:(e,t,n)=>{"use strict";var r=n(9565),o=n(8551),s=n(5966);e.exports=function(e,t,n){var a,i;o(e);try{if(!(a=s(e,"return"))){if("throw"===t)throw n;return n}a=r(a,e)}catch(e){i=!0,a=e}if("throw"===t)throw n;if(i)throw a;return o(a),n}},9565:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},9617:(e,t,n)=>{"use strict";var r=n(5397),o=n(5610),s=n(6198),a=function(e){return function(t,n,a){var i=r(t),c=s(i);if(0===c)return!e&&-1;var l,u=o(a,c);if(e&&n!=n){for(;c>u;)if((l=i[u++])!=l)return!0}else for(;c>u;u++)if((e||u in i)&&i[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>q,AgentInfo:()=>al,Chat:()=>Wi,ChatFrame:()=>Dc,ComponentFilter:()=>Ja,Conversation:()=>Ri,Engine:()=>Yc,EntryContainer:()=>Rc,EventParticipant:()=>Us,ExternalApi:()=>el,Header:()=>il,Icon:()=>$s,Interrupt:()=>Mc,MessageContainer:()=>Fs,SeamlyActivityEventContext:()=>Ls,SeamlyActivityMonitor:()=>Xa,SeamlyApiContext:()=>Yo,SeamlyEventBusContext:()=>Qo,SeamlyFileUpload:()=>Za,SeamlyGeneralError:()=>x,SeamlyLiveRegionContext:()=>os,SeamlyOfflineError:()=>Kn,SeamlyStoreProvider:()=>Ht,Text:()=>Ha,TextEntry:()=>jc,Upload:()=>Lc,View:()=>Jc,appReducer:()=>qn,appStorageProvider:()=>nl,calculateVisibility:()=>At,className:()=>Cs,configReducer:()=>$n,cookieStorageProvider:()=>sl,default:()=>fl,eventTypes:()=>E,formsReducer:()=>ir,getSearchParamsByKeys:()=>ul,getUrlSearchParams:()=>cl,getUrlSearchString:()=>ll,i18nReducer:()=>fr,initResetSearchParams:()=>pl,interruptReducer:()=>br,randomId:()=>$,replaceSearchParams:()=>dl,sessionStorageProvider:()=>C,setConfig:()=>zn,setInitialLocale:()=>dr,setParticipant:()=>Qr,setPreChatEvents:()=>Vn,setTranslations:()=>pr,stateReducer:()=>mo,timeout:()=>hs,translationReducer:()=>jo,useChoicePrompt:()=>Qs,useEvents:()=>vn,useGeneratedId:()=>Ms,useI18n:()=>qo,useSeamlyActions:()=>tl,useSeamlyChat:()=>ls,useSeamlyCommands:()=>rs,useSeamlyConfig:()=>en,useSeamlyEventStream:()=>Ds,useSeamlyIdleDetachCountdown:()=>Rs,useSeamlyMessageContainerClassNames:()=>Ss,useSeamlyOptions:()=>ks,useSeamlyVisibility:()=>Ko,useTranslatedEventData:()=>xs,useTranslations:()=>bs,useTranslationsContainer:()=>ws,visibilityReducer:()=>Io,visibilityStates:()=>Ot}),n(9497),n(4114),n(8992),n(4520),n(3949),n(1454),n(7550);var e=n(2086),t=n.n(e),o=n(8785),s=(n(3375),n(9225),n(3972),n(9209),n(5714),n(7561),n(6197),function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},s(e,t)});function a(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return a}var c=function(e,t){this.target=t,this.type=e},l=function(e){function t(t,n){var r=e.call(this,"error",n)||this;return r.message=t.message,r.error=t,r}return a(t,e),t}(c),u=function(e){function t(t,n,r){void 0===t&&(t=1e3),void 0===n&&(n="");var o=e.call(this,"close",r)||this;return o.wasClean=!0,o.code=t,o.reason=n,o}return a(t,e),t}(c),d=function(){if("undefined"!=typeof WebSocket)return WebSocket},p={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},f=function(){function e(e,t,n){var r=this;void 0===n&&(n={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(e){r._debug("open event");var t=r._options.minUptime,n=void 0===t?p.minUptime:t;clearTimeout(r._connectTimeout),r._uptimeTimeout=setTimeout((function(){return r._acceptOpen()}),n),r._ws.binaryType=r._binaryType,r._messageQueue.forEach((function(e){return r._ws.send(e)})),r._messageQueue=[],r.onopen&&r.onopen(e),r._listeners.open.forEach((function(t){return r._callEventListener(e,t)}))},this._handleMessage=function(e){r._debug("message event"),r.onmessage&&r.onmessage(e),r._listeners.message.forEach((function(t){return r._callEventListener(e,t)}))},this._handleError=function(e){r._debug("error event",e.message),r._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),r.onerror&&r.onerror(e),r._debug("exec error listeners"),r._listeners.error.forEach((function(t){return r._callEventListener(e,t)})),r._connect()},this._handleClose=function(e){r._debug("close event"),r._clearTimeouts(),r._shouldReconnect&&r._connect(),r.onclose&&r.onclose(e),r._listeners.close.forEach((function(t){return r._callEventListener(e,t)}))},this._url=e,this._protocols=t,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){return this._messageQueue.reduce((function(e,t){return"string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e}),0)+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")},e.prototype.reconnect=function(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()},e.prototype.send=function(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{var t=this._options.maxEnqueuedMessages,n=void 0===t?p.maxEnqueuedMessages:t;this._messageQueue.length<n&&(this._debug("enqueue",e),this._messageQueue.push(e))}},e.prototype.addEventListener=function(e,t){this._listeners[e]&&this._listeners[e].push(t)},e.prototype.dispatchEvent=function(e){var t,n,r=this._listeners[e.type];if(r)try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(r),s=o.next();!s.done;s=o.next()){var a=s.value;this._callEventListener(e,a)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return!0},e.prototype.removeEventListener=function(e,t){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((function(e){return e!==t})))},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._options.debug&&console.log.apply(console,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e}(["RWS>"],e))},e.prototype._getNextDelay=function(){var e=this._options,t=e.reconnectionDelayGrowFactor,n=void 0===t?p.reconnectionDelayGrowFactor:t,r=e.minReconnectionDelay,o=void 0===r?p.minReconnectionDelay:r,s=e.maxReconnectionDelay,a=void 0===s?p.maxReconnectionDelay:s,i=0;return this._retryCount>0&&(i=o*Math.pow(n,this._retryCount-1))>a&&(i=a),this._debug("next delay",i),i},e.prototype._wait=function(){var e=this;return new Promise((function(t){setTimeout(t,e._getNextDelay())}))},e.prototype._getNextUrl=function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")},e.prototype._connect=function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,n=t.maxRetries,r=void 0===n?p.maxRetries:n,o=t.connectionTimeout,s=void 0===o?p.connectionTimeout:o,a=t.WebSocket,i=void 0===a?d():a;if(this._retryCount>=r)this._debug("max retries reached",this._retryCount,">=",r);else{if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),void 0===(c=i)||!c||2!==c.CLOSING)throw Error("No valid WebSocket class provided");var c;this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._debug("connect",{url:t,protocols:e._protocols}),e._ws=e._protocols?new i(t,e._protocols):new i(t),e._ws.binaryType=e._binaryType,e._connectLock=!1,e._addListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),s))}))}}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new l(Error("TIMEOUT"),this))},e.prototype._disconnect=function(e,t){if(void 0===e&&(e=1e3),this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new u(e,t,this))}catch(e){}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(e,t){"handleEvent"in t?t.handleEvent(e):t(e)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const h=f;n(8872);const m=new Set;class y{#e=[];#t=null;#n=null;#r=e=>{const t=JSON.parse(e.data);this.#t&&clearInterval(this.#t),this.#t=setInterval((()=>{this.socket?.readyState===h.OPEN&&this.socket?.send(JSON.stringify({type:"ping"}))}),3e4);try{if("attach_channel_response"===t.type){if(!t.payload.success)return void this.#o({connected:!0,ready:!1,currentState:"attach_channel_erred"});this.#o({connected:!0,ready:!0,currentState:"attach_channel_response"})}}catch(e){console.warn(e)}};#s=()=>{this.#o({connected:!1,ready:!1,currentState:"socket_closed"})};#a=()=>{this.#o({connected:!1,ready:!1,currentState:"socket_join_error"})};accessToken="";channelName="";channelTopic="";url="";async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o}=(e=>{const t=e.indexOf("?");return t<0?{url:e,params:{}}:{url:e.slice(0,t),params:e.slice(t+1).split("&").reduce((function(e,t){const[n,r]=t.split("=");return{...e,[n]:decodeURIComponent(r)}}),{})}})(this.url);this.socket=new h(o,[],{maxReconnectionDelay:1e4,minReconnectionDelay:500,reconnectionDelayGrowFactor:2});const s={type:"attach_channel",payload:{accessToken:this.accessToken,channelName:this.channelName}};this.#n=()=>{this.socket?.send(JSON.stringify(s)),this.#o({connected:!0,ready:!1,currentState:"socket_connected"})},this.socket?.addEventListener("open",this.#n),this.socket?.addEventListener("message",this.#r),this.socket?.addEventListener("close",this.#s),this.socket?.addEventListener("error",this.#a)}disconnect(){this.socket?.close(),this.#n&&this.socket?.removeEventListener("open",this.#n),this.socket?.removeEventListener("message",this.#r),this.socket?.removeEventListener("close",this.#s),this.socket?.removeEventListener("error",this.#a),this.#e=[]}onOpen=e=>{this?.socket?.addEventListener("open",e)};onError=e=>{this?.socket?.addEventListener("error",e)};addListener=(e,t)=>{this?.socket?.addEventListener(e,(e=>t(JSON.parse(e.data))))};onMessage=e=>{this?.socket&&(this.socket.onmessage=t=>e(JSON.parse(t.data)))};removeListener=(e,t)=>{this.socket?.removeEventListener(e,t)};onConnection(e){this.#e.push(e)}#o(e){this.#e=this.#e.filter((t=>!t(e))),m.forEach((e=>e()))}pushToChannel(e,t){this.socket?.send(JSON.stringify({type:e,payload:t}))}static subscribe(e){return m.add(e),()=>m.delete(e)}}class v extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.status=t?.status}}class g 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 b extends g{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class x extends g{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class w extends g{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class _ extends g{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}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 n?JSON.parse(n):{}},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const E={info:"info",message:"message",participant:"participant",system:"system"},S="text",j="text",T="upload",N="received",I="read",k="custom",O="detach_service",L="dismiss",A="set_topic",R="click_cta",P="translation_proposal",M=P,D="window_api",U="assertive",F="polite",z={new_topic:"newTopic",new_translation:"newTranslation"},B="uploads",V="navigate";function $(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}const H=async(e,t)=>{const n=new URL(e),r=await fetch(n.href,{mode:"cors",...t});if(!r.ok)throw new v(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function W(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:void 0}const G=()=>null;class q{#i;#c;#l;#u="window";#d;#p="new";URLS={};locale="";conversation=new y;constructor({layoutMode:e,namespace:t,config:n,context:r}){this.store=function(e,t){const n=t(e),r=n.get()||{};return{get:e=>void 0===e?r:r[e],set:(e,t)=>(r[e]=t,n.set(r),t),delete(e){const t=this.get(e);return delete r[e],n.set(r),t}}}(`${t}.connection${r.userLocale?`.${r.userLocale}`:""}`,n.storageProvider||C),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},this.#d={...n,sendEnvironment:n.sendEnvironment??!0,context:{...r,channelName:r.channelName||"web"}},this.#i=!1,this.connected=!1,this.configReady=!1,n.externalId&&(this.#c=n.externalId),this.#u=e,this.userResponded=!1,this.URLS={translations:{href:`/channels/api/v2/client/${this.connectionInfo.apiKey}/translations/{version}/{locale}.json`,templated:!0},config:{href:`/channels/api/v2/client/${this.connectionInfo.apiKey}/configs`,templated:!0}},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getAccessToken(){return this.store.get("accessToken")}setAccessToken(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}setConversationUrl(e){this.store.set("conversationUrl",e?.href)}hasConversation(){return!!this.getConversationUrl()}getChannelTopic(){return this.store.get("channelTopic")||this.store.get("channelName")}getLocale=e=>e||this.locale;#f({_links:{self:e,...t}}){this.URLS={...this.URLS,...t}}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}#h(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}async getTranslations(e){try{if(!this.URLS.translations?.href)throw new b;const t=`${this.#h("http")}${this.URLS.translations.href}`.replace("{version}",String(4)).replace("{locale}",this.getLocale(e)),n=await H(t,{method:"GET"});return(await n.json()).translations}catch(e){if(e.status>=500)throw new x(e);throw new v(e)}}getContext(e){const{source:t,userLocale:n,variables:r}=e;if(t&&"string"!=typeof t)throw new Error("Source must be a string");if(n){if("string"!=typeof n)throw new Error("Locale must be a string");this.#m(e,n)}if(r&&"object"!=typeof r)throw new Error("Variables must be an object");if(0===Object.keys(e).length&&e.constructor===Object)return;const o=this.#d.context?.userLocale;return{...o?{userLocale:o}:{},...e}}async downloadFile(e,t){try{const n=await H(`${this.#h("http")}${this.URLS.uploads.href}/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.getAccessToken()}`}}),r=document.createElement("a"),o=URL.createObjectURL(await n.blob());r.href=o,void 0!==r.download&&(r.download=t),r.click(),setTimeout((()=>{URL.revokeObjectURL(o)}),6e4)}catch(e){}}uploadFile(e,t,n,r){const o=new FormData;o.append("upload",e);const s=new XMLHttpRequest;return s.open("POST",`${this.#h("http")}${this.URLS.uploads.href}`),s.setRequestHeader("Authorization",`Bearer ${this.getAccessToken()}`),s.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},s.onloadend=()=>{if(0!==s.status)if(200!==s.status&&201!==s.status||!n){if(!r)throw new Error(s.response);try{r(JSON.parse(s.response))}catch(e){r(s.response)}}else try{n(JSON.parse(s.response))}catch(e){n(s.response)}},s.send(o),s}async createConversation(){try{"function"==typeof this.#d?.getConversationAuthToken&&(this.#l=await this.#d.getConversationAuthToken());const e=await H(`${this.#h("http")}${this.URLS.conversations?.href}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#l?void 0:this.#c,token:this.#l})}),t=await e.json(),{conversation:n}=t,r={...n};return this.setAccessToken(n.accessToken),this.#f(t),this.URLS.conversation&&this.setConversationUrl(this.URLS.conversation),this.locale=n.context.userLocale,this.userResponded=n.userResponded,this.#p=n.status,r}catch(e){if(e.status>=500)throw new x(e);if(400===e.status)throw new _(e);if(404===e.status)throw new b(e);throw e}}async getConfig(){try{const e={channelName:this.#d.context.channelName,contentLocale:this.#d.context.contentLocale,environment:!0===this.#d.sendEnvironment?this.getEnvironment():this.#d.sendEnvironment,userLocale:this.#d.context.userLocale,variables:this.#d.context.variables},t=await H(`${this.#h("http")}${this.URLS.config?.href}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e})}),n=await t.json();return this.#f(n),this.configReady=!0,n.config}catch(e){if(404===e.status)throw new b(e);if(e.status>=500)throw new x(e);throw e}}async fetchConversation(){if(!this.hasConversation())return null;try{const e=await H(`${this.#h("http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${this.getAccessToken()}`}}),t=await e.json();return this.#p=t.conversation.status,this.#f(t),t.conversation}catch(e){if(401===e.status)throw new _(e);if(404===e.status)throw new w(e);if(e.status>=500)throw new x(e);throw e}}async getConversation(){return this.hasConversation()?this.fetchConversation():null}async getConversationIntitialState(){return this.fetchConversation()}async disconnect(){this.conversation?.disconnect&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}async connect(){this.connected=!1;const e=this.hasConversation()?void 0:await this.createConversation();return this.URLS.socket&&(this.conversation.connect(`${this.#h("ws")}${this.URLS.socket.href}`,this.#d.context.channelName||"",this.getChannelTopic(),this.getAccessToken()),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,this.#i=t})),this.send("context",this.#y())),e}send(e,t=void 0){this.connected&&this.#i?(G("[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))):this.conversation?.onConnection((({connected:n,ready:r})=>(this.connected=n,this.#i=r,!!r&&(this.send(e,t),!0))))}sendContext(e){const t=this.getContext(e);t&&this.send("context",t)}#y(){const e=!0===this.#d.sendEnvironment?this.getEnvironment():void 0,t="string"==typeof this.#d.context?.source?this.#d.context?.source:void 0,n=this.#d.context?.variables;return{contentLocale:"started"!==this.#p?this.#d.context?.contentLocale:void 0,environment:e,source:t,userLocale:"started"!==this.#p?this.#d.context?.userLocale:void 0,variables:n}}#m(e,t){e.source||t==this.#d.context?.userLocale||(e.source=D)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#u,clientVersion:"24.5.0-beta.1",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:W(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}function K(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 J=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),X=()=>Math.random().toString(36).substring(7).split("").join("."),Y={INIT:`@@redux/INIT${X()}`,REPLACE:`@@redux/REPLACE${X()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${X()}`};function Q(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Z(e,t,n){if("function"!=typeof e)throw new Error(K(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(K(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(K(1));return n(Z)(e,t)}let r=e,o=t,s=new Map,a=s,i=0,c=!1;function l(){a===s&&(a=new Map,s.forEach(((e,t)=>{a.set(t,e)})))}function u(){if(c)throw new Error(K(3));return o}function d(e){if("function"!=typeof e)throw new Error(K(4));if(c)throw new Error(K(5));let t=!0;l();const n=i++;return a.set(n,e),function(){if(t){if(c)throw new Error(K(6));t=!1,l(),a.delete(n),s=null}}}function p(e){if(!Q(e))throw new Error(K(7));if(void 0===e.type)throw new Error(K(8));if("string"!=typeof e.type)throw new Error(K(17));if(c)throw new Error(K(9));try{c=!0,o=r(o,e)}finally{c=!1}return(s=a).forEach((e=>{e()})),e}return p({type:Y.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(K(10));r=e,p({type:Y.REPLACE})},[J]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(K(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[J](){return this}}}}}function ee(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Y.INIT}))throw new Error(K(12));if(void 0===n(void 0,{type:Y.PROBE_UNKNOWN_ACTION()}))throw new Error(K(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let s=!1;const a={};for(let o=0;o<r.length;o++){const i=r[o],c=n[i],l=e[i],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(K(14));a[i]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function te(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ne(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var re=ne(),oe=ne,se=Symbol.for("immer-nothing"),ae=Symbol.for("immer-draftable"),ie=Symbol.for("immer-state");function ce(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var le=Object.getPrototypeOf;function ue(e){return!!e&&!!e[ie]}function de(e){return!!e&&(fe(e)||Array.isArray(e)||!!e[ae]||!!e.constructor?.[ae]||ge(e)||be(e))}var pe=Object.prototype.constructor.toString();function fe(e){if(!e||"object"!=typeof e)return!1;const t=le(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===pe}function he(e,t){0===me(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function me(e){const t=e[ie];return t?t.type_:Array.isArray(e)?1:ge(e)?2:be(e)?3:0}function ye(e,t){return 2===me(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ve(e,t,n){const r=me(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ge(e){return e instanceof Map}function be(e){return e instanceof Set}function xe(e){return e.copy_||e.base_}function we(e,t){if(ge(e))return new Map(e);if(be(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=fe(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[ie];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],s=t[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(le(e),t)}{const t=le(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function _e(e,t=!1){return Ee(e)||ue(e)||!de(e)||(me(e)>1&&(e.set=e.add=e.clear=e.delete=Ce),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>_e(t,!0)))),e}function Ce(){ce(2)}function Ee(e){return Object.isFrozen(e)}var Se,je={};function Te(e){const t=je[e];return t||ce(0),t}function Ne(){return Se}function Ie(e,t){t&&(Te("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ke(e){Oe(e),e.drafts_.forEach(Ae),e.drafts_=null}function Oe(e){e===Se&&(Se=e.parent_)}function Le(e){return Se={drafts_:[],parent_:Se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ae(e){const t=e[ie];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Re(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ie].modified_&&(ke(t),ce(4)),de(e)&&(e=Pe(t,e),t.parent_||De(t,e)),t.patches_&&Te("Patches").generateReplacementPatches_(n[ie].base_,e,t.patches_,t.inversePatches_)):e=Pe(t,n,[]),ke(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==se?e:void 0}function Pe(e,t,n){if(Ee(t))return t;const r=t[ie];if(!r)return he(t,((o,s)=>Me(e,r,t,o,s,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return De(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,s=!1;3===r.type_&&(o=new Set(t),t.clear(),s=!0),he(o,((o,a)=>Me(e,r,t,o,a,n,s))),De(e,t,!1),n&&e.patches_&&Te("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Me(e,t,n,r,o,s,a){if(ue(o)){const a=Pe(e,o,s&&t&&3!==t.type_&&!ye(t.assigned_,r)?s.concat(r):void 0);if(ve(n,r,a),!ue(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(de(o)&&!Ee(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Pe(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||De(e,o)}}function De(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_e(t,n)}var Ue={get(e,t){if(t===ie)return e;const n=xe(e);if(!ye(n,t))return function(e,t,n){const r=Be(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!de(r)?r:r===ze(e.base_,t)?($e(e),e.copy_[t]=He(r,e)):r},has:(e,t)=>t in xe(e),ownKeys:e=>Reflect.ownKeys(xe(e)),set(e,t,n){const r=Be(xe(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ze(xe(e),t),a=r?.[ie];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)&&(void 0!==n||ye(e.base_,t)))return!0;$e(e),Ve(e)}var o,s;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==ze(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,$e(e),Ve(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=xe(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){ce(11)},getPrototypeOf:e=>le(e.base_),setPrototypeOf(){ce(12)}},Fe={};function ze(e,t){const n=e[ie];return(n?xe(n):e)[t]}function Be(e,t){if(!(t in e))return;let n=le(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=le(n)}}function Ve(e){e.modified_||(e.modified_=!0,e.parent_&&Ve(e.parent_))}function $e(e){e.copy_||(e.copy_=we(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function He(e,t){const n=ge(e)?Te("MapSet").proxyMap_(e,t):be(e)?Te("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ne(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,s=Ue;n&&(o=[r],s=Fe);const{revoke:a,proxy:i}=Proxy.revocable(o,s);return r.draft_=i,r.revoke_=a,i}(e,t);return(t?t.scope_:Ne()).drafts_.push(n),n}function We(e){if(!de(e)||Ee(e))return e;const t=e[ie];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=we(e,t.scope_.immer_.useStrictShallowCopy_)}else n=we(e,!0);return he(n,((e,t)=>{ve(n,e,We(t))})),t&&(t.finalized_=!1),n}he(Ue,((e,t)=>{Fe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fe.deleteProperty=function(e,t){return Fe.set.call(this,e,t,void 0)},Fe.set=function(e,t,n){return Ue.set.call(this,e[0],t,n,e[0])};var Ge=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&ce(6),void 0!==n&&"function"!=typeof n&&ce(7),de(e)){const o=Le(this),s=He(e,void 0);let a=!0;try{r=t(s),a=!1}finally{a?ke(o):Oe(o)}return Ie(o,n),Re(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===se&&(r=void 0),this.autoFreeze_&&_e(r,!0),n){const t=[],o=[];Te("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}ce(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){var t;de(e)||ce(8),ue(e)&&(ue(t=e)||ce(10),e=We(t));const n=Le(this),r=He(e,void 0);return r[ie].isManual_=!0,Oe(n),r}finishDraft(e,t){const n=e&&e[ie];n&&n.isManual_||ce(9);const{scope_:r}=n;return Ie(r,t),Re(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Te("Patches").applyPatches_;return ue(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},qe=Ge.produce;Ge.produceWithPatches.bind(Ge),Ge.setAutoFreeze.bind(Ge),Ge.setUseStrictShallowCopy.bind(Ge),Ge.applyPatches.bind(Ge),Ge.createDraft.bind(Ge),Ge.finishDraft.bind(Ge);var Ke="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?te:te.apply(null,arguments)},Je=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Xe(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(bt(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return Q(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Ye=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Qe(e){return de(e)?qe(e,(()=>{})):e}function Ze(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var et=e=>t=>{setTimeout(t,e)};function tt(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let s=new Ye;return t&&("boolean"==typeof t?s.push(re):s.push(oe(t.extraArgument))),s},{reducer:n,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:s=!0,preloadedState:a,enhancers:i}=e||{};let c,l;if("function"==typeof n)c=n;else{if(!Q(n))throw new Error(bt(1));c=ee(n)}l="function"==typeof r?r(t):t();let u=te;o&&(u=Ke({trace:!1,..."object"==typeof o&&o}));const d=function(...e){return t=>(n,r)=>{const o=t(n,r);let s=()=>{throw new Error(K(15))};const a={getState:o.getState,dispatch:(e,...t)=>s(e,...t)},i=e.map((e=>e(a)));return s=te(...i)(o.dispatch),{...o,dispatch:s}}}(...l),p=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ye(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,s=!1,a=!1;const i=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:et(10):"callback"===e.type?e.queueNotification:et(e.timeout),l=()=>{a=!1,s&&(s=!1,i.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>o&&e()));return i.add(e),()=>{t(),i.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,s=!o,s&&(a||(a=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r})(d);return Z(c,a,u(..."function"==typeof i?i(p):p()))}function nt(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(bt(28));if(r in t)throw new Error(bt(29));return t[r]=n,o},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),o),addDefaultCase:e=>(r=e,o)};return e(o),[t,n,r]}function rt(...e){return t=>e.some((e=>((e,t)=>Je(e)?e.match(t):e(t))(e,t)))}var ot=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},st=["name","message","stack","code"],at=class{constructor(e,t){this.payload=e,this.meta=t}_type},it=class{constructor(e,t){this.payload=e,this.meta=t}_type},ct=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of st)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},lt="External signal was aborted",ut=(()=>{function e(e,t,n){const r=Xe(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=Xe(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),s=Xe(e+"/rejected",((e,t,r,o,s)=>({payload:o,error:(n&&n.serializeError||ct)(e||"Rejected"),meta:{...s||{},arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e,{signal:a}={}){return(i,c,l)=>{const u=n?.idGenerator?n.idGenerator(e):ot(),d=new AbortController;let p,f;function h(e){f=e,d.abort()}a&&(a.aborted?h(lt):a.addEventListener("abort",(()=>h(lt)),{once:!0}));const m=async function(){let a;try{let s=n?.condition?.(e,{getState:c,extra:l});if(null!==(m=s)&&"object"==typeof m&&"function"==typeof m.then&&(s=await s),!1===s||d.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const y=new Promise(((e,t)=>{p=()=>{t({name:"AbortError",message:f||"Aborted"})},d.signal.addEventListener("abort",p)}));i(o(u,e,n?.getPendingMeta?.({requestId:u,arg:e},{getState:c,extra:l}))),a=await Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:c,extra:l,requestId:u,signal:d.signal,abort:h,rejectWithValue:(e,t)=>new at(e,t),fulfillWithValue:(e,t)=>new it(e,t)})).then((t=>{if(t instanceof at)throw t;return t instanceof it?r(t.payload,u,e,t.meta):r(t,u,e)}))])}catch(t){a=t instanceof at?s(null,u,e,t.payload,t.meta):s(t,u,e)}finally{p&&d.signal.removeEventListener("abort",p)}var m;return n&&!n.dispatchConditionRejection&&s.match(a)&&a.meta.condition||i(a),a}();return Object.assign(m,{abort:h,requestId:u,arg:e,unwrap:()=>m.then(dt)})}}),{pending:o,rejected:s,fulfilled:r,settled:rt(s,r),typePrefix:e})}return e.withTypes=()=>e,e})();function dt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var pt=Symbol.for("rtk-slice-createasyncthunk");function ft(e,t){return`${e}/${t}`}function ht({creators:e}={}){const t=e?.asyncThunk?.[pt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(bt(11));const o=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},s=Object.keys(o),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},i={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(bt(12));if(n in a.sliceCaseReducersByType)throw new Error(bt(13));return a.sliceCaseReducersByType[n]=t,i},addMatcher:(e,t)=>(a.sliceMatchers.push({matcher:e,reducer:t}),i),exposeAction:(e,t)=>(a.actionCreators[e]=t,i),exposeCaseReducer:(e,t)=>(a.sliceCaseReducersByName[e]=t,i)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?nt(e.extraReducers):[e.extraReducers],o={...t,...a.sliceCaseReducersByType};return function(e){let t,[s,i,c]=nt((e=>{for(let t in o)e.addCase(t,o[t]);for(let t of a.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}));if("function"==typeof e)t=()=>Qe(e());else{const n=Qe(e);t=()=>n}function l(e=t(),n){let r=[s[n.type],...i.filter((({matcher:e})=>e(n))).map((({reducer:e})=>e))];return 0===r.filter((e=>!!e)).length&&(r=[c]),r.reduce(((e,t)=>{if(t){if(ue(e)){const r=t(e,n);return void 0===r?e:r}if(de(e))return qe(e,(e=>t(e,n)));{const r=t(e,n);if(void 0===r){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 l.getInitialState=t,l}(e.initialState)}s.forEach((r=>{const s=o[r],a={reducerName:r,type:ft(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(s)?function({type:e,reducerName:t,createNotation:n},r,o){let s,a;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(bt(17));s=r.reducer,a=r.prepare}else s=r;o.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,a?Xe(e,a):Xe(e))}(a,s,i):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(bt(18));const{payloadCreator:s,fulfilled:a,pending:i,rejected:c,settled:l,options:u}=n,d=o(e,s,u);r.exposeAction(t,d),a&&r.addCase(d.fulfilled,a),i&&r.addCase(d.pending,i),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:a||vt,pending:i||vt,rejected:c||vt,settled:l||vt})}(a,s,i,t)}));const l=e=>e,u=new Map,d=new WeakMap;let p;function f(e,t){return p||(p=c()),p(e,t)}function h(){return p||(p=c()),p.getInitialState()}function m(t,n=!1){function r(e){let o=e[t];return void 0===o&&n&&(o=Ze(d,r,h)),o}function o(t=l){const r=Ze(u,n,(()=>new WeakMap));return Ze(r,t,(()=>{const r={};for(const[o,s]of Object.entries(e.selectors??{}))r[o]=mt(s,t,(()=>Ze(d,t,h)),n);return r}))}return{reducerPath:t,getSelectors:o,get selectors(){return o(r)},selectSlice:r}}const y={name:n,reducer:f,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:h,...m(r),injectInto(e,{reducerPath:t,...n}={}){const o=t??r;return e.inject({reducerPath:o,reducer:f},n),{...y,...m(o,!0)}}};return y}}function mt(e,t,n,r){function o(o,...s){let a=t(o);return void 0===a&&r&&(a=n()),e(a,...s)}return o.unwrapped=e,o}var yt=ht();function vt(){}var{assign:gt}=Object;function bt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");class xt extends g{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const wt=ut("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,preChat:r,agentParticipant:o,defaultContentLocale:s,defaultUserLocale:a,userParticipant:i,startChatIcon:c}=await t.getConfig(),{connectWhenInView:l}=n;return{features:e,preChat:r,agentParticipant:o,userParticipant:i,startChatIcon:c,defaultUserLocale:n?.context?.userLocale||a,defaultContentLocale:n?.context?.contentLocale||s,connectWhenInView:l}}catch(e){return r(e)}})),_t=ut("resetConfig",(async(e,{extra:{config:t}})=>t));var Ct=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var Et="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function St(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,s=0;function a(){let t=n;const{length:a}=arguments;for(let e=0,n=a;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=r}}const i=t;let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),s++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==s&&s--),o="object"==typeof c&&null!==c||"function"==typeof c?new Et(c):c}return i.s=1,i.v=c,c}return a.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function jt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},a=e.pop();"object"==typeof a&&(s=a,a=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const i={...n,...s},{memoize:c,memoizeOptions:l=[],argsMemoize:u=St,argsMemoizeOptions:d=[],devModeChecks:p={}}=i,f=Ct(l),h=Ct(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=c((function(){return r++,a.apply(null,arguments)}),...f),v=u((function(){o++;const e=function(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}(m,arguments);return t=y.apply(null,e),t}),...h);return Object.assign(v,{resultFunc:a,memoizedResultFunc:y,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var Tt=jt(St),Nt=Object.assign(((e,t=Tt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>Nt});const It=Tt((({app:e})=>e),(({userHasResponded:e})=>e)),kt="visibility",Ot={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},Lt=Tt((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?Ot.open:Ot.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),At=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:s,hideOnNoUserResponse:a}=r,{visible:i}=o||{};if("app"===s&&!t)return Ot.open;if("window"===s&&a&&n!==Ot.open)return e?n||t||Ot.open:Ot.hidden;if("inline"===s&&e&&!n)return t||Ot.open;const c=Ot.minimized;return n||t||i||c};var Rt=n(7402),Pt=n(8418);var Mt={notify(){},get:()=>[]};var Dt=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),Ut=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),Ft=(()=>Dt||Ut?Rt.useLayoutEffect:Rt.useEffect)();Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var zt=Symbol.for("react-redux-context"),Bt="undefined"!=typeof globalThis?globalThis:{};function Vt(){if(!Rt.createContext)return{};const e=Bt[zt]??=new Map;let t=e.get(Rt.createContext);return t||(t=Rt.createContext(null),e.set(Rt.createContext,t)),t}var $t=Vt(),Ht=function(e){const{children:t,context:n,serverState:r,store:o}=e,s=Rt.useMemo((()=>{const e=function(e,t){let n,r=Mt,o=0,s=!1;function a(){l.onStateChange&&l.onStateChange()}function i(){o++,n||(n=t?t.addNestedSub(a):e.subscribe(a),r=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const o=t={callback:n,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){r&&null!==e&&(r=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}())}function c(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=Mt)}const l={addNestedSub:function(e){i();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:a,isSubscribed:function(){return s},trySubscribe:function(){s||(s=!0,i())},tryUnsubscribe:function(){s&&(s=!1,c())},getListeners:()=>r};return l}(o);return{store:o,subscription:e,getServerState:r?()=>r:void 0}}),[o,r]),a=Rt.useMemo((()=>o.getState()),[o]);Ft((()=>{const{subscription:e}=s;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),a!==o.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}}),[s,a]);const i=n||$t;return Rt.createElement(i.Provider,{value:s},t)};function Wt(e=$t){return function(){return Rt.useContext(e)}}var Gt=Wt();function qt(e=$t){const t=e===$t?Gt:Wt(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Kt=qt();function Jt(e=$t){const t=e===$t?Kt:qt(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Xt=Jt(),Yt=(e,t)=>e===t;function Qt(e=$t){const t=e===$t?Gt:Wt(e),n=(e,n={})=>{const{equalityFn:r=Yt}="function"==typeof n?{equalityFn:n}:n,o=t(),{store:s,subscription:a,getServerState:i}=o,c=(Rt.useRef(!0),Rt.useCallback({[e.name]:t=>e(t)}[e.name],[e])),l=(0,Pt.useSyncExternalStoreWithSelector)(a.addNestedSub,s.getState,i||s.getState,c,r);return Rt.useDebugValue(l),l};return Object.assign(n,{withTypes:()=>n}),n}var Zt=Qt();const en=()=>Zt(Lt);function tn(){const{startChatIcon:e}=en();return e}const nn=(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)}}},rn=e=>Math.ceil(e/1e3),on=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},sn=(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]}`},an={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},cn={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},ln=e=>e.code?cn[e.code]:an[e.keyCode],un=e=>{e&&e.focus()},dn=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function pn(e){return"object"==typeof e}const fn=({state:e})=>e,hn=()=>Zt(fn),mn=Tt(fn,Lt,It,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const o={type:"service_data",payload:t.suggestion};return[...e,o]})),yn=Tt(mn,Lt,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,o)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const s=o[n-1];if(!t?.occurredAt||!s.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const a=rn(t.occurredAt-s.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:a}}})):e})),vn=()=>Zt(yn),gn=(Tt(yn,(e=>e.map((e=>e.payload.id)))),()=>hn().isLoading),bn=()=>hn().unreadEvents,xn=()=>hn().skiplinkTargetId,wn=()=>hn().serviceInfo,_n=Tt(yn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),Cn=()=>{const{participants:e,currentAgent:t}=hn().participantInfo;return t?e[t]:null},En=()=>{const{entryMeta:{options:e,optionsOverride:t}}=hn(),{limit:n}=t?.text||e?.text||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},Sn=()=>{const{layoutMode:e}=en();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},jn=Tt((({visibility:e})=>e),(e=>e.visibility)),Tn=Tt((({visibility:e})=>e),(e=>e.showInlineView)),Nn=Tt((({visibility:e})=>e),(e=>e.setInputFocus)),In=[Ot.open,Ot.minimized,Ot.hidden],kn=ut("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),s=e.visibility,a=jn(o),i=It(o),c=n.hasConversation(),l=Lt(o),{visibilityCallback:u=At,layoutMode:d}=l,{unreadEvents:p}=fn(o),f=u({hasResponded:i,previousVisibility:a,requestedVisibility:s,config:l});if(f&&!In.includes(f))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),{visibility:null,setInputFocus:e.setInputFocus};if(a===f)return{visibility:null,setInputFocus:e.setInputFocus};const h=n.store.get(kt);return n.store.set(kt,{...h||{},[d]:s}),s&&r.emit("ui.visible",s,{visibility:s,hasConversation:c,hasResponded:i,unreadMessageCount:p}),{visibility:f,setInputFocus:e.setInputFocus}})),On=ut("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:o}=Lt(n()),s=r.store.get(kt)?.[o]||Ot.initialize;return t(kn({visibility:s})),s})),Ln=ut("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{const o=n?.context?.contentLocale,s=n?.context?.userLocale;try{return t.hasConversation()?{initialState:await t.getConversationIntitialState(),contentLocale:o,userLocale:s,config:n}:(n?.context?.topic&&t.send("action",{type:A,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),{initialState:void 0,contentLocale:o,userLocale:s,config:n})}catch(e){if(e instanceof w){const e=new w;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new xt;return r({name:t.name,message:t.message,langKey:t.langKey})}})),An=((e,t,n)=>{const{wait:r=300,maxWait:o=0,leading:s=!1}=n??{};let a,i=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,a&&(a(!0),a=void 0)};return ut(e,t,{condition:()=>{const e=s&&!i;return i&&clearTimeout(i),i=setTimeout((()=>{l(),i=null}),r),!!e||(a&&(a(!1),a=void 0),o&&!c&&(c=setTimeout(l,o)),new Promise((e=>{a=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(_t()),await t(wt()),await t(Ln()),t(On())}),{wait:2e3,leading:!0}),Rn="cvco",Pn=50,Mn=300,Dn=["alwaysShowEntryLabel","hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],Un=(e,t)=>{const{messages:n,...r}=(o=t,Dn.reduce(((e,t)=>(t in o&&(e[t]=o[t]),e)),{}));var o;let s=e;return Object.keys(r).length>0&&(s={...s,...r}),n&&(s={...s,messages:{...s.messages,...n}}),s},Fn=yt({name:"config",initialState:{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}},alwaysShowEntryLabel:!1,api:{domain:"",key:"",secure:!0,sendEnvironment:!0},context:{},notificationAudioURL:void 0,hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showSuggestions:!0,preChat:{enterDelay:1e3,exitAfter:4e3},continueChat:{enterDelay:0,exitAfter:2e3},customComponents:{},defaults:{visible:null},preChatEvents:[],parentElement:void 0,layoutMode:"window"},reducers:{setConfig:(e,{payload:t})=>Un(e,t),updateConfig:(e,{payload:t})=>Un(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(_t.fulfilled,(e=>e)).addCase(wt.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o,defaultContentLocale:s,defaultUserLocale:a}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.contentLocale=s,e.context.userLocale=a,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o||""}))}}),{setConfig:zn,updateConfig:Bn,setPreChatEvents:Vn}=Fn.actions,$n=Fn.reducer,Hn={userHasResponded:!1},Wn=yt({name:"app",initialState:Hn,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(An.pending,(()=>Hn)).addCase(Ln.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:Gn}=Wn.actions,qn=Wn.reducer;class Kn extends g{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const Jn={SeamlyGeneralError:x,SeamlyConfigurationError:b,SeamlySessionExpiredError:w,SeamlyOfflineError:Kn,SeamlyUnauthorizedError:_,SeamlyUnavailableError:xt},Xn=Xe("catch-error",(e=>({payload:e}))),Yn={controls:{}},Qn={touched:!1},Zn={controls:Qn},er=yt({name:"forms",initialState:Zn,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...Yn,persistData:t}:{...Yn,persistData:t};e[n]=r},deregisterForm:(e,{payload:{formId:t}})=>(e[t]?.persistData||delete e[t],e),registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:Qn}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o={...r.controls};return delete o[t],{...e,[n]:{...r,controls:o}}},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{e[t]?.controls&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{e[t]?.controls[n]&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(An.pending,(()=>Zn))}}),{registerForm:tr,deregisterForm:nr,registerControl:rr,deregisterControl:or,updateControlValue:sr,updateControlTouched:ar}=er.actions,ir=er.reducer,cr=ut("setLocale",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return{translations:await t.getTranslations(e),userLocale:e}}catch(e){return n(e)}}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),lr={translations:{"errors.configError.message":"We are sorry this happened, please retry at a later time.","errors.configError.srText":"A chat configuration error occurred. Our apologies, please retry at a later time.","errors.configError.title":"Chat configuration error.","errors.general.buttonText":"Restart chat","errors.general.message":"Do you want to start a new chat session?","errors.general.srText":"Something went wrong with the chat session. You can restart the chat.","errors.general.title":"Something went wrong","errors.seamlyOffline.message":"There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.","errors.seamlyOffline.srText":"The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.","errors.seamlyOffline.title":"Connection issues","errors.seamlyUnavailable.buttonText":"Try again","errors.seamlyUnavailable.message":"The server could not be reached. Try again in a little while.","errors.seamlyUnavailable.srText":"The chat server could not be reached. Try again in a little while.","errors.seamlyUnavailable.title":"Server unavailable"},isLoading:!1,initialLocale:void 0,userLocale:void 0},ur=yt({name:"app",initialState:lr,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(An.pending,(()=>lr)).addCase(wt.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(cr.pending,(e=>{e.isLoading=!0})).addCase(cr.rejected,(e=>{e.isLoading=!1})).addCase(cr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t?.translations&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>{if(!t.translations)return e;const r=t.translations[n];return e[n]=r,e}),{}))}))}}),{setInitialLocale:dr,setTranslations:pr}=ur.actions,fr=ur.reducer,hr=ut("getConversation",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{const e=await t.getConversation();if(!e)throw new Error("No conversation found");return e}catch(e){return n({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError})}}),{condition(e,{getState:t}){const{state:{events:n}}=t(),r=n.at(-1);return r&&("lastEvent"in e?e?.lastEvent?.id:e?.body?.lastEvent?.id)!==r.payload.id}}),mr={error:void 0},yr=yt({name:"interrupt",initialState:mr,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>mr},extraReducers:e=>{e.addCase(wt.pending,(()=>mr)).addMatcher(rt(Ln.rejected,wt.rejected,cr.rejected,kn.rejected,On.rejected,hr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:vr,clearInterrupt:gr}=yr.actions,br=yr.reducer,xr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"];n(2577);const wr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===E.message&&!t.fromClient||e===E.info&&t.type===S,_r=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),Cr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:s,introduction:a}=t.participant,i=n[r],c={...n,[r]:i?{...i,...o?{avatar:o}:{},...s?{name:s}:{},...a?{introduction:a}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Er=(e,t)=>{if(!0===t?.payload?.fromClient)return e;const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{options:void 0,type:void 0},{blockAutoEntrySwitch:r}=e,o=t?.payload?.actions||{},s=t?.payload?.translatedActions||{};if(!n)return{...e,actions:o,optionsOverride:{},translatedActions:s};const{type:a,options:i}=n||{};let c=e.active;return r||a===e.userSelected||(c=a),{...e,active:c,optionsOverride:{...a?{[a]:i}:{}},actions:o,translatedActions:s}},Sr={events:[],isLastEventFromClient:!1,initialState:{userResponded:!1,context:{contentLocale:"",translationActive:!1,userLocale:""}},unreadEvents:0,userHasResponded:!1,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1,remaining:void 0,wasStopped:void 0,count:void 0,timer:void 0},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:"",proactiveMessages:!1},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:$(),optionsButtonId:$(),headerCollapseButtonId:$(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:j,optionsOverride:{},defaultEntry:j,active:j,userSelected:null,blockAutoEntrySwitch:!1,options:{},actions:{},translatedActions:{}},seamlyContainerElement:null},jr=yt({name:"store",initialState:Sr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,o=e.options.features.hasOwnProperty(B);let s={...e.options};if(o&&(n===E.message||n===E.participant)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;s={...s,features:{...s.features,uploads:{enabled:s.features.uploads?.enabled||!1,...s.features?.uploads||{},enabledFromEntry:e===T}}}}const a=wr(t.payload);if(!e.events.find((e=>e.payload.id===r.id))){if(!e.events.find((e=>"transactionId"in e.payload&&"transactionId"in r&&e.payload.transactionId===r.transactionId&&(!t.payload.type||e.type===t.payload.type)&&r.fromClient))){const i=Er(e.entryMeta,t.payload);e.entryMeta=o||i.active!==T?i:{...e.entryMeta},e.options=s,a&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?I:N)),t.payload.payload.key=$(),e.events.push(t.payload),e.events=_r(e.events)}r.fromClient&&(e.isLastEventFromClient=r.fromClient)}},updateEvent:(e,{payload:t})=>{const n=e.events.find((e=>"service_data"!==e.type&&"service_data"!==t.type&&e.payload.transactionId===t.payload.transactionId));n?(n.payload.id=t.payload.id,n.payload.occurredAt=t.payload.occurredAt):e.events.push(t),e.events=_r(e.events)},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(e.payload.id&&-1!==t.indexOf(e.payload.id)&&(e.payload={...e.payload,..."service_data"!==e.type&&e.payload.messageStatus===N&&{messageStatus:I}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setEvents:(e,{payload:{messages:t,unreadMessageCount:n,userResponded:r,participants:o,service:s,serviceData:a,ui:i}})=>{const c=((e,t)=>{const n=e.filter((e=>"message"===e.type&&!e.payload.optimisticallyInjected&&!t.some((t=>t.payload?.id===e.payload.id)))),r=t.filter((({type:e,payload:t})=>!("participant"===e&&!t?.participant?.introduction))).reverse();return _r([...r,...n])})(e.events,t),l=Object.fromEntries(Object.entries(o).map((([e,t])=>[t.id,t]))),u=t.find((e=>"participant"===e.type)),d=u?.payload?.participant?.id,{entry:p}=s?.settings||{},f=Er({...e.entryMeta,...p,active:p?.default||S,options:{...p?.options?p.options:{}}},c[c.length-1]);let h={...e.options.features};const m=t.find((e=>!e.payload.fromClient&&["message","participant"].includes(e.type))),y=h.hasOwnProperty(B);if(y&&"message"===m?.type){const e=m.payload.entry?.type||"";h={...h,uploads:{enabled:h.uploads?.enabled||!1,enabledFromEntry:e===T}}}e.unreadEvents=n,e.userHasResponded=r,e.events=c.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...d?Cr(e.participantInfo,{participant:l[d]}):{},participants:l},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,proactiveMessages:s?.settings?.proactiveMessages?.enabled||!1,activeServiceSessionId:s?.sessionId},e.serviceData={...e.serviceData,...a},e.options={...e.options,features:h},e.entryMeta=y||f.active!==T?f:{...e.entryMeta},e.resumeConversationPrompt=i.resumeConversationPrompt||!1,d&&(e.headerTitles.subTitle=l[d]?.name)},setIsLoading:(e,{payload:t})=>{e.isLoading=t},initIdleDetachCountdown:(e,{payload:t})=>{const{delaySeconds:n,delayTime:r}=t;e.idleDetachCountdown={hasCountdown:!0,isActive:!0,wasStopped:!1,count:n,remaining:n,timer:r}},decrementIdleDetachCountdownCounter:e=>{const{idleDetachCountdown:t}=e,{remaining:n=0}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=on(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=Cr(e.participantInfo,{participant:t.participant,fromClient:t.fromClient})},setActiveService:(e,{payload:t})=>{e.serviceInfo.activeServiceSessionId!==t&&(e.serviceInfo.activeServiceSessionId=t)},setHeaderTitle:(e,{payload:t})=>{e.headerTitles.title=t},setHeaderSubTitle:(e,{payload:t})=>{e.headerTitles.subTitle=t},setInitialState:(e,{payload:t})=>{e.initialState=t,e.unreadEvents=Sr.unreadEvents},setServiceDataItem:(e,{payload:t})=>{e.serviceData[t.type]=t},setFeatures:(e,{payload:t})=>{t.features&&(e.options.features=t.features)},updateFeatures:(e,{payload:t})=>{Object.entries(t).forEach((([t,n])=>{e.options.features[t]=n}))},setFeatureEnabledState:(e,{payload:t})=>{e.options.features.hasOwnProperty(t.key)&&(e.options.features[t.key].enabled=t.enabled)},clearFeatures:e=>{e.options.features={webNotifications:e.options.features.webNotifications}},showOption:(e,{payload:t})=>{e.options.panelActive=!0,e.options.optionActive=t},hideOption:e=>{e.options.panelActive=!1,e.options.optionActive=""},setUserSelectedOptions:(e,{payload:t})=>{e.options.userSelectedOptions=t},setUserSelectedOption:(e,{payload:t})=>{const{option:n,value:r}=t;e.options.userSelectedOptions[n]=r},setBlockAutoEntrySwitch:(e,{payload:t})=>{e.entryMeta.blockAutoEntrySwitch=t},setServiceEntryMetadata:(e,{payload:t})=>{e.entryMeta.active=t.default,e.entryMeta.options=t.options||{},e.entryMeta.optionsOverride={},e.entryMeta.actions={},e.entryMeta.translatedActions={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},clearAbortTransaction:e=>{e.entryMeta.actions={}},registerUpload:(e,{payload:t})=>{e.currentUploads.push({id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle})},setUploadProgress:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}:e))},startProcessingImage:(e,{payload:t})=>{e.processingFileUploads.push(t)},doneProcessingImage:(e,{payload:t})=>{e.processingFileUploads=e.processingFileUploads.filter((e=>e!==t))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,error:t.errorText,progress:0,uploading:!1,uploadHandle:null}:e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?{...e,complete:!0}:e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t},setProactiveMessages:(e,{payload:t})=>{e.serviceInfo.proactiveMessages=t}},extraReducers:e=>{e.addCase(An.pending,(()=>Sr)).addCase(Ln.pending,(e=>{e.isLoading=!0})).addCase(wt.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name||"",t.features&&(e.options.features=t.features)})).addCase(Ln.fulfilled,((e,{payload:t,type:n})=>{if(e.isLoading=!1,!t.initialState)return;e.initialState=t.initialState,"messages"in t.initialState&&jr.caseReducers.setEvents(e,{payload:t.initialState,type:n});const{initialState:{service:r}}=t;r?.settings?.entry?.options?.upload&&jr.caseReducers.setFeatureEnabledState(e,{payload:{key:B,enabled:r.settings.entry.options.upload.enabled||!1},type:n})})).addMatcher(rt(Mr,Dr),(e=>{e.isLastEventFromClient=!1}))}}),{addEvent:Tr,updateEvent:Nr,clearAllUploads:Ir,clearEvents:kr,clearFeatures:Or,clearIdleDetachCountdown:Lr,clearResumeConversationPrompt:Ar,decrementIdleDetachCountdownCounter:Rr,hideOption:Pr,initIdleDetachCountdown:Mr,initResumeConversationPrompt:Dr,registerUpload:Ur,setActiveEntryType:Fr,setActiveService:zr,setBlockAutoEntrySwitch:Br,setEventsRead:Vr,setFeatureEnabledState:$r,updateFeatures:Hr,setFeatures:Wr,setHeaderSubTitle:Gr,setHeaderTitle:qr,setEvents:Kr,setInitialState:Jr,setIsLoading:Xr,setLoadedImageEventIds:Yr,setParticipant:Qr,setSeamlyContainerElement:Zr,setServiceDataItem:eo,setServiceEntryMetadata:to,clearAbortTransaction:no,setUploadComplete:ro,setUploadError:oo,setUploadProgress:so,startProcessingImage:ao,doneProcessingImage:io,setUserEntryType:co,setUserSelectedOption:lo,setUserSelectedOptions:uo,showOption:po,stopIdleDetachCountdownCounter:fo,setProactiveMessages:ho}=jr.actions,mo=jr.reducer,yo=({dispatch:e})=>t=>n=>{const r=t(n);if(wt.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(cr(n.payload.defaultUserLocale)),r;if(Ln.fulfilled.match(n))return n.payload.userLocale&&e(cr(n.payload.userLocale)),r;if(Tr.match(n)&&"info"===n.payload.type&&n.payload.payload.body&&"subtype"in n.payload.payload.body&&"new_translation"===n.payload.payload.body.subtype){const{body:t}=n.payload.payload;if(t.translationLocale&&t.translationEnabled)return e(cr(t.translationLocale)),r}return r},vo={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:ot(),translatedEventGroups:{},translationProposal:null},go=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},o,s)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return s.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=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},bo=yt({name:"translation",initialState:vo,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}=go(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:s}=go(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=s},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(An.pending,(()=>vo)).addCase(wt.fulfilled,((e,{payload:t})=>{const n=t?.features?.translation;n?.languages&&(e.isAvailable=!0===n.enabled,e.languages=[...n.languages].sort(((e,n)=>e.locale===t.defaultUserLocale?-1:n.locale===t.defaultUserLocale?1:e.nativeName?.localeCompare(n.nativeName||"",void 0,{sensitivity:"base"})||0)))})).addCase(cr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(Tr,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)})).addCase(Kr,((e,{payload:t})=>{e.translationProposal=t?.ui?.translationProposal})).addCase(Ln.fulfilled,((e,{payload:t})=>{e.translationProposal=t.initialState?.ui?.translationProposal}))}}),{enableTranslation:xo,disableTranslation:wo,enableEventsTranslation:_o,disableEventsTranslation:Co,setTranslationProposalPrompt:Eo,disableTranslationProposalPrompt:So}=bo.actions,jo=bo.reducer,To=yt({name:"visibility",initialState:{visibility:Ot.initialize,showInlineView:!1,setInputFocus:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(kn.fulfilled,((e,{payload:{visibility:t,setInputFocus:n}})=>{t&&(e.visibility=t,e.setInputFocus=Boolean(n))})).addCase(wt.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:No}=To.actions,Io=To.reducer,ko=ee({state:mo,app:qn,config:$n,i18n:fr,translations:jo,visibility:Io,forms:ir,interrupt:br});const Oo=Xt;var Lo=n(1162);function Ao(e=""){const t=e=>/\s/.test(e),n=[],r={};let o=0,s=null,a=!1,i=0;for(;i<e.length;){if(a&&(t(e[i])||"{"===e[i]))a=!1,s=e.slice(o,i),"{"===e[i]&&i--;else if(!a&&!t(e[i])){const t="{"===e[i];if(s&&t){const t=Ro(e,i);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[s]=e.slice(i+1,t),i=t,s=null}else s&&(n.push(s),s=null),a=!0,o=i}i++}return a&&(s=e.slice(o)),s&&n.push(s),{args:n,cases:r}}function Ro(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if("}"===t){if(0===n)return r;n--}else"{"===t&&n++}return-1}function Po(e){return Mo(e.slice(1,-1),",",3)}function Mo(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let o=e.indexOf(t);if(-1===o)return r.push(e),r;let s=e.substring(0,o).trim(),a=e.substring(o+t.length+1).trim();return r.push(s),Mo(a,t,n-1,r)}let Do,Uo=0;const Fo="other";function zo(e,t){let n=0,r="",o=0;const s={};for(;n<e.length;){if("#"!==e[n]||o)r+=e[n];else{let e="__hashToken"+Uo++;r+=`{${e}, number}`,s[e]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:s}}const Bo="other",Vo=Tt((({i18n:e})=>e),(({translations:e})=>e)),$o=Tt((({i18n:e})=>e),(({initialLocale:e})=>e)),Ho=Tt((({i18n:e})=>e),(({userLocale:e})=>e)),Wo=Tt((({i18n:e})=>e),(({isLoading:e})=>e)),Go=new class{constructor(e,t={}){this.locale=e,this.typeHandlers=t}format=function(e){const t={};return function(...n){let r=n.length?n.map((e=>null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e))).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,r))return t[r];let o=e(...n);return t[r]=o,o}}(((e,t={})=>this.process(e,t).flat(1/0).join("")));process(e,t={}){if(!e)return[];let n=e.indexOf("{");if(-1!==n){let r=Ro(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let o=e.substring(n,r+1);if(o){let s=[],a=e.substring(0,n);a&&s.push(a);let[i,c,l]=Po(o),u=t[i];null==u&&(u="");let d=c&&this.typeHandlers[c];s.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&s.push(this.process(p,t)),s}}}return[e]}}("en-GB",{plural:function(e,t,n,r,o){const{args:s,cases:a}=Ao(t);let i=parseInt(e);s.forEach((e=>{e.startsWith("offset:")&&(i-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==Do&&Do.resolvedOptions().locale===n||(Do=new Intl.PluralRules(n));const e=Do.select(i);e!==Fo&&c.push(e)}1===i&&c.push("one"),c.push(`=${i}`,Fo);for(let e=0;e<c.length;e++){const t=c[e];if(t in a){const{caseBody:e,numberValues:n}=zo(a[t],i);return o(e,{...r,...n})}}return e},select:function(e,t,n,r,o){const{cases:s}=Ao(t);return e in s?o(s[e],r):Bo in s?o(s[Bo],r):e}});function qo(){const e=Zt(Vo),t=Zt(Ho),n=Zt($o),r=Zt(Wo);return{t:(0,Lo.useCallback)(((n,o={})=>{if(!e)return"";const s=e[n];return s?Go.format(s,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const Ko=()=>{const e=Oo(),t=Zt(jn),n=Zt(Nn),r=!!t&&t!==Ot.hidden,o=t===Ot.open,s=t===Ot.minimized,a=(0,Lo.useCallback)((t=>{e(kn("string"==typeof t||null===t?{visibility:t,setInputFocus:!1}:t))}),[e]);return{isVisible:r,isOpen:o,isMinimized:s,visible:t,setVisibility:a,openChat:()=>{a({visibility:Ot.open})},closeChat:()=>{a({visibility:Ot.minimized})},setInputFocus:n}},Jo=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,o.createRef)()})=>{const[r,s]=(0,Lo.useState)(null),a=!!r?.isIntersecting||!t,i=a&&e,c=([e])=>s(e);return(0,Lo.useEffect)((()=>{const e=n?.current;if(!window.IntersectionObserver||i||!e||!t)return()=>{};const r=new IntersectionObserver(c,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,i]),{isVisible:a,containerRef:n}},Xo=()=>Zt(It),Yo=(0,o.createContext)(null),Qo=(0,o.createContext)(null),Zo=()=>{const e=(0,Lo.useContext)(Qo);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},es=()=>{const e=(0,Lo.useContext)(Yo);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},ts=()=>es().store,ns=()=>{const e=es();return(0,Lo.useCallback)((()=>e.hasConversation()),[e])},rs=()=>{const e=es(),t=Oo(),n=Zo(),r=Xo(),o=ns(),{visible:s,setVisibility:a}=Ko(),i=bn(),c=(0,Lo.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,Lo.useCallback)((()=>{c("ui.beforeStart",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:i}),e.send("start_conversation"),c("ui.start",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:i})}),[e,c,o,r,i,s]),u=(0,Lo.useCallback)((async()=>{await t(An())}),[t]),d=(0,Lo.useCallback)((e=>({type:e,id:$(),transactionId:$(),fromClient:!0,participant:"seamly-client-participant",occurredAt:1e3*Date.now()})),[]),p=(0,Lo.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,Lo.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const o={...p(n),...r};e.send("message",o),c("message",o),t(Tr({type:"message",payload:{...o,body:o.body,type:o.type,optimisticallyInjected:!0}}))}),[e,t,c,p]),h=(0,Lo.useCallback)(((e,n=$())=>{t(Tr({type:"message",payload:{...p(e),transactionId:n}}))}),[t,p]),m=(0,Lo.useCallback)(((e,n,r,o,s,a)=>{t(Tr({type:"message",payload:{type:"upload",id:e,transactionId:n,fromClient:!0,participant:"seamly-client-participant",occurredAt:r,body:{contentType:o,filename:s,filesize:a,id:e||"",isDeleted:!1}}}))}),[t]),y=(0,Lo.useCallback)((t=>{t&&e.send("action",t)}),[e]),v=(0,Lo.useCallback)((t=>{e.sendContext(t)}),[e]),g=(0,Lo.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(Jr(e)),e.messages&&e.messages.length&&t(Kr(e)),e.userResponded&&(t(Gn(e.userResponded)),a({visibility:Ot.open})))})).catch((e=>{t(vr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,a]);return{connect:g,start:l,sendMessage:f,sendAction:y,sendContext:v,reset:u,emitEvent:c,addMessageBubble:h,addUploadBubble:m,apiConnected:e.connected,apiConfigReady:e.configReady}},os=(0,o.createContext)(null),ss=()=>{const e=(()=>{const e=(0,Lo.useContext)(os);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,Lo.useCallback)((t=>{t&&e({ariaLive:F,messageText:t})}),[e]),sendAssertive:(0,Lo.useCallback)((t=>{t&&e({ariaLive:U,messageText:t})}),[e])}},as=Tt((({interrupt:e})=>e),(({error:e})=>e)),is=Tt(as,(e=>Boolean(e)));function cs(){const{t:e}=qo(),t=Zt(as);return{hasError:Zt(is),meta:(0,Lo.useMemo)((()=>{if(!t)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0,action:void 0};const{langKey:n,action:r}=t,o=e(`${n}.title`),s=e(`${n}.message`),a=e(`${n}.srText`),i=r?e(`${n}.buttonText`):null;return{...n?{title:o,message:s,srText:a}:{},...r?{action:r}:{},...r&&n?{buttonText:i}:{},originalError:t}}),[t,e]),error:t}}const ls=()=>{const{t:e}=qo(),{isInline:t,isWindow:n,isApp:r}=Sn(),{isOpen:o,isVisible:s}=Ko(),a=Zt(Tn),{start:i,connect:c,apiConfigReady:l,apiConnected:u}=rs(),d=(0,Lo.useRef)(!1),{sendAssertive:p}=ss();!function(){const{meta:{originalError:e,action:t}}=cs(),n=Oo(),{reset:r}=rs(),o="SeamlySessionExpiredError"===e?.name,s=(0,Lo.useRef)(0),a=(0,Lo.useRef)(null);(0,Lo.useEffect)((()=>{if(o&&"reset"===t){if(s.current>=10){a.current=setTimeout((()=>{s.current=0}),1e4);const e=new x;return n(vr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}s.current+=1,r()}return()=>{a.current&&clearTimeout(a.current)}}),[t,r,o,n])}(),(0,Lo.useEffect)((()=>{s&&setTimeout((()=>{p(e("window.srTexts.onLoad"))}),500)}),[s,p,e]),(0,Lo.useEffect)((()=>{s&&p(e(o?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[o,s,p,e]),(0,Lo.useEffect)((()=>{l||u||(d.current=!1)}),[l,u]);const f=(0,Lo.useCallback)((async()=>{u||(d.current=!0,await c()),(r||o||s&&t)&&i()}),[u,c,r,t,o,s,i]);(0,Lo.useEffect)((()=>{!l||d.current||n&&!o||!(!t||s&&a)||f()}),[l,f,t,o,s,n,a])},us=require("preact/compat"),ds=require("preact/jsx-runtime"),ps=({children:e})=>(ls(),(0,ds.jsx)(ds.Fragment,{children:e})),fs=(0,o.createContext)(null),hs=(e=0)=>new Promise((t=>{setTimeout(t,e)})),ms=()=>{const{seamlyContainerElement:e}=hn(),t=Oo();return[e,(0,Lo.useCallback)((e=>{t(Zr(e))}),[t])]},ys=e=>(0,Lo.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await hs(180);const e="string"==typeof t?document.getElementById(t):t;un(e)}))}),[e]),vs=()=>{const e=xn();return ys(e)};n(3215);const gs=e=>Tt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function bs(){const{sendContext:e}=rs(),t=Oo(),n=en(),r=(0,Lo.useCallback)(((t,n)=>{e({userLocale:t,source:n})}),[e]),o=(0,Lo.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(wo())}),[n.context?.contentLocale,t,e]),{languages:s,isActive:a,isAvailable:i,currentLocale:c}=Zt((({translations:e})=>e));return{languages:s,isActive:a,isAvailable:i,currentLocale:c,enableTranslations:r,disableTranslations:o}}const xs=e=>{const t=Zt(gs(e));if(!e?.payload)return{body:void 0,hasTranslation:!1,isTranslated:!1,locale:""};const n=e.payload?.translatedBody&&"data"in e.payload.translatedBody?e.payload?.translatedBody.data:e.payload.translatedBody,{translation:r,body:o}={body:e.payload?.body,translation:e.payload?.translation},s=!!n;return{body:t&&s?n:o,hasTranslation:s,isTranslated:t&&s,locale:r?.locale}};function ws(){const e=Zt((({translations:e})=>e.containerId));return{id:e,focusContainer:ys(e)}}function _s(e){const{languages:t}=bs();return(0,Lo.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const Cs=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e?.split(" "))).flat().filter((e=>e&&e.length)).map((e=>e&&e.indexOf(Rn)>-1?e:[Rn,e].join("-"))).join(" "),Es=()=>en().appContainerClassNames,Ss=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},js=()=>{const e=es();return(0,us.useSyncExternalStore)(y.subscribe,(()=>e.conversation))},Ts=(0,o.createContext)(null),Ns=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=hn(),{allowedMimeTypes:o,maxSize:s}=n?.upload||{},{enabled:a,enabledFromEntry:i}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...o?{allowedMimeTypes:o}:{},...s?{maxSize:s}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:i||a,allowedMimeTypes:c,maxSize:l}},Is=()=>{const{currentUploads:e}=hn(),t=Oo(),n=(()=>{const e=(0,Lo.useContext)(Ts);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,Lo.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,Lo.useCallback)((()=>{t(Ir())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},ks=()=>{const{t:e}=qo(),{options:t}=hn(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:s}=t,{extraMenuItem:a,sendTranscript:i}=s,c={extraMenuItem:a,sendTranscript:i},l=t=>"extraMenuItem"===t?"Extra menu item":e(`options.${t}.menuTitle`),u=Object.keys(c).filter((e=>c[e])).map((e=>({name:e,title:l(e),available:c[e].enabled}))),d=a||i,p=Oo(),{get:f,set:h}=ts();return{allowOptionSelection:d,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,Lo.useCallback)((()=>{const e=f("options")||{};p(uo(e))}),[f,p]),setUserSelectedOptions:(0,Lo.useCallback)((e=>{p(uo(e)),h("options",e)}),[h,p]),setUserSelectedOption:(0,Lo.useCallback)(((e,t)=>{const n=f("options")||{};"object"==typeof n&&h("options",{...n,[e]:t}),p(lo({option:e,value:t}))}),[p,f,h]),showOption:e=>{p(po(e))},hideOption:()=>{p(Pr())},panelActive:n,optionActive:r}},Os=()=>{const{optionsButtonId:e}=hn();return{id:e,focusButton:ys(e)}},Ls=(0,o.createContext)(null),As=()=>{const e=(0,Lo.useContext)(Ls);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},Rs=()=>{const e=Oo(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:a}}=hn(),{isOpen:i}=Ko(),{emitEvent:c,sendAction:l}=rs(),{t:u}=qo(),{sendAssertive:d,sendPolite:p}=ss(),f=(0,Lo.useCallback)((e=>{i&&d(e)}),[i,d]),h=(0,Lo.useCallback)((e=>{i&&p(e)}),[i,p]),m=(0,Lo.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=on(n);e(Mr({delaySeconds:n,delayTime:r})),c("idleTimer.start"),f(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,f,u]),y=(0,Lo.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:O}),f(u("idleDetachWarning.notifyTransferText"))),a||c("idleTimer.stop"),e(Lr()))}),[e,c,t,l,f,u,a]),v=(0,Lo.useCallback)((()=>{if(!o||o<=0)return;const t=o-1;t%10==0&&f(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",on(t))}`),e(Rr())}),[e,o,f,u]),g=(0,Lo.useCallback)((()=>{n&&(e(fo()),o&&(c("idleTimer.stop"),h(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,o,h,u]);return{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:a,initCountdown:m,endCountdown:y,decrementCountdown:v,stopCountdown:g}},Ps=()=>{const e=Oo(),t=hn().resumeConversationPrompt,{sendAction:n}=rs(),{t:r}=qo(),{sendAssertive:o}=ss();return{continueChat:()=>{n({type:L,body:{type:"resume_conversation_prompt"}}),e(Ar())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:O}),e(Ar())}}},Ms=()=>{const[e]=(0,Lo.useState)((()=>$()));return e},Ds=(e,t)=>{const n=js();(0,Lo.useEffect)((()=>{n.onMessage(((n,r)=>(t&&!t({type:n,payload:r})||e({type:n,payload:r}),r)))}),[e,t,n])},Us=({eventPayload:e})=>{const{t}=qo(),{fromClient:n,participant:r}=e,o=(e=>hn().participantInfo.participants[e])(r)||{},{messages:s}=en(),a=n?t("participants.user.name"):o&&o.name,{showAvatar:i,showName:c}=s&&s[n?"user":"agent"]||{};if(!i&&!c)return null;const l=[];return i&&a&&o.avatar&&l.push((0,ds.jsx)("span",{className:Cs("message__avatar"),children:(0,ds.jsx)("img",{src:o.avatar,className:Cs("avatar"),alt:""})})),c&&a&&l.push((0,ds.jsx)("span",{className:Cs("message__author-name"),children:a})),l.length>0?(0,ds.jsx)("div",{className:Cs("message__author"),children:l}):null},Fs=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:o,bodyProps:s={},info:a,...i})=>{const c=Ss(t),{hasTranslation:l,isTranslated:u,locale:d}=xs(t);return n&&c.push(`message--type-${n}`),r&&("string"==typeof r&&(r=r.split(" ").filter((e=>e.length))),r.forEach((e=>{c.push(`message--${e}`)}))),u&&c.push("message--is-translated"),l&&c.push("message--has-translation"),u&&(s={...s,lang:d}),(0,ds.jsx)(ds.Fragment,{children:(0,ds.jsxs)("div",{className:Cs(c),...i,children:[e&&(0,ds.jsx)(Us,{eventPayload:t.payload}),(0,ds.jsx)("div",{className:Cs("message__body"),...s,children:o}),a&&(0,ds.jsx)("div",{"aria-hidden":"true",className:Cs("message__info"),children:a})]})})},zs=({id:e,action:t,buttonText:n,description:r,hasFocus:o,image:s,title:a,isCarouselItem:i})=>{const c=(0,Lo.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=rs(),p=Ms(),f=(0,Lo.useRef)(!1),h=t?.type===V?"a":"button",m=(0,Lo.useCallback)((()=>d("action.click_card",{type:R,originMessage:e,action:t})),[d,e,t]),y=(0,Lo.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:A,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),v=(0,Lo.useMemo)((()=>t?.type===V?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,Lo.useEffect)((()=>{i&&(o&&f.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),f.current=!0}),[o,i]),(0,ds.jsxs)("div",{className:Cs("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[s?(0,ds.jsx)("img",{className:Cs("card__image"),src:s,alt:""}):null,(0,ds.jsxs)("div",{className:Cs("card__content"),id:e,children:[a&&(0,ds.jsx)("h2",{className:Cs("card__title"),children:a}),r&&(0,ds.jsx)("div",{className:Cs("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,ds.jsx)(h,{tabIndex:i&&!o?-1:void 0,className:Cs("button","button--primary"),"aria-describedby":p,...v,children:n})]})]})};function Bs({item:e,items:t,index:n,isActive:r}){const{t:o}=qo();return(0,ds.jsx)("div",{className:Cs("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:n+1,total:t.length}),children:(0,ds.jsx)(zs,{...e,isCarouselItem:!0,hasFocus:r})})}const Vs={send:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>'},balloon:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>'},newTopic:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>'},newTranslation:{16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>'},avatar:{32:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">\n<path fill="#4A48C1" d="M10,14.8c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S11.1,14.8,10,14.8z M15.9,14.8c1.1,0,2-0.9,2-2s-0.9-2-2-2\n\ts-2,0.9-2,2S14.8,14.8,15.9,14.8z M21.8,10.8c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S22.9,10.8,21.8,10.8z M21.3,18.1H10.7\n\tC11.7,23.9,20.2,23.9,21.3,18.1z"/>\n</svg>\n'},chevronDown:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>'},chevronRight:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>'},close:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>'},enlarge:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>'},options:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>'},file:{32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>'},upload:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>'},download:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>'},error:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>'},arrowLeft:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n'},arrowRight:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},check:{16:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="16px"\n height="16px"\n x="0px"\n y="0px"\n viewBox="0 0 16 16"\n>\n <path\n fill="currentColor"\n d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8\n\tc0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"\n />\n</svg>\n',32:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="32px"\n height="32px"\n x="0px"\n y="0px"\n viewBox="0 0 32 32"\n>\n <path\n fill="currentColor"\n d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6\n\tc0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"\n />\n</svg>\n'}},$s=({name:e,size:t="32",className:n,alt:r})=>(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("div",{"aria-hidden":"true",className:n||Cs("icon"),dangerouslySetInnerHTML:{__html:Vs[e][t]}}),r&&(0,ds.jsx)("span",{className:Cs("visually-hidden"),children:r})]});function Hs({items:e,currentIndex:t,onChange:n,children:r}){const{t:o}=qo(),s=e.length;return(0,ds.jsxs)("div",{className:Cs("carousel-controls"),children:[(0,ds.jsx)("button",{className:Cs("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{n((t-1+s)%s)},children:(0,ds.jsx)($s,{name:"arrowLeft",size:"16",alt:""})}),r,(0,ds.jsx)("button",{className:Cs("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{n((t+1)%s)},children:(0,ds.jsx)($s,{name:"arrowRight",size:"16",alt:""})})]})}function Ws({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:o}){const s=e.length,a=(0,Lo.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,r));o!==t&&n(o)}),[s,t,n]);return(0,ds.jsx)("div",{className:Cs("carousel-pagination__wrapper"),role:"group",children:(0,ds.jsx)("ul",{className:Cs("carousel-pagination"),children:e.map(((e,n)=>{const s=t===n;return(0,ds.jsx)("li",{className:Cs("carousel-pagination__item",s?"is-active":void 0),children:(0,ds.jsx)("button",{className:Cs("carousel-pagination__button"),type:"button",onClick:a,"data-item":n,"aria-disabled":s?"true":void 0,"aria-label":o(e,n)})},r(e,n,"pagination-item-"))}))})})}const Gs=(e,t,n)=>`${n}${t}`,qs=e=>e.label,Ks=({target:e})=>{e.scrollLeft=0};function Js({currentIndex:e=0,onChange:t=()=>{},getItemKey:n=Gs,getItemLabel:r=qs,items:s}){const a=Ms(),i=s.length,[c,l]=(0,Lo.useState)(Number(e||0));(0,Lo.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,Lo.useRef)([]);u.current=(0,Lo.useMemo)((()=>Array(i).fill(1).map((()=>(0,o.createRef)()))),[i]);const d=(0,Lo.useRef)(!0),p=(0,Lo.useRef)(null);return p.current=t,(0,Lo.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,ds.jsxs)("div",{className:Cs("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,ds.jsx)("div",{className:Cs("carousel__slides-wrapper"),onScroll:Ks,children:(0,ds.jsx)("div",{id:a,className:Cs("carousel__slides"),style:{width:100*i+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const r=c===t;return(0,ds.jsx)("div",{ref:u.current[t],className:Cs("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,ds.jsx)(Bs,{item:e,items:s,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,ds.jsx)("div",{className:Cs("carousel__controls"),children:(0,ds.jsx)(Hs,{currentIndex:c,items:s,onChange:l,children:(0,ds.jsx)("div",{className:Cs("carousel__pagination"),children:(0,ds.jsx)(Ws,{currentIndex:c,items:s,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const Xs=(e,t,n="")=>`${n}${e.title}:${t}`,Ys=e=>e.title,Qs=e=>{const{payload:t}=e,[n,r]=(0,Lo.useState)(!1),{addMessageBubble:o,emitEvent:s,sendAction:a}=rs(),i=ns(),{activeServiceSessionId:c}=wn(),l=Zt(_n),{body:u}=xs(e),{service:d}=t,p=(0,Lo.useMemo)((()=>{if("choice_prompt"===e.payload.type)return{...e,payload:{...e.payload,body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&{...e.payload.translatedBody,data:e.payload.translatedBody?.prompt}}}}),[e]),f=u?.chooseAgain&&c===d?.serviceSessionId&&t.id!==l;return(0,Lo.useEffect)((()=>{r(t.id===l)}),[t,l]),{body:u,subEvent:p,showOptions:n,chooseAgain:f,onChoiceClickHandler:e=>{if(!i())return;const n=$(),c={type:"pick_choice",originMessage:t.id,choice:{chooseAgain:f,id:e.id},transactionId:n};o(e.text,n),a(c),r(!1),s(`action.${c.type}`,{...c,choice:{...c.choice,text:e.text}})},onChooseAgainClickHandler:()=>{r((e=>!e))}}},Zs=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,ea=({id:e,categories:t=[],question:n,onClick:r,hasIcon:o})=>{const s=(0,Lo.useMemo)((()=>["suggestions__item",...t.map(Zs)]),[t]),a=(0,Lo.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,ds.jsx)("li",{className:Cs(s),children:(0,ds.jsxs)("button",{type:"button",onClick:a,className:Cs("button","button--primary"),children:[o&&(0,ds.jsx)($s,{name:"chevronRight",size:"8",alt:""}),n]})})},ta=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,ds.jsx)("ul",{className:Cs("suggestions__list",e||""),children:t.map((e=>(0,ds.jsx)(ea,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),na=({originMessage:e,transactionId:t})=>{const{emitEvent:n,sendAction:r}=rs();return o=>{if(o.target&&o.target.dataset.linkId){const s={type:"navigate",originMessage:e,transactionId:t,link:{id:o.target.dataset.linkId,url:o.target.getAttribute("href")}};r(s),n(`action.${s.type}`,s)}}},ra=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:o,iconSize:s,iconClassName:a,dividerType:i,title:c,description:l})=>{const u=Boolean(o||n);return(0,ds.jsxs)("div",{className:Cs("divider",i&&`divider--type-${i}`,t),children:[u&&(0,ds.jsx)("span",{className:Cs("divider__graphic"),children:o?(0,ds.jsx)($s,{name:o,size:s,className:a,alt:""}):(0,ds.jsx)("img",{src:n||void 0,className:Cs({icon:"icon"===r,avatar:"avatar"===r},a)})}),(0,ds.jsxs)("div",{className:Cs("divider__body"),children:[c?(0,ds.jsx)("h2",{className:Cs("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,ds.jsx)("p",{className:Cs("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},oa={[z.new_topic]:"new-topic"},sa={default:({event:e})=>{const{t}=qo(),{subtype:n}=e.payload.body,r=oa[z[n]];return z[n]?(0,ds.jsx)(ra,{dividerType:r,iconName:z[n],title:t(`dividerKeys.${z[n]}`)}):null},[z.new_translation]:({event:e})=>{const{t}=qo(),n=vn(),{body:{translationEnabled:r,text:o,title:s},id:a}=e.payload,i=Zt((e=>e.translations.translatedEventGroups)),c=Oo(),l=(0,Lo.useCallback)((()=>{i[a]?c(_o({events:n,id:a})):c(Co({events:n,id:a}))}),[c,n,a,i]);return(0,ds.jsx)(ra,{iconName:"newTranslation",dividerType:"new-translation",title:s,description:o,children:r?(0,ds.jsx)(ds.Fragment,{children:(0,ds.jsx)("button",{className:Cs("button","button--secondary"),onClick:l,children:t(i[a]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},aa={month:"long",day:"numeric",year:"numeric"},ia={hour:"numeric",minute:"numeric"},ca=({event:e})=>{const t=(()=>{const[e,t]=(0,Lo.useReducer)((e=>e+1),0);return(0,Lo.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:o,srText:s}=(e=>{const{t}=qo(),n=en(),r=n?.context?.userLocale??[],o=new Date(e),s=new Date,a=new Date(s);a.setHours(24,0,0,0);const i=a.valueOf()-s.valueOf(),c=o.toString(),l=new Intl.DateTimeFormat(r,ia).format(o);let u=((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})(o,s);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,aa).format(o)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:i}})(rn(e.payload.timeIndicator));return(0,Lo.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,ds.jsxs)(ra,{dividerType:"time-indicator",children:[(0,ds.jsxs)("h2",{className:Cs("divider__time"),"aria-hidden":"true",children:[(0,ds.jsx)("span",{className:Cs("divider__time--date"),children:n}),(0,ds.jsx)("span",{className:Cs("divider__time--time"),children:r})]}),(0,ds.jsx)("p",{className:Cs("visually-hidden"),children:s})]})};var la=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ua=la.join(","),da="undefined"==typeof Element,pa=da?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,fa=!da&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ha=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},ma=function(e,t,n){if(ha(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ua));return t&&pa.call(e,ua)&&r.unshift(e),r.filter(n)},ya=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var a=s.shift();if(!ha(a,!1))if("SLOT"===a.tagName){var i=a.assignedElements(),c=e(i.length?i:a.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:a,candidates:c})}else{pa.call(a,ua)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var l=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),u=!ha(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(l&&u){var d=e(!0===l?a.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:a,candidates:d})}else s.unshift.apply(s,a.children)}}return o},va=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ga=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!va(e)?0:e.tabIndex},ba=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},xa=function(e){return"INPUT"===e.tagName},wa=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},_a=function(e,t){return!(t.disabled||ha(t)||function(e){return xa(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=pa.call(e,"details>summary:first-of-type")?e.parentElement:e;if(pa.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return wa(e)}else{if("function"==typeof r){for(var s=e;e;){var a=e.parentElement,i=fa(e);if(a&&!a.shadowRoot&&!0===r(a))return wa(e);e=e.assignedSlot?e.assignedSlot:a||i===e.ownerDocument?a:i.host}e=s}if(function(e){var t,n,r,o,s=e&&fa(e),a=null===(t=s)||void 0===t?void 0:t.host,i=!1;if(s&&s!==e)for(i=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!i&&a;){var c,l,u;i=!(null===(l=a=null===(c=s=fa(a))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(a))}return i}(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!!pa.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ca=function(e,t){return!(function(e){return function(e){return xa(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||fa(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)||ga(t)<0||!_a(e,t))},Ea=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Sa=function e(t){var n=[],r=[];return t.forEach((function(t,o){var s=!!t.scopeParent,a=s?t.scopeParent:t,i=function(e,t){var n=ga(e);return n<0&&t&&!va(e)?0:n}(a,s),c=s?e(t.candidates):a;0===i?s?n.push.apply(n,c):n.push(a):r.push({documentOrder:o,tabIndex:i,item:t,isScope:s,content:c})})),r.sort(ba).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ja=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==pa.call(e,ua)&&Ca(t,e)},Ta=la.concat("iframe").join(","),Na=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==pa.call(e,Ta)&&_a(t,e)};function Ia(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ka(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 La(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){ka(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}var Aa=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},Ra=function(e){return Aa(e)&&!e.shiftKey},Pa=function(e){return Aa(e)&&e.shiftKey},Ma=function(e){return setTimeout(e,0)},Da=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},Ua=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},Fa=[],za=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||Fa,s=La({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ra,isKeyBackward:Pa},t),a={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},i=function(e,t,n){return e&&void 0!==e[t]?e[t]:s[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return a.containerGroups.findIndex((function(t){var r=t.container,o=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||o.find((function(t){return t===e}))}))},l=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.hasFallback,a=void 0!==o&&o,i=n.params,c=void 0===i?[]:i,l=s[e];if("function"==typeof l&&(l=l.apply(void 0,function(e){if(Array.isArray(e))return Ia(e)}(t=c)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Ia(e,t);var n={}.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)?Ia(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),!0===l&&(l=void 0),!l){if(void 0===l||!1===l)return l;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var u=l;if("string"==typeof l){try{u=r.querySelector(l)}catch(t){throw new Error("`".concat(e,'` appears to be an invalid selector; error="').concat(t.message,'"'))}if(!u&&!a)throw new Error("`".concat(e,"` as selector refers to no known node"))}return u},u=function(){var e=l("initialFocus",{hasFallback:!0});if(!1===e)return!1;if(void 0===e||e&&!Na(e,s.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=a.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}else null===e&&(e=l("fallbackFocus"));if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(a.containerGroups=a.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?ya([e],t.includeContainer,{filter:Ca.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ea}):ma(e,t.includeContainer,Ca.bind(null,t)),Sa(n)}(e,s.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?ya([e],t.includeContainer,{filter:_a.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):ma(e,t.includeContainer,_a.bind(null,t))}(e,s.tabbableOptions),r=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,a=n.find((function(e){return ja(e)})),i=n.slice().reverse().find((function(e){return ja(e)})),c=!!t.find((function(e){return ga(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:a,lastDomTabbableNode:i,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=t.indexOf(e);return o<0?r?n.slice(n.indexOf(e)+1).find((function(e){return ja(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return ja(e)})):t[o+(r?1:-1)]}}})),a.tabbableGroups=a.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),a.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find((function(e){return e.posTabIndexesFound}))&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function(e){var t=e.activeElement;if(t)return t.shadowRoot&&null!==t.shadowRoot.activeElement?p(t.shadowRoot):t},f=function(e){!1!==e&&e!==p(document)&&(e&&e.focus?(e.focus({preventScroll:!!s.preventScroll}),a.mostRecentlyFocusedNode=e,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(e)&&e.select()):f(u()))},h=function(e){var t=l("setReturnFocus",{params:[e]});return t||!1!==t&&e},m=function(e){var t=e.target,n=e.event,r=e.isBackward,o=void 0!==r&&r;t=t||Ua(n),d();var i=null;if(a.tabbableGroups.length>0){var u=c(t,n),p=u>=0?a.containerGroups[u]:void 0;if(u<0)i=o?a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:a.tabbableGroups[0].firstTabbableNode;else if(o){var f=a.tabbableGroups.findIndex((function(e){var n=e.firstTabbableNode;return t===n}));if(f<0&&(p.container===t||Na(t,s.tabbableOptions)&&!ja(t,s.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(f=u),f>=0){var h=0===f?a.tabbableGroups.length-1:f-1,m=a.tabbableGroups[h];i=ga(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else Aa(n)||(i=p.nextTabbableNode(t,!1))}else{var y=a.tabbableGroups.findIndex((function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||Na(t,s.tabbableOptions)&&!ja(t,s.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var v=y===a.tabbableGroups.length-1?0:y+1,g=a.tabbableGroups[v];i=ga(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else Aa(n)||(i=p.nextTabbableNode(t))}}else i=l("fallbackFocus");return i},y=function(e){var t=Ua(e);c(t,e)>=0||(Da(s.clickOutsideDeactivates,e)?n.deactivate({returnFocus:s.returnFocusOnDeactivate}):Da(s.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=Ua(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(a.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var o=!0;if(a.mostRecentlyFocusedNode)if(ga(a.mostRecentlyFocusedNode)>0){var i=c(a.mostRecentlyFocusedNode),l=a.containerGroups[i].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===a.mostRecentlyFocusedNode}));d>=0&&(s.isKeyForward(a.recentNavEvent)?d+1<l.length&&(r=l[d+1],o=!1):d-1>=0&&(r=l[d-1],o=!1))}}else a.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return ga(e)>0}))}))||(o=!1);else o=!1;o&&(r=m({target:a.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(a.recentNavEvent)})),f(r||a.mostRecentlyFocusedNode||u())}a.recentNavEvent=void 0},g=function(e){(s.isKeyForward(e)||s.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(Aa(e)&&e.preventDefault(),f(n))}(e,s.isKeyBackward(e))},b=function(e){var t;"Escape"!==(null==(t=e)?void 0:t.key)&&"Esc"!==(null==t?void 0:t.key)&&27!==(null==t?void 0:t.keyCode)||!1===Da(s.escapeDeactivates,e)||(e.preventDefault(),n.deactivate())},x=function(e){var t=Ua(e);c(t,e)>=0||Da(s.clickOutsideDeactivates,e)||Da(s.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},w=function(){if(a.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n._setPausedState(!0)}var r=e.indexOf(t);-1===r||e.splice(r,1),e.push(t)}(o,n),a.delayInitialFocusTimer=s.delayInitialFocus?Ma((function(){f(u())})):f(u()),r.addEventListener("focusin",v,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",x,{capture:!0,passive:!1}),r.addEventListener("keydown",g,{capture:!0,passive:!1}),r.addEventListener("keydown",b),n},_=function(){if(a.active)return r.removeEventListener("focusin",v,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",x,!0),r.removeEventListener("keydown",g,!0),r.removeEventListener("keydown",b),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===a.mostRecentlyFocusedNode}))}))&&f(u())})):void 0,E=function(){C&&(C.disconnect(),a.active&&!a.paused&&a.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return a.active},get paused(){return a.paused},activate:function(e){if(a.active)return this;var t=i(e,"onActivate"),n=i(e,"onPostActivate"),o=i(e,"checkCanFocusTrap");o||d(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var s=function(){o&&d(),w(),E(),null==n||n()};return o?(o(a.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!a.active)return this;var t=La({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},e);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,_(),a.active=!1,a.paused=!1,E(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}(o,n);var r=i(t,"onDeactivate"),c=i(t,"onPostDeactivate"),l=i(t,"checkCanReturnFocus"),u=i(t,"returnFocus","returnFocusOnDeactivate");null==r||r();var d=function(){Ma((function(){u&&f(h(a.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(h(a.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){return a.active?(a.manuallyPaused=!0,this._setPausedState(!0,e)):this},unpause:function(e){return a.active?(a.manuallyPaused=!1,o[o.length-1]!==this?this:this._setPausedState(!1,e)):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return a.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),a.active&&d(),E(),this}},Object.defineProperties(n,{_isManuallyPaused:{value:function(){return a.manuallyPaused}},_setPausedState:{value:function(e,t){if(a.paused===e)return this;if(a.paused=e,e){var n=i(t,"onPause"),r=i(t,"onPostPause");null==n||n(),_(),E(),null==r||r()}else{var o=i(t,"onUnpause"),s=i(t,"onPostUnpause");null==o||o(),d(),w(),E(),null==s||s()}return this}}}),n.updateContainerElements(e),n};const Ba=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":s})=>{const a=Ms(),i=(0,Lo.useRef)(null),c=(0,Lo.useRef)(null),[l,u]=(0,Lo.useState)(!1);return(0,Lo.useEffect)((()=>(l&&i.current&&(c.current=za(i.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,Lo.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(null!==r&&e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[l]),(0,Lo.useEffect)((()=>{l&&i.current&&i.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,Lo.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",a),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),r&&t.setAttribute("aria-label",r),s&&t.setAttribute("aria-labelledby",s),e.appendChild(t),i.current=t,u(!0),()=>{i.current&&(e.removeChild(i.current),i.current=null)}}),[r,s,a]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>i.current&&(0,o.render)(e,i.current)}):i.current&&(0,o.render)((0,o.toChildArray)(e).filter(pn).map((e=>(e.props={...e.props,onClose:t},e))),i.current)},Va=({url:e,description:t,onClose:n})=>{const r=en(),o=As(),s=Es(),a=(0,Lo.useRef)(null),{t:i}=qo(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof s?c.push(...s):c.push(...s(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,ds.jsx)(Ba,{onClose:n,"aria-label":i("lightbox.heading"),fallBackFocusRef:a,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,ds.jsx)("div",{className:Cs(c),onClick:u,style:d,children:(0,ds.jsxs)("div",{className:Cs("modal__float"),tabIndex:-1,onMouseDown:o,onKeyDown:o,onTouchStart:o,onMouseMove:o,onWheel:o,onPointerDown:o,onPointerMove:o,ref:a,children:[(0,ds.jsx)("div",{className:Cs("modal__inner"),onClick:l,children:(0,ds.jsx)("img",{className:Cs("modal__image"),src:e,alt:t})}),(0,ds.jsxs)("button",{type:"button",className:Cs("modal__close"),onClick:n,children:[(0,ds.jsx)($s,{name:"close",size:"16",alt:""}),i("lightbox.closeLabel")]})]})}))(n))})},$a=({description:e,url:t})=>{const{t:n}=qo(),[r,o]=(0,Lo.useState)(!1);return(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsxs)("button",{type:"button",className:Cs("modal__enlarge"),onClick:()=>{o(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,ds.jsx)($s,{name:"enlarge",size:"32",alt:""})]}),r&&(0,ds.jsx)(Va,{url:t,description:e,onClose:()=>{o(!1)}})]})},Ha=({event:e,...t})=>{const{body:n}=xs(e),r=na({originMessage:e.payload.id,transactionId:e.payload.transactionId}),o=(0,Lo.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,ds.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,ds.jsx)(Fs,{type:"text",event:e,onClick:r,...t,...o})},Wa="PROCESSING_IMAGE",Ga=({img:e,filename:t})=>{const{t:n}=qo(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,ds.jsx)(ds.Fragment,{children:(0,ds.jsxs)("span",{className:Cs(["download","download--preview"]),children:[(0,ds.jsx)("img",{src:e,alt:r}),(0,ds.jsx)("span",{"aria-hidden":"true",className:Cs("file-download"),children:t})]})})},qa=({children:e,fileId:t,isDeleted:n,onClickHandler:r,url:o,target:s})=>t&&!n?(0,ds.jsx)("button",{type:"button",onClick:r,className:Cs(["download","download-link"]),children:e}):o?(0,ds.jsx)("a",{href:o,download:!0,target:s,className:Cs(["download","download-link"]),children:e}):(0,ds.jsx)("span",{className:Cs("download"),children:e}),Ka={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=qo(),s=Ms(),{body:a,subEvent:i,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=Qs(e);return(0,ds.jsxs)(ds.Fragment,{children:[(0,o.toChildArray)(t).filter(pn).map((e=>(e.props={...e.props,event:i,descriptorId:s,showTranslationToggle:!1},e))),l&&(0,ds.jsxs)("button",{type:"button",className:Cs("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":s,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,ds.jsx)($s,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,ds.jsx)(Fs,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,ds.jsx)("ul",{className:Cs("choice-prompt","choice-prompt--many"),children:a?.choices?.map((e=>(0,ds.jsx)("li",{className:Cs("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:Ha,image:({event:e,descriptorId:t,...n})=>{const{body:r}=xs(e),[o,s]=(0,Lo.useState)(!1),a=Oo();return(0,ds.jsxs)(Fs,{event:e,type:"image",...n,children:[(0,ds.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{a(Yr(e.payload.id)),s(!0)}}),r?.isZoomable&&o&&(0,ds.jsx)($a,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=xs(e),o=na({originMessage:n.id,transactionId:n.transactionId});return(0,ds.jsx)(Fs,{type:"splash",event:e,onClick:o,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=xs(e);return Ss(e).push("message--type-video"),(0,ds.jsxs)(Fs,{event:e,type:"video",...n,children:[(0,ds.jsx)("div",{id:t,className:Cs("visually-hidden"),children:r?.description}),(0,ds.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=qo(),{body:r}=xs(e),{fromClient:o,id:s}=e.payload,{filename:a,id:i,isDeleted:c,url:l}=r,u=es(),d=(e=>{const{processingFileUploads:t}=Zt((({state:e})=>e));return(0,Lo.useMemo)((()=>{if(t.some((t=>t===e)))return Wa;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(s),p=(0,Lo.useMemo)((()=>n(c||!l&&!i?"fileUpload.srFileUploadedText":"fileUpload.srFileDownloadText",{fileName:a})),[l,i,a,c,n]);return(0,ds.jsx)(Fs,{event:e,type:"upload",...t,children:d&&d!==Wa?(0,ds.jsx)(Ga,{img:d,filename:a}):(0,ds.jsxs)(qa,{fileId:i,isDeleted:c,onClickHandler:()=>{i&&a&&u.downloadFile(i,a)},url:l,target:o?void 0:"_blank",children:[(0,ds.jsx)($s,{name:"download",size:"16",alt:p}),(0,ds.jsx)("span",{"aria-hidden":"true",className:Cs("file-download"),children:a})]})})},cta:({event:e})=>{const{body:t}=xs(e),n=na({originMessage:e.payload.id,transactionId:e.payload.transactionId}),{emitEvent:r}=rs(),o=Ms(),s=(0,Lo.useCallback)((()=>r(`action.${R}`,{type:R,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,ds.jsxs)(Fs,{type:"cta",event:e,children:[(0,ds.jsx)("div",{className:Cs("cta__content"),id:o,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,ds.jsx)("a",{className:Cs("button","button--primary"),"aria-describedby":o,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:s,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=xs(e),n=t.cards;return(0,ds.jsx)(Fs,{event:e,modifiers:"type-carousel",children:(0,ds.jsx)(Js,{items:n,getItemKey:Xs,getItemLabel:Ys})})},card:({event:e})=>{const{body:t}=xs(e),n=Ms();return(0,ds.jsx)(Fs,{type:"card",event:e,children:(0,ds.jsx)(zs,{id:n,...t})})}},info:{text:Ha,divider:({event:e,...t})=>{const n=sa[z[e.payload.body.subtype]]||sa.default;return(0,ds.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=qo(),{body:r}=xs(e);return(0,ds.jsx)(Fs,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:ca},participant:{participant:({event:e})=>{const{participant:t}=e.payload,{body:n}=(e=>{const{translatedBody:t,translation:n,body:r}={body:e.payload?.participant?.introduction,translatedBody:e.payload?.participant?.translatedIntroduction,translation:e.payload?.participant?.translation},o=!!t,s=Zt(gs(e));return{body:s&&o?t:r,hasTranslation:o,isTranslated:s&&o,userLocale:n?.locale}})(e);return n?(0,ds.jsx)(ra,{graphicSrc:t?.avatar,graphicType:t?.avatar?"avatar":void 0,iconName:t?.avatar?void 0:"balloon",dividerType:"participant",title:n}):null}},service_data:{suggestion:({event:e,...t})=>{const[n,r]=(0,Lo.useState)(!0),o=Oo(),s=Xo(),{addMessageBubble:a,emitEvent:i,sendAction:c}=rs(),l=ns(),{suggestions:u,payload:d}=(e=>{const{payload:t}=e,{body:n}=xs(e);return{suggestions:n,payload:t}})(e),{showSuggestions:p}=en(),f=vn(),{t:h}=qo(),m=h("suggestions.headingText"),y=h("suggestions.footerText"),v=(0,Lo.useMemo)((()=>f.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[f]),g=(0,Lo.useCallback)((({id:e,question:t})=>{if(!l())return;r(!1),o(Gn(!0));const n=$(),s={type:k,originMessage:d.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}},transactionId:n};c(s),a(t,n),i(`action.${s.type}`,s)}),[a,o,i,l,d.id,c]);return n&&!s&&v&&p?(0,ds.jsxs)("div",{className:Cs("suggestions","suggestions--conversation"),children:[m&&(0,ds.jsx)("p",{className:Cs("suggestions__heading"),children:m}),(0,ds.jsxs)(Fs,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,ds.jsx)(ta,{className:"suggestions__list--conversation",onClickSuggestion:g,suggestions:u}),y&&(0,ds.jsx)("p",{className:Cs("suggestions__footer"),children:y})]})]}):null}}},Ja=({children:e})=>{const{customComponents:t}=en(),n=(0,Lo.useMemo)((()=>Object.keys(Ka).reduce(((e,n)=>(e[n]={...Ka[n],...t?t[n]:{}},e)),{fallback:Ha})),[t]);return(0,ds.jsx)(fs.Provider,{value:n,children:e})},Xa=({children:e})=>{const{isMinimized:t}=Ko(),n=(0,Lo.useRef)(0),{sendAction:r}=rs(),{hasCountdown:o,isActive:s,stopCountdown:a}=Rs(),i=(0,Lo.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),i=()=>{r({type:"interactivity_update"}),n.current=e};o&&s&&(i(),a()),e-n.current>15e3&&i()}),[r,o,s,a,t]);return(0,ds.jsx)("div",{className:Cs("activity-monitor"),tabIndex:-1,onMouseDown:i,onKeyUp:i,onTouchStart:i,onMouseMove:i,onWheel:i,onPointerDown:i,onPointerMove:i,children:(0,ds.jsx)(Ls.Provider,{value:i,children:e})})},Ya=["text","choice_prompt","image","video"],Qa=()=>{const e=js(),t=(0,Lo.useRef)(),n=(0,Lo.useRef)(),r=Oo(),o=Zo(),s=(0,Lo.useRef)(null),{initCountdown:a,endCountdown:i}=Rs(),{emitEvent:c}=rs(),{hasPrompt:l,continueChat:u}=Ps(),d=(0,Lo.useRef)(l);return(0,Lo.useEffect)((()=>{d.current=l}),[l]),(0,Lo.useEffect)((()=>{e.socket&&(e.onConnection((({currentState:e})=>{if("attach_channel_erred"===e){const e=new x;return r(vr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1})),e.onError((e=>{const t=new Kn(e);r(vr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(kr())})),e.onOpen((()=>{r(gr())})))}),[e,e.socket,r]),(0,Lo.useEffect)((()=>{e.onConnection((({connected:t})=>!!t&&(n.current&&e?.removeListener("message",n.current),n.current=e=>{switch(e.type){case"ui":switch(e.payload.type){case"idle_detach_countdown":"idle_detach_countdown"===e.payload.body.type&&a(e.payload.body.duration);break;case"loading":r(Xr(e.payload.body.loading));break;case"idle_detach_countdown_elapsed":i(void 0,!0);break;case"resume_conversation_prompt":r(Dr());break;case"user_first_response":r(Gn(!0)),c("system.userFirstResponse",e.payload.body);break;case"translation_proposal":r(Eo(e.payload.body))}break;case"service_attach":const{service:{name:t,settings:{proactiveMessages:{enabled:n},entry:o},sessionId:s}}=e.payload;r(ho(n||!1)),t&&c("system.serviceChanged",t),s&&r(zr(s)),r(to(o)),r(Hr({uploads:{enabled:o.options?.upload?.enabled||!1}}));break;case"context":e.payload.contentLocale&&e.payload.userLocale&&r(cr(e.payload.userLocale));break;case"message":switch(e.payload.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":if(e.payload.service&&e.payload.service.serviceSessionId&&r(zr(e.payload.service.serviceSessionId)),e.payload.fromClient){r(Nr(e));break}d.current&&u(),r(Tr(e))}break;case"participant":(e=>{const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:o}=t;!n&&"string"!=typeof o&&o?.name&&r(Gr(o.name)),r(Qr(t)),"string"!=typeof o&&o.introduction&&r(Tr({...e,payload:{...t,type:"participant"}}))})(e);break;case"service_data":e.payload.persist&&r(eo(e.payload));break;case"info":"divider"!==e.payload.type&&"text"!==e.payload.type&&"translation"!==e.payload.type||r(Tr({type:"info",payload:{...e.payload,participant:null}}));break;case"error":switch(e.payload.type){case"find_conversation":const t=new w(e);r(vr({name:t.name,action:t.action,message:t.message,originalEvent:t.originalEvent,originalError:t.originalError}));break;case"conversation":const n=new x(e);r(vr({name:n.name,message:n.message,langKey:n.langKey,originalEvent:n.originalEvent,originalError:n.originalError,action:n.action}))}}return e},e.onMessage(n.current),!0)))}),[u,e,r,c,i,o,a]),(0,Lo.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.removeListener("message",t.current),t.current=async({payload:e})=>{if("history_changed"===e?.type)try{const t=await r(hr(e)).unwrap();t&&"service"in t&&r(Kr(t))}catch(e){}return Ya.includes(e?.type)?(e.id!==s.current&&o.emit("message",e),s.current=e.id,e):e},e.addListener("message",t.current),!0)))}),[e,r,o]),null},Za=({children:e})=>{const{t}=qo(),n=Oo(),r=es(),{addUploadBubble:o}=rs(),s=(0,Lo.useCallback)((async(e,t)=>{n(ao(t));const r=await(e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{"string"==typeof r.result&&t(r.result)},r.onerror=e=>n(e)})))(e),o=new Image;o.src=r,await o.decode();const s=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,o]=(e=>{const{height:t,width:n}=e;return n>t&&n>600?[600,600*t/n]:t>600?[600*n/t,600]:[n,t]})(e);return t.width=r,t.height=o,n?.drawImage(e,0,0,r,o),t.toDataURL()})(o);try{sessionStorage.setItem(`image-${t}`,s)}catch(e){}finally{n(io(t))}}),[n]),a=(0,Lo.useCallback)((e=>{const a=$(),i=r.uploadFile(e,(e=>{n(so({fileId:a,progress:Math.ceil(e)}))}),(async t=>{const{id:r,transactionId:i,occurredAt:c,body:{contentType:l,filename:u,filesize:d}}=t;n(ro(a)),o(r,i,c,l,u,d),l.includes("image/")&&await s(e,r)}),(e=>{let r;switch(e?.error||""){case"file_uploads_are_disabled":r=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":r=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":r=t("fileUpload.errors.wrongType");break;case"virus_found":r=t("fileUpload.errors.virusFound");break;default:r=t("fileUpload.errors.general")}n(oo({fileId:a,errorText:r}))}));n(Ur({fileId:a,fileName:e.name,uploadHandle:i}))}),[s,o,r,n,t]);return(0,ds.jsx)(Ts.Provider,{value:a,children:e})},ei=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=Rs();return((e,t)=>{const n=(0,Lo.useRef)(e);(0,Lo.useEffect)((()=>{n.current=e}),[e]),(0,Lo.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},ti=()=>{const{initUserSelectedOptions:e}=ks(),t=(0,Lo.useRef)(!1),n=en();return(0,Lo.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function ni(e,t,n=[]){const r=Zo(),o=(0,Lo.useRef)(t);(0,Lo.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 ri=()=>{const e=en(),{emitEvent:t,sendAction:n,sendContext:r,sendMessage:o}=rs(),s=Oo(),{setVisibility:a,visible:i}=Ko(),c=(0,Lo.useRef)(i),l=Zo(),u=es(),d=bn(),p=(0,Lo.useRef)(null),f=(0,Lo.useRef)(null),{isInline:h,isResolving:m}=Sn(),y=Zt(is),v=(()=>{const{get:e}=ts();return e?e("conversationUrl"):null})(),g=(0,Lo.useRef)(null),b=As(),{enableTranslations:x,disableTranslations:w}=bs();return(0,Lo.useEffect)((()=>{c.current=i}),[i]),ni("askText",(e=>{o({body:e})}),[u.send]),ni("setVariables",(e=>{r({variables:e})}),[u.send]),ni("getVisibility",(e=>{e?e(c.current):console.warn("A callback function is required for the getVisibility action.")})),ni("setVisibility",(e=>{const t="string"==typeof e||null===e?e:e.visibility;Object.values(Ot).includes(t)?(b(),a(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),ni("sendCustomAction",((e,r)=>{const o={type:"custom",body:{type:e,body:r}};n(o),t(`action.${o.type}`,o)}),[u.send]),ni("setTopic",(({name:e,fallbackMessage:t,message:r,userTriggered:o})=>{o&&s(Bn({showSuggestions:!1})),e&&t?n({type:A,body:{name:e,fallbackMessage:t,message:r}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[u.send]),ni("setContext",(e=>{r(e)}),[u.send]),ni("setTranslation",(({enabled:e,locale:t})=>{e?x(t,D):w()}),[u.send]),(0,Lo.useEffect)((()=>{m||y||(g.current&&g.current!==v&&l.emit("unreadMessageCount",d),i===Ot.open&&i!==f.current&&0!==p.current&&l.emit("unreadMessageCount",0),i!==Ot.open&&d!==p.current&&l.emit("unreadMessageCount",d),f.current=i,p.current=d,"string"==typeof v&&(g.current=v))}),[d,i,l,h,m,y,v]),null},oi=({children:e})=>{const t=Zo(),n=(0,Lo.useRef)(null),[r,o]=(0,Lo.useState)(),s=(0,Lo.useRef)(!0),a=(0,Lo.useCallback)((e=>{s.current&&(o(e),t.emit("aria-live",e))}),[o,t]);return(0,Lo.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{a({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,a]),(0,Lo.useEffect)((()=>()=>{s.current=!1}),[]),(0,ds.jsxs)(os.Provider,{value:a,children:[e,(0,ds.jsxs)("div",{className:Cs("app__live-container"),children:[(0,ds.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Cs("visually-hidden"),children:r?.ariaLive===U?r?.messageText:null}),(0,ds.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Cs("visually-hidden"),children:r?.ariaLive===F?r?.messageText:null})]})]})},si=()=>{const{t:e}=qo(),t=hn().historyLoaded,{sendPolite:n}=ss();return(0,Lo.useEffect)((()=>{t&&setTimeout((()=>{n(e("window.srTexts.onHistoryLoad"))}),500)}),[t,e,n]),null},ai=()=>{const{t:e}=qo(),{isOpen:t,isVisible:n}=Ko(),r=bn(),{sendPolite:o}=ss(),s=(0,Lo.useMemo)((()=>nn(o,2e3)),[o]),a=(0,Lo.useRef)(null),i=(0,Lo.useRef)(null);return(0,Lo.useEffect)((()=>{a.current!==n&&!n&&i.current&&i.current(),0!==r&&!t&&n&&(i.current=s(e("message.srTextUnreadCount",{unreadCount:r}))),a.current=n}),[r,t,n,s,e]),null},ii=({store:e,children:t,eventBus:n,api:r})=>((0,Lo.useErrorBoundary)((t=>{console.error(t),e.dispatch(Xn(t))})),(0,ds.jsx)(Ht,{store:e,children:(0,ds.jsx)(Qo.Provider,{value:n,children:(0,ds.jsx)(Yo.Provider,{value:r,children:(0,ds.jsx)(oi,{children:(0,ds.jsx)(ps,{children:(0,ds.jsxs)(Ja,{children:[(0,ds.jsx)(ti,{}),(0,ds.jsx)(Qa,{}),(0,ds.jsx)(ai,{}),(0,ds.jsx)(si,{}),(0,ds.jsx)(ei,{}),(0,ds.jsxs)(Xa,{children:[(0,ds.jsx)(ri,{}),(0,ds.jsx)(Za,{children:t})]})]})})})})})})),ci=Tt(yn,(e=>e.filter((e=>wr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===N)))),li=Tt([ci],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),ui=Tt(ci,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),di=Tt((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),pi=()=>{const{t:e}=qo(),{showDisclaimer:t}=en();return t?(0,ds.jsxs)("div",{className:Cs("disclaimer"),tabIndex:0,children:[(0,ds.jsx)("h2",{className:Cs("disclaimer__title"),children:e("disclaimer.title")}),(0,ds.jsx)("div",{className:Cs("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},fi=Tt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),hi=Tt(fi,(e=>e?.controls||{})),mi=Tt(hi,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),yi=Tt([hi,(e,{name:t})=>t],((e,t)=>e[t]?.value)),vi=Tt([hi,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),gi=(0,o.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:bi,Consumer:xi}=gi,wi=gi;function _i(){return(0,Lo.useContext)(wi)}function Ci(e){const t=Oo(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:s}=_i(),a=!!Zt((e=>fi(e,{formId:n}))),i=Zt((t=>yi(t,{formId:n,name:e}))),c=Zt((t=>vi(t,{formId:n,name:e}))),l=s?.[e],u=!l;(0,Lo.useEffect)((()=>{a&&t(rr({formId:n,name:e}))}),[a,n,e,t]),(0,Lo.useLayoutEffect)((()=>()=>{t(or({formId:n,name:e}))}),[a,n,e,t]);const d=(0,Lo.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,Lo.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,Lo.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:i})),[e,d,p,i]),(0,Lo.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function Ei(e){const{t}=qo(),{sendAssertive:n}=ss(),{hasLimit:r,limit:o}=En(),s=(0,Lo.useMemo)((()=>nn(n,Mn)),[n]),a=(0,Lo.useMemo)((()=>nn(((e,n)=>{e&&s(t("input.srCharacterLimitText",{limit:n}))}),Mn)),[s,t]),[{value:i}]=Ci(e),c="number"==typeof o&&r&&i?o-i.length:o,l=!(!r||"number"!=typeof c)&&c<=Pn,u=!(!r||"number"!=typeof c)&&c<0;return(0,Lo.useEffect)((()=>{a(l,c)}),[l,c,a]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Si=e=>{const{hasCharacterLimit:t,characterLimit:n}=Ei(e),{entryMeta:{optionsOverride:r}}=hn(),{alwaysShowEntryLabel:o}=en(),{t:s}=qo();return{placeholder:(0,Lo.useMemo)((()=>s("input.inputPlaceholder",{hasLimit:t,text:r?.text?.placeholder||s("input.inputPlaceholderText"),limit:t?n:null})),[s,t,n,r?.text?.placeholder]),label:(0,Lo.useMemo)((()=>s("input.inputLabel",{hasLimit:!r?.text?.label&&t,text:r?.text?.label||s("input.inputLabelText"),limit:!r?.text?.label&&t?n:null})),[s,t,n,r?.text?.label]),labelClass:(0,Lo.useMemo)((()=>!0===o||r?.text?.label?"label":"visually-hidden"),[o,r?.text?.label])}};function ji(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=Oo(),{entryMeta:{actions:t,translatedActions:n}}=hn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(no())}}})(),n=es();return e?(0,ds.jsx)("li",{className:Cs(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,ds.jsx)("button",{className:Cs(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:A,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const Ti=(0,o.createContext)(null),Ni=()=>{const e=(0,Lo.useContext)(Ti);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},Ii=Ti,ki=e=>{const t=(()=>{const e=(0,Lo.useContext)(fs);if(!e)throw new Error("useComponentContext has to be used within <ComponentContext.Provider>");return e})(),n=t[e.type];let r=n[e.payload.type],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]},Oi=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=Ni(),{sendAction:o}=rs(),s=e.payload.id?n[e.payload.id]:void 0,{containerRef:a,isVisible:i}=Jo({containerRef:s,freezeOnceVisible:!0}),c=Oo(),[l,u]=ki(e);if((0,us.useEffect)((()=>{if(i&&r?.includes(e.payload.id)){const t=r.reduce(((t,n)=>e?.payload?.id&&n&&!t.includes(e.payload.id)?t.concat(n):t),[]);c(Vr(t)),o({type:"read",events:t})}}),[c,e.payload.id,i,o,r]),!l)return null;const d=["conversation__item"];return"info"===e.type?d.push("conversation__item--source-info"):e.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),t&&d.push("conversation__item--new-participant"),(0,ds.jsxs)("li",{className:Cs(d),ref:a,children:[e.payload.timeIndicator&&(0,ds.jsx)(ca,{event:e}),(0,ds.jsx)(l,{event:e,children:(0,ds.jsx)(u,{event:e})})]})},Li=()=>{const{id:e}=Cn()||{};return(0,ds.jsx)("li",{className:Cs("conversation__item","conversation__item--source-agent"),children:(0,ds.jsxs)("div",{className:Cs("message","message--source-agent","message--type-loading"),children:[(0,ds.jsx)(Us,{eventPayload:{fromClient:!1,participant:e}}),(0,ds.jsx)("div",{className:Cs("message__body"),children:(0,ds.jsxs)("span",{className:Cs("loader"),children:[(0,ds.jsx)("span",{className:Cs("loader__part","one")}),(0,ds.jsx)("span",{className:Cs("loader__part","two")}),(0,ds.jsx)("span",{className:Cs("loader__part","three")}),(0,ds.jsx)("span",{className:Cs("loader__part","four")})]})})]})})},Ai=()=>{const e=vn();let t;return(0,ds.jsx)(ds.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let o=!1;if("info"===n||"message"===n){const{participant:n,fromClient:s}=r,a=s?"seamly-client-participant":n;"info"!==e.type&&t!==a&&(o=!0),t=a}return(0,ds.jsx)(Oi,{event:e,newParticipant:o},e.payload.key||e.payload.id)}))})},Ri=()=>{const{t:e}=qo(),t=gn(),n=((e,t=20)=>{const[n,r]=(0,Lo.useState)(e),o=(0,Lo.useRef)(null);return(0,Lo.useEffect)((()=>(o.current=setTimeout((()=>r(e)),t),()=>{o.current&&clearTimeout(o.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=Ko(),o=xn(),s=vs();return(0,ds.jsxs)(ds.Fragment,{children:[r&&(0,ds.jsx)("a",{className:Cs("skip-link"),href:`#${o}`,onClick:e=>{e.preventDefault(),s()},children:e("skiplinkText")}),(0,ds.jsx)("div",{className:Cs("chat__body"),children:(0,ds.jsxs)("div",{className:Cs("conversation__container"),children:[(0,ds.jsx)(pi,{}),(0,ds.jsxs)("ol",{className:Cs("conversation"),role:"log","aria-label":e("chat.srLabel"),children:[(0,ds.jsx)(Ja,{children:(0,ds.jsx)(Ai,{})}),n?(0,ds.jsx)(Li,{}):null,(0,ds.jsx)(ji,{})]})]})})]})};function Pi(e,t){const n=(0,Lo.useRef)(null),r=(0,Lo.useRef)(e);return(0,Lo.useEffect)((()=>{r.current=e}),[e]),(0,Lo.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const Mi={visible:Cs("transition--visible"),in:Cs("transition--in"),visuallyHidden:Cs("visually-hidden")},Di=Object.values(Mi),Ui=e=>{const t=(0,Lo.useRef)(null);t.current=e;const n="function"==typeof e;return(0,Lo.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Fi="notRendered",zi="rendered",Bi="visuallyHidden",Vi=({children:e,isActive:t,timeout:n=300,transitionStartState:r=Fi,onInTransitionComplete:s=()=>{},onOutTransitionComplete:a=()=>{},exitAfter:i,enterDelay:c=0})=>{const l=(0,Lo.useRef)(!1),u=(0,Lo.useRef)(null),d=(0,Lo.useRef)(null),p=r===Bi,[f,h]=(0,Lo.useState)((()=>p?[Mi.visuallyHidden]:[])),[m,y]=(0,Lo.useState)((()=>0===c)),v=(0,Lo.useMemo)((()=>i?i+c:i),[c,i]);Pi((()=>y(!1)),t?v:void 0),Pi((()=>y(!0)),t?c:void 0);const g=(0,Lo.useMemo)((()=>m&&t),[t,m]),b=Ui(s),x=Ui(a),w="notRendered"!==r||f.length>0;return(0,Lo.useEffect)((()=>(l.current&&!g&&(h([Mi.visible]),u.current=setTimeout((()=>{h([...p?[Mi.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&g&&(h([Mi.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{h([Mi.visible,Mi.in]),b&&(u.current=setTimeout((()=>{b()}),n))}))}))),l.current=g,()=>{u.current&&clearTimeout(u.current),d.current&&cancelAnimationFrame(d.current)})),[p,b,x,n,g]),(0,ds.jsx)(ds.Fragment,{children:w&&(0,o.toChildArray)(e).filter(pn).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!Di.includes(e)));return(0,o.cloneElement)(e,{className:[...n,...f].join(" ")})}))})},$i=({isAside:e=!1})=>{const{isInline:t}=Sn(),{t:n}=qo(),{addMessageBubble:r,emitEvent:o,sendAction:s}=rs(),a=ns(),{isOpen:i,setVisibility:c}=Ko(),{showSuggestions:l}=en(),u=Ms(),d=vs(),p=(0,Lo.useRef)(null),{sendPolite:f}=ss(),h=Zt(is),{hasCountdown:m,endCountdown:y}=Rs(),{hasPrompt:v,continueChat:g}=Ps(),b=Xo(),x=hn().serviceData.suggestion;const{body:w}=xs({payload:x,type:"service_data"}),_=(0,Lo.useMemo)((()=>h?[]:Array.isArray(w)?w:[]),[w,h]),C=(0,Lo.useRef)(),E=(0,Lo.useRef)(!1),S=(0,Lo.useRef)(),j=!!_?.length,T=t?(b||i)&&!e:b,N=(0,Lo.useRef)(T),I=j&&!T&&l,O=j?_:S.current;S.current=O;const L=(0,Lo.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Cs(t)}),[e]),A=(0,Lo.useCallback)((({id:e,question:t})=>{if(!a())return;m&&y(!0),v&&g();const n=$(),l={type:k,originMessage:x.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}},transactionId:n};s(l),r(t,n),o(`action.${l.type}`,l),i||c({visibility:Ot.open}),d()}),[r,g,y,o,d,a,m,v,i,x,s,c]);(0,Lo.useEffect)((()=>{if(C.current!==_&&!T){if(j){const e=E.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{f(e)}),30)}else E.current&&f(n("suggestions.srUnavailableText"));C.current=_}!N.current&&T?(dn(p.current,d),f(n("suggestions.srUnavailableText"))):!j&&E.current&&dn(p.current,d),E.current=j,N.current=T}),[_,j,T,d,f,n]);const R=n("suggestions.headingText"),P=n("suggestions.footerText"),M=R?"section":"div";return(0,ds.jsx)(Vi,{isActive:!!I,transitionStartState:Fi,children:(0,ds.jsxs)(M,{className:L,"aria-labelledby":R?u:void 0,ref:p,children:[R&&(0,ds.jsx)("p",{id:u,className:Cs("suggestions__heading"),children:R}),!!O&&(0,ds.jsx)(ta,{suggestions:O,onClickSuggestion:A}),P&&!i&&(0,ds.jsx)("p",{className:Cs("suggestions__footer"),children:P})]})})},Hi=(0,us.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:o,setVisibility:s}=Ko(),{namespace:a,layoutMode:i}=en(),{isInline:c}=Sn(),l=Es(),u=Ms(),d=Xo(),{t:p}=qo(),f=["chat",`chat--layout-${i}`,`namespace--${a}`,t];return"function"!=typeof l&&f.push(...l),r||"app"===i||f.push("chat--collapsed"),d&&f.push("chat--user-responded"),o&&(0,ds.jsxs)("section",{className:Cs(f),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&s({visibility:Ot.minimized})},tabIndex:-1,ref:n,role:"window"===i?"dialog":void 0,"aria-labelledby":u,children:[(0,ds.jsx)("h2",{className:Cs("chat__title","visually-hidden"),id:u,children:p("chat.srLabel")}),(0,ds.jsx)("div",{className:Cs("chat-wrapper"),children:e}),"inline"===i&&r&&(0,ds.jsx)($i,{isAside:!0})]})})),Wi=Hi,Gi=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:o,id:s})=>{const a=Ms();return(0,ds.jsxs)("section",{tabIndex:-1,id:s,"aria-labelledby":n?a:void 0,className:Cs("chat-status",n?void 0:"chat-status--condensed"),children:[(0,ds.jsxs)("div",{className:Cs("chat-status__body"),children:[n?(0,ds.jsx)("h2",{className:Cs("chat-status__title"),id:a,children:n}):null,e]}),"function"==typeof t&&(0,ds.jsxs)("button",{type:"button",onClick:t,className:Cs("button","button--tertiary","chat-status__close"),children:[r||(0,ds.jsx)($s,{name:"close",size:"16",alt:""}),o&&(0,ds.jsx)("span",{className:Cs("visually-hidden"),children:o})]})]})},qi=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,ds.jsxs)("button",{type:"button",onClick:e,className:Cs("button","button--primary","chat-status__button"),children:[(0,ds.jsx)($s,{name:t,size:"16",alt:""}),n,r&&(0,ds.jsx)("span",{className:Cs("visually-hidden"),children:r})]});function Ki(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=(()=>{const{isActive:e,languages:t}=bs(),n=Oo(),{sendAction:r}=rs(),{translationProposal:o}=Zt((e=>e.translations)),{enableTranslations:s}=bs(),{isOpen:a}=Ko(),{userLocale:i}=qo(),c=o?.proposedLocale,l=_s(c),u=(0,Lo.useMemo)((()=>null!==o&&!e&&a&&i!==c&&t.some((e=>e.locale===c))),[o,e,a,i,c,t]);return{activateTranslationProposal:()=>{o?.proposedLocale&&s(o.proposedLocale,M)},dismissTranslationProposal:()=>{r({type:L,body:{type:P}}),n(So())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}})(),{id:o}=ws();return e&&t?(0,ds.jsx)(Gi,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:o,title:t.titleLabel,children:(0,ds.jsx)(qi,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function Ji(){const e=Zt(is),{isActive:t}=bs();return e||t?null:(0,ds.jsx)(Ki,{})}const Xi=({label:e,checked:t,description:n,onChange:r,id:o,itemClassName:s})=>(0,ds.jsxs)("li",{className:Cs([s||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:o,children:[(0,ds.jsx)($s,{name:"check",size:"16",alt:""}),e," ",n&&(0,ds.jsxs)("span",{children:["(",n,")"]})]}),Yi=({onChange:e,describedById:t})=>{const{context:{contentLocale:n}}=en(),{t:r}=qo(),{languages:o,currentLocale:s,enableTranslations:a,disableTranslations:i}=bs(),c=vs(),l=t=>()=>{t&&(t===s||n===t?i():a(t,"translation_choice"),e(),c())},{primaryLanguages:u,remainingLanguages:d}=(0,us.useMemo)((()=>o.reduce(((e,t)=>{const r=t.locale===n,o=((e,t,n)=>t===e.locale||!t&&n)(t,s,r);t.locale!==n&&e.remainingLanguages.push({...t,checked:o,isOriginal:r});const a=e.remainingLanguages.findIndex((e=>e.locale===s));return(r||o&&a>4)&&e.primaryLanguages.push({...t,checked:o,isOriginal:r}),e}),{primaryLanguages:[],remainingLanguages:[]})),[s,n,o]);return(0,ds.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Cs("translation-options"),children:[u.map((({locale:e,nativeName:t,checked:n,isOriginal:o},s)=>(0,ds.jsx)(Xi,{id:e,label:t,checked:n,description:o?r("translations.settings.original"):void 0,onChange:l(e),itemClassName:Cs({"translation-options__item--original":o,"translation-options__item--selected":n&&0!==s})},e))),d.map((({locale:e,nativeName:t,checked:n,isOriginal:o})=>(0,ds.jsx)(Xi,{id:e,label:t,checked:n,description:o?r("translations.settings.original"):void 0,onChange:l(e)},e)))]})},Qi=({className:e,children:t,onCancel:n,headingText:r,description:o,descriptionId:s,cancelButtonText:a,cancelButtonRef:i,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=Ms(),{hideOption:d}=ks(),{focusButton:p}=Os(),f=(0,Lo.useCallback)((()=>{d(),c||p()}),[c,p,d]),h=(0,Lo.useCallback)((()=>{n&&n(),f()}),[f,n]),m=(e=>{const t=(0,Lo.useRef)(null);return(0,Lo.useEffect)((()=>{const n=n=>{t.current&&n.target instanceof HTMLElement&&!t.current.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),e())};return document.addEventListener("click",n,!0),document.addEventListener("touchstart",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("touchstart",n,!0)}}),[e,t]),t})(h);return(0,Lo.useEffect)((()=>{un(m.current)}),[m]),(0,ds.jsx)("section",{className:Cs("options",{"options--right":"right"===l.horizontal,"options--left":"left"===l.horizontal,"options--top":"top"===l.vertical,"options--bottom":"bottom"===l.vertical},e||""),"aria-labelledby":u,tabIndex:-1,ref:m,children:(0,ds.jsxs)("div",{className:Cs("options__body"),children:[(0,ds.jsx)("h2",{id:u,className:Cs("options__title"),children:r}),(0,ds.jsxs)("button",{type:"button",onClick:h,"aria-describedby":u,className:Cs("button","options__close"),ref:e=>{i&&(i.current=e)},children:[(0,ds.jsx)($s,{name:"close",size:"16",alt:""}),(0,ds.jsx)("span",{children:a})]}),o?(0,ds.jsx)("p",{className:Cs("options__description"),id:s,children:o}):null,(0,ds.jsx)("div",{className:Cs("options__wrapper"),children:t})]})})},Zi=function({onClose:e,position:t}){const{t:n}=qo(),r=Ms();return(0,ds.jsx)(Qi,{onCancel:e,headingText:n("translations.menu.title"),cancelButtonText:n("translations.settings.cancelButtonText"),description:n("translations.menu.description"),descriptionId:r,position:t,disableButtonFocusing:!0,children:(0,ds.jsx)(Yi,{describedById:r,onChange:e})})};function ec({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,o]=(0,Lo.useState)(!1),s=(0,Lo.useRef)(null),a=Ms();return(0,ds.jsxs)("div",{className:Cs("translations__container"),onKeyDown:e=>{r&&ln(e)===cn.Escape&&(o(!1),un(s.current))},children:[(0,ds.jsx)(Vi,{transitionStartState:Fi,isActive:r,children:(0,ds.jsx)("div",{className:Cs("options__dialog"),role:"dialog",children:(0,ds.jsx)(Zi,{onClose:()=>{o(!1)},position:t})})}),(0,ds.jsx)("button",{type:"button",className:Cs(["button","chat__options__button",...n]),id:a,onClick:()=>{o(!r)},onKeyDown:e=>{ln(e)===cn.ArrowDown&&(o(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const tc=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:o,validationSchema:s={},...a})=>{const i=Oo(),c=Zt((e=>mi(e,{formId:t}))),[l,u]=(0,Lo.useState)(!1),[d,p]=(0,Lo.useState)({}),{isValid:f,errors:h}=function(e,t){const n=(0,Lo.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const o=Array.isArray(r)?r:[r];for(let r=0;r<o.length;r++)if(!o[r].fn(e[n],o[r].compareValue)){t[n]=o[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,s),m=(0,Lo.useMemo)((()=>({...h,...d})),[h,d]);(0,Lo.useLayoutEffect)((()=>{i(tr({formId:t,persistData:n}))}),[t,n,i]),(0,Lo.useEffect)((()=>()=>{i(nr({formId:t}))}),[t,n,i]);const y=(0,Lo.useCallback)(((e,n)=>{i(sr({formId:t,name:e,value:n}))}),[t,i]),v=(0,Lo.useCallback)(((e,n)=>{i(ar({formId:t,name:e,touched:n}))}),[i,t]),g=(0,Lo.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,Lo.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&f&&(i(Gn(!0)),o(c,{updateControlValue:y,setError:g}))}),[f,i,o,c,y,g]);(0,Lo.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,Lo.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:s,updateControlValue:y,updateControlTouched:v})),[t,c,m,l,b,s,y,v]);return t?o?(0,ds.jsx)(bi,{...a,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},nc=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),rc=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},oc=e=>!!e?.length,sc=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))},ac=e=>!!e,ic=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:o,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=_i();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),a=["form"];return!t&&s&&(a.push("form--submitted"),o?a.push("form--valid"):a.push("form--invalid")),(0,ds.jsx)("form",{onSubmit:r,className:Cs([...a,e]),...n})};function cc({id:e,error:t}){const[n,r]=(0,Lo.useState)(!1);return(0,Lo.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,ds.jsx)("div",{className:Cs("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,ds.jsxs)("span",{id:e,className:Cs("error__message"),children:[(0,ds.jsx)($s,{name:"error",size:"16",alt:""}),t]})})}const lc=({contentHint:e,id:t,labelText:n,labelClass:r,validity:o,errorText:s,children:a})=>(0,ds.jsxs)(ds.Fragment,{children:[e&&(0,ds.jsx)("span",{id:`${t}-content-hint`,className:Cs("input__content-hint"),children:e}),(0,ds.jsx)(cc,{id:`${t}-error`,error:!o&&s}),(0,ds.jsxs)("div",{className:Cs("form-control__wrapper"),children:[(0,ds.jsx)("label",{htmlFor:t,className:Cs(r),children:n}),a]})]}),uc=function({id:e,name:t,type:n,labelText:r,labelClass:o,contentHint:s=null,focus:a,"aria-invalid":i,"aria-describedby":c,...l}){const u=(0,Lo.useRef)(null),{isSubmitted:d}=_i(),[p,{error:f}]=Ci(t),h=d&&f,m=[];return c&&m.push(c),s&&m.push(`${e}-content-hint`),h&&m.push(`${e}-error`),(0,Lo.useLayoutEffect)((()=>{u.current&&a&&u.current.focus()}),[a]),(0,ds.jsx)(lc,{id:e,contentHint:s,validity:!h,errorText:f,labelText:r,labelClass:o,children:(0,ds.jsx)("input",{...p,...l,ref:u,id:e,type:n,"aria-invalid":i||h?"true":"false","aria-describedby":m.join(" ")||void 0,name:t})})};function dc({controlName:e,describedById:t}){const{t:n}=qo();return(0,ds.jsxs)(ic,{noValidate:"true",className:Cs("options__form"),children:[(0,ds.jsx)(uc,{id:"email-id",name:e,type:"email",autocomplete:"email",className:Cs("transcript__input"),"aria-describedby":t,labelClass:Cs("label"),labelText:n("options.sendTranscript.label")}),(0,ds.jsx)("div",{className:Cs("options__actions"),children:(0,ds.jsx)("button",{type:"submit",className:Cs("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const pc="email",fc={sendTranscript:()=>{const[e,t]=(0,Lo.useState)(void 0),{hideOption:n}=ks(),{focusButton:r}=Os(),{t:o}=qo(),s=Ms(),{sendAction:a}=rs(),i=(0,Lo.useMemo)((()=>({[pc]:[nc(ac,o("options.sendTranscript.noEmailText")),nc(sc,o("options.sendTranscript.invalidEmailText"))]})),[o]),c=(0,Lo.useCallback)((e=>{const t=e[pc].trim();a({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[a,n,r]),l=(0,Lo.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,ds.jsx)(Qi,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),description:o("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,ds.jsx)(tc,{formId:"sendTranscript",onSubmit:c,validationSchema:i,onError:l,children:(0,ds.jsx)(dc,{controlName:pc,describedById:s})})})}},hc=()=>{const{optionActive:e}=ks(),t=(0,Lo.useRef)(),n=fc[t.current??e];return e&&(t.current=e),n?(0,ds.jsx)(n,{}):null},mc=()=>{const{t:e}=qo(),{menuOptions:t,showOption:n,panelActive:r,hideOption:o}=ks(),{id:s}=Os(),a=(0,Lo.useRef)(null),[i,c]=(0,Lo.useState)(!1),l=(0,Lo.useRef)(null),u=t.length,d=(0,Lo.useRef)([]),p=(0,Lo.useRef)(!1),f=u>1,h=t[0],m=(0,Lo.useMemo)((()=>h?.name?.trim().replace(/\s+/g,"")),[h]);return(0,Lo.useEffect)((()=>()=>{a.current&&clearTimeout(a.current)}),[]),(0,Lo.useEffect)((()=>{i&&!p.current&&requestAnimationFrame((async()=>{await hs(60);const e=t.findIndex((e=>e.available)),n=-1===e?0:e;d.current&&un(d.current[n])})),p.current=i}),[i,t]),u?(0,ds.jsxs)("div",{className:Cs("options__container"),onKeyDown:e=>{i&&(ln(e)===cn.Escape&&(c(!1),un(l.current)),ln(e)===cn.Home&&(d.current&&un(d.current[0]),e.preventDefault()),ln(e)===cn.End&&(d.current&&un(d.current[u-1]),e.preventDefault()))},onFocusOut:()=>{f&&(a.current=setTimeout((()=>{c(!1)}),200))},onFocusIn:()=>{a.current&&clearTimeout(a.current)},children:[(0,ds.jsx)(Vi,{transitionStartState:Fi,isActive:r,children:(0,ds.jsx)("div",{className:Cs("options__dialog"),children:(0,ds.jsx)(hc,{})})}),f&&(0,ds.jsx)(Vi,{isActive:i,transitionStartState:Fi,children:(0,ds.jsx)("ul",{className:Cs(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":s,children:t.map((({name:r,title:o,available:s},a)=>(0,ds.jsx)("li",{className:Cs("options__menu__item"),role:"menuitem","data-testid":r,children:(0,ds.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[a]=e)},className:Cs(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(ln(e)===cn.ArrowDown){const n=Math.min(u-1,t+1);d.current&&un(d.current[t===n?0:n]),e.preventDefault()}if(ln(e)===cn.ArrowUp){const n=Math.max(0,t-1);d.current&&un(d.current[t===n?u-1:n]),e.preventDefault()}})(e,a),onKeyPress:e=>((e,n)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=t)})),-1!==o&&d.current&&un(d.current[o])})(e,a),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,s),"aria-disabled":!s,children:[(0,ds.jsxs)("span",{className:Cs("button__text"),children:[o,!s&&" "]}),s?null:(0,ds.jsx)("span",{className:Cs("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,ds.jsxs)("button",{type:"button",className:Cs(["button","button--secondary","chat__options__button",...!f&&m?[`chat__options__button--${m}`]:[]]),id:s,onClick:()=>{r&&o(),f?c((e=>!e)):h.available&&!r&&n(h.name)},onKeyDown:f?e=>{ln(e)===cn.ArrowDown&&(c(!0),e.preventDefault())}:void 0,ref:l,"aria-haspopup":!!f&&"menu","aria-expanded":!!f&&i,"aria-disabled":!f&&!h.available,children:[f?(0,ds.jsx)($s,{name:"options",size:"32",alt:""}):null,(0,ds.jsx)("span",{className:Cs("button__text"),children:f?e("options.openButtonText"):`${h.title}${h.available?"":" "}`}),f||h.available?null:(0,ds.jsx)("span",{className:Cs("button__state"),children:e("options.unavailableText")})]})]}):null};function yc(){const{menuOptions:e,allowOptionSelection:t}=ks(),{isAvailable:n}=bs(),r=Zt(is),{t:o,userLocale:s}=qo(),a=_s(s);if(!n&&(!t||!e.length)||r)return null;const i=o("translations.settings.openButtonText",{hasLanguage:!!a,language:a});return(0,ds.jsxs)("div",{className:Cs("chat__options"),children:[n&&(0,ds.jsx)("div",{className:Cs("chat__options-item","chat__options-item--left"),children:(0,ds.jsxs)(ec,{classNames:["button--secondary"],children:[(0,ds.jsx)($s,{alt:i,name:"newTranslation",size:"16"}),(0,ds.jsx)("span",{className:Cs("button__text"),children:i})]})}),t&&(0,ds.jsx)("div",{className:Cs("chat__options-item","chat__options-item--right"),children:(0,ds.jsx)(mc,{})})]})}const vc=()=>{const{scrollToRef:e,unreadIds:t}=Ni(),{isMinimized:n}=Ko(),{t:r}=qo();return(0,ds.jsx)(Vi,{isActive:!!t.length&&!n,children:(0,ds.jsx)("div",{className:Cs("unread-messages"),children:(0,ds.jsxs)("button",{type:"button",className:Cs("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,ds.jsx)($s,{name:"chevronDown",size:"32",alt:""})]})})})},gc=({children:e})=>{const t=vn(),n=(0,Lo.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,o.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:s,containerRef:a,unreadIds:i}=(e=>{const t=(0,Lo.useRef)(null),[n,r]=(0,Lo.useState)(!0),o=Zt(ui),s=vn(),a=gn(),{isOpen:i}=Ko(),c=hn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=Zt((({state:e})=>e));(0,Lo.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,s=Math.abs(t-n-o)>10;r(!s)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,Lo.useCallback)((()=>{requestAnimationFrame((async()=>{await hs(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,Lo.useEffect)((()=>{u&&d()}),[u,d]),(0,Lo.useEffect)((()=>{n&&d()}),[n,o,s,a,i,c,l,d]),{containerRef:t,unreadIds:o,scrollToRef:()=>{const n=o.at(0);if(void 0!==n){const r=e[n]?.current;t.current?.scrollTo({top:r?.offsetTop,behavior:"auto",left:0})}},scrollToBottom:d}})(n);return(0,ds.jsx)(Ii.Provider,{value:{eventRefs:n,unreadIds:i,scrollToRef:r,scrollToBottom:s,containerRef:a},children:(0,ds.jsxs)("div",{className:Cs("chat__container"),children:[(0,ds.jsx)("div",{className:Cs("chat__container__scroll-area"),ref:a,children:e}),(0,ds.jsx)(vc,{})]})})},bc=({baseClassName:e,children:t,title:n})=>{const r=xn(),o=Ms();return(0,ds.jsxs)("section",{id:r,className:Cs(e),"aria-describedby":o,tabIndex:-1,children:[(0,ds.jsx)("h2",{className:Cs(`${e}__title`),id:o,children:n}),t]})},xc=()=>{const{t:e}=qo(),t=vs(),n=As(),{emitEvent:r}=rs(),{isActive:o,remaining:s,timer:a,endCountdown:i}=Rs(),c=!!s&&s>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,ds.jsx)(bc,{baseClassName:"idle",title:l,children:c&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("div",{className:Cs("idle__count-container"),children:o&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("span",{className:Cs("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,ds.jsx)("span",{className:Cs("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",a)})]})}),(0,ds.jsxs)("div",{className:Cs("idle__options"),children:[(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{n(),i(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{i(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},wc=()=>{const{t:e}=qo(),t=As(),{name:n}=Cn()||{},{continueChat:r,restartChat:o}=Ps();return(0,ds.jsx)(bc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,ds.jsxs)("div",{className:Cs("prompt__options"),children:[(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},_c=()=>{const{sendAction:e}=rs(),{features:t}=ks(),{typingPeekahead:n}=t||{},r=(0,Lo.useRef)(null),o=(0,Lo.useRef)(null),s=(0,Lo.useRef)(!1),a=(0,Lo.useRef)(null);(0,Lo.useEffect)((()=>()=>{a.current&&clearInterval(a.current),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current)}),[]);const i=(t,r)=>{e({type:"typing",state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,a.current||(i(!0,e.target.value),a.current=setInterval((()=>{!s.current&&a.current?(clearInterval(a.current),a.current=null):n&&n.enabled&&i(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current),r.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{i(!1,e.target.value)}),2e3))}},Cc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=hn().entryMeta,s=Oo(),a=n||t||e,i=o&&o[a]||r&&r[a]||{},c=(0,Lo.useCallback)((e=>{s(Br(e))}),[s]),l=(0,Lo.useCallback)((e=>{s(Fr(e))}),[s]),u=(0,Lo.useCallback)((e=>{s(co(e))}),[s]),d=(0,Lo.useCallback)((()=>{n?u(null):l(e)}),[l,u,e,n]);return{activeEntry:a,activeEntryOptions:i,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Ec({controlName:e,skipLinkId:t}){const{t:n}=qo(),{setInputFocus:r}=Ko(),{sendAssertive:o}=ss(),{emitEvent:s}=rs(),a=_c(),{setBlockAutoEntrySwitch:i}=Cc(),{placeholder:c,label:l,labelClass:u}=Si(e),{hasCharacterLimit:d,reachedCharacterWarning:p,reachedCharacterLimit:f,remainingChars:h}=Ei(e),[{value:m}]=Ci(e),y=!!m,v=(0,Lo.useCallback)((()=>{p&&o(n("input.srCharacterLimitText",{limit:h})),s("ui.inputFocus")}),[n,o,p,h,s]);return(0,Lo.useLayoutEffect)((()=>(i(y),()=>{i(!1)})),[i,y]),(0,ds.jsxs)(ic,{className:Cs("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,ds.jsxs)("div",{className:Cs(["input--text__container",...p&&!f?["character-warning"]:[],...f?["character-exceeded"]:[]]),children:[(0,ds.jsx)(uc,{id:t,type:"text",name:e,className:Cs("input__text"),autocomplete:"off",placeholder:c,labelText:l,labelClass:Cs(u),"aria-invalid":!!d&&f,onKeyUp:a,onFocus:v,focus:r}),(0,ds.jsx)("div",{className:Cs("character-count"),children:p&&(0,ds.jsx)("span",{children:h})})]}),(0,ds.jsx)("button",{className:Cs("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!y||f,children:(0,ds.jsx)($s,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const Sc="textMessageEntry";function jc({...e}){const{isOpen:t,setVisibility:n}=Ko(),r=xn(),o=vs(),{sendMessage:s}=rs(),a=(0,Lo.useCallback)(((e,{updateControlValue:r})=>{s({body:e[Sc]}),r(Sc,""),o(),t||n({visibility:Ot.open})}),[s,o,t,n]);return(0,ds.jsx)(tc,{...e,formId:"textEntry",persistData:!0,onSubmit:a,children:(0,ds.jsx)(Ec,{controlName:Sc,skipLinkId:r})})}const Tc=()=>{const{t:e}=qo(),{currentUploads:t}=Is();return(0,ds.jsx)("div",{className:Cs("progress"),children:t.map((({id:t,name:n,progress:r,uploading:o,error:s})=>(0,ds.jsxs)("div",{className:Cs("progress_container"),children:[(0,ds.jsxs)("div",{className:Cs("progress__text"),children:[(0,ds.jsx)("span",{className:Cs("progress__text--file-name"),children:n}),(0,ds.jsx)("span",{className:Cs("progress__text--percentage"),children:`${r}%`})]}),(0,ds.jsx)(cc,{error:s,id:"progress-error"}),(0,ds.jsx)("progress",{className:Cs("progress__bar"),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-label":e("fileUpload.srProgressLabel",{fileName:n}),max:"100","aria-valuenow":r,value:r,"aria-busy":o,children:`${r}%`})]},t)))})};function Nc({id:e,name:t,labelText:n,contentHint:r,outputText:o,accept:s}){const{isSubmitted:a}=_i(),[i,c]=(0,Lo.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=Ci(t),p=Ms(),f=Ms(),h=Ms(),m=a&&d,y=[h];r&&y.push(f),m&&y.push(p);const v=(0,Lo.useCallback)((()=>{c(!0)}),[c]),g=(0,Lo.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,Lo.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,ds.jsxs)("div",{className:Cs("upload__container"),children:[r&&(0,ds.jsx)("span",{className:Cs("upload__content-hint"),id:f,children:r}),(0,ds.jsx)(cc,{id:p,error:m&&d}),(0,ds.jsx)("div",{className:Cs(["file-upload",...i?["focus-within"]:[]]),children:(0,ds.jsxs)("label",{htmlFor:e,className:Cs("upload__label"),children:[(0,ds.jsx)($s,{name:"upload",size:"32",alt:""}),(0,ds.jsxs)("div",{children:[(0,ds.jsx)("span",{className:Cs(["upload__label--text"]),children:n}),(0,ds.jsx)("input",{id:e,className:Cs("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:s||null,onFocus:v,onBlur:g}),(0,ds.jsx)("span",{className:Cs("upload__output"),"aria-hidden":"true",id:h,children:o})]})]})})]})}const Ic=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:o,isComplete:s,onClickCancel:a})=>{const{t:i}=qo(),[{value:c}]=Ci(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,ds.jsxs)(ic,{className:Cs("upload-form"),children:[(0,ds.jsx)(Nc,{name:t,id:e,accept:n,labelText:i("fileUpload.labelText"),outputText:i("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,ds.jsxs)("div",{className:Cs("upload__button-container"),children:[(0,ds.jsx)("button",{id:o||!s?e:void 0,type:"button",onClick:a,className:Cs("button","button--secondary","upload__cancel"),children:i("fileUpload.cancelButtonText")}),(0,ds.jsx)("button",{className:Cs("button","button--primary"),type:"submit",children:i("fileUpload.uploadButtonText")})]})]})},kc="fileListForm",Oc="fileList",Lc=()=>{const{t:e}=qo(),{sendPolite:t,sendAssertive:n}=ss(),r=xn(),o=vs(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:i}=Ns(),c=(0,Lo.useRef)(null),l=(0,Lo.useRef)(s),{cancelEntrySelection:u}=Cc(),{uploadFile:d,clearUploads:p,isUploading:f,isComplete:h}=Is(),{uploadHandle:m,hasServerError:y,progress:v}=((e,t)=>{const n=Zt((n=>yi(n,{formId:e,name:t}))),{currentUploads:r}=Is(),o=n&&n.length>0;let s=null,a=!1,i=0;if(r&&r.length>0){const e=r[0];s=e.uploadHandle,a=!!e.error,i=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:s,hasServerError:a,progress:i}})(kc,Oc),g=Ms(),b=(0,Lo.useRef)(!0),x=e("fileUpload.contentHint",{size:sn(i)}),w=(0,Lo.useRef)(""),_=(0,Lo.useRef)(null);(0,Lo.useEffect)((()=>{w.current&&_.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(x),w.current=x}),[x,n]),(0,Lo.useEffect)((()=>{v>0&&t(1===v?e("fileUpload.srStartedText"):`${v}%`)}),[v,t,e]),(0,Lo.useEffect)((()=>{b.current||f||!h||(p(),u(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=h}),[f,h,p,u,o,t,e]),(0,Lo.useEffect)((()=>{s||f||(p(),u(),o())}),[s,f,p,u,o]);const C=(0,Lo.useCallback)((({fileList:e})=>{d(e[0]),o()}),[d,!1,o]),E=(0,Lo.useCallback)((()=>{m&&m.abort(),p(),u(),o()}),[m,p,u,o]),S=(0,Lo.useMemo)((()=>({[Oc]:[nc((()=>s),e("fileUpload.errors.unavailable")),nc(oc,e("fileUpload.errors.noFile")),nc(rc,e("fileUpload.errors.tooLarge"),i)]})),[i,s,e]);return(0,ds.jsx)("div",{className:Cs(["upload",...y?["upload--error"]:[]]),ref:_,children:(0,ds.jsxs)(tc,{formId:kc,persistData:!0,onSubmit:C,validationSchema:S,children:[(f||!h)&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)(Tc,{}),(0,ds.jsx)("div",{className:Cs("upload__button-container"),children:(0,ds.jsx)("button",{id:f||!h?r:void 0,type:"button",onClick:E,ref:c,className:Cs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!f&&h&&(0,ds.jsx)(Ic,{controlName:Oc,skiplinkId:r,accept:a?.join(", ")||"",contentHint:x,isComplete:h,isUploading:f,onClickCancel:E}),!l.current&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("span",{className:Cs("notification"),id:g,children:e("fileUpload.unavailableText")}),(0,ds.jsx)("div",{className:Cs("upload__button-container"),children:(0,ds.jsx)("button",{id:f||!h?r:void 0,type:"button",onClick:E,className:Cs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},Ac=()=>{const{t:e}=qo(),{showFileUpload:t,serviceAllowsUploads:n}=Ns(),[r,o]=(0,Lo.useState)(n||!1),s=vs(),a=(0,Lo.useRef)(null),{setUserEntryType:i,activeEntry:c}=Cc(),l=(0,Lo.useRef)(null),{sendPolite:u}=ss(),d=!!Cn();return(0,Lo.useEffect)((()=>{dn(l.current,(()=>{n||s()})),o(n||!1)}),[n,s]),(0,Lo.useEffect)((()=>{a.current&&!n&&u(e("fileUpload.srUnavailableText")),!1===a.current&&n&&u(e("fileUpload.srAvailableText")),d&&(a.current=n)}),[n,d,u,e]),t||c===T?null:(0,ds.jsx)(Vi,{isActive:r,transitionStartState:zi,children:(0,ds.jsx)("div",{className:Cs("upload-toggle-wrapper"),children:(0,ds.jsx)(Vi,{isActive:r,transitionStartState:Bi,children:(0,ds.jsx)("button",{className:Cs(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{i(T),s()}:void 0,children:(0,ds.jsx)($s,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},Rc=()=>{const{isOpen:e}=Ko(),t=(0,Lo.useRef)(null),{hasCountdown:n}=Rs(),[r,o]=(0,Lo.useState)(n),{hasPrompt:s}=Ps(),[a,i]=(0,Lo.useState)(s),c=vs(),l=(0,Lo.useRef)(!1),{activeEntry:u,activeEntryOptions:d}=Cc(),[p,f]=(0,Lo.useState)({text:jc,upload:Lc}),[h,m]=(0,Lo.useState)((()=>u)),y=en(),{accountAllowsUploads:v}=Ns(),g=(0,Lo.useCallback)((()=>{dn(t.current,c)}),[c]);(0,Lo.useEffect)((()=>{const{customComponents:e}=y,{entry:t}=e||{};t&&f((e=>({...e,...t})))}),[y]),(0,Lo.useEffect)((()=>{g(),o(n),i(s)}),[n,s,g]),(0,Lo.useEffect)((()=>{m(u),g()}),[u,g,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const b=p[h],{allowManualInput:x=!0}=d;return(0,ds.jsxs)("div",{className:Cs("chat__entry"),ref:t,children:[r&&(0,ds.jsx)(xc,{}),a&&(0,ds.jsx)(wc,{}),(0,ds.jsxs)("div",{className:Cs(["entry__body",...n||s||!1===x?["entry__body--hidden"]:[]]),children:[h!==T&&v&&e?(0,ds.jsx)(Ac,{}):null,(0,ds.jsx)(b,{})]})]})},Pc=()=>{const{t:e}=qo(),{isOpen:t,closeChat:n}=Ko(),{isWindow:r}=Sn();return t&&r?(0,ds.jsx)("button",{type:"button",className:Cs("button","collapse-button"),onClick:n,children:(0,ds.jsx)($s,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},Mc=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:o,srText:s}}=cs(),a=rs(),i=Ms(),{sendPolite:c}=ss(),l=vs(),u="SeamlySessionExpiredError"===e?.name;return(0,Lo.useEffect)((()=>{!u&&s&&setTimeout((()=>{c(s)}),200)}),[c,s,u]),u?(0,ds.jsx)(ds.Fragment,{}):(0,ds.jsxs)("section",{className:Cs("interrupt"),"aria-labelledby":i,children:[(0,ds.jsx)(Pc,{}),(0,ds.jsxs)("div",{className:Cs("interrupt__body"),children:[(0,ds.jsx)("h2",{id:i,className:Cs("interrupt__title"),children:t}),(0,ds.jsx)("p",{className:Cs("interrupt__message"),children:n}),r&&o&&(0,ds.jsx)("div",{className:Cs("interrupt__actions"),children:(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{o&&a[o]&&a[o](),l()},children:r})})]})]})},Dc=function({children:e}){const t=Zt(is),{isOpen:n}=Ko();return t?(0,ds.jsx)(Mc,{}):(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsxs)(gc,{children:[(0,ds.jsxs)("div",{className:Cs("chat__container__header"),children:[(0,ds.jsx)(Ji,{}),(0,ds.jsx)(Pc,{})]}),e]}),(0,ds.jsx)(Rc,{}),n&&(0,ds.jsx)(yc,{})]})};function Uc({event:e}){const[t]=ki(e);return(0,ds.jsx)("li",{children:(0,ds.jsx)(t,{event:e})})}function Fc({events:e}){return(0,ds.jsx)("ul",{className:Cs("collapsed-chat-messages"),children:e.map((e=>(0,ds.jsx)(Uc,{event:e},e.payload.id)))})}function zc(){const{preChatEvents:e}=en(),t=Zt(is),{isOpen:n}=Ko();return t||!e?.length||n?null:(0,ds.jsx)(Fc,{events:e})}function Bc(){const{t:e}=qo(),t=e("window.chat.continue"),n=(0,Lo.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t,type:"",data:{}},participant:"seamly-client-participant"}})),[t]);return(0,ds.jsx)(Fc,{events:[n]})}const Vc=()=>{const e=tn(),t=Cn(),n=Zt(is),r=t&&!n,o=r?t.avatar:e;return o?(0,ds.jsx)("img",{className:Cs(r?"avatar":"icon"),src:o,alt:""}):(0,ds.jsx)($s,{name:"avatar",size:"32",alt:""})},$c=({onClick:e})=>{const t=ns(),{t:n}=qo(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),o=vs(),{isOpen:s}=Ko(),a=bn(),i=(0,Lo.useCallback)((()=>{e(),o()}),[o,e]);return(0,ds.jsx)(Vi,{isActive:!s,transitionStartState:zi,children:(0,ds.jsxs)("button",{className:Cs("window-open-button"),"aria-label":r,"aria-hidden":s,onClick:i,children:[(0,ds.jsx)(Vi,{isActive:!!a,transitionStartState:Fi,children:(0,ds.jsx)("span",{className:Cs("message-count"),"aria-hidden":"true",children:a})}),(0,ds.jsx)(Vc,{})]})})},Hc=(e,t,n)=>"object"==typeof e?e[t]:n,Wc=n.p+"sounds/beep.mp3",Gc=!!window.Notification,qc={app:()=>(0,ds.jsx)(Wi,{children:(0,ds.jsx)(Dc,{children:(0,ds.jsx)(Ri,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=Oo(),{connectWhenInView:t}=en(),n=Zt(Tn),{containerRef:r,isVisible:o}=Jo({enabled:t,freezeOnceVisible:!0});return(0,Lo.useEffect)((()=>{o&&e(No())}),[e,o]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=Ko();return(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)(Vi,{isActive:!n,transitionStartState:zi,children:(0,ds.jsxs)("div",{ref:t,className:Cs("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,ds.jsx)(zc,{}),(0,ds.jsx)($i,{})]})}),(0,ds.jsx)(Vi,{isActive:n,transitionStartState:zi,children:(0,ds.jsx)(Wi,{ref:t,children:e&&(0,ds.jsx)(Dc,{children:n&&(0,ds.jsx)(Ri,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=Ko(),n=Xo(),{continueChat:r,preChat:o}=en();return(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)($c,{onClick:t}),(0,ds.jsx)(Vi,{isActive:!!o&&!e&&!n,exitAfter:Hc(o,"exitAfter"),enterDelay:Hc(o,"enterDelay"),transitionStartState:Fi,children:(0,ds.jsx)("div",{className:Cs("unstarted-wrapper","unstarted-wrapper--window"),children:(0,ds.jsx)(zc,{})})}),(0,ds.jsx)(Vi,{isActive:r&&!e&&n,exitAfter:Hc(r,"exitAfter"),enterDelay:Hc(r,"enterDelay"),transitionStartState:Fi,children:(0,ds.jsx)("div",{className:Cs("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,ds.jsx)(Bc,{})})}),(0,ds.jsx)(Vi,{isActive:e,transitionStartState:Fi,children:(0,ds.jsx)(Wi,{children:(0,ds.jsx)(Dc,{children:(0,ds.jsx)(Ri,{})})})})]})}};function Kc(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const Jc=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=wn(),{notificationAudioURL:t}=en(),[n,r]=(0,Lo.useState)(Gc?Notification.permission:"default"),[o,s]=(0,Lo.useState)(document.visibilityState),a=Zt(di),i=(0,Lo.useCallback)((async()=>{if(Gc&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,Lo.useMemo)((()=>"granted"===n),[n]),l=(0,Lo.useMemo)((()=>"hidden"===o),[o]);(0,Lo.useEffect)((()=>{"default"===n&&e&&i()}),[n,e,i]);const u=(0,Lo.useCallback)((async(e,r)=>{if(a&&Gc){if("default"===n&&i(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||Wc);await e.play()}catch(e){console.warn(e)}if(c&&(l||!document.hasFocus())){const t=new Notification(e,r);t.onclick=function(){window.parent.focus(),window.focus(),t.close();const e=document.querySelector(`input[name=${Sc}]`);e&&e.focus()}}}}),[t,n,c,i,a,l]);return(0,Lo.useEffect)((()=>{if(!a)return()=>{};function e(){s(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[a]),{permission:n,requestPermission:i,sendNotification:u}})(),[,n]=ms(),r=en(),o=Cn(),{proactiveMessages:s}=wn(),{isOpen:a,isVisible:i}=Ko(),c=Es(),l=Xo(),u=Zt(li),{body:d}=xs(u),{userLocale:p}=qo(),f=(0,Lo.useRef)(void 0),h=(0,Lo.useMemo)((()=>d?"string"==typeof d?Kc(d):"text"in d?Kc(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?Kc(d.prompt?.text):"":""),[d]);(0,Lo.useEffect)((()=>{o?.name&&h&&s&&u&&f.current!==u.payload?.id&&(t(o.name,{body:h,icon:o?.avatar||void 0}),f.current=u.payload.id)}),[o?.avatar,o?.name,u,h,s,t]);const m=qc[r.layoutMode],y=(0,Lo.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),v=(0,Lo.useMemo)((()=>{if(p){const e=document.querySelector("html")?.getAttribute("lang");if(e!==p)return p}}),[p]);if(!m)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const g=["app",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];return"function"!=typeof c?g.push(...c):g.push(...c(r)),a||"app"===r.layoutMode||g.push("app--collapsed"),l&&g.push("app--user-responded"),i?(0,ds.jsx)("div",{className:Cs(g),lang:v,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,ds.jsx)(m,{})}):null},Xc=e=>(0,ds.jsx)(ii,{...e,children:(0,ds.jsx)(Jc,{})});class Yc{constructor(e,n){const{namespace:r="",parentElement:o,...s}=e;this.config={...s,namespace:r},this.namespace=r,this.parentElement=o,this.externalApi=n,this.api=new q({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(t()),this.functions={},this.registerFunctions({on:this.eventBus.on,off:this.eventBus.off}),this.eventBus.on("function.register",((e,t)=>this.registerFunction(e,t))),this.eventBus.on("function.unregister",((e,t)=>this.unregisterFunction(e,t)))}async render(){const{view:e,...t}=this.config.customComponents||{},n={...this.config,parentElement:this.parentElement,customComponents:Object.keys(t).length?t:void 0},r=function({initialState:e,api:t,eventBus:n,config:r}){const o=tt({reducer:ko,preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat(function({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:o,api:s,layoutMode:a}=Lt(t()),{error:i,type:c}=n,l=Jn[i?.name]?new Jn[i.name](i):new g(i);r?.(l,{namespace:o,api:s,layoutMode:a,conversationUrl:e.getConversationUrl(),action:c?n:void 0})};return e=>t=>{try{return t.payload?.originalEvent?.payload?n({error:t.payload,type:t.payload?.originalEvent?.payload?.type}):t.payload?.originalError&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}({api:t}),function({api:e}){return()=>t=>n=>{const{payload:r,type:o}=n;if(o===vr.type){if(!xr.includes(r.name))throw new x(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}({api:t}),function({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case uo.toString():e.store.set("options",n.payload);break;case lo.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),yo)});return o}({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(zn(n)),await r.dispatch(wt()),await r.dispatch(Ln()),r.dispatch(On()),e?(0,o.render)((0,ds.jsx)(ii,{eventBus:this.eventBus,store:r,api:this.api,children:(0,ds.jsx)(e,{})}),this.parentElement):(0,o.render)((0,ds.jsx)(Xc,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,o.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),this.functions={}}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}const Qc=e=>"object"==typeof e&&"action"in e,Zc=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),el=class{constructor(e){this._waitingActions=[],this._instances={},this.timeouts={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(Qc).map(Zc)).length&&(this._waitingActions.push(...e),this.handleActions())}handleActions(){const e=this._waitingActions;this._waitingActions=[],e.forEach((e=>{switch(e.action){case"init":this.handleInit(e);break;case"destroy":this.handleDestroy(e);break;default:this.handleAction(e)||this.setContext(e.action,...e.args)||this._waitingActions.push(e)}}))}instanceInitializing(e){const t=Object.keys(this._instances);return!e&&t.length>0||t.includes(e)}setContext(e,t){const{instance:n}=t;if(this.instanceInitializing(n))return!1;switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:n,locale:r}=t;return n&&r&&(this.context.userLocale=r,this.context.source=D),!0;case"setContext":const{userLocale:o,contentLocale:s}=t;return this.context.userLocale=o,this.context.contentLocale=s,o&&o!=this.appConfig?.userLocale&&(this.context.source=D),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables={...t}),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace: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={},this.debouncedRender(e,n.namespace)}}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 Yc(e,this)}debouncedRender(e,t){window.clearTimeout(this.timeouts[t]),this.timeouts[t]=window.setTimeout((()=>{e.render()}),100)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){const t={...e.context||this.appConfig.context,...this.context},n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r={...this.appConfig.defaults,...e.defaults},o={...this.appConfig,...e,api:{...this.appConfig.api,...e.api},context:Object.keys(t).length?t:void 0,defaults:Object.keys(r).length?r:void 0};return"function"==typeof this.appConfig?this.appConfig(o):o}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},tl=()=>{const e=Oo();return{addEvent:t=>e(Tr(t)),clearEvents:()=>e(kr()),setEventsRead:t=>e(Vr(t)),setLoadedImageEventIds:t=>e(Yr(t)),setIsLoading:t=>e(Xr(t)),setParticipant:t=>e(Qr(t)),setHeaderTitle:t=>e(qr(t)),setHeaderSubTitle:t=>e(Gr(t)),setActiveService:t=>e(zr(t)),initIdleDetachCountdown:t=>e(Mr(t)),decrementIdleDetachCountdownCounter:()=>e(Rr()),stopIdleDetachCountdownCounter:()=>e(fo()),clearIdleDetachCountdown:()=>e(Lr()),initResumeConversationPrompt:()=>e(Dr()),clearResumeConversationPrompt:()=>e(Ar()),setServiceDataItem:t=>e(eo(t)),setFeatures:t=>e(Wr(t)),setFeatureEnabledState:t=>e($r(t)),clearFeatures:()=>e(Or()),setInitialState:t=>e(Jr(t)),setUserSelectedOptions:t=>e(uo(t)),setUserSelectedOption:t=>e(lo(t)),showOption:t=>e(po(t)),hideOption:()=>e(Pr()),setServiceEntryMetadata:t=>e(to(t)),setBlockAutoEntrySwitch:t=>e(Br(t)),setActiveEntryType:t=>e(Fr(t)),setUserEntryType:t=>e(co(t)),registerUpload:t=>e(Ur(t)),setUploadProgress:t=>e(so(t)),setUploadComplete:t=>e(ro(t)),setUploadError:t=>e(oo(t)),clearAllUploads:()=>e(Ir()),setSeamlyContainerElement:t=>e(Zr(t))}};function nl(){return{get:()=>{if(window.hasOwnProperty("SeamlyBridge"))try{return JSON.parse(SeamlyBridge.getData())}catch(e){return console.error("Unexpected or malformed data retrieved from bridge",e),{}}return window.seamlyBridgeData},set:e=>{window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.seamlyBridge&&window.webkit.messageHandlers.seamlyBridge.postMessage(JSON.stringify(e)),window.hasOwnProperty("SeamlyBridge")&&SeamlyBridge.setData(JSON.stringify(e)),window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e))}}}function rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var ol=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=rl({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in o)o[a]&&(s+="; "+a,!0!==o[a]&&(s+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+s}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var s=n[o].split("="),a=s.slice(1).join("=");try{var i=decodeURIComponent(s[0]);if(r[i]=t.read(a,i),e===i)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",rl({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,rl({},this.attributes,t))},withConverter:function(t){return e(rl({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function sl(e={}){return function(t){const n=`cvco.${t}`;return{get(){const e=ol.get(n);return e?JSON.parse(e):null},set(t){t&&ol.set(n,JSON.stringify(t),e)}}}}const al=()=>{const{t:e}=qo(),{title:t,subTitle:n}=hn().headerTitles,r=bn(),{isOpen:o}=Ko(),s=Cn(),a=Zt(is),i=tn(),c=s?.avatar??i,l=a?"":n,u=["message-count"];return o&&u.push("message-count__hide"),0===r&&u.push("message-count__empty"),l||!o?(0,ds.jsxs)("div",{className:Cs("agent-info"),children:[(0,ds.jsxs)("div",{className:Cs("agent-info__graphic"),children:[c?(0,ds.jsx)("img",{className:Cs(s?.avatar?"avatar":"icon"),src:c,alt:""}):(0,ds.jsx)($s,{name:"avatar",size:"32",alt:""}),(0,ds.jsx)("span",{className:Cs(u),"aria-hidden":"true",children:r})]}),(0,ds.jsxs)("div",{className:Cs("agent-info__body"),children:[(0,ds.jsx)("p",{className:Cs("agent-info__heading"),children:t??e("header.title")}),(0,ds.jsx)("p",{className:Cs("agent-info__text"),children:l})]})]}):null},il=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=hn(),r=(0,Lo.useRef)(null),{t:o}=qo();return(0,ds.jsxs)("header",{className:Cs("chat__header"),children:[e,(0,ds.jsx)("div",{className:Cs("header-controls"),children:(0,ds.jsx)("button",{type:"button",className:Cs("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,ds.jsx)($s,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},cl=()=>{const e=new URLSearchParams(window.location.search);return Array.from(e.entries()).reduce(((e,[t,n])=>({...e,[t]:n})),{})},ll=e=>new URLSearchParams(e).toString(),ul=(...e)=>{const t=new URL(window.location.href);return e.reduce(((e,n)=>{const r=t.searchParams.get(n)||sessionStorage.getItem(n);return r&&(e[n]=r),e}),{})},dl=(...e)=>{const t=new URL(window.location.href),n=e.reduce(((e,n)=>{const r=t.searchParams.get(n),o=r||sessionStorage.getItem(n);return r&&sessionStorage.setItem(n,r),o?(e.set(n,o),e):e}),new URLSearchParams),r=new URLSearchParams({...Object.fromEntries(t.searchParams),...Object.fromEntries(n)});return r.toString()&&window.history.replaceState(null,"",`?${r}`),ul(...n.keys())},pl=(...e)=>{const t=document.querySelector("[data-reset-search-params]");t&&t.addEventListener("click",(t=>{t.preventDefault();const n=new URL(window.location.href);e.forEach((e=>{sessionStorage.removeItem(e),n.searchParams.delete(e)})),window.location.href=n.toString()}))},fl=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 el(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
2
+ (()=>{var e={34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},81:(e,t,n)=>{"use strict";var r=n(9565),o=n(9306),s=n(8551),a=n(6823),i=n(851),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?i(e):t;if(o(n))return s(r(n,e));throw new c(a(e)+" is not iterable")}},116:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;return s(t,(function(t,r){if(e(t,n++))return r(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},283:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),s=n(4901),a=n(9297),i=n(3724),c=n(350).CONFIGURABLE,l=n(3706),u=n(1181),d=u.enforce,p=u.get,f=String,h=Object.defineProperty,m=r("".slice),y=r("".replace),v=r([].join),g=i&&!o((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),x=e.exports=function(e,t,n){"Symbol("===m(f(t),0,7)&&(t="["+y(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(i?h(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?i&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return a(r,"source")||(r.source=v(b,"string"==typeof t?t:"")),e};Function.prototype.toString=x((function(){return s(this)&&p(this).source||l(this)}),"toString")},350:(e,t,n)=>{"use strict";var r=n(3724),o=n(9297),s=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,i=o(s,"name"),c=i&&"something"===function(){}.name,l=i&&(!r||r&&a(s,"name").configurable);e.exports={EXISTS:i,PROPER:c,CONFIGURABLE:l}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},421:e=>{"use strict";e.exports={}},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var o,s,a=n?e:e.iterator,i=e.next;!(o=r(i,a)).done;)if(void 0!==(s=t(o.value)))return s}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},679:(e,t,n)=>{"use strict";var r=n(1625),o=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new o("Incorrect invocation")}},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},757:(e,t,n)=>{"use strict";var r=n(7751),o=n(4901),s=n(1625),a=n(7040),i=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&s(t.prototype,i(e))}},851:(e,t,n)=>{"use strict";var r=n(6955),o=n(5966),s=n(4117),a=n(6269),i=n(8227)("iterator");e.exports=function(e){if(!s(e))return o(e,i)||o(e,"@@iterator")||a[r(e)]}},1072:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727);e.exports=Object.keys||function(e){return r(e,o)}},1148:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;return!s(t,(function(t,r){if(!e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1162:e=>{"use strict";e.exports=require("preact/hooks")},1181:(e,t,n)=>{"use strict";var r,o,s,a=n(8622),i=n(4576),c=n(34),l=n(6699),u=n(9297),d=n(7629),p=n(6119),f=n(421),h="Object already initialized",m=i.TypeError,y=i.WeakMap;if(a||d.state){var v=d.state||(d.state=new y);v.get=v.get,v.has=v.has,v.set=v.set,r=function(e,t){if(v.has(e))throw new m(h);return t.facade=e,v.set(e,t),t},o=function(e){return v.get(e)||{}},s=function(e){return v.has(e)}}else{var g=p("state");f[g]=!0,r=function(e,t){if(u(e,g))throw new m(h);return t.facade=e,l(e,g,t),t},o=function(e){return u(e,g)?e[g]:{}},s=function(e){return u(e,g)}}e.exports={set:r,get:o,has:s,enforce:function(e){return s(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},1454:(e,t,n)=>{"use strict";n(1701)},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1698:(e,t,n)=>{"use strict";var r=n(6518),o=n(4204);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("union")},{union:o})},1701:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(9306),a=n(8551),i=n(1767),c=n(9462),l=n(6319),u=n(9539),d=n(4549),p=n(6395),f=!p&&d("map",TypeError),h=c((function(){var e=this.iterator,t=a(o(this.next,e));if(!(this.done=!!t.done))return l(e,this.mapper,[t.value,this.counter++],!0)}));r({target:"Iterator",proto:!0,real:!0,forced:p||f},{map:function(e){a(this);try{s(e)}catch(e){u(this,"throw",e)}return f?o(f,this,e):new h(i(this),{mapper:e})}})},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},1828:(e,t,n)=>{"use strict";var r=n(9504),o=n(9297),s=n(5397),a=n(9617).indexOf,i=n(421),c=r([].push);e.exports=function(e,t){var n,r=s(e),l=0,u=[];for(n in r)!o(i,n)&&o(r,n)&&c(u,n);for(;t.length>l;)o(r,n=t[l++])&&(~a(u,n)||c(u,n));return u}},2086: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 s=t[r]||n,a=s.length=o?s.length:0;a--;)o==s[a][0]&&s.splice(a,1);return e},e.emit=function(r){for(var o,s=t[r]||n,a=s.length>0?s.slice(0,s.length):s,i=0;o=a[i++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},2106:(e,t,n)=>{"use strict";var r=n(283),o=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),o.f(e,t,n)}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},2195:(e,t,n)=>{"use strict";var r=n(9504),o=r({}.toString),s=r("".slice);e.exports=function(e){return s(o(e),8,-1)}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2360:(e,t,n)=>{"use strict";var r,o=n(8551),s=n(6801),a=n(8727),i=n(421),c=n(397),l=n(4055),u=n(6119),d="prototype",p="script",f=u("IE_PROTO"),h=function(){},m=function(e){return"<"+p+">"+e+"</"+p+">"},y=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;v="undefined"!=typeof document?document.domain&&r?y(r):(t=l("iframe"),n="java"+p+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):y(r);for(var o=a.length;o--;)delete v[d][a[o]];return v()};i[f]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[d]=o(e),n=new h,h[d]=null,n[f]=e):n=v(),void 0===t?n:s.f(n,t)}},2475:(e,t,n)=>{"use strict";var r=n(6518),o=n(8527);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSupersetOf",(function(e){return!e}))},{isSupersetOf:o})},2489:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(9306),a=n(8551),i=n(1767),c=n(9462),l=n(6319),u=n(6395),d=n(9539),p=n(4549),f=!u&&p("filter",TypeError),h=c((function(){for(var e,t,n=this.iterator,r=this.predicate,s=this.next;;){if(e=a(o(s,n)),this.done=!!e.done)return;if(t=e.value,l(n,r,[t,this.counter++],!0))return t}}));r({target:"Iterator",proto:!0,real:!0,forced:u||f},{filter:function(e){a(this);try{s(e)}catch(e){d(this,"throw",e)}return f?o(f,this,e):new h(i(this),{predicate:e})}})},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},2577:(e,t,n)=>{"use strict";n(116)},2652:(e,t,n)=>{"use strict";var r=n(6080),o=n(9565),s=n(8551),a=n(6823),i=n(4209),c=n(6198),l=n(1625),u=n(81),d=n(851),p=n(9539),f=TypeError,h=function(e,t){this.stopped=e,this.result=t},m=h.prototype;e.exports=function(e,t,n){var y,v,g,b,x,w,_,C=n&&n.that,E=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),j=!(!n||!n.IS_ITERATOR),T=!(!n||!n.INTERRUPTED),N=r(t,C),I=function(e){return y&&p(y,"normal",e),new h(!0,e)},k=function(e){return E?(s(e),T?N(e[0],e[1],I):N(e[0],e[1])):T?N(e,I):N(e)};if(S)y=e.iterator;else if(j)y=e;else{if(!(v=d(e)))throw new f(a(e)+" is not iterable");if(i(v)){for(g=0,b=c(e);b>g;g++)if((x=k(e[g]))&&l(m,x))return x;return new h(!1)}y=u(e,v)}for(w=S?e.next:y.next;!(_=o(w,y)).done;){try{x=k(_.value)}catch(e){p(y,"throw",e)}if("object"==typeof x&&x&&l(m,x))return x}return new h(!1)}},2777:(e,t,n)=>{"use strict";var r=n(9565),o=n(34),s=n(757),a=n(5966),i=n(4270),c=n(8227),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var n,c=a(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!o(n)||s(n))return n;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),i(e,t)}},2787:(e,t,n)=>{"use strict";var r=n(9297),o=n(4901),s=n(8981),a=n(6119),i=n(2211),c=a("IE_PROTO"),l=Object,u=l.prototype;e.exports=i?l.getPrototypeOf:function(e){var t=s(e);if(r(t,c))return t[c];var n=t.constructor;return o(n)&&t instanceof n?n.prototype:t instanceof l?u:null}},2796:(e,t,n)=>{"use strict";var r=n(9039),o=n(4901),s=/#|\.prototype\./,a=function(e,t){var n=c[i(e)];return n===u||n!==l&&(o(t)?r(t):!!t)},i=a.normalize=function(e){return String(e).replace(s,".").toLowerCase()},c=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},2839:(e,t,n)=>{"use strict";var r=n(4576).navigator,o=r&&r.userAgent;e.exports=o?String(o):""},3215:(e,t,n)=>{"use strict";n(1148)},3375:(e,t,n)=>{"use strict";n(7642)},3392:(e,t,n)=>{"use strict";var r=n(9504),o=0,s=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+s,36)}},3440:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402),s=n(9286),a=n(5170),i=n(3789),c=n(8469),l=n(507),u=o.has,d=o.remove;e.exports=function(e){var t=r(this),n=i(e),o=s(t);return a(t)<=n.size?c(t,(function(e){n.includes(e)&&d(o,e)})):l(n.getIterator(),(function(e){u(t,e)&&d(o,e)})),o}},3579:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;return s(t,(function(t,r){if(e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3650:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402),s=n(9286),a=n(3789),i=n(507),c=o.add,l=o.has,u=o.remove;e.exports=function(e){var t=r(this),n=a(e).getIterator(),o=s(t);return i(n,(function(e){l(t,e)?u(o,e):c(o,e)})),o}},3706:(e,t,n)=>{"use strict";var r=n(9504),o=n(4901),s=n(7629),a=r(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return a(e)}),e.exports=s.inspectSource},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3789:(e,t,n)=>{"use strict";var r=n(9306),o=n(8551),s=n(9565),a=n(1291),i=n(1767),c="Invalid size",l=RangeError,u=TypeError,d=Math.max,p=function(e,t){this.set=e,this.size=d(t,0),this.has=r(e.has),this.keys=r(e.keys)};p.prototype={getIterator:function(){return i(o(s(this.keys,this.set)))},includes:function(e){return s(this.has,this.set,e)}},e.exports=function(e){o(e);var t=+e.size;if(t!=t)throw new u(c);var n=a(t);if(n<0)throw new l(c);return new p(e,n)}},3838:(e,t,n)=>{"use strict";var r=n(7080),o=n(5170),s=n(8469),a=n(3789);e.exports=function(e){var t=r(this),n=a(e);return!(o(t)>n.size)&&!1!==s(t,(function(e){if(!n.includes(e))return!1}),!0)}},3853:(e,t,n)=>{"use strict";var r=n(6518),o=n(4449);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isDisjointFrom",(function(e){return!e}))},{isDisjointFrom:o})},3949:(e,t,n)=>{"use strict";n(7588)},3972:(e,t,n)=>{"use strict";n(3853)},4055:(e,t,n)=>{"use strict";var r=n(4576),o=n(34),s=r.document,a=o(s)&&o(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},4114:(e,t,n)=>{"use strict";var r=n(6518),o=n(8981),s=n(6198),a=n(4527),i=n(6837);r({target:"Array",proto:!0,arity:1,forced:n(9039)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=o(this),n=s(t),r=arguments.length;i(n+r);for(var c=0;c<r;c++)t[n]=arguments[c],n++;return a(t,n),n}})},4117:e=>{"use strict";e.exports=function(e){return null==e}},4204:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402).add,s=n(9286),a=n(3789),i=n(507);e.exports=function(e){var t=r(this),n=a(e).getIterator(),c=s(t);return i(n,(function(e){o(c,e)})),c}},4209:(e,t,n)=>{"use strict";var r=n(8227),o=n(6269),s=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(o.Array===e||a[s]===e)}},4270:(e,t,n)=>{"use strict";var r=n(9565),o=n(4901),s=n(34),a=TypeError;e.exports=function(e,t){var n,i;if("string"===t&&o(n=e.toString)&&!s(i=r(n,e)))return i;if(o(n=e.valueOf)&&!s(i=r(n,e)))return i;if("string"!==t&&o(n=e.toString)&&!s(i=r(n,e)))return i;throw new a("Can't convert object to primitive value")}},4376:(e,t,n)=>{"use strict";var r=n(2195);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4402:(e,t,n)=>{"use strict";var r=n(9504),o=Set.prototype;e.exports={Set,add:r(o.add),has:r(o.has),remove:r(o.delete),proto:o}},4449:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402).has,s=n(5170),a=n(3789),i=n(8469),c=n(507),l=n(9539);e.exports=function(e){var t=r(this),n=a(e);if(s(t)<=n.size)return!1!==i(t,(function(e){if(n.includes(e))return!1}),!0);var u=n.getIterator();return!1!==c(u,(function(e){if(o(t,e))return l(u,"normal",!1)}))}},4495:(e,t,n)=>{"use strict";var r=n(9519),o=n(9039),s=n(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4520:(e,t,n)=>{"use strict";n(2489)},4527:(e,t,n)=>{"use strict";var r=n(3724),o=n(4376),s=TypeError,a=Object.getOwnPropertyDescriptor,i=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=i?function(e,t){if(o(e)&&!a(e,"length").writable)throw new s("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},4549:(e,t,n)=>{"use strict";var r=n(4576);e.exports=function(e,t){var n=r.Iterator,o=n&&n.prototype,s=o&&o[e],a=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(e){e instanceof t||(a=!1)}if(!a)return s}},4576:function(e,t,n){"use strict";var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4659:(e,t,n)=>{"use strict";var r=n(3724),o=n(4913),s=n(6980);e.exports=function(e,t,n){r?o.f(e,t,s(0,n)):e[t]=n}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},4913:(e,t,n)=>{"use strict";var r=n(3724),o=n(5917),s=n(8686),a=n(8551),i=n(6969),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",f="writable";t.f=r?s?function(e,t,n){if(a(e),t=i(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&f in n&&!n[f]){var r=u(e,t);r&&r[f]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(a(e),t=i(t),a(n),o)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},4916:(e,t,n)=>{"use strict";var r=n(7751),o=function(e){return{size:e,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(e){return{size:e,has:function(){return!0},keys:function(){throw new Error("e")}}};e.exports=function(e,t){var n=r("Set");try{(new n)[e](o(0));try{return(new n)[e](o(-1)),!1}catch(r){if(!t)return!0;try{return(new n)[e](s(-1/0)),!1}catch(r){var a=new n;return a.add(1),a.add(2),t(a[e](s(1/0)))}}}catch(e){return!1}}},5024:(e,t,n)=>{"use strict";var r=n(6518),o=n(3650);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("symmetricDifference")},{symmetricDifference:o})},5031:(e,t,n)=>{"use strict";var r=n(7751),o=n(9504),s=n(8480),a=n(3717),i=n(8551),c=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=s.f(i(e)),n=a.f;return n?c(t,n(e)):t}},5160:(e,t,n)=>{"use strict";var r=n(7402),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useSyncExternalStore,a=r.useRef,i=r.useEffect,c=r.useMemo,l=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=a(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c((function(){function e(e){if(!i){if(i=!0,s=e,e=r(e),void 0!==u&&p.hasValue){var t=p.value;if(u(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==u&&u(t,n)?(s=e,t):(s=e,a=n)}var s,a,i=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,u]);var f=s(e,d[0],d[1]);return i((function(){p.hasValue=!0,p.value=f}),[f]),l(f),f}},5170:(e,t,n)=>{"use strict";var r=n(6706),o=n(4402);e.exports=r(o.proto,"size","get")||function(e){return e.size}},5397:(e,t,n)=>{"use strict";var r=n(7055),o=n(7750);e.exports=function(e){return r(o(e))}},5610:(e,t,n)=>{"use strict";var r=n(1291),o=Math.max,s=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):s(n,t)}},5714:(e,t,n)=>{"use strict";n(2475)},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},5876:(e,t,n)=>{"use strict";var r=n(6518),o=n(3838);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("isSubsetOf",(function(e){return e}))},{isSubsetOf:o})},5917:(e,t,n)=>{"use strict";var r=n(3724),o=n(9039),s=n(4055);e.exports=!r&&!o((function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},5966:(e,t,n)=>{"use strict";var r=n(9306),o=n(4117);e.exports=function(e,t){var n=e[t];return o(n)?void 0:r(n)}},6080:(e,t,n)=>{"use strict";var r=n(7476),o=n(9306),s=n(616),a=r(r.bind);e.exports=function(e,t){return o(e),void 0===t?e:s?a(e,t):function(){return e.apply(t,arguments)}}},6119:(e,t,n)=>{"use strict";var r=n(5745),o=n(3392),s=r("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},6197:(e,t,n)=>{"use strict";n(1698)},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},6269:e=>{"use strict";e.exports={}},6279:(e,t,n)=>{"use strict";var r=n(6840);e.exports=function(e,t,n){for(var o in t)r(e,o,t[o],n);return e}},6319:(e,t,n)=>{"use strict";var r=n(8551),o=n(9539);e.exports=function(e,t,n,s){try{return s?t(r(n)[0],n[1]):t(n)}catch(t){o(e,"throw",t)}}},6395:e=>{"use strict";e.exports=!1},6469:(e,t,n)=>{"use strict";var r=n(8227),o=n(2360),s=n(4913).f,a=r("unscopables"),i=Array.prototype;void 0===i[a]&&s(i,a,{configurable:!0,value:o(null)}),e.exports=function(e){i[a][e]=!0}},6518:(e,t,n)=>{"use strict";var r=n(4576),o=n(7347).f,s=n(6699),a=n(6840),i=n(9433),c=n(7740),l=n(2796);e.exports=function(e,t){var n,u,d,p,f,h=e.target,m=e.global,y=e.stat;if(n=m?r:y?r[h]||i(h,{}):r[h]&&r[h].prototype)for(u in t){if(p=t[u],d=e.dontCallGetSet?(f=o(n,u))&&f.value:n[u],!l(m?u:h+(y?".":"#")+u,e.forced)&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(e.sham||d&&d.sham)&&s(p,"sham",!0),a(n,u,p,e)}}},6699:(e,t,n)=>{"use strict";var r=n(3724),o=n(4913),s=n(6980);e.exports=r?function(e,t,n){return o.f(e,t,s(1,n))}:function(e,t,n){return e[t]=n,e}},6706:(e,t,n)=>{"use strict";var r=n(9504),o=n(9306);e.exports=function(e,t,n){try{return r(o(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},6801:(e,t,n)=>{"use strict";var r=n(3724),o=n(8686),s=n(4913),a=n(8551),i=n(5397),c=n(1072);t.f=r&&!o?Object.defineProperties:function(e,t){a(e);for(var n,r=i(t),o=c(t),l=o.length,u=0;l>u;)s.f(e,n=o[u++],r[n]);return e}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6837:e=>{"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},6840:(e,t,n)=>{"use strict";var r=n(4901),o=n(4913),s=n(283),a=n(9433);e.exports=function(e,t,n,i){i||(i={});var c=i.enumerable,l=void 0!==i.name?i.name:t;if(r(n)&&s(n,l,i),i.global)c?e[t]=n:a(t,n);else{try{i.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:o.f(e,t,{value:n,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e}},6955:(e,t,n)=>{"use strict";var r=n(2140),o=n(4901),s=n(2195),a=n(8227)("toStringTag"),i=Object,c="Arguments"===s(function(){return arguments}());e.exports=r?s:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=i(e),a))?n:c?s(t):"Object"===(r=s(t))&&o(t.callee)?"Arguments":r}},6969:(e,t,n)=>{"use strict";var r=n(2777),o=n(757);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7015:(e,t,n)=>{"use strict";var r=n(4576),o=n(9504);e.exports=function(e,t){return o(r[e].prototype[t])}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),s=n(2195),a=Object,i=r("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===s(e)?i(e,""):a(e)}:a},7080:(e,t,n)=>{"use strict";var r=n(4402).has;e.exports=function(e){return r(e),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),o=n(9565),s=n(8773),a=n(6980),i=n(5397),c=n(6969),l=n(9297),u=n(5917),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=i(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return a(!o(s.f,e,t),e[t])}},7402:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Children:()=>x,Component:()=>r.Component,Fragment:()=>r.Fragment,PureComponent:()=>h,StrictMode:()=>ie,Suspense:()=>S,SuspenseList:()=>N,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>X,cloneElement:()=>ne,createContext:()=>r.createContext,createElement:()=>r.createElement,createFactory:()=>Q,createPortal:()=>L,createRef:()=>r.createRef,default:()=>le,findDOMNode:()=>oe,flushSync:()=>ae,forwardRef:()=>g,hydrate:()=>z,isElement:()=>ce,isFragment:()=>ee,isMemo:()=>te,isValidElement:()=>Z,lazy:()=>T,memo:()=>m,render:()=>F,startTransition:()=>u,unmountComponentAtNode:()=>re,unstable_batchedUpdates:()=>se,useDeferredValue:()=>d,useInsertionEffect:()=>f,useSyncExternalStore:()=>c,useTransition:()=>p,version:()=>Y});var r=n(8785),o=n(1162),s={};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","isElement","isFragment","isMemo","isValidElement","lazy","memo","render","startTransition","unmountComponentAtNode","unstable_batchedUpdates","useDeferredValue","useInsertionEffect","useSyncExternalStore","useTransition","version"].indexOf(e)<0&&(s[e]=()=>o[e]);function a(e,t){for(var n in t)e[n]=t[n];return e}function i(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){var n=t(),r=(0,o.useState)({t:{__:n,u:t}}),s=r[0].t,a=r[1];return(0,o.useLayoutEffect)((function(){s.__=n,s.u=t,l(s)&&a({t:s})}),[e,n,t]),(0,o.useEffect)((function(){return l(s)&&a({t:s}),e((function(){l(s)&&a({t:s})}))}),[e]),n}function l(e){var t,n,r=e.u,o=e.__;try{var s=r();return!((t=o)===(n=s)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}function u(e){e()}function d(e){return e}function p(){return[!1,u]}n.d(t,s);var f=o.useLayoutEffect;function h(e,t){this.props=e,this.context=t}function m(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:i(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}(h.prototype=new r.Component).isPureReactComponent=!0,h.prototype.shouldComponentUpdate=function(e,t){return i(this.props,e)||i(this.state,t)};var y=r.options.__b;r.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),y&&y(e)};var v="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function g(e){function t(t){var n=a({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=v,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var b=function(e,t){return null==e?null:(0,r.toChildArray)((0,r.toChildArray)(e).map(t))},x={map:b,forEach:b,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},w=r.options.__e;r.options.__e=function(e,t,n,r){if(e.then)for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);w(e,t,n,r)};var _=r.options.unmount;function C(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=a({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return C(e,t,n)}))),e}function E(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return E(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function S(){this.__u=0,this.o=null,this.__b=null}function j(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function T(e){var t,n,o;function s(s){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,s)}return s.displayName="Lazy",s.__f=!0,s}function N(){this.i=null,this.l=null}r.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),_&&_(e)},(S.prototype=new r.Component).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var o=j(r.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(i):i())};n.__R=a;var i=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=E(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},S.prototype.componentWillUnmount=function(){this.o=[]},S.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]=C(this.__b,n,o.__O=o.__P)}this.__b=null}var s=t.__a&&(0,r.createElement)(r.Fragment,null,e.fallback);return s&&(s.__u&=-33),[(0,r.createElement)(r.Fragment,null,t.__a?null:e.children),s]};var I=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function k(e){return this.getChildContext=function(){return e.context},e.children}function O(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){(0,r.render)(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},appendChild:function(e){this.childNodes.push(e),t.h.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}(0,r.render)((0,r.createElement)(k,{context:t.context},e.__v),t.v)}function L(e,t){var n=(0,r.createElement)(O,{__v:e,h:t});return n.containerInfo=t,n}(N.prototype=new r.Component).__a=function(e){var t=this,n=j(t.__v),r=t.l.get(e);return r[0]++,function(o){var s=function(){t.props.revealOrder?(r.push(o),I(t,e,r)):o()};n?n(s):s()}},N.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,r.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},N.prototype.componentDidUpdate=N.prototype.componentDidMount=function(){var e=this;this.l.forEach((function(t,n){I(e,n,t)}))};var A="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,R=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,P=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,M=/[A-Z0-9]/g,D="undefined"!=typeof document,U=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function F(e,t,n){return null==t.__k&&(t.textContent=""),(0,r.render)(e,t),"function"==typeof n&&n(),e?e.__c:null}function z(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 B=r.options.event;function V(){}function $(){return this.cancelBubble}function H(){return this.defaultPrevented}r.options.event=function(e){return B&&(e=B(e)),e.persist=V,e.isPropagationStopped=$,e.isDefaultPrevented=H,e.nativeEvent=e};var W,G={enumerable:!1,configurable:!0,get:function(){return this.class}},q=r.options.vnode;r.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},s=-1===n.indexOf("-");for(var a in t){var i=t[a];if(!("value"===a&&"defaultValue"in t&&null==i||D&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var c=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===i?i="":"translate"===c&&"no"===i?i=!1:"o"===c[0]&&"n"===c[1]?"ondoubleclick"===c?a="ondblclick":"onchange"!==c||"input"!==n&&"textarea"!==n||U(t.type)?"onfocus"===c?a="onfocusin":"onblur"===c?a="onfocusout":P.test(a)&&(a=c):c=a="oninput":s&&R.test(a)?a=a.replace(M,"-$&").toLowerCase():null===i&&(i=void 0),"oninput"===c&&o[a=c]&&(a="oninputCapture"),o[a]=i}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)}))),"select"==n&&null!=o.defaultValue&&(o.value=(0,r.toChildArray)(t.children).forEach((function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",G)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=A,q&&q(e)};var K=r.options.__r;r.options.__r=function(e){K&&K(e),W=e.__c};var J=r.options.diffed;r.options.diffed=function(e){J&&J(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),W=null};var X={ReactCurrentDispatcher:{current:{readContext:function(e){return W.__n[e.__c].props.value},useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,useDeferredValue:d,useEffect:o.useEffect,useId:o.useId,useImperativeHandle:o.useImperativeHandle,useInsertionEffect:f,useLayoutEffect:o.useLayoutEffect,useMemo:o.useMemo,useReducer:o.useReducer,useRef:o.useRef,useState:o.useState,useSyncExternalStore:c,useTransition:p}}},Y="18.3.1";function Q(e){return r.createElement.bind(null,e)}function Z(e){return!!e&&e.$$typeof===A}function ee(e){return Z(e)&&e.type===r.Fragment}function te(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function ne(e){return Z(e)?r.cloneElement.apply(null,arguments):e}function re(e){return!!e.__k&&((0,r.render)(null,e),!0)}function oe(e){return e&&(e.base||1===e.nodeType&&e)||null}var se=function(e,t){return e(t)},ae=function(e,t){return e(t)},ie=r.Fragment,ce=Z,le={useState:o.useState,useId:o.useId,useReducer:o.useReducer,useEffect:o.useEffect,useLayoutEffect:o.useLayoutEffect,useInsertionEffect:f,useTransition:p,useDeferredValue:d,useSyncExternalStore:c,startTransition:u,useRef:o.useRef,useImperativeHandle:o.useImperativeHandle,useMemo:o.useMemo,useCallback:o.useCallback,useContext:o.useContext,useDebugValue:o.useDebugValue,version:"18.3.1",Children:x,render:F,hydrate:z,unmountComponentAtNode:re,createPortal:L,createElement:r.createElement,createContext:r.createContext,createFactory:Q,cloneElement:ne,createRef:r.createRef,Fragment:r.Fragment,isValidElement:Z,isElement:ce,isFragment:ee,isMemo:te,findDOMNode:oe,Component:r.Component,PureComponent:h,memo:m,forwardRef:g,flushSync:ae,unstable_batchedUpdates:se,StrictMode:ie,Suspense:S,SuspenseList:N,lazy:T,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:X}},7476:(e,t,n)=>{"use strict";var r=n(2195),o=n(9504);e.exports=function(e){if("Function"===r(e))return o(e)}},7550:(e,t,n)=>{"use strict";n(3579)},7561:(e,t,n)=>{"use strict";n(5024)},7588:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),s=n(2652),a=n(9306),i=n(8551),c=n(1767),l=n(9539),u=n(4549)("forEach",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(e){i(this);try{a(e)}catch(e){l(this,"throw",e)}if(u)return o(u,this,e);var t=c(this),n=0;s(t,(function(t){e(t,n++)}),{IS_RECORD:!0})}})},7629:(e,t,n)=>{"use strict";var r=n(6395),o=n(4576),s=n(9433),a="__core-js_shared__",i=e.exports=o[a]||s(a,{});(i.versions||(i.versions=[])).push({version:"3.42.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})},7642:(e,t,n)=>{"use strict";var r=n(6518),o=n(3440);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("difference",(function(e){return 0===e.size}))},{difference:o})},7657:(e,t,n)=>{"use strict";var r,o,s,a=n(9039),i=n(4901),c=n(34),l=n(2360),u=n(2787),d=n(6840),p=n(8227),f=n(6395),h=p("iterator"),m=!1;[].keys&&("next"in(s=[].keys())?(o=u(u(s)))!==Object.prototype&&(r=o):m=!0),!c(r)||a((function(){var e={};return r[h].call(e)!==e}))?r={}:f&&(r=l(r)),i(r[h])||d(r,h,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},7740:(e,t,n)=>{"use strict";var r=n(9297),o=n(5031),s=n(7347),a=n(4913);e.exports=function(e,t,n){for(var i=o(t),c=a.f,l=s.f,u=0;u<i.length;u++){var d=i[u];r(e,d)||n&&r(n,d)||c(e,d,l(t,d))}}},7750:(e,t,n)=>{"use strict";var r=n(4117),o=TypeError;e.exports=function(e){if(r(e))throw new o("Can't call method on "+e);return e}},7751:(e,t,n)=>{"use strict";var r=n(4576),o=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],o(n)?n:void 0):r[e]&&r[e][t];var n}},8004:(e,t,n)=>{"use strict";var r=n(6518),o=n(9039),s=n(8750);r({target:"Set",proto:!0,real:!0,forced:!n(4916)("intersection",(function(e){return 2===e.size&&e.has(1)&&e.has(2)}))||o((function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))}))},{intersection:s})},8014:(e,t,n)=>{"use strict";var r=n(1291),o=Math.min;e.exports=function(e){var t=r(e);return t>0?o(t,9007199254740991):0}},8107:(e,t,n)=>{"use strict";var r=n(6518),o=n(8981),s=n(6198),a=n(1291),i=n(6469);r({target:"Array",proto:!0},{at:function(e){var t=o(this),n=s(t),r=a(e),i=r>=0?r:n+r;return i<0||i>=n?void 0:t[i]}}),i("at")},8111:(e,t,n)=>{"use strict";var r=n(6518),o=n(4576),s=n(679),a=n(8551),i=n(4901),c=n(2787),l=n(2106),u=n(4659),d=n(9039),p=n(9297),f=n(8227),h=n(7657).IteratorPrototype,m=n(3724),y=n(6395),v="constructor",g="Iterator",b=f("toStringTag"),x=TypeError,w=o[g],_=y||!i(w)||w.prototype!==h||!d((function(){w({})})),C=function(){if(s(this,h),c(this)===h)throw new x("Abstract class Iterator not directly constructable")},E=function(e,t){m?l(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new x("You can't redefine this property");p(this,e)?this[e]=t:u(this,e,t)}}):h[e]=t};p(h,b)||E(b,g),!_&&p(h,v)&&h[v]!==Object||E(v,C),C.prototype=h,r({global:!0,constructor:!0,forced:_},{Iterator:C})},8227:(e,t,n)=>{"use strict";var r=n(4576),o=n(5745),s=n(9297),a=n(3392),i=n(4495),c=n(7040),l=r.Symbol,u=o("wks"),d=c?l.for||l:l&&l.withoutSetter||a;e.exports=function(e){return s(u,e)||(u[e]=i&&s(l,e)?l[e]:d("Symbol."+e)),u[e]}},8237:(e,t,n)=>{"use strict";var r=n(6518),o=n(2652),s=n(9306),a=n(8551),i=n(1767),c=n(9539),l=n(4549),u=n(8745),d=n(9039),p=TypeError,f=d((function(){[].keys().reduce((function(){}),void 0)})),h=!f&&l("reduce",p);r({target:"Iterator",proto:!0,real:!0,forced:f||h},{reduce:function(e){a(this);try{s(e)}catch(e){c(this,"throw",e)}var t=arguments.length<2,n=t?void 0:arguments[1];if(h)return u(h,this,t?[e]:[e,n]);var r=i(this),l=0;if(o(r,(function(r){t?(t=!1,n=r):n=e(n,r,l),l++}),{IS_RECORD:!0}),t)throw new p("Reduce of empty iterator with no initial value");return n}})},8418:(e,t,n)=>{"use strict";e.exports=n(5160)},8469:(e,t,n)=>{"use strict";var r=n(9504),o=n(507),s=n(4402),a=s.Set,i=s.proto,c=r(i.forEach),l=r(i.keys),u=l(new a).next;e.exports=function(e,t,n){return n?o({iterator:l(e),next:u},t):c(e,t)}},8480:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},8527:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402).has,s=n(5170),a=n(3789),i=n(507),c=n(9539);e.exports=function(e){var t=r(this),n=a(e);if(s(t)<n.size)return!1;var l=n.getIterator();return!1!==i(l,(function(e){if(!o(t,e))return c(l,"normal",!1)}))}},8551:(e,t,n)=>{"use strict";var r=n(34),o=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not an object")}},8622:(e,t,n)=>{"use strict";var r=n(4576),o=n(4901),s=r.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},8686:(e,t,n)=>{"use strict";var r=n(3724),o=n(9039);e.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8745:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype,s=o.apply,a=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(s):function(){return a.apply(s,arguments)})},8750:(e,t,n)=>{"use strict";var r=n(7080),o=n(4402),s=n(5170),a=n(3789),i=n(8469),c=n(507),l=o.Set,u=o.add,d=o.has;e.exports=function(e){var t=r(this),n=a(e),o=new l;return s(t)>n.size?c(n.getIterator(),(function(e){d(t,e)&&u(o,e)})):i(t,(function(e){n.includes(e)&&u(o,e)})),o}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},8785:e=>{"use strict";e.exports=require("preact")},8872:(e,t,n)=>{"use strict";n(8237)},8981:(e,t,n)=>{"use strict";var r=n(7750),o=Object;e.exports=function(e){return o(r(e))}},8992:(e,t,n)=>{"use strict";n(8111)},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9209:(e,t,n)=>{"use strict";n(5876)},9225:(e,t,n)=>{"use strict";n(8004)},9286:(e,t,n)=>{"use strict";var r=n(4402),o=n(8469),s=r.Set,a=r.add;e.exports=function(e){var t=new s;return o(e,(function(e){a(t,e)})),t}},9297:(e,t,n)=>{"use strict";var r=n(9504),o=n(8981),s=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(o(e),t)}},9306:(e,t,n)=>{"use strict";var r=n(4901),o=n(6823),s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(o(e)+" is not a function")}},9433:(e,t,n)=>{"use strict";var r=n(4576),o=Object.defineProperty;e.exports=function(e,t){try{o(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},9462:(e,t,n)=>{"use strict";var r=n(9565),o=n(2360),s=n(6699),a=n(6279),i=n(8227),c=n(1181),l=n(5966),u=n(7657).IteratorPrototype,d=n(2529),p=n(9539),f=i("toStringTag"),h="IteratorHelper",m="WrapForValidIterator",y=c.set,v=function(e){var t=c.getterFor(e?m:h);return a(o(u),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return d(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:d(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),o=n.iterator;if(n.done=!0,e){var s=l(o,"return");return s?r(s,o):d(void 0,!0)}if(n.inner)try{p(n.inner.iterator,"normal")}catch(e){return p(o,"throw",e)}return o&&p(o,"normal"),d(void 0,!0)}})},g=v(!0),b=v(!1);s(b,f,"Iterator Helper"),e.exports=function(e,t,n){var r=function(r,o){o?(o.iterator=r.iterator,o.next=r.next):o=r,o.type=t?m:h,o.returnHandlerResult=!!n,o.nextHandler=e,o.counter=0,o.done=!1,y(this,o)};return r.prototype=t?g:b,r}},9497:(e,t,n)=>{"use strict";n(8107);var r=n(7015);e.exports=r("Array","at")},9504:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype,s=o.call,a=r&&o.bind.bind(s,s);e.exports=r?a:function(e){return function(){return s.apply(e,arguments)}}},9519:(e,t,n)=>{"use strict";var r,o,s=n(4576),a=n(2839),i=s.process,c=s.Deno,l=i&&i.versions||c&&c.version,u=l&&l.v8;u&&(o=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=+r[1]),e.exports=o},9539:(e,t,n)=>{"use strict";var r=n(9565),o=n(8551),s=n(5966);e.exports=function(e,t,n){var a,i;o(e);try{if(!(a=s(e,"return"))){if("throw"===t)throw n;return n}a=r(a,e)}catch(e){i=!0,a=e}if("throw"===t)throw n;if(i)throw a;return o(a),n}},9565:(e,t,n)=>{"use strict";var r=n(616),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},9617:(e,t,n)=>{"use strict";var r=n(5397),o=n(5610),s=n(6198),a=function(e){return function(t,n,a){var i=r(t),c=s(i);if(0===c)return!e&&-1;var l,u=o(a,c);if(e&&n!=n){for(;c>u;)if((l=i[u++])!=l)return!0}else for(;c>u;u++)if((e||u in i)&&i[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>q,AgentInfo:()=>al,Chat:()=>Wi,ChatFrame:()=>Dc,ComponentFilter:()=>Ja,Conversation:()=>Ri,Engine:()=>Yc,EntryContainer:()=>Rc,EventParticipant:()=>Us,ExternalApi:()=>el,Header:()=>il,Icon:()=>$s,Interrupt:()=>Mc,MessageContainer:()=>Fs,SeamlyActivityEventContext:()=>Ls,SeamlyActivityMonitor:()=>Xa,SeamlyApiContext:()=>Yo,SeamlyEventBusContext:()=>Qo,SeamlyFileUpload:()=>Za,SeamlyGeneralError:()=>x,SeamlyLiveRegionContext:()=>os,SeamlyOfflineError:()=>Kn,SeamlyStoreProvider:()=>Ht,Text:()=>Ha,TextEntry:()=>jc,Upload:()=>Lc,View:()=>Jc,appReducer:()=>qn,appStorageProvider:()=>nl,calculateVisibility:()=>At,className:()=>Cs,configReducer:()=>$n,cookieStorageProvider:()=>sl,default:()=>fl,eventTypes:()=>E,formsReducer:()=>ir,getSearchParamsByKeys:()=>ul,getUrlSearchParams:()=>cl,getUrlSearchString:()=>ll,i18nReducer:()=>fr,initResetSearchParams:()=>pl,interruptReducer:()=>br,randomId:()=>$,replaceSearchParams:()=>dl,sessionStorageProvider:()=>C,setConfig:()=>zn,setInitialLocale:()=>dr,setParticipant:()=>Qr,setPreChatEvents:()=>Vn,setTranslations:()=>pr,stateReducer:()=>mo,timeout:()=>hs,translationReducer:()=>jo,useChoicePrompt:()=>Qs,useEvents:()=>vn,useGeneratedId:()=>Ms,useI18n:()=>qo,useSeamlyActions:()=>tl,useSeamlyChat:()=>ls,useSeamlyCommands:()=>rs,useSeamlyConfig:()=>en,useSeamlyEventStream:()=>Ds,useSeamlyIdleDetachCountdown:()=>Rs,useSeamlyMessageContainerClassNames:()=>Ss,useSeamlyOptions:()=>ks,useSeamlyVisibility:()=>Ko,useTranslatedEventData:()=>xs,useTranslations:()=>bs,useTranslationsContainer:()=>ws,visibilityReducer:()=>Io,visibilityStates:()=>Ot}),n(9497),n(4114),n(8992),n(4520),n(3949),n(1454),n(7550);var e=n(2086),t=n.n(e),o=n(8785),s=(n(3375),n(9225),n(3972),n(9209),n(5714),n(7561),n(6197),function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},s(e,t)});function a(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return a}var c=function(e,t){this.target=t,this.type=e},l=function(e){function t(t,n){var r=e.call(this,"error",n)||this;return r.message=t.message,r.error=t,r}return a(t,e),t}(c),u=function(e){function t(t,n,r){void 0===t&&(t=1e3),void 0===n&&(n="");var o=e.call(this,"close",r)||this;return o.wasClean=!0,o.code=t,o.reason=n,o}return a(t,e),t}(c),d=function(){if("undefined"!=typeof WebSocket)return WebSocket},p={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},f=function(){function e(e,t,n){var r=this;void 0===n&&(n={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(e){r._debug("open event");var t=r._options.minUptime,n=void 0===t?p.minUptime:t;clearTimeout(r._connectTimeout),r._uptimeTimeout=setTimeout((function(){return r._acceptOpen()}),n),r._ws.binaryType=r._binaryType,r._messageQueue.forEach((function(e){return r._ws.send(e)})),r._messageQueue=[],r.onopen&&r.onopen(e),r._listeners.open.forEach((function(t){return r._callEventListener(e,t)}))},this._handleMessage=function(e){r._debug("message event"),r.onmessage&&r.onmessage(e),r._listeners.message.forEach((function(t){return r._callEventListener(e,t)}))},this._handleError=function(e){r._debug("error event",e.message),r._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),r.onerror&&r.onerror(e),r._debug("exec error listeners"),r._listeners.error.forEach((function(t){return r._callEventListener(e,t)})),r._connect()},this._handleClose=function(e){r._debug("close event"),r._clearTimeouts(),r._shouldReconnect&&r._connect(),r.onclose&&r.onclose(e),r._listeners.close.forEach((function(t){return r._callEventListener(e,t)}))},this._url=e,this._protocols=t,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){return this._messageQueue.reduce((function(e,t){return"string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e}),0)+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")},e.prototype.reconnect=function(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()},e.prototype.send=function(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{var t=this._options.maxEnqueuedMessages,n=void 0===t?p.maxEnqueuedMessages:t;this._messageQueue.length<n&&(this._debug("enqueue",e),this._messageQueue.push(e))}},e.prototype.addEventListener=function(e,t){this._listeners[e]&&this._listeners[e].push(t)},e.prototype.dispatchEvent=function(e){var t,n,r=this._listeners[e.type];if(r)try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(r),s=o.next();!s.done;s=o.next()){var a=s.value;this._callEventListener(e,a)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return!0},e.prototype.removeEventListener=function(e,t){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((function(e){return e!==t})))},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._options.debug&&console.log.apply(console,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e}(["RWS>"],e))},e.prototype._getNextDelay=function(){var e=this._options,t=e.reconnectionDelayGrowFactor,n=void 0===t?p.reconnectionDelayGrowFactor:t,r=e.minReconnectionDelay,o=void 0===r?p.minReconnectionDelay:r,s=e.maxReconnectionDelay,a=void 0===s?p.maxReconnectionDelay:s,i=0;return this._retryCount>0&&(i=o*Math.pow(n,this._retryCount-1))>a&&(i=a),this._debug("next delay",i),i},e.prototype._wait=function(){var e=this;return new Promise((function(t){setTimeout(t,e._getNextDelay())}))},e.prototype._getNextUrl=function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")},e.prototype._connect=function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,n=t.maxRetries,r=void 0===n?p.maxRetries:n,o=t.connectionTimeout,s=void 0===o?p.connectionTimeout:o,a=t.WebSocket,i=void 0===a?d():a;if(this._retryCount>=r)this._debug("max retries reached",this._retryCount,">=",r);else{if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),void 0===(c=i)||!c||2!==c.CLOSING)throw Error("No valid WebSocket class provided");var c;this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._debug("connect",{url:t,protocols:e._protocols}),e._ws=e._protocols?new i(t,e._protocols):new i(t),e._ws.binaryType=e._binaryType,e._connectLock=!1,e._addListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),s))}))}}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new l(Error("TIMEOUT"),this))},e.prototype._disconnect=function(e,t){if(void 0===e&&(e=1e3),this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new u(e,t,this))}catch(e){}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(e,t){"handleEvent"in t?t.handleEvent(e):t(e)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}();const h=f;n(8872);const m=new Set;class y{#e=[];#t=null;#n=null;#r=e=>{const t=JSON.parse(e.data);this.#t&&clearInterval(this.#t),this.#t=setInterval((()=>{this.socket?.readyState===h.OPEN&&this.socket?.send(JSON.stringify({type:"ping"}))}),3e4);try{if("attach_channel_response"===t.type){if(!t.payload.success)return void this.#o({connected:!0,ready:!1,currentState:"attach_channel_erred"});this.#o({connected:!0,ready:!0,currentState:"attach_channel_response"})}}catch(e){console.warn(e)}};#s=()=>{this.#o({connected:!1,ready:!1,currentState:"socket_closed"})};#a=()=>{this.#o({connected:!1,ready:!1,currentState:"socket_join_error"})};accessToken="";channelName="";channelTopic="";url="";async connect(e,t,n,r){this.url=e,this.accessToken=r,this.channelName=t,this.channelTopic=n;const{url:o}=(e=>{const t=e.indexOf("?");return t<0?{url:e,params:{}}:{url:e.slice(0,t),params:e.slice(t+1).split("&").reduce((function(e,t){const[n,r]=t.split("=");return{...e,[n]:decodeURIComponent(r)}}),{})}})(this.url);this.socket=new h(o,[],{maxReconnectionDelay:1e4,minReconnectionDelay:500,reconnectionDelayGrowFactor:2});const s={type:"attach_channel",payload:{accessToken:this.accessToken,channelName:this.channelName}};this.#n=()=>{this.socket?.send(JSON.stringify(s)),this.#o({connected:!0,ready:!1,currentState:"socket_connected"})},this.socket?.addEventListener("open",this.#n),this.socket?.addEventListener("message",this.#r),this.socket?.addEventListener("close",this.#s),this.socket?.addEventListener("error",this.#a)}disconnect(){this.socket?.close(),this.#n&&this.socket?.removeEventListener("open",this.#n),this.socket?.removeEventListener("message",this.#r),this.socket?.removeEventListener("close",this.#s),this.socket?.removeEventListener("error",this.#a),this.#e=[]}onOpen=e=>{this?.socket?.addEventListener("open",e)};onError=e=>{this?.socket?.addEventListener("error",e)};addListener=(e,t)=>{this?.socket?.addEventListener(e,(e=>t(JSON.parse(e.data))))};onMessage=e=>{this?.socket&&(this.socket.onmessage=t=>e(JSON.parse(t.data)))};removeListener=(e,t)=>{this.socket?.removeEventListener(e,t)};onConnection(e){this.#e.push(e)}#o(e){this.#e=this.#e.filter((t=>!t(e))),m.forEach((e=>e()))}pushToChannel(e,t){this.socket?.send(JSON.stringify({type:e,payload:t}))}static subscribe(e){return m.add(e),()=>m.delete(e)}}class v extends Error{constructor(e,t){super(e,{cause:t?.cause}),this.status=t?.status}}class g 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 b extends g{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class x extends g{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class w extends g{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}class _ extends g{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}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 n?JSON.parse(n):{}},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}const E={info:"info",message:"message",participant:"participant",system:"system"},S="text",j="text",T="upload",N="received",I="read",k="custom",O="detach_service",L="dismiss",A="set_topic",R="click_cta",P="translation_proposal",M=P,D="window_api",U="assertive",F="polite",z={new_topic:"newTopic",new_translation:"newTranslation"},B="uploads",V="navigate";function $(){return`_${(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}`}const H=async(e,t)=>{const n=new URL(e),r=await fetch(n.href,{mode:"cors",...t});if(!r.ok)throw new v(r.statusText||`Request failed with status: ${r.status}`,{status:r.status});return r};function W(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:void 0}const G=()=>null;class q{#i;#c;#l;#u="window";#d;#p="new";URLS={};locale="";conversation=new y;constructor({layoutMode:e,namespace:t,config:n,context:r}){this.store=function(e,t){const n=t(e),r=n.get()||{};return{get:e=>void 0===e?r:r[e],set:(e,t)=>(r[e]=t,n.set(r),t),delete(e){const t=this.get(e);return delete r[e],n.set(r),t}}}(`${t}.connection${r.userLocale?`.${r.userLocale}`:""}`,n.storageProvider||C),this.connectionInfo={apiKey:n.key,domain:n.domain||"api.seamly-app.com",secure:!1!==n.secure&&(n.secure||!0)},this.#d={...n,sendEnvironment:n.sendEnvironment??!0,context:{...r,channelName:r.channelName||"web"}},this.#i=!1,this.connected=!1,this.configReady=!1,n.externalId&&(this.#c=n.externalId),this.#u=e,this.userResponded=!1,this.URLS={translations:{href:`/channels/api/v2/client/${this.connectionInfo.apiKey}/translations/{version}/{locale}.json`,templated:!0},config:{href:`/channels/api/v2/client/${this.connectionInfo.apiKey}/configs`,templated:!0}},window.addEventListener("pageshow",(e=>{e.persisted&&this.connected&&this.connect()}))}getAccessToken(){return this.store.get("accessToken")}setAccessToken(e){this.store.set("accessToken",e)}getConversationUrl(){return this.store.get("conversationUrl")}setConversationUrl(e){this.store.set("conversationUrl",e?.href)}hasConversation(){return!!this.getConversationUrl()}getChannelTopic(){return this.store.get("channelTopic")||this.store.get("channelName")}getLocale=e=>e||this.locale;#f({_links:{self:e,...t}}){this.URLS={...this.URLS,...t}}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName"),this.store.delete("channelTopic")}#h(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}async getTranslations(e){try{if(!this.URLS.translations?.href)throw new b;const t=`${this.#h("http")}${this.URLS.translations.href}`.replace("{version}",String(4)).replace("{locale}",this.getLocale(e)),n=await H(t,{method:"GET"});return(await n.json()).translations}catch(e){if(e.status>=500)throw new x(e);throw new v(e)}}getContext(e){const{source:t,userLocale:n,variables:r}=e;if(t&&"string"!=typeof t)throw new Error("Source must be a string");if(n){if("string"!=typeof n)throw new Error("Locale must be a string");this.#m(e,n)}if(r&&"object"!=typeof r)throw new Error("Variables must be an object");if(0===Object.keys(e).length&&e.constructor===Object)return;const o=this.#d.context?.userLocale;return{...o?{userLocale:o}:{},...e}}async downloadFile(e,t){try{const n=await H(`${this.#h("http")}${this.URLS.uploads.href}/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.getAccessToken()}`}}),r=document.createElement("a"),o=URL.createObjectURL(await n.blob());r.href=o,void 0!==r.download&&(r.download=t),r.click(),setTimeout((()=>{URL.revokeObjectURL(o)}),6e4)}catch(e){}}uploadFile(e,t,n,r){const o=new FormData;o.append("upload",e);const s=new XMLHttpRequest;return s.open("POST",`${this.#h("http")}${this.URLS.uploads.href}`),s.setRequestHeader("Authorization",`Bearer ${this.getAccessToken()}`),s.upload.onprogress=e=>{if("function"==typeof t){const n=Math.ceil(e.loaded/e.total*100);t(n)}},s.onloadend=()=>{if(0!==s.status)if(200!==s.status&&201!==s.status||!n){if(!r)throw new Error(s.response);try{r(JSON.parse(s.response))}catch(e){r(s.response)}}else try{n(JSON.parse(s.response))}catch(e){n(s.response)}},s.send(o),s}async createConversation(){try{"function"==typeof this.#d?.getConversationAuthToken&&(this.#l=await this.#d.getConversationAuthToken());const e=await H(`${this.#h("http")}${this.URLS.conversations?.href}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({externalId:this.#l?void 0:this.#c,token:this.#l})}),t=await e.json(),{conversation:n}=t,r={...n};return this.setAccessToken(n.accessToken),this.#f(t),this.URLS.conversation&&this.setConversationUrl(this.URLS.conversation),this.locale=n.context.userLocale,this.userResponded=n.userResponded,this.#p=n.status,r}catch(e){if(e.status>=500)throw new x(e);if(400===e.status)throw new _(e);if(404===e.status)throw new b(e);throw e}}async getConfig(){try{const e={channelName:this.#d.context.channelName,contentLocale:this.#d.context.contentLocale,environment:!0===this.#d.sendEnvironment?this.getEnvironment():this.#d.sendEnvironment,userLocale:this.#d.context.userLocale,variables:this.#d.context.variables},t=await H(`${this.#h("http")}${this.URLS.config?.href}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e})}),n=await t.json();return this.#f(n),this.configReady=!0,n.config}catch(e){if(404===e.status)throw new b(e);if(e.status>=500)throw new x(e);throw e}}async fetchConversation(){if(!this.hasConversation())return null;try{const e=await H(`${this.#h("http")}${this.getConversationUrl()}`,{method:"GET",headers:{Authorization:`Bearer ${this.getAccessToken()}`}}),t=await e.json();return this.#p=t.conversation.status,this.#f(t),t.conversation}catch(e){if(401===e.status)throw new _(e);if(404===e.status)throw new w(e);if(e.status>=500)throw new x(e);throw e}}async getConversation(){return this.hasConversation()?this.fetchConversation():null}async getConversationIntitialState(){return this.fetchConversation()}async disconnect(){this.conversation?.disconnect&&this.conversation.disconnect(),this.connected=!1,this.configReady=!1}async connect(){this.connected=!1;const e=this.hasConversation()?void 0:await this.createConversation();return this.URLS.socket&&(this.conversation.connect(`${this.#h("ws")}${this.URLS.socket.href}`,this.#d.context.channelName||"",this.getChannelTopic(),this.getAccessToken()),this.conversation.onConnection((({connected:e,ready:t})=>{this.connected=e,this.#i=t})),this.send("context",this.#y())),e}send(e,t=void 0){this.connected&&this.#i?(G("[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))):this.conversation?.onConnection((({connected:n,ready:r})=>(this.connected=n,this.#i=r,!!r&&(this.send(e,t),!0))))}sendContext(e){const t=this.getContext(e);t&&this.send("context",t)}#y(){const e=!0===this.#d.sendEnvironment?this.getEnvironment():void 0,t="string"==typeof this.#d.context?.source?this.#d.context?.source:void 0,n=this.#d.context?.variables;return{contentLocale:"started"!==this.#p?this.#d.context?.contentLocale:void 0,environment:e,source:t,userLocale:"started"!==this.#p?this.#d.context?.userLocale:void 0,variables:n}}#m(e,t){e.source||t==this.#d.context?.userLocale||(e.source=D)}getEnvironment(){return{clientName:"@seamly/web-ui",clientVariant:this.#u,clientVersion:"24.5.0",currentUrl:window.location.toString(),screenResolution:`${window.screen.width}x${window.screen.height}`,timezone:W(),userAgent:navigator.userAgent,preferredLocale:navigator.language}}}function K(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 J=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),X=()=>Math.random().toString(36).substring(7).split("").join("."),Y={INIT:`@@redux/INIT${X()}`,REPLACE:`@@redux/REPLACE${X()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${X()}`};function Q(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Z(e,t,n){if("function"!=typeof e)throw new Error(K(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(K(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(K(1));return n(Z)(e,t)}let r=e,o=t,s=new Map,a=s,i=0,c=!1;function l(){a===s&&(a=new Map,s.forEach(((e,t)=>{a.set(t,e)})))}function u(){if(c)throw new Error(K(3));return o}function d(e){if("function"!=typeof e)throw new Error(K(4));if(c)throw new Error(K(5));let t=!0;l();const n=i++;return a.set(n,e),function(){if(t){if(c)throw new Error(K(6));t=!1,l(),a.delete(n),s=null}}}function p(e){if(!Q(e))throw new Error(K(7));if(void 0===e.type)throw new Error(K(8));if("string"!=typeof e.type)throw new Error(K(17));if(c)throw new Error(K(9));try{c=!0,o=r(o,e)}finally{c=!1}return(s=a).forEach((e=>{e()})),e}return p({type:Y.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(K(10));r=e,p({type:Y.REPLACE})},[J]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(K(11));function n(){const e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[J](){return this}}}}}function ee(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Y.INIT}))throw new Error(K(12));if(void 0===n(void 0,{type:Y.PROBE_UNKNOWN_ACTION()}))throw new Error(K(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let s=!1;const a={};for(let o=0;o<r.length;o++){const i=r[o],c=n[i],l=e[i],u=c(l,t);if(void 0===u)throw t&&t.type,new Error(K(14));a[i]=u,s=s||u!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function te(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ne(e){return({dispatch:t,getState:n})=>r=>o=>"function"==typeof o?o(t,n,e):r(o)}var re=ne(),oe=ne,se=Symbol.for("immer-nothing"),ae=Symbol.for("immer-draftable"),ie=Symbol.for("immer-state");function ce(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var le=Object.getPrototypeOf;function ue(e){return!!e&&!!e[ie]}function de(e){return!!e&&(fe(e)||Array.isArray(e)||!!e[ae]||!!e.constructor?.[ae]||ge(e)||be(e))}var pe=Object.prototype.constructor.toString();function fe(e){if(!e||"object"!=typeof e)return!1;const t=le(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===pe}function he(e,t){0===me(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function me(e){const t=e[ie];return t?t.type_:Array.isArray(e)?1:ge(e)?2:be(e)?3:0}function ye(e,t){return 2===me(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ve(e,t,n){const r=me(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ge(e){return e instanceof Map}function be(e){return e instanceof Set}function xe(e){return e.copy_||e.base_}function we(e,t){if(ge(e))return new Map(e);if(be(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=fe(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[ie];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],s=t[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(le(e),t)}{const t=le(e);if(null!==t&&n)return{...e};const r=Object.create(t);return Object.assign(r,e)}}function _e(e,t=!1){return Ee(e)||ue(e)||!de(e)||(me(e)>1&&(e.set=e.add=e.clear=e.delete=Ce),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>_e(t,!0)))),e}function Ce(){ce(2)}function Ee(e){return Object.isFrozen(e)}var Se,je={};function Te(e){const t=je[e];return t||ce(0),t}function Ne(){return Se}function Ie(e,t){t&&(Te("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ke(e){Oe(e),e.drafts_.forEach(Ae),e.drafts_=null}function Oe(e){e===Se&&(Se=e.parent_)}function Le(e){return Se={drafts_:[],parent_:Se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ae(e){const t=e[ie];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Re(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ie].modified_&&(ke(t),ce(4)),de(e)&&(e=Pe(t,e),t.parent_||De(t,e)),t.patches_&&Te("Patches").generateReplacementPatches_(n[ie].base_,e,t.patches_,t.inversePatches_)):e=Pe(t,n,[]),ke(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==se?e:void 0}function Pe(e,t,n){if(Ee(t))return t;const r=t[ie];if(!r)return he(t,((o,s)=>Me(e,r,t,o,s,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return De(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,s=!1;3===r.type_&&(o=new Set(t),t.clear(),s=!0),he(o,((o,a)=>Me(e,r,t,o,a,n,s))),De(e,t,!1),n&&e.patches_&&Te("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Me(e,t,n,r,o,s,a){if(ue(o)){const a=Pe(e,o,s&&t&&3!==t.type_&&!ye(t.assigned_,r)?s.concat(r):void 0);if(ve(n,r,a),!ue(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(de(o)&&!Ee(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Pe(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||De(e,o)}}function De(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_e(t,n)}var Ue={get(e,t){if(t===ie)return e;const n=xe(e);if(!ye(n,t))return function(e,t,n){const r=Be(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!de(r)?r:r===ze(e.base_,t)?($e(e),e.copy_[t]=He(r,e)):r},has:(e,t)=>t in xe(e),ownKeys:e=>Reflect.ownKeys(xe(e)),set(e,t,n){const r=Be(xe(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ze(xe(e),t),a=r?.[ie];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)&&(void 0!==n||ye(e.base_,t)))return!0;$e(e),Ve(e)}var o,s;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==ze(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,$e(e),Ve(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=xe(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){ce(11)},getPrototypeOf:e=>le(e.base_),setPrototypeOf(){ce(12)}},Fe={};function ze(e,t){const n=e[ie];return(n?xe(n):e)[t]}function Be(e,t){if(!(t in e))return;let n=le(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=le(n)}}function Ve(e){e.modified_||(e.modified_=!0,e.parent_&&Ve(e.parent_))}function $e(e){e.copy_||(e.copy_=we(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function He(e,t){const n=ge(e)?Te("MapSet").proxyMap_(e,t):be(e)?Te("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ne(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,s=Ue;n&&(o=[r],s=Fe);const{revoke:a,proxy:i}=Proxy.revocable(o,s);return r.draft_=i,r.revoke_=a,i}(e,t);return(t?t.scope_:Ne()).drafts_.push(n),n}function We(e){if(!de(e)||Ee(e))return e;const t=e[ie];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=we(e,t.scope_.immer_.useStrictShallowCopy_)}else n=we(e,!0);return he(n,((e,t)=>{ve(n,e,We(t))})),t&&(t.finalized_=!1),n}he(Ue,((e,t)=>{Fe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fe.deleteProperty=function(e,t){return Fe.set.call(this,e,t,void 0)},Fe.set=function(e,t,n){return Ue.set.call(this,e[0],t,n,e[0])};var Ge=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&ce(6),void 0!==n&&"function"!=typeof n&&ce(7),de(e)){const o=Le(this),s=He(e,void 0);let a=!0;try{r=t(s),a=!1}finally{a?ke(o):Oe(o)}return Ie(o,n),Re(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===se&&(r=void 0),this.autoFreeze_&&_e(r,!0),n){const t=[],o=[];Te("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}ce(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){var t;de(e)||ce(8),ue(e)&&(ue(t=e)||ce(10),e=We(t));const n=Le(this),r=He(e,void 0);return r[ie].isManual_=!0,Oe(n),r}finishDraft(e,t){const n=e&&e[ie];n&&n.isManual_||ce(9);const{scope_:r}=n;return Ie(r,t),Re(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Te("Patches").applyPatches_;return ue(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},qe=Ge.produce;Ge.produceWithPatches.bind(Ge),Ge.setAutoFreeze.bind(Ge),Ge.setUseStrictShallowCopy.bind(Ge),Ge.applyPatches.bind(Ge),Ge.createDraft.bind(Ge),Ge.finishDraft.bind(Ge);var Ke="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?te:te.apply(null,arguments)},Je=("undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__,e=>e&&"function"==typeof e.match);function Xe(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(bt(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>function(e){return Q(e)&&"type"in e&&"string"==typeof e.type}(t)&&t.type===e,n}var Ye=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Qe(e){return de(e)?qe(e,(()=>{})):e}function Ze(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var et=e=>t=>{setTimeout(t,e)};function tt(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let s=new Ye;return t&&("boolean"==typeof t?s.push(re):s.push(oe(t.extraArgument))),s},{reducer:n,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:s=!0,preloadedState:a,enhancers:i}=e||{};let c,l;if("function"==typeof n)c=n;else{if(!Q(n))throw new Error(bt(1));c=ee(n)}l="function"==typeof r?r(t):t();let u=te;o&&(u=Ke({trace:!1,..."object"==typeof o&&o}));const d=function(...e){return t=>(n,r)=>{const o=t(n,r);let s=()=>{throw new Error(K(15))};const a={getState:o.getState,dispatch:(e,...t)=>s(e,...t)},i=e.map((e=>e(a)));return s=te(...i)(o.dispatch),{...o,dispatch:s}}}(...l),p=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ye(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,s=!1,a=!1;const i=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:et(10):"callback"===e.type?e.queueNotification:et(e.timeout),l=()=>{a=!1,s&&(s=!1,i.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>o&&e()));return i.add(e),()=>{t(),i.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,s=!o,s&&(a||(a=!0,c(l))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof n?n:void 0)),r})(d);return Z(c,a,u(..."function"==typeof i?i(p):p()))}function nt(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(bt(28));if(r in t)throw new Error(bt(29));return t[r]=n,o},addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),o),addDefaultCase:e=>(r=e,o)};return e(o),[t,n,r]}function rt(...e){return t=>e.some((e=>((e,t)=>Je(e)?e.match(t):e(t))(e,t)))}var ot=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},st=["name","message","stack","code"],at=class{constructor(e,t){this.payload=e,this.meta=t}_type},it=class{constructor(e,t){this.payload=e,this.meta=t}_type},ct=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of st)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},lt="External signal was aborted",ut=(()=>{function e(e,t,n){const r=Xe(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),o=Xe(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),s=Xe(e+"/rejected",((e,t,r,o,s)=>({payload:o,error:(n&&n.serializeError||ct)(e||"Rejected"),meta:{...s||{},arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e,{signal:a}={}){return(i,c,l)=>{const u=n?.idGenerator?n.idGenerator(e):ot(),d=new AbortController;let p,f;function h(e){f=e,d.abort()}a&&(a.aborted?h(lt):a.addEventListener("abort",(()=>h(lt)),{once:!0}));const m=async function(){let a;try{let s=n?.condition?.(e,{getState:c,extra:l});if(null!==(m=s)&&"object"==typeof m&&"function"==typeof m.then&&(s=await s),!1===s||d.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const y=new Promise(((e,t)=>{p=()=>{t({name:"AbortError",message:f||"Aborted"})},d.signal.addEventListener("abort",p)}));i(o(u,e,n?.getPendingMeta?.({requestId:u,arg:e},{getState:c,extra:l}))),a=await Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:c,extra:l,requestId:u,signal:d.signal,abort:h,rejectWithValue:(e,t)=>new at(e,t),fulfillWithValue:(e,t)=>new it(e,t)})).then((t=>{if(t instanceof at)throw t;return t instanceof it?r(t.payload,u,e,t.meta):r(t,u,e)}))])}catch(t){a=t instanceof at?s(null,u,e,t.payload,t.meta):s(t,u,e)}finally{p&&d.signal.removeEventListener("abort",p)}var m;return n&&!n.dispatchConditionRejection&&s.match(a)&&a.meta.condition||i(a),a}();return Object.assign(m,{abort:h,requestId:u,arg:e,unwrap:()=>m.then(dt)})}}),{pending:o,rejected:s,fulfilled:r,settled:rt(s,r),typePrefix:e})}return e.withTypes=()=>e,e})();function dt(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var pt=Symbol.for("rtk-slice-createasyncthunk");function ft(e,t){return`${e}/${t}`}function ht({creators:e}={}){const t=e?.asyncThunk?.[pt];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(bt(11));const o=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},s=Object.keys(o),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},i={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(bt(12));if(n in a.sliceCaseReducersByType)throw new Error(bt(13));return a.sliceCaseReducersByType[n]=t,i},addMatcher:(e,t)=>(a.sliceMatchers.push({matcher:e,reducer:t}),i),exposeAction:(e,t)=>(a.actionCreators[e]=t,i),exposeCaseReducer:(e,t)=>(a.sliceCaseReducersByName[e]=t,i)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?nt(e.extraReducers):[e.extraReducers],o={...t,...a.sliceCaseReducersByType};return function(e){let t,[s,i,c]=nt((e=>{for(let t in o)e.addCase(t,o[t]);for(let t of a.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}));if("function"==typeof e)t=()=>Qe(e());else{const n=Qe(e);t=()=>n}function l(e=t(),n){let r=[s[n.type],...i.filter((({matcher:e})=>e(n))).map((({reducer:e})=>e))];return 0===r.filter((e=>!!e)).length&&(r=[c]),r.reduce(((e,t)=>{if(t){if(ue(e)){const r=t(e,n);return void 0===r?e:r}if(de(e))return qe(e,(e=>t(e,n)));{const r=t(e,n);if(void 0===r){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 l.getInitialState=t,l}(e.initialState)}s.forEach((r=>{const s=o[r],a={reducerName:r,type:ft(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(s)?function({type:e,reducerName:t,createNotation:n},r,o){let s,a;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(bt(17));s=r.reducer,a=r.prepare}else s=r;o.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,a?Xe(e,a):Xe(e))}(a,s,i):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(bt(18));const{payloadCreator:s,fulfilled:a,pending:i,rejected:c,settled:l,options:u}=n,d=o(e,s,u);r.exposeAction(t,d),a&&r.addCase(d.fulfilled,a),i&&r.addCase(d.pending,i),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:a||vt,pending:i||vt,rejected:c||vt,settled:l||vt})}(a,s,i,t)}));const l=e=>e,u=new Map,d=new WeakMap;let p;function f(e,t){return p||(p=c()),p(e,t)}function h(){return p||(p=c()),p.getInitialState()}function m(t,n=!1){function r(e){let o=e[t];return void 0===o&&n&&(o=Ze(d,r,h)),o}function o(t=l){const r=Ze(u,n,(()=>new WeakMap));return Ze(r,t,(()=>{const r={};for(const[o,s]of Object.entries(e.selectors??{}))r[o]=mt(s,t,(()=>Ze(d,t,h)),n);return r}))}return{reducerPath:t,getSelectors:o,get selectors(){return o(r)},selectSlice:r}}const y={name:n,reducer:f,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:h,...m(r),injectInto(e,{reducerPath:t,...n}={}){const o=t??r;return e.inject({reducerPath:o,reducer:f},n),{...y,...m(o,!0)}}};return y}}function mt(e,t,n,r){function o(o,...s){let a=t(o);return void 0===a&&r&&(a=n()),e(a,...s)}return o.unwrapped=e,o}var yt=ht();function vt(){}var{assign:gt}=Object;function bt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");class xt extends g{constructor(e,...t){super(e,...t),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}const wt=ut("initializeConfig",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{try{const{features:e,preChat:r,agentParticipant:o,defaultContentLocale:s,defaultUserLocale:a,userParticipant:i,startChatIcon:c}=await t.getConfig(),{connectWhenInView:l}=n;return{features:e,preChat:r,agentParticipant:o,userParticipant:i,startChatIcon:c,defaultUserLocale:n?.context?.userLocale||a,defaultContentLocale:n?.context?.contentLocale||s,connectWhenInView:l}}catch(e){return r(e)}})),_t=ut("resetConfig",(async(e,{extra:{config:t}})=>t));var Ct=e=>Array.isArray(e)?e:[e];Symbol(),Object.getPrototypeOf({});var Et="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function St(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,s=0;function a(){let t=n;const{length:a}=arguments;for(let e=0,n=a;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=r}}const i=t;let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),s++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==s&&s--),o="object"==typeof c&&null!==c||"function"==typeof c?new Et(c):c}return i.s=1,i.v=c,c}return a.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function jt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},a=e.pop();"object"==typeof a&&(s=a,a=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const i={...n,...s},{memoize:c,memoizeOptions:l=[],argsMemoize:u=St,argsMemoizeOptions:d=[],devModeChecks:p={}}=i,f=Ct(l),h=Ct(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=c((function(){return r++,a.apply(null,arguments)}),...f),v=u((function(){o++;const e=function(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}(m,arguments);return t=y.apply(null,e),t}),...h);return Object.assign(v,{resultFunc:a,memoizedResultFunc:y,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var Tt=jt(St),Nt=Object.assign(((e,t=Tt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>Nt});const It=Tt((({app:e})=>e),(({userHasResponded:e})=>e)),kt="visibility",Ot={hidden:"hidden",minimized:"minimized",open:"open",initialize:null},Lt=Tt((({config:e})=>e),(e=>{let t={visible:"inline"===e?.layoutMode?Ot.open:Ot.minimized,appContainerClassNames:e?.appContainerClassNames||[],...e};return"function"==typeof t.appContainerClassNames&&(t={...t,appContainerClassNames:t.appContainerClassNames(t)}),t})),At=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:s,hideOnNoUserResponse:a}=r,{visible:i}=o||{};if("app"===s&&!t)return Ot.open;if("window"===s&&a&&n!==Ot.open)return e?n||t||Ot.open:Ot.hidden;if("inline"===s&&e&&!n)return t||Ot.open;const c=Ot.minimized;return n||t||i||c};var Rt=n(7402),Pt=n(8418);var Mt={notify(){},get:()=>[]};var Dt=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),Ut=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),Ft=(()=>Dt||Ut?Rt.useLayoutEffect:Rt.useEffect)();Object.defineProperty,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.prototype;var zt=Symbol.for("react-redux-context"),Bt="undefined"!=typeof globalThis?globalThis:{};function Vt(){if(!Rt.createContext)return{};const e=Bt[zt]??=new Map;let t=e.get(Rt.createContext);return t||(t=Rt.createContext(null),e.set(Rt.createContext,t)),t}var $t=Vt(),Ht=function(e){const{children:t,context:n,serverState:r,store:o}=e,s=Rt.useMemo((()=>{const e=function(e,t){let n,r=Mt,o=0,s=!1;function a(){l.onStateChange&&l.onStateChange()}function i(){o++,n||(n=t?t.addNestedSub(a):e.subscribe(a),r=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const o=t={callback:n,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){r&&null!==e&&(r=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}())}function c(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=Mt)}const l={addNestedSub:function(e){i();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:a,isSubscribed:function(){return s},trySubscribe:function(){s||(s=!0,i())},tryUnsubscribe:function(){s&&(s=!1,c())},getListeners:()=>r};return l}(o);return{store:o,subscription:e,getServerState:r?()=>r:void 0}}),[o,r]),a=Rt.useMemo((()=>o.getState()),[o]);Ft((()=>{const{subscription:e}=s;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),a!==o.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}}),[s,a]);const i=n||$t;return Rt.createElement(i.Provider,{value:s},t)};function Wt(e=$t){return function(){return Rt.useContext(e)}}var Gt=Wt();function qt(e=$t){const t=e===$t?Gt:Wt(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Kt=qt();function Jt(e=$t){const t=e===$t?Kt:qt(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Xt=Jt(),Yt=(e,t)=>e===t;function Qt(e=$t){const t=e===$t?Gt:Wt(e),n=(e,n={})=>{const{equalityFn:r=Yt}="function"==typeof n?{equalityFn:n}:n,o=t(),{store:s,subscription:a,getServerState:i}=o,c=(Rt.useRef(!0),Rt.useCallback({[e.name]:t=>e(t)}[e.name],[e])),l=(0,Pt.useSyncExternalStoreWithSelector)(a.addNestedSub,s.getState,i||s.getState,c,r);return Rt.useDebugValue(l),l};return Object.assign(n,{withTypes:()=>n}),n}var Zt=Qt();const en=()=>Zt(Lt);function tn(){const{startChatIcon:e}=en();return e}const nn=(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)}}},rn=e=>Math.ceil(e/1e3),on=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},sn=(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]}`},an={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},cn={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},ln=e=>e.code?cn[e.code]:an[e.keyCode],un=e=>{e&&e.focus()},dn=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function pn(e){return"object"==typeof e}const fn=({state:e})=>e,hn=()=>Zt(fn),mn=Tt(fn,Lt,It,(({events:e,serviceData:t},n,r)=>{if(r||"inline"===n.layoutMode||!t?.suggestion||!t?.suggestion?.body?.length)return e;const o={type:"service_data",payload:t.suggestion};return[...e,o]})),yn=Tt(mn,Lt,((e,t)=>{const{enabled:n,threshold:r}=t?.messages?.timeIndicator??{};return n?e.map((({type:e,payload:t},n,o)=>{if(0===n)return{type:e,payload:{...t,timeIndicator:t?.occurredAt}};const s=o[n-1];if(!t?.occurredAt||!s.payload?.occurredAt||!r)return{type:e,payload:{...t,timeIndicator:void 0}};const a=rn(t.occurredAt-s.payload.occurredAt)>=r?t.occurredAt:void 0;return{type:e,payload:{...t,timeIndicator:a}}})):e})),vn=()=>Zt(yn),gn=(Tt(yn,(e=>e.map((e=>e.payload.id)))),()=>hn().isLoading),bn=()=>hn().unreadEvents,xn=()=>hn().skiplinkTargetId,wn=()=>hn().serviceInfo,_n=Tt(yn,(e=>{const t=e.filter((e=>"message"===e.type));return t[t.length-1]?.payload.id})),Cn=()=>{const{participants:e,currentAgent:t}=hn().participantInfo;return t?e[t]:null},En=()=>{const{entryMeta:{options:e,optionsOverride:t}}=hn(),{limit:n}=t?.text||e?.text||{limit:null};return{hasLimit:null!==n,limit:null!==n?n:null}},Sn=()=>{const{layoutMode:e}=en();return{isInline:"inline"===e,isWindow:"window"===e,isApp:"app"===e,isResolving:!e}},jn=Tt((({visibility:e})=>e),(e=>e.visibility)),Tn=Tt((({visibility:e})=>e),(e=>e.showInlineView)),Nn=Tt((({visibility:e})=>e),(e=>e.setInputFocus)),In=[Ot.open,Ot.minimized,Ot.hidden],kn=ut("setVisibility",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),s=e.visibility,a=jn(o),i=It(o),c=n.hasConversation(),l=Lt(o),{visibilityCallback:u=At,layoutMode:d}=l,{unreadEvents:p}=fn(o),f=u({hasResponded:i,previousVisibility:a,requestedVisibility:s,config:l});if(f&&!In.includes(f))return console.error('The visibilityCallback function should return "open", "minimized" or "hidden".'),{visibility:null,setInputFocus:e.setInputFocus};if(a===f)return{visibility:null,setInputFocus:e.setInputFocus};const h=n.store.get(kt);return n.store.set(kt,{...h||{},[d]:s}),s&&r.emit("ui.visible",s,{visibility:s,hasConversation:c,hasResponded:i,unreadMessageCount:p}),{visibility:f,setInputFocus:e.setInputFocus}})),On=ut("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{const{layoutMode:o}=Lt(n()),s=r.store.get(kt)?.[o]||Ot.initialize;return t(kn({visibility:s})),s})),Ln=ut("initializeApp",(async(e,{extra:{api:t,config:n},rejectWithValue:r})=>{const o=n?.context?.contentLocale,s=n?.context?.userLocale;try{return t.hasConversation()?{initialState:await t.getConversationIntitialState(),contentLocale:o,userLocale:s,config:n}:(n?.context?.topic&&t.send("action",{type:A,body:{name:n.context.topic,fallbackMessage:n.context.topic}}),{initialState:void 0,contentLocale:o,userLocale:s,config:n})}catch(e){if(e instanceof w){const e=new w;return r({name:e.name,message:e.message,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})}const t=new xt;return r({name:t.name,message:t.message,langKey:t.langKey})}})),An=((e,t,n)=>{const{wait:r=300,maxWait:o=0,leading:s=!1}=n??{};let a,i=null,c=null;const l=()=>{c&&clearTimeout(c),c=void 0,a&&(a(!0),a=void 0)};return ut(e,t,{condition:()=>{const e=s&&!i;return i&&clearTimeout(i),i=setTimeout((()=>{l(),i=null}),r),!!e||(a&&(a(!1),a=void 0),o&&!c&&(c=setTimeout(l,o)),new Promise((e=>{a=e})))}})})("resetApp",(async(e,{dispatch:t,extra:{api:n}})=>{await n.disconnect(),n.clearStore(),t(_t()),await t(wt()),await t(Ln()),t(On())}),{wait:2e3,leading:!0}),Rn="cvco",Pn=50,Mn=300,Dn=["alwaysShowEntryLabel","hideOnNoUserResponse","connectWhenInView","showDisclaimer","showSuggestions","continueChat","preChat","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback","agentParticipant","userParticipant","startChatIcon","notificationAudioURL"],Un=(e,t)=>{const{messages:n,...r}=(o=t,Dn.reduce(((e,t)=>(t in o&&(e[t]=o[t]),e)),{}));var o;let s=e;return Object.keys(r).length>0&&(s={...s,...r}),n&&(s={...s,messages:{...s.messages,...n}}),s},Fn=yt({name:"config",initialState:{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}},alwaysShowEntryLabel:!1,api:{domain:"",key:"",secure:!0,sendEnvironment:!0},context:{},notificationAudioURL:void 0,hideOnNoUserResponse:!1,connectWhenInView:!0,showDisclaimer:!1,showSuggestions:!0,preChat:{enterDelay:1e3,exitAfter:4e3},continueChat:{enterDelay:0,exitAfter:2e3},customComponents:{},defaults:{visible:null},preChatEvents:[],parentElement:void 0,layoutMode:"window"},reducers:{setConfig:(e,{payload:t})=>Un(e,t),updateConfig:(e,{payload:t})=>Un(e,t),setPreChatEvents:(e,{payload:t})=>{e.preChatEvents=t}},extraReducers:e=>{e.addCase(_t.fulfilled,(e=>e)).addCase(wt.fulfilled,((e,{payload:{preChat:t,agentParticipant:n,userParticipant:r,startChatIcon:o,defaultContentLocale:s,defaultUserLocale:a}})=>{e.preChatEvents=t.map((e=>({type:"message",payload:e}))),e.context.contentLocale=s,e.context.userLocale=a,e.agentParticipant=n,e.userParticipant=r,e.startChatIcon=o||""}))}}),{setConfig:zn,updateConfig:Bn,setPreChatEvents:Vn}=Fn.actions,$n=Fn.reducer,Hn={userHasResponded:!1},Wn=yt({name:"app",initialState:Hn,reducers:{setHasResponded:(e,{payload:t})=>{e.userHasResponded=t}},extraReducers:e=>{e.addCase(An.pending,(()=>Hn)).addCase(Ln.fulfilled,((e,{payload:t})=>{t.initialState&&"userResponded"in t.initialState&&(e.userHasResponded=t.initialState.userResponded||!1)}))}}),{setHasResponded:Gn}=Wn.actions,qn=Wn.reducer;class Kn extends g{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}const Jn={SeamlyGeneralError:x,SeamlyConfigurationError:b,SeamlySessionExpiredError:w,SeamlyOfflineError:Kn,SeamlyUnauthorizedError:_,SeamlyUnavailableError:xt},Xn=Xe("catch-error",(e=>({payload:e}))),Yn={controls:{}},Qn={touched:!1},Zn={controls:Qn},er=yt({name:"forms",initialState:Zn,reducers:{registerForm:(e,{payload:{persistData:t,formId:n}})=>{const r=t?e[n]??{...Yn,persistData:t}:{...Yn,persistData:t};e[n]=r},deregisterForm:(e,{payload:{formId:t}})=>(e[t]?.persistData||delete e[t],e),registerControl:(e,{payload:{name:t,formId:n}})=>{e[n].controls={[t]:Qn}},deregisterControl:(e,{payload:{name:t,formId:n}})=>{const r=e[n];if(!r)return e;if(r.persistData)return e;const o={...r.controls};return delete o[t],{...e,[n]:{...r,controls:o}}},updateControlValue:(e,{payload:{formId:t,name:n,value:r}})=>{e[t]?.controls&&(e[t].controls[n].value=r)},updateControlTouched:(e,{payload:{formId:t,name:n,touched:r}})=>{e[t]?.controls[n]&&(e[t].controls[n].touched=r)}},extraReducers:e=>{e.addCase(An.pending,(()=>Zn))}}),{registerForm:tr,deregisterForm:nr,registerControl:rr,deregisterControl:or,updateControlValue:sr,updateControlTouched:ar}=er.actions,ir=er.reducer,cr=ut("setLocale",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{return{translations:await t.getTranslations(e),userLocale:e}}catch(e){return n(e)}}),{condition:(e,{getState:t})=>{const{i18n:{isLoading:n,userLocale:r}}=t();return e!==r&&!n}}),lr={translations:{"errors.configError.message":"We are sorry this happened, please retry at a later time.","errors.configError.srText":"A chat configuration error occurred. Our apologies, please retry at a later time.","errors.configError.title":"Chat configuration error.","errors.general.buttonText":"Restart chat","errors.general.message":"Do you want to start a new chat session?","errors.general.srText":"Something went wrong with the chat session. You can restart the chat.","errors.general.title":"Something went wrong","errors.seamlyOffline.message":"There might be a problem with your or our network connection. The chat session should resume as soon the connection is available again.","errors.seamlyOffline.srText":"The chat has connection issues. There might be a problem with your or our network connection. The chat session should resume as soon as the connection is available again.","errors.seamlyOffline.title":"Connection issues","errors.seamlyUnavailable.buttonText":"Try again","errors.seamlyUnavailable.message":"The server could not be reached. Try again in a little while.","errors.seamlyUnavailable.srText":"The chat server could not be reached. Try again in a little while.","errors.seamlyUnavailable.title":"Server unavailable"},isLoading:!1,initialLocale:void 0,userLocale:void 0},ur=yt({name:"app",initialState:lr,reducers:{setInitialLocale:(e,t)=>{e.initialLocale=t.payload},setTranslations:(e,{payload:t})=>{e.translations=t}},extraReducers:e=>{e.addCase(An.pending,(()=>lr)).addCase(wt.fulfilled,((e,{payload:t})=>{e.initialLocale=t.defaultUserLocale})).addCase(cr.pending,(e=>{e.isLoading=!0})).addCase(cr.rejected,(e=>{e.isLoading=!1})).addCase(cr.fulfilled,((e,{payload:t})=>{e.isLoading=!1,t?.translations&&(e.userLocale=t.userLocale,e.translations=Object.keys(t.translations).sort().reduce(((e,n)=>{if(!t.translations)return e;const r=t.translations[n];return e[n]=r,e}),{}))}))}}),{setInitialLocale:dr,setTranslations:pr}=ur.actions,fr=ur.reducer,hr=ut("getConversation",(async(e,{extra:{api:t},rejectWithValue:n})=>{try{const e=await t.getConversation();if(!e)throw new Error("No conversation found");return e}catch(e){return n({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError})}}),{condition(e,{getState:t}){const{state:{events:n}}=t(),r=n.at(-1);return r&&("lastEvent"in e?e?.lastEvent?.id:e?.body?.lastEvent?.id)!==r.payload.id}}),mr={error:void 0},yr=yt({name:"interrupt",initialState:mr,reducers:{setInterrupt:(e,t)=>{e.error=t.payload},clearInterrupt:()=>mr},extraReducers:e=>{e.addCase(wt.pending,(()=>mr)).addMatcher(rt(Ln.rejected,wt.rejected,cr.rejected,kn.rejected,On.rejected,hr.rejected),((e,{payload:t})=>{e.error=t}))}}),{setInterrupt:vr,clearInterrupt:gr}=yr.actions,br=yr.reducer,xr=["SeamlyGeneralError","SeamlyConfigurationError","SeamlySessionExpiredError","SeamlyOfflineError","SeamlyUnauthorizedError","SeamlyUnavailableError"];n(2577);const wr=({type:e,payload:t})=>"hidden"===document.visibilityState||e===E.message&&!t.fromClient||e===E.info&&t.type===S,_r=e=>e.sort((({payload:{occurredAt:e=0}},{payload:{occurredAt:t=0}})=>e-t)),Cr=(e,t)=>{if(!e)return{participants:{},currentAgent:""};const{participants:n}=e||{participants:{}},{id:r,avatar:o,name:s,introduction:a}=t.participant,i=n[r],c={...n,[r]:i?{...i,...o?{avatar:o}:{},...s?{name:s}:{},...a?{introduction:a}:{}}:t.participant};return{...e,participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r}},Er=(e,t)=>{if(!0===t?.payload?.fromClient)return e;const n="message"===t?.type?t?.payload.translatedEntry||t?.payload.entry:{options:void 0,type:void 0},{blockAutoEntrySwitch:r}=e,o=t?.payload?.actions||{},s=t?.payload?.translatedActions||{};if(!n)return{...e,actions:o,optionsOverride:{},translatedActions:s};const{type:a,options:i}=n||{};let c=e.active;return r||a===e.userSelected||(c=a),{...e,active:c,optionsOverride:{...a?{[a]:i}:{}},actions:o,translatedActions:s}},Sr={events:[],isLastEventFromClient:!1,initialState:{userResponded:!1,context:{contentLocale:"",translationActive:!1,userLocale:""}},unreadEvents:0,userHasResponded:!1,loadedImageEventIds:[],isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1,remaining:void 0,wasStopped:void 0,count:void 0,timer:void 0},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:"",proactiveMessages:!1},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:$(),optionsButtonId:$(),headerCollapseButtonId:$(),serviceData:{},options:{features:{webNotifications:{enabled:!1}},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],processingFileUploads:[],entryMeta:{default:j,optionsOverride:{},defaultEntry:j,active:j,userSelected:null,blockAutoEntrySwitch:!1,options:{},actions:{},translatedActions:{}},seamlyContainerElement:null},jr=yt({name:"store",initialState:Sr,reducers:{addEvent:(e,t)=>{const{type:n,payload:r}=t.payload,o=e.options.features.hasOwnProperty(B);let s={...e.options};if(o&&(n===E.message||n===E.participant)&&!r.fromClient){const e="message"===n?r.entry?.type:void 0;s={...s,features:{...s.features,uploads:{enabled:s.features.uploads?.enabled||!1,...s.features?.uploads||{},enabledFromEntry:e===T}}}}const a=wr(t.payload);if(!e.events.find((e=>e.payload.id===r.id))){if(!e.events.find((e=>"transactionId"in e.payload&&"transactionId"in r&&e.payload.transactionId===r.transactionId&&(!t.payload.type||e.type===t.payload.type)&&r.fromClient))){const i=Er(e.entryMeta,t.payload);e.entryMeta=o||i.active!==T?i:{...e.entryMeta},e.options=s,a&&(e.unreadEvents+=1,"service_data"!==n&&(t.payload.payload.messageStatus=r.fromClient?I:N)),t.payload.payload.key=$(),e.events.push(t.payload),e.events=_r(e.events)}r.fromClient&&(e.isLastEventFromClient=r.fromClient)}},updateEvent:(e,{payload:t})=>{const n=e.events.find((e=>"service_data"!==e.type&&"service_data"!==t.type&&e.payload.transactionId===t.payload.transactionId));n?(n.payload.id=t.payload.id,n.payload.occurredAt=t.payload.occurredAt):e.events.push(t),e.events=_r(e.events)},clearEvents:e=>{e.unreadEvents=0,e.loadedImageEventIds=[],e.events=[]},setEventsRead:(e,{payload:t})=>{e.unreadEvents=0,e.events.forEach((e=>(e.payload.id&&-1!==t.indexOf(e.payload.id)&&(e.payload={...e.payload,..."service_data"!==e.type&&e.payload.messageStatus===N&&{messageStatus:I}}),e)))},setLoadedImageEventIds:(e,{payload:t})=>{e.loadedImageEventIds.push(t)},setEvents:(e,{payload:{messages:t,unreadMessageCount:n,userResponded:r,participants:o,service:s,serviceData:a,ui:i}})=>{const c=((e,t)=>{const n=e.filter((e=>"message"===e.type&&!e.payload.optimisticallyInjected&&!t.some((t=>t.payload?.id===e.payload.id)))),r=t.filter((({type:e,payload:t})=>!("participant"===e&&!t?.participant?.introduction))).reverse();return _r([...r,...n])})(e.events,t),l=Object.fromEntries(Object.entries(o).map((([e,t])=>[t.id,t]))),u=t.find((e=>"participant"===e.type)),d=u?.payload?.participant?.id,{entry:p}=s?.settings||{},f=Er({...e.entryMeta,...p,active:p?.default||S,options:{...p?.options?p.options:{}}},c[c.length-1]);let h={...e.options.features};const m=t.find((e=>!e.payload.fromClient&&["message","participant"].includes(e.type))),y=h.hasOwnProperty(B);if(y&&"message"===m?.type){const e=m.payload.entry?.type||"";h={...h,uploads:{enabled:h.uploads?.enabled||!1,enabledFromEntry:e===T}}}e.unreadEvents=n,e.userHasResponded=r,e.events=c.filter((e=>"participant"!==e.type||!!e.payload.participant?.introduction)),e.participantInfo={...e.participantInfo,...d?Cr(e.participantInfo,{participant:l[d]}):{},participants:l},e.historyLoaded=!0,e.serviceInfo={...e.serviceInfo,proactiveMessages:s?.settings?.proactiveMessages?.enabled||!1,activeServiceSessionId:s?.sessionId},e.serviceData={...e.serviceData,...a},e.options={...e.options,features:h},e.entryMeta=y||f.active!==T?f:{...e.entryMeta},e.resumeConversationPrompt=i.resumeConversationPrompt||!1,d&&(e.headerTitles.subTitle=l[d]?.name)},setIsLoading:(e,{payload:t})=>{e.isLoading=t},initIdleDetachCountdown:(e,{payload:t})=>{const{delaySeconds:n,delayTime:r}=t;e.idleDetachCountdown={hasCountdown:!0,isActive:!0,wasStopped:!1,count:n,remaining:n,timer:r}},decrementIdleDetachCountdownCounter:e=>{const{idleDetachCountdown:t}=e,{remaining:n=0}=t,r=n-1;e.idleDetachCountdown.remaining=r,e.idleDetachCountdown.timer=on(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=Cr(e.participantInfo,{participant:t.participant,fromClient:t.fromClient})},setActiveService:(e,{payload:t})=>{e.serviceInfo.activeServiceSessionId!==t&&(e.serviceInfo.activeServiceSessionId=t)},setHeaderTitle:(e,{payload:t})=>{e.headerTitles.title=t},setHeaderSubTitle:(e,{payload:t})=>{e.headerTitles.subTitle=t},setInitialState:(e,{payload:t})=>{e.initialState=t,e.unreadEvents=Sr.unreadEvents},setServiceDataItem:(e,{payload:t})=>{e.serviceData[t.type]=t},setFeatures:(e,{payload:t})=>{t.features&&(e.options.features=t.features)},updateFeatures:(e,{payload:t})=>{Object.entries(t).forEach((([t,n])=>{e.options.features[t]=n}))},setFeatureEnabledState:(e,{payload:t})=>{e.options.features.hasOwnProperty(t.key)&&(e.options.features[t.key].enabled=t.enabled)},clearFeatures:e=>{e.options.features={webNotifications:e.options.features.webNotifications}},showOption:(e,{payload:t})=>{e.options.panelActive=!0,e.options.optionActive=t},hideOption:e=>{e.options.panelActive=!1,e.options.optionActive=""},setUserSelectedOptions:(e,{payload:t})=>{e.options.userSelectedOptions=t},setUserSelectedOption:(e,{payload:t})=>{const{option:n,value:r}=t;e.options.userSelectedOptions[n]=r},setBlockAutoEntrySwitch:(e,{payload:t})=>{e.entryMeta.blockAutoEntrySwitch=t},setServiceEntryMetadata:(e,{payload:t})=>{e.entryMeta.active=t.default,e.entryMeta.options=t.options||{},e.entryMeta.optionsOverride={},e.entryMeta.actions={},e.entryMeta.translatedActions={}},setActiveEntryType:(e,{payload:t})=>{e.entryMeta.active=t},setUserEntryType:(e,{payload:t})=>{e.entryMeta.userSelected=t},clearAbortTransaction:e=>{e.entryMeta.actions={}},registerUpload:(e,{payload:t})=>{e.currentUploads.push({id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle})},setUploadProgress:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}:e))},startProcessingImage:(e,{payload:t})=>{e.processingFileUploads.push(t)},doneProcessingImage:(e,{payload:t})=>{e.processingFileUploads=e.processingFileUploads.filter((e=>e!==t))},setUploadError:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t.fileId?{...e,error:t.errorText,progress:0,uploading:!1,uploadHandle:null}:e))},setUploadComplete:(e,{payload:t})=>{e.currentUploads=e.currentUploads.map((e=>e.id===t?{...e,complete:!0}:e))},clearAllUploads:e=>{e.currentUploads=[]},setSeamlyContainerElement:(e,{payload:t})=>{e.seamlyContainerElement=t},setProactiveMessages:(e,{payload:t})=>{e.serviceInfo.proactiveMessages=t}},extraReducers:e=>{e.addCase(An.pending,(()=>Sr)).addCase(Ln.pending,(e=>{e.isLoading=!0})).addCase(wt.fulfilled,((e,{payload:t})=>{e.headerTitles.subTitle=t.agentParticipant?.name||"",t.features&&(e.options.features=t.features)})).addCase(Ln.fulfilled,((e,{payload:t,type:n})=>{if(e.isLoading=!1,!t.initialState)return;e.initialState=t.initialState,"messages"in t.initialState&&jr.caseReducers.setEvents(e,{payload:t.initialState,type:n});const{initialState:{service:r}}=t;r?.settings?.entry?.options?.upload&&jr.caseReducers.setFeatureEnabledState(e,{payload:{key:B,enabled:r.settings.entry.options.upload.enabled||!1},type:n})})).addMatcher(rt(Mr,Dr),(e=>{e.isLastEventFromClient=!1}))}}),{addEvent:Tr,updateEvent:Nr,clearAllUploads:Ir,clearEvents:kr,clearFeatures:Or,clearIdleDetachCountdown:Lr,clearResumeConversationPrompt:Ar,decrementIdleDetachCountdownCounter:Rr,hideOption:Pr,initIdleDetachCountdown:Mr,initResumeConversationPrompt:Dr,registerUpload:Ur,setActiveEntryType:Fr,setActiveService:zr,setBlockAutoEntrySwitch:Br,setEventsRead:Vr,setFeatureEnabledState:$r,updateFeatures:Hr,setFeatures:Wr,setHeaderSubTitle:Gr,setHeaderTitle:qr,setEvents:Kr,setInitialState:Jr,setIsLoading:Xr,setLoadedImageEventIds:Yr,setParticipant:Qr,setSeamlyContainerElement:Zr,setServiceDataItem:eo,setServiceEntryMetadata:to,clearAbortTransaction:no,setUploadComplete:ro,setUploadError:oo,setUploadProgress:so,startProcessingImage:ao,doneProcessingImage:io,setUserEntryType:co,setUserSelectedOption:lo,setUserSelectedOptions:uo,showOption:po,stopIdleDetachCountdownCounter:fo,setProactiveMessages:ho}=jr.actions,mo=jr.reducer,yo=({dispatch:e})=>t=>n=>{const r=t(n);if(wt.fulfilled.match(n)&&n.payload.defaultUserLocale)return e(cr(n.payload.defaultUserLocale)),r;if(Ln.fulfilled.match(n))return n.payload.userLocale&&e(cr(n.payload.userLocale)),r;if(Tr.match(n)&&"info"===n.payload.type&&n.payload.payload.body&&"subtype"in n.payload.payload.body&&"new_translation"===n.payload.payload.body.subtype){const{body:t}=n.payload.payload;if(t.translationLocale&&t.translationEnabled)return e(cr(t.translationLocale)),r}return r},vo={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],containerId:ot(),translatedEventGroups:{},translationProposal:null},go=(e,t)=>{const n=[...e].reduce(((e,{payload:n,type:r},o,s)=>{if(e[t]&&n.id){if("info"===r&&"divider"===n?.type&&n?.body?.translationEnabled)return s.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=>"divider"===e.payload?.type)).map((e=>e.payload.id)).at(-1),groupId:r,eventIds:o}},bo=yt({name:"translation",initialState:vo,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}=go(t,n);e.lastGroupId=r},disableEventsTranslation:(e,{payload:{events:t,id:n}})=>{const{lastGroupId:r,groupId:o,eventIds:s}=go(t,n);e.lastGroupId=r,e.translatedEventGroups[o]=s},disableTranslationProposalPrompt:e=>{e.translationProposal=null},setTranslationProposalPrompt:(e,{payload:t})=>{e.translationProposal=t}},extraReducers:e=>{e.addCase(An.pending,(()=>vo)).addCase(wt.fulfilled,((e,{payload:t})=>{const n=t?.features?.translation;n?.languages&&(e.isAvailable=!0===n.enabled,e.languages=[...n.languages].sort(((e,n)=>e.locale===t.defaultUserLocale?-1:n.locale===t.defaultUserLocale?1:e.nativeName?.localeCompare(n.nativeName||"",void 0,{sensitivity:"base"})||0)))})).addCase(cr.fulfilled,((e,{payload:t})=>{e.currentLocale=t.userLocale})).addCase(Tr,((e,{payload:t})=>{t.payload.id&&e.lastGroupId&&e.translatedEventGroups[e.lastGroupId]&&e.translatedEventGroups[e.lastGroupId].push(t.payload.id)})).addCase(Kr,((e,{payload:t})=>{e.translationProposal=t?.ui?.translationProposal})).addCase(Ln.fulfilled,((e,{payload:t})=>{e.translationProposal=t.initialState?.ui?.translationProposal}))}}),{enableTranslation:xo,disableTranslation:wo,enableEventsTranslation:_o,disableEventsTranslation:Co,setTranslationProposalPrompt:Eo,disableTranslationProposalPrompt:So}=bo.actions,jo=bo.reducer,To=yt({name:"visibility",initialState:{visibility:Ot.initialize,showInlineView:!1,setInputFocus:!1},reducers:{setShowInlineView:e=>{e.showInlineView=!0}},extraReducers:e=>{e.addCase(kn.fulfilled,((e,{payload:{visibility:t,setInputFocus:n}})=>{t&&(e.visibility=t,e.setInputFocus=Boolean(n))})).addCase(wt.fulfilled,((e,{payload:t})=>{t.connectWhenInView||(e.showInlineView=!t.connectWhenInView)}))}}),{setShowInlineView:No}=To.actions,Io=To.reducer,ko=ee({state:mo,app:qn,config:$n,i18n:fr,translations:jo,visibility:Io,forms:ir,interrupt:br});const Oo=Xt;var Lo=n(1162);function Ao(e=""){const t=e=>/\s/.test(e),n=[],r={};let o=0,s=null,a=!1,i=0;for(;i<e.length;){if(a&&(t(e[i])||"{"===e[i]))a=!1,s=e.slice(o,i),"{"===e[i]&&i--;else if(!a&&!t(e[i])){const t="{"===e[i];if(s&&t){const t=Ro(e,i);if(-1===t)throw new Error(`Unbalanced curly braces in string: "${e}"`);r[s]=e.slice(i+1,t),i=t,s=null}else s&&(n.push(s),s=null),a=!0,o=i}i++}return a&&(s=e.slice(o)),s&&n.push(s),{args:n,cases:r}}function Ro(e,t){let n=0;for(let r=t+1;r<e.length;r++){let t=e.charAt(r);if("}"===t){if(0===n)return r;n--}else"{"===t&&n++}return-1}function Po(e){return Mo(e.slice(1,-1),",",3)}function Mo(e,t,n,r=[]){if(!e)return r;if(1===n)return r.push(e),r;let o=e.indexOf(t);if(-1===o)return r.push(e),r;let s=e.substring(0,o).trim(),a=e.substring(o+t.length+1).trim();return r.push(s),Mo(a,t,n-1,r)}let Do,Uo=0;const Fo="other";function zo(e,t){let n=0,r="",o=0;const s={};for(;n<e.length;){if("#"!==e[n]||o)r+=e[n];else{let e="__hashToken"+Uo++;r+=`{${e}, number}`,s[e]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:s}}const Bo="other",Vo=Tt((({i18n:e})=>e),(({translations:e})=>e)),$o=Tt((({i18n:e})=>e),(({initialLocale:e})=>e)),Ho=Tt((({i18n:e})=>e),(({userLocale:e})=>e)),Wo=Tt((({i18n:e})=>e),(({isLoading:e})=>e)),Go=new class{constructor(e,t={}){this.locale=e,this.typeHandlers=t}format=function(e){const t={};return function(...n){let r=n.length?n.map((e=>null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e))).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,r))return t[r];let o=e(...n);return t[r]=o,o}}(((e,t={})=>this.process(e,t).flat(1/0).join("")));process(e,t={}){if(!e)return[];let n=e.indexOf("{");if(-1!==n){let r=Ro(e,n);if(-1===r)throw new Error(`Unbalanced curly braces in string: "${e}"`);{let o=e.substring(n,r+1);if(o){let s=[],a=e.substring(0,n);a&&s.push(a);let[i,c,l]=Po(o),u=t[i];null==u&&(u="");let d=c&&this.typeHandlers[c];s.push(d?d(u,l,this.locale,t,this.process.bind(this)):u);let p=e.substring(r+1);return p&&s.push(this.process(p,t)),s}}}return[e]}}("en-GB",{plural:function(e,t,n,r,o){const{args:s,cases:a}=Ao(t);let i=parseInt(e);s.forEach((e=>{e.startsWith("offset:")&&(i-=parseInt(e.slice(7)))}));const c=[];if("PluralRules"in Intl){void 0!==Do&&Do.resolvedOptions().locale===n||(Do=new Intl.PluralRules(n));const e=Do.select(i);e!==Fo&&c.push(e)}1===i&&c.push("one"),c.push(`=${i}`,Fo);for(let e=0;e<c.length;e++){const t=c[e];if(t in a){const{caseBody:e,numberValues:n}=zo(a[t],i);return o(e,{...r,...n})}}return e},select:function(e,t,n,r,o){const{cases:s}=Ao(t);return e in s?o(s[e],r):Bo in s?o(s[Bo],r):e}});function qo(){const e=Zt(Vo),t=Zt(Ho),n=Zt($o),r=Zt(Wo);return{t:(0,Lo.useCallback)(((n,o={})=>{if(!e)return"";const s=e[n];return s?Go.format(s,o):(r||console.warn(`Translation key: ${n} is missing in locale: ${t}`),"")}),[e,t,r]),userLocale:t,initialLocale:n}}const Ko=()=>{const e=Oo(),t=Zt(jn),n=Zt(Nn),r=!!t&&t!==Ot.hidden,o=t===Ot.open,s=t===Ot.minimized,a=(0,Lo.useCallback)((t=>{e(kn("string"==typeof t||null===t?{visibility:t,setInputFocus:!1}:t))}),[e]);return{isVisible:r,isOpen:o,isMinimized:s,visible:t,setVisibility:a,openChat:()=>{a({visibility:Ot.open})},closeChat:()=>{a({visibility:Ot.minimized})},setInputFocus:n}},Jo=({freezeOnceVisible:e=!1,enabled:t=!0,containerRef:n=(0,o.createRef)()})=>{const[r,s]=(0,Lo.useState)(null),a=!!r?.isIntersecting||!t,i=a&&e,c=([e])=>s(e);return(0,Lo.useEffect)((()=>{const e=n?.current;if(!window.IntersectionObserver||i||!e||!t)return()=>{};const r=new IntersectionObserver(c,{threshold:0,root:null,rootMargin:"0%"});return r.observe(e),()=>r.disconnect()}),[n,t,i]),{isVisible:a,containerRef:n}},Xo=()=>Zt(It),Yo=(0,o.createContext)(null),Qo=(0,o.createContext)(null),Zo=()=>{const e=(0,Lo.useContext)(Qo);if(!e)throw new Error("useSeamlyEventBusContext has to be used within <SeamlyEventBusContext.Provider>");return e},es=()=>{const e=(0,Lo.useContext)(Yo);if(!e)throw new Error("useSeamlyApiContext has to be used within <SeamlyApiContext.Provider>");return e},ts=()=>es().store,ns=()=>{const e=es();return(0,Lo.useCallback)((()=>e.hasConversation()),[e])},rs=()=>{const e=es(),t=Oo(),n=Zo(),r=Xo(),o=ns(),{visible:s,setVisibility:a}=Ko(),i=bn(),c=(0,Lo.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=(0,Lo.useCallback)((()=>{c("ui.beforeStart",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:i}),e.send("start_conversation"),c("ui.start",{visibility:s,hasConversation:o(),hasResponded:r,unreadMessageCount:i})}),[e,c,o,r,i,s]),u=(0,Lo.useCallback)((async()=>{await t(An())}),[t]),d=(0,Lo.useCallback)((e=>({type:e,id:$(),transactionId:$(),fromClient:!0,participant:"seamly-client-participant",occurredAt:1e3*Date.now()})),[]),p=(0,Lo.useCallback)((e=>({...d("text"),body:{text:e}})),[d]),f=(0,Lo.useCallback)((({body:n,config:r={}})=>{if(""===n.trim())return;const o={...p(n),...r};e.send("message",o),c("message",o),t(Tr({type:"message",payload:{...o,body:o.body,type:o.type,optimisticallyInjected:!0}}))}),[e,t,c,p]),h=(0,Lo.useCallback)(((e,n=$())=>{t(Tr({type:"message",payload:{...p(e),transactionId:n}}))}),[t,p]),m=(0,Lo.useCallback)(((e,n,r,o,s,a)=>{t(Tr({type:"message",payload:{type:"upload",id:e,transactionId:n,fromClient:!0,participant:"seamly-client-participant",occurredAt:r,body:{contentType:o,filename:s,filesize:a,id:e||"",isDeleted:!1}}}))}),[t]),y=(0,Lo.useCallback)((t=>{t&&e.send("action",t)}),[e]),v=(0,Lo.useCallback)((t=>{e.sendContext(t)}),[e]),g=(0,Lo.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&(t(Jr(e)),e.messages&&e.messages.length&&t(Kr(e)),e.userResponded&&(t(Gn(e.userResponded)),a({visibility:Ot.open})))})).catch((e=>{t(vr({name:e?.name,message:e?.message,langKey:e?.langKey,action:e?.action,originalEvent:e?.originalEvent,originalError:e?.originalError}))}))),[e,t,a]);return{connect:g,start:l,sendMessage:f,sendAction:y,sendContext:v,reset:u,emitEvent:c,addMessageBubble:h,addUploadBubble:m,apiConnected:e.connected,apiConfigReady:e.configReady}},os=(0,o.createContext)(null),ss=()=>{const e=(()=>{const e=(0,Lo.useContext)(os);if(!e)throw new Error("useSeamlyLiveRegionContext has to be used within <SeamlyLiveRegionContext.Provider>");return e})();return{sendPolite:(0,Lo.useCallback)((t=>{t&&e({ariaLive:F,messageText:t})}),[e]),sendAssertive:(0,Lo.useCallback)((t=>{t&&e({ariaLive:U,messageText:t})}),[e])}},as=Tt((({interrupt:e})=>e),(({error:e})=>e)),is=Tt(as,(e=>Boolean(e)));function cs(){const{t:e}=qo(),t=Zt(as);return{hasError:Zt(is),meta:(0,Lo.useMemo)((()=>{if(!t)return{title:void 0,message:void 0,srText:void 0,buttonText:void 0,originalError:void 0,action:void 0};const{langKey:n,action:r}=t,o=e(`${n}.title`),s=e(`${n}.message`),a=e(`${n}.srText`),i=r?e(`${n}.buttonText`):null;return{...n?{title:o,message:s,srText:a}:{},...r?{action:r}:{},...r&&n?{buttonText:i}:{},originalError:t}}),[t,e]),error:t}}const ls=()=>{const{t:e}=qo(),{isInline:t,isWindow:n,isApp:r}=Sn(),{isOpen:o,isVisible:s}=Ko(),a=Zt(Tn),{start:i,connect:c,apiConfigReady:l,apiConnected:u}=rs(),d=(0,Lo.useRef)(!1),{sendAssertive:p}=ss();!function(){const{meta:{originalError:e,action:t}}=cs(),n=Oo(),{reset:r}=rs(),o="SeamlySessionExpiredError"===e?.name,s=(0,Lo.useRef)(0),a=(0,Lo.useRef)(null);(0,Lo.useEffect)((()=>{if(o&&"reset"===t){if(s.current>=10){a.current=setTimeout((()=>{s.current=0}),1e4);const e=new x;return n(vr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),()=>{}}s.current+=1,r()}return()=>{a.current&&clearTimeout(a.current)}}),[t,r,o,n])}(),(0,Lo.useEffect)((()=>{s&&setTimeout((()=>{p(e("window.srTexts.onLoad"))}),500)}),[s,p,e]),(0,Lo.useEffect)((()=>{s&&p(e(o?"window.srTexts.onOpen":"window.srTexts.onClose"))}),[o,s,p,e]),(0,Lo.useEffect)((()=>{l||u||(d.current=!1)}),[l,u]);const f=(0,Lo.useCallback)((async()=>{u||(d.current=!0,await c()),(r||o||s&&t)&&i()}),[u,c,r,t,o,s,i]);(0,Lo.useEffect)((()=>{!l||d.current||n&&!o||!(!t||s&&a)||f()}),[l,f,t,o,s,n,a])},us=require("preact/compat"),ds=require("preact/jsx-runtime"),ps=({children:e})=>(ls(),(0,ds.jsx)(ds.Fragment,{children:e})),fs=(0,o.createContext)(null),hs=(e=0)=>new Promise((t=>{setTimeout(t,e)})),ms=()=>{const{seamlyContainerElement:e}=hn(),t=Oo();return[e,(0,Lo.useCallback)((e=>{t(Zr(e))}),[t])]},ys=e=>(0,Lo.useCallback)((()=>{var t;t=e,requestAnimationFrame((async()=>{await hs(180);const e="string"==typeof t?document.getElementById(t):t;un(e)}))}),[e]),vs=()=>{const e=xn();return ys(e)};n(3215);const gs=e=>Tt((e=>e.translations.translatedEventGroups),(t=>Object.values(t).every((t=>e?.payload?.id&&!t.includes(e.payload.id)))));function bs(){const{sendContext:e}=rs(),t=Oo(),n=en(),r=(0,Lo.useCallback)(((t,n)=>{e({userLocale:t,source:n})}),[e]),o=(0,Lo.useCallback)((()=>{e({userLocale:n.context?.contentLocale}),t(wo())}),[n.context?.contentLocale,t,e]),{languages:s,isActive:a,isAvailable:i,currentLocale:c}=Zt((({translations:e})=>e));return{languages:s,isActive:a,isAvailable:i,currentLocale:c,enableTranslations:r,disableTranslations:o}}const xs=e=>{const t=Zt(gs(e));if(!e?.payload)return{body:void 0,hasTranslation:!1,isTranslated:!1,locale:""};const n=e.payload?.translatedBody&&"data"in e.payload.translatedBody?e.payload?.translatedBody.data:e.payload.translatedBody,{translation:r,body:o}={body:e.payload?.body,translation:e.payload?.translation},s=!!n;return{body:t&&s?n:o,hasTranslation:s,isTranslated:t&&s,locale:r?.locale}};function ws(){const e=Zt((({translations:e})=>e.containerId));return{id:e,focusContainer:ys(e)}}function _s(e){const{languages:t}=bs();return(0,Lo.useMemo)((()=>t?.find((t=>t.locale===e))?.nativeName),[e,t])}const Cs=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e?.split(" "))).flat().filter((e=>e&&e.length)).map((e=>e&&e.indexOf(Rn)>-1?e:[Rn,e].join("-"))).join(" "),Es=()=>en().appContainerClassNames,Ss=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},js=()=>{const e=es();return(0,us.useSyncExternalStore)(y.subscribe,(()=>e.conversation))},Ts=(0,o.createContext)(null),Ns=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=hn(),{allowedMimeTypes:o,maxSize:s}=n?.upload||{},{enabled:a,enabledFromEntry:i}=r||{},{allowedMimeTypes:c,maxSize:l}={...t.upload||{allowedMimeTypes:[],maxSize:0},...o?{allowedMimeTypes:o}:{},...s?{maxSize:s}:{}};return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:i||a,allowedMimeTypes:c,maxSize:l}},Is=()=>{const{currentUploads:e}=hn(),t=Oo(),n=(()=>{const e=(0,Lo.useContext)(Ts);if(!e)throw new Error("useSeamlyFileUploadContext has to be used within <SeamlyFileUploadContext.Provider>");return e})();return{uploadFile:(0,Lo.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,Lo.useCallback)((()=>{t(Ir())}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},ks=()=>{const{t:e}=qo(),{options:t}=hn(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:s}=t,{extraMenuItem:a,sendTranscript:i}=s,c={extraMenuItem:a,sendTranscript:i},l=t=>"extraMenuItem"===t?"Extra menu item":e(`options.${t}.menuTitle`),u=Object.keys(c).filter((e=>c[e])).map((e=>({name:e,title:l(e),available:c[e].enabled}))),d=a||i,p=Oo(),{get:f,set:h}=ts();return{allowOptionSelection:d,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,Lo.useCallback)((()=>{const e=f("options")||{};p(uo(e))}),[f,p]),setUserSelectedOptions:(0,Lo.useCallback)((e=>{p(uo(e)),h("options",e)}),[h,p]),setUserSelectedOption:(0,Lo.useCallback)(((e,t)=>{const n=f("options")||{};"object"==typeof n&&h("options",{...n,[e]:t}),p(lo({option:e,value:t}))}),[p,f,h]),showOption:e=>{p(po(e))},hideOption:()=>{p(Pr())},panelActive:n,optionActive:r}},Os=()=>{const{optionsButtonId:e}=hn();return{id:e,focusButton:ys(e)}},Ls=(0,o.createContext)(null),As=()=>{const e=(0,Lo.useContext)(Ls);if(!e)throw new Error("useSeamlyActivityEventHandler has to be used within <SeamlyActivityEventContext.Provider>");return e},Rs=()=>{const e=Oo(),{idleDetachCountdown:{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:a}}=hn(),{isOpen:i}=Ko(),{emitEvent:c,sendAction:l}=rs(),{t:u}=qo(),{sendAssertive:d,sendPolite:p}=ss(),f=(0,Lo.useCallback)((e=>{i&&d(e)}),[i,d]),h=(0,Lo.useCallback)((e=>{i&&p(e)}),[i,p]),m=(0,Lo.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=on(n);e(Mr({delaySeconds:n,delayTime:r})),c("idleTimer.start"),f(`${u("idleDetachWarning.countdownTitle")} ${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",r)}`)}),[e,c,f,u]),y=(0,Lo.useCallback)(((n=void 0,r=!1)=>{t&&(n||(r||l({type:O}),f(u("idleDetachWarning.notifyTransferText"))),a||c("idleTimer.stop"),e(Lr()))}),[e,c,t,l,f,u,a]),v=(0,Lo.useCallback)((()=>{if(!o||o<=0)return;const t=o-1;t%10==0&&f(`${u("idleDetachWarning.countdownText")} ${u("idleDetachWarning.countdownTimer",on(t))}`),e(Rr())}),[e,o,f,u]),g=(0,Lo.useCallback)((()=>{n&&(e(fo()),o&&(c("idleTimer.stop"),h(u("idleDetachWarning.srCountDownStoppedText"))))}),[e,c,n,o,h,u]);return{hasCountdown:t,isActive:n,count:r,remaining:o,timer:s,wasStopped:a,initCountdown:m,endCountdown:y,decrementCountdown:v,stopCountdown:g}},Ps=()=>{const e=Oo(),t=hn().resumeConversationPrompt,{sendAction:n}=rs(),{t:r}=qo(),{sendAssertive:o}=ss();return{continueChat:()=>{n({type:L,body:{type:"resume_conversation_prompt"}}),e(Ar())},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:O}),e(Ar())}}},Ms=()=>{const[e]=(0,Lo.useState)((()=>$()));return e},Ds=(e,t)=>{const n=js();(0,Lo.useEffect)((()=>{n.onMessage(((n,r)=>(t&&!t({type:n,payload:r})||e({type:n,payload:r}),r)))}),[e,t,n])},Us=({eventPayload:e})=>{const{t}=qo(),{fromClient:n,participant:r}=e,o=(e=>hn().participantInfo.participants[e])(r)||{},{messages:s}=en(),a=n?t("participants.user.name"):o&&o.name,{showAvatar:i,showName:c}=s&&s[n?"user":"agent"]||{};if(!i&&!c)return null;const l=[];return i&&a&&o.avatar&&l.push((0,ds.jsx)("span",{className:Cs("message__avatar"),children:(0,ds.jsx)("img",{src:o.avatar,className:Cs("avatar"),alt:""})})),c&&a&&l.push((0,ds.jsx)("span",{className:Cs("message__author-name"),children:a})),l.length>0?(0,ds.jsx)("div",{className:Cs("message__author"),children:l}):null},Fs=({showParticipant:e=!0,event:t,type:n,modifiers:r,children:o,bodyProps:s={},info:a,...i})=>{const c=Ss(t),{hasTranslation:l,isTranslated:u,locale:d}=xs(t);return n&&c.push(`message--type-${n}`),r&&("string"==typeof r&&(r=r.split(" ").filter((e=>e.length))),r.forEach((e=>{c.push(`message--${e}`)}))),u&&c.push("message--is-translated"),l&&c.push("message--has-translation"),u&&(s={...s,lang:d}),(0,ds.jsx)(ds.Fragment,{children:(0,ds.jsxs)("div",{className:Cs(c),...i,children:[e&&(0,ds.jsx)(Us,{eventPayload:t.payload}),(0,ds.jsx)("div",{className:Cs("message__body"),...s,children:o}),a&&(0,ds.jsx)("div",{"aria-hidden":"true",className:Cs("message__info"),children:a})]})})},zs=({id:e,action:t,buttonText:n,description:r,hasFocus:o,image:s,title:a,isCarouselItem:i})=>{const c=(0,Lo.useRef)(null),{sendMessage:l,sendAction:u,emitEvent:d}=rs(),p=Ms(),f=(0,Lo.useRef)(!1),h=t?.type===V?"a":"button",m=(0,Lo.useCallback)((()=>d("action.click_card",{type:R,originMessage:e,action:t})),[d,e,t]),y=(0,Lo.useCallback)((()=>{if(m(),"ask"===t?.type)l({body:t?.ask});else if("topic"===t?.type){const{topic:e,fallbackMessage:n}=t;u({type:A,body:{name:e,fallbackMessage:n}})}}),[l,t,u,m]),v=(0,Lo.useMemo)((()=>t?.type===V?{href:t?.link,rel:"noopener noreferrer",target:t?.newTab?"_blank":"_self",onClick:m}:{onClick:y}),[t,y,m]);return(0,Lo.useEffect)((()=>{i&&(o&&f.current?window.requestAnimationFrame((()=>c.current?.focus())):c.current?.blur()),f.current=!0}),[o,i]),(0,ds.jsxs)("div",{className:Cs("card__wrapper"),id:e,tabIndex:-1,ref:c,children:[s?(0,ds.jsx)("img",{className:Cs("card__image"),src:s,alt:""}):null,(0,ds.jsxs)("div",{className:Cs("card__content"),id:e,children:[a&&(0,ds.jsx)("h2",{className:Cs("card__title"),children:a}),r&&(0,ds.jsx)("div",{className:Cs("card__description"),dangerouslySetInnerHTML:{__html:r}}),(0,ds.jsx)(h,{tabIndex:i&&!o?-1:void 0,className:Cs("button","button--primary"),"aria-describedby":p,...v,children:n})]})]})};function Bs({item:e,items:t,index:n,isActive:r}){const{t:o}=qo();return(0,ds.jsx)("div",{className:Cs("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:n+1,total:t.length}),children:(0,ds.jsx)(zs,{...e,isCarouselItem:!0,hasFocus:r})})}const Vs={send:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>'},balloon:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>'},newTopic:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>'},newTranslation:{16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>'},avatar:{32:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">\n<path fill="#4A48C1" d="M10,14.8c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S11.1,14.8,10,14.8z M15.9,14.8c1.1,0,2-0.9,2-2s-0.9-2-2-2\n\ts-2,0.9-2,2S14.8,14.8,15.9,14.8z M21.8,10.8c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S22.9,10.8,21.8,10.8z M21.3,18.1H10.7\n\tC11.7,23.9,20.2,23.9,21.3,18.1z"/>\n</svg>\n'},chevronDown:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>'},chevronRight:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>'},close:{8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>'},enlarge:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>'},options:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>'},file:{32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>'},upload:{32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>'},download:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>'},error:{16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>'},arrowLeft:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n'},arrowRight:{16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},check:{16:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="16px"\n height="16px"\n x="0px"\n y="0px"\n viewBox="0 0 16 16"\n>\n <path\n fill="currentColor"\n d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8\n\tc0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"\n />\n</svg>\n',32:'<svg\n xmlns="http://www.w3.org/2000/svg"\n width="32px"\n height="32px"\n x="0px"\n y="0px"\n viewBox="0 0 32 32"\n>\n <path\n fill="currentColor"\n d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6\n\tc0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"\n />\n</svg>\n'}},$s=({name:e,size:t="32",className:n,alt:r})=>(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("div",{"aria-hidden":"true",className:n||Cs("icon"),dangerouslySetInnerHTML:{__html:Vs[e][t]}}),r&&(0,ds.jsx)("span",{className:Cs("visually-hidden"),children:r})]});function Hs({items:e,currentIndex:t,onChange:n,children:r}){const{t:o}=qo(),s=e.length;return(0,ds.jsxs)("div",{className:Cs("carousel-controls"),children:[(0,ds.jsx)("button",{className:Cs("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{n((t-1+s)%s)},children:(0,ds.jsx)($s,{name:"arrowLeft",size:"16",alt:""})}),r,(0,ds.jsx)("button",{className:Cs("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{n((t+1)%s)},children:(0,ds.jsx)($s,{name:"arrowRight",size:"16",alt:""})})]})}function Ws({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:o}){const s=e.length,a=(0,Lo.useCallback)((e=>{const r=Number(e.target.dataset.item||"0"),o=Math.min(s-1,Math.max(0,r));o!==t&&n(o)}),[s,t,n]);return(0,ds.jsx)("div",{className:Cs("carousel-pagination__wrapper"),role:"group",children:(0,ds.jsx)("ul",{className:Cs("carousel-pagination"),children:e.map(((e,n)=>{const s=t===n;return(0,ds.jsx)("li",{className:Cs("carousel-pagination__item",s?"is-active":void 0),children:(0,ds.jsx)("button",{className:Cs("carousel-pagination__button"),type:"button",onClick:a,"data-item":n,"aria-disabled":s?"true":void 0,"aria-label":o(e,n)})},r(e,n,"pagination-item-"))}))})})}const Gs=(e,t,n)=>`${n}${t}`,qs=e=>e.label,Ks=({target:e})=>{e.scrollLeft=0};function Js({currentIndex:e=0,onChange:t=()=>{},getItemKey:n=Gs,getItemLabel:r=qs,items:s}){const a=Ms(),i=s.length,[c,l]=(0,Lo.useState)(Number(e||0));(0,Lo.useEffect)((()=>{l(Number(e||0))}),[l,e]);const u=(0,Lo.useRef)([]);u.current=(0,Lo.useMemo)((()=>Array(i).fill(1).map((()=>(0,o.createRef)()))),[i]);const d=(0,Lo.useRef)(!0),p=(0,Lo.useRef)(null);return p.current=t,(0,Lo.useEffect)((()=>{d.current?d.current=!1:p.current&&p.current(c)}),[c]),(0,ds.jsxs)("div",{className:Cs("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,ds.jsx)("div",{className:Cs("carousel__slides-wrapper"),onScroll:Ks,children:(0,ds.jsx)("div",{id:a,className:Cs("carousel__slides"),style:{width:100*i+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const r=c===t;return(0,ds.jsx)("div",{ref:u.current[t],className:Cs("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,ds.jsx)(Bs,{item:e,items:s,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,ds.jsx)("div",{className:Cs("carousel__controls"),children:(0,ds.jsx)(Hs,{currentIndex:c,items:s,onChange:l,children:(0,ds.jsx)("div",{className:Cs("carousel__pagination"),children:(0,ds.jsx)(Ws,{currentIndex:c,items:s,onChange:l,getItemKey:n,getItemLabel:r})})})})]})}const Xs=(e,t,n="")=>`${n}${e.title}:${t}`,Ys=e=>e.title,Qs=e=>{const{payload:t}=e,[n,r]=(0,Lo.useState)(!1),{addMessageBubble:o,emitEvent:s,sendAction:a}=rs(),i=ns(),{activeServiceSessionId:c}=wn(),l=Zt(_n),{body:u}=xs(e),{service:d}=t,p=(0,Lo.useMemo)((()=>{if("choice_prompt"===e.payload.type)return{...e,payload:{...e.payload,body:e.payload.body?.prompt,translatedBody:e.payload.translatedBody&&{...e.payload.translatedBody,data:e.payload.translatedBody?.prompt}}}}),[e]),f=u?.chooseAgain&&c===d?.serviceSessionId&&t.id!==l;return(0,Lo.useEffect)((()=>{r(t.id===l)}),[t,l]),{body:u,subEvent:p,showOptions:n,chooseAgain:f,onChoiceClickHandler:e=>{if(!i())return;const n=$(),c={type:"pick_choice",originMessage:t.id,choice:{chooseAgain:f,id:e.id},transactionId:n};o(e.text,n),a(c),r(!1),s(`action.${c.type}`,{...c,choice:{...c.choice,text:e.text}})},onChooseAgainClickHandler:()=>{r((e=>!e))}}},Zs=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,ea=({id:e,categories:t=[],question:n,onClick:r,hasIcon:o})=>{const s=(0,Lo.useMemo)((()=>["suggestions__item",...t.map(Zs)]),[t]),a=(0,Lo.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,ds.jsx)("li",{className:Cs(s),children:(0,ds.jsxs)("button",{type:"button",onClick:a,className:Cs("button","button--primary"),children:[o&&(0,ds.jsx)($s,{name:"chevronRight",size:"8",alt:""}),n]})})},ta=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r=!0})=>(0,ds.jsx)("ul",{className:Cs("suggestions__list",e||""),children:t.map((e=>(0,ds.jsx)(ea,{hasIcon:r,onClick:n,categories:e.categories,id:e.id,question:e.question},e.id)))}),na=({originMessage:e,transactionId:t})=>{const{emitEvent:n,sendAction:r}=rs();return o=>{if(o.target&&o.target.dataset.linkId){const s={type:"navigate",originMessage:e,transactionId:t,link:{id:o.target.dataset.linkId,url:o.target.getAttribute("href")}};r(s),n(`action.${s.type}`,s)}}},ra=({children:e,className:t,graphicSrc:n,graphicType:r="icon",iconName:o,iconSize:s,iconClassName:a,dividerType:i,title:c,description:l})=>{const u=Boolean(o||n);return(0,ds.jsxs)("div",{className:Cs("divider",i&&`divider--type-${i}`,t),children:[u&&(0,ds.jsx)("span",{className:Cs("divider__graphic"),children:o?(0,ds.jsx)($s,{name:o,size:s,className:a,alt:""}):(0,ds.jsx)("img",{src:n||void 0,className:Cs({icon:"icon"===r,avatar:"avatar"===r},a)})}),(0,ds.jsxs)("div",{className:Cs("divider__body"),children:[c?(0,ds.jsx)("h2",{className:Cs("divider__title"),dangerouslySetInnerHTML:{__html:c}}):null,l?(0,ds.jsx)("p",{className:Cs("divider__description"),dangerouslySetInnerHTML:{__html:l}}):null,e]})]})},oa={[z.new_topic]:"new-topic"},sa={default:({event:e})=>{const{t}=qo(),{subtype:n}=e.payload.body,r=oa[z[n]];return z[n]?(0,ds.jsx)(ra,{dividerType:r,iconName:z[n],title:t(`dividerKeys.${z[n]}`)}):null},[z.new_translation]:({event:e})=>{const{t}=qo(),n=vn(),{body:{translationEnabled:r,text:o,title:s},id:a}=e.payload,i=Zt((e=>e.translations.translatedEventGroups)),c=Oo(),l=(0,Lo.useCallback)((()=>{i[a]?c(_o({events:n,id:a})):c(Co({events:n,id:a}))}),[c,n,a,i]);return(0,ds.jsx)(ra,{iconName:"newTranslation",dividerType:"new-translation",title:s,description:o,children:r?(0,ds.jsx)(ds.Fragment,{children:(0,ds.jsx)("button",{className:Cs("button","button--secondary"),onClick:l,children:t(i[a]?"translations.toggle.showTranslationsButtonText":"translations.toggle.hideTranslationsButtonText")})}):null})}},aa={month:"long",day:"numeric",year:"numeric"},ia={hour:"numeric",minute:"numeric"},ca=({event:e})=>{const t=(()=>{const[e,t]=(0,Lo.useReducer)((e=>e+1),0);return(0,Lo.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:o,srText:s}=(e=>{const{t}=qo(),n=en(),r=n?.context?.userLocale??[],o=new Date(e),s=new Date,a=new Date(s);a.setHours(24,0,0,0);const i=a.valueOf()-s.valueOf(),c=o.toString(),l=new Intl.DateTimeFormat(r,ia).format(o);let u=((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})(o,s);switch(u){case"today":u=t("dateTime.today");break;case"yesterday":u=t("dateTime.yesterday");break;default:u=new Intl.DateTimeFormat(r,aa).format(o)}return{date:u,srText:t("dateTime.srText",{date:u,time:l}),time:l,fullDateTime:c,timeUntilMidnight:i}})(rn(e.payload.timeIndicator));return(0,Lo.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,ds.jsxs)(ra,{dividerType:"time-indicator",children:[(0,ds.jsxs)("h2",{className:Cs("divider__time"),"aria-hidden":"true",children:[(0,ds.jsx)("span",{className:Cs("divider__time--date"),children:n}),(0,ds.jsx)("span",{className:Cs("divider__time--time"),children:r})]}),(0,ds.jsx)("p",{className:Cs("visually-hidden"),children:s})]})};var la=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ua=la.join(","),da="undefined"==typeof Element,pa=da?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,fa=!da&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},ha=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},ma=function(e,t,n){if(ha(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ua));return t&&pa.call(e,ua)&&r.unshift(e),r.filter(n)},ya=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var a=s.shift();if(!ha(a,!1))if("SLOT"===a.tagName){var i=a.assignedElements(),c=e(i.length?i:a.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:a,candidates:c})}else{pa.call(a,ua)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var l=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),u=!ha(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(l&&u){var d=e(!0===l?a.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:a,candidates:d})}else s.unshift.apply(s,a.children)}}return o},va=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ga=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!va(e)?0:e.tabIndex},ba=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},xa=function(e){return"INPUT"===e.tagName},wa=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},_a=function(e,t){return!(t.disabled||ha(t)||function(e){return xa(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=pa.call(e,"details>summary:first-of-type")?e.parentElement:e;if(pa.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return wa(e)}else{if("function"==typeof r){for(var s=e;e;){var a=e.parentElement,i=fa(e);if(a&&!a.shadowRoot&&!0===r(a))return wa(e);e=e.assignedSlot?e.assignedSlot:a||i===e.ownerDocument?a:i.host}e=s}if(function(e){var t,n,r,o,s=e&&fa(e),a=null===(t=s)||void 0===t?void 0:t.host,i=!1;if(s&&s!==e)for(i=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!i&&a;){var c,l,u;i=!(null===(l=a=null===(c=s=fa(a))||void 0===c?void 0:c.host)||void 0===l||null===(u=l.ownerDocument)||void 0===u||!u.contains(a))}return i}(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!!pa.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ca=function(e,t){return!(function(e){return function(e){return xa(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||fa(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)||ga(t)<0||!_a(e,t))},Ea=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Sa=function e(t){var n=[],r=[];return t.forEach((function(t,o){var s=!!t.scopeParent,a=s?t.scopeParent:t,i=function(e,t){var n=ga(e);return n<0&&t&&!va(e)?0:n}(a,s),c=s?e(t.candidates):a;0===i?s?n.push.apply(n,c):n.push(a):r.push({documentOrder:o,tabIndex:i,item:t,isScope:s,content:c})})),r.sort(ba).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ja=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==pa.call(e,ua)&&Ca(t,e)},Ta=la.concat("iframe").join(","),Na=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==pa.call(e,Ta)&&_a(t,e)};function Ia(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ka(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 La(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){ka(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}var Aa=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},Ra=function(e){return Aa(e)&&!e.shiftKey},Pa=function(e){return Aa(e)&&e.shiftKey},Ma=function(e){return setTimeout(e,0)},Da=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},Ua=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},Fa=[],za=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=(null==t?void 0:t.trapStack)||Fa,s=La({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ra,isKeyBackward:Pa},t),a={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},i=function(e,t,n){return e&&void 0!==e[t]?e[t]:s[n||t]},c=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return a.containerGroups.findIndex((function(t){var r=t.container,o=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||o.find((function(t){return t===e}))}))},l=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.hasFallback,a=void 0!==o&&o,i=n.params,c=void 0===i?[]:i,l=s[e];if("function"==typeof l&&(l=l.apply(void 0,function(e){if(Array.isArray(e))return Ia(e)}(t=c)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Ia(e,t);var n={}.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)?Ia(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),!0===l&&(l=void 0),!l){if(void 0===l||!1===l)return l;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var u=l;if("string"==typeof l){try{u=r.querySelector(l)}catch(t){throw new Error("`".concat(e,'` appears to be an invalid selector; error="').concat(t.message,'"'))}if(!u&&!a)throw new Error("`".concat(e,"` as selector refers to no known node"))}return u},u=function(){var e=l("initialFocus",{hasFallback:!0});if(!1===e)return!1;if(void 0===e||e&&!Na(e,s.tabbableOptions))if(c(r.activeElement)>=0)e=r.activeElement;else{var t=a.tabbableGroups[0];e=t&&t.firstTabbableNode||l("fallbackFocus")}else null===e&&(e=l("fallbackFocus"));if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(a.containerGroups=a.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?ya([e],t.includeContainer,{filter:Ca.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ea}):ma(e,t.includeContainer,Ca.bind(null,t)),Sa(n)}(e,s.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?ya([e],t.includeContainer,{filter:_a.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):ma(e,t.includeContainer,_a.bind(null,t))}(e,s.tabbableOptions),r=t.length>0?t[0]:void 0,o=t.length>0?t[t.length-1]:void 0,a=n.find((function(e){return ja(e)})),i=n.slice().reverse().find((function(e){return ja(e)})),c=!!t.find((function(e){return ga(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:c,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:a,lastDomTabbableNode:i,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=t.indexOf(e);return o<0?r?n.slice(n.indexOf(e)+1).find((function(e){return ja(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return ja(e)})):t[o+(r?1:-1)]}}})),a.tabbableGroups=a.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),a.tabbableGroups.length<=0&&!l("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find((function(e){return e.posTabIndexesFound}))&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function(e){var t=e.activeElement;if(t)return t.shadowRoot&&null!==t.shadowRoot.activeElement?p(t.shadowRoot):t},f=function(e){!1!==e&&e!==p(document)&&(e&&e.focus?(e.focus({preventScroll:!!s.preventScroll}),a.mostRecentlyFocusedNode=e,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(e)&&e.select()):f(u()))},h=function(e){var t=l("setReturnFocus",{params:[e]});return t||!1!==t&&e},m=function(e){var t=e.target,n=e.event,r=e.isBackward,o=void 0!==r&&r;t=t||Ua(n),d();var i=null;if(a.tabbableGroups.length>0){var u=c(t,n),p=u>=0?a.containerGroups[u]:void 0;if(u<0)i=o?a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:a.tabbableGroups[0].firstTabbableNode;else if(o){var f=a.tabbableGroups.findIndex((function(e){var n=e.firstTabbableNode;return t===n}));if(f<0&&(p.container===t||Na(t,s.tabbableOptions)&&!ja(t,s.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(f=u),f>=0){var h=0===f?a.tabbableGroups.length-1:f-1,m=a.tabbableGroups[h];i=ga(t)>=0?m.lastTabbableNode:m.lastDomTabbableNode}else Aa(n)||(i=p.nextTabbableNode(t,!1))}else{var y=a.tabbableGroups.findIndex((function(e){var n=e.lastTabbableNode;return t===n}));if(y<0&&(p.container===t||Na(t,s.tabbableOptions)&&!ja(t,s.tabbableOptions)&&!p.nextTabbableNode(t))&&(y=u),y>=0){var v=y===a.tabbableGroups.length-1?0:y+1,g=a.tabbableGroups[v];i=ga(t)>=0?g.firstTabbableNode:g.firstDomTabbableNode}else Aa(n)||(i=p.nextTabbableNode(t))}}else i=l("fallbackFocus");return i},y=function(e){var t=Ua(e);c(t,e)>=0||(Da(s.clickOutsideDeactivates,e)?n.deactivate({returnFocus:s.returnFocusOnDeactivate}):Da(s.allowOutsideClick,e)||e.preventDefault())},v=function(e){var t=Ua(e),n=c(t,e)>=0;if(n||t instanceof Document)n&&(a.mostRecentlyFocusedNode=t);else{var r;e.stopImmediatePropagation();var o=!0;if(a.mostRecentlyFocusedNode)if(ga(a.mostRecentlyFocusedNode)>0){var i=c(a.mostRecentlyFocusedNode),l=a.containerGroups[i].tabbableNodes;if(l.length>0){var d=l.findIndex((function(e){return e===a.mostRecentlyFocusedNode}));d>=0&&(s.isKeyForward(a.recentNavEvent)?d+1<l.length&&(r=l[d+1],o=!1):d-1>=0&&(r=l[d-1],o=!1))}}else a.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return ga(e)>0}))}))||(o=!1);else o=!1;o&&(r=m({target:a.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(a.recentNavEvent)})),f(r||a.mostRecentlyFocusedNode||u())}a.recentNavEvent=void 0},g=function(e){(s.isKeyForward(e)||s.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.recentNavEvent=e;var n=m({event:e,isBackward:t});n&&(Aa(e)&&e.preventDefault(),f(n))}(e,s.isKeyBackward(e))},b=function(e){var t;"Escape"!==(null==(t=e)?void 0:t.key)&&"Esc"!==(null==t?void 0:t.key)&&27!==(null==t?void 0:t.keyCode)||!1===Da(s.escapeDeactivates,e)||(e.preventDefault(),n.deactivate())},x=function(e){var t=Ua(e);c(t,e)>=0||Da(s.clickOutsideDeactivates,e)||Da(s.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},w=function(){if(a.active)return function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n._setPausedState(!0)}var r=e.indexOf(t);-1===r||e.splice(r,1),e.push(t)}(o,n),a.delayInitialFocusTimer=s.delayInitialFocus?Ma((function(){f(u())})):f(u()),r.addEventListener("focusin",v,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",x,{capture:!0,passive:!1}),r.addEventListener("keydown",g,{capture:!0,passive:!1}),r.addEventListener("keydown",b),n},_=function(){if(a.active)return r.removeEventListener("focusin",v,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",x,!0),r.removeEventListener("keydown",g,!0),r.removeEventListener("keydown",b),n},C="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===a.mostRecentlyFocusedNode}))}))&&f(u())})):void 0,E=function(){C&&(C.disconnect(),a.active&&!a.paused&&a.containers.map((function(e){C.observe(e,{subtree:!0,childList:!0})})))};return n={get active(){return a.active},get paused(){return a.paused},activate:function(e){if(a.active)return this;var t=i(e,"onActivate"),n=i(e,"onPostActivate"),o=i(e,"checkCanFocusTrap");o||d(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=r.activeElement,null==t||t();var s=function(){o&&d(),w(),E(),null==n||n()};return o?(o(a.containers.concat()).then(s,s),this):(s(),this)},deactivate:function(e){if(!a.active)return this;var t=La({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},e);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,_(),a.active=!1,a.paused=!1,E(),function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}(o,n);var r=i(t,"onDeactivate"),c=i(t,"onPostDeactivate"),l=i(t,"checkCanReturnFocus"),u=i(t,"returnFocus","returnFocusOnDeactivate");null==r||r();var d=function(){Ma((function(){u&&f(h(a.nodeFocusedBeforeActivation)),null==c||c()}))};return u&&l?(l(h(a.nodeFocusedBeforeActivation)).then(d,d),this):(d(),this)},pause:function(e){return a.active?(a.manuallyPaused=!0,this._setPausedState(!0,e)):this},unpause:function(e){return a.active?(a.manuallyPaused=!1,o[o.length-1]!==this?this:this._setPausedState(!1,e)):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return a.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),a.active&&d(),E(),this}},Object.defineProperties(n,{_isManuallyPaused:{value:function(){return a.manuallyPaused}},_setPausedState:{value:function(e,t){if(a.paused===e)return this;if(a.paused=e,e){var n=i(t,"onPause"),r=i(t,"onPostPause");null==n||n(),_(),E(),null==r||r()}else{var o=i(t,"onUnpause"),s=i(t,"onPostUnpause");null==o||o(),d(),w(),E(),null==s||s()}return this}}}),n.updateContainerElements(e),n};const Ba=({children:e,onClose:t,fallBackFocusRef:n,"aria-label":r,"aria-labelledby":s})=>{const a=Ms(),i=(0,Lo.useRef)(null),c=(0,Lo.useRef)(null),[l,u]=(0,Lo.useState)(!1);return(0,Lo.useEffect)((()=>(l&&i.current&&(c.current=za(i.current,{initialFocus:n.current||void 0}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[l,n]),(0,Lo.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(null!==r&&e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[l]),(0,Lo.useEffect)((()=>{l&&i.current&&i.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&t()}))}),[l,t]),(0,Lo.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",a),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),r&&t.setAttribute("aria-label",r),s&&t.setAttribute("aria-labelledby",s),e.appendChild(t),i.current=t,u(!0),()=>{i.current&&(e.removeChild(i.current),i.current=null)}}),[r,s,a]),"function"==typeof e?e({onClose:t,modalRenderFn:e=>i.current&&(0,o.render)(e,i.current)}):i.current&&(0,o.render)((0,o.toChildArray)(e).filter(pn).map((e=>(e.props={...e.props,onClose:t},e))),i.current)},Va=({url:e,description:t,onClose:n})=>{const r=en(),o=As(),s=Es(),a=(0,Lo.useRef)(null),{t:i}=qo(),c=["modal",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];"function"!=typeof s?c.push(...s):c.push(...s(r));const l=e=>{e.stopPropagation()},u=()=>{n()},d=r?.zIndex?{zIndex:r.zIndex+1}:void 0;return(0,ds.jsx)(Ba,{onClose:n,"aria-label":i("lightbox.heading"),fallBackFocusRef:a,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,ds.jsx)("div",{className:Cs(c),onClick:u,style:d,children:(0,ds.jsxs)("div",{className:Cs("modal__float"),tabIndex:-1,onMouseDown:o,onKeyDown:o,onTouchStart:o,onMouseMove:o,onWheel:o,onPointerDown:o,onPointerMove:o,ref:a,children:[(0,ds.jsx)("div",{className:Cs("modal__inner"),onClick:l,children:(0,ds.jsx)("img",{className:Cs("modal__image"),src:e,alt:t})}),(0,ds.jsxs)("button",{type:"button",className:Cs("modal__close"),onClick:n,children:[(0,ds.jsx)($s,{name:"close",size:"16",alt:""}),i("lightbox.closeLabel")]})]})}))(n))})},$a=({description:e,url:t})=>{const{t:n}=qo(),[r,o]=(0,Lo.useState)(!1);return(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsxs)("button",{type:"button",className:Cs("modal__enlarge"),onClick:()=>{o(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,ds.jsx)($s,{name:"enlarge",size:"32",alt:""})]}),r&&(0,ds.jsx)(Va,{url:t,description:e,onClose:()=>{o(!1)}})]})},Ha=({event:e,...t})=>{const{body:n}=xs(e),r=na({originMessage:e.payload.id,transactionId:e.payload.transactionId}),o=(0,Lo.useMemo)((()=>e.payload.optimisticallyInjected?{children:(0,ds.jsx)("p",{children:n?.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:n?.text||""}}}),[n,e]);return(0,ds.jsx)(Fs,{type:"text",event:e,onClick:r,...t,...o})},Wa="PROCESSING_IMAGE",Ga=({img:e,filename:t})=>{const{t:n}=qo(),r=n("fileUpload.srFileUploadedText",{fileName:t});return(0,ds.jsx)(ds.Fragment,{children:(0,ds.jsxs)("span",{className:Cs(["download","download--preview"]),children:[(0,ds.jsx)("img",{src:e,alt:r}),(0,ds.jsx)("span",{"aria-hidden":"true",className:Cs("file-download"),children:t})]})})},qa=({children:e,fileId:t,isDeleted:n,onClickHandler:r,url:o,target:s})=>t&&!n?(0,ds.jsx)("button",{type:"button",onClick:r,className:Cs(["download","download-link"]),children:e}):o?(0,ds.jsx)("a",{href:o,download:!0,target:s,className:Cs(["download","download-link"]),children:e}):(0,ds.jsx)("span",{className:Cs("download"),children:e}),Ka={message:{choice_prompt:({event:e,children:t,...n})=>{const{t:r}=qo(),s=Ms(),{body:a,subEvent:i,showOptions:c,chooseAgain:l,onChoiceClickHandler:u,onChooseAgainClickHandler:d}=Qs(e);return(0,ds.jsxs)(ds.Fragment,{children:[(0,o.toChildArray)(t).filter(pn).map((e=>(e.props={...e.props,event:i,descriptorId:s,showTranslationToggle:!1},e))),l&&(0,ds.jsxs)("button",{type:"button",className:Cs("button","button--secondary","button--choose-again"),"aria-expanded":c?"true":"false",onClick:d,"aria-describedby":s,children:[r(c?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,ds.jsx)($s,{name:"chevronDown",size:"8",alt:""})]}),c&&(0,ds.jsx)(Fs,{type:"choice-prompt",showParticipant:!1,event:e,...n,children:(0,ds.jsx)("ul",{className:Cs("choice-prompt","choice-prompt--many"),children:a?.choices?.map((e=>(0,ds.jsx)("li",{className:Cs("choice-prompt__item",{[`choice-prompt__item--${e?.category}`]:!!e.category}),children:(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{u(e)},children:e.text})},e.id)))})})]})},text:Ha,image:({event:e,descriptorId:t,...n})=>{const{body:r}=xs(e),[o,s]=(0,Lo.useState)(!1),a=Oo();return(0,ds.jsxs)(Fs,{event:e,type:"image",...n,children:[(0,ds.jsx)("img",{src:r?.url,id:t,alt:r?.description||void 0,onLoad:()=>{a(Yr(e.payload.id)),s(!0)}}),r?.isZoomable&&o&&(0,ds.jsx)($a,{description:r?.description,url:r?.url})]})},splash:({event:e,...t})=>{const{payload:n}=e,{body:r}=xs(e),o=na({originMessage:n.id,transactionId:n.transactionId});return(0,ds.jsx)(Fs,{type:"splash",event:e,onClick:o,...t,bodyProps:{dangerouslySetInnerHTML:{__html:r?.text||""}}})},video:({event:e,descriptorId:t,...n})=>{const{body:r}=xs(e);return Ss(e).push("message--type-video"),(0,ds.jsxs)(Fs,{event:e,type:"video",...n,children:[(0,ds.jsx)("div",{id:t,className:Cs("visually-hidden"),children:r?.description}),(0,ds.jsx)("iframe",{title:r?.description||"",src:r?.url,allow:"autoplay; encrypted-media",allowFullScreen:!0})]})},upload:({event:e,...t})=>{const{t:n}=qo(),{body:r}=xs(e),{fromClient:o,id:s}=e.payload,{filename:a,id:i,isDeleted:c,url:l}=r,u=es(),d=(e=>{const{processingFileUploads:t}=Zt((({state:e})=>e));return(0,Lo.useMemo)((()=>{if(t.some((t=>t===e)))return Wa;try{return sessionStorage.getItem(`image-${e}`)}catch(e){return}}),[e,t])})(s),p=(0,Lo.useMemo)((()=>n(c||!l&&!i?"fileUpload.srFileUploadedText":"fileUpload.srFileDownloadText",{fileName:a})),[l,i,a,c,n]);return(0,ds.jsx)(Fs,{event:e,type:"upload",...t,children:d&&d!==Wa?(0,ds.jsx)(Ga,{img:d,filename:a}):(0,ds.jsxs)(qa,{fileId:i,isDeleted:c,onClickHandler:()=>{i&&a&&u.downloadFile(i,a)},url:l,target:o?void 0:"_blank",children:[(0,ds.jsx)($s,{name:"download",size:"16",alt:p}),(0,ds.jsx)("span",{"aria-hidden":"true",className:Cs("file-download"),children:a})]})})},cta:({event:e})=>{const{body:t}=xs(e),n=na({originMessage:e.payload.id,transactionId:e.payload.transactionId}),{emitEvent:r}=rs(),o=Ms(),s=(0,Lo.useCallback)((()=>r(`action.${R}`,{type:R,originMessage:e.payload.id,link:{url:t?.buttonLink}})),[r,t,e]);return(0,ds.jsxs)(Fs,{type:"cta",event:e,children:[(0,ds.jsx)("div",{className:Cs("cta__content"),id:o,dangerouslySetInnerHTML:t?.description?{__html:t.description}:void 0,onClick:n}),(0,ds.jsx)("a",{className:Cs("button","button--primary"),"aria-describedby":o,href:t?.buttonLink,rel:"noreferrer",target:t?.buttonNewTab?"_blank":"_self",onClick:s,children:t?.buttonText})]})},carousel:({event:e})=>{const{body:t}=xs(e),n=t.cards;return(0,ds.jsx)(Fs,{event:e,modifiers:"type-carousel",children:(0,ds.jsx)(Js,{items:n,getItemKey:Xs,getItemLabel:Ys})})},card:({event:e})=>{const{body:t}=xs(e),n=Ms();return(0,ds.jsx)(Fs,{type:"card",event:e,children:(0,ds.jsx)(zs,{id:n,...t})})}},info:{text:Ha,divider:({event:e,...t})=>{const n=sa[z[e.payload.body.subtype]]||sa.default;return(0,ds.jsx)(n,{event:e,...t})},translation:({event:e,...t})=>{const{t:n}=qo(),{body:r}=xs(e);return(0,ds.jsx)(Fs,{type:"text",event:e,...t,children:n(r.key.join("."),r.variables)})},timeIndicator:ca},participant:{participant:({event:e})=>{const{participant:t}=e.payload,{body:n}=(e=>{const{translatedBody:t,translation:n,body:r}={body:e.payload?.participant?.introduction,translatedBody:e.payload?.participant?.translatedIntroduction,translation:e.payload?.participant?.translation},o=!!t,s=Zt(gs(e));return{body:s&&o?t:r,hasTranslation:o,isTranslated:s&&o,userLocale:n?.locale}})(e);return n?(0,ds.jsx)(ra,{graphicSrc:t?.avatar,graphicType:t?.avatar?"avatar":void 0,iconName:t?.avatar?void 0:"balloon",dividerType:"participant",title:n}):null}},service_data:{suggestion:({event:e,...t})=>{const[n,r]=(0,Lo.useState)(!0),o=Oo(),s=Xo(),{addMessageBubble:a,emitEvent:i,sendAction:c}=rs(),l=ns(),{suggestions:u,payload:d}=(e=>{const{payload:t}=e,{body:n}=xs(e);return{suggestions:n,payload:t}})(e),{showSuggestions:p}=en(),f=vn(),{t:h}=qo(),m=h("suggestions.headingText"),y=h("suggestions.footerText"),v=(0,Lo.useMemo)((()=>f.some((({payload:e,type:t})=>"message"===t&&e?.transactionLast))),[f]),g=(0,Lo.useCallback)((({id:e,question:t})=>{if(!l())return;r(!1),o(Gn(!0));const n=$(),s={type:k,originMessage:d.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}},transactionId:n};c(s),a(t,n),i(`action.${s.type}`,s)}),[a,o,i,l,d.id,c]);return n&&!s&&v&&p?(0,ds.jsxs)("div",{className:Cs("suggestions","suggestions--conversation"),children:[m&&(0,ds.jsx)("p",{className:Cs("suggestions__heading"),children:m}),(0,ds.jsxs)(Fs,{type:"suggestions",showParticipant:!1,event:e,...t,children:[(0,ds.jsx)(ta,{className:"suggestions__list--conversation",onClickSuggestion:g,suggestions:u}),y&&(0,ds.jsx)("p",{className:Cs("suggestions__footer"),children:y})]})]}):null}}},Ja=({children:e})=>{const{customComponents:t}=en(),n=(0,Lo.useMemo)((()=>Object.keys(Ka).reduce(((e,n)=>(e[n]={...Ka[n],...t?t[n]:{}},e)),{fallback:Ha})),[t]);return(0,ds.jsx)(fs.Provider,{value:n,children:e})},Xa=({children:e})=>{const{isMinimized:t}=Ko(),n=(0,Lo.useRef)(0),{sendAction:r}=rs(),{hasCountdown:o,isActive:s,stopCountdown:a}=Rs(),i=(0,Lo.useCallback)((()=>{if(t)return;const e=(new Date).getTime(),i=()=>{r({type:"interactivity_update"}),n.current=e};o&&s&&(i(),a()),e-n.current>15e3&&i()}),[r,o,s,a,t]);return(0,ds.jsx)("div",{className:Cs("activity-monitor"),tabIndex:-1,onMouseDown:i,onKeyUp:i,onTouchStart:i,onMouseMove:i,onWheel:i,onPointerDown:i,onPointerMove:i,children:(0,ds.jsx)(Ls.Provider,{value:i,children:e})})},Ya=["text","choice_prompt","image","video"],Qa=()=>{const e=js(),t=(0,Lo.useRef)(),n=(0,Lo.useRef)(),r=Oo(),o=Zo(),s=(0,Lo.useRef)(null),{initCountdown:a,endCountdown:i}=Rs(),{emitEvent:c}=rs(),{hasPrompt:l,continueChat:u}=Ps(),d=(0,Lo.useRef)(l);return(0,Lo.useEffect)((()=>{d.current=l}),[l]),(0,Lo.useEffect)((()=>{e.socket&&(e.onConnection((({currentState:e})=>{if("attach_channel_erred"===e){const e=new x;return r(vr({name:e.name,message:e.message,langKey:e.langKey,originalEvent:e.originalEvent,originalError:e.originalError,action:e.action})),!0}return!1})),e.onError((e=>{const t=new Kn(e);r(vr({name:t.name,message:t.message,langKey:t.langKey,originalEvent:t.originalEvent,originalError:t.originalError})),r(kr())})),e.onOpen((()=>{r(gr())})))}),[e,e.socket,r]),(0,Lo.useEffect)((()=>{e.onConnection((({connected:t})=>!!t&&(n.current&&e?.removeListener("message",n.current),n.current=e=>{switch(e.type){case"ui":switch(e.payload.type){case"idle_detach_countdown":"idle_detach_countdown"===e.payload.body.type&&a(e.payload.body.duration);break;case"loading":r(Xr(e.payload.body.loading));break;case"idle_detach_countdown_elapsed":i(void 0,!0);break;case"resume_conversation_prompt":r(Dr());break;case"user_first_response":r(Gn(!0)),c("system.userFirstResponse",e.payload.body);break;case"translation_proposal":r(Eo(e.payload.body))}break;case"service_attach":const{service:{name:t,settings:{proactiveMessages:{enabled:n},entry:o},sessionId:s}}=e.payload;r(ho(n||!1)),t&&c("system.serviceChanged",t),s&&r(zr(s)),r(to(o)),r(Hr({uploads:{enabled:o.options?.upload?.enabled||!1}}));break;case"context":e.payload.contentLocale&&e.payload.userLocale&&r(cr(e.payload.userLocale));break;case"message":switch(e.payload.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":if(e.payload.service&&e.payload.service.serviceSessionId&&r(zr(e.payload.service.serviceSessionId)),e.payload.fromClient){r(Nr(e));break}d.current&&u(),r(Tr(e))}break;case"participant":(e=>{const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:o}=t;!n&&"string"!=typeof o&&o?.name&&r(Gr(o.name)),r(Qr(t)),"string"!=typeof o&&o.introduction&&r(Tr({...e,payload:{...t,type:"participant"}}))})(e);break;case"service_data":e.payload.persist&&r(eo(e.payload));break;case"info":"divider"!==e.payload.type&&"text"!==e.payload.type&&"translation"!==e.payload.type||r(Tr({type:"info",payload:{...e.payload,participant:null}}));break;case"error":switch(e.payload.type){case"find_conversation":const t=new w(e);r(vr({name:t.name,action:t.action,message:t.message,originalEvent:t.originalEvent,originalError:t.originalError}));break;case"conversation":const n=new x(e);r(vr({name:n.name,message:n.message,langKey:n.langKey,originalEvent:n.originalEvent,originalError:n.originalError,action:n.action}))}}return e},e.onMessage(n.current),!0)))}),[u,e,r,c,i,o,a]),(0,Lo.useEffect)((()=>{e.onConnection((({connected:n})=>!!n&&(t.current&&e.removeListener("message",t.current),t.current=async({payload:e})=>{if("history_changed"===e?.type)try{const t=await r(hr(e)).unwrap();t&&"service"in t&&r(Kr(t))}catch(e){}return Ya.includes(e?.type)?(e.id!==s.current&&o.emit("message",e),s.current=e.id,e):e},e.addListener("message",t.current),!0)))}),[e,r,o]),null},Za=({children:e})=>{const{t}=qo(),n=Oo(),r=es(),{addUploadBubble:o}=rs(),s=(0,Lo.useCallback)((async(e,t)=>{n(ao(t));const r=await(e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{"string"==typeof r.result&&t(r.result)},r.onerror=e=>n(e)})))(e),o=new Image;o.src=r,await o.decode();const s=(e=>{const t=document.createElement("canvas"),n=t.getContext("2d"),[r,o]=(e=>{const{height:t,width:n}=e;return n>t&&n>600?[600,600*t/n]:t>600?[600*n/t,600]:[n,t]})(e);return t.width=r,t.height=o,n?.drawImage(e,0,0,r,o),t.toDataURL()})(o);try{sessionStorage.setItem(`image-${t}`,s)}catch(e){}finally{n(io(t))}}),[n]),a=(0,Lo.useCallback)((e=>{const a=$(),i=r.uploadFile(e,(e=>{n(so({fileId:a,progress:Math.ceil(e)}))}),(async t=>{const{id:r,transactionId:i,occurredAt:c,body:{contentType:l,filename:u,filesize:d}}=t;n(ro(a)),o(r,i,c,l,u,d),l.includes("image/")&&await s(e,r)}),(e=>{let r;switch(e?.error||""){case"file_uploads_are_disabled":r=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":r=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":r=t("fileUpload.errors.wrongType");break;case"virus_found":r=t("fileUpload.errors.virusFound");break;default:r=t("fileUpload.errors.general")}n(oo({fileId:a,errorText:r}))}));n(Ur({fileId:a,fileName:e.name,uploadHandle:i}))}),[s,o,r,n,t]);return(0,ds.jsx)(Ts.Provider,{value:a,children:e})},ei=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=Rs();return((e,t)=>{const n=(0,Lo.useRef)(e);(0,Lo.useEffect)((()=>{n.current=e}),[e]),(0,Lo.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n&&n>0?1e3:null),null},ti=()=>{const{initUserSelectedOptions:e}=ks(),t=(0,Lo.useRef)(!1),n=en();return(0,Lo.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null};function ni(e,t,n=[]){const r=Zo(),o=(0,Lo.useRef)(t);(0,Lo.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 ri=()=>{const e=en(),{emitEvent:t,sendAction:n,sendContext:r,sendMessage:o}=rs(),s=Oo(),{setVisibility:a,visible:i}=Ko(),c=(0,Lo.useRef)(i),l=Zo(),u=es(),d=bn(),p=(0,Lo.useRef)(null),f=(0,Lo.useRef)(null),{isInline:h,isResolving:m}=Sn(),y=Zt(is),v=(()=>{const{get:e}=ts();return e?e("conversationUrl"):null})(),g=(0,Lo.useRef)(null),b=As(),{enableTranslations:x,disableTranslations:w}=bs();return(0,Lo.useEffect)((()=>{c.current=i}),[i]),ni("askText",(e=>{o({body:e})}),[u.send]),ni("setVariables",(e=>{r({variables:e})}),[u.send]),ni("getVisibility",(e=>{e?e(c.current):console.warn("A callback function is required for the getVisibility action.")})),ni("setVisibility",(e=>{const t="string"==typeof e||null===e?e:e.visibility;Object.values(Ot).includes(t)?(b(),a(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[e.api]),ni("sendCustomAction",((e,r)=>{const o={type:"custom",body:{type:e,body:r}};n(o),t(`action.${o.type}`,o)}),[u.send]),ni("setTopic",(({name:e,fallbackMessage:t,message:r,userTriggered:o})=>{o&&s(Bn({showSuggestions:!1})),e&&t?n({type:A,body:{name:e,fallbackMessage:t,message:r}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[u.send]),ni("setContext",(e=>{r(e)}),[u.send]),ni("setTranslation",(({enabled:e,locale:t})=>{e?x(t,D):w()}),[u.send]),(0,Lo.useEffect)((()=>{m||y||(g.current&&g.current!==v&&l.emit("unreadMessageCount",d),i===Ot.open&&i!==f.current&&0!==p.current&&l.emit("unreadMessageCount",0),i!==Ot.open&&d!==p.current&&l.emit("unreadMessageCount",d),f.current=i,p.current=d,"string"==typeof v&&(g.current=v))}),[d,i,l,h,m,y,v]),null},oi=({children:e})=>{const t=Zo(),n=(0,Lo.useRef)(null),[r,o]=(0,Lo.useState)(),s=(0,Lo.useRef)(!0),a=(0,Lo.useCallback)((e=>{s.current&&(o(e),t.emit("aria-live",e))}),[o,t]);return(0,Lo.useEffect)((()=>(n.current=null,r?.messageText&&(n.current=setTimeout((()=>{a({}),n.current&&clearTimeout(n.current)}),600)),()=>{n.current&&clearTimeout(n.current)})),[r,a]),(0,Lo.useEffect)((()=>()=>{s.current=!1}),[]),(0,ds.jsxs)(os.Provider,{value:a,children:[e,(0,ds.jsxs)("div",{className:Cs("app__live-container"),children:[(0,ds.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Cs("visually-hidden"),children:r?.ariaLive===U?r?.messageText:null}),(0,ds.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Cs("visually-hidden"),children:r?.ariaLive===F?r?.messageText:null})]})]})},si=()=>{const{t:e}=qo(),t=hn().historyLoaded,{sendPolite:n}=ss();return(0,Lo.useEffect)((()=>{t&&setTimeout((()=>{n(e("window.srTexts.onHistoryLoad"))}),500)}),[t,e,n]),null},ai=()=>{const{t:e}=qo(),{isOpen:t,isVisible:n}=Ko(),r=bn(),{sendPolite:o}=ss(),s=(0,Lo.useMemo)((()=>nn(o,2e3)),[o]),a=(0,Lo.useRef)(null),i=(0,Lo.useRef)(null);return(0,Lo.useEffect)((()=>{a.current!==n&&!n&&i.current&&i.current(),0!==r&&!t&&n&&(i.current=s(e("message.srTextUnreadCount",{unreadCount:r}))),a.current=n}),[r,t,n,s,e]),null},ii=({store:e,children:t,eventBus:n,api:r})=>((0,Lo.useErrorBoundary)((t=>{console.error(t),e.dispatch(Xn(t))})),(0,ds.jsx)(Ht,{store:e,children:(0,ds.jsx)(Qo.Provider,{value:n,children:(0,ds.jsx)(Yo.Provider,{value:r,children:(0,ds.jsx)(oi,{children:(0,ds.jsx)(ps,{children:(0,ds.jsxs)(Ja,{children:[(0,ds.jsx)(ti,{}),(0,ds.jsx)(Qa,{}),(0,ds.jsx)(ai,{}),(0,ds.jsx)(si,{}),(0,ds.jsx)(ei,{}),(0,ds.jsxs)(Xa,{children:[(0,ds.jsx)(ri,{}),(0,ds.jsx)(Za,{children:t})]})]})})})})})})),ci=Tt(yn,(e=>e.filter((e=>wr(e)&&"service_data"!==e.type&&e.payload?.messageStatus===N)))),li=Tt([ci],(e=>e.filter((e=>"participant"!==e.type)).at(-1))),ui=Tt(ci,(e=>e.filter((({payload:e})=>e?.id)).map((({payload:e})=>e.id)))),di=Tt((({state:e})=>e.options.features?.webNotifications),(e=>e?.enabled)),pi=()=>{const{t:e}=qo(),{showDisclaimer:t}=en();return t?(0,ds.jsxs)("div",{className:Cs("disclaimer"),tabIndex:0,children:[(0,ds.jsx)("h2",{className:Cs("disclaimer__title"),children:e("disclaimer.title")}),(0,ds.jsx)("div",{className:Cs("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]}):null},fi=Tt([({forms:e})=>e,(e,{formId:t})=>t],((e,t)=>e[t])),hi=Tt(fi,(e=>e?.controls||{})),mi=Tt(hi,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),yi=Tt([hi,(e,{name:t})=>t],((e,t)=>e[t]?.value)),vi=Tt([hi,(e,{name:t})=>t],((e,t)=>e[t]?.touched)),gi=(0,o.createContext)({handleSubmit:()=>{},isSubmitted:!1,isValid:!1,updateControlValue:()=>{},updateControlTouched:()=>{},errors:void 0}),{Provider:bi,Consumer:xi}=gi,wi=gi;function _i(){return(0,Lo.useContext)(wi)}function Ci(e){const t=Oo(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:s}=_i(),a=!!Zt((e=>fi(e,{formId:n}))),i=Zt((t=>yi(t,{formId:n,name:e}))),c=Zt((t=>vi(t,{formId:n,name:e}))),l=s?.[e],u=!l;(0,Lo.useEffect)((()=>{a&&t(rr({formId:n,name:e}))}),[a,n,e,t]),(0,Lo.useLayoutEffect)((()=>()=>{t(or({formId:n,name:e}))}),[a,n,e,t]);const d=(0,Lo.useCallback)((t=>r(e,t.target.value)),[e,r]),p=(0,Lo.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,Lo.useMemo)((()=>({name:e,onInput:d,onBlur:p,value:i})),[e,d,p,i]),(0,Lo.useMemo)((()=>({isValid:u,error:l,touched:c})),[u,l,c])]}function Ei(e){const{t}=qo(),{sendAssertive:n}=ss(),{hasLimit:r,limit:o}=En(),s=(0,Lo.useMemo)((()=>nn(n,Mn)),[n]),a=(0,Lo.useMemo)((()=>nn(((e,n)=>{e&&s(t("input.srCharacterLimitText",{limit:n}))}),Mn)),[s,t]),[{value:i}]=Ci(e),c="number"==typeof o&&r&&i?o-i.length:o,l=!(!r||"number"!=typeof c)&&c<=Pn,u=!(!r||"number"!=typeof c)&&c<0;return(0,Lo.useEffect)((()=>{a(l,c)}),[l,c,a]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:l,reachedCharacterLimit:u,remainingChars:c}}const Si=e=>{const{hasCharacterLimit:t,characterLimit:n}=Ei(e),{entryMeta:{optionsOverride:r}}=hn(),{alwaysShowEntryLabel:o}=en(),{t:s}=qo();return{placeholder:(0,Lo.useMemo)((()=>s("input.inputPlaceholder",{hasLimit:t,text:r?.text?.placeholder||s("input.inputPlaceholderText"),limit:t?n:null})),[s,t,n,r?.text?.placeholder]),label:(0,Lo.useMemo)((()=>s("input.inputLabel",{hasLimit:!r?.text?.label&&t,text:r?.text?.label||s("input.inputLabelText"),limit:!r?.text?.label&&t?n:null})),[s,t,n,r?.text?.label]),labelClass:(0,Lo.useMemo)((()=>!0===o||r?.text?.label?"label":"visually-hidden"),[o,r?.text?.label])}};function ji(){const{abortTransaction:e,clearEntryAbortTransaction:t}=(()=>{const e=Oo(),{entryMeta:{actions:t,translatedActions:n}}=hn();return{abortTransaction:n?.abortTransaction||t?.abortTransaction,clearEntryAbortTransaction:()=>{e(no())}}})(),n=es();return e?(0,ds.jsx)("li",{className:Cs(["cvco-conversation__item","cvco-conversation__item--abort-transaction"]),children:(0,ds.jsx)("button",{className:Cs(["button","button--secondary","abort-transaction__button"]),type:"button",onClick:()=>{n.send("action",{type:A,body:{name:e.topicName,fallbackMessage:e.topicFallbackMessage}}),t()},children:e.label})}):null}const Ti=(0,o.createContext)(null),Ni=()=>{const e=(0,Lo.useContext)(Ti);if(!e)throw new Error("useChatScrollContext has to be used within <ChatScrollContext.Provider>");return e},Ii=Ti,ki=e=>{const t=(()=>{const e=(0,Lo.useContext)(fs);if(!e)throw new Error("useComponentContext has to be used within <ComponentContext.Provider>");return e})(),n=t[e.type];let r=n[e.payload.type],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]},Oi=({event:e,newParticipant:t})=>{const{eventRefs:n,unreadIds:r}=Ni(),{sendAction:o}=rs(),s=e.payload.id?n[e.payload.id]:void 0,{containerRef:a,isVisible:i}=Jo({containerRef:s,freezeOnceVisible:!0}),c=Oo(),[l,u]=ki(e);if((0,us.useEffect)((()=>{if(i&&r?.includes(e.payload.id)){const t=r.reduce(((t,n)=>e?.payload?.id&&n&&!t.includes(e.payload.id)?t.concat(n):t),[]);c(Vr(t)),o({type:"read",events:t})}}),[c,e.payload.id,i,o,r]),!l)return null;const d=["conversation__item"];return"info"===e.type?d.push("conversation__item--source-info"):e.payload.fromClient?d.push("conversation__item--source-user"):d.push("conversation__item--source-agent"),t&&d.push("conversation__item--new-participant"),(0,ds.jsxs)("li",{className:Cs(d),ref:a,children:[e.payload.timeIndicator&&(0,ds.jsx)(ca,{event:e}),(0,ds.jsx)(l,{event:e,children:(0,ds.jsx)(u,{event:e})})]})},Li=()=>{const{id:e}=Cn()||{};return(0,ds.jsx)("li",{className:Cs("conversation__item","conversation__item--source-agent"),children:(0,ds.jsxs)("div",{className:Cs("message","message--source-agent","message--type-loading"),children:[(0,ds.jsx)(Us,{eventPayload:{fromClient:!1,participant:e}}),(0,ds.jsx)("div",{className:Cs("message__body"),children:(0,ds.jsxs)("span",{className:Cs("loader"),children:[(0,ds.jsx)("span",{className:Cs("loader__part","one")}),(0,ds.jsx)("span",{className:Cs("loader__part","two")}),(0,ds.jsx)("span",{className:Cs("loader__part","three")}),(0,ds.jsx)("span",{className:Cs("loader__part","four")})]})})]})})},Ai=()=>{const e=vn();let t;return(0,ds.jsx)(ds.Fragment,{children:e.map((e=>{const{type:n,payload:r}=e;let o=!1;if("info"===n||"message"===n){const{participant:n,fromClient:s}=r,a=s?"seamly-client-participant":n;"info"!==e.type&&t!==a&&(o=!0),t=a}return(0,ds.jsx)(Oi,{event:e,newParticipant:o},e.payload.key||e.payload.id)}))})},Ri=()=>{const{t:e}=qo(),t=gn(),n=((e,t=20)=>{const[n,r]=(0,Lo.useState)(e),o=(0,Lo.useRef)(null);return(0,Lo.useEffect)((()=>(o.current=setTimeout((()=>r(e)),t),()=>{o.current&&clearTimeout(o.current)})),[e,t]),n})(t,t?0:20),{isOpen:r}=Ko(),o=xn(),s=vs();return(0,ds.jsxs)(ds.Fragment,{children:[r&&(0,ds.jsx)("a",{className:Cs("skip-link"),href:`#${o}`,onClick:e=>{e.preventDefault(),s()},children:e("skiplinkText")}),(0,ds.jsx)("div",{className:Cs("chat__body"),children:(0,ds.jsxs)("div",{className:Cs("conversation__container"),children:[(0,ds.jsx)(pi,{}),(0,ds.jsxs)("ol",{className:Cs("conversation"),role:"log","aria-label":e("chat.srLabel"),children:[(0,ds.jsx)(Ja,{children:(0,ds.jsx)(Ai,{})}),n?(0,ds.jsx)(Li,{}):null,(0,ds.jsx)(ji,{})]})]})})]})};function Pi(e,t){const n=(0,Lo.useRef)(null),r=(0,Lo.useRef)(e);return(0,Lo.useEffect)((()=>{r.current=e}),[e]),(0,Lo.useEffect)((()=>"number"!=typeof t?()=>{}:(n.current=setTimeout((()=>r.current()),t),()=>{n.current&&clearTimeout(n.current)})),[t]),n}const Mi={visible:Cs("transition--visible"),in:Cs("transition--in"),visuallyHidden:Cs("visually-hidden")},Di=Object.values(Mi),Ui=e=>{const t=(0,Lo.useRef)(null);t.current=e;const n="function"==typeof e;return(0,Lo.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Fi="notRendered",zi="rendered",Bi="visuallyHidden",Vi=({children:e,isActive:t,timeout:n=300,transitionStartState:r=Fi,onInTransitionComplete:s=()=>{},onOutTransitionComplete:a=()=>{},exitAfter:i,enterDelay:c=0})=>{const l=(0,Lo.useRef)(!1),u=(0,Lo.useRef)(null),d=(0,Lo.useRef)(null),p=r===Bi,[f,h]=(0,Lo.useState)((()=>p?[Mi.visuallyHidden]:[])),[m,y]=(0,Lo.useState)((()=>0===c)),v=(0,Lo.useMemo)((()=>i?i+c:i),[c,i]);Pi((()=>y(!1)),t?v:void 0),Pi((()=>y(!0)),t?c:void 0);const g=(0,Lo.useMemo)((()=>m&&t),[t,m]),b=Ui(s),x=Ui(a),w="notRendered"!==r||f.length>0;return(0,Lo.useEffect)((()=>(l.current&&!g&&(h([Mi.visible]),u.current=setTimeout((()=>{h([...p?[Mi.visuallyHidden]:[]]),x&&(d.current=requestAnimationFrame((()=>{x()})))}),n)),!l.current&&g&&(h([Mi.visible]),d.current=requestAnimationFrame((()=>{d.current=requestAnimationFrame((()=>{h([Mi.visible,Mi.in]),b&&(u.current=setTimeout((()=>{b()}),n))}))}))),l.current=g,()=>{u.current&&clearTimeout(u.current),d.current&&cancelAnimationFrame(d.current)})),[p,b,x,n,g]),(0,ds.jsx)(ds.Fragment,{children:w&&(0,o.toChildArray)(e).filter(pn).map((e=>{const{className:t=""}=e.props,n=t.split(" ").filter((e=>!Di.includes(e)));return(0,o.cloneElement)(e,{className:[...n,...f].join(" ")})}))})},$i=({isAside:e=!1})=>{const{isInline:t}=Sn(),{t:n}=qo(),{addMessageBubble:r,emitEvent:o,sendAction:s}=rs(),a=ns(),{isOpen:i,setVisibility:c}=Ko(),{showSuggestions:l}=en(),u=Ms(),d=vs(),p=(0,Lo.useRef)(null),{sendPolite:f}=ss(),h=Zt(is),{hasCountdown:m,endCountdown:y}=Rs(),{hasPrompt:v,continueChat:g}=Ps(),b=Xo(),x=hn().serviceData.suggestion;const{body:w}=xs({payload:x,type:"service_data"}),_=(0,Lo.useMemo)((()=>h?[]:Array.isArray(w)?w:[]),[w,h]),C=(0,Lo.useRef)(),E=(0,Lo.useRef)(!1),S=(0,Lo.useRef)(),j=!!_?.length,T=t?(b||i)&&!e:b,N=(0,Lo.useRef)(T),I=j&&!T&&l,O=j?_:S.current;S.current=O;const L=(0,Lo.useMemo)((()=>{const t=["suggestions"];return e&&t.push("suggestions--aside"),Cs(t)}),[e]),A=(0,Lo.useCallback)((({id:e,question:t})=>{if(!a())return;m&&y(!0),v&&g();const n=$(),l={type:k,originMessage:x.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}},transactionId:n};s(l),r(t,n),o(`action.${l.type}`,l),i||c({visibility:Ot.open}),d()}),[r,g,y,o,d,a,m,v,i,x,s,c]);(0,Lo.useEffect)((()=>{if(C.current!==_&&!T){if(j){const e=E.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{f(e)}),30)}else E.current&&f(n("suggestions.srUnavailableText"));C.current=_}!N.current&&T?(dn(p.current,d),f(n("suggestions.srUnavailableText"))):!j&&E.current&&dn(p.current,d),E.current=j,N.current=T}),[_,j,T,d,f,n]);const R=n("suggestions.headingText"),P=n("suggestions.footerText"),M=R?"section":"div";return(0,ds.jsx)(Vi,{isActive:!!I,transitionStartState:Fi,children:(0,ds.jsxs)(M,{className:L,"aria-labelledby":R?u:void 0,ref:p,children:[R&&(0,ds.jsx)("p",{id:u,className:Cs("suggestions__heading"),children:R}),!!O&&(0,ds.jsx)(ta,{suggestions:O,onClickSuggestion:A}),P&&!i&&(0,ds.jsx)("p",{className:Cs("suggestions__footer"),children:P})]})})},Hi=(0,us.forwardRef)((({children:e,className:t=""},n)=>{const{isOpen:r,isVisible:o,setVisibility:s}=Ko(),{namespace:a,layoutMode:i}=en(),{isInline:c}=Sn(),l=Es(),u=Ms(),d=Xo(),{t:p}=qo(),f=["chat",`chat--layout-${i}`,`namespace--${a}`,t];return"function"!=typeof l&&f.push(...l),r||"app"===i||f.push("chat--collapsed"),d&&f.push("chat--user-responded"),o&&(0,ds.jsxs)("section",{className:Cs(f),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!c&&r&&s({visibility:Ot.minimized})},tabIndex:-1,ref:n,role:"window"===i?"dialog":void 0,"aria-labelledby":u,children:[(0,ds.jsx)("h2",{className:Cs("chat__title","visually-hidden"),id:u,children:p("chat.srLabel")}),(0,ds.jsx)("div",{className:Cs("chat-wrapper"),children:e}),"inline"===i&&r&&(0,ds.jsx)($i,{isAside:!0})]})})),Wi=Hi,Gi=({children:e,handleClose:t,title:n,closeButtonText:r,srCloseButtonText:o,id:s})=>{const a=Ms();return(0,ds.jsxs)("section",{tabIndex:-1,id:s,"aria-labelledby":n?a:void 0,className:Cs("chat-status",n?void 0:"chat-status--condensed"),children:[(0,ds.jsxs)("div",{className:Cs("chat-status__body"),children:[n?(0,ds.jsx)("h2",{className:Cs("chat-status__title"),id:a,children:n}):null,e]}),"function"==typeof t&&(0,ds.jsxs)("button",{type:"button",onClick:t,className:Cs("button","button--tertiary","chat-status__close"),children:[r||(0,ds.jsx)($s,{name:"close",size:"16",alt:""}),o&&(0,ds.jsx)("span",{className:Cs("visually-hidden"),children:o})]})]})},qi=({handleClick:e,icon:t,title:n,srButtonText:r})=>(0,ds.jsxs)("button",{type:"button",onClick:e,className:Cs("button","button--primary","chat-status__button"),children:[(0,ds.jsx)($s,{name:t,size:"16",alt:""}),n,r&&(0,ds.jsx)("span",{className:Cs("visually-hidden"),children:r})]});function Ki(){const{showProposal:e,translationProposal:t,dismissTranslationProposal:n,activateTranslationProposal:r}=(()=>{const{isActive:e,languages:t}=bs(),n=Oo(),{sendAction:r}=rs(),{translationProposal:o}=Zt((e=>e.translations)),{enableTranslations:s}=bs(),{isOpen:a}=Ko(),{userLocale:i}=qo(),c=o?.proposedLocale,l=_s(c),u=(0,Lo.useMemo)((()=>null!==o&&!e&&a&&i!==c&&t.some((e=>e.locale===c))),[o,e,a,i,c,t]);return{activateTranslationProposal:()=>{o?.proposedLocale&&s(o.proposedLocale,M)},dismissTranslationProposal:()=>{r({type:L,body:{type:P}}),n(So())},proposedLocale:c,proposedLocaleNativeName:l,showProposal:u,translationProposal:o}})(),{id:o}=ws();return e&&t?(0,ds.jsx)(Gi,{handleClose:n,srCloseButtonText:t.srDismissButtonText,id:o,title:t.titleLabel,children:(0,ds.jsx)(qi,{handleClick:r,icon:"newTranslation",title:t.buttonLabel})}):null}function Ji(){const e=Zt(is),{isActive:t}=bs();return e||t?null:(0,ds.jsx)(Ki,{})}const Xi=({label:e,checked:t,description:n,onChange:r,id:o,itemClassName:s})=>(0,ds.jsxs)("li",{className:Cs([s||"","translation-options__item"]),"aria-selected":t,role:"option",tabIndex:0,onClick:r,onKeyDown:e=>{"Space"!==e.code&&"Enter"!==e.code||(e.preventDefault(),r())},id:o,children:[(0,ds.jsx)($s,{name:"check",size:"16",alt:""}),e," ",n&&(0,ds.jsxs)("span",{children:["(",n,")"]})]}),Yi=({onChange:e,describedById:t})=>{const{context:{contentLocale:n}}=en(),{t:r}=qo(),{languages:o,currentLocale:s,enableTranslations:a,disableTranslations:i}=bs(),c=vs(),l=t=>()=>{t&&(t===s||n===t?i():a(t,"translation_choice"),e(),c())},{primaryLanguages:u,remainingLanguages:d}=(0,us.useMemo)((()=>o.reduce(((e,t)=>{const r=t.locale===n,o=((e,t,n)=>t===e.locale||!t&&n)(t,s,r);t.locale!==n&&e.remainingLanguages.push({...t,checked:o,isOriginal:r});const a=e.remainingLanguages.findIndex((e=>e.locale===s));return(r||o&&a>4)&&e.primaryLanguages.push({...t,checked:o,isOriginal:r}),e}),{primaryLanguages:[],remainingLanguages:[]})),[s,n,o]);return(0,ds.jsxs)("ul",{"aria-describedby":t,role:"listbox",tabIndex:-1,className:Cs("translation-options"),children:[u.map((({locale:e,nativeName:t,checked:n,isOriginal:o},s)=>(0,ds.jsx)(Xi,{id:e,label:t,checked:n,description:o?r("translations.settings.original"):void 0,onChange:l(e),itemClassName:Cs({"translation-options__item--original":o,"translation-options__item--selected":n&&0!==s})},e))),d.map((({locale:e,nativeName:t,checked:n,isOriginal:o})=>(0,ds.jsx)(Xi,{id:e,label:t,checked:n,description:o?r("translations.settings.original"):void 0,onChange:l(e)},e)))]})},Qi=({className:e,children:t,onCancel:n,headingText:r,description:o,descriptionId:s,cancelButtonText:a,cancelButtonRef:i,disableButtonFocusing:c,position:l={horizontal:"left",vertical:"top"}})=>{const u=Ms(),{hideOption:d}=ks(),{focusButton:p}=Os(),f=(0,Lo.useCallback)((()=>{d(),c||p()}),[c,p,d]),h=(0,Lo.useCallback)((()=>{n&&n(),f()}),[f,n]),m=(e=>{const t=(0,Lo.useRef)(null);return(0,Lo.useEffect)((()=>{const n=n=>{t.current&&n.target instanceof HTMLElement&&!t.current.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),e())};return document.addEventListener("click",n,!0),document.addEventListener("touchstart",n,!0),()=>{document.removeEventListener("click",n,!0),document.removeEventListener("touchstart",n,!0)}}),[e,t]),t})(h);return(0,Lo.useEffect)((()=>{un(m.current)}),[m]),(0,ds.jsx)("section",{className:Cs("options",{"options--right":"right"===l.horizontal,"options--left":"left"===l.horizontal,"options--top":"top"===l.vertical,"options--bottom":"bottom"===l.vertical},e||""),"aria-labelledby":u,tabIndex:-1,ref:m,children:(0,ds.jsxs)("div",{className:Cs("options__body"),children:[(0,ds.jsx)("h2",{id:u,className:Cs("options__title"),children:r}),(0,ds.jsxs)("button",{type:"button",onClick:h,"aria-describedby":u,className:Cs("button","options__close"),ref:e=>{i&&(i.current=e)},children:[(0,ds.jsx)($s,{name:"close",size:"16",alt:""}),(0,ds.jsx)("span",{children:a})]}),o?(0,ds.jsx)("p",{className:Cs("options__description"),id:s,children:o}):null,(0,ds.jsx)("div",{className:Cs("options__wrapper"),children:t})]})})},Zi=function({onClose:e,position:t}){const{t:n}=qo(),r=Ms();return(0,ds.jsx)(Qi,{onCancel:e,headingText:n("translations.menu.title"),cancelButtonText:n("translations.settings.cancelButtonText"),description:n("translations.menu.description"),descriptionId:r,position:t,disableButtonFocusing:!0,children:(0,ds.jsx)(Yi,{describedById:r,onChange:e})})};function ec({children:e,position:t={horizontal:"left",vertical:"top"},classNames:n=[]}){const[r,o]=(0,Lo.useState)(!1),s=(0,Lo.useRef)(null),a=Ms();return(0,ds.jsxs)("div",{className:Cs("translations__container"),onKeyDown:e=>{r&&ln(e)===cn.Escape&&(o(!1),un(s.current))},children:[(0,ds.jsx)(Vi,{transitionStartState:Fi,isActive:r,children:(0,ds.jsx)("div",{className:Cs("options__dialog"),role:"dialog",children:(0,ds.jsx)(Zi,{onClose:()=>{o(!1)},position:t})})}),(0,ds.jsx)("button",{type:"button",className:Cs(["button","chat__options__button",...n]),id:a,onClick:()=>{o(!r)},onKeyDown:e=>{ln(e)===cn.ArrowDown&&(o(!0),e.preventDefault())},ref:s,"aria-haspopup":"dialog","aria-expanded":r,children:e})]})}const tc=({children:e,formId:t,persistData:n=!1,onError:r,onSubmit:o,validationSchema:s={},...a})=>{const i=Oo(),c=Zt((e=>mi(e,{formId:t}))),[l,u]=(0,Lo.useState)(!1),[d,p]=(0,Lo.useState)({}),{isValid:f,errors:h}=function(e,t){const n=(0,Lo.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{const o=Array.isArray(r)?r:[r];for(let r=0;r<o.length;r++)if(!o[r].fn(e[n],o[r].compareValue)){t[n]=o[r].errorText;break}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(c,s),m=(0,Lo.useMemo)((()=>({...h,...d})),[h,d]);(0,Lo.useLayoutEffect)((()=>{i(tr({formId:t,persistData:n}))}),[t,n,i]),(0,Lo.useEffect)((()=>()=>{i(nr({formId:t}))}),[t,n,i]);const y=(0,Lo.useCallback)(((e,n)=>{i(sr({formId:t,name:e,value:n}))}),[t,i]),v=(0,Lo.useCallback)(((e,n)=>{i(ar({formId:t,name:e,touched:n}))}),[i,t]),g=(0,Lo.useCallback)(((e,t)=>{p((n=>({...n,[e]:t})))}),[p]),b=(0,Lo.useCallback)((e=>{e.preventDefault();const t="true"===e.submitter.getAttribute("aria-disabled");u(!t),!t&&f&&(i(Gn(!0)),o(c,{updateControlValue:y,setError:g}))}),[f,i,o,c,y,g]);(0,Lo.useEffect)((()=>{r&&r({errors:m,isSubmitted:l,isValid:0===Object.keys(m).length})}),[l,m,r]);const x=(0,Lo.useMemo)((()=>({formId:t,values:c,errors:m,isValid:0===Object.keys(m).length,isSubmitted:l,handleSubmit:b,validationSchema:s,updateControlValue:y,updateControlTouched:v})),[t,c,m,l,b,s,y,v]);return t?o?(0,ds.jsx)(bi,{...a,value:x,children:e}):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)},nc=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),rc=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},oc=e=>!!e?.length,sc=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))},ac=e=>!!e,ic=function({className:e,disableValidationClasses:t=!1,...n}){const{handleSubmit:r,isValid:o,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=_i();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),a=["form"];return!t&&s&&(a.push("form--submitted"),o?a.push("form--valid"):a.push("form--invalid")),(0,ds.jsx)("form",{onSubmit:r,className:Cs([...a,e]),...n})};function cc({id:e,error:t}){const[n,r]=(0,Lo.useState)(!1);return(0,Lo.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,ds.jsx)("div",{className:Cs("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,ds.jsxs)("span",{id:e,className:Cs("error__message"),children:[(0,ds.jsx)($s,{name:"error",size:"16",alt:""}),t]})})}const lc=({contentHint:e,id:t,labelText:n,labelClass:r,validity:o,errorText:s,children:a})=>(0,ds.jsxs)(ds.Fragment,{children:[e&&(0,ds.jsx)("span",{id:`${t}-content-hint`,className:Cs("input__content-hint"),children:e}),(0,ds.jsx)(cc,{id:`${t}-error`,error:!o&&s}),(0,ds.jsxs)("div",{className:Cs("form-control__wrapper"),children:[(0,ds.jsx)("label",{htmlFor:t,className:Cs(r),children:n}),a]})]}),uc=function({id:e,name:t,type:n,labelText:r,labelClass:o,contentHint:s=null,focus:a,"aria-invalid":i,"aria-describedby":c,...l}){const u=(0,Lo.useRef)(null),{isSubmitted:d}=_i(),[p,{error:f}]=Ci(t),h=d&&f,m=[];return c&&m.push(c),s&&m.push(`${e}-content-hint`),h&&m.push(`${e}-error`),(0,Lo.useLayoutEffect)((()=>{u.current&&a&&u.current.focus()}),[a]),(0,ds.jsx)(lc,{id:e,contentHint:s,validity:!h,errorText:f,labelText:r,labelClass:o,children:(0,ds.jsx)("input",{...p,...l,ref:u,id:e,type:n,"aria-invalid":i||h?"true":"false","aria-describedby":m.join(" ")||void 0,name:t})})};function dc({controlName:e,describedById:t}){const{t:n}=qo();return(0,ds.jsxs)(ic,{noValidate:"true",className:Cs("options__form"),children:[(0,ds.jsx)(uc,{id:"email-id",name:e,type:"email",autocomplete:"email",className:Cs("transcript__input"),"aria-describedby":t,labelClass:Cs("label"),labelText:n("options.sendTranscript.label")}),(0,ds.jsx)("div",{className:Cs("options__actions"),children:(0,ds.jsx)("button",{type:"submit",className:Cs("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const pc="email",fc={sendTranscript:()=>{const[e,t]=(0,Lo.useState)(void 0),{hideOption:n}=ks(),{focusButton:r}=Os(),{t:o}=qo(),s=Ms(),{sendAction:a}=rs(),i=(0,Lo.useMemo)((()=>({[pc]:[nc(ac,o("options.sendTranscript.noEmailText")),nc(sc,o("options.sendTranscript.invalidEmailText"))]})),[o]),c=(0,Lo.useCallback)((e=>{const t=e[pc].trim();a({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[a,n,r]),l=(0,Lo.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,ds.jsx)(Qi,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),description:o("options.sendTranscript.description"),descriptionId:s,position:{vertical:"top",horizontal:"right"},children:(0,ds.jsx)(tc,{formId:"sendTranscript",onSubmit:c,validationSchema:i,onError:l,children:(0,ds.jsx)(dc,{controlName:pc,describedById:s})})})}},hc=()=>{const{optionActive:e}=ks(),t=(0,Lo.useRef)(),n=fc[t.current??e];return e&&(t.current=e),n?(0,ds.jsx)(n,{}):null},mc=()=>{const{t:e}=qo(),{menuOptions:t,showOption:n,panelActive:r,hideOption:o}=ks(),{id:s}=Os(),a=(0,Lo.useRef)(null),[i,c]=(0,Lo.useState)(!1),l=(0,Lo.useRef)(null),u=t.length,d=(0,Lo.useRef)([]),p=(0,Lo.useRef)(!1),f=u>1,h=t[0],m=(0,Lo.useMemo)((()=>h?.name?.trim().replace(/\s+/g,"")),[h]);return(0,Lo.useEffect)((()=>()=>{a.current&&clearTimeout(a.current)}),[]),(0,Lo.useEffect)((()=>{i&&!p.current&&requestAnimationFrame((async()=>{await hs(60);const e=t.findIndex((e=>e.available)),n=-1===e?0:e;d.current&&un(d.current[n])})),p.current=i}),[i,t]),u?(0,ds.jsxs)("div",{className:Cs("options__container"),onKeyDown:e=>{i&&(ln(e)===cn.Escape&&(c(!1),un(l.current)),ln(e)===cn.Home&&(d.current&&un(d.current[0]),e.preventDefault()),ln(e)===cn.End&&(d.current&&un(d.current[u-1]),e.preventDefault()))},onFocusOut:()=>{f&&(a.current=setTimeout((()=>{c(!1)}),200))},onFocusIn:()=>{a.current&&clearTimeout(a.current)},children:[(0,ds.jsx)(Vi,{transitionStartState:Fi,isActive:r,children:(0,ds.jsx)("div",{className:Cs("options__dialog"),children:(0,ds.jsx)(hc,{})})}),f&&(0,ds.jsx)(Vi,{isActive:i,transitionStartState:Fi,children:(0,ds.jsx)("ul",{className:Cs(["options__menu"]),role:"menu",tabIndex:-1,"aria-labelledby":s,children:t.map((({name:r,title:o,available:s},a)=>(0,ds.jsx)("li",{className:Cs("options__menu__item"),role:"menuitem","data-testid":r,children:(0,ds.jsxs)("button",{type:"button",ref:e=>{e&&(d.current[a]=e)},className:Cs(["button","button--secondary"]),onKeyDown:e=>((e,t)=>{if(ln(e)===cn.ArrowDown){const n=Math.min(u-1,t+1);d.current&&un(d.current[t===n?0:n]),e.preventDefault()}if(ln(e)===cn.ArrowUp){const n=Math.max(0,t-1);d.current&&un(d.current[t===n?u-1:n]),e.preventDefault()}})(e,a),onKeyPress:e=>((e,n)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;t.forEach(((e,t)=>{t>n&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=t)})),-1!==o&&d.current&&un(d.current[o])})(e,a),onClick:()=>((e,t)=>{t&&(c(!1),n(e))})(r,s),"aria-disabled":!s,children:[(0,ds.jsxs)("span",{className:Cs("button__text"),children:[o,!s&&" "]}),s?null:(0,ds.jsx)("span",{className:Cs("button__state"),children:e("options.unavailableText")})]})},r)))})}),(0,ds.jsxs)("button",{type:"button",className:Cs(["button","button--secondary","chat__options__button",...!f&&m?[`chat__options__button--${m}`]:[]]),id:s,onClick:()=>{r&&o(),f?c((e=>!e)):h.available&&!r&&n(h.name)},onKeyDown:f?e=>{ln(e)===cn.ArrowDown&&(c(!0),e.preventDefault())}:void 0,ref:l,"aria-haspopup":!!f&&"menu","aria-expanded":!!f&&i,"aria-disabled":!f&&!h.available,children:[f?(0,ds.jsx)($s,{name:"options",size:"32",alt:""}):null,(0,ds.jsx)("span",{className:Cs("button__text"),children:f?e("options.openButtonText"):`${h.title}${h.available?"":" "}`}),f||h.available?null:(0,ds.jsx)("span",{className:Cs("button__state"),children:e("options.unavailableText")})]})]}):null};function yc(){const{menuOptions:e,allowOptionSelection:t}=ks(),{isAvailable:n}=bs(),r=Zt(is),{t:o,userLocale:s}=qo(),a=_s(s);if(!n&&(!t||!e.length)||r)return null;const i=o("translations.settings.openButtonText",{hasLanguage:!!a,language:a});return(0,ds.jsxs)("div",{className:Cs("chat__options"),children:[n&&(0,ds.jsx)("div",{className:Cs("chat__options-item","chat__options-item--left"),children:(0,ds.jsxs)(ec,{classNames:["button--secondary"],children:[(0,ds.jsx)($s,{alt:i,name:"newTranslation",size:"16"}),(0,ds.jsx)("span",{className:Cs("button__text"),children:i})]})}),t&&(0,ds.jsx)("div",{className:Cs("chat__options-item","chat__options-item--right"),children:(0,ds.jsx)(mc,{})})]})}const vc=()=>{const{scrollToRef:e,unreadIds:t}=Ni(),{isMinimized:n}=Ko(),{t:r}=qo();return(0,ds.jsx)(Vi,{isActive:!!t.length&&!n,children:(0,ds.jsx)("div",{className:Cs("unread-messages"),children:(0,ds.jsxs)("button",{type:"button",className:Cs("button","button--primary"),onClick:e,children:[r("message.unreadMessagesCount",{unreadCount:t.length}),(0,ds.jsx)($s,{name:"chevronDown",size:"32",alt:""})]})})})},gc=({children:e})=>{const t=vn(),n=(0,Lo.useMemo)((()=>t.reduce(((e,t)=>t.payload.id?(e[t.payload.id]=(0,o.createRef)(),e):e),{})),[t]),{scrollToRef:r,scrollToBottom:s,containerRef:a,unreadIds:i}=(e=>{const t=(0,Lo.useRef)(null),[n,r]=(0,Lo.useState)(!0),o=Zt(ui),s=vn(),a=gn(),{isOpen:i}=Ko(),c=hn().loadedImageEventIds,{processingFileUploads:l,isLastEventFromClient:u}=Zt((({state:e})=>e));(0,Lo.useEffect)((()=>{const e=t.current;if(!e)return()=>{};const n=()=>{const{scrollHeight:t,scrollTop:n,clientHeight:o}=e,s=Math.abs(t-n-o)>10;r(!s)};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}),[]);const d=(0,Lo.useCallback)((()=>{requestAnimationFrame((async()=>{await hs(30),t.current?.scrollTo({top:t.current?.scrollHeight,left:0,behavior:"auto"})}))}),[]);return(0,Lo.useEffect)((()=>{u&&d()}),[u,d]),(0,Lo.useEffect)((()=>{n&&d()}),[n,o,s,a,i,c,l,d]),{containerRef:t,unreadIds:o,scrollToRef:()=>{const n=o.at(0);if(void 0!==n){const r=e[n]?.current;t.current?.scrollTo({top:r?.offsetTop,behavior:"auto",left:0})}},scrollToBottom:d}})(n);return(0,ds.jsx)(Ii.Provider,{value:{eventRefs:n,unreadIds:i,scrollToRef:r,scrollToBottom:s,containerRef:a},children:(0,ds.jsxs)("div",{className:Cs("chat__container"),children:[(0,ds.jsx)("div",{className:Cs("chat__container__scroll-area"),ref:a,children:e}),(0,ds.jsx)(vc,{})]})})},bc=({baseClassName:e,children:t,title:n})=>{const r=xn(),o=Ms();return(0,ds.jsxs)("section",{id:r,className:Cs(e),"aria-describedby":o,tabIndex:-1,children:[(0,ds.jsx)("h2",{className:Cs(`${e}__title`),id:o,children:n}),t]})},xc=()=>{const{t:e}=qo(),t=vs(),n=As(),{emitEvent:r}=rs(),{isActive:o,remaining:s,timer:a,endCountdown:i}=Rs(),c=!!s&&s>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,ds.jsx)(bc,{baseClassName:"idle",title:l,children:c&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("div",{className:Cs("idle__count-container"),children:o&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("span",{className:Cs("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,ds.jsx)("span",{className:Cs("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",a)})]})}),(0,ds.jsxs)("div",{className:Cs("idle__options"),children:[(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{n(),i(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{i(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},wc=()=>{const{t:e}=qo(),t=As(),{name:n}=Cn()||{},{continueChat:r,restartChat:o}=Ps();return(0,ds.jsx)(bc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,ds.jsxs)("div",{className:Cs("prompt__options"),children:[(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},_c=()=>{const{sendAction:e}=rs(),{features:t}=ks(),{typingPeekahead:n}=t||{},r=(0,Lo.useRef)(null),o=(0,Lo.useRef)(null),s=(0,Lo.useRef)(!1),a=(0,Lo.useRef)(null);(0,Lo.useEffect)((()=>()=>{a.current&&clearInterval(a.current),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current)}),[]);const i=(t,r)=>{e({type:"typing",state:t,...n&&n.enabled?{body:{currentMessage:r}}:{}})};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,a.current||(i(!0,e.target.value),a.current=setInterval((()=>{!s.current&&a.current?(clearInterval(a.current),a.current=null):n&&n.enabled&&i(!0,e.target.value)}),2e3)),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current),r.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{i(!1,e.target.value)}),2e3))}},Cc=()=>{const{default:e,active:t,userSelected:n,options:r,optionsOverride:o}=hn().entryMeta,s=Oo(),a=n||t||e,i=o&&o[a]||r&&r[a]||{},c=(0,Lo.useCallback)((e=>{s(Br(e))}),[s]),l=(0,Lo.useCallback)((e=>{s(Fr(e))}),[s]),u=(0,Lo.useCallback)((e=>{s(co(e))}),[s]),d=(0,Lo.useCallback)((()=>{n?u(null):l(e)}),[l,u,e,n]);return{activeEntry:a,activeEntryOptions:i,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:d,setBlockAutoEntrySwitch:c}};function Ec({controlName:e,skipLinkId:t}){const{t:n}=qo(),{setInputFocus:r}=Ko(),{sendAssertive:o}=ss(),{emitEvent:s}=rs(),a=_c(),{setBlockAutoEntrySwitch:i}=Cc(),{placeholder:c,label:l,labelClass:u}=Si(e),{hasCharacterLimit:d,reachedCharacterWarning:p,reachedCharacterLimit:f,remainingChars:h}=Ei(e),[{value:m}]=Ci(e),y=!!m,v=(0,Lo.useCallback)((()=>{p&&o(n("input.srCharacterLimitText",{limit:h})),s("ui.inputFocus")}),[n,o,p,h,s]);return(0,Lo.useLayoutEffect)((()=>(i(y),()=>{i(!1)})),[i,y]),(0,ds.jsxs)(ic,{className:Cs("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,ds.jsxs)("div",{className:Cs(["input--text__container",...p&&!f?["character-warning"]:[],...f?["character-exceeded"]:[]]),children:[(0,ds.jsx)(uc,{id:t,type:"text",name:e,className:Cs("input__text"),autocomplete:"off",placeholder:c,labelText:l,labelClass:Cs(u),"aria-invalid":!!d&&f,onKeyUp:a,onFocus:v,focus:r}),(0,ds.jsx)("div",{className:Cs("character-count"),children:p&&(0,ds.jsx)("span",{children:h})})]}),(0,ds.jsx)("button",{className:Cs("button","input__submit"),onPointerDown:e=>{e.preventDefault()},"aria-disabled":!y||f,children:(0,ds.jsx)($s,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}const Sc="textMessageEntry";function jc({...e}){const{isOpen:t,setVisibility:n}=Ko(),r=xn(),o=vs(),{sendMessage:s}=rs(),a=(0,Lo.useCallback)(((e,{updateControlValue:r})=>{s({body:e[Sc]}),r(Sc,""),o(),t||n({visibility:Ot.open})}),[s,o,t,n]);return(0,ds.jsx)(tc,{...e,formId:"textEntry",persistData:!0,onSubmit:a,children:(0,ds.jsx)(Ec,{controlName:Sc,skipLinkId:r})})}const Tc=()=>{const{t:e}=qo(),{currentUploads:t}=Is();return(0,ds.jsx)("div",{className:Cs("progress"),children:t.map((({id:t,name:n,progress:r,uploading:o,error:s})=>(0,ds.jsxs)("div",{className:Cs("progress_container"),children:[(0,ds.jsxs)("div",{className:Cs("progress__text"),children:[(0,ds.jsx)("span",{className:Cs("progress__text--file-name"),children:n}),(0,ds.jsx)("span",{className:Cs("progress__text--percentage"),children:`${r}%`})]}),(0,ds.jsx)(cc,{error:s,id:"progress-error"}),(0,ds.jsx)("progress",{className:Cs("progress__bar"),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-label":e("fileUpload.srProgressLabel",{fileName:n}),max:"100","aria-valuenow":r,value:r,"aria-busy":o,children:`${r}%`})]},t)))})};function Nc({id:e,name:t,labelText:n,contentHint:r,outputText:o,accept:s}){const{isSubmitted:a}=_i(),[i,c]=(0,Lo.useState)(!1),[{onInput:l,onBlur:u},{error:d}]=Ci(t),p=Ms(),f=Ms(),h=Ms(),m=a&&d,y=[h];r&&y.push(f),m&&y.push(p);const v=(0,Lo.useCallback)((()=>{c(!0)}),[c]),g=(0,Lo.useCallback)((()=>{c(!1),u()}),[c,u]),b=(0,Lo.useCallback)((e=>{const t={target:{value:e.target.files}};l(t)}),[l]);return(0,ds.jsxs)("div",{className:Cs("upload__container"),children:[r&&(0,ds.jsx)("span",{className:Cs("upload__content-hint"),id:f,children:r}),(0,ds.jsx)(cc,{id:p,error:m&&d}),(0,ds.jsx)("div",{className:Cs(["file-upload",...i?["focus-within"]:[]]),children:(0,ds.jsxs)("label",{htmlFor:e,className:Cs("upload__label"),children:[(0,ds.jsx)($s,{name:"upload",size:"32",alt:""}),(0,ds.jsxs)("div",{children:[(0,ds.jsx)("span",{className:Cs(["upload__label--text"]),children:n}),(0,ds.jsx)("input",{id:e,className:Cs("upload__input"),type:"file",name:t,onChange:b,"aria-invalid":m?"true":"false","aria-describedby":y.join(" "),accept:s||null,onFocus:v,onBlur:g}),(0,ds.jsx)("span",{className:Cs("upload__output"),"aria-hidden":"true",id:h,children:o})]})]})})]})}const Ic=({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:o,isComplete:s,onClickCancel:a})=>{const{t:i}=qo(),[{value:c}]=Ci(t),l=c&&c.length>0,u=l&&"string"!=typeof c?c[0].name:"";return(0,ds.jsxs)(ic,{className:Cs("upload-form"),children:[(0,ds.jsx)(Nc,{name:t,id:e,accept:n,labelText:i("fileUpload.labelText"),outputText:i("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,ds.jsxs)("div",{className:Cs("upload__button-container"),children:[(0,ds.jsx)("button",{id:o||!s?e:void 0,type:"button",onClick:a,className:Cs("button","button--secondary","upload__cancel"),children:i("fileUpload.cancelButtonText")}),(0,ds.jsx)("button",{className:Cs("button","button--primary"),type:"submit",children:i("fileUpload.uploadButtonText")})]})]})},kc="fileListForm",Oc="fileList",Lc=()=>{const{t:e}=qo(),{sendPolite:t,sendAssertive:n}=ss(),r=xn(),o=vs(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:i}=Ns(),c=(0,Lo.useRef)(null),l=(0,Lo.useRef)(s),{cancelEntrySelection:u}=Cc(),{uploadFile:d,clearUploads:p,isUploading:f,isComplete:h}=Is(),{uploadHandle:m,hasServerError:y,progress:v}=((e,t)=>{const n=Zt((n=>yi(n,{formId:e,name:t}))),{currentUploads:r}=Is(),o=n&&n.length>0;let s=null,a=!1,i=0;if(r&&r.length>0){const e=r[0];s=e.uploadHandle,a=!!e.error,i=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:s,hasServerError:a,progress:i}})(kc,Oc),g=Ms(),b=(0,Lo.useRef)(!0),x=e("fileUpload.contentHint",{size:sn(i)}),w=(0,Lo.useRef)(""),_=(0,Lo.useRef)(null);(0,Lo.useEffect)((()=>{w.current&&_.current?.contains(document.activeElement)&&"INPUT"===document.activeElement?.tagName&&n(x),w.current=x}),[x,n]),(0,Lo.useEffect)((()=>{v>0&&t(1===v?e("fileUpload.srStartedText"):`${v}%`)}),[v,t,e]),(0,Lo.useEffect)((()=>{b.current||f||!h||(p(),u(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),b.current=h}),[f,h,p,u,o,t,e]),(0,Lo.useEffect)((()=>{s||f||(p(),u(),o())}),[s,f,p,u,o]);const C=(0,Lo.useCallback)((({fileList:e})=>{d(e[0]),o()}),[d,!1,o]),E=(0,Lo.useCallback)((()=>{m&&m.abort(),p(),u(),o()}),[m,p,u,o]),S=(0,Lo.useMemo)((()=>({[Oc]:[nc((()=>s),e("fileUpload.errors.unavailable")),nc(oc,e("fileUpload.errors.noFile")),nc(rc,e("fileUpload.errors.tooLarge"),i)]})),[i,s,e]);return(0,ds.jsx)("div",{className:Cs(["upload",...y?["upload--error"]:[]]),ref:_,children:(0,ds.jsxs)(tc,{formId:kc,persistData:!0,onSubmit:C,validationSchema:S,children:[(f||!h)&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)(Tc,{}),(0,ds.jsx)("div",{className:Cs("upload__button-container"),children:(0,ds.jsx)("button",{id:f||!h?r:void 0,type:"button",onClick:E,ref:c,className:Cs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!f&&h&&(0,ds.jsx)(Ic,{controlName:Oc,skiplinkId:r,accept:a?.join(", ")||"",contentHint:x,isComplete:h,isUploading:f,onClickCancel:E}),!l.current&&(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)("span",{className:Cs("notification"),id:g,children:e("fileUpload.unavailableText")}),(0,ds.jsx)("div",{className:Cs("upload__button-container"),children:(0,ds.jsx)("button",{id:f||!h?r:void 0,type:"button",onClick:E,className:Cs("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})},Ac=()=>{const{t:e}=qo(),{showFileUpload:t,serviceAllowsUploads:n}=Ns(),[r,o]=(0,Lo.useState)(n||!1),s=vs(),a=(0,Lo.useRef)(null),{setUserEntryType:i,activeEntry:c}=Cc(),l=(0,Lo.useRef)(null),{sendPolite:u}=ss(),d=!!Cn();return(0,Lo.useEffect)((()=>{dn(l.current,(()=>{n||s()})),o(n||!1)}),[n,s]),(0,Lo.useEffect)((()=>{a.current&&!n&&u(e("fileUpload.srUnavailableText")),!1===a.current&&n&&u(e("fileUpload.srAvailableText")),d&&(a.current=n)}),[n,d,u,e]),t||c===T?null:(0,ds.jsx)(Vi,{isActive:r,transitionStartState:zi,children:(0,ds.jsx)("div",{className:Cs("upload-toggle-wrapper"),children:(0,ds.jsx)(Vi,{isActive:r,transitionStartState:Bi,children:(0,ds.jsx)("button",{className:Cs(["button","button--secondary","upload-toggle"]),ref:l,"aria-disabled":!r,type:"button",onClick:r?()=>{i(T),s()}:void 0,children:(0,ds.jsx)($s,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},Rc=()=>{const{isOpen:e}=Ko(),t=(0,Lo.useRef)(null),{hasCountdown:n}=Rs(),[r,o]=(0,Lo.useState)(n),{hasPrompt:s}=Ps(),[a,i]=(0,Lo.useState)(s),c=vs(),l=(0,Lo.useRef)(!1),{activeEntry:u,activeEntryOptions:d}=Cc(),[p,f]=(0,Lo.useState)({text:jc,upload:Lc}),[h,m]=(0,Lo.useState)((()=>u)),y=en(),{accountAllowsUploads:v}=Ns(),g=(0,Lo.useCallback)((()=>{dn(t.current,c)}),[c]);(0,Lo.useEffect)((()=>{const{customComponents:e}=y,{entry:t}=e||{};t&&f((e=>({...e,...t})))}),[y]),(0,Lo.useEffect)((()=>{g(),o(n),i(s)}),[n,s,g]),(0,Lo.useEffect)((()=>{m(u),g()}),[u,g,t]),l.current=!(!t.current||!t.current.contains(document.activeElement));const b=p[h],{allowManualInput:x=!0}=d;return(0,ds.jsxs)("div",{className:Cs("chat__entry"),ref:t,children:[r&&(0,ds.jsx)(xc,{}),a&&(0,ds.jsx)(wc,{}),(0,ds.jsxs)("div",{className:Cs(["entry__body",...n||s||!1===x?["entry__body--hidden"]:[]]),children:[h!==T&&v&&e?(0,ds.jsx)(Ac,{}):null,(0,ds.jsx)(b,{})]})]})},Pc=()=>{const{t:e}=qo(),{isOpen:t,closeChat:n}=Ko(),{isWindow:r}=Sn();return t&&r?(0,ds.jsx)("button",{type:"button",className:Cs("button","collapse-button"),onClick:n,children:(0,ds.jsx)($s,{name:"chevronDown",size:"32",alt:e("window.srCollapseButton")})}):null},Mc=()=>{const{meta:{originalError:e,title:t,message:n,buttonText:r,action:o,srText:s}}=cs(),a=rs(),i=Ms(),{sendPolite:c}=ss(),l=vs(),u="SeamlySessionExpiredError"===e?.name;return(0,Lo.useEffect)((()=>{!u&&s&&setTimeout((()=>{c(s)}),200)}),[c,s,u]),u?(0,ds.jsx)(ds.Fragment,{}):(0,ds.jsxs)("section",{className:Cs("interrupt"),"aria-labelledby":i,children:[(0,ds.jsx)(Pc,{}),(0,ds.jsxs)("div",{className:Cs("interrupt__body"),children:[(0,ds.jsx)("h2",{id:i,className:Cs("interrupt__title"),children:t}),(0,ds.jsx)("p",{className:Cs("interrupt__message"),children:n}),r&&o&&(0,ds.jsx)("div",{className:Cs("interrupt__actions"),children:(0,ds.jsx)("button",{type:"button",className:Cs("button","button--primary"),onClick:()=>{o&&a[o]&&a[o](),l()},children:r})})]})]})},Dc=function({children:e}){const t=Zt(is),{isOpen:n}=Ko();return t?(0,ds.jsx)(Mc,{}):(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsxs)(gc,{children:[(0,ds.jsxs)("div",{className:Cs("chat__container__header"),children:[(0,ds.jsx)(Ji,{}),(0,ds.jsx)(Pc,{})]}),e]}),(0,ds.jsx)(Rc,{}),n&&(0,ds.jsx)(yc,{})]})};function Uc({event:e}){const[t]=ki(e);return(0,ds.jsx)("li",{children:(0,ds.jsx)(t,{event:e})})}function Fc({events:e}){return(0,ds.jsx)("ul",{className:Cs("collapsed-chat-messages"),children:e.map((e=>(0,ds.jsx)(Uc,{event:e},e.payload.id)))})}function zc(){const{preChatEvents:e}=en(),t=Zt(is),{isOpen:n}=Ko();return t||!e?.length||n?null:(0,ds.jsx)(Fc,{events:e})}function Bc(){const{t:e}=qo(),t=e("window.chat.continue"),n=(0,Lo.useMemo)((()=>({type:"message",payload:{type:"custom",body:{text:t,type:"",data:{}},participant:"seamly-client-participant"}})),[t]);return(0,ds.jsx)(Fc,{events:[n]})}const Vc=()=>{const e=tn(),t=Cn(),n=Zt(is),r=t&&!n,o=r?t.avatar:e;return o?(0,ds.jsx)("img",{className:Cs(r?"avatar":"icon"),src:o,alt:""}):(0,ds.jsx)($s,{name:"avatar",size:"32",alt:""})},$c=({onClick:e})=>{const t=ns(),{t:n}=qo(),r=t()?n("window.openButton.srContinue"):n("window.openButton.srStart"),o=vs(),{isOpen:s}=Ko(),a=bn(),i=(0,Lo.useCallback)((()=>{e(),o()}),[o,e]);return(0,ds.jsx)(Vi,{isActive:!s,transitionStartState:zi,children:(0,ds.jsxs)("button",{className:Cs("window-open-button"),"aria-label":r,"aria-hidden":s,onClick:i,children:[(0,ds.jsx)(Vi,{isActive:!!a,transitionStartState:Fi,children:(0,ds.jsx)("span",{className:Cs("message-count"),"aria-hidden":"true",children:a})}),(0,ds.jsx)(Vc,{})]})})},Hc=(e,t,n)=>"object"==typeof e?e[t]:n,Wc=n.p+"sounds/beep.mp3",Gc=!!window.Notification,qc={app:()=>(0,ds.jsx)(Wi,{children:(0,ds.jsx)(Dc,{children:(0,ds.jsx)(Ri,{})})}),inline:()=>{const{showInlineView:e,containerRef:t}=(()=>{const e=Oo(),{connectWhenInView:t}=en(),n=Zt(Tn),{containerRef:r,isVisible:o}=Jo({enabled:t,freezeOnceVisible:!0});return(0,Lo.useEffect)((()=>{o&&e(No())}),[e,o]),{containerRef:r,showInlineView:n}})(),{isOpen:n}=Ko();return(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)(Vi,{isActive:!n,transitionStartState:zi,children:(0,ds.jsxs)("div",{ref:t,className:Cs("unstarted-wrapper","unstarted-wrapper--inline"),children:[(0,ds.jsx)(zc,{}),(0,ds.jsx)($i,{})]})}),(0,ds.jsx)(Vi,{isActive:n,transitionStartState:zi,children:(0,ds.jsx)(Wi,{ref:t,children:e&&(0,ds.jsx)(Dc,{children:n&&(0,ds.jsx)(Ri,{})})})})]})},window:()=>{const{isOpen:e,openChat:t}=Ko(),n=Xo(),{continueChat:r,preChat:o}=en();return(0,ds.jsxs)(ds.Fragment,{children:[(0,ds.jsx)($c,{onClick:t}),(0,ds.jsx)(Vi,{isActive:!!o&&!e&&!n,exitAfter:Hc(o,"exitAfter"),enterDelay:Hc(o,"enterDelay"),transitionStartState:Fi,children:(0,ds.jsx)("div",{className:Cs("unstarted-wrapper","unstarted-wrapper--window"),children:(0,ds.jsx)(zc,{})})}),(0,ds.jsx)(Vi,{isActive:r&&!e&&n,exitAfter:Hc(r,"exitAfter"),enterDelay:Hc(r,"enterDelay"),transitionStartState:Fi,children:(0,ds.jsx)("div",{className:Cs("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,ds.jsx)(Bc,{})})}),(0,ds.jsx)(Vi,{isActive:e,transitionStartState:Fi,children:(0,ds.jsx)(Wi,{children:(0,ds.jsx)(Dc,{children:(0,ds.jsx)(Ri,{})})})})]})}};function Kc(e){const t=document.createElement("div");return t.innerHTML=e||"",t.textContent||t.innerText||""}const Jc=({children:e})=>{const{sendNotification:t}=(()=>{const{proactiveMessages:e}=wn(),{notificationAudioURL:t}=en(),[n,r]=(0,Lo.useState)(Gc?Notification.permission:"default"),[o,s]=(0,Lo.useState)(document.visibilityState),a=Zt(di),i=(0,Lo.useCallback)((async()=>{if(Gc&&"granted"!==n){const e=await Notification.requestPermission();r(e)}}),[n]),c=(0,Lo.useMemo)((()=>"granted"===n),[n]),l=(0,Lo.useMemo)((()=>"hidden"===o),[o]);(0,Lo.useEffect)((()=>{"default"===n&&e&&i()}),[n,e,i]);const u=(0,Lo.useCallback)((async(e,r)=>{if(a&&Gc){if("default"===n&&i(),!1!==t&&!c&&(l||!document.hasFocus()))try{const e=new Audio(t||Wc);await e.play()}catch(e){console.warn(e)}if(c&&(l||!document.hasFocus())){const t=new Notification(e,r);t.onclick=function(){window.parent.focus(),window.focus(),t.close();const e=document.querySelector(`input[name=${Sc}]`);e&&e.focus()}}}}),[t,n,c,i,a,l]);return(0,Lo.useEffect)((()=>{if(!a)return()=>{};function e(){s(document.visibilityState)}return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e)}}),[a]),{permission:n,requestPermission:i,sendNotification:u}})(),[,n]=ms(),r=en(),o=Cn(),{proactiveMessages:s}=wn(),{isOpen:a,isVisible:i}=Ko(),c=Es(),l=Xo(),u=Zt(li),{body:d}=xs(u),{userLocale:p}=qo(),f=(0,Lo.useRef)(void 0),h=(0,Lo.useMemo)((()=>d?"string"==typeof d?Kc(d):"text"in d?Kc(d.text):"prompt"in d&&d.prompt&&"text"in d.prompt?Kc(d.prompt?.text):"":""),[d]);(0,Lo.useEffect)((()=>{o?.name&&h&&s&&u&&f.current!==u.payload?.id&&(t(o.name,{body:h,icon:o?.avatar||void 0}),f.current=u.payload.id)}),[o?.avatar,o?.name,u,h,s,t]);const m=qc[r.layoutMode],y=(0,Lo.useCallback)((e=>{"function"==typeof n&&n(e)}),[n]),v=(0,Lo.useMemo)((()=>{if(p){const e=document.querySelector("html")?.getAttribute("lang");if(e!==p)return p}}),[p]);if(!m)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const g=["app",`app--layout-${r.layoutMode}`,`namespace--${r.namespace}`];return"function"!=typeof c?g.push(...c):g.push(...c(r)),a||"app"===r.layoutMode||g.push("app--collapsed"),l&&g.push("app--user-responded"),i?(0,ds.jsx)("div",{className:Cs(g),lang:v,tabIndex:-1,"data-nosnippet":!0,style:{zIndex:r?.zIndex},ref:y,children:e||(0,ds.jsx)(m,{})}):null},Xc=e=>(0,ds.jsx)(ii,{...e,children:(0,ds.jsx)(Jc,{})});class Yc{constructor(e,n){const{namespace:r="",parentElement:o,...s}=e;this.config={...s,namespace:r},this.namespace=r,this.parentElement=o,this.externalApi=n,this.api=new q({layoutMode:e.layoutMode,namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(t()),this.functions={},this.registerFunctions({on:this.eventBus.on,off:this.eventBus.off}),this.eventBus.on("function.register",((e,t)=>this.registerFunction(e,t))),this.eventBus.on("function.unregister",((e,t)=>this.unregisterFunction(e,t)))}async render(){const{view:e,...t}=this.config.customComponents||{},n={...this.config,parentElement:this.parentElement,customComponents:Object.keys(t).length?t:void 0},r=function({initialState:e,api:t,eventBus:n,config:r}){const o=tt({reducer:ko,preloadedState:e,middleware:e=>e({thunk:{extraArgument:{api:t,eventBus:n,config:r}},serializableCheck:!1}).concat(function({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:o,api:s,layoutMode:a}=Lt(t()),{error:i,type:c}=n,l=Jn[i?.name]?new Jn[i.name](i):new g(i);r?.(l,{namespace:o,api:s,layoutMode:a,conversationUrl:e.getConversationUrl(),action:c?n:void 0})};return e=>t=>{try{return t.payload?.originalEvent?.payload?n({error:t.payload,type:t.payload?.originalEvent?.payload?.type}):t.payload?.originalError&&n({error:t.payload,type:void 0}),e(t)}catch(e){throw n({error:e}),e}}}}({api:t}),function({api:e}){return()=>t=>n=>{const{payload:r,type:o}=n;if(o===vr.type){if(!xr.includes(r.name))throw new x(r);"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}({api:t}),function({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case uo.toString():e.store.set("options",n.payload);break;case lo.toString():e.store.set("options",{...e.store.get("options")||{},[n.payload.option]:n.payload.value})}return r}}({api:t}),yo)});return o}({api:this.api,eventBus:this.eventBus,config:n,initialState:void 0});r.dispatch(zn(n)),await r.dispatch(wt()),await r.dispatch(Ln()),r.dispatch(On()),e?(0,o.render)((0,ds.jsx)(ii,{eventBus:this.eventBus,store:r,api:this.api,children:(0,ds.jsx)(e,{})}),this.parentElement):(0,o.render)((0,ds.jsx)(Xc,{config:n,eventBus:this.eventBus,store:r,api:this.api}),this.parentElement)}destroy(){(0,o.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),this.functions={}}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}const Qc=e=>"object"==typeof e&&"action"in e,Zc=e=>({...e,args:Array.isArray(e.args)?e.args:[e.args]}),el=class{constructor(e){this._waitingActions=[],this._instances={},this.timeouts={},this.appConfig=e,this.context={}}push(...e){(e=e.filter(Qc).map(Zc)).length&&(this._waitingActions.push(...e),this.handleActions())}handleActions(){const e=this._waitingActions;this._waitingActions=[],e.forEach((e=>{switch(e.action){case"init":this.handleInit(e);break;case"destroy":this.handleDestroy(e);break;default:this.handleAction(e)||this.setContext(e.action,...e.args)||this._waitingActions.push(e)}}))}instanceInitializing(e){const t=Object.keys(this._instances);return!e&&t.length>0||t.includes(e)}setContext(e,t){const{instance:n}=t;if(this.instanceInitializing(n))return!1;switch(e){case"setTopic":const{name:e}=t;return e&&(this.context.topic=e),!0;case"setTranslation":const{enabled:n,locale:r}=t;return n&&r&&(this.context.userLocale=r,this.context.source=D),!0;case"setContext":const{userLocale:o,contentLocale:s}=t;return this.context.userLocale=o,this.context.contentLocale=s,o&&o!=this.appConfig?.userLocale&&(this.context.source=D),!0;case"setVariables":return Object.keys(t).length>0&&(this.context.variables={...t}),!0;default:return!1}}handleInit(e){const t=this.getUserConfig(...e.args),n=this.getCombinedConfig(t),{parentElement:r,namespace: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={},this.debouncedRender(e,n.namespace)}}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 Yc(e,this)}debouncedRender(e,t){window.clearTimeout(this.timeouts[t]),this.timeouts[t]=window.setTimeout((()=>{e.render()}),100)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){const t={...e.context||this.appConfig.context,...this.context},n=this.getMergedVariables(e);Object.keys(n).length>0&&(t.variables=n);const r={...this.appConfig.defaults,...e.defaults},o={...this.appConfig,...e,api:{...this.appConfig.api,...e.api},context:Object.keys(t).length?t:void 0,defaults:Object.keys(r).length?r:void 0};return"function"==typeof this.appConfig?this.appConfig(o):o}getMergedVariables(e){return{...this.appConfig.context?.variables||{},...e.context?.variables||{},...this.context.variables||{}}}},tl=()=>{const e=Oo();return{addEvent:t=>e(Tr(t)),clearEvents:()=>e(kr()),setEventsRead:t=>e(Vr(t)),setLoadedImageEventIds:t=>e(Yr(t)),setIsLoading:t=>e(Xr(t)),setParticipant:t=>e(Qr(t)),setHeaderTitle:t=>e(qr(t)),setHeaderSubTitle:t=>e(Gr(t)),setActiveService:t=>e(zr(t)),initIdleDetachCountdown:t=>e(Mr(t)),decrementIdleDetachCountdownCounter:()=>e(Rr()),stopIdleDetachCountdownCounter:()=>e(fo()),clearIdleDetachCountdown:()=>e(Lr()),initResumeConversationPrompt:()=>e(Dr()),clearResumeConversationPrompt:()=>e(Ar()),setServiceDataItem:t=>e(eo(t)),setFeatures:t=>e(Wr(t)),setFeatureEnabledState:t=>e($r(t)),clearFeatures:()=>e(Or()),setInitialState:t=>e(Jr(t)),setUserSelectedOptions:t=>e(uo(t)),setUserSelectedOption:t=>e(lo(t)),showOption:t=>e(po(t)),hideOption:()=>e(Pr()),setServiceEntryMetadata:t=>e(to(t)),setBlockAutoEntrySwitch:t=>e(Br(t)),setActiveEntryType:t=>e(Fr(t)),setUserEntryType:t=>e(co(t)),registerUpload:t=>e(Ur(t)),setUploadProgress:t=>e(so(t)),setUploadComplete:t=>e(ro(t)),setUploadError:t=>e(oo(t)),clearAllUploads:()=>e(Ir()),setSeamlyContainerElement:t=>e(Zr(t))}};function nl(){return{get:()=>{if(window.hasOwnProperty("SeamlyBridge"))try{return JSON.parse(SeamlyBridge.getData())}catch(e){return console.error("Unexpected or malformed data retrieved from bridge",e),{}}return window.seamlyBridgeData},set:e=>{window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.seamlyBridge&&window.webkit.messageHandlers.seamlyBridge.postMessage(JSON.stringify(e)),window.hasOwnProperty("SeamlyBridge")&&SeamlyBridge.setData(JSON.stringify(e)),window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e))}}}function rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var ol=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=rl({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in o)o[a]&&(s+="; "+a,!0!==o[a]&&(s+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+s}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var s=n[o].split("="),a=s.slice(1).join("=");try{var i=decodeURIComponent(s[0]);if(r[i]=t.read(a,i),e===i)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",rl({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,rl({},this.attributes,t))},withConverter:function(t){return e(rl({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function sl(e={}){return function(t){const n=`cvco.${t}`;return{get(){const e=ol.get(n);return e?JSON.parse(e):null},set(t){t&&ol.set(n,JSON.stringify(t),e)}}}}const al=()=>{const{t:e}=qo(),{title:t,subTitle:n}=hn().headerTitles,r=bn(),{isOpen:o}=Ko(),s=Cn(),a=Zt(is),i=tn(),c=s?.avatar??i,l=a?"":n,u=["message-count"];return o&&u.push("message-count__hide"),0===r&&u.push("message-count__empty"),l||!o?(0,ds.jsxs)("div",{className:Cs("agent-info"),children:[(0,ds.jsxs)("div",{className:Cs("agent-info__graphic"),children:[c?(0,ds.jsx)("img",{className:Cs(s?.avatar?"avatar":"icon"),src:c,alt:""}):(0,ds.jsx)($s,{name:"avatar",size:"32",alt:""}),(0,ds.jsx)("span",{className:Cs(u),"aria-hidden":"true",children:r})]}),(0,ds.jsxs)("div",{className:Cs("agent-info__body"),children:[(0,ds.jsx)("p",{className:Cs("agent-info__heading"),children:t??e("header.title")}),(0,ds.jsx)("p",{className:Cs("agent-info__text"),children:l})]})]}):null},il=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=hn(),r=(0,Lo.useRef)(null),{t:o}=qo();return(0,ds.jsxs)("header",{className:Cs("chat__header"),children:[e,(0,ds.jsx)("div",{className:Cs("header-controls"),children:(0,ds.jsx)("button",{type:"button",className:Cs("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,ds.jsx)($s,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},cl=()=>{const e=new URLSearchParams(window.location.search);return Array.from(e.entries()).reduce(((e,[t,n])=>({...e,[t]:n})),{})},ll=e=>new URLSearchParams(e).toString(),ul=(...e)=>{const t=new URL(window.location.href);return e.reduce(((e,n)=>{const r=t.searchParams.get(n)||sessionStorage.getItem(n);return r&&(e[n]=r),e}),{})},dl=(...e)=>{const t=new URL(window.location.href),n=e.reduce(((e,n)=>{const r=t.searchParams.get(n),o=r||sessionStorage.getItem(n);return r&&sessionStorage.setItem(n,r),o?(e.set(n,o),e):e}),new URLSearchParams),r=new URLSearchParams({...Object.fromEntries(t.searchParams),...Object.fromEntries(n)});return r.toString()&&window.history.replaceState(null,"",`?${r}`),ul(...n.keys())},pl=(...e)=>{const t=document.querySelector("[data-reset-search-params]");t&&t.addEventListener("click",(t=>{t.preventDefault();const n=new URL(window.location.href);e.forEach((e=>{sessionStorage.removeItem(e),n.searchParams.delete(e)})),window.location.href=n.toString()}))},fl=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 el(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();
3
3
  //# sourceMappingURL=~/index.min.js.map