@seamly/web-ui 20.0.0-beta.3 → 20.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/build/dist/lib/components.js +1 -1
  2. package/build/dist/lib/components.min.js +1 -1
  3. package/build/dist/lib/deprecated-view.css +1 -0
  4. package/build/dist/lib/deprecated-view.js +1 -0
  5. package/build/dist/lib/index.debug.js +75 -52
  6. package/build/dist/lib/index.debug.min.js +1 -1
  7. package/build/dist/lib/index.debug.min.js.LICENSE.txt +20 -12
  8. package/build/dist/lib/index.js +14465 -13888
  9. package/build/dist/lib/index.min.js +1 -1
  10. package/build/dist/lib/index.min.js.LICENSE.txt +5 -0
  11. package/build/dist/lib/standalone.js +19693 -19678
  12. package/build/dist/lib/standalone.min.js +1 -1
  13. package/build/dist/lib/style-guide.js +68 -26
  14. package/build/dist/lib/style-guide.min.js +1 -1
  15. package/build/dist/lib/styles-default-implementation.css +1 -0
  16. package/build/dist/lib/styles-default-implementation.js +1 -0
  17. package/build/dist/lib/styles.css +1 -1
  18. package/package.json +8 -7
  19. package/src/javascripts/domains/translations/components/options-button.js +1 -1
  20. package/src/javascripts/index.js +2 -2
  21. package/src/javascripts/lib/parse-body.js +1 -1
  22. package/src/javascripts/package/components.js +1 -1
  23. package/src/javascripts/style-guide/components/view.js +1 -0
  24. package/src/javascripts/style-guide/states.js +48 -6
  25. package/src/javascripts/ui/components/app-options/index.js +9 -3
  26. package/src/javascripts/ui/components/conversation/conversation.js +1 -1
  27. package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -1
  28. package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +12 -3
  29. package/src/javascripts/ui/components/conversation/event/hooks/use-text-rendering.js +35 -0
  30. package/src/javascripts/ui/components/conversation/event/participant.js +5 -2
  31. package/src/javascripts/ui/components/conversation/event/splash.js +2 -1
  32. package/src/javascripts/ui/components/conversation/event/text.js +2 -1
  33. package/src/javascripts/ui/components/entry/{toggle-button.js → deprecated-toggle-button.js} +0 -0
  34. package/src/javascripts/ui/components/entry/entry-container.js +1 -1
  35. package/src/javascripts/ui/components/layout/chat-frame.js +1 -1
  36. package/src/javascripts/ui/components/layout/{app-frame.js → chat.js} +10 -41
  37. package/src/javascripts/ui/components/layout/deprecated-app-frame.js +1 -8
  38. package/src/javascripts/ui/components/layout/header.js +1 -1
  39. package/src/javascripts/ui/components/options/options-button.js +2 -2
  40. package/src/javascripts/ui/components/suggestions/index.js +2 -2
  41. package/src/javascripts/ui/components/view/app-view.js +3 -3
  42. package/src/javascripts/ui/components/view/deprecated-view.js +2 -2
  43. package/src/javascripts/ui/components/view/index.js +61 -5
  44. package/src/javascripts/ui/components/view/inline-view.js +9 -3
  45. package/src/javascripts/ui/components/view/window-view/index.js +3 -3
  46. package/src/stylesheets/1-settings/_config.scss +6 -6
  47. package/src/stylesheets/{3-app/_app.scss → 3-chat/_chat.scss} +27 -25
  48. package/src/stylesheets/5-components/_conversation.scss +2 -2
  49. package/src/stylesheets/5-components/_disclaimer.scss +1 -1
  50. package/src/stylesheets/5-components/_message-count.scss +1 -0
  51. package/src/stylesheets/5-components/_modal.scss +2 -2
  52. package/src/stylesheets/5-components/_options.scss +8 -8
  53. package/src/stylesheets/5-components/_pre-chat-messages.scss +6 -2
  54. package/src/stylesheets/5-components/_suggestions.scss +12 -6
  55. package/src/stylesheets/5-components/_unstarted.scss +14 -8
  56. package/src/stylesheets/6-default-implementation/_hover.scss +153 -0
  57. package/src/stylesheets/{6-webui-only → 6-default-implementation}/_scrollbar.scss +1 -1
  58. package/src/stylesheets/7-deprecated/3-app/_app.scss +8 -8
  59. package/src/stylesheets/7-deprecated/5-components/_options.scss +8 -8
  60. package/src/stylesheets/styles-default-implementation.scss +3 -0
  61. package/src/stylesheets/styles.scss +8 -9
  62. package/webpack/config.package.js +9 -1
  63. package/webpack/defaults.js +3 -6
  64. package/src/javascripts/ui/components/layout/modal-wrapper.js +0 -0
  65. package/src/stylesheets/6-webui-only/_hover.scss +0 -151
  66. package/src/stylesheets/styles-webui-only.scss +0 -3
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.min.js.LICENSE.txt */
2
- (()=>{var e={853:function(e){e.exports=function(){"use strict";function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n={exports:{}};function o(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}n.exports={defaults:{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:o,changeDefaults:function(e){n.exports.defaults=e}};var i=/[&<>"']/,s=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,c=/[<>"']|&(?!#?\w+;)/g,u={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},l=function(e){return u[e]};var p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function f(e){return e.replace(p,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var h=/(^|[^\[])\^/g;var d=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var b={},m=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function O(e,t){b[" "+e]||(m.test(e)?b[" "+e]=e+"/":b[" "+e]=w(e,"/",!0));var r=-1===(e=b[" "+e]).indexOf(":");return"//"===t.substring(0,2)?r?t:e.replace(g,"$1")+t:"/"===t.charAt(0)?r?t:e.replace(v,"$1")+t:e+t}function w(e,t,r){var n=e.length;if(0===n)return"";for(var o=0;o<n;){var i=e.charAt(n-o-1);if(i!==t||r){if(i===t||!r)break;o++}else o++}return e.substr(0,n-o)}var E=function(e,t){if(t){if(i.test(e))return e.replace(s,l)}else if(a.test(e))return e.replace(c,l);return e},D=f,j=function(e,t){e=e.source||e,t=t||"";var r={replace:function(t,n){return n=(n=n.source||n).replace(h,"$1"),e=e.replace(t,n),r},getRegex:function(){return new RegExp(e,t)}};return r},x=function(e,t,r){if(e){var n;try{n=decodeURIComponent(f(r)).replace(d,"").toLowerCase()}catch(e){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}t&&!y.test(r)&&(r=O(t,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r},_={exec:function(){}},C=function(e){for(var t,r,n=1;n<arguments.length;n++)for(r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},A=function(e,t){var r=e.replace(/\|/g,(function(e,t,r){for(var n=!1,o=t;--o>=0&&"\\"===r[o];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(r[0].trim()||r.shift(),r[r.length-1].trim()||r.pop(),r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r},S=w,T=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var r=e.length,n=0,o=0;o<r;o++)if("\\"===e[o])o++;else if(e[o]===t[0])n++;else if(e[o]===t[1]&&--n<0)return o;return-1},k=function(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")},P=function(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e},I=n.exports.defaults,N=S,F=A,R=E,B=T;function L(e,t,r,n){var o=t.href,i=t.title?R(t.title):null,s=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){n.state.inLink=!0;var a={type:"link",raw:r,href:o,title:i,text:s,tokens:n.inlineTokens(s,[])};return n.state.inLink=!1,a}return{type:"image",raw:r,href:o,title:i,text:R(s)}}var M=function(){function e(e){this.options=e||I}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e){var t=this.rules.block.code.exec(e);if(t){var r=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:N(r,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var r=t[0],n=function(e,t){var r=e.match(/^(\s+)(?:```)/);if(null===r)return t;var n=r[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=n.length?e.slice(n.length):e})).join("\n")}(r,t[3]||"");return{type:"code",raw:r,lang:t[2]?t[2].trim():t[2],text:n}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var r=t[2].trim();if(/#$/.test(r)){var n=N(r,"#");this.options.pedantic?r=n.trim():n&&!/ $/.test(n)||(r=n.trim())}var o={type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:[]};return this.lexer.inline(o.text,o.tokens),o}},t.hr=function(e){var t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}},t.blockquote=function(e){var t=this.rules.block.blockquote.exec(e);if(t){var r=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(r,[]),text:r}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var r,n,o,i,s,a,c,u,l,p,f=t[1].trim(),h=f.length>1,d={type:"list",raw:"",ordered:h,start:h?+f.slice(0,-1):"",loose:!1,items:[]};f=h?"\\d{1,9}\\"+f.slice(-1):"\\"+f,this.options.pedantic&&(f=h?f:"[*+-]");for(var y=new RegExp("^( {0,3}"+f+")((?: [^\\n]*| *)(?:\\n[^\\n]*)*(?:\\n|$))");e&&!this.rules.block.hr.test(e)&&(t=y.exec(e));){l=t[2].split("\n"),this.options.pedantic?(i=2,p=l[0].trimLeft()):(i=t[2].search(/[^ ]/),i=t[1].length+(i>4?1:i),p=l[0].slice(i-t[1].length)),a=!1,r=t[0],!l[0]&&/^ *$/.test(l[1])&&(r=t[1]+l.slice(0,2).join("\n")+"\n",d.loose=!0,l=[]);var b=new RegExp("^ {0,"+Math.min(3,i-1)+"}(?:[*+-]|\\d{1,9}[.)])");for(s=1;s<l.length;s++){if(u=l[s],this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),b.test(u)){r=t[1]+l.slice(0,s).join("\n")+"\n";break}if(a){if(!(u.search(/[^ ]/)>=i)&&u.trim()){r=t[1]+l.slice(0,s).join("\n")+"\n";break}p+="\n"+u.slice(i)}else u.trim()||(a=!0),u.search(/[^ ]/)>=i?p+="\n"+u.slice(i):p+="\n"+u}d.loose||(c?d.loose=!0:/\n *\n *$/.test(r)&&(c=!0)),this.options.gfm&&(n=/^\[[ xX]\] /.exec(p))&&(o="[ ] "!==n[0],p=p.replace(/^\[[ xX]\] +/,"")),d.items.push({type:"list_item",raw:r,task:!!n,checked:o,loose:!1,text:p}),d.raw+=r,e=e.slice(r.length)}d.items[d.items.length-1].raw=r.trimRight(),d.items[d.items.length-1].text=p.trimRight(),d.raw=d.raw.trimRight();var m=d.items.length;for(s=0;s<m;s++)this.lexer.state.top=!1,d.items[s].tokens=this.lexer.blockTokens(d.items[s].text,[]),d.items[s].tokens.some((function(e){return"space"===e.type}))&&(d.loose=!0,d.items[s].loose=!0);return d}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t){var r={type:"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};return this.options.sanitize&&(r.type="paragraph",r.text=this.options.sanitizer?this.options.sanitizer(t[0]):R(t[0]),r.tokens=[],this.lexer.inline(r.text,r.tokens)),r}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var r={type:"table",header:F(t[1]).map((function(e){return{text:e}})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(r.header.length===r.align.length){r.raw=t[0];var n,o,i,s,a=r.align.length;for(n=0;n<a;n++)/^ *-+: *$/.test(r.align[n])?r.align[n]="right":/^ *:-+: *$/.test(r.align[n])?r.align[n]="center":/^ *:-+ *$/.test(r.align[n])?r.align[n]="left":r.align[n]=null;for(a=r.rows.length,n=0;n<a;n++)r.rows[n]=F(r.rows[n],r.header.length).map((function(e){return{text:e}}));for(a=r.header.length,o=0;o<a;o++)r.header[o].tokens=[],this.lexer.inlineTokens(r.header[o].text,r.header[o].tokens);for(a=r.rows.length,o=0;o<a;o++)for(s=r.rows[o],i=0;i<s.length;i++)s[i].tokens=[],this.lexer.inlineTokens(s[i].text,s[i].tokens);return r}}},t.lheading=function(e){var t=this.rules.block.lheading.exec(e);if(t){var r={type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:[]};return this.lexer.inline(r.text,r.tokens),r}},t.paragraph=function(e){var t=this.rules.block.paragraph.exec(e);if(t){var r={type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(r.text,r.tokens),r}},t.text=function(e){var t=this.rules.block.text.exec(e);if(t){var r={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(r.text,r.tokens),r}},t.escape=function(e){var t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:R(t[1])}},t.tag=function(e){var t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):R(t[0]):t[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var r=t[2].trim();if(!this.options.pedantic&&/^</.test(r)){if(!/>$/.test(r))return;var n=N(r.slice(0,-1),"\\");if((r.length-n.length)%2==0)return}else{var o=B(t[2],"()");if(o>-1){var i=(0===t[0].indexOf("!")?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,i).trim(),t[3]=""}}var s=t[2],a="";if(this.options.pedantic){var c=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);c&&(s=c[1],a=c[3])}else a=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(s=this.options.pedantic&&!/>$/.test(r)?s.slice(1):s.slice(1,-1)),L(t,{href:s?s.replace(this.rules.inline._escapes,"$1"):s,title:a?a.replace(this.rules.inline._escapes,"$1"):a},t[0],this.lexer)}},t.reflink=function(e,t){var r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){var n=(r[2]||r[1]).replace(/\s+/g," ");if(!(n=t[n.toLowerCase()])||!n.href){var o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return L(r,n,r[0],this.lexer)}},t.emStrong=function(e,t,r){void 0===r&&(r="");var n=this.rules.inline.emStrong.lDelim.exec(e);if(n&&(!n[3]||!r.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var o=n[1]||n[2]||"";if(!o||o&&(""===r||this.rules.inline.punctuation.exec(r))){var i,s,a=n[0].length-1,c=a,u=0,l="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+a);null!=(n=l.exec(t));)if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6])if(s=i.length,n[3]||n[4])c+=s;else if(!((n[5]||n[6])&&a%3)||(a+s)%3){if(!((c-=s)>0)){if(s=Math.min(s,s+c+u),Math.min(a,s)%2){var p=e.slice(1,a+n.index+s);return{type:"em",raw:e.slice(0,a+n.index+s+1),text:p,tokens:this.lexer.inlineTokens(p,[])}}var f=e.slice(2,a+n.index+s-1);return{type:"strong",raw:e.slice(0,a+n.index+s+1),text:f,tokens:this.lexer.inlineTokens(f,[])}}}else u+=s}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var r=t[2].replace(/\n/g," "),n=/[^ ]/.test(r),o=/^ /.test(r)&&/ $/.test(r);return n&&o&&(r=r.substring(1,r.length-1)),r=R(r,!0),{type:"codespan",raw:t[0],text:r}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}},t.autolink=function(e,t){var r,n,o=this.rules.inline.autolink.exec(e);if(o)return n="@"===o[2]?"mailto:"+(r=R(this.options.mangle?t(o[1]):o[1])):r=R(o[1]),{type:"link",raw:o[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}},t.url=function(e,t){var r;if(r=this.rules.inline.url.exec(e)){var n,o;if("@"===r[2])o="mailto:"+(n=R(this.options.mangle?t(r[0]):r[0]));else{var i;do{i=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0]}while(i!==r[0]);n=R(r[0]),o="www."===r[1]?"http://"+n:n}return{type:"link",raw:r[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}},t.inlineText=function(e,t){var r,n=this.rules.inline.text.exec(e);if(n)return r=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):R(n[0]):n[0]:R(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:r}},e}(),U=_,z=j,$=C,H={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:U,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};H.def=z(H.def).replace("label",H._label).replace("title",H._title).getRegex(),H.bullet=/(?:[*+-]|\d{1,9}[.)])/,H.listItemStart=z(/^( *)(bull) */).replace("bull",H.bullet).getRegex(),H.list=z(H.list).replace(/bull/g,H.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+H.def.source+")").getRegex(),H._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",H._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,H.html=z(H.html,"i").replace("comment",H._comment).replace("tag",H._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),H.paragraph=z(H._paragraph).replace("hr",H.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",H._tag).getRegex(),H.blockquote=z(H.blockquote).replace("paragraph",H.paragraph).getRegex(),H.normal=$({},H),H.gfm=$({},H.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),H.gfm.table=z(H.gfm.table).replace("hr",H.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",H._tag).getRegex(),H.pedantic=$({},H.normal,{html:z("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",H._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:U,paragraph:z(H.normal._paragraph).replace("hr",H.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",H.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var q={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:U,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:U,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};q.punctuation=z(q.punctuation).replace(/punctuation/g,q._punctuation).getRegex(),q.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,q.escapedEmSt=/\\\*|\\_/g,q._comment=z(H._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),q.emStrong.lDelim=z(q.emStrong.lDelim).replace(/punct/g,q._punctuation).getRegex(),q.emStrong.rDelimAst=z(q.emStrong.rDelimAst,"g").replace(/punct/g,q._punctuation).getRegex(),q.emStrong.rDelimUnd=z(q.emStrong.rDelimUnd,"g").replace(/punct/g,q._punctuation).getRegex(),q._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,q._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,q._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,q.autolink=z(q.autolink).replace("scheme",q._scheme).replace("email",q._email).getRegex(),q._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,q.tag=z(q.tag).replace("comment",q._comment).replace("attribute",q._attribute).getRegex(),q._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,q._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,q._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,q.link=z(q.link).replace("label",q._label).replace("href",q._href).replace("title",q._title).getRegex(),q.reflink=z(q.reflink).replace("label",q._label).getRegex(),q.reflinkSearch=z(q.reflinkSearch,"g").replace("reflink",q.reflink).replace("nolink",q.nolink).getRegex(),q.normal=$({},q),q.pedantic=$({},q.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:z(/^!?\[(label)\]\((.*?)\)/).replace("label",q._label).getRegex(),reflink:z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q._label).getRegex()}),q.gfm=$({},q.normal,{escape:z(q.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),q.gfm.url=z(q.gfm.url,"i").replace("email",q.gfm._extended_email).getRegex(),q.breaks=$({},q.gfm,{br:z(q.br).replace("{2,}","*").getRegex(),text:z(q.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var V={block:H,inline:q},W=M,G=n.exports.defaults,K=V.block,Y=V.inline,J=P;function Q(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Z(e){var t,r,n="",o=e.length;for(t=0;t<o;t++)r=e.charCodeAt(t),Math.random()>.5&&(r="x"+r.toString(16)),n+="&#"+r+";";return n}var X=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||G,this.options.tokenizer=this.options.tokenizer||new W,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var t={block:K.normal,inline:Y.normal};this.options.pedantic?(t.block=K.pedantic,t.inline=Y.pedantic):this.options.gfm&&(t.block=K.gfm,this.options.breaks?t.inline=Y.breaks:t.inline=Y.gfm),this.tokenizer.rules=t}t.lex=function(e,r){return new t(r).lex(e)},t.lexInline=function(e,r){return new t(r).inlineTokens(e)};var r,n,o,i=t.prototype;return i.lex=function(e){var t;for(e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens},i.blockTokens=function(e,t){var r,n,o,i,s=this;for(void 0===t&&(t=[]),this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((function(n){return!!(r=n.call({lexer:s},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)}))))if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e))e=e.substring(r.raw.length),!(n=t[t.length-1])||"paragraph"!==n.type&&"text"!==n.type?t.push(r):(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.list(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.html(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.def(e))e=e.substring(r.raw.length),!(n=t[t.length-1])||"paragraph"!==n.type&&"text"!==n.type?this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}):(n.raw+="\n"+r.raw,n.text+="\n"+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text);else if(r=this.tokenizer.table(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.lheading(e))e=e.substring(r.raw.length),t.push(r);else if(o=e,this.options.extensions&&this.options.extensions.startBlock&&function(){var t=1/0,r=e.slice(1),n=void 0;s.options.extensions.startBlock.forEach((function(e){"number"==typeof(n=e.call({lexer:this},r))&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}(),this.state.top&&(r=this.tokenizer.paragraph(o)))n=t[t.length-1],i&&"paragraph"===n.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):t.push(r),i=o.length!==e.length,e=e.substring(r.raw.length);else if(r=this.tokenizer.text(e))e=e.substring(r.raw.length),(n=t[t.length-1])&&"text"===n.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):t.push(r);else if(e){var a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}throw new Error(a)}return this.state.top=!0,t},i.inline=function(e,t){this.inlineQueue.push({src:e,tokens:t})},i.inlineTokens=function(e,t){var r,n,o,i=this;void 0===t&&(t=[]);var s,a,c,u=e;if(this.tokens.links){var l=Object.keys(this.tokens.links);if(l.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(u));)l.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(u=u.slice(0,s.index)+"["+J("a",s[0].length-2)+"]"+u.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(u));)u=u.slice(0,s.index)+"["+J("a",s[0].length-2)+"]"+u.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.escapedEmSt.exec(u));)u=u.slice(0,s.index)+"++"+u.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(a||(c=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((function(n){return!!(r=n.call({lexer:i},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)}))))if(r=this.tokenizer.escape(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.tag(e))e=e.substring(r.raw.length),(n=t[t.length-1])&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.link(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(r.raw.length),(n=t[t.length-1])&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.emStrong(e,u,c))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.codespan(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.br(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.del(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.autolink(e,Z))e=e.substring(r.raw.length),t.push(r);else if(this.state.inLink||!(r=this.tokenizer.url(e,Z))){if(o=e,this.options.extensions&&this.options.extensions.startInline&&function(){var t=1/0,r=e.slice(1),n=void 0;i.options.extensions.startInline.forEach((function(e){"number"==typeof(n=e.call({lexer:this},r))&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}(),r=this.tokenizer.inlineText(o,Q))e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(c=r.raw.slice(-1)),a=!0,(n=t[t.length-1])&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(e){var p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}throw new Error(p)}}else e=e.substring(r.raw.length),t.push(r);return t},r=t,o=[{key:"rules",get:function(){return{block:K,inline:Y}}}],(n=null)&&e(r.prototype,n),o&&e(r,o),t}(),ee=n.exports.defaults,te=x,re=E,ne=function(){function e(e){this.options=e||ee}var t=e.prototype;return t.code=function(e,t,r){var n=(t||"").match(/\S*/)[0];if(this.options.highlight){var o=this.options.highlight(e,n);null!=o&&o!==e&&(r=!0,e=o)}return e=e.replace(/\n$/,"")+"\n",n?'<pre><code class="'+this.options.langPrefix+re(n,!0)+'">'+(r?e:re(e,!0))+"</code></pre>\n":"<pre><code>"+(r?e:re(e,!0))+"</code></pre>\n"},t.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},t.html=function(e){return e},t.heading=function(e,t,r,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.slug(r)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},t.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},t.list=function(e,t,r){var n=t?"ol":"ul";return"<"+n+(t&&1!==r?' start="'+r+'"':"")+">\n"+e+"</"+n+">\n"},t.listitem=function(e){return"<li>"+e+"</li>\n"},t.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},t.paragraph=function(e){return"<p>"+e+"</p>\n"},t.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},t.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},t.tablecell=function(e,t){var r=t.header?"th":"td";return(t.align?"<"+r+' align="'+t.align+'">':"<"+r+">")+e+"</"+r+">\n"},t.strong=function(e){return"<strong>"+e+"</strong>"},t.em=function(e){return"<em>"+e+"</em>"},t.codespan=function(e){return"<code>"+e+"</code>"},t.br=function(){return this.options.xhtml?"<br/>":"<br>"},t.del=function(e){return"<del>"+e+"</del>"},t.link=function(e,t,r){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return r;var n='<a href="'+re(e)+'"';return t&&(n+=' title="'+t+'"'),n+">"+r+"</a>"},t.image=function(e,t,r){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return r;var n='<img src="'+e+'" alt="'+r+'"';return t&&(n+=' title="'+t+'"'),n+(this.options.xhtml?"/>":">")},t.text=function(e){return e},e}(),oe=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,r){return""+r},t.image=function(e,t,r){return""+r},t.br=function(){return""},e}(),ie=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var r=e,n=0;if(this.seen.hasOwnProperty(r)){n=this.seen[e];do{r=e+"-"+ ++n}while(this.seen.hasOwnProperty(r))}return t||(this.seen[e]=n,this.seen[r]=0),r},t.slug=function(e,t){void 0===t&&(t={});var r=this.serialize(e);return this.getNextSafeSlug(r,t.dryrun)},e}(),se=ne,ae=oe,ce=ie,ue=n.exports.defaults,le=D,pe=X,fe=function(){function e(e){this.options=e||ue,this.options.renderer=this.options.renderer||new se,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ae,this.slugger=new ce}e.parse=function(t,r){return new e(r).parse(t)},e.parseInline=function(t,r){return new e(r).parseInline(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var r,n,o,i,s,a,c,u,l,p,f,h,d,y,b,m,g,v,O,w="",E=e.length;for(r=0;r<E;r++)if(p=e[r],!(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[p.type])||!1===(O=this.options.extensions.renderers[p.type].call({parser:this},p))&&["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type))switch(p.type){case"space":continue;case"hr":w+=this.renderer.hr();continue;case"heading":w+=this.renderer.heading(this.parseInline(p.tokens),p.depth,le(this.parseInline(p.tokens,this.textRenderer)),this.slugger);continue;case"code":w+=this.renderer.code(p.text,p.lang,p.escaped);continue;case"table":for(u="",c="",i=p.header.length,n=0;n<i;n++)c+=this.renderer.tablecell(this.parseInline(p.header[n].tokens),{header:!0,align:p.align[n]});for(u+=this.renderer.tablerow(c),l="",i=p.rows.length,n=0;n<i;n++){for(c="",s=(a=p.rows[n]).length,o=0;o<s;o++)c+=this.renderer.tablecell(this.parseInline(a[o].tokens),{header:!1,align:p.align[o]});l+=this.renderer.tablerow(c)}w+=this.renderer.table(u,l);continue;case"blockquote":l=this.parse(p.tokens),w+=this.renderer.blockquote(l);continue;case"list":for(f=p.ordered,h=p.start,d=p.loose,i=p.items.length,l="",n=0;n<i;n++)m=(b=p.items[n]).checked,g=b.task,y="",b.task&&(v=this.renderer.checkbox(m),d?b.tokens.length>0&&"paragraph"===b.tokens[0].type?(b.tokens[0].text=v+" "+b.tokens[0].text,b.tokens[0].tokens&&b.tokens[0].tokens.length>0&&"text"===b.tokens[0].tokens[0].type&&(b.tokens[0].tokens[0].text=v+" "+b.tokens[0].tokens[0].text)):b.tokens.unshift({type:"text",text:v}):y+=v),y+=this.parse(b.tokens,d),l+=this.renderer.listitem(y,g,m);w+=this.renderer.list(l,f,h);continue;case"html":w+=this.renderer.html(p.text);continue;case"paragraph":w+=this.renderer.paragraph(this.parseInline(p.tokens));continue;case"text":for(l=p.tokens?this.parseInline(p.tokens):p.text;r+1<E&&"text"===e[r+1].type;)l+="\n"+((p=e[++r]).tokens?this.parseInline(p.tokens):p.text);w+=t?this.renderer.paragraph(l):l;continue;default:var D='Token with "'+p.type+'" type was not found.';if(this.options.silent)return void console.error(D);throw new Error(D)}else w+=O||"";return w},t.parseInline=function(e,t){t=t||this.renderer;var r,n,o,i="",s=e.length;for(r=0;r<s;r++)if(n=e[r],!(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type])||!1===(o=this.options.extensions.renderers[n.type].call({parser:this},n))&&["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type))switch(n.type){case"escape":i+=t.text(n.text);break;case"html":i+=t.html(n.text);break;case"link":i+=t.link(n.href,n.title,this.parseInline(n.tokens,t));break;case"image":i+=t.image(n.href,n.title,n.text);break;case"strong":i+=t.strong(this.parseInline(n.tokens,t));break;case"em":i+=t.em(this.parseInline(n.tokens,t));break;case"codespan":i+=t.codespan(n.text);break;case"br":i+=t.br();break;case"del":i+=t.del(this.parseInline(n.tokens,t));break;case"text":i+=t.text(n.text);break;default:var a='Token with "'+n.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}else i+=o||"";return i},e}(),he=M,de=ne,ye=oe,be=ie,me=C,ge=k,ve=E,Oe=n.exports.getDefaults,we=n.exports.changeDefaults,Ee=n.exports.defaults;function De(e,t,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(r=t,t=null),t=me({},De.defaults,t||{}),ge(t),r){var n,o=t.highlight;try{n=pe.lex(e,t)}catch(e){return r(e)}var i=function(e){var i;if(!e)try{t.walkTokens&&De.walkTokens(n,t.walkTokens),i=fe.parse(n,t)}catch(t){e=t}return t.highlight=o,e?r(e):r(null,i)};if(!o||o.length<3)return i();if(delete t.highlight,!n.length)return i();var s=0;return De.walkTokens(n,(function(e){"code"===e.type&&(s++,setTimeout((function(){o(e.text,e.lang,(function(t,r){if(t)return i(t);null!=r&&r!==e.text&&(e.text=r,e.escaped=!0),0==--s&&i()}))}),0))})),void(0===s&&i())}try{var a=pe.lex(e,t);return t.walkTokens&&De.walkTokens(a,t.walkTokens),fe.parse(a,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+ve(e.message+"",!0)+"</pre>";throw e}}return De.options=De.setOptions=function(e){return me(De.defaults,e),we(De.defaults),De},De.getDefaults=Oe,De.defaults=Ee,De.use=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o,i=me.apply(void 0,[{}].concat(r)),s=De.defaults.extensions||{renderers:{},childTokens:{}};r.forEach((function(t){if(t.extensions&&(o=!0,t.extensions.forEach((function(e){if(!e.name)throw new Error("extension name required");if(e.renderer){var t=s.renderers?s.renderers[e.name]:null;s.renderers[e.name]=t?function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var i=e.renderer.apply(this,n);return!1===i&&(i=t.apply(this,n)),i}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");s[e.level]?s[e.level].unshift(e.tokenizer):s[e.level]=[e.tokenizer],e.start&&("block"===e.level?s.startBlock?s.startBlock.push(e.start):s.startBlock=[e.start]:"inline"===e.level&&(s.startInline?s.startInline.push(e.start):s.startInline=[e.start]))}e.childTokens&&(s.childTokens[e.name]=e.childTokens)}))),t.renderer&&function(){var e=De.defaults.renderer||new de,r=function(r){var n=e[r];e[r]=function(){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];var a=t.renderer[r].apply(e,i);return!1===a&&(a=n.apply(e,i)),a}};for(var n in t.renderer)r(n);i.renderer=e}(),t.tokenizer&&function(){var e=De.defaults.tokenizer||new he,r=function(r){var n=e[r];e[r]=function(){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];var a=t.tokenizer[r].apply(e,i);return!1===a&&(a=n.apply(e,i)),a}};for(var n in t.tokenizer)r(n);i.tokenizer=e}(),t.walkTokens){var r=De.defaults.walkTokens;i.walkTokens=function(n){t.walkTokens.call(e,n),r&&r(n)}}o&&(i.extensions=s),De.setOptions(i)}))},De.walkTokens=function(e,t){for(var n,o=function(){var e=n.value;switch(t(e),e.type){case"table":for(var o,i=r(e.header);!(o=i()).done;){var s=o.value;De.walkTokens(s.tokens,t)}for(var a,c=r(e.rows);!(a=c()).done;)for(var u,l=r(a.value);!(u=l()).done;){var p=u.value;De.walkTokens(p.tokens,t)}break;case"list":De.walkTokens(e.items,t);break;default:De.defaults.extensions&&De.defaults.extensions.childTokens&&De.defaults.extensions.childTokens[e.type]?De.defaults.extensions.childTokens[e.type].forEach((function(r){De.walkTokens(e[r],t)})):e.tokens&&De.walkTokens(e.tokens,t)}},i=r(e);!(n=i()).done;)o()},De.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");t=me({},De.defaults,t||{}),ge(t);try{var r=pe.lexInline(e,t);return t.walkTokens&&De.walkTokens(r,t.walkTokens),fe.parseInline(r,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+ve(e.message+"",!0)+"</pre>";throw e}},De.Parser=fe,De.parser=fe.parse,De.Renderer=de,De.TextRenderer=ye,De.Lexer=pe,De.lexer=pe.lex,De.Tokenizer=he,De.Slugger=be,De.parse=De,De}()},574:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach((function(e){r.prototype[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return this._defaults.push({fn:e,args:r}),this}})),r.prototype._setDefaults=function(e){this._defaults.forEach((function(r){var n;e[r.fn].apply(e,function(e){if(Array.isArray(e))return t(e)}(n=r.args)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(n)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(n)||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.")}())}))},e.exports=r},766:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;var i=r(767),s=r(445),a=r(129),c=r(842),u=r(508),l=r(253),p=r(574);function f(){}e.exports=function(e,r){return"function"==typeof r?new t.Request("GET",e).end(r):1===arguments.length?new t.Request("GET",e):new t.Request(e,r)};var h=t=e.exports;t.Request=O,h.getXHR=function(){if(o.XMLHttpRequest&&(!o.location||"file:"!==o.location.protocol||!o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("Browser-only version of superagent could not find XHR")};var d="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function y(e){if(!u(e))return e;var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&b(t,r,e[r]);return t.join("&")}function b(e,t,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach((function(r){b(e,t,r)}));else if(u(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&b(e,"".concat(t,"[").concat(n,"]"),r[n]);else e.push(encodeURI(t)+"="+encodeURIComponent(r));else e.push(encodeURI(t))}function m(e){for(var t,r,n={},o=e.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(t=o[i]).indexOf("="))?n[decodeURIComponent(t)]="":n[decodeURIComponent(t.slice(0,r))]=decodeURIComponent(t.slice(r+1));return n}function g(e){return/[/+]json($|[^-\w])/i.test(e)}function v(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,r,n,o,i=e.split(/\r?\n/),s={},a=0,c=i.length;a<c;++a)-1!==(t=(r=i[a]).indexOf(":"))&&(n=r.slice(0,t).toLowerCase(),o=d(r.slice(t+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function O(e,t){var r=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,n=null;try{n=new v(r)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,r.xhr?(t.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.status=r.xhr.status?r.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),r.callback(t)}r.emit("response",n);try{r._isResponseOK(n)||(e=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=n,e.status=n.status,r.callback(e,n)):r.callback(null,n)}))}function w(e,t,r){var n=h("DELETE",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}h.serializeObject=y,h.parseString=m,h.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},h.serialize={"application/x-www-form-urlencoded":a.stringify,"application/json":s},h.parse={"application/x-www-form-urlencoded":m,"application/json":JSON.parse},l(v.prototype),v.prototype._parseBody=function(e){var t=h.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&g(this.type)&&(t=h.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},v.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,n="cannot ".concat(t," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=t,o.url=r,o},h.Response=v,i(O.prototype),c(O.prototype),O.prototype.type=function(e){return this.set("Content-Type",h.types[e]||e),this},O.prototype.accept=function(e){return this.set("Accept",h.types[e]||e),this},O.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,o)},O.prototype.query=function(e){return"string"!=typeof e&&(e=y(e)),e&&this._query.push(e),this},O.prototype.attach=function(e,t,r){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},O.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},O.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},O.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},O.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},O.prototype.ca=O.prototype.agent,O.prototype.buffer=O.prototype.ca,O.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},O.prototype.pipe=O.prototype.write,O.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},O.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||f,this._finalizeQueryString(),this._end()},O.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},O.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=h.getXHR();var t=this.xhr,r=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(e._uploadTimeoutTimer)),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.addEventListener("progress",n.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",n.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||h.serialize[o?o.split(";")[0]:""];!i&&g(o)&&(i=h.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===r?null:r)},h.agent=function(){return new p},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){p.prototype[e.toLowerCase()]=function(t,r){var n=new h.Request(e,t);return this._setDefaults(n),r&&n.end(r),n}})),p.prototype.del=p.prototype.delete,h.get=function(e,t,r){var n=h("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},h.head=function(e,t,r){var n=h("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},h.options=function(e,t,r){var n=h("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},h.del=w,h.delete=w,h.patch=function(e,t,r){var n=h("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},h.post=function(e,t,r){var n=h("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},h.put=function(e,t,r){var n=h("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},508:e=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!==e&&"object"===t(e)}},842:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=r(508);function i(e){if(e)return function(e){for(var t in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,t)&&(e[t]=i.prototype[t]);return e}(e)}e.exports=i,i.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},i.prototype.parse=function(e){return this._parser=e,this},i.prototype.responseType=function(e){return this._responseType=e,this},i.prototype.serialize=function(e){return this._serializer=e,this},i.prototype.timeout=function(e){if(!e||"object"!==n(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},i.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var s=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),a=new Set([408,413,429,500,502,503,504,521,522,524]);i.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(e,t);if(!0===r)return!0;if(!1===r)return!1}catch(e){console.error(e)}if(t&&t.status&&a.has(t.status))return!0;if(e){if(e.code&&s.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},i.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},i.prototype.then=function(e,t){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.on("abort",(function(){if(!(r._maxRetries&&r._maxRetries>r._retries))if(r.timedout&&r.timedoutError)t(r.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=r.status,e.method=r.method,e.url=r.url,t(e)}})),n.end((function(r,n){r?t(r):e(n)}))}))}return this._fullfilledPromise.then(e,t)},i.prototype.catch=function(e){return this.then(void 0,e)},i.prototype.use=function(e){return e(this),this},i.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},i.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},i.prototype.get=function(e){return this._header[e.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(e,t){if(o(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},i.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},i.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(o(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.field(r,e[r]);return this}if(Array.isArray(t)){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.field(e,t[n]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),this._getFormData().append(e,t),this},i.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},i.prototype._auth=function(e,t,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},i.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},i.prototype.redirects=function(e){return this._maxRedirects=e,this},i.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(e){var t=o(e),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&o(this._data))for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._data[n]=e[n]);else"string"==typeof e?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||r||this.type("json"),this},i.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},i.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.slice(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,t)+"?"+r.join("&")}}},i.prototype._appendQueryString=function(){console.warn("Unsupported")},i.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error("".concat(e+t,"ms exceeded"));n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},253:(e,t,r)=>{"use strict";var n=r(244);function o(e){if(e)return function(e){for(var t in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,t)&&(e[t]=o.prototype[t]);return e}(e)}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=n.type(t);var r=n.params(t);for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(this[o]=r[o]);this.links={};try{e.link&&(this.links=n.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){var t=e/100|0;this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},244:(e,t)=>{"use strict";function r(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){var t,n={},o=r(e.split(/ *; */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *= */),s=i.shift(),a=i.shift();s&&a&&(n[s]=a)}}catch(e){o.e(e)}finally{o.f()}return n},t.parseLinks=function(e){var t,n={},o=r(e.split(/ *, */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *; */),s=i[0].slice(1,-1);n[i[1].split(/ *= */)[1].slice(1,-1)]=s}}catch(e){o.e(e)}finally{o.f()}return n},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},905:e=>{e.exports=()=>()=>null},698:e=>{e.exports=null},924:(e,t,r)=>{"use strict";var n=r(210),o=r(559),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},559:(e,t,r)=>{"use strict";var n=r(612),o=r(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(s,i),c=o("%Object.getOwnPropertyDescriptor%",!0),u=o("%Object.defineProperty%",!0),l=o("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function(e){var t=a(n,s,arguments);if(c&&u){var r=c(t,"length");r.configurable&&u(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(n,i,arguments)};u?u(e.exports,"apply",{value:p}):e.exports.apply=p},767:e=>{function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((r=n[o])===t||r.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},289:(e,t,r)=>{"use strict";var n=r(215),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,a=Object.defineProperty,c=a&&function(){var e={};try{for(var t in a(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),u=function(e,t,r,n){var o;(!(t in e)||"function"==typeof(o=n)&&"[object Function]"===i.call(o)&&n())&&(c?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},l=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);o&&(i=s.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a<i.length;a+=1)u(e,i[a],t[i[a]],r[i[a]])};l.supportsDescriptors=!!c,e.exports=l},445:e=>{e.exports=n,n.default=n,n.stable=s,n.stableStringify=s;var t=[],r=[];function n(e,n,i){var s;for(o(e,"",[],void 0),s=0===r.length?JSON.stringify(e,n,i):JSON.stringify(e,c(n),i);0!==t.length;){var a=t.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return s}function o(e,n,i,s){var a;if("object"==typeof e&&null!==e){for(a=0;a<i.length;a++)if(i[a]===e){var c=Object.getOwnPropertyDescriptor(s,n);return void(void 0!==c.get?c.configurable?(Object.defineProperty(s,n,{value:"[Circular]"}),t.push([s,n,e,c])):r.push([e,n]):(s[n]="[Circular]",t.push([s,n,e])))}if(i.push(e),Array.isArray(e))for(a=0;a<e.length;a++)o(e[a],a,i,e);else{var u=Object.keys(e);for(a=0;a<u.length;a++){var l=u[a];o(e[l],l,i,e)}}i.pop()}}function i(e,t){return e<t?-1:e>t?1:0}function s(e,n,o){var i,s=a(e,"",[],void 0)||e;for(i=0===r.length?JSON.stringify(s,n,o):JSON.stringify(s,c(n),o);0!==t.length;){var u=t.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}return i}function a(e,n,o,s){var c;if("object"==typeof e&&null!==e){for(c=0;c<o.length;c++)if(o[c]===e){var u=Object.getOwnPropertyDescriptor(s,n);return void(void 0!==u.get?u.configurable?(Object.defineProperty(s,n,{value:"[Circular]"}),t.push([s,n,e,u])):r.push([e,n]):(s[n]="[Circular]",t.push([s,n,e])))}if("function"==typeof e.toJSON)return;if(o.push(e),Array.isArray(e))for(c=0;c<e.length;c++)a(e[c],c,o,e);else{var l={},p=Object.keys(e).sort(i);for(c=0;c<p.length;c++){var f=p[c];a(e[f],f,o,e),l[f]=e[f]}if(void 0===s)return l;t.push([s,n,e]),s[n]=l}o.pop()}}function c(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(r.length>0)for(var o=0;o<r.length;o++){var i=r[o];if(i[1]===t&&i[0]===n){n="[Circular]",r.splice(o,1);break}}return e.call(this,t,n)}}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(t+i);for(var s,a=r.call(arguments,1),c=function(){if(this instanceof s){var t=i.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(r.call(arguments)))},u=Math.max(0,i.length-a.length),l=[],p=0;p<u;p++)l.push("$"+p);if(s=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(c),i.prototype){var f=function(){};f.prototype=i.prototype,s.prototype=new f,f.prototype=null}return s}},612:(e,t,r)=>{"use strict";var n=r(648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var u=function(){throw new s},l=c?function(){try{return u}catch(e){try{return c(arguments,"callee").get}catch(e){return u}}}():u,p=r(405)(),f=Object.getPrototypeOf||function(e){return e.__proto__},h={},d="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":p?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":h,"%AsyncGenerator%":h,"%AsyncGeneratorFunction%":h,"%AsyncIteratorPrototype%":h,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":h,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?f(""[Symbol.iterator]()):n,"%Symbol%":p?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":l,"%TypedArray%":d,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet},b=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=f(o.prototype))}return y[t]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=r(612),v=r(642),O=g.call(Function.call,Array.prototype.concat),w=g.call(Function.apply,Array.prototype.splice),E=g.call(Function.call,String.prototype.replace),D=g.call(Function.call,String.prototype.slice),j=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,x=/\\(\\)?/g,_=function(e){var t=D(e,0,1),r=D(e,-1);if("%"===t&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return E(e,j,(function(e,t,r,o){n[n.length]=r?E(o,x,"$1"):t||e})),n},C=function(e,t){var r,n=e;if(v(m,n)&&(n="%"+(r=m[n])[0]+"%"),v(y,n)){var i=y[n];if(i===h&&(i=b(n)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var r=_(e),n=r.length>0?r[0]:"",i=C("%"+n+"%",t),a=i.name,u=i.value,l=!1,p=i.alias;p&&(n=p[0],w(r,O([0,1],p)));for(var f=1,h=!0;f<r.length;f+=1){var d=r[f],b=D(d,0,1),m=D(d,-1);if(('"'===b||"'"===b||"`"===b||'"'===m||"'"===m||"`"===m)&&b!==m)throw new o("property names with quotes must have matching quotes");if("constructor"!==d&&h||(l=!0),v(y,a="%"+(n+="."+d)+"%"))u=y[a];else if(null!=u){if(!(d in u)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&f+1>=r.length){var g=c(u,d);u=(h=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:u[d]}else h=v(u,d),u=u[d];h&&!l&&(y[a]=u)}}return u}},221:e=>{"use strict";"undefined"!=typeof self?e.exports=self:"undefined"!=typeof window?e.exports=window:e.exports=Function("return this")()},503:(e,t,r)=>{"use strict";var n=r(289),o=r(221),i=r(168),s=r(471),a=i(),c=function(){return a};n(c,{getPolyfill:i,implementation:o,shim:s}),e.exports=c},168:(e,t,r)=>{"use strict";var n=r(221);e.exports=function(){return"object"==typeof r.g&&r.g&&r.g.Math===Math&&r.g.Array===Array?r.g:n}},471:(e,t,r)=>{"use strict";var n=r(289),o=r(168);e.exports=function(){var e=o();if(n.supportsDescriptors){var t=Object.getOwnPropertyDescriptor(e,"globalThis");(!t||t.configurable&&(t.enumerable||t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!1})}else"object"==typeof globalThis&&globalThis===e||(e.globalThis=e);return e}},405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,r)=>{"use strict";var n=r(612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},679:e=>{e.exports=function(e){var t={},r=[];(e=e||this).on=function(r,n,o){return(t[r]=t[r]||[]).push([n,o]),e},e.off=function(n,o){n||(t={});for(var i=t[n]||r,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(n){for(var o,i=t[n]||r,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],r.slice.call(arguments,1));return e}}},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=n&&o&&"function"==typeof o.get?o.get:null,s=n&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=a&&c&&"function"==typeof c.get?c.get:null,l=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,f="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,m=String.prototype.match,g="function"==typeof BigInt?BigInt.prototype.valueOf:null,v=Object.getOwnPropertySymbols,O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,w="function"==typeof Symbol&&"object"==typeof Symbol.iterator,E=Object.prototype.propertyIsEnumerable,D=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),j=r(654).custom,x=j&&T(j)?j:null,_="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null;function C(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function A(e){return String(e).replace(/"/g,"&quot;")}function S(e){return!("[object Array]"!==I(e)||_&&"object"==typeof e&&_ in e)}function T(e){if(w)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!O)return!1;try{return O.call(e),!0}catch(e){}return!1}e.exports=function e(t,r,n,o){var a=r||{};if(P(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(P(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!P(a,"customInspect")||a.customInspect;if("boolean"!=typeof c)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(P(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return F(t,a);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var y=void 0===a.depth?5:a.depth;if(void 0===n&&(n=0),n>=y&&y>0&&"object"==typeof t)return S(t)?"[Array]":"[Object]";var v,E=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=Array(e.indent+1).join(" ")}return{base:r,prev:Array(t+1).join(r)}}(a,n);if(void 0===o)o=[];else if(N(o,t)>=0)return"[Circular]";function j(t,r,i){if(r&&(o=o.slice()).push(r),i){var s={depth:a.depth};return P(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,n+1,o)}return e(t,a,n+1,o)}if("function"==typeof t){var k=function(e){if(e.name)return e.name;var t=m.call(b.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),R=z(t,j);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(R.length>0?" { "+R.join(", ")+" }":"")}if(T(t)){var $=w?String(t).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(t);return"object"!=typeof t||w?$:B($)}if((v=t)&&"object"==typeof v&&("undefined"!=typeof HTMLElement&&v instanceof HTMLElement||"string"==typeof v.nodeName&&"function"==typeof v.getAttribute)){for(var H="<"+String(t.nodeName).toLowerCase(),q=t.attributes||[],V=0;V<q.length;V++)H+=" "+q[V].name+"="+C(A(q[V].value),"double",a);return H+=">",t.childNodes&&t.childNodes.length&&(H+="..."),H+"</"+String(t.nodeName).toLowerCase()+">"}if(S(t)){if(0===t.length)return"[]";var W=z(t,j);return E&&!function(e){for(var t=0;t<e.length;t++)if(N(e[t],"\n")>=0)return!1;return!0}(W)?"["+U(W,E)+"]":"[ "+W.join(", ")+" ]"}if(function(e){return!("[object Error]"!==I(e)||_&&"object"==typeof e&&_ in e)}(t)){var G=z(t,j);return 0===G.length?"["+String(t)+"]":"{ ["+String(t)+"] "+G.join(", ")+" }"}if("object"==typeof t&&c){if(x&&"function"==typeof t[x])return t[x]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{u.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var K=[];return s.call(t,(function(e,r){K.push(j(r,t,!0)+" => "+j(e,t))})),M("Map",i.call(t),K,E)}if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{u.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var Y=[];return l.call(t,(function(e){Y.push(j(e,t))})),M("Set",u.call(t),Y,E)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return L("WeakMap");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return L("WeakSet");if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{return h.call(e),!0}catch(e){}return!1}(t))return L("WeakRef");if(function(e){return!("[object Number]"!==I(e)||_&&"object"==typeof e&&_ in e)}(t))return B(j(Number(t)));if(function(e){if(!e||"object"!=typeof e||!g)return!1;try{return g.call(e),!0}catch(e){}return!1}(t))return B(j(g.call(t)));if(function(e){return!("[object Boolean]"!==I(e)||_&&"object"==typeof e&&_ in e)}(t))return B(d.call(t));if(function(e){return!("[object String]"!==I(e)||_&&"object"==typeof e&&_ in e)}(t))return B(j(String(t)));if(!function(e){return!("[object Date]"!==I(e)||_&&"object"==typeof e&&_ in e)}(t)&&!function(e){return!("[object RegExp]"!==I(e)||_&&"object"==typeof e&&_ in e)}(t)){var J=z(t,j),Q=D?D(t)===Object.prototype:t instanceof Object||t.constructor===Object,Z=t instanceof Object?"":"null prototype",X=!Q&&_&&Object(t)===t&&_ in t?I(t).slice(8,-1):Z?"Object":"",ee=(Q||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(X||Z?"["+[].concat(X||[],Z||[]).join(": ")+"] ":"");return 0===J.length?ee+"{}":E?ee+"{"+U(J,E)+"}":ee+"{ "+J.join(", ")+" }"}return String(t)};var k=Object.prototype.hasOwnProperty||function(e){return e in this};function P(e,t){return k.call(e,t)}function I(e){return y.call(e)}function N(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function F(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return F(e.slice(0,t.maxStringLength),t)+n}return C(e.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,R),"single",t)}function R(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+t.toString(16).toUpperCase()}function B(e){return"Object("+e+")"}function L(e){return e+" { ? }"}function M(e,t,r,n){return e+" ("+t+") {"+(n?U(r,n):r.join(", "))+"}"}function U(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+e.join(","+r)+"\n"+t.prev}function z(e,t){var r=S(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=P(e,o)?t(e[o],e):""}var i,s="function"==typeof v?v(e):[];if(w){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var c in e)P(e,c)&&(r&&String(Number(c))===c&&c<e.length||w&&i["$"+c]instanceof Symbol||(/[^\w$]/.test(c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if("function"==typeof v)for(var u=0;u<s.length;u++)E.call(e,s[u])&&n.push("["+t(s[u])+"]: "+t(e[s[u]],e));return n}},987:(e,t,r)=>{"use strict";var n;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=r(414),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&o.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{p(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===i.call(e),n=s(e),a=t&&"[object String]"===i.call(e),f=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var d=u&&r;if(a&&e.length>0&&!o.call(e,0))for(var y=0;y<e.length;++y)f.push(String(y));if(n&&e.length>0)for(var b=0;b<e.length;++b)f.push(String(b));else for(var m in e)d&&"prototype"===m||!o.call(e,m)||f.push(String(m));if(c)for(var g=function(e){if("undefined"==typeof window||!h)return p(e);try{return p(e)}catch(e){return!1}}(e),v=0;v<l.length;++v)g&&"constructor"===l[v]||!o.call(e,l[v])||f.push(l[v]);return f}}e.exports=n},215:(e,t,r)=>{"use strict";var n=Array.prototype.slice,o=r(414),i=Object.keys,s=i?function(e){return i(e)}:r(987),a=Object.keys;s.shim=function(){return Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return o(e)?a(n.call(e)):a(e)}):Object.keys=s,Object.keys||s},e.exports=s},414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},798:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC3986";e.exports={default:n,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:n}},129:(e,t,r)=>{"use strict";var n=r(261),o=r(235),i=r(798);e.exports={formats:i,parse:o,stringify:n}},235:(e,t,r)=>{"use strict";var n=r(769),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},u=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(i),u=a?i.slice(0,a.index):i,l=[];if(u){if(!r.plainObjects&&o.call(Object.prototype,u)&&!r.allowPrototypes)return;l.push(u)}for(var p=0;r.depth>0&&null!==(a=s.exec(i))&&p<r.depth;){if(p+=1,!r.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(a[1])}return a&&l.push("["+i.slice(a.index)+"]"),function(e,t,r,n){for(var o=n?t:c(t,r),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&r.parseArrays)s=[].concat(o);else{s=r.plainObjects?Object.create(null):{};var u="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(u,10);r.parseArrays||""!==u?!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(s=[])[l]=o:s[u]=o:s={0:o}}o=s}return o}(l,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var r,u={},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,f=l.split(t.delimiter,p),h=-1,d=t.charset;if(t.charsetSentinel)for(r=0;r<f.length;++r)0===f[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===f[r]?d="utf-8":"utf8=%26%2310003%3B"===f[r]&&(d="iso-8859-1"),h=r,r=f.length);for(r=0;r<f.length;++r)if(r!==h){var y,b,m=f[r],g=m.indexOf("]="),v=-1===g?m.indexOf("="):g+1;-1===v?(y=t.decoder(m,s.decoder,d,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(m.slice(0,v),s.decoder,d,"key"),b=n.maybeMap(c(m.slice(v+1),t),(function(e){return t.decoder(e,s.decoder,d,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===d&&(b=a(b)),m.indexOf("[]=")>-1&&(b=i(b)?[b]:b),o.call(u,y)?u[y]=n.combine(u[y],b):u[y]=b}return u}(e,r):e,p=r.plainObjects?Object.create(null):{},f=Object.keys(l),h=0;h<f.length;++h){var d=f[h],y=u(d,l[d],r,"string"==typeof e);p=n.merge(p,y,r)}return!0===r.allowSparse?p:n.compact(p)}},261:(e,t,r)=>{"use strict";var n=r(478),o=r(769),i=r(798),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,u=Array.prototype.push,l=function(e,t){u.apply(e,c(t)?t:[t])},p=Date.prototype.toISOString,f=i.default,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:f,formatter:i.formatters[f],indices:!1,serializeDate:function(e){return p.call(e)},skipNulls:!1,strictNullHandling:!1},d=function e(t,r,i,s,a,u,p,f,d,y,b,m,g,v,O){var w,E=t;if(O.has(t))throw new RangeError("Cyclic object value");if("function"==typeof p?E=p(r,E):E instanceof Date?E=y(E):"comma"===i&&c(E)&&(E=o.maybeMap(E,(function(e){return e instanceof Date?y(e):e}))),null===E){if(s)return u&&!g?u(r,h.encoder,v,"key",b):r;E=""}if("string"==typeof(w=E)||"number"==typeof w||"boolean"==typeof w||"symbol"==typeof w||"bigint"==typeof w||o.isBuffer(E))return u?[m(g?r:u(r,h.encoder,v,"key",b))+"="+m(u(E,h.encoder,v,"value",b))]:[m(r)+"="+m(String(E))];var D,j=[];if(void 0===E)return j;if("comma"===i&&c(E))D=[{value:E.length>0?E.join(",")||null:void 0}];else if(c(p))D=p;else{var x=Object.keys(E);D=f?x.sort(f):x}for(var _=0;_<D.length;++_){var C=D[_],A="object"==typeof C&&void 0!==C.value?C.value:E[C];if(!a||null!==A){var S=c(E)?"function"==typeof i?i(r,C):r:r+(d?"."+C:"["+C+"]");O.set(t,!0);var T=n();l(j,e(A,S,i,s,a,u,p,f,d,y,b,m,g,v,T))}}return j};e.exports=function(e,t){var r,o=e,u=function(e){if(!e)return h;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||h.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=i.formatters[r],o=h.filter;return("function"==typeof e.filter||c(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===e.allowDots?h.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:h.charsetSentinel,delimiter:void 0===e.delimiter?h.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:h.encode,encoder:"function"==typeof e.encoder?e.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:h.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:h.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:h.strictNullHandling}}(t);"function"==typeof u.filter?o=(0,u.filter)("",o):c(u.filter)&&(r=u.filter);var p,f=[];if("object"!=typeof o||null===o)return"";p=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var y=a[p];r||(r=Object.keys(o)),u.sort&&r.sort(u.sort);for(var b=n(),m=0;m<r.length;++m){var g=r[m];u.skipNulls&&null===o[g]||l(f,d(o[g],g,y,u.strictNullHandling,u.skipNulls,u.encode?u.encoder:null,u.filter,u.sort,u.allowDots,u.serializeDate,u.format,u.formatter,u.encodeValuesOnly,u.charset,b))}var v=f.join(u.delimiter),O=!0===u.addQueryPrefix?"?":"";return u.charsetSentinel&&("iso-8859-1"===u.charset?O+="utf8=%26%2310003%3B&":O+="utf8=%E2%9C%93&"),v.length>0?O+v:""}},769:(e,t,r)=>{"use strict";var n=r(798),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var u=a[c],l=s[u];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:s,prop:u}),r.push(l))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===r)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",u=0;u<a.length;++u){var l=a.charCodeAt(u);45===l||46===l||95===l||126===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===n.RFC1738&&(40===l||41===l)?c+=a.charAt(u):l<128?c+=s[l]:l<2048?c+=s[192|l>>6]+s[128|63&l]:l<55296||l>=57344?c+=s[224|l>>12]+s[128|l>>6&63]+s[128|63&l]:(u+=1,l=65536+((1023&l)<<10|1023&a.charCodeAt(u)),c+=s[240|l>>18]+s[128|l>>12&63]+s[128|l>>6&63]+s[128|63&l])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return i(t)&&!i(r)&&(s=a(t,n)),i(t)&&i(r)?(r.forEach((function(r,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&r&&"object"==typeof r?t[i]=e(s,r,n):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var s=r[i];return o.call(t,i)?t[i]=e(t[i],s,n):t[i]=s,t}),s)}}},478:(e,t,r)=>{"use strict";var n=r(210),o=r(924),i=r(631),s=n("%TypeError%"),a=n("%WeakMap%",!0),c=n("%Map%",!0),u=o("WeakMap.prototype.get",!0),l=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),f=o("Map.prototype.get",!0),h=o("Map.prototype.set",!0),d=o("Map.prototype.has",!0),y=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new s("Side channel does not contain "+i(e))},get:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return u(e,n)}else if(c){if(t)return f(t,n)}else if(r)return function(e,t){var r=y(e,t);return r&&r.value}(r,n)},has:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(e)return p(e,n)}else if(c){if(t)return d(t,n)}else if(r)return function(e,t){return!!y(e,t)}(r,n);return!1},set:function(n,o){a&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new a),l(e,n,o)):c?(t||(t=new c),h(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=y(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n}},839:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,r=e.Symbol;if("function"==typeof r)if(r.observable)t=r.observable;else{t=r.for("https://github.com/benlesh/symbol-observable");try{r.observable=t}catch(e){}}else t="@@observable";return t}},868:(e,t,r)=>{e.exports=r(839)},813:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NO_IL=t.NO=t.MemoryStream=t.Stream=void 0;var i=r(868),s=r(503),a=i.default(s.getPolyfill()),c={};function u(){}function l(e){for(var t=e.length,r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function p(e,t,r){try{return e.f(t)}catch(e){return r._e(e),c}}t.NO=c;var f={_n:u,_e:u,_c:u};function h(e){e._start=function(e){e.next=e._n,e.error=e._e,e.complete=e._c,this.start(e)},e._stop=e.stop}t.NO_IL=f;var d=function(){function e(e,t){this._stream=e,this._listener=t}return e.prototype.unsubscribe=function(){this._stream._remove(this._listener)},e}(),y=function(){function e(e){this._listener=e}return e.prototype.next=function(e){this._listener._n(e)},e.prototype.error=function(e){this._listener._e(e)},e.prototype.complete=function(){this._listener._c()},e}(),b=function(){function e(e){this.type="fromObservable",this.ins=e,this.active=!1}return e.prototype._start=function(e){this.out=e,this.active=!0,this._sub=this.ins.subscribe(new y(e)),this.active||this._sub.unsubscribe()},e.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},e}(),m=function(){function e(e){this.type="merge",this.insArr=e,this.out=c,this.ac=0}return e.prototype._start=function(e){this.out=e;var t=this.insArr,r=t.length;this.ac=r;for(var n=0;n<r;n++)t[n]._add(this)},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,r=0;r<t;r++)e[r]._remove(this);this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){if(--this.ac<=0){var e=this.out;if(e===c)return;e._c()}},e}(),g=function(){function e(e,t,r){this.i=e,this.out=t,this.p=r,r.ils.push(this)}return e.prototype._n=function(e){var t=this.p,r=this.out;if(r!==c&&t.up(e,this.i)){var n=l(t.vals);r._n(n)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.p;e.out!==c&&0==--e.Nc&&e.out._c()},e}(),v=function(){function e(e){this.type="combine",this.insArr=e,this.out=c,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return e.prototype.up=function(e,t){var r=this.vals[t],n=this.Nn?r===c?--this.Nn:this.Nn:0;return this.vals[t]=e,0===n},e.prototype._start=function(e){this.out=e;var t=this.insArr,r=this.Nc=this.Nn=t.length,n=this.vals=new Array(r);if(0===r)e._n([]),e._c();else for(var o=0;o<r;o++)n[o]=c,t[o]._add(new g(o,e,this))},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,r=this.ils,n=0;n<t;n++)e[n]._remove(r[n]);this.out=c,this.ils=[],this.vals=[]},e}(),O=function(){function e(e){this.type="fromArray",this.a=e}return e.prototype._start=function(e){for(var t=this.a,r=0,n=t.length;r<n;r++)e._n(t[r]);e._c()},e.prototype._stop=function(){},e}(),w=function(){function e(e){this.type="fromPromise",this.on=!1,this.p=e}return e.prototype._start=function(e){var t=this;this.on=!0,this.p.then((function(r){t.on&&(e._n(r),e._c())}),(function(t){e._e(t)})).then(u,(function(e){setTimeout((function(){throw e}))}))},e.prototype._stop=function(){this.on=!1},e}(),E=function(){function e(e){this.type="periodic",this.period=e,this.intervalID=-1,this.i=0}return e.prototype._start=function(e){var t=this;this.intervalID=setInterval((function(){e._n(t.i++)}),this.period)},e.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},e}(),D=function(){function e(e,t){this.type="debug",this.ins=e,this.out=c,this.s=u,this.l="","string"==typeof t?this.l=t:"function"==typeof t&&(this.s=t)}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=this.s,n=this.l;if(r!==u)try{r(e)}catch(e){t._e(e)}else n?console.log(n+":",e):console.log(e);t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),j=function(){function e(e,t){this.type="drop",this.ins=t,this.out=c,this.max=e,this.dropped=0}return e.prototype._start=function(e){this.out=e,this.dropped=0,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&this.dropped++>=this.max&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),x=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(){this.op.end()},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.end()},e}(),_=function(){function e(e,t){this.type="endWhen",this.ins=t,this.out=c,this.o=e,this.oil=f}return e.prototype._start=function(e){this.out=e,this.o._add(this.oil=new x(e,this)),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=c,this.oil=f},e.prototype.end=function(){var e=this.out;e!==c&&e._c()},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.end()},e}(),C=function(){function e(e,t){this.type="filter",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&r&&t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),A=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(e){this.out._n(e)},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.inner=c,this.op.less()},e}(),S=function(){function e(e){this.type="flatten",this.ins=e,this.out=c,this.open=!0,this.inner=c,this.il=f}return e.prototype._start=function(e){this.out=e,this.open=!0,this.inner=c,this.il=f,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.inner!==c&&this.inner._remove(this.il),this.out=c,this.open=!0,this.inner=c,this.il=f},e.prototype.less=function(){var e=this.out;e!==c&&(this.open||this.inner!==c||e._c())},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=this.inner,n=this.il;r!==c&&n!==f&&r._remove(n),(this.inner=e)._add(this.il=new A(t,this))}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.open=!1,this.less()},e}(),T=function(){function e(e,t,r){var n=this;this.type="fold",this.ins=r,this.out=c,this.f=function(t){return e(n.acc,t)},this.acc=this.seed=t}return e.prototype._start=function(e){this.out=e,this.acc=this.seed,e._n(this.acc),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.acc=this.seed},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&t._n(this.acc=r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),k=function(){function e(e){this.type="last",this.ins=e,this.out=c,this.has=!1,this.val=c}return e.prototype._start=function(e){this.out=e,this.has=!1,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.val=c},e.prototype._n=function(e){this.has=!0,this.val=e},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&(this.has?(e._n(this.val),e._c()):e._e(new Error("last() failed because input stream completed")))},e}(),P=function(){function e(e,t){this.type="map",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=p(this,e,t);r!==c&&t._n(r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),I=function(){function e(e){this.type="remember",this.ins=e,this.out=c}return e.prototype._start=function(e){this.out=e,this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),N=function(){function e(e,t){this.type="replaceError",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;if(t!==c)try{this.ins._remove(this),(this.ins=this.f(e))._add(this)}catch(e){t._e(e)}},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),F=function(){function e(e,t){this.type="startWith",this.ins=e,this.out=c,this.val=t}return e.prototype._start=function(e){this.out=e,this.out._n(this.val),this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),R=function(){function e(e,t){this.type="take",this.ins=t,this.out=c,this.max=e,this.taken=0}return e.prototype._start=function(e){this.out=e,this.taken=0,this.max<=0?e._c():this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var r=++this.taken;r<this.max?t._n(e):r===this.max&&(t._n(e),t._c())}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),B=function(){function e(e){this._prod=e||c,this._ils=[],this._stopID=c,this._dl=c,this._d=!1,this._target=null,this._err=c}return e.prototype._n=function(e){var t=this._ils,r=t.length;if(this._d&&this._dl._n(e),1==r)t[0]._n(e);else{if(0==r)return;for(var n=l(t),o=0;o<r;o++)n[o]._n(e)}},e.prototype._e=function(e){if(this._err===c){this._err=e;var t=this._ils,r=t.length;if(this._x(),this._d&&this._dl._e(e),1==r)t[0]._e(e);else{if(0==r)return;for(var n=l(t),o=0;o<r;o++)n[o]._e(e)}if(!this._d&&0==r)throw this._err}},e.prototype._c=function(){var e=this._ils,t=e.length;if(this._x(),this._d&&this._dl._c(),1==t)e[0]._c();else{if(0==t)return;for(var r=l(e),n=0;n<t;n++)r[n]._c()}},e.prototype._x=function(){0!==this._ils.length&&(this._prod!==c&&this._prod._stop(),this._err=c,this._ils=[])},e.prototype._stopNow=function(){this._prod._stop(),this._err=c,this._stopID=c},e.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var r=this._ils;if(r.push(e),!(r.length>1))if(this._stopID!==c)clearTimeout(this._stopID),this._stopID=c;else{var n=this._prod;n!==c&&n._start(this)}},e.prototype._remove=function(e){var t=this,r=this._target;if(r)return r._remove(e);var n=this._ils,o=n.indexOf(e);o>-1&&(n.splice(o,1),this._prod!==c&&n.length<=0?(this._err=c,this._stopID=setTimeout((function(){return t._stopNow()}))):1===n.length&&this._pruneCycles())},e.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},e.prototype._hasNoSinks=function(e,t){if(-1!==t.indexOf(e))return!0;if(e.out===this)return!0;if(e.out&&e.out!==c)return this._hasNoSinks(e.out,t.concat(e));if(e._ils){for(var r=0,n=e._ils.length;r<n;r++)if(!this._hasNoSinks(e._ils[r],t.concat(e)))return!1;return!0}return!1},e.prototype.ctor=function(){return this instanceof L?L:e},e.prototype.addListener=function(e){e._n=e.next||u,e._e=e.error||u,e._c=e.complete||u,this._add(e)},e.prototype.removeListener=function(e){this._remove(e)},e.prototype.subscribe=function(e){return this.addListener(e),new d(this,e)},e.prototype[a]=function(){return this},e.create=function(t){if(t){if("function"!=typeof t.start||"function"!=typeof t.stop)throw new Error("producer requires both start and stop functions");h(t)}return new e(t)},e.createWithMemory=function(e){return e&&h(e),new L(e)},e.never=function(){return new e({_start:u,_stop:u})},e.empty=function(){return new e({_start:function(e){e._c()},_stop:u})},e.throw=function(t){return new e({_start:function(e){e._e(t)},_stop:u})},e.from=function(t){if("function"==typeof t[a])return e.fromObservable(t);if("function"==typeof t.then)return e.fromPromise(t);if(Array.isArray(t))return e.fromArray(t);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},e.of=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.fromArray(t)},e.fromArray=function(t){return new e(new O(t))},e.fromPromise=function(t){return new e(new w(t))},e.fromObservable=function(t){if(void 0!==t.endWhen)return t;var r="function"==typeof t[a]?t[a]():t;return new e(new b(r))},e.periodic=function(t){return new e(new E(t))},e.prototype._map=function(e){return new(this.ctor())(new P(e,this))},e.prototype.map=function(e){return this._map(e)},e.prototype.mapTo=function(e){var t=this.map((function(){return e}));return t._prod.type="mapTo",t},e.prototype.filter=function(t){var r,n,o=this._prod;return new e(o instanceof C?new C((r=o.f,n=t,function(e){return r(e)&&n(e)}),o.ins):new C(t,this))},e.prototype.take=function(e){return new(this.ctor())(new R(e,this))},e.prototype.drop=function(t){return new e(new j(t,this))},e.prototype.last=function(){return new e(new k(this))},e.prototype.startWith=function(e){return new L(new F(this,e))},e.prototype.endWhen=function(e){return new(this.ctor())(new _(e,this))},e.prototype.fold=function(e,t){return new L(new T(e,t,this))},e.prototype.replaceError=function(e){return new(this.ctor())(new N(e,this))},e.prototype.flatten=function(){return new e(new S(this))},e.prototype.compose=function(e){return e(this)},e.prototype.remember=function(){return new L(new I(this))},e.prototype.debug=function(e){return new(this.ctor())(new D(this,e))},e.prototype.imitate=function(e){if(e instanceof L)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=e;for(var t=this._ils,r=t.length,n=0;n<r;n++)e._add(t[n]);this._ils=[]},e.prototype.shamefullySendNext=function(e){this._n(e)},e.prototype.shamefullySendError=function(e){this._e(e)},e.prototype.shamefullySendComplete=function(){this._c()},e.prototype.setDebugListener=function(e){e?(this._d=!0,e._n=e.next||u,e._e=e.error||u,e._c=e.complete||u,this._dl=e):(this._d=!1,this._dl=c)},e.merge=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(new m(t))},e.combine=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e(new v(t))},e}();t.Stream=B;var L=function(e){function t(t){var r=e.call(this,t)||this;return r._has=!1,r}return o(t,e),t.prototype._n=function(t){this._v=t,this._has=!0,e.prototype._n.call(this,t)},t.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var r=this._ils;if(r.push(e),r.length>1)this._has&&e._n(this._v);else if(this._stopID!==c)this._has&&e._n(this._v),clearTimeout(this._stopID),this._stopID=c;else if(this._has)e._n(this._v);else{var n=this._prod;n!==c&&n._start(this)}},t.prototype._stopNow=function(){this._has=!1,e.prototype._stopNow.call(this)},t.prototype._x=function(){this._has=!1,e.prototype._x.call(this)},t.prototype.map=function(e){return this._map(e)},t.prototype.mapTo=function(t){return e.prototype.mapTo.call(this,t)},t.prototype.take=function(t){return e.prototype.take.call(this,t)},t.prototype.endWhen=function(t){return e.prototype.endWhen.call(this,t)},t.prototype.replaceError=function(t){return e.prototype.replaceError.call(this,t)},t.prototype.remember=function(){return this},t.prototype.debug=function(t){return e.prototype.debug.call(this,t)},t}(B);t.MemoryStream=L;var M=B;t.default=M},654:()=>{}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{API:()=>tp,AgentInfo:()=>jp,AppFrame:()=>Bs,ChatFrame:()=>ju,ComponentFilter:()=>zc,Conversation:()=>Hc,DeprecatedToggleButton:()=>_p,DeprecatedView:()=>Ip,Engine:()=>mp,EntryContainer:()=>yu,EventParticipant:()=>Ys,ExternalApi:()=>Dp,Header:()=>xp,Icon:()=>fi,Interrupt:()=>Ls,MessageContainer:()=>ta,SeamlyApiContext:()=>Lr,SeamlyEventBusContext:()=>Mr,SeamlyGeneralError:()=>Gn,SeamlyLiveRegionContext:()=>vo,SeamlyOfflineError:()=>Yn,StoreProvider:()=>R,Text:()=>ya,View:()=>ku,calculateVisibility:()=>Kt,className:()=>Br,createReduxStore:()=>K,default:()=>Np,eventTypes:()=>ge,getUrlParams:()=>ce,getUrlSearchString:()=>ue,randomId:()=>i,seamlyActions:()=>Ne,useChoicePrompt:()=>sa,useDispatch:()=>qr,useEvents:()=>nr,useGeneratedId:()=>Un,useI18n:()=>hn,useSeamlyChat:()=>To,useSeamlyCommands:()=>go,useSeamlyConfig:()=>ee,useSeamlyEventStream:()=>zo,useSeamlyIdleDetachCountdown:()=>Lo,useSeamlyMessageContainerClassNames:()=>Wr,useSeamlyOptions:()=>kn,useSeamlyVisibility:()=>so,useTranslatedEventData:()=>oi,useTranslations:()=>ni,useTranslationsContainer:()=>ii,visibilityStates:()=>_}),r(698);const e=require("preact");var t=r(679),o=r.n(t);function i(){return"_"+(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const c="//";function u(e,t,r="/"){return(n,...o)=>t(e+r+n,...o)}function l(e,t=(e=>({payload:e}))){const r=(...r)=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:e},t(...r));return r.toString=()=>String(e),r.match=t=>(null==t?void 0:t.type)===String(e),r}function p(e,...t){const r=[];t.forEach((e=>{const t=typeof e;if("string"===t)return r.push([e]);"object"!==t||e instanceof Array||Object.keys(e).forEach((t=>r.push([t,e[t]])))}));const n=u(e,l,"/");return r.map((e=>n(...e)))}function f(e,t){const[r,n,o]=p(e,{pending:(e,t)=>({meta:{arg:e,requestId:t,status:"pending"}}),fulfilled:(e,t,r)=>({payload:t,meta:{arg:e,requestId:r,status:"fulfilled"}}),rejected:(e,t,r)=>({error:t,meta:{arg:e,requestId:r,status:"rejected",error:String(t)}})});return Object.assign((s=>(a,c,u)=>{const l=i(),p=(async()=>{let e;try{a(r(s,l));const o=t(s,{dispatch:a,getState:c,extra:u}),i=await o;e=n(s,i,l)}catch(t){e=o(s,t,l)}return a(e),e})();return Object.assign(p,{type:e,arg:s,requestId:l})}),{type:e,pending:r,fulfilled:n,rejected:o})}function h(e){return{createAction:u(e,l,c),createActions:u(e,p,c),createThunk:u(e,f,c),createReducer:(t,r)=>function(e,t={},r){const n=(e=r,n)=>{const o=null==t?void 0:t[null==n?void 0:n.type];return o?o(e,n):e};return n.toString=()=>e,n}(e,t,r),selectState:t=>t[e]}}const{createAction:d,createThunk:y,createReducer:b,selectState:m}=h("config"),g=d("initialize",(e=>({config:e}))),v=d("update",(e=>({config:e}))),O=d("setPreChatEvents",(e=>({events:e})));function w(e,t){return e===t}function E(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}function D(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}var j=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=0,s=n.pop(),a=D(n),c=e.apply(void 0,[function(){return i++,s.apply(null,arguments)}].concat(r)),u=e((function(){for(var e=[],t=a.length,r=0;r<t;r++)e.push(a[r].apply(null,arguments));return c.apply(null,e)}));return u.resultFunc=s,u.dependencies=a,u.recomputations=function(){return i},u.resetRecomputations=function(){return i=0},u}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w,r=null,n=null;return function(){return E(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}}));const x="visibility",_={hidden:"hidden",minimized:"minimized",open:"open",initialize:null};function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const T=j(m,(e=>{let t=A({visible:"inline"===(null==e?void 0:e.layoutMode)?_.open:_.minimized,appContainerClassNames:e.appContainerClassNames||[]},e);return"function"==typeof t.appContainerClassNames&&(t=A(A({},t),{},{appContainerClassNames:t.appContainerClassNames(t)})),t})),k=(0,e.createContext)(void 0),P=k,{Provider:I,Consumer:N}=k,F=require("preact/jsx-runtime");function R({store:e,children:t}){return(0,F.jsx)(I,{value:e,children:t})}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function U(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 z="function"==typeof Symbol&&Symbol.observable||"@@observable",$=function(){return Math.random().toString(36).substring(7).split("").join(".")},H={INIT:"@@redux/INIT"+$(),REPLACE:"@@redux/REPLACE"+$(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$()}};function q(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function V(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(U(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(U(1));return r(V)(e,t)}if("function"!=typeof e)throw new Error(U(2));var o=e,i=t,s=[],a=s,c=!1;function u(){a===s&&(a=s.slice())}function l(){if(c)throw new Error(U(3));return i}function p(e){if("function"!=typeof e)throw new Error(U(4));if(c)throw new Error(U(5));var t=!0;return u(),a.push(e),function(){if(t){if(c)throw new Error(U(6));t=!1,u();var r=a.indexOf(e);a.splice(r,1),s=null}}}function f(e){if(!q(e))throw new Error(U(7));if(void 0===e.type)throw new Error(U(8));if(c)throw new Error(U(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,r=0;r<t.length;r++)(0,t[r])();return e}function h(e){if("function"!=typeof e)throw new Error(U(10));o=e,f({type:H.REPLACE})}function d(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(U(11));function r(){e.next&&e.next(l())}return r(),{unsubscribe:t(r)}}})[z]=function(){return this},e}return f({type:H.INIT}),(n={dispatch:f,subscribe:p,getState:l,replaceReducer:h})[z]=d,n}function W(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}let G=W;function K({reducers:e={},initialState:t={},middlewares:r=[]}={}){return V(function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];"function"==typeof e[o]&&(r[o]=e[o])}var i,s=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:H.INIT}))throw new Error(U(12));if(void 0===r(void 0,{type:H.PROBE_UNKNOWN_ACTION()}))throw new Error(U(13))}))}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},a=0;a<s.length;a++){var c=s[a],u=r[c],l=e[c],p=u(l,t);if(void 0===p)throw t&&t.type,new Error(U(14));o[c]=p,n=n||p!==l}return(n=n||s.length!==Object.keys(e).length)?o:e}}(e),t,G(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error(U(15))},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return n=W.apply(void 0,i)(r.dispatch),M(M({},r),{},{dispatch:n})}}}(...r)))}const Y=require("preact/hooks");function J(){return(0,Y.useContext)(P)}function Q(){return J().dispatch}function Z(e,t=[]){const r=J(),[,n]=(0,Y.useReducer)((e=>e+1),0),o=(0,Y.useRef)(),i=(0,Y.useCallback)(e,t),s=(0,Y.useRef)(),a=(0,Y.useRef)(),c=r.getState();return s.current===i&&a.current===c||(a.current=c,o.current=i(a.current),s.current=i),(0,Y.useLayoutEffect)((()=>r.subscribe((()=>{var e;if(r.getState()===a.current)return;const t=null===(e=s.current)||void 0===e?void 0:e.call(s,r.getState());t!==o.current&&(o.current=t,n())}))),[r]),o.current}const X=function(e,t,r=[]){return Z((0,Y.useCallback)((r=>e(r,t)),r),r)};function ee(){return Z(T)}function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){ne(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ne(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const oe=(e,t)=>{let r;return function(...n){const o=this;let i=!1;return clearTimeout(r),r=setTimeout((()=>{r=null,i||e.apply(o,n),i=!1}),t),t=>{i=!0,t&&e.apply(o,n)}}},ie=e=>Math.ceil(e/1e3),se=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},ae=(e,t=2)=>{if(0===e)return"0 Bytes";const r=t<0?0:t,n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,n)).toFixed(r))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]},ce=()=>{const{search:e}=window.location;return e?e.slice(e.indexOf("?")+1).split("&").reduce(((e,t)=>{const[r,n]=t.split("=");return re(re({},e),{},{[r]:decodeURIComponent(n)})}),{}):{}},ue=e=>Object.keys(e).reduce(((t,r)=>`${t}${t?"&":""}${r}=${encodeURIComponent(e[r])}`),""),le={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},pe={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},fe=e=>e.code?pe[e.code]:le[e.keyCode],he=e=>{e&&e.focus()},de=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function be(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach((function(t){me(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function me(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ge={info:"info",message:"message",participant:"participant",system:"system"},ve="text",Oe="text",we="upload",Ee="received",De="read",je="custom",xe="typing",_e="read",Ce="detach_service",Ae="set_translation",Se="click_cta",Te="assertive",ke="polite",Pe={new_topic:"newTopic",new_translation:"newTranslation"},Ie="uploads",Ne={ADD_EVENT:"ADD_EVENT",CLEAR_EVENTS:"CLEAR_EVENTS",SET_HISTORY:"SET_HISTORY",SET_EVENTS_READ:"SET_EVENTS_READ",ACK_EVENT:"ACK_EVENT",SET_IS_LOADING:"SET_IS_LOADING",CLEAR_PARTICIPANTS:"CLEAR_PARTICIPANTS",SET_PARTICIPANT:"SET_PARTICIPANT",SET_HEADER_TITLE:"SET_HEADER_TITLE",SET_HEADER_SUB_TITLE:"SET_HEADER_SUB_TITLE",RESET_HISTORY_LOADED_FLAG:"RESET_HISTORY_LOADED_FLAG",SET_ACTIVE_SERVICE:"SET_ACTIVE_SERVICE",INIT_IDLE_DETACH_COUNTDOWN:"INIT_IDLE_DETACH_COUNTDOWN",DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:"DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER",STOP_IDLE_DETACH_COUNTDOWN_COUNTER:"STOP_IDLE_DETACH_COUNTDOWN_COUNTER",CLEAR_IDLE_DETACH_COUNTDOWN:"CLEAR_IDLE_DETACH_COUNTDOWN",INIT_RESUME_CONVERSATION_PROMPT:"INIT_RESUME_CONVERSATION_PROMPT",CLEAR_RESUME_CONVERSATION_PROMPT:"CLEAR_RESUME_CONVERSATION_PROMPT",SET_SERVICE_DATA_ITEM:"SET_SERVICE_DATA_ITEM",SET_FEATURES:"SET_FEATURES",SET_FEATURE_ENABLED_STATE:"SET_FEATURE_ENABLED_STATE",CLEAR_FEATURES:"CLEAR_FEATURES",SET_INITIAL_STATE:"SET_INITIAL_STATE",SET_USER_SELECTED_OPTIONS:"SET_USER_SELECTED_OPTIONS",SET_USER_SELECTED_OPTION:"SET_USER_SELECTED_OPTION",SHOW_OPTION:"SHOW_OPTION",HIDE_OPTION:"HIDE_OPTION",SET_SERVICE_ENTRY_METADATA:"SET_SERVICE_ENTRY_METADATA",SET_BLOCK_AUTO_ENTRY_SWITCH:"SET_BLOCK_AUTO_ENTRY_SWITCH",SET_ACTIVE_ENTRY_TYPE:"SET_ACTIVE_ENTRY_TYPE",SET_USER_ENTRY_TYPE:"SET_USER_ENTRY_TYPE",REGISTER_UPLOAD:"REGISTER_UPLOAD",SET_UPLOAD_PROGRESS:"SET_UPLOAD_PROGRESS",SET_UPLOAD_COMPLETE:"SET_UPLOAD_COMPLETE",SET_UPLOAD_ERROR:"SET_UPLOAD_ERROR",CLEAR_UPLOAD:"CLEAR_UPLOAD",CLEAR_ALL_UPLOADS:"CLEAR_ALL_UPLOADS",SET_SEAMLY_CONTAINER_ELEMENT:"SET_SEAMLY_CONTAINER_ELEMENT"},Fe="navigate",{ADD_EVENT:Re,CLEAR_EVENTS:Be,SET_HISTORY:Le,SET_EVENTS_READ:Me,ACK_EVENT:Ue,SET_IS_LOADING:ze,CLEAR_PARTICIPANTS:$e,SET_PARTICIPANT:He,SET_HEADER_TITLE:qe,SET_HEADER_SUB_TITLE:Ve,RESET_HISTORY_LOADED_FLAG:We,SET_ACTIVE_SERVICE:Ge,INIT_IDLE_DETACH_COUNTDOWN:Ke,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:Ye,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:Je,CLEAR_IDLE_DETACH_COUNTDOWN:Qe,INIT_RESUME_CONVERSATION_PROMPT:Ze,CLEAR_RESUME_CONVERSATION_PROMPT:Xe,SET_SERVICE_DATA_ITEM:et,SET_FEATURES:tt,SET_FEATURE_ENABLED_STATE:rt,CLEAR_FEATURES:nt,SET_INITIAL_STATE:ot,SET_USER_SELECTED_OPTION:it,SET_USER_SELECTED_OPTIONS:st,SHOW_OPTION:at,HIDE_OPTION:ct,SET_BLOCK_AUTO_ENTRY_SWITCH:ut,SET_USER_ENTRY_TYPE:lt,SET_ACTIVE_ENTRY_TYPE:pt,SET_SERVICE_ENTRY_METADATA:ft,REGISTER_UPLOAD:ht,SET_UPLOAD_PROGRESS:dt,SET_UPLOAD_COMPLETE:yt,SET_UPLOAD_ERROR:bt,CLEAR_UPLOAD:mt,CLEAR_ALL_UPLOADS:gt,SET_SEAMLY_CONTAINER_ELEMENT:vt}=Ne,Ot=({type:e,payload:t})=>e===ge.message&&!t.fromClient||e===ge.info&&t.type===ve,wt=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),Et=(e,t)=>{switch(t.type){case $e:return{participants:{},currentAgent:""};case He:const{participants:r}=e,{id:n,avatar:o,name:i,introduction:s}=t.participant,a=r[n],c=be(be({},r),{},{[n]:a?be(be(be(be({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return be(be({},e),{},{participants:c,currentAgent:e.currentAgent===n||t.fromClient?e.currentAgent:n});default:return e}},Dt=(e,t)=>{switch(t.type){case qe:return be(be({},e),{},{title:t.title});case Ve:return be(be({},e),{},{subTitle:t.title});default:return e}},jt=(e,t)=>{const{entry:r}=t,{blockAutoEntrySwitch:n}=e;if(!r)return be(be({},e),{},{optionsOverride:{}});const{type:o,options:i}=r;let s=e.active;return n||o===e.userSelected||(s=o),be(be({},e),{},{active:s,optionsOverride:be(be({},e.optionsOverride),{},{[o]:i||{}})})},xt="cvco",_t="2",Ct="seamly-client-participant",{createAction:At,createThunk:St,createReducer:Tt,selectState:kt}=h("i18n"),Pt=j(kt,(e=>e.translations)),It=j(kt,(e=>e.initialLocale)),Nt=j(kt,(e=>e.locale)),Ft=At("setInitialLocale",(e=>({locale:e}))),Rt=function(){let e=!1;const t=[],r=async()=>{if(!e)for(;t.length;){const r=t.shift();e=!0,await r().catch((()=>{})),e=!1}};return{next:r,runExclusively:async e=>{const n=new Promise(((r,n)=>{t.push((async()=>{try{r(await e())}catch(e){n(e)}}))}));return r(),n}}}(),Bt=St("setLocale",(async(e,{getState:t,extra:{api:r}})=>Rt.runExclusively((()=>{if(e!==Nt(t()))return r.getTranslations(e)})))),{createAction:Lt,createThunk:Mt,createReducer:Ut,selectState:zt}=h("app"),$t=j(zt,(e=>e.userHasResponded)),{createAction:Ht,createActions:qt,createThunk:Vt,createReducer:Wt,selectState:Gt}=h("visibility"),Kt=({hasResponded:e,previousVisibility:t,requestedVisibility:r,config:n})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=n,{visible:a}=o||{};if("window"===i&&s&&r!==_.open)return e?r||t||_.open:_.hidden;const c=_.minimized;return r||t||a||c},Yt=j(Gt,(e=>e.visibility));function Jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(r),!0).forEach((function(t){Zt(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Zt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Xt=e=>e.state,er=()=>Z(Xt),tr=j(Xt,T,$t,(({events:e,serviceData:t},r,n)=>{var o;if(n||"inline"===r.layoutMode||!t.suggestion||null===(o=t.suggestion)||void 0===o||!o.body.length)return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),rr=j(tr,T,((e,t)=>{var r;const{enabled:n,threshold:o}=(null==t||null===(r=t.messages)||void 0===r?void 0:r.timeIndicator)??{};if(!n)return e;const i=[];let s=null;return e.forEach(((e,t)=>{if(0===t)i.push(Qt(Qt({},e),{},{timeIndicator:e.payload.occurredAt}));else{const t=s&&ie(e.payload.occurredAt-s.payload.occurredAt)>=o?e.payload.occurredAt:void 0;i.push(Qt(Qt({},e),{},{timeIndicator:t}))}s=e})),i})),nr=()=>Z(rr,[]),or=()=>er().headerTitles,ir=()=>er().unreadEvents,sr=()=>er().skiplinkTargetId,ar=j(rr,(e=>{var t;const r=e.filter((e=>"message"===e.type));return null===(t=r[r.length-1])||void 0===t?void 0:t.payload.id})),cr=()=>{const{participants:e,currentAgent:t}=er().participantInfo;return t?e[t]:null},ur=e=>er().serviceData[e],lr=()=>{const{layoutMode:e}=ee();return{isInline:"inline"===e,isWindow:"window"===e,isResolving:!e}};function pr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pr(Object(r),!0).forEach((function(t){hr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dr=Ht("setFromStorage",(e=>({visibility:e}))),yr=[_.open,_.minimized,_.hidden],br=Vt("set",((e,{getState:t,extra:{api:r,eventBus:n}})=>{const o=t(),i=Yt(o),s=$t(o),a=r.hasConversation(),c=T(o),{visibilityCallback:u=Kt,layoutMode:l}=c,{unreadEvents:p}=Xt(o),f=u({hasConversation:a,hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(yr.includes(f)){if(i!==f)return r.store.set(x,fr(fr({},r.store.get(x)||{}),{},{[l]:e})),e&&n.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:p}),f}else console.error('The visibilityCallback function should return "open", "minimized" or "hidden".')})),mr=Vt("initialize",(async(e,{dispatch:t,getState:r,extra:{api:n}})=>{var o;const{layoutMode:i}=T(r()),s=null===(o=n.store.get(x))||void 0===o?void 0:o[i];s&&t(dr(s)),t(br(_.initialize))}));class gr extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,gr),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}class vr extends Error{constructor(e,...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,null!=e&&e.payload&&(this.originalEvent=e,this.originalError=e.payload.error),null!=e&&e.error&&(this.originalError=e.error)}}class Or extends vr{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}const{createAction:wr,createReducer:Er,selectState:Dr}=h("interrupt"),jr=wr("set",(e=>({error:e}))),xr=wr("clear"),_r=Lt("setHasResponded",(e=>({hasResponded:e}))),Cr=Mt("initialize",(async(e,{dispatch:t,extra:{api:r,config:n}})=>{var o;t(g(n));let i=null==n||null===(o=n.context)||void 0===o?void 0:o.locale;try{const{features:e,defaultLocale:n,preChat:o}=await r.getConfig();t({type:Ne.SET_FEATURES,features:e}),i=i||n,t(Ft(i)),t(O(o.map((e=>({type:"message",payload:e})))))}catch(e){throw new gr}try{if(r.hasConversation()){var s;const e=await r.getConversationIntitialState();t({type:Ne.SET_INITIAL_STATE,initialState:e}),i=(null===(s=e.translation)||void 0===s?void 0:s.locale)||i,"userResponded"in e&&t(_r(e.userResponded))}}catch(e){if(e instanceof Or)throw e;throw new gr}finally{await t(Bt(i)),t(mr())}})),Ar=Mt("reset",(async(e,{dispatch:t,extra:{api:r}})=>{try{await r.disconnect(),await r.clearStore(),t(Cr())}catch(e){t(jr(e))}})),Sr=["messages"];function Tr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function kr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tr(Object(r),!0).forEach((function(t){Pr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ir=kr(kr({},{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}}}),{},{hideOnNoUserResponse:!1,showDisclaimer:!1,showFaq:!1,customComponents:{},defaults:{},preChatEvents:[]}),Nr=["hideOnNoUserResponse","showDisclaimer","showFaq","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback"],Fr=(e,{config:t})=>{const r=(i=t,Nr.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:n}=r,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,Sr);var i;let s=e;return Object.keys(o).length>0&&(s=kr(kr({},s),o)),n&&(s=kr(kr({},s),{},{messages:kr(kr({},s.messages),n)})),s},Rr=b({[g]:(e,t)=>Fr(e,t),[v]:(e,t)=>Fr(e,t),[Cr.pending]:()=>Ir,[O]:(e,{events:t})=>kr(kr({},e),{},{preChatEvents:t})},Ir),Br=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e.split(" "))).flat().filter((e=>e.length)).map((e=>e.indexOf(xt)>-1?e:[xt,e].join("-"))).join(" "),Lr=(0,e.createContext)(null),Mr=(0,e.createContext)(""),Ur=()=>(0,Y.useContext)(Lr),zr=()=>Ur().store||{},$r=()=>{const{get:e}=zr();return e?e("conversationUrl"):null},Hr=()=>!!$r(),qr=Q,Vr=()=>ee().appContainerClassNames,Wr=e=>{const{fromClient:t}=e.payload,r=["message"];return"info"===e.type?r.push("message--source-info"):t?r.push("message--source-user"):r.push("message--source-agent"),r};function Gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Qr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zr(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Zr(t):t)}),[])}function Xr(e){var t={};return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var i=n.length?n.map((function(e){return null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e)})).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,i))return t[i];var s=e.apply(void 0,n);return t[i]=s,s}}function en(e){for(var t=function(e){return/\s/.test(e)},r=[],n={},o=0,i=null,s=!1,a=0;a<e.length;){if(s&&(t(e[a])||"{"===e[a]))s=!1,i=e.slice(o,a),"{"===e[a]&&a--;else if(!s&&!t(e[a])){var c="{"===e[a];if(i&&c){var u=tn(e,a);if(-1===u)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));n[i]=e.slice(a+1,u),a=u,i=null}else i&&(r.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&r.push(i),{args:r,cases:n}}function tn(e,t){for(var r=0,n=t+1;n<e.length;n++){var o=e.charAt(n);if("}"===o){if(0===r)return n;r--}else"{"===o&&r++}return-1}function rn(e){return nn(e.slice(1,-1),",",3)}function nn(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return n;if(1===r)return n.push(e),n;var o=e.indexOf(t);if(-1===o)return n.push(e),n;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return n.push(i),nn(s,t,r-1,n)}var on;function sn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function an(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sn(Object(r),!0).forEach((function(t){Qr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var cn=0,un="other";function ln(e,t){for(var r=0,n="",o=0,i={};r<e.length;){if("#"!==e[r]||o)n+=e[r];else{var s="__hashToken".concat(cn++);n+="{".concat(s,", number}"),i[s]=t}"{"===e[r]?o++:"}"===e[r]&&o--,r++}return{caseBody:n,numberValues:i}}var pn="other";const fn=new(function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Yr(this,e),Qr(this,"format",Xr((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zr(r.process(e,t)).join("")}))),this.locale=t,this.typeHandlers=n}var t,r;return t=e,(r=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var r=e.indexOf("{");if(-1!==r){var n=tn(e,r);if(-1===n)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var o=e.substring(r,n+1);if(o){var i=[],s=e.substring(0,r);s&&i.push(s);var a=rn(o),c=Kr(a,3),u=c[0],l=c[1],p=c[2],f=t[u];null==f&&(f="");var h=l&&this.typeHandlers[l];i.push(h?h(f,p,this.locale,t,this.process.bind(this)):f);var d=e.substring(n+1);return d&&i.push(this.process(d,t)),i}}return[e]}}])&&Jr(t.prototype,r),e}())("en-GB",{plural:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=en(t),s=i.args,a=i.cases,c=parseInt(e);s.forEach((function(e){e.startsWith("offset:")&&(c-=parseInt(e.slice("offset:".length)))}));var u=[];if("PluralRules"in Intl){void 0!==on&&on.resolvedOptions().locale===r||(on=new Intl.PluralRules(r));var l=on.select(c);l!==un&&u.push(l)}1===c&&u.push("one"),u.push("=".concat(c),un);for(var p=0;p<u.length;p++){var f=u[p];if(f in a){var h=ln(a[f],c),d=h.caseBody,y=h.numberValues;return o(d,an(an({},n),y))}}return e},select:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,o=en(t),i=o.cases;return e in i?n(i[e],r):pn in i?n(i.other,r):e}});function hn(){const e=Z(Pt),t=Z(Nt),r=Z(It);return{t:(0,Y.useCallback)(((r,n={})=>{const o=e[r];return o?fn.format(o,n):(console.warn(`Translation key: ${r} is missing in locale: ${t}`),null)}),[e,t]),locale:t,initialLocale:r}}function dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dn(Object(r),!0).forEach((function(t){bn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const mn={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},gn=Tt({[Ft]:(e,{locale:t})=>yn(yn({},e),{},{initialLocale:t}),[Bt.pending]:e=>yn(yn({},e),{},{isLoading:!0}),[Bt.fulfilled]:(e,{payload:t,meta:{arg:r}})=>yn(yn({},e),{},t?{isLoading:!1,locale:r,translations:Object.keys(t).sort().reduce(((e,r)=>yn(yn({},e),{},{[r]:t[r]})),{})}:{isLoading:!1}),[Bt.rejected]:e=>yn(yn({},e),{},{isLoading:!1}),[Cr.pending]:()=>mn},mn),{SET_SEAMLY_CONTAINER_ELEMENT:vn}=Ne,On=e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{const t="string"==typeof e?document.getElementById(e):e;he(t)}))}))},wn=()=>{const{seamlyContainerElement:e}=er(),t=qr();return[e,(0,Y.useCallback)((e=>{t({type:vn,element:e})}),[t])]},En=e=>(0,Y.useCallback)((()=>{On(e)}),[e]),Dn=()=>{const e=sr();return En(e)};function jn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jn(Object(r),!0).forEach((function(t){_n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_USER_SELECTED_OPTION:Cn,SET_USER_SELECTED_OPTIONS:An,SHOW_OPTION:Sn,HIDE_OPTION:Tn}=Ne,kn=()=>{const{t:e}=hn(),{options:t}=er(),{panelActive:r,optionActive:n,userSelectedOptions:o,features:i}=t,{cobrowsing:s,sendTranscript:a}=i,c={cobrowsing:s,sendTranscript:a},u=Object.keys(c).filter((e=>c[e])).map((t=>({name:t,title:e(`options.${t}.menuTitle`),available:c[t].enabled}))),l=s||a,p=qr(),{get:f,set:h}=zr();return{allowOptionSelection:l,userSelectedOptions:o,features:i,menuOptions:u,initUserSelectedOptions:(0,Y.useCallback)((()=>{const e=f("options")||{};p({type:An,options:e})}),[f,p]),setUserSelectedOptions:(0,Y.useCallback)((e=>{p({type:An,options:e}),h("options",e)}),[h,p]),setUserSelectedOption:(0,Y.useCallback)(((e,t)=>{const r=f("options")||{};h("options",xn(xn({},r),{},{[e]:t})),p({type:Cn,option:e,value:t})}),[p,f,h]),showOption:e=>{p({type:Sn,optionName:e})},hideOption:()=>{p({type:Tn})},panelActive:r,optionActive:n}},Pn=()=>{const{optionsButtonId:e}=er();return{id:e,focusButton:En(e)}},In=(0,e.createContext)({});function Nn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nn(Object(r),!0).forEach((function(t){Rn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Rn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{CLEAR_ALL_UPLOADS:Bn}=Ne,Ln=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:r},options:{features:{uploads:n}}}=er(),{allowedMimeTypes:o,maxSize:i}=r.upload||{},{enabled:s,enabledFromEntry:a}=n||{},{allowedMimeTypes:c,maxSize:u}=Fn(Fn(Fn({},t.upload||{allowedMimeTypes:[],maxSize:0}),o?{allowedMimeTypes:o}:{}),i?{maxSize:i}:{});return{showFileUpload:e,accountAllowsUploads:!!n,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:u}},Mn=()=>{const{currentUploads:e}=er(),t=qr(),r=(0,Y.useContext)(In);return{uploadFile:(0,Y.useCallback)((e=>{r(e)}),[r]),clearUploads:(0,Y.useCallback)((()=>{t({type:Bn})}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},Un=()=>{const[e]=(0,Y.useState)((()=>i()));return e},zn=e=>{const t=(0,Y.useRef)();t.current=e;const r="function"==typeof e;return(0,Y.useMemo)((()=>r?(...e)=>t.current(...e):void 0),[r])},$n=j(Dr,(({error:e})=>e));function Hn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hn(Object(r),!0).forEach((function(t){Vn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wn(){const{t:e}=hn(),t=Z($n);return{hasInterrupt:Boolean(t),meta:(0,Y.useMemo)((()=>{if(!t)return{};const{langKey:r,action:n}=t,o=e(`${r}.title`),i=e(`${r}.message`),s=e(`${r}.srText`),a=e(`${r}.buttonText`);return qn(qn(qn(qn({},r?{title:o,message:i,srText:s}:{}),n?{action:n}:{}),n&&r?{buttonText:a}:{}),{},{originalError:t})}),[e,t]),error:t}}class Gn extends vr{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class Kn extends vr{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class Yn extends vr{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}class Jn extends vr{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const Qn=[Gn,Kn,Or,Yn,Jn,gr];function Zn({api:e}){return()=>t=>r=>{const{error:n}=r;if(n){if(!Qn.some((e=>n instanceof e)))throw n;"reset"===n.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(r)}}function Xn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function eo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xn(Object(r),!0).forEach((function(t){to(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function to(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ro={error:void 0},no=(e,{error:t})=>eo(eo({},e),{},{error:t}),oo=Er({[jr]:no,[Cr.rejected]:no,[xr]:()=>ro,[Cr.pending]:()=>ro},ro);function io(){return Z($t)}const so=()=>{const e=Q(),t=Z(Yt);return{isVisible:!!t&&t!==_.hidden,isOpen:t===_.open,isMinimized:t===_.minimized,visible:t,setVisibility:(0,Y.useCallback)((t=>e(br(t))),[e])}};function ao(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function co(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ao(Object(r),!0).forEach((function(t){uo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ao(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function uo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const lo={visibility:_.initialize},po=Wt({[dr]:(e,{visibility:t})=>co(co({},e),{},{visibility:t}),[br.fulfilled]:(e,{payload:t})=>t?co(co({},e),{},{visibility:t}):e},lo);function fo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ho(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fo(Object(r),!0).forEach((function(t){yo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function yo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{ADD_EVENT:bo,SET_INITIAL_STATE:mo}=Ne,go=()=>{const e=Ur(),t=ee(),r=qr(),n=(0,Y.useContext)(Mr),o=io(),s=Hr(),{visible:a}=so(),c=ir(),u=(0,Y.useCallback)(((...e)=>{n.emit(...e)}),[n]),l=zn((()=>{e.sendContext(t.context||{}),u("ui.beforeStart",{visibility:a,hasConversation:s,hasResponded:o,unreadMessageCount:c}),e.send("start"),u("ui.start",{visibility:a,hasConversation:s,hasResponded:o,unreadMessageCount:c})})),p=(0,Y.useCallback)((async()=>{r(Ar())}),[r]),f=(0,Y.useCallback)((e=>({type:e,id:i(),transactionId:i(),participant:Ct,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),h=(0,Y.useCallback)((e=>ho(ho({},f("text")),{},{body:{text:e}})),[f]),d=(0,Y.useCallback)((({body:t,config:n={}})=>{if(""===t.trim())return;const o=ho(ho({},h(t)),n);e.send("message",o),u("message",o),r({type:bo,event:{type:"message",payload:o}})}),[e,r,u,h]),y=(0,Y.useCallback)((e=>{r({type:bo,event:{type:"message",payload:h(e)}})}),[r,h]),b=(0,Y.useCallback)(((e,t,n,o,i,s,a)=>{r({type:bo,event:{type:"message",payload:{type:"upload",id:e,transactionId:t,participant:Ct,fromClient:!0,occurredAt:n,meta:{},body:{contentType:o,filename:i,filesize:s,url:a}}}})}),[r]),m=(0,Y.useCallback)((e=>{const t={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:i(),transactionId:i(),type:"divider"};r({type:bo,event:{type:"info",payload:t}})}),[r]),g=(0,Y.useCallback)((({type:t,subtype:r})=>{const n={type:t,subtype:r,id:i(),transactionId:i(),participant:Ct,fromClient:!0};e.send("info",n)}),[e]),v=(0,Y.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:r}=t;r!==xe&&r!==_e&&u(`action.${r}`,t)}),[e,u]),O=(0,Y.useCallback)((t=>{e.sendContext(t)}),[e]);return{connect:(0,Y.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&r({type:mo,initialState:e})})).catch((e=>{r(jr(e))}))),[e,r]),start:l,sendMessage:d,sendInfo:g,sendAction:v,sendContext:O,reset:p,emitEvent:u,addMessageBubble:y,addUploadBubble:b,addDivider:m,apiConfigReady:e.configReady}},vo=(0,e.createContext)(null),Oo=()=>{const e=(0,Y.useContext)(vo);return{sendPolite:(0,Y.useCallback)((t=>{e({ariaLive:ke,messageText:t})}),[e]),sendAssertive:(0,Y.useCallback)((t=>{e({ariaLive:Te,messageText:t})}),[e])}},wo=(0,e.createContext)(null),Eo=()=>(0,Y.useContext)(wo);function Do(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{SET_BLOCK_AUTO_ENTRY_SWITCH:xo,SET_ACTIVE_ENTRY_TYPE:_o,SET_USER_ENTRY_TYPE:Co}=Ne,Ao=()=>{const{default:e,active:t,userSelected:r,options:n}=er().entryMeta,o=qr(),i=r||t||e,s=n[i]||{},a=(0,Y.useCallback)((e=>{o({type:xo,value:e})}),[o]),c=(0,Y.useCallback)((e=>{o({type:_o,entryType:e})}),[o]),u=(0,Y.useCallback)((e=>{o({type:Co,entryType:e})}),[o]),l=(0,Y.useCallback)((()=>{r?u(null):c(e)}),[r,e,u,c]);return{activeEntry:i,activeEntryOptions:s,setActiveEntryType:c,setUserEntryType:u,cancelEntrySelection:l,setBlockAutoEntrySwitch:a}},{SET_IS_LOADING:So}=Ne,To=()=>{const{t:e}=hn(),{layoutMode:t}=ee(),{isOpen:r,isVisible:n,setVisibility:o}=so(),i=qr(),s=nr(),a=(0,Y.useRef)(null),{start:c,connect:u,apiConfigReady:l}=go(),p=Hr(),f=(0,Y.useRef)(null),h=(0,Y.useRef)(null),{sendAssertive:d}=Oo(),y=(0,Y.useRef)(!1),b=s.length>0;return(0,Y.useEffect)((()=>{n&&setTimeout((()=>{d(e("window.srTexts.onLoad"))}),500)}),[n,d,e]),(0,Y.useEffect)((()=>{if(n!==h.current)return f.current=r,void(h.current=n);null!==f.current&&d(e(r?"window.srTexts.onOpen":"window.srTexts.onClose")),f.current=r,h.current=n}),[r,n,d,e]),(0,Y.useEffect)((()=>{a.current=setTimeout((()=>{i({type:So,isLoading:!0})}),500)}),[i]),(0,Y.useEffect)((()=>{b&&(clearTimeout(a.current),i({type:So,isLoading:!1}))}),[b,i]),(0,Y.useEffect)((()=>{p&&l||(y.current=!1)}),[p,l]),(0,Y.useEffect)((()=>{("window"!==t||r||p)&&!y.current&&l&&(p&&(clearTimeout(a.current),i({type:So,isLoading:!1})),u().then((()=>{c()})),y.current=!0)}),[r,p,l,c,u,i,t]),{openChat:()=>{o(_.open)},closeChat:()=>{o(_.minimized)}}};function ko(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Po(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ko(Object(r),!0).forEach((function(t){Io(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ko(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Io(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const{CLEAR_IDLE_DETACH_COUNTDOWN:No,INIT_IDLE_DETACH_COUNTDOWN:Fo,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:Ro,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:Bo}=Ne,Lo=()=>{const e=qr(),{idleDetachCountdown:t}=er(),{isOpen:r}=so(),n=(0,Y.useRef)({});n.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:r};const{emitEvent:o,sendAction:i}=go(),{t:s}=hn(),{sendAssertive:a,sendPolite:c}=Oo(),u=(0,Y.useCallback)((e=>{const{isOpen:t}=n.current;t&&a(e)}),[a]),l=(0,Y.useCallback)((e=>{const{isOpen:t}=n.current;t&&c(e)}),[c]),p=(0,Y.useCallback)((t=>{const r=(e=>Math.ceil(e/1e3))(t),n=se(r);e({type:Fo,delaySeconds:r,delayTime:n}),o("idleTimer.start"),u(`${s("idleDetachWarning.countdownTitle")} ${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",n)}`)}),[e,o,u,s]),f=(0,Y.useCallback)(((t,r)=>{const{hasCountdown:a,wasStopped:c}=n.current;a&&(t||(r||i({type:Ce}),u(s("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e({type:No}))}),[e,i,o,u,s]),h=(0,Y.useCallback)((()=>{const{remaining:t}=n.current;if(t<=0)return;const r=t-1;r%10==0&&u(`${s("idleDetachWarning.countdownText")} ${s("idleDetachWarning.countdownTimer",se(r))}`),e({type:Ro})}),[e,u,s]),d=(0,Y.useCallback)((()=>{const{isActive:t,remaining:r}=n.current;t&&(e({type:Bo}),r&&(o("idleTimer.stop"),l(s("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,l,s]);return Po(Po({},t),{},{initCountdown:p,endCountdown:f,decrementCountdown:h,stopCountdown:d})},{CLEAR_RESUME_CONVERSATION_PROMPT:Mo}=Ne,Uo=()=>{const e=qr(),t=er().resumeConversationPrompt,{sendAction:r}=go(),{t:n}=hn(),{sendAssertive:o}=Oo();return{continueChat:()=>{r({type:"dismiss",body:{type:"resume_conversation_prompt"}}),e({type:Mo})},hasPrompt:t,restartChat:()=>{o(n("resumeConversationPrompt.srNotifyRestartText")),r({type:Ce}),e({type:Mo})}}},zo=(e,t)=>{const r=Ur();(0,Y.useEffect)((()=>{r.stream&&(t?r.stream().filter(t).subscribe({next:e}):r.stream().subscribe({next:e}))}),[r,e,t])};function $o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ho(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$o(Object(r),!0).forEach((function(t){qo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vo=Ut({[_r]:(e,{hasResponded:t})=>Ho(Ho({},e),{},{userHasResponded:t})},{userHasResponded:!1}),{createActions:Wo,createReducer:Go,selectState:Ko}=h("translations"),[Yo,Jo]=Wo("translate",{enable:e=>({locale:e}),disable:()=>({})}),[Qo,Zo]=Wo("event",{enable:e=>({payloadId:e}),disable:e=>({payloadId:e})}),Xo=(e,t)=>(r,n)=>n[e]||t,ei=Ko,ti=j(ei,(e=>e.originalPayloadIds)),ri=j(ti,Xo("payloadId"),((e,t)=>!e.includes(t)));function ni(){const{sendAction:e}=go(),t=Q(),r=zn((r=>{e({type:Ae,body:{enabled:!0,locale:r}}),t(Yo(r))})),n=zn((()=>{e({type:Ae,body:{enabled:!1}}),t(Jo())})),{languages:o,isActive:i,isAvailable:s,currentLocale:a}=Z(ei,[]);return{languages:o,isActive:i,isAvailable:s,currentLocale:a,enableTranslations:r,disableTranslations:n}}function oi({payload:e}={}){var t,r,n;const o=null==e?void 0:e.id;let i,s;switch(null==e?void 0:e.type){case"participant":i=e.participant.introduction,s=e.participant.translatedIntroduction;break;default:i=null==e?void 0:e.body,s=null==e?void 0:e.translatedBody}const a=!!s,c=X(ri,{payloadId:o},[o]),u=Q(),l=zn((()=>{u(c?Zo(o):Qo(o))}));return[a&&c?null===(t=s)||void 0===t?void 0:t.data:i,{hasTranslation:a,isTranslated:c&&a,toggleTranslation:l,translatedBy:null===(r=s)||void 0===r?void 0:r.translatedBy,locale:null===(n=s)||void 0===n?void 0:n.locale}]}function ii(){const e=Z(ei,[]).containerId;return{id:e,focusContainer:En(e)}}function si(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ai(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?si(Object(r),!0).forEach((function(t){ci(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):si(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ci(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ui={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],originalPayloadIds:[],containerId:i()},li=Go({[Ne.SET_FEATURES]:(e,t)=>{var r;const n=null==t||null===(r=t.features)||void 0===r?void 0:r.translation;return n?ai(ai({},e),{},{isAvailable:!0===n.enabled,languages:n.languages||[]}):e},[Ne.CLEAR_FEATURES]:()=>ui,[Yo]:(e,{locale:t})=>ai(ai({},e),{},{isActive:!0,currentLocale:t}),[Jo]:e=>ai(ai({},e),{},{isActive:!1,currentLocale:void 0}),[Qo]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?ai(ai({},e),{},{originalPayloadIds:e.originalPayloadIds.filter((e=>e!==t))}):e,[Zo]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?e:ai(ai({},e),{},{originalPayloadIds:[...e.originalPayloadIds,t]}),[Cr.pending]:()=>ui},ui),pi={send32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>',balloon32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>',newTopic32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>',newTranslation16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',newTranslation32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>',avatar32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#003A5D" d="M0,4.717C0,2.112,2.112,0,4.717,0h22.566C29.888,0,32,2.112,32,4.717v22.566C32,29.887,29.888,32,27.283,32 H4.717C2.113,32,0,29.887,0,27.283V4.717z"/><path fill="#FFF" d="M10.103,14.901c-1.107,0-2.004-0.897-2.004-2.004s0.897-2.005,2.004-2.005c1.107,0,2.005,0.897,2.005,2.005 C12.108,14.004,11.211,14.901,10.103,14.901z M16,14.901c1.107,0,2.005-0.897,2.005-2.004S17.108,10.892,16,10.892 c-1.108,0-2.005,0.897-2.005,2.005C13.995,14.004,14.892,14.901,16,14.901z M21.896,10.892c-1.106,0-2.004,0.897-2.004,2.005 c0,1.107,0.896,2.004,2.004,2.004c1.109,0,2.005-0.897,2.005-2.004C23.901,11.789,23.005,10.892,21.896,10.892z M21.408,18.207 H10.783C11.83,23.973,20.361,23.973,21.408,18.207z"/></svg>',chevronDown8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',chevronDown32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>',chevronRight8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',chevronRight16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>',close8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',close16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>',enlarge32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>',options32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>',file32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>',upload32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>',download16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>',error16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>',arrowLeft16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n',arrowRight16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},fi=({name:e,size:t="32",className:r,alt:n})=>{const o=`${e}${t}`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{"aria-hidden":"true",className:r||Br("icon"),dangerouslySetInnerHTML:{__html:pi[o]}}),n&&(0,F.jsx)("span",{className:Br("visually-hidden"),children:n})]})},hi={visible:Br("transition--visible"),in:Br("transition--in"),visuallyHidden:Br("visually-hidden")},di=Object.values(hi),yi="notRendered",bi="rendered",mi="visuallyHidden",gi=({children:t,isActive:r,timeout:n,transitionStartState:o="notRendered",onInTransitionComplete:i,onOutTransitionComplete:s})=>{const a=(0,Y.useRef)(!1),c=n?parseInt(n,10):300,u=zn(i),l=zn(s),p=o===mi,[f,h]=(0,Y.useState)((()=>p?[hi.visuallyHidden]:[])),d="notRendered"!==o||f.length>0;return(0,Y.useEffect)((()=>{let e=null,t=null;return a.current&&!r&&(h([hi.visible]),e=setTimeout((()=>{h([...p?[hi.visuallyHidden]:[]]),l&&(t=requestAnimationFrame((()=>{l()})))}),c)),!a.current&&r&&(h([hi.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{h([hi.visible,hi.in]),u&&(e=setTimeout((()=>{u()}),c))}))}))),a.current=r,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[r,p,c,u,l]),d&&(0,e.toChildArray)(t).map((t=>{const{className:r=""}=t.props,n=r.split(" ").filter((e=>!di.includes(e)));return(0,e.cloneElement)(t,{className:[...n,...f].join(" ")})}))},vi=({className:e,children:t,onCancel:r,headingText:n,cancelButtonText:o,disableButtonFocusing:i,cancelButtonRef:s,position:a="right"})=>{const c=(0,Y.useRef)(null),u=Un(),{hideOption:l}=kn(),{focusButton:p}=Pn();return(0,Y.useEffect)((()=>{he(c.current)}),[]),(0,F.jsx)("section",{className:Br("options",{"options--right":"left"!==a,"options--left":"left"===a},e),"aria-labelledby":u,tabIndex:"-1",ref:c,children:(0,F.jsxs)("div",{className:Br("options__body"),children:[(0,F.jsx)("h2",{id:u,className:Br("options__title"),children:n}),(0,F.jsxs)("button",{type:"button",onClick:()=>{r&&r(),l(),i||p()},"aria-describedby":u,className:Br("button","options__close"),ref:e=>{s&&(s.current=e)},children:[(0,F.jsx)(fi,{name:"close",size:"16"}),(0,F.jsx)("span",{children:o})]}),(0,F.jsx)("div",{className:Br("options__wrapper"),children:t})]})})},{createActions:Oi,createReducer:wi,selectState:Ei}=h("forms"),[Di,ji]=Oi("form",{register:(e,t)=>({formId:e,persistData:t}),deregister:e=>({formId:e})}),[xi,_i,Ci,Ai]=Oi("control",{register:(e,t)=>({formId:e,name:t}),deregister:(e,t)=>({formId:e,name:t}),updateValue:(e,t,r)=>({formId:e,name:t,value:r}),updateTouched:(e,t,r)=>({formId:e,name:t,touched:r})}),Si=j(Ei,Xo("formId"),((e,t)=>e[t])),Ti=j(Si,(e=>(null==e?void 0:e.controls)||{})),ki=j(Ti,(e=>{const t={};return Object.entries(e).forEach((([e,{value:r}])=>{t[e]=r})),t})),Pi=j(Ti,Xo("name"),((e,t)=>{var r;return null===(r=e[t])||void 0===r?void 0:r.value})),Ii=j(Ti,Xo("name"),((e,t)=>{var r;return null===(r=e[t])||void 0===r?void 0:r.touched})),Ni=(0,e.createContext)({}),Fi=Ni,{Provider:Ri,Consumer:Bi}=Ni;function Li(){return(0,Y.useContext)(Fi)}function Mi(e){const t=Q(),{formId:r,updateControlValue:n,updateControlTouched:o,errors:i}=Li(),s=!!X(Si,{formId:r},[r]),a=(0,Y.useRef)();a.current=s;const c=X(Pi,{formId:r,name:e},[r,e]),u=X(Ii,{formId:r,name:e},[r,e]),l=null==i?void 0:i[e],p=!l;(0,Y.useEffect)((()=>{a.current&&t(xi(r,e))}),[s,r,e,t]),(0,Y.useLayoutEffect)((()=>()=>{t(_i(r,e))}),[s,r,e,t]);const f=(0,Y.useCallback)((t=>n(e,t.target.value)),[e,n]),h=(0,Y.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,Y.useMemo)((()=>({name:e,onInput:f,onBlur:h,value:c})),[e,f,h,c]),(0,Y.useMemo)((()=>({isValid:p,error:l,touched:u})),[p,l,u])]}const Ui=["children","formId","persistData","onError","onSubmit","validationSchema"];function zi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zi(Object(r),!0).forEach((function(t){Hi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qi(e){let{children:t,formId:r,persistData:n,onError:o,onSubmit:i,validationSchema:s}=e,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Ui);const c=Q(),u=X(ki,{formId:r},[r]),[l,p]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)({}),{isValid:d,errors:y}=function(e,t){const r=(0,Y.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[r,n])=>{n&&!Array.isArray(n)&&(n=[n]);for(let i=0;i<(null===(o=n)||void 0===o?void 0:o.length);i++){var o;if(!n[i].fn(e[r],n[i].compareValue)){t[r]=n[i].errorText;break}}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(r).length,errors:r}}(u,s),b=(0,Y.useMemo)((()=>$i($i({},y),f)),[y,f]);(0,Y.useLayoutEffect)((()=>{c(Di(r,n))}),[r,n,c]),(0,Y.useEffect)((()=>()=>{c(ji(r))}),[r,n,c]);const m=(0,Y.useCallback)(((e,t)=>{c(Ci(r,e,t))}),[r,c]),g=(0,Y.useCallback)(((e,t)=>{c(Ai(r,e,t))}),[c,r]),v=(0,Y.useCallback)(((e,t)=>{h((r=>$i($i({},r),{},{[e]:t})))}),[h]),O=(0,Y.useCallback)((e=>{e.preventDefault(),p(!0),d&&i(u,{updateControlValue:m,setError:v})}),[d,i,u,m,v]);(0,Y.useEffect)((()=>{o&&o({errors:b,isSubmitted:l,isValid:0===Object.keys(b).length})}),[l,b,o]);const w=(0,Y.useMemo)((()=>({formId:r,values:u,errors:b,isValid:0===Object.keys(b).length,isSubmitted:l,handleSubmit:O,validationSchema:s,updateControlValue:m,updateControlTouched:g})),[r,u,b,l,O,s,m,g]);return r?i?(0,F.jsx)(Ri,$i($i({},a),{},{value:w,children:t})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}function Vi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vi(Object(r),!0).forEach((function(t){Gi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Gi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ki={},Yi={controls:{}},Ji={value:"",touched:!1};function Qi(e,t,r,n){var o;const i=(null===(o=e[t])||void 0===o?void 0:o.controls[r])||Ji;return Wi(Wi({},e),{},{[t]:Wi(Wi({},e[t]),{},{controls:Wi(Wi({},e[t].controls),{},{[r]:Wi(Wi({},i),n)})})})}const Zi=wi({[Di]:(e,{formId:t,persistData:r})=>{const n=r?e[t]??Wi(Wi({},Yi),{},{persistData:r}):Wi(Wi({},Yi),{},{persistData:r});return Wi(Wi({},e),{},{[t]:n})},[ji]:(e,{formId:t})=>{var r;const n=Wi({},e);return null!==(r=n[t])&&void 0!==r&&r.persistData||delete n[t],n},[xi]:(e,{name:t,formId:r})=>Qi(e,r,t),[_i]:(e,{formId:t,name:r})=>{const n=e[t];if(!n)return e;if(n.persistData)return e;const o=Wi({},n.controls);return delete o[r],Wi(Wi({},e),{},{[t]:Wi(Wi({},n),{},{controls:o})})},[Ci]:(e,{formId:t,name:r,value:n})=>Qi(e,t,r,{value:n}),[Ai]:(e,{formId:t,name:r,touched:n})=>Qi(e,t,r,{touched:n}),[Cr.pending]:()=>Ki},Ki),Xi=["className","disableValidationClasses"];function es(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ts(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const rs=function(e){let{className:t,disableValidationClasses:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Xi);const{handleSubmit:o,isValid:i,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:r}=Li();return{handleSubmit:e,isSubmitted:t,isValid:r}}(),a=["form"];return!r&&s&&(a.push("form--submitted"),i?a.push("form--valid"):a.push("form--invalid")),(0,F.jsx)("form",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?es(Object(r),!0).forEach((function(t){ts(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):es(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({onSubmit:o,className:Br([...a,t])},n))};function ns({id:e,error:t}){const[r,n]=(0,Y.useState)(!1);return(0,Y.useEffect)((()=>{const e=setTimeout((()=>n(!0)),300);return()=>clearTimeout(e)}),[]),(0,F.jsx)("div",{className:Br("error"),"aria-live":"assertive","aria-atomic":"true",children:r&&t&&(0,F.jsxs)("span",{id:e,className:Br("error__message"),children:[(0,F.jsx)(fi,{name:"error",size:"16"}),t]})})}const os=({contentHint:e,id:t,labelText:r,labelClass:n=Br("label"),validity:o,errorText:i,children:s})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("label",{htmlFor:t,className:n,children:r}),e&&(0,F.jsx)("span",{id:`${t}-content-hint`,className:Br("input__content-hint"),children:e}),(0,F.jsx)(ns,{id:`${t}-error`,error:!o&&i}),s]}),is=["id","name","labelText","labelClass","contentHint","aria-describedby","options"];function ss(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function as(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ss(Object(r),!0).forEach((function(t){cs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ss(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function cs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const us=e=>{let{id:t,name:r,labelText:n,labelClass:o,contentHint:i,"aria-describedby":s,options:a=[]}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,is);const{isSubmitted:u}=Li(),[l,{error:p}]=Mi(r),f=u&&p,h=[];return s&&h.push(s),i&&h.push(`${t}-content-hint`),f&&h.push(`${t}-error`),(0,F.jsx)(os,{id:t,contentHint:i,validity:!f,errorText:p,labelText:n,labelClass:o,children:(0,F.jsx)("select",as(as(as({id:t,name:r,"aria-invalid":f?"true":"false","aria-describedby":h.join(" ")||null},l),c),{},{children:a.map((e=>(0,F.jsx)("option",{value:e.value,children:e.label},e.value)))}))})},ls=function({controlName:e,descriptionId:t}){const{t:r}=hn(),{isActive:n,languages:o,currentLocale:i}=ni(),{locale:s}=hn(),a=(0,Y.useMemo)((()=>{var e;return null==o||null===(e=o.find((e=>e.locale===i)))||void 0===e?void 0:e.nativeName}),[o,i]),c=(0,Y.useMemo)((()=>[{value:"",label:r("translations.settings.defaultOptionLabel")},...o.filter((e=>e.locale.toLowerCase()!==String(s).toLowerCase())).map((e=>({value:e.locale,label:e.nativeName})))]),[r,o,s]);return(0,F.jsxs)(rs,{noValidate:"true",className:Br("options__form"),children:[(0,F.jsx)("p",{className:Br("options__description"),id:t,children:r("translations.settings.description")}),n?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("h3",{children:r("translations.settings.currentTranslationLabel")}),(0,F.jsx)("p",{className:Br("options__active-language"),children:a})]}):(0,F.jsx)(us,{name:e,type:"text",className:Br("input__select"),"aria-describedby":t,labelClass:Br("label"),labelText:r("translations.settings.inputLabel"),options:c,defaultValue:i||""}),(0,F.jsx)("div",{className:Br("options__actions"),children:(0,F.jsx)("button",{type:"submit",className:Br("button","button--primary","options__submit"),children:r(n?"translations.settings.endButtonText":"translations.settings.startButtonText")})})]})},{REGISTER_FORM:ps,DE_REGISTER_FORM:fs,REGISTER:hs,DE_REGISTER:ds,SET_VALUE:ys,SET_VALIDITY:bs,SET_STATE:ms,SET_SUBMITTED:gs,SET_PERSIST_FORM_DATA:vs}={REGISTER_FORM:"REGISTER_FORM",DE_REGISTER_FORM:"DE_REGISTER_FORM",REGISTER:"REGISTER",DE_REGISTER:"DEREGISTER",SET_VALUE:"SET_VALUE",SET_VALIDITY:"SET_VALIDITY",SET_STATE:"SET_STATE",SET_SUBMITTED:"SET_SUBMITTED",SET_PERSIST_FORM_DATA:"SET_PERSIST_FORM_DATA"},Os=(e,t,r=null)=>({fn:e,errorText:t,compareValue:r}),ws=(e,t)=>{let r=!0;for(let n=0;n<e.length;n++)e[n].size>t&&(r=!1);return r},Es=e=>!(null==e||!e.length)>0,Ds=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))},js=e=>!!e,xs="translation-settings",_s="locale",Cs=function({onClose:e}){const[t,r]=(0,Y.useState)(void 0),{t:n}=hn(),{isActive:o,enableTranslations:i,disableTranslations:s}=ni(),a=Un(),{focusContainer:c}=ii(),u=(0,Y.useCallback)((({isValid:e,isSubmitted:t})=>{r(t&&!e?"options--error":void 0)}),[r]),l=(0,Y.useRef)(0),p=(0,Y.useMemo)((()=>(l.current+=1,o?{}:{[_s]:Os(js,n("translations.settings.noLocaleText"))})),[o,n]);return(0,F.jsx)(vi,{className:t,onCancel:e,formName:xs,headingText:n("translations.settings.title"),cancelButtonText:n("translations.settings.cancelButtonText"),position:"left",disableButtonFocusing:!0,children:(0,F.jsx)(qi,{onSubmit:({locale:t})=>{o?s():(i(t),e(),c())},formId:xs,validationSchema:p,onError:u,children:(0,F.jsx)(ls,{controlName:_s,descriptionId:a})},l.current)})};function As(){const{t:e}=hn(),[t,r]=(0,Y.useState)(!1),n=(0,Y.useRef)(null),o=Un();return(0,F.jsxs)("div",{className:Br("translations__container"),onKeyDown:e=>{t&&fe(e)===pe.Escape&&(r(!1),he(n.current))},children:[(0,F.jsx)(gi,{transitionStartState:yi,isActive:t,children:(0,F.jsx)("div",{className:Br("options__dialog"),role:"dialog",children:(0,F.jsx)(Cs,{onClose:()=>{r(!1)}})})}),(0,F.jsxs)("button",{type:"button",className:Br(["button","button--secondary","app__options__button"]),id:o,onClick:()=>{r((e=>!e))},onKeyDown:e=>{fe(e)===pe.ArrowDown&&(r(!0),e.preventDefault())},ref:n,"aria-haspopup":"dialog","aria-expanded":t.toString(),children:[(0,F.jsx)(fi,{name:"newTranslation",size:"16"}),(0,F.jsx)("span",{className:Br("button__text"),children:e("translations.settings.openButtonText")})]})]})}function Ss({id:e,label:t,onButtonClick:r,buttonText:n,srButtonText:o,type:i}){const s=Un();return(0,F.jsxs)("section",{className:Br("chat-status",i&&`chat-status--${i}`),id:e,tabIndex:"-1","aria-labelledby":s,children:[(0,F.jsx)("h2",{className:Br("chat-status__title"),id:s,children:t}),(0,F.jsxs)("button",{type:"button",className:Br("button","button--tertiary"),onClick:r,children:[(0,F.jsx)("span",{"aria-hidden":o?"true":void 0,children:n}),o&&(0,F.jsx)("span",{className:Br("visually-hidden"),children:o})]})]})}function Ts(){const{t:e}=hn(),{id:t}=ii(),{hasInterrupt:r}=Wn(),{isActive:n,disableTranslations:o,languages:i,currentLocale:s}=ni(),a=Dn(),c=(0,Y.useMemo)((()=>{var e;return null==i||null===(e=i.find((e=>e.locale===s)))||void 0===e?void 0:e.nativeName}),[i,s]),u=(0,Y.useCallback)((()=>{o(),a()}),[o,a]);return!n||r?null:(0,F.jsx)(Ss,{type:"translations",id:t,label:e("translations.status.label",{language:c}),onButtonClick:u,buttonText:e("translations.status.stopText"),srButtonText:e("translations.status.srStopText")})}const ks=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Ps=({id:e,categories:t=[],question:r,onClick:n,hasIcon:o})=>{const i=(0,Y.useMemo)((()=>["suggestions-item",...t.map(ks)]),[t]),s=(0,Y.useCallback)((()=>{n&&n({id:e,question:r})}),[e,r,n]);return(0,F.jsx)("li",{className:Br(i),children:(0,F.jsxs)("button",{type:"button",onClick:s,className:Br("button","button--primary"),children:[o&&(0,F.jsx)(fi,{name:"chevronRight",size:"8"}),r]})})};function Is(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ns(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fs=({className:e,suggestions:t=[],onClickSuggestion:r,hasIcon:n})=>(0,F.jsx)("ul",{className:Br("suggestions__list",e),children:t.map((e=>(0,F.jsx)(Ps,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Is(Object(r),!0).forEach((function(t){Ns(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Is(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({hasIcon:n,onClick:r},e),e.id)))}),Rs=({isAside:e})=>{const{layoutMode:t}=ee(),{t:r}=hn(),{sendAction:n,addMessageBubble:o}=go(),{isOpen:i,setVisibility:s}=so(),a=Un(),c=Dn(),u=(0,Y.useRef)(null),{sendPolite:l}=Oo(),{hasInterrupt:p}=Wn(),{hasCountdown:f,endCountdown:h}=Lo(),{hasPrompt:d,continueChat:y}=Uo(),b=io(),m=ur("suggestion"),[g]=oi({payload:m}),v=(0,Y.useMemo)((()=>m&&!p?g:[]),[m,p,g]),O=(0,Y.useRef)(null),w=(0,Y.useRef)(!1),E=(0,Y.useRef)([]),D=!!v.length,j="inline"===t?(b||i)&&!e:b,x=(0,Y.useRef)(j),C=D&&!j,A=D?v:E.current;E.current=A;const S=(0,Y.useCallback)((({id:e,question:t})=>{f&&h(!0),d&&y(),n({type:je,originMessage:m.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),o(t),i||s(_.open),c()}),[o,y,h,c,f,d,m,n,s,i]);(0,Y.useEffect)((()=>{if(O.current!==v&&!j){if(D){const e=w.current?r("suggestions.srUpdatedText"):r("suggestions.srAvailableText");setTimeout((()=>{l(e)}),30)}else w.current&&l(r("suggestions.srUnavailableText"));O.current=v}!x.current&&j?(de(u.current,c),l(r("suggestions.srUnavailableText"))):!D&&w.current&&de(u.current,c),w.current=D,x.current=j}),[v,D,j,c,l,r]);const T=r("suggestions.headingText"),k=r("suggestions.footerText"),P=T?"section":"div";return(0,F.jsx)(gi,{isActive:C,transitionStartState:yi,children:(0,F.jsxs)(P,{className:Br("suggestions"),"aria-labelledby":T?a:null,ref:u,children:[T&&(0,F.jsx)("h2",{id:a,className:Br("suggestions__heading"),children:T}),!!A.length&&(0,F.jsx)(Fs,{hasIcon:!0,suggestions:A,onClickSuggestion:S}),k&&!i&&(0,F.jsx)("p",{className:Br("suggestions__footer"),children:k})]})})},Bs=({children:e,className:t="",isDeprecated:r})=>{const[,n]=wn(),{isOpen:o,isVisible:i,setVisibility:s}=so(),{zIndex:a,namespace:c,layoutMode:u}=ee(),{isInline:l}=lr(),p=Vr(),f=io(),{locale:h,t:d}=hn(),y=(0,Y.useCallback)((e=>{n(e)}),[n]),b=(0,Y.useMemo)((()=>{if(h&&document.querySelector("html").getAttribute("lang")!==h)return h}),[h]),m=[r?"app--deprecated":"app",`app--layout-${u}`,`namespace--${c}`,...p,t];return o||"app"===u||m.push("app--collapsed"),f&&m.push("app--user-responded"),i&&(0,F.jsxs)("section",{className:Br(m),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&o&&s(_.minimized)},lang:b,tabIndex:"-1",ref:y,style:{zIndex:a},"data-nosnippet":!0,"aria-label":d("app.srLabel"),children:[(0,F.jsx)("div",{className:Br("app-wrapper"),children:e}),"inline"===u&&o&&(0,F.jsx)(Rs,{isAside:!0})]})},Ls=({originalError:e,title:t,message:r,buttonText:n,action:o,srText:i})=>{const s=go(),a=Un(),{sendPolite:c}=Oo(),u=Dn(),l=e instanceof Or;return(0,Y.useEffect)((()=>{l&&s[o]()}),[o,s,l]),(0,Y.useEffect)((()=>{!l&&i&&setTimeout((()=>{c(i)}),200)}),[c,i,l]),!l&&(0,F.jsx)("section",{className:Br("interrupt"),"aria-labelledby":a,children:(0,F.jsxs)("div",{className:Br("interrupt__body"),children:[(0,F.jsx)("h2",{id:a,className:Br("interrupt__title"),children:t}),(0,F.jsx)("p",{className:Br("interrupt__message"),children:r}),n&&o&&(0,F.jsx)("div",{className:Br("interrupt__actions"),children:(0,F.jsx)("button",{type:"button",className:Br("button","button--primary"),onClick:()=>{s[o](),u()},children:n})})]})})},Ms=(0,e.createContext)({}),Us=e=>{const t=(0,Y.useContext)(Ms);let r=null;"choice_prompt"===e.payload.type&&(r=t[e.type][e.payload.body.prompt.type]);const n=t[e.type][e.payload.type]||t.fallback;return[n&&"function"!=typeof n?n[e.payload.body.type]||t.fallback:n,r]};function zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zs(Object(r),!0).forEach((function(t){Hs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qs({children:e,childrenHTML:t,className:r,graphicSrc:n,graphicType:o="icon",iconName:i,iconSize:s,iconClassName:a,dividerType:c}){const u=Boolean(i||n),l=t?{dangerouslySetInnerHTML:{__html:t}}:{children:e};return(0,F.jsxs)("div",{className:Br("divider",c&&`divider--type-${c}`,r),children:[u&&(0,F.jsx)("span",{className:Br("divider__graphic"),children:i?(0,F.jsx)(fi,{name:i,size:s,className:a}):(0,F.jsx)("img",{src:n,className:Br({icon:"icon"===o,avatar:"avatar"===o},a)})}),(0,F.jsx)("div",$s({className:Br("divider__body")},l))]})}const Vs={month:"long",day:"numeric",year:"numeric"},Ws={hour:"numeric",minute:"numeric"},Gs=({event:e})=>{const t=(()=>{const[e,t]=(0,Y.useReducer)((e=>e+1),0);return(0,Y.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:r,time:n,timeUntilMidnight:o,srText:i}=(e=>{var t;const{t:r}=hn(),n=ee(),o=(null==n||null===(t=n.context)||void 0===t?void 0:t.locale)??[],i=new Date(e),s=new Date,a=new Date(s);a.setHours(24,0,0,0);const c=a-s,u=i.toString(),l=new Intl.DateTimeFormat(o,Ws).format(i);let p=((e,t)=>{const r=new Date(t).setHours(0,0,0,0),n=e.getTime(),o=864e5;return n>=r+o?e:n>r?"today":n>r-o?"yesterday":e})(i,s);switch(p){case"today":p=r("dateTime.today");break;case"yesterday":p=r("dateTime.yesterday");break;default:p=new Intl.DateTimeFormat(o,Vs).format(i)}return{date:p,srText:r("dateTime.srText",{date:p,time:l}),time:l,fullDateTime:u,timeUntilMidnight:c}})(ie(e.timeIndicator));return(0,Y.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,F.jsxs)(qs,{dividerType:"time-indicator",children:[(0,F.jsxs)("p",{className:Br("divider__time"),"aria-hidden":"true",children:[(0,F.jsx)("span",{children:r}),(0,F.jsx)("span",{children:n})]}),(0,F.jsx)("p",{className:Br("visually-hidden"),children:i})]})},Ks=({event:e,newParticipant:t})=>{const[r,n]=Us(e);if(!r)return null;const o=["conversation__item"];return"info"===e.type?o.push("conversation__item--source-info"):e.payload.fromClient?o.push("conversation__item--source-user"):o.push("conversation__item--source-agent"),t&&o.push("conversation__item--new-participant"),(0,F.jsxs)("li",{className:Br(o),children:[e.timeIndicator&&(0,F.jsx)(Gs,{event:e}),(0,F.jsx)(r,{event:e,children:(0,F.jsx)(n,{event:e})})]})},Ys=({eventPayload:e})=>{const{fromClient:t,participant:r}=e,n=(e=>er().participantInfo.participants[e])(r)||{},{messages:o,defaults:i}=ee(),s=n&&n.name,{showAvatar:a,showName:c}=o[t?"user":"agent"]||{},{userName:u}=i||{};if(!a&&!c)return null;const l=[];a&&s&&n.avatar&&l.push((0,F.jsx)("span",{className:Br("message__avatar"),children:(0,F.jsx)("img",{src:n.avatar,className:Br("avatar"),alt:""})}));const p=t&&u||s;return c&&p&&l.push((0,F.jsx)("span",{className:Br("message__author-name"),children:p})),l.length>0&&(0,F.jsx)("div",{className:Br("message__author"),children:l})},Js=()=>{const{id:e}=cr()||{};return(0,F.jsx)("li",{className:Br("conversation__item","conversation__item--source-agent"),children:(0,F.jsxs)("div",{className:Br("message","message--source-agent","message--type-loading"),children:[(0,F.jsx)(Ys,{eventPayload:{fromClient:!1,participant:e}}),(0,F.jsx)("div",{className:Br("message__body"),children:(0,F.jsxs)("span",{className:Br("loader"),children:[(0,F.jsx)("span",{className:Br("loader__part","one")}),(0,F.jsx)("span",{className:Br("loader__part","two")}),(0,F.jsx)("span",{className:Br("loader__part","three")}),(0,F.jsx)("span",{className:Br("loader__part","four")})]})})]})})},Qs=["showParticipant","showTranslationToggle","event","type","modifiers","children","bodyProps","info"];function Zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Zs(Object(r),!0).forEach((function(t){ea(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ea(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ta=function(e){let{showParticipant:t=!0,showTranslationToggle:r=!0,event:n,type:o,modifiers:i,children:s,bodyProps:a={},info:c}=e,u=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Qs);const l=Wr(n),{t:p}=hn(),[,{hasTranslation:f,isTranslated:h,toggleTranslation:d,locale:y}]=oi(n);return o&&l.push("message--type-"+o),i&&("string"==typeof i&&(i=i.split(" ").filter((e=>e.length))),i.forEach((e=>{l.push("message--"+e)}))),h&&l.push("message--is-translated"),f&&l.push("message--has-translation"),h&&(a=Xs(Xs({},a),{},{lang:y})),(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)("div",Xs(Xs({className:Br(l)},u),{},{children:[t&&(0,F.jsx)(Ys,{eventPayload:n.payload}),(0,F.jsx)("div",Xs(Xs({className:Br("message__body")},a),{},{children:s})),c&&(0,F.jsx)("div",{"aria-hidden":"true",className:Br("message__info"),children:c}),r&&f&&(0,F.jsx)("div",{className:Br("message__translation-info"),children:(0,F.jsx)("button",{className:Br("message__translation-toggle","button","button--secondary"),onClick:d,children:p(h?"translations.toggle.hideButtonText":"translations.toggle.showButtonText")})})]}))})},ra=["event","children"];function na(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oa(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?na(Object(r),!0).forEach((function(t){ia(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):na(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ia(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const sa=e=>{const{payload:t}=e,[r,n]=(0,Y.useState)(!1),{sendAction:o,addMessageBubble:i,addDivider:s}=go(),{activeServiceSessionId:a}=er().serviceInfo,c=Z(ar),[u]=oi(e),{service:l}=t,p=(0,Y.useMemo)((()=>{var t;return oa(oa({},e),{},{payload:oa(oa({},e.payload),{},{body:null===(t=e.payload.body)||void 0===t?void 0:t.prompt,translatedBody:e.payload.translatedBody&&oa(oa({},e.payload.translatedBody),{},{data:e.payload.translatedBody.data.prompt})})})}),[e]),f=u.chooseAgain&&a===l.serviceSessionId&&t.id!==c;return(0,Y.useEffect)((()=>{n(t.id===c)}),[t,c]),{body:u,subEvent:p,showOptions:r,chooseAgain:f,onChoiceClickHandler:e=>{f&&s("new_topic"),i(e.text),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:f}}),n(!1)},onChooseAgainClickHandler:()=>{n((e=>!e))}}};var aa=r(853),ca=r.n(aa);const ua=e=>{try{return ca()(e)}catch(t){return console.log("Could not parse message",e,t),""}},la=e=>{const{sendAction:t}=go();return r=>{r.target&&r.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:r.target.dataset.linkId,url:r.target.getAttribute("href")}})}},pa=["event"];function fa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ha(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fa(Object(r),!0).forEach((function(t){da(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function da(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ya=e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,pa);const[n]=oi(t),o=la(t.payload.id),i=(0,Y.useMemo)((()=>t.payload.fromClient?{children:(0,F.jsx)("p",{children:n.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:ua(n.text)}}}),[n,t]);return(0,F.jsx)(ta,ha(ha({type:"text",event:t,onClick:o},r),i))};var ba=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],ma=ba.join(","),ga="undefined"==typeof Element?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,va=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?function(e){return"true"===e.contentEditable}(e)?0:"AUDIO"!==e.nodeName&&"VIDEO"!==e.nodeName&&"DETAILS"!==e.nodeName||null!==e.getAttribute("tabindex")?e.tabIndex:0:t},Oa=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},wa=function(e){return"INPUT"===e.tagName},Ea=function(e,t){return!(t.disabled||function(e){return wa(e)&&"hidden"===e.type}(t)||function(e,t){if("hidden"===getComputedStyle(e).visibility)return!0;var r=ga.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ga.call(r,"details:not([open]) *"))return!0;if(t&&"full"!==t){if("non-zero-area"===t){var n=e.getBoundingClientRect(),o=n.width,i=n.height;return 0===o&&0===i}}else for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(t,e.displayCheck)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(wa(e)||"SELECT"===e.tagName||"TEXTAREA"===e.tagName||"BUTTON"===e.tagName)for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var r=0;r<t.children.length;r++){var n=t.children.item(r);if("LEGEND"===n.tagName)return!n.contains(e)}return!0}t=t.parentElement}return!1}(t))},Da=function(e,t){return!(!Ea(e,t)||function(e){return function(e){return wa(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,r=e.form||e.ownerDocument,n=function(e){return r.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=n(window.CSS.escape(e.name));else try{t=n(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 r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]}(t,e.form);return!o||o===e}(e)}(t)||va(t)<0)},ja=ba.concat("iframe").join(","),xa=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ga.call(e,ja)&&Ea(t,e)};function _a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ca(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Aa,Sa=(Aa=[],{activateTrap:function(e){if(Aa.length>0){var t=Aa[Aa.length-1];t!==e&&t.pause()}var r=Aa.indexOf(e);-1===r||Aa.splice(r,1),Aa.push(e)},deactivateTrap:function(e){var t=Aa.indexOf(e);-1!==t&&Aa.splice(t,1),Aa.length>0&&Aa[Aa.length-1].unpause()}}),Ta=function(e){return setTimeout(e,0)},ka=function(e,t){var r=-1;return e.every((function(e,n){return!t(e)||(r=n,!1)})),r},Pa=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e?e.apply(void 0,r):e},Ia=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},Na=function(e,t){var r,n=(null==t?void 0:t.document)||document,o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_a(Object(r),!0).forEach((function(t){Ca(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},s=function(e,t,r){return e&&void 0!==e[t]?e[t]:o[r||t]},a=function(e){return!(!e||!i.containers.some((function(t){return t.contains(e)})))},c=function(e){var t=o[e];if("function"==typeof t){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];t=t.apply(void 0,i)}if(!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var a=t;if("string"==typeof t&&!(a=n.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},u=function(){var e=c("initialFocus");if(!1===e)return!1;if(void 0===e)if(a(n.activeElement))e=n.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},l=function(){if(i.tabbableGroups=i.containers.map((function(e){var t=function(e,t){var r=[],n=[];return function(e,t,r){var n=Array.prototype.slice.apply(e.querySelectorAll(ma));return t&&ga.call(e,ma)&&n.unshift(e),n.filter(r)}(e,(t=t||{}).includeContainer,Da.bind(null,t)).forEach((function(e,t){var o=va(e);0===o?r.push(e):n.push({documentOrder:t,tabIndex:o,node:e})})),n.sort(Oa).map((function(e){return e.node})).concat(r)}(e);if(t.length>0)return{container:e,firstTabbableNode:t[0],lastTabbableNode:t[t.length-1]}})).filter((function(e){return!!e})),i.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},p=function e(t){!1!==t&&t!==n.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(u()))},f=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},h=function(e){var t=Ia(e);a(t)||(Pa(o.clickOutsideDeactivates,e)?r.deactivate({returnFocus:o.returnFocusOnDeactivate&&!xa(t)}):Pa(o.allowOutsideClick,e)||e.preventDefault())},d=function(e){var t=Ia(e),r=a(t);r||t instanceof Document?r&&(i.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),p(i.mostRecentlyFocusedNode||u()))},y=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==Pa(o.escapeDeactivates,e))return e.preventDefault(),void r.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=Ia(e);l();var r=null;if(i.tabbableGroups.length>0){var n=ka(i.tabbableGroups,(function(e){return e.container.contains(t)}));if(n<0)r=e.shiftKey?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var o=ka(i.tabbableGroups,(function(e){var r=e.firstTabbableNode;return t===r}));if(o<0&&i.tabbableGroups[n].container===t&&(o=n),o>=0){var s=0===o?i.tabbableGroups.length-1:o-1;r=i.tabbableGroups[s].lastTabbableNode}}else{var a=ka(i.tabbableGroups,(function(e){var r=e.lastTabbableNode;return t===r}));if(a<0&&i.tabbableGroups[n].container===t&&(a=n),a>=0){var u=a===i.tabbableGroups.length-1?0:a+1;r=i.tabbableGroups[u].firstTabbableNode}}}else r=c("fallbackFocus");r&&(e.preventDefault(),p(r))}(e)},b=function(e){if(!Pa(o.clickOutsideDeactivates,e)){var t=Ia(e);a(t)||Pa(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())}},m=function(){if(i.active)return Sa.activateTrap(r),i.delayInitialFocusTimer=o.delayInitialFocus?Ta((function(){p(u())})):p(u()),n.addEventListener("focusin",d,!0),n.addEventListener("mousedown",h,{capture:!0,passive:!1}),n.addEventListener("touchstart",h,{capture:!0,passive:!1}),n.addEventListener("click",b,{capture:!0,passive:!1}),n.addEventListener("keydown",y,{capture:!0,passive:!1}),r},g=function(){if(i.active)return n.removeEventListener("focusin",d,!0),n.removeEventListener("mousedown",h,!0),n.removeEventListener("touchstart",h,!0),n.removeEventListener("click",b,!0),n.removeEventListener("keydown",y,!0),r};return(r={activate:function(e){if(i.active)return this;var t=s(e,"onActivate"),r=s(e,"onPostActivate"),o=s(e,"checkCanFocusTrap");o||l(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,t&&t();var a=function(){o&&l(),m(),r&&r()};return o?(o(i.containers.concat()).then(a,a),this):(a(),this)},deactivate:function(e){if(!i.active)return this;clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,g(),i.active=!1,i.paused=!1,Sa.deactivateTrap(r);var t=s(e,"onDeactivate"),n=s(e,"onPostDeactivate"),o=s(e,"checkCanReturnFocus");t&&t();var a=s(e,"returnFocus","returnFocusOnDeactivate"),c=function(){Ta((function(){a&&p(f(i.nodeFocusedBeforeActivation)),n&&n()}))};return a&&o?(o(f(i.nodeFocusedBeforeActivation)).then(c,c),this):(c(),this)},pause:function(){return i.paused||!i.active||(i.paused=!0,g()),this},unpause:function(){return i.paused&&i.active?(i.paused=!1,l(),m(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?n.querySelector(e):e})),i.active&&l(),this}}).updateContainerElements(e),r};function Fa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ra(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fa(Object(r),!0).forEach((function(t){Ba(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ba(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const La=({children:t,onClose:r,"aria-label":n,"aria-labelledby":o,fallBackFocusRef:i})=>{const s=Un(),a=(0,Y.useRef)(null),c=(0,Y.useRef)(null),[u,l]=(0,Y.useState)(!1);return(0,Y.useEffect)((()=>(u&&(c.current=Na(a.current,{initialFocus:i&&i.current?i.current:null}),c.current.activate()),()=>{c.current&&c.current.deactivate()})),[u,i]),(0,Y.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((r=>{const n=r.getAttribute("aria-hidden");null!==n&&"false"!==n||(e.push(n),t.push(r),r.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,r)=>{const n=e[r];null===n?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",n)}))}})();return()=>{e()}}),[u]),(0,Y.useEffect)((()=>{u&&a.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&r()}))}),[u,r]),(0,Y.useLayoutEffect)((()=>{const e=document.getElementsByTagName("body")[0],t=document.createElement("div");return t.setAttribute("id",s),t.setAttribute("role","dialog"),t.setAttribute("data-nosnippet","true"),t.setAttribute("aria-modal","true"),n&&t.setAttribute("aria-label",n),o&&t.setAttribute("aria-labelledby",o),e.appendChild(t),a.current=t,l(!0),()=>{a.current&&(e.removeChild(a.current),a.current=null)}}),[n,o,s]),"function"==typeof t?t({onClose:r,modalRenderFn:t=>a.current&&(0,e.render)(t,a.current)}):a.current&&(0,e.render)((0,e.toChildArray)(t).map((e=>(e.props=Ra(Ra({},e.props),{},{onClose:r}),e))),a.current)},Ma=({url:e,description:t,onClose:r})=>{const{zIndex:n,layoutMode:o,namespace:i}=ee(),s=Eo(),a=Vr(),c=(0,Y.useRef)(null),{t:u}=hn(),l=["modal",`app--layout-${o}`,`namespace--${i}`,...a],p=e=>{e.stopPropagation()},f=()=>{r()},h=n?{zIndex:n+1}:void 0;return(0,F.jsx)(La,{onClose:r,"aria-label":u("lightbox.heading"),fallBackFocusRef:c,children:({onClose:r,modalRenderFn:n})=>n((r=>(0,F.jsx)("div",{className:Br(l),onClick:f,style:h,children:(0,F.jsxs)("div",{className:Br("modal__float"),tabIndex:"-1",onMouseDown:s,onKeyDown:s,onTouchStart:s,onMouseMove:s,onWheel:s,onPointerDown:s,onPointerMove:s,ref:c,children:[(0,F.jsx)("div",{className:Br("modal__inner"),onClick:p,children:(0,F.jsx)("img",{className:Br("modal__image"),src:e,alt:t})}),(0,F.jsxs)("button",{type:"button",className:Br("modal__close"),onClick:r,children:[(0,F.jsx)(fi,{name:"close",size:"16"}),u("lightbox.closeLabel")]})]})}))(r))})},Ua=({description:e,url:t})=>{const{t:r}=hn(),[n,o]=(0,Y.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("button",{type:"button",className:Br("modal__enlarge"),onClick:()=>{o(!0)},children:[r("message.image.srTextEnlargeButtonLabel",{description:e}),(0,F.jsx)(fi,{name:"enlarge",size:"32"})]}),n&&(0,F.jsx)(Ma,{url:t,description:e,onClose:()=>{o(!1)}})]})},za=["event","descriptorId"];function $a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ha(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$a(Object(r),!0).forEach((function(t){qa(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Va=["event","descriptorId"];function Wa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ga(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wa(Object(r),!0).forEach((function(t){Ka(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ka(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ya={[Pe.new_topic]:"newtopic"},Ja=["event"];function Qa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Za(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Xa={default:({event:e})=>{const{t}=hn(),{subtype:r}=e.payload.body,n=Ya[Pe[r]];return(0,F.jsx)(qs,{dividerType:n,iconName:Pe[r],children:(0,F.jsx)("p",{children:t(`dividerKeys.${Pe[r]}`)})})},[Pe.new_translation]:({event:e})=>{const{t}=hn(),{translationEnabled:r,translationLocale:n,text:o}=e.payload.body,{enableTranslations:i,languages:s}=ni(),a=(0,Y.useMemo)((()=>{var e;return null==s||null===(e=s.find((e=>e.locale===n)))||void 0===e?void 0:e.nativeName}),[s,n]);return(0,F.jsxs)(qs,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,F.jsx)("p",{className:Br("divider__title"),children:t(r?"translations.divider.startText":"translations.divider.stopText",{language:a})}),r?(0,F.jsx)("p",{children:o}):(0,F.jsx)("button",{className:Br("button","button--secondary"),onClick:()=>{i(n)},children:t("translations.divider.restartButtonText")})]})}},ec=["event"];function tc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tc(Object(r),!0).forEach((function(t){nc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const oc=["event"];function ic(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ic(Object(r),!0).forEach((function(t){ac(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ic(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ac(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const cc=e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,oc);const{payload:n}=t,[o]=oi(t),i=la(n.id);return(0,F.jsx)(ta,sc(sc({type:"splash",event:t,onClick:i},r),{},{bodyProps:{dangerouslySetInnerHTML:{__html:ua(o.text)}}}))},uc=["event"];function lc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lc(Object(r),!0).forEach((function(t){fc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function fc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const hc=({children:e,url:t,target:r})=>t?(0,F.jsx)("a",{href:t,download:!0,target:r||void 0,children:e}):(0,F.jsx)("span",{children:e});function dc({items:e,currentIndex:t,onChange:r,getItemKey:n,getItemLabel:o}){const i=e.length,s=(0,Y.useCallback)((e=>{const n=Number(e.target.dataset.item||"0"),o=Math.min(i-1,Math.max(0,n));o!==t&&r(o)}),[i,t,r]);return(0,F.jsx)("div",{className:Br("carousel-pagination__wrapper"),role:"group",children:(0,F.jsx)("ul",{className:Br("carousel-pagination"),children:e.map(((e,r)=>{const i=t===r;return(0,F.jsx)("li",{className:Br("carousel-pagination__item",i?"is-active":void 0),children:(0,F.jsx)("button",{className:Br("carousel-pagination__button"),type:"button",onClick:s,"data-item":r,"aria-disabled":i?"true":void 0,"aria-label":o(e,r)})},n(e,r,"pagination-item-"))}))})})}function yc({items:e,currentIndex:t,onChange:r,children:n}){const{t:o}=hn(),i=e.length;return(0,F.jsxs)("div",{className:Br("carousel-controls"),children:[(0,F.jsx)("button",{className:Br("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{r((t-1+i)%i)},children:(0,F.jsx)(fi,{name:"arrowLeft",size:"16"})}),n,(0,F.jsx)("button",{className:Br("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{r((t+1)%i)},children:(0,F.jsx)(fi,{name:"arrowRight",size:"16"})})]})}function bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function mc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bc(Object(r),!0).forEach((function(t){gc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function gc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vc=({id:e,action:t,buttonText:r,description:n,hasFocus:o,image:i,title:s,isCarouselItem:a})=>{const c=(0,Y.useRef)(null),{sendMessage:u,sendAction:l,emitEvent:p}=go(),f=Un(),h=(0,Y.useRef)(),d=t.type===Fe?"a":"button",y=(0,Y.useCallback)((()=>p("action.click_card",{type:Se,originMessage:e,action:t})),[p,e,t]),b=(0,Y.useCallback)((()=>{if(y(),"ask"===t.type)u({body:t.ask});else if("topic"===t.type){const{topic:e,fallbackMessage:r}=t;l({type:"set_topic",body:{name:e,fallbackMessage:r}})}}),[u,t,l,y]),m=(0,Y.useMemo)((()=>t.type===Fe?{href:t.link,rel:"noopener noreferrer",target:t.newTab?"_blank":"_self",onClick:y}:{onClick:b}),[t,b,y]);return(0,Y.useEffect)((()=>{a&&(o&&h.current?window.requestAnimationFrame((()=>c.current.focus())):c.current.blur()),h.current=!0}),[o,a]),(0,F.jsxs)("div",{className:Br("card__wrapper"),id:e,tabIndex:"-1",ref:c,children:[(0,F.jsx)("img",{className:Br("card__image"),src:i,alt:""}),(0,F.jsxs)("div",{className:Br("card__content"),id:e,children:[s&&(0,F.jsx)("h2",{className:Br("card__title"),children:s}),n&&(0,F.jsx)("div",{className:Br("card__description"),dangerouslySetInnerHTML:{__html:ua(n)}}),(0,F.jsx)(d,mc(mc({tabIndex:a&&!o?"-1":void 0,className:Br("button","button--primary"),"aria-describedby":f},m),{},{children:r}))]})]})};function Oc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oc(Object(r),!0).forEach((function(t){Ec(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ec(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dc({item:e,items:t,index:r,isActive:n}){const{t:o}=hn();return(0,F.jsx)("div",{className:Br("carousel-item",`carousel-item--${e.type}`),role:"group","aria-roledescription":"slide","aria-label":o("carousel.slide.label",{index:r+1,total:t.length}),children:(0,F.jsx)(vc,wc(wc({},e),{},{isCarouselItem:!0,hasFocus:n}))})}const jc=(e,t,r)=>`${r}${t}`,xc=e=>e.label,_c=({target:e})=>{e.scrollLeft=0};function Cc({currentIndex:t,onChange:r,getItemKey:n=jc,getItemLabel:o=xc,items:i}){const s=Un(),a=i.length,[c,u]=(0,Y.useState)(Number(t||"0"));(0,Y.useEffect)((()=>{u(Number(t||"0"))}),[u,t]);const l=(0,Y.useRef)([]);l.current=(0,Y.useMemo)((()=>Array(a).fill(1).map((()=>(0,e.createRef)()))),[a]);const p=(0,Y.useRef)(!0),f=(0,Y.useRef)();return f.current=r,(0,Y.useEffect)((()=>{p.current?p.current=!1:f.current&&f.current(c)}),[c]),(0,F.jsxs)("div",{className:Br("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,F.jsx)("div",{className:Br("carousel__slides-wrapper"),onScroll:_c,children:(0,F.jsx)("div",{id:s,className:Br("carousel__slides"),style:{width:100*a+"%",left:-100*c+"%"},"aria-live":"polite","aria-atomic":"false",children:i.map(((e,t)=>{const r=c===t;return(0,F.jsx)("div",{ref:l.current[t],className:Br("carousel__slide",r?"is-active":void 0),"aria-hidden":r?void 0:"true",children:(0,F.jsx)(Dc,{item:e,items:i,currentIndex:c,index:t,isActive:r})},n(e,t,"item-"))}))})}),(0,F.jsx)("div",{className:Br("carousel__controls"),children:(0,F.jsx)(yc,{currentIndex:c,items:i,onChange:u,controlId:s,children:(0,F.jsx)("div",{className:Br("carousel__pagination"),children:(0,F.jsx)(dc,{currentIndex:c,items:i,onChange:u,getItemKey:n,getItemLabel:o})})})})]})}const Ac=(e,t,r="")=>`${r}${e.title}:${t}`,Sc=e=>e.title;function Tc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function kc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tc(Object(r),!0).forEach((function(t){Pc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ic=["event"];function Nc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nc(Object(r),!0).forEach((function(t){Rc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Rc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bc(Object(r),!0).forEach((function(t){Mc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Uc={message:{choice_prompt:t=>{let{event:r,children:n}=t,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,ra);const{t:i}=hn(),s=Un(),{body:a,subEvent:c,showOptions:u,chooseAgain:l,onChoiceClickHandler:p,onChooseAgainClickHandler:f}=sa(r);return(0,F.jsxs)(F.Fragment,{children:[(0,e.toChildArray)(n).map((e=>(e.props=oa(oa({},e.props),{},{event:c,descriptorId:s,showTranslationToggle:!1}),e))),l&&(0,F.jsxs)("button",{type:"button",className:Br("button","button--secondary","button--choose-again"),"aria-expanded":u?"true":"false",onClick:f,"aria-describedby":s,children:[i(u?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,F.jsx)(fi,{name:"chevronDown",size:"8"})]}),u&&(0,F.jsx)(ta,oa(oa({type:"choice-prompt",showParticipant:!1,event:r},o),{},{children:(0,F.jsx)("ul",{className:Br("choice-prompt","choice-prompt--many"),children:a.choices.map((e=>(0,F.jsx)("li",{className:Br("choice-prompt__item",{[`choice-prompt__item--${e.category}`]:e.category}),children:(0,F.jsx)("button",{type:"button",className:Br("button","button--primary"),onClick:()=>{p(e)},children:e.text})},e.id)))})}))]})},text:ya,image:e=>{let{event:t,descriptorId:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,za);const[o]=oi(t),{description:i,url:s,isZoomable:a}=o,[c,u]=(0,Y.useState)(!1);return(0,F.jsxs)(ta,Ha(Ha({event:t,type:"image"},n),{},{children:[(0,F.jsx)("img",{src:s,id:r,alt:i,onLoad:()=>{u(!0)}}),a&&c&&(0,F.jsx)(Ua,{description:i,url:s})]}))},splash:cc,video:e=>{let{event:t,descriptorId:r}=e,n=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Va);const[o]=oi(t),{description:i,url:s}=o;return Wr(t).push("message--type-video"),(0,F.jsxs)(ta,Ga(Ga({event:t,type:"video"},n),{},{children:[(0,F.jsx)("div",{id:r,className:Br("visually-hidden"),children:i}),(0,F.jsx)("iframe",{title:i,src:s,allow:"autoplay; encrypted-media",allowFullScreen:!0})]}))},upload:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,uc);const{t:n}=hn(),[o]=oi(t),{fromClient:i}=t.payload,{filename:s,url:a}=o,c=(0,Y.useMemo)((()=>n(a?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:s})),[a,s,n]);return(0,F.jsx)(ta,pc(pc({event:t,type:"upload"},r),{},{children:(0,F.jsxs)("div",{className:Br("download"),children:[(0,F.jsx)(fi,{name:"download",size:"16"}),(0,F.jsxs)(hc,{url:a,target:i?void 0:"_blank",children:[(0,F.jsx)("span",{"aria-hidden":"true",className:Br("file-download"),children:s}),(0,F.jsx)("span",{className:Br("visually-hidden"),children:c})]})]})}))},cta:({event:e})=>{const[t]=oi(e),r=la(e.payload.id),{emitEvent:n}=go(),o=Un(),i=(0,Y.useCallback)((()=>n("action.click_cta",{type:Se,originMessage:e.payload.id,link:{url:t.buttonLink}})),[n,t,e]);return(0,F.jsxs)(ta,{type:"cta",event:e,children:[(0,F.jsx)("div",{className:Br("cta__content"),id:o,dangerouslySetInnerHTML:{__html:ua(t.description)},onClick:r}),(0,F.jsx)("a",{className:Br("button","button--primary"),"aria-describedby":o,href:t.buttonLink,rel:"noreferrer",target:t.buttonNewTab?"_blank":"_self",onClick:i,children:t.buttonText})]})},carousel:({event:e})=>{const t=e.payload.body.cards;return(0,F.jsx)(ta,{event:e,modifiers:"type-carousel",children:(0,F.jsx)(Cc,{items:t,ItemComponent:Dc,getItemKey:Ac,getItemLabel:Sc})})},card:({event:e})=>{const[t]=oi(e),r=Un();return(0,F.jsx)(ta,{type:"card",event:e,children:(0,F.jsx)(vc,kc({id:r},t))})}},info:{text:ya,divider:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Ja);const n=Xa[Pe[t.payload.body.subtype]]||Xa.default;return(0,F.jsx)(n,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qa(Object(r),!0).forEach((function(t){Za(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qa(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({event:t},r))},translation:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,ec);const{t:n}=hn(),[o]=oi(t);return(0,F.jsx)(ta,rc(rc({type:"text",event:t},r),{},{children:n(o.key.join("."),o.variables)}))},timeIndicator:Gs},participant:{participant:({event:e})=>{const{agentIcon:t}=ee().defaults||{},{participant:r}=e.payload,[n]=oi(e),o=(0,Y.useMemo)((()=>n?ua(n):void 0),[n]);if(!o)return null;const i=r.avatar||t;return(0,F.jsx)(qs,{graphicSrc:i,graphicType:r.avatar?"avatar":void 0,iconName:i?void 0:"balloon",childrenHTML:o,dividerType:"participant"})}},service_data:{suggestion:e=>{let{event:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Ic);const{t:n}=hn(),o=n("suggestions.headingText"),i=n("suggestions.footerText"),{sendAction:s,addMessageBubble:a}=go(),{suggestions:c,payload:u}=(e=>{const{payload:t}=e,[r]=oi(e);return{suggestions:r,payload:t}})(t),l=(0,Y.useCallback)((({id:e,question:t})=>{s({type:je,originMessage:u.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),a(t)}),[u,s,a]);return(0,F.jsxs)("div",{className:Br("suggestions","suggestions--conversation"),children:[o&&(0,F.jsx)("h2",{className:Br("suggestions__heading"),children:o}),(0,F.jsxs)(ta,Fc(Fc({type:"suggestions",showParticipant:!1,event:t},r),{},{children:[(0,F.jsx)(Fs,{className:"suggestions__list--conversation",onClickSuggestion:l,suggestions:c}),i&&(0,F.jsx)("p",{className:Br("suggestions__footer"),children:i})]}))]})}}},zc=({children:e})=>{const{customComponents:t}=ee(),r=(0,Y.useMemo)((()=>Object.keys(Uc).reduce(((e,r)=>Lc(Lc({},e),{},{[r]:Lc(Lc({},Uc[r]),t?t[r]:{})})),{fallback:ya})),[t]);return(0,F.jsx)(Ms.Provider,{value:r,children:e})},$c=()=>{const{t:e}=hn(),{showDisclaimer:t}=ee();return t&&(0,F.jsxs)("div",{className:Br("disclaimer"),tabIndex:"0",children:[(0,F.jsx)("h2",{className:Br("disclaimer__title"),children:e("disclaimer.title")}),(0,F.jsx)("div",{className:Br("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]})},Hc=()=>{const{t:e}=hn(),t=(0,Y.useRef)(null),r=nr(),n=er().isLoading,{isOpen:o}=so(),i=sr(),s=Dn();return(0,Y.useEffect)((()=>{window.requestAnimationFrame((()=>{t.current&&(t.current.scrollTop=t.current.scrollHeight)}))}),[r,n,o]),(0,F.jsxs)(F.Fragment,{children:[o&&(0,F.jsx)("a",{className:Br("skip-link"),href:`#${i}`,onClick:e=>{e.preventDefault(),s()},children:e("skiplinkText")}),(0,F.jsx)("div",{className:Br("app__body"),ref:t,children:(0,F.jsxs)("div",{className:Br("conversation__container"),children:[(0,F.jsx)($c,{}),(0,F.jsxs)("ol",{className:Br("conversation"),children:[(0,F.jsx)(zc,{children:(()=>{let e=null;return r.map((t=>{const{type:r,payload:n}=t,{participant:o,fromClient:i}=n;let s=!1;if("participant"!==r){const r=i?"seamly-client-participant":o;"info"!==t.type&&e!==r&&(s=!0),e=r}return(0,F.jsx)(Ks,{event:t,newParticipant:s},t.payload.id)}))})()}),n&&(0,F.jsx)(Js,{})]})]})})]})},qc=({baseClassName:e,children:t,title:r})=>{const n=sr(),o=Un();return(0,F.jsxs)("section",{id:n,className:Br(e),"aria-describedby":o,tabIndex:"-1",children:[(0,F.jsx)("h2",{className:Br(`${e}__title`),id:o,children:r}),t]})},Vc=()=>{const{t:e}=hn(),t=Dn(),r=Eo(),{emitEvent:n}=go(),{isActive:o,remaining:i,timer:s,endCountdown:a}=Lo(),c=i>0,u=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,F.jsx)(qc,{baseClassName:"idle",title:u,children:c&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:Br("idle__count-container"),children:o&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:Br("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,F.jsx)("span",{className:Br("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",s)})]})}),(0,F.jsxs)("div",{className:Br("idle__options"),children:[(0,F.jsx)("button",{type:"button",className:Br("button","button--primary"),onClick:()=>{r(),a(!0),t(),n("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,F.jsx)("button",{type:"button",className:Br("button","button--primary"),onClick:()=>{a(),t(),n("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},Wc=()=>{const{t:e}=hn(),t=Eo(),{name:r}=cr()||{},{continueChat:n,restartChat:o}=Uo();return(0,F.jsx)(qc,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:r}),children:(0,F.jsxs)("div",{className:Br("prompt__options"),children:[(0,F.jsx)("button",{type:"button",className:Br("button","button--primary"),onClick:()=>{t(),n()},children:e("resumeConversationPrompt.continueButton")}),(0,F.jsx)("button",{type:"button",className:Br("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},Gc=["id","name","type","labelText","labelClass","contentHint","aria-describedby"];function Kc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Yc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kc(Object(r),!0).forEach((function(t){Jc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Qc=function(e){let{id:t,name:r,type:n,labelText:o,labelClass:i,contentHint:s,"aria-describedby":a}=e,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Gc);const{isSubmitted:u}=Li(),[l,{error:p}]=Mi(r),f=u&&p,h=[];return a&&h.push(a),s&&h.push(`${t}-content-hint`),f&&h.push(`${t}-error`),(0,F.jsx)(os,{id:t,contentHint:s,validity:!f,errorText:p,labelText:o,labelClass:i,children:(0,F.jsx)("input",Yc(Yc({id:t,name:r,type:n,"aria-invalid":f?"true":"false","aria-describedby":h.join(" ")||null},l),c))})};function Zc({controlName:e,skipLinkId:t}){const{t:r}=hn(),{sendAssertive:n}=Oo(),{emitEvent:o}=go(),i=(()=>{const{sendAction:e}=go(),{features:t}=kn(),{typingPeekahead:r}=t||{},n=(0,Y.useRef)(null),o=(0,Y.useRef)(null),i=(0,Y.useRef)(!1),s=(0,Y.useRef)(null);(0,Y.useEffect)((()=>()=>{clearInterval(s.current),clearTimeout(n.current),clearTimeout(o.current)}),[]);const a=(t,n)=>{e(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Do(Object(r),!0).forEach((function(t){jo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Do(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:xe,state:t},r&&r.enabled?{body:{currentMessage:n}}:{}))};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(i.current=!0,s.current||(a(!0,e.target.value),s.current=setInterval((()=>{i.current?r&&r.enabled&&a(!0,e.target.value):(clearInterval(s.current),s.current=null)}),2e3)),clearTimeout(n.current),clearTimeout(o.current),n.current=setTimeout((()=>{i.current=!1}),300),o.current=setTimeout((()=>{a(!1,e.target.value)}),2e3))}})(),{setBlockAutoEntrySwitch:s}=Ao(),{hasCharacterLimit:a,characterLimit:c,reachedCharacterWarning:u,reachedCharacterLimit:l,remainingChars:p}=function(e){const{t}=hn(),{sendAssertive:r}=Oo(),{hasLimit:n,limit:o}=(()=>{const{entryMeta:{options:{text:e}}}=er(),{limit:t}=e||{};return{hasLimit:null!=t,limit:null!=t?t:null}})(),i=(0,Y.useMemo)((()=>oe(r,300)),[r]),s=(0,Y.useMemo)((()=>oe(((e,r)=>{e&&i(t("input.srCharacterLimitText",{limit:r}))}),300)),[i,t]),[{value:a}]=Mi(e),c=n&&a?o-a.length:o,u=!!n&&c<=50,l=!!n&&c<0;return(0,Y.useEffect)((()=>{s(u,c)}),[u,c,s]),{hasCharacterLimit:n,characterLimit:o,reachedCharacterWarning:u,reachedCharacterLimit:l,remainingChars:c}}(e),[{value:f}]=Mi(e),h=!!f,d=(0,Y.useCallback)((()=>{u&&n(r("input.srCharacterLimitText",{limit:p})),o("ui.inputFocus")}),[r,n,u,p,o]),y=(0,Y.useMemo)((()=>r("input.inputPlaceholder",{hasLimit:a,limit:a?c:null})),[r,a,c]),b=(0,Y.useMemo)((()=>r("input.inputLabel",{hasLimit:a,limit:a?c:null})),[r,a,c]);return(0,Y.useLayoutEffect)((()=>(s(h),()=>{s(!1)})),[s,h]),(0,F.jsxs)(rs,{className:Br("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,F.jsxs)("div",{className:Br(["input--text__container",...u&&!l?["character-warning"]:[],...l?["character-exceeded"]:[]]),children:[(0,F.jsx)(Qc,{id:t,type:"text",name:e,className:Br("input__text"),autocomplete:"off",placeholder:y,labelText:b,labelClass:Br("visually-hidden"),"aria-invalid":a?l:null,onKeyUp:i,onFocus:d}),(0,F.jsx)("div",{className:Br("character-count"),children:u&&(0,F.jsx)("span",{children:p})})]}),(0,F.jsx)("button",{className:Br("button","input__submit"),type:"submit",disabled:!h||l,children:(0,F.jsx)(fi,{name:"send",size:"32",alt:r("input.sendMessage")})})]})}function Xc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function eu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xc(Object(r),!0).forEach((function(t){tu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ru(){return(ru=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}const nu="userText";function ou(e){let t=ru({},e);const{isOpen:r,setVisibility:n}=so(),o=sr(),i=Dn(),{sendMessage:s}=go(),a=(0,Y.useCallback)(((e,{updateControlValue:t})=>{s({body:e.userText}),t(nu,""),i(),r||n(_.open)}),[s,i,r,n]);return(0,F.jsx)(qi,eu(eu({},t),{},{formId:"textEntry",persistData:!0,onSubmit:a,children:(0,F.jsx)(Zc,{controlName:nu,skipLinkId:o})}))}const iu=()=>{const{t:e}=hn(),{showFileUpload:t,serviceAllowsUploads:r}=Ln(),[n,o]=(0,Y.useState)(r),i=Dn(),s=(0,Y.useRef)(null),{setUserEntryType:a,activeEntry:c}=Ao(),u=(0,Y.useRef)(null),{sendPolite:l}=Oo(),p=!!cr();return(0,Y.useEffect)((()=>{de(u.current,(()=>{r||i()})),o(r)}),[r,i]),(0,Y.useEffect)((()=>{s.current&&!r&&l(e("fileUpload.srUnavailableText")),!1===s.current&&r&&l(e("fileUpload.srAvailableText")),p&&(s.current=r)}),[r,p,l,e]),!t&&c!==we&&(0,F.jsx)(gi,{isActive:n,transitionStartState:bi,children:(0,F.jsx)("div",{className:Br("upload-toggle-wrapper"),children:(0,F.jsx)(gi,{isActive:n,transitionStartState:mi,children:(0,F.jsx)("button",{className:Br(["button","button--secondary","upload-toggle"]),ref:u,disabled:n?null:"true",type:"button",onClick:()=>{a(we),i()},children:(0,F.jsx)(fi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},su=()=>{const{t:e}=hn(),{currentUploads:t}=Mn();return(0,F.jsx)("div",{className:Br("progress"),children:t.map((({id:t,name:r,progress:n,uploading:o,error:i})=>(0,F.jsxs)("div",{className:Br("progress_container"),children:[(0,F.jsxs)("div",{className:Br("progress__text"),children:[(0,F.jsx)("span",{className:Br("progress__text--file-name"),children:r}),(0,F.jsx)("span",{className:Br("progress__text--percentage"),children:`${n}%`})]}),(0,F.jsx)(ns,{error:i}),(0,F.jsx)("progress",{className:Br("progress__bar"),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-label":e("fileUpload.srProgressLabel",{fileName:r}),max:"100","aria-valuenow":n,value:n,"aria-busy":o,children:`${n}%`})]},t)))})};function au({id:e,name:t,labelText:r,contentHint:n,outputText:o,accept:i}){const{isSubmitted:s}=Li(),[a,c]=(0,Y.useState)(!1),[{onInput:u,onBlur:l},{error:p}]=Mi(t),f=Un(),h=Un(),d=Un(),y=s&&p,b=[d];n&&b.push(h),y&&b.push(f);const m=(0,Y.useCallback)((()=>{c(!0)}),[c]),g=(0,Y.useCallback)((()=>{c(!1),l()}),[c,l]),v=(0,Y.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,F.jsxs)("div",{className:Br("upload__container"),children:[n&&(0,F.jsx)("span",{className:Br("upload__content-hint"),id:h,children:n}),(0,F.jsx)(ns,{id:f,error:y&&p}),(0,F.jsx)("div",{className:Br(["file-upload",...a?["focus-within"]:[]]),children:(0,F.jsxs)("label",{htmlFor:e,className:Br("upload__label"),children:[(0,F.jsx)(fi,{name:"upload",size:"32"}),(0,F.jsxs)("div",{children:[(0,F.jsx)("span",{className:Br(["upload__label--text"]),children:r}),(0,F.jsx)("input",{id:e,className:Br("upload__input"),type:"file",name:t,onChange:v,"aria-invalid":y?"true":"false","aria-describedby":b.join(" "),accept:i||null,onFocus:m,onBlur:g}),(0,F.jsx)("span",{className:Br("upload__output"),"aria-hidden":"true",id:d,children:o})]})]})})]})}function cu({skiplinkId:e,controlName:t,accept:r,contentHint:n,isUploading:o,isComplete:i,onClickCancel:s}){const{t:a}=hn(),[{value:c}]=Mi(t),u=c&&c.length>0,l=u?c[0].name:"";return(0,F.jsxs)(rs,{className:Br("upload-form"),children:[(0,F.jsx)(au,{name:t,id:e,accept:r,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:u,filename:l}),contentHint:n}),(0,F.jsxs)("div",{className:Br("upload__button-container"),children:[(0,F.jsx)("button",{id:o||!i?e:void 0,type:"button",onClick:s,className:Br("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,F.jsx)("button",{className:Br("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})}const uu="fileListForm",lu="fileList",pu=()=>{const{t:e}=hn(),{sendPolite:t,sendAssertive:r}=Oo(),n=sr(),o=Dn(),{serviceAllowsUploads:i,allowedMimeTypes:s,maxSize:a}=Ln(),c=(0,Y.useRef)(null),u=(0,Y.useRef)(i),{cancelEntrySelection:l}=Ao(),{uploadFile:p,clearUploads:f,isUploading:h,isComplete:d}=Mn(),{hasFile:y,selectedFileName:b,uploadHandle:m,hasServerError:g,progress:v}=((e,t)=>{const r=X(Pi,{formId:e,name:t},[e,t]),{currentUploads:n}=Mn(),o=r&&r.length>0;let i=null,s=!1,a=0;if(n&&n.length>0){const e=n[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?r[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(uu,lu),O=Un(),w=(0,Y.useRef)(!0),E=e("fileUpload.contentHint",{size:ae(a)}),D=(0,Y.useRef)(""),j=(0,Y.useRef)(null);(0,Y.useEffect)((()=>{D.current&&j.current.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&r(E),D.current=E}),[E,r]),(0,Y.useEffect)((()=>{if(v>0)switch(v){case 1:t(e("fileUpload.srStartedText"));break;default:t(`${v}%`)}}),[v,t,e]),(0,Y.useEffect)((()=>{w.current||h||!d||(f(),l(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),w.current=d}),[h,d,f,l,o,t,e]);const x=(0,Y.useCallback)((({fileList:e})=>{p(e[0]),o()}),[p,!1,o]),_=(0,Y.useCallback)((()=>{m&&m.abort(),f(),l(),o()}),[m,f,l,o]),C=(0,Y.useMemo)((()=>({[lu]:[Os((()=>i),e("fileUpload.errors.unavailable")),Os(Es,e("fileUpload.errors.noFile")),Os(ws,e("fileUpload.errors.tooLarge"),a)]})),[a,i,e]);return(0,F.jsx)("div",{className:Br(["upload",...g?["upload--error"]:[]]),ref:j,children:(0,F.jsxs)(qi,{formId:uu,persistData:!0,onSubmit:x,validationSchema:C,children:[(h||!d)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(su,{}),(0,F.jsx)("div",{className:Br("upload__button-container"),children:(0,F.jsx)("button",{id:h||!d?n:void 0,type:"button",onClick:_,ref:c,className:Br("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!h&&d&&(0,F.jsx)(cu,{controlName:lu,skiplinkId:n,accept:s.join(", "),contentHint:E,isComplete:d,isUploading:h,outputText:e("fileUpload.selectedText",{hasFile:y,filename:b}),onClickCancel:_}),!u.current&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:Br("notification"),id:O,children:e("fileUpload.unavailableText")}),(0,F.jsx)("div",{className:Br("upload__button-container"),children:(0,F.jsx)("button",{id:h||!d?n:void 0,type:"button",onClick:_,className:Br("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})};function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function hu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(r),!0).forEach((function(t){du(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yu=()=>{const{isOpen:e}=so(),t=(0,Y.useRef)(null),{hasCountdown:r}=Lo(),[n,o]=(0,Y.useState)(r),{hasPrompt:i}=Uo(),[s,a]=(0,Y.useState)(i),c=Dn(),u=(0,Y.useRef)(!1),{activeEntry:l}=Ao(),[p,f]=(0,Y.useState)({text:ou,upload:pu}),[h,d]=(0,Y.useState)((()=>l)),y=ee(),{accountAllowsUploads:b}=Ln(),m=(0,Y.useCallback)((()=>{de(t.current,(()=>{c()}))}),[c]);(0,Y.useEffect)((()=>{const{customComponents:e}=y,{entry:t}=e||{};t&&f((e=>hu(hu({},e),t)))}),[y]),(0,Y.useEffect)((()=>{m(),o(r),a(i)}),[r,i,m]),(0,Y.useEffect)((()=>{d(l),m()}),[l,m,t]),u.current=!(!t.current||!t.current.contains(document.activeElement));const g=p[h];return(0,F.jsxs)("div",{className:Br("app__entry"),ref:t,children:[n&&(0,F.jsx)(Vc,{}),s&&(0,F.jsx)(Wc,{}),(0,F.jsxs)("div",{className:Br(["entry__body",...r||i?["entry__body--hidden"]:[]]),children:[h!==we&&b&&e&&(0,F.jsx)(iu,{}),(0,F.jsx)(g,{})]})]})};function bu({controlName:e,describedById:t}){const{t:r}=hn();return(0,F.jsxs)(rs,{noValidate:"true",className:Br("options__form"),children:[(0,F.jsx)(Qc,{name:e,type:"email",className:Br("transcript__input"),"aria-describedby":t,labelClass:Br("label"),labelText:r("options.sendTranscript.label")}),(0,F.jsx)("div",{className:Br("options__actions"),children:(0,F.jsx)("button",{type:"submit",className:Br("button","button--primary","options__submit"),children:r("options.sendTranscript.sendButtonText")})})]})}const mu="email",gu={sendTranscript:()=>{const[e,t]=(0,Y.useState)(void 0),{hideOption:r}=kn(),{focusButton:n}=Pn(),{t:o}=hn(),i=Un(),{sendAction:s}=go(),a=(0,Y.useMemo)((()=>({[mu]:[Os(js,o("options.sendTranscript.noEmailText")),Os(Ds,o("options.sendTranscript.invalidEmailText"))]})),[o]),c=(0,Y.useCallback)((e=>{const t=e.email.trim();s({type:"send_transcript",body:{emailAddress:t}}),r(),n()}),[s,r,n]),u=(0,Y.useCallback)((({isValid:e,isSubmitted:r})=>{t(r&&!e?"options--error":void 0)}),[t]);return(0,F.jsxs)(vi,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),children:[(0,F.jsx)("p",{className:Br("options__description"),id:i,children:o("options.sendTranscript.description")}),(0,F.jsx)(qi,{formId:"sendTranscript",onSubmit:c,validationSchema:a,onError:u,children:(0,F.jsx)(bu,{controlName:mu,describedById:i})})]})}},vu=()=>{const{optionActive:e}=kn(),t=(0,Y.useRef)(null),r=gu[e||t.current];return e&&(t.current=e),r?(0,F.jsx)(r,{}):null},Ou=()=>{const{t}=hn(),{menuOptions:r,showOption:n,panelActive:o,hideOption:i}=kn(),{id:s}=Pn(),a=(0,Y.useRef)(null),[c,u]=(0,Y.useState)(!1),l=(0,Y.useRef)(null),p=r.length,f=(0,Y.useRef)(Array.from({length:p},(()=>(0,e.createRef)()))),h=(0,Y.useRef)(!1),d=p>1,y=r[0],b=(0,Y.useMemo)((()=>{var e;return null==y||null===(e=y.name)||void 0===e?void 0:e.trim().replace(/\s+/g,"")}),[y]);return(0,Y.useEffect)((()=>()=>{clearTimeout(a.current)}),[]),(0,Y.useEffect)((()=>{c&&!h.current&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{const e=r.findIndex((e=>e.available)),t=-1===e?0:e;he(f.current[t])}))})),h.current=c}),[c,r]),p?(0,F.jsxs)("div",{className:Br("options__container"),onKeyDown:e=>{c&&(fe(e)===pe.Escape&&(u(!1),he(l.current)),fe(e)===pe.Home&&(he(f.current[0]),e.preventDefault()),fe(e)===pe.End&&(he(f.current[p-1]),e.preventDefault()))},onfocusout:()=>{d&&(a.current=setTimeout((()=>{u(!1)}),200))},onfocusin:()=>{clearTimeout(a.current)},children:[(0,F.jsx)(gi,{transitionStartState:yi,isActive:o,children:(0,F.jsx)("div",{className:Br("options__dialog"),children:(0,F.jsx)(vu,{})})}),d&&(0,F.jsx)(gi,{isActive:c,transitionStartState:yi,children:(0,F.jsx)("ul",{className:Br(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":s,children:r.map((({name:e,title:o,available:i},s)=>(0,F.jsx)("li",{className:Br("options__menu__item"),role:"menuitem","data-testid":e,children:(0,F.jsxs)("button",{type:"button",ref:e=>{f.current[s]=e},className:Br(["button","button--secondary",...i?[]:["button--disabled"]]),onKeyDown:e=>((e,t)=>{if(fe(e)===pe.ArrowDown){const r=Math.min(p-1,t+1);he(f.current[t===r?0:r]),e.preventDefault()}if(fe(e)===pe.ArrowUp){const r=Math.max(0,t-1);he(f.current[t===r?p-1:r]),e.preventDefault()}})(e,s),onKeyPress:e=>((e,t)=>{const n=String.fromCharCode(e.charCode);if(1!==n.length||!n.match(/\S/))return;let o=-1;r.forEach(((e,r)=>{r>t&&e.title.charAt(0).toLowerCase()===n.toLowerCase()&&-1===o&&(o=r)})),-1!==o&&he(f.current[o])})(e,s),onClick:()=>((e,t)=>{t&&(u(!1),n(e))})(e,i),"aria-disabled":i?null:"true",children:[(0,F.jsxs)("span",{className:Br("button__text"),children:[o,!i&&" "]}),!i&&(0,F.jsx)("span",{className:Br("button__state"),children:t("options.unavailableText")})]})},e)))})}),(0,F.jsxs)("button",{type:"button",className:Br(["button","button--secondary","app__options__button",...!d&&b?[`app__options__button--${b}`]:[],...d||y.available?[]:["button--disabled"]]),id:s,onClick:()=>{o&&i(),d?u((e=>!e)):y.available&&n(y.name)},onKeyDown:d?e=>{fe(e)===pe.ArrowDown&&(u(!0),e.preventDefault())}:null,ref:l,"aria-haspopup":d?"menu":null,"aria-expanded":d?c.toString():null,"aria-disabled":d||y.available?null:"true",children:[d&&(0,F.jsx)(fi,{name:"options",size:"32"}),(0,F.jsx)("span",{className:Br("button__text"),children:d?t("options.openButtonText"):`${y.title}${y.available?"":" "}`}),!d&&!y.available&&(0,F.jsx)("span",{className:Br("button__state"),children:t("options.unavailableText")})]})]}):null};function wu(){const{menuOptions:e,allowOptionSelection:t}=kn(),{isAvailable:r}=ni();return r||t&&e.length?(0,F.jsxs)("div",{className:Br("app__options"),children:[r&&(0,F.jsx)("div",{className:Br("app__options-item","app__options-item--left"),children:(0,F.jsx)(As,{})}),t&&(0,F.jsx)("div",{className:Br("app__options-item","app__options-item--right"),children:(0,F.jsx)(Ou,{})})]}):null}function Eu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ju=function({children:e,interruptComponent:t}){const{hasInterrupt:r,meta:n}=Wn(),{isOpen:o}=so();return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ts,{}),(0,F.jsx)("div",{className:Br("app__container"),children:r?o?(0,F.jsx)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Eu(Object(r),!0).forEach((function(t){Du(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Eu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},n)):null:e}),(0,F.jsx)(wu,{})]})};function xu(){const{preChatEvents:e,layoutMode:t}=ee(),{hasInterrupt:r}=Wn(),{isOpen:n}=so(),o=!(r||!e.length||n);return(0,F.jsx)(gi,{isActive:o,transitionStartState:yi,children:(0,F.jsx)("ul",{className:Br("pre-chat-messages",`pre-chat-messages--${t}`),"aria-hidden":!o,children:e.map((e=>(0,F.jsx)("li",{className:Br("pre-chat-messages__message"),children:(0,F.jsx)(_u,{event:e})},e.payload.id)))})})}function _u({event:e}){const[t]=Us(e);return(0,F.jsx)(t,{event:e})}const Cu=()=>{const e=cr(),{hasInterrupt:t}=Wn(),{defaults:r}=ee(),n=null==r?void 0:r.startChatIcon,o=e&&!t?e.avatar:void 0;return o||n?(0,F.jsx)("img",{className:Br(o?"avatar":"icon"),src:o||n,alt:""}):(0,F.jsx)(fi,{name:"avatar",size:"32"})},Au=({onClick:e})=>{const t=Hr(),{t:r}=hn(),n=r(t?"window.openButton.srContinue":"window.openButton.srStart"),o=Dn(),{isOpen:i}=so(),s=ir(),a=(0,Y.useCallback)((()=>{e(),o()}),[o,e]);return(0,F.jsx)(gi,{isActive:!i,transitionStartState:bi,children:(0,F.jsxs)("button",{className:Br("window-open-button"),"aria-label":n,"aria-hidden":i,onClick:a,children:[(0,F.jsx)("span",{className:Br("message-count"),"aria-hidden":"true",children:!!s&&s}),(0,F.jsx)(Cu,{})]})})},Su=({onClick:e})=>{const{t}=hn(),r=(0,Y.useCallback)((()=>e()),[e]);return(0,F.jsx)("button",{type:"button",className:Br("button","collapse-button"),onClick:r,children:(0,F.jsx)(fi,{name:"chevronDown",size:"32",alt:t("window.srCollapseButton")})})},Tu={app:()=>(To(),(0,F.jsx)(Bs,{children:(0,F.jsxs)(ju,{interruptComponent:Ls,children:[(0,F.jsx)(Hc,{}),(0,F.jsx)(yu,{})]})})),inline:()=>{To();const{isOpen:e}=so();return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(gi,{isActive:!e,transitionStartState:bi,children:(0,F.jsxs)("div",{className:Br("unstarted-wrapper"),children:[(0,F.jsx)(xu,{}),(0,F.jsx)(Rs,{})]})}),(0,F.jsx)(gi,{isActive:e,transitionStartState:bi,children:(0,F.jsx)(Bs,{children:(0,F.jsxs)(ju,{interruptComponent:Ls,children:[e&&(0,F.jsx)(Hc,{}),(0,F.jsx)(yu,{})]})})})]})},window:()=>{const{openChat:e,closeChat:t}=To(),{isOpen:r}=so(),n=io(),{t:o}=hn(),i=o("window.chat.continue"),s=(0,Y.useMemo)((()=>({payload:{body:{text:i}}})),[i]);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Au,{onClick:e}),(0,F.jsx)(gi,{isActive:!r&&!n,transitionStartState:bi,children:(0,F.jsx)("div",{className:Br("unstarted-wrapper","unstarted-wrapper--window"),children:(0,F.jsx)(xu,{})})}),(0,F.jsx)(gi,{isActive:!r&&n,transitionStartState:yi,children:(0,F.jsx)("div",{className:Br("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,F.jsx)(cc,{event:s})})}),(0,F.jsx)(gi,{isActive:r,transitionStartState:yi,children:(0,F.jsxs)(Bs,{children:[r&&(0,F.jsx)(Su,{onClick:t}),(0,F.jsxs)(ju,{interruptComponent:Ls,children:[(0,F.jsx)(Hc,{}),(0,F.jsx)(yu,{})]})]})})]})}},ku=()=>{const{layoutMode:e}=ee(),{visible:t}=er(),r=Tu[e];return r?t!==_.hidden&&(0,F.jsx)(r,{}):(console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null)};function Pu(e,t,r=[]){const n=(0,Y.useContext)(Mr),o=(0,Y.useRef)();o.current=t,(0,Y.useEffect)((()=>{if(!r.every(Boolean))return;const t=(...e)=>{var t;return null===(t=o.current)||void 0===t?void 0:t.call(o,...e)};return n.emit("function.register",e,t),()=>n.emit("function.unregister",e,t)}),[n,e,...r])}const Iu=()=>{const e=ee(),{sendMessage:t,sendContext:r,sendAction:n}=go(),{setVisibility:o,visible:i}=so(),s=(0,Y.useRef)(i),a=(0,Y.useContext)(Mr),c=Ur(),u=ir(),l=(0,Y.useRef)(null),p=(0,Y.useRef)(null),{isInline:f,isResolving:h}=lr(),{hasInterrupt:d}=Wn(),y=$r(),b=(0,Y.useRef)(null),m=Eo(),{enableTranslations:g,disableTranslations:v}=ni();return(0,Y.useEffect)((()=>{s.current=i}),[i]),Pu("askText",(e=>{t({body:e})}),[null==c?void 0:c.send]),Pu("setVariables",(e=>{r({variables:e})}),[null==c?void 0:c.send]),Pu("getVisibility",(e=>{e?e(s.current):console.warn("A callback function is required for the getVisibility action.")})),Pu("setVisibility",(e=>{Object.values(_).includes(e)?(m(),o(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[null==e?void 0:e.api]),Pu("sendCustomAction",((e,t)=>{n({type:"custom",body:{type:e,body:t}})}),[c.send]),Pu("setTopic",(({name:e,fallbackMessage:t})=>{e&&t?n({type:"set_topic",body:{name:e,fallbackMessage:t}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[c.send]),Pu("setTranslation",(({enabled:e,locale:t})=>{e?g(t):v()}),[c.send]),(0,Y.useEffect)((()=>{h||d||(b.current&&b.current!==y&&a.emit("unreadMessageCount",u),i===_.open&&i!==p.current&&0!==l.current&&a.emit("unreadMessageCount",0),i!==_.open&&u!==l.current&&a.emit("unreadMessageCount",u),p.current=i,l.current=u,b.current=y)}),[u,i,a,f,h,d,y]),null},{SET_EVENTS_READ:Nu}=Ne,Fu=()=>{const{t:e}=hn(),t=nr(),r=qr(),{isOpen:n,isVisible:o}=so(),{sendAction:i}=go(),s=ir(),{sendPolite:a}=Oo(),c=(0,Y.useMemo)((()=>oe(a,2e3)),[a]),u=(0,Y.useRef)(null),l=(0,Y.useRef)(null);return(0,Y.useEffect)((()=>{if(!n)return;const e=t.filter((e=>Ot(e)&&e.payload.messageStatus===Ee)).map((e=>e.payload.id));e.length>0&&(r({type:Nu,ids:e}),i({type:_e,events:e}))}),[t,r,n,i]),(0,Y.useEffect)((()=>{u.current!==o&&!o&&l.current&&l.current(),0!==s&&!n&&o&&(l.current=c(e("message.srTextUnreadCount",{unreadCount:s}))),u.current=o}),[s,n,o,c,e]),null},Ru=()=>{const{t:e}=hn(),t=nr(),r=(0,Y.useRef)(0),n=(0,Y.useRef)(0),o=er().historyLoaded,{sendPolite:i}=Oo(),{isOpen:s}=so(),a=(0,Y.useRef)(null),c=(0,Y.useRef)(null),u=(0,Y.useMemo)((()=>oe((t=>{const r=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;r>n.current&&(i(e("message.srNewEventCount",{newCount:r-n.current})),n.current=r)}),1e3)),[i,e]);return(0,Y.useEffect)((()=>{t.length>r.current&&(s&&(c.current=u(t)),r.current=t.length)}),[t,u,s]),(0,Y.useEffect)((()=>{a.current&&!s&&c.current&&(c.current(!0),c.current=null)}),[s]),(0,Y.useEffect)((()=>{o&&setTimeout((()=>{i(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,i]),null},Bu=({children:e})=>{const t=(0,Y.useContext)(Mr),[r,n]=(0,Y.useState)({}),o=(0,Y.useRef)(!0),i=(0,Y.useCallback)((e=>{o.current&&(n(e),t.emit("aria-live",e))}),[n,t]);(0,Y.useEffect)((()=>{let e=null;return r&&r.messageText&&(e=setTimeout((()=>{i({}),clearTimeout(e)}),500)),()=>{clearTimeout(e)}}),[r,i]),(0,Y.useEffect)((()=>()=>{o.current=!1}),[]);const{ariaLive:s,messageText:a}=r;return(0,F.jsxs)(vo.Provider,{value:i,children:[e,(0,F.jsxs)("div",{className:Br("app__live-container"),children:[(0,F.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Br("visually-hidden"),children:s===Te?a:null}),(0,F.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Br("visually-hidden"),children:s===ke?a:null})]})]})},Lu=()=>{const{hasCountdown:e,isActive:t,remaining:r,decrementCountdown:n}=Lo();return((e,t)=>{const r=(0,Y.useRef)(e);(0,Y.useEffect)((()=>{r.current=e}),[e]),(0,Y.useEffect)((()=>{if(null!==t){const e=setInterval((function(){r.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{n()}),e&&t&&r>0?1e3:null),null},Mu=({children:e})=>{const t=(0,Y.useRef)(0),{sendAction:r}=go(),{hasCountdown:n,isActive:o,stopCountdown:i}=Lo(),s=(0,Y.useCallback)((()=>{const e=(new Date).getTime(),s=()=>{r({type:"interactivity_update"}),t.current=e};n&&o&&(s(),i()),e-t.current>15e3&&s()}),[r,n,o,i]);return(0,F.jsx)("div",{className:Br("activity-monitor"),tabIndex:"-1",onMouseDown:s,onKeyUp:s,onTouchStart:s,onMouseMove:s,onWheel:s,onPointerDown:s,onPointerMove:s,children:(0,F.jsx)(wo.Provider,{value:s,children:e})})},Uu=()=>{const{initUserSelectedOptions:e}=kn(),t=(0,Y.useRef)(!1),r=ee();return(0,Y.useEffect)((()=>{r.api&&!t.current&&(t.current=!0,e())}),[e,r]),null},zu=["serviceSettings"];const{ADD_EVENT:$u,ACK_EVENT:Hu,SET_IS_LOADING:qu,SET_PARTICIPANT:Vu,SET_HEADER_SUB_TITLE:Wu,SET_ACTIVE_SERVICE:Gu,INIT_RESUME_CONVERSATION_PROMPT:Ku,CLEAR_EVENTS:Yu,SET_SERVICE_DATA_ITEM:Ju,SET_FEATURE_ENABLED_STATE:Qu,SET_SERVICE_ENTRY_METADATA:Zu,SET_HISTORY:Xu}=Ne,el=["text","choice_prompt","image","video"],tl=({eventBus:e})=>{const{t}=hn(),r=Ur(),n=qr(),o=nr(),i=(0,Y.useRef)(null),{setUserSelectedOption:s}=kn(),{initCountdown:a,endCountdown:c}=Lo(),{emitEvent:u}=go();return(0,Y.useEffect)((()=>{if(r.connectionInfo){const t=e=>{const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:r,participant:o}=t;!r&&o.name&&n({type:Wu,title:o.name}),n({type:Vu,participant:o,fromClient:r}),o.introduction&&n({type:$u,event:e})};r.stream().subscribe({next:r=>{const{type:o,payload:i}=r;switch(o){case"ui":switch(i.state&&i.state.hasOwnProperty("loading")&&n({type:qu,isLoading:i.state.loading}),i.type){case"idle_detach_countdown":a(i.body.duration);break;case"idle_detach_countdown_elapsed":c(void 0,!0);break;case"resume_conversation_prompt":n({type:Ku});break;case"user_first_response":n(_r(!0)),e.emit("system.userFirstResponse",i.body)}break;case"message":switch(t(i),i.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":i.service&&i.service.serviceSessionId&&n({type:Gu,activeServiceSessionId:i.service.serviceSessionId}),n({type:$u,event:r})}break;case"participant":t(r);break;case"service_data":i.persist&&n({type:Ju,payload:i});break;case"ack":n({type:Hu,event:r});break;case"system":if("service_changed"===i.type){const{serviceSettings:e}=i,t=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(i,zu),{uploads:r,entry:o}=e;n({type:Qu,key:Ie,enabled:!(!r||!r.enabled)}),n({type:Zu,entryMeta:o}),n({type:Gu,activeServiceSessionId:i.serviceSessionId}),u("system.serviceChanged",t)}break;case"info":"divider"!==i.type&&"text"!==i.type&&"translation"!==i.type||n({type:$u,event:r});break;case"error":switch(i.type){case"find_conversation_erred":n(jr(new Or(r)));break;case"seamly_offline":n(jr(new Yn(r))),n({type:Yu});break;default:n(jr(new Gn(r)))}break;case"socket_opened":n(xr())}}}),r.stream().filter((e=>"message"===e.type&&el.includes(e.payload.type))).subscribe({next:({payload:t})=>{t.id!==i.current&&e.emit("message",t),i.current=t.id}})}}),[n,r,e,t,s,a,c,u]),(0,Y.useEffect)((()=>{if(r.stream){const e=r.stream().filter((e=>"sync"===e.type)).subscribe({next:e=>{const{payload:t}=e,i=o[o.length-1],{id:s}=t.lastEvent;i&&s===i.payload.id||r.getConversation().then((e=>{e&&n({type:Xu,history:e})})).catch((e=>{n(jr(e))}))}});return()=>{e.unsubscribe()}}return()=>{}}),[r,o,n]),null},{REGISTER_UPLOAD:rl,SET_UPLOAD_PROGRESS:nl,SET_UPLOAD_ERROR:ol,SET_UPLOAD_COMPLETE:il}=Ne,sl=({children:e})=>{const{t}=hn(),r=qr(),n=Ur(),{addUploadBubble:o}=go();return(0,F.jsx)(In.Provider,{value:e=>{const s=i(),a=n.uploadFile(e,(e=>{r({type:nl,fileId:s,progress:Math.ceil(e)})}),(e=>{const{id:t,transactionId:n,occurredAt:i,body:{contentType:a,filename:c,filesize:u,url:l}}=e.body;r({type:il,fileId:s}),o(t,n,i,a,c,u,l)}),(e=>{let n;switch(e&&e.body?e.body.error:""){case"file_uploads_are_disabled":n=t("fileUpload.errors.unavailable");break;case"request_entity_too_large":n=t("fileUpload.errors.tooLarge");break;case"file_has_invalid_mime_type":n=t("fileUpload.errors.wrongType");break;case"virus_found":n=t("fileUpload.errors.virusFound");break;default:n=t("fileUpload.errors.general")}r({type:ol,fileId:s,errorText:n})}));r({type:rl,fileId:s,fileName:e.name,uploadHandle:a})},children:e})},{createAction:al}=h("errors"),cl=al("catch-error",(e=>({error:e})));function ul({api:e}){return({getState:t})=>{const r=r=>{const{errorCallback:n,namespace:o,api:i,layoutMode:s}=T(t());null==n||n(r.error,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:r.type?r:void 0})};return e=>t=>{try{return t.error&&r(t),e(t)}catch(e){throw r({error:e}),e}}}}const ll=({store:e,children:t,config:r,eventBus:n,api:o})=>((0,Y.useErrorBoundary)((t=>e.dispatch(cl(t)))),(0,F.jsx)(R,{store:e,children:(0,F.jsx)(Mr.Provider,{value:n,children:(0,F.jsx)(Lr.Provider,{value:o,children:(0,F.jsx)(Bu,{children:(0,F.jsxs)(zc,{children:[(0,F.jsx)(Uu,{config:r}),(0,F.jsx)(tl,{eventBus:n}),(0,F.jsx)(Fu,{}),(0,F.jsx)(Ru,{}),(0,F.jsx)(Lu,{}),(0,F.jsxs)(Mu,{children:[(0,F.jsx)(Iu,{}),(0,F.jsx)(sl,{children:t})]})]})})})})}));function pl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pl(Object(r),!0).forEach((function(t){hl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dl=e=>(0,F.jsx)(ll,fl(fl({},e),{},{children:(0,F.jsx)(ku,{})}));var yl=r(813),bl=r.n(yl),ml=r(766),gl=r.n(ml),vl=e=>"function"==typeof e?e:function(){return e},Ol="undefined"!=typeof self?self:null,wl="undefined"!=typeof window?window:null,El=Ol||wl||void 0,Dl="closed",jl="errored",xl="joined",_l="joining",Cl="leaving",Al="phx_close",Sl="phx_error",Tl="phx_reply",kl="phx_leave",Pl=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Il=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},Nl=class{static request(e,t,r,n,o,i,s){if(El.XDomainRequest){let r=new El.XDomainRequest;this.xdomainRequest(r,e,t,n,o,i,s)}else{let a=new El.XMLHttpRequest;this.xhrRequest(a,e,t,r,n,o,i,s)}}static xdomainRequest(e,t,r,n,o,i,s){e.timeout=o,e.open(t,r),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n)}static xhrRequest(e,t,r,n,o,i,s,a){e.open(t,r,!0),e.timeout=i,e.setRequestHeader("Content-Type",n),e.onerror=()=>{a&&a(null)},e.onreadystatechange=()=>{if(4===e.readyState&&a){let t=this.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(o)}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let o=t?`${t}[${n}]`:n,i=e[n];"object"==typeof i?r.push(this.serialize(i,o)):r.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},Fl=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/websocket"),"$1/longpoll")}endpointURL(){return Nl.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(){this.close(),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry()}poll(){1!==this.readyState&&0!==this.readyState||Nl.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),(e=>{if(e){var{status:t,token:r,messages:n}=e;this.token=r}else t=0;switch(t){case 200:n.forEach((e=>{setTimeout((()=>{this.onmessage({data:e})}),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen(),this.poll();break;case 403:this.onerror(),this.close();break;case 0:case 500:this.onerror(),this.closeAndRetry();break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){Nl.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),(e=>{e&&200===e.status||(this.onerror(e&&e.status),this.closeAndRetry())}))}close(e,t){this.readyState=3,this.onclose()}},Rl={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,o,i,s]=JSON.parse(e);return t({join_ref:r,ref:n,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+r.length+o.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),c=new DataView(a),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,r.length),c.setUint8(u++,o.length),c.setUint8(u++,n.length),Array.from(t,(e=>c.setUint8(u++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(u++,e.charCodeAt(0)))),Array.from(o,(e=>c.setUint8(u++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(u++,e.charCodeAt(0))));var l=new Uint8Array(a.byteLength+i.byteLength);return l.set(new Uint8Array(a),0),l.set(new Uint8Array(i),a.byteLength),l.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(e.slice(s,s+n));s+=n;let c=r.decode(e.slice(s,s+o));s+=o;let u=r.decode(e.slice(s,s+i));return s+=i,{join_ref:a,ref:null,topic:c,event:u,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(a,a+n));a+=n;let u=r.decode(e.slice(a,a+o));a+=o;let l=r.decode(e.slice(a,a+i));a+=i;let p=r.decode(e.slice(a,a+s));a+=s;let f=e.slice(a,e.byteLength);return{join_ref:c,ref:u,topic:l,event:Tl,payload:{status:p,response:f}}},decodeBroadcast(e,t,r){let n=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=r.decode(e.slice(i,i+n));i+=n;let a=r.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}};function Bl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ll(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bl(Object(r),!0).forEach((function(t){Ml(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ml(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ul=r(905),zl=r.n(Ul);function $l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Hl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$l(Object(r),!0).forEach((function(t){ql(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ql(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vl=zl()("seamly");class Wl{constructor(e,t,r){this.url=e,this.accessToken=r,this.channelName=t,this.connect(),this.socket.onError((e=>{Vl("[SOCKET][ERROR]",e),this.emit({type:"error",payload:{type:"seamly_offline",error:e}})})),this.socket.onOpen((()=>{Vl("[SOCKET]OPEN"),this.emit({type:"socket_opened"})})),this.channel.on("system",(e=>{switch(e.type){case"join_conversation_succeeded":this.emit({type:"connection",connected:!0,ready:!0})}})),this.socket.onClose((()=>{Vl("[SOCKET]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onClose((()=>{Vl("[CHANNEL]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onError((e=>{Vl("[CHANNEL][ERROR]",e),this.emit({type:"connection",connected:!1,ready:!1})})),this.listenTo("ack"),this.listenTo("ui"),this.listenTo("error"),this.listenTo("participant",((e,t)=>Hl(Hl({},t),{},{type:e}))),this.listenTo("message"),this.listenTo("service_data"),this.listenTo("system"),this.listenTo("info"),this.listenTo("sync")}start(e){this.listener=e,this.channel.join().receive("ok",(()=>{Vl("[CHANNEL][JOIN] OK"),this.emit({type:"connection",connected:!0,ready:!1})})).receive("error",(e=>{Vl("[CHANNEL][JOIN] ERROR",e),this.emit({type:"error",payload:{type:"join_channel_erred",error:e}}),this.emit({type:"connection",connected:!1,ready:!1}),this.channel.socket.disconnect()})).receive("timeout",(()=>{Vl("[CHANEL][JOIN] Networking issue. Still waiting...")}))}stop(){this.listener=null}connect(){const{url:e,params:t}=(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[r,n]=t.split("=");return Ll(Ll({},e),{},{[r]:decodeURIComponent(n)})}),{})}})(this.url);this.socket=new class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||El.WebSocket||Fl,this.establishedConnections=0,this.defaultEncoder=Rl.encode.bind(Rl),this.defaultDecoder=Rl.decode.bind(Rl),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Fl?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;wl&&wl.addEventListener&&(wl.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),r=this.connectClock)})),wl.addEventListener("pageshow",(e=>{r===this.connectClock&&(r=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=vl(t.params||{}),this.endPoint=`${e}/websocket`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Il((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}replaceTransport(e){this.disconnect(),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Nl.appendParams(Nl.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,r)}connect(e){this.connectClock++,e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=vl(e)),this.conn||(this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e))}log(e,t,r){this.logger(e,t,r)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,r||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),e&&e()}))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&3!==this.conn.readyState?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,r=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,n])=>{n(e,t,r)})),(t===this.transport||r>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Sl)}))}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t.joinRef()!==e.joinRef()))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let r=new class{constructor(e,t,r){this.state=Dl,this.topic=e,this.params=vl(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Pl(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Il((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=xl,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=jl,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Dl,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=jl,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Pl(this,kl,vl({}),this.timeout).send(),this.state=jl,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(Tl,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Al,e)}onError(e){return this.on(Sl,(t=>e(t)))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter((r=>!(r.event===e&&(void 0===t||t===r.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new Pl(this,e,(function(){return t}),r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Cl;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Al,"leave")},r=new Pl(this,kl,vl({}),e);return r.receive("ok",(()=>t())).receive("timeout",(()=>t())),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e,t,r,n){return!(this.topic!==e||n&&n!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=_l,this.joinPush.resend(e))}trigger(e,t,r,n){let o=this.onMessage(e,t,r,n);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter((t=>t.event===e));for(let e=0;e<i.length;e++)i[e].callback(o,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Dl}isErrored(){return this.state===jl}isJoined(){return this.state===xl}isJoining(){return this.state===_l}isLeaving(){return this.state===Cl}}(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:o,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${o})`,n)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,e)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:r,payload:n,ref:o,join_ref:i}=e;o&&o===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${t} ${r} ${o&&"("+o+")"||""}`,n);for(let e=0;e<this.channels.length;e++){const s=this.channels[e];s.isMember(t,r,n,i)&&s.trigger(r,n,o,i)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,r]=this.stateChangeCallbacks.message[t];r(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}(e,{params:Hl(Hl({},t),{},{v:_t})}),this.socket.connect(),this.channel=this.socket.channel(this.channelName,{authorization:`Bearer ${this.accessToken}`})}disconnect(){return new Promise((e=>{this.socket.disconnect(e)}))}listenTo(e,t=null){this.channel.on(e,(r=>{Vl("[RECEIVE]",e,r),this.emit({type:e,payload:t?t(e,r):r})}))}emit(e){this.listener&&this.listener.next(e)}push(e,t,r){this.channel.push(e,t,r)}}function Gl(e){const t="cvco."+e;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let r;do{r=sessionStorage.getItem(e[0])}while(e.shift()&&!r);return JSON.parse(r)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}class Kl{constructor(e){this.name=e}emit(e){this.listener&&this.listener.next(e)}start(e){this.listener=e}stop(){this.listener=null}}function Yl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Jl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yl(Object(r),!0).forEach((function(t){Ql(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ql(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Zl=zl()("seamly");function Xl(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return null;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:null}function ep(){return{screenResolution:`${window.screen.width}x${window.screen.height}`,userAgent:navigator.userAgent,currentUrl:window.location.toString(),timezone:Xl()}}class tp{constructor({namespace:e,config:t={},context:r={}}){this.store=function(e,t){const r=t(e),n=r.get()||{};return{get:e=>void 0===e?n:n[e],set:(e,t)=>(n[e]=t,r.set(n),t),delete(e){const t=this.get(e);return delete n[e],r.set(n),t}}}(`${e}.connection${r.locale?"."+r.locale:""}`,t.storageProvider||Gl),this.connectionInfo={apiKey:t.key,domain:t.domain||"api.seamly-app.com",secure:!1!==t.secure&&(t.secure||!0)},this.config={sendEnvironment:t.sendEnvironment??!0,context:r},this.connected=!1,this.configReady=!1,this.externalId=t.externalId,this.internalProducer=new Kl("API"),this.internal$=bl().create(this.internalProducer).flatten(),this.connection$=this.internal$.filter((e=>"connection"===e.type)),this.connection$.subscribe({next:({connected:e,ready:t})=>{this.connected=e,this.ready=t}}),this.URLS={}}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)}hasConversation(){return!!this.getConversationUrl()}getChannelName(){return this.store.get("channelName")}setChannelName(e){this.store.set("channelName",e)}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName")}getUrlPrefix(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}updateUrls({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:r}])=>Jl(Jl({},e),{},{[t]:r})),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversationProducer&&await this.conversationProducer.disconnect(),this.connected=!1,this.configReady=!1}async createConversation(){try{const e=gl().post(`${this.getUrlPrefix("http")}${this.URLS.conversations}`).set("Content-Type","application/json").query({v:_t}).withCredentials().send({externalId:this.externalId||void 0}),{body:t}=await e,{conversation:r}=t,n=Jl({},r);return delete n.accessToken,delete n.channelName,this.setAccessToken(r.accessToken),this.setChannelName(r.channelName),this.updateUrls(t),this.setConversationUrl(this.URLS.conversation),n}catch(e){if(e.status>=500)throw new Gn(e);throw e}}getConfig(){return gl().post(`${this.getUrlPrefix("http")}/client/${this.connectionInfo.apiKey}/configs`).set("Content-Type","application/json").query({v:_t}).send({context:Jl(Jl({},this.config.context),{},{environment:!0===this.config.sendEnvironment?ep():this.config.sendEnvironment})}).then((({body:e})=>(this.updateUrls(e),this.configReady=!0,e.config))).catch((e=>{if(404===e.status)throw new Kn;if(e.status>=500)throw new Gn;throw e}))}async getConversation(){if(!this.hasConversation())return null;try{const{body:e}=await gl().get(`${this.getUrlPrefix("http")}${this.URLS.history}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:_t});this.updateUrls(e);const{messages:t,participants:r,activeServiceSessionId:n,activeServiceSettings:o,serviceData:i,ui:s,translation:a}=e.history;return{events:t.map((([e,t])=>({type:e,payload:Jl(Jl({},t),{},{type:"participant"===e?e:t.type})}))),participants:r,activeServiceSessionId:n,activeServiceSettings:o,serviceData:i,resumeConversationPrompt:!!s&&Boolean(s.resumeConversationPrompt),translation:a}}catch(e){if(401===e.status)throw new Jn(e);if(404===e.status)throw new Or(e);if(e.status>=500)throw new Gn(e);throw e}}async connect(){this.connected=!1;let e=null;return this.hasConversation()||(e=await this.createConversation()),this.conversationProducer=new Wl(`${this.getUrlPrefix("ws")}${this.URLS.socket}`,this.getChannelName(),this.getAccessToken()),this.internalProducer.emit(bl().create(this.conversationProducer)),this.config.sendEnvironment&&this.send("context",{environment:!0===this.config.sendEnvironment?ep():this.config.sendEnvironment},!1),e}uploadFile(e,t,r,n){const o=new FormData;o.append("upload",e);const i=gl().post(`${this.getUrlPrefix("http")}${this.URLS.uploads}`).set("Authorization",`Bearer ${this.getAccessToken()}`).send(o);return i.on("progress",(function(e){const{direction:r,percent:n}=e;"upload"===r&&"function"==typeof t&&t(n)})),i.then((e=>{r&&r(e)})).catch((e=>{if(!n)throw e;n(e.response)})),i}getConversationIntitialState(){return gl().get(`${this.getUrlPrefix("http")}${this.getConversationUrl()}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:_t}).then((({body:e})=>{return this.updateUrls(e),t=e.conversation,r=["accessToken","channelName"],Object.keys(t).reduce(((e,n)=>(r.includes(n)||(e[n]=t[n]),e)),{});var t,r})).catch((e=>{if(401===e.status)throw new Jn(e);if(404===e.status)throw new Or(e);if(e.status>=500)throw new Gn(e);throw e}))}async getTranslations(e){try{const t=`${this.getUrlPrefix("http")}${this.URLS.translations}`.replace("{version}",String(1)).replace("{locale}",e),r=gl().get(t),{body:n}=await r;return n.translations}catch(e){if(e.status>=500)throw new Gn(e);throw e}}send(e,t,r=!0){!this.connected||r&&!this.ready?this.connection$.filter((e=>r?e.connected&&e.ready:e.connected)).take(1).subscribe({next:()=>this.send(e,t,r)}):(Zl("[SEND]",e,t),this.conversationProducer.push(e,function(e,t){if("message"!==e)return t;const{type:r,body:n}=t;let{transactionId:o}=t;return o||(o=i()),{type:r,body:n,transactionId:o}}(e,t),1e4))}sendContext(e={}){const{locale:t,variables:r}=e,n={};if(t){if("string"!=typeof t)throw new Error("Locale must be a string");n.locale=t}if(r){if("object"!=typeof r)throw new Error("Variables must be an object");n.variables=r}0===Object.keys(n).length&&n.constructor===Object||this.send("context",n,!1)}stream(){return this.internal$.filter((e=>"connection"!==e.type))}}function rp(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var np=rp();np.withExtraArgument=rp;const op=np;function ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ip(Object(r),!0).forEach((function(t){ap(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ip(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ap(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cp({api:e}){return()=>t=>r=>{const n=t(r);switch(r.type){case Ne.SET_USER_SELECTED_OPTIONS:e.store.set("options",r.options);break;case Ne.SET_USER_SELECTED_OPTION:e.store.set("options",sp(sp({},e.store.get("options")||{}),{},{[r.option]:r.value}))}return n}}const up={events:[],initialState:{},unreadEvents:0,isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:i(),optionsButtonId:i(),headerCollapseButtonId:i(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],entryMeta:{default:Oe,active:Oe,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{}},seamlyContainerElement:null};function lp(e=up,t){return t.type===String(Cr.pending)?up:((e,t)=>{switch(t.type){case Re:const{type:r,payload:n}=t.event,o=e.options.features.hasOwnProperty(Ie),i=jt(e.entryMeta,n);let s=be({},e.options);if(o&&(r===ge.message||r===ge.participant)&&!n.fromClient){const{type:e}=n.entry||{};s=be(be({},s),{},{features:be(be({},s.features),{},{uploads:be(be({},s.features.uploads),{},{enabledFromEntry:e===we})})})}const a=Ot(t.event);return e.events.find((e=>e.payload.id===n.id))?e:be(be({},e),{},{entryMeta:o||i.active!==we?i:be({},e.entryMeta),options:s,unreadEvents:a?e.unreadEvents+1:e.unreadEvents,events:[...e.events,be(be({},t.event),{},{payload:be(be({},a&&{messageStatus:n.fromClient?De:Ee}),n)})]});case Ue:if(!t.event.payload.transactionId)return console.warn("ACK received without transaction ID."),e;const c=e.events.find((e=>e.payload.transactionId===t.event.payload.transactionId)),{id:u,occurredAt:l}=t.event.payload;return c?be(be({},e),{},{events:wt(e.events.map((e=>e.payload.id===c.payload.id?be(be({},e),{},{payload:be(be({},e.payload),{},{id:u,occurredAt:l})}):e)))}):e;case Be:return be(be({},e),{},{unreadEvents:0,events:[]});case Me:return be(be({},e),{},{unreadEvents:0,events:e.events.map((e=>-1!==t.ids.indexOf(e.payload.id)?be(be({},e),{},{payload:be(be({},e.payload),e.payload.messageStatus===Ee&&{messageStatus:De})}):e))});case Le:const{events:p,participants:f,activeServiceSessionId:h,activeServiceSettings:d={},serviceData:y,resumeConversationPrompt:b}=t.history,m=((e,t)=>{const r=t.filter((t=>!(e.find((e=>e.payload.id===t.payload.id))||"participant"===t.type&&!t.payload.participant.introduction))).reverse();return wt([...r,...e])})(e.events,p),g=be(be({},e.participantInfo.participants),f),v=m.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let O=null;v&&("message"===v.type&&(O=v.payload.participant),"participant"===v.type&&(O=v.payload.participant.id));const{entry:w,uploads:E}=d,D=jt(be(be(be({},e.entryMeta),w),{},{active:w.default||ve,options:be({},w&&w.options?w.options:{})}),m[m.length-1].payload);let j=be({},e.options.features);const x=j.hasOwnProperty(Ie);if(x){const{payload:e}=v,{type:t}=e.entry||{};j=be(be({},j),{},{uploads:{enabled:!(!E||!E.enabled),enabledFromEntry:t===we}})}const _=be(be({},e),{},{unreadEvents:m.filter((e=>"message"===e.type&&e.payload.messageStatus===Ee)).length,events:m.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),participantInfo:be(be(be({},e.participantInfo),O?Et(e.participantInfo,{type:He,participant:g[O]}):{}),{},{participants:g}),historyLoaded:!0,serviceInfo:be(be({},e.serviceInfo),{},{activeServiceSessionId:h}),serviceData:y||{},options:be(be({},e.options),{},{features:j}),entryMeta:x||D.active!==we?D:be({},e.entryMeta),resumeConversationPrompt:b||!1});return O&&(_.headerTitles=Dt(e.headerTitles,{type:Ve,title:g[O].name})),_;case We:return be(be({},e),{},{historyLoaded:!1});case ze:return be(be({},e),{},{isLoading:t.isLoading});case Ke:const{delaySeconds:C,delayTime:A}=t;return be(be({},e),{},{idleDetachCountdown:{hasCountdown:!0,isActive:!0,wasStopped:!1,count:C,remaining:C,timer:A}});case Ye:const{idleDetachCountdown:S}=e,{remaining:T}=S,k=T-1;return be(be({},e),{},{idleDetachCountdown:be(be({},e.idleDetachCountdown),{},{remaining:k,timer:se(k)})});case Je:return be(be({},e),{},{idleDetachCountdown:be(be({},e.idleDetachCountdown),{},{isActive:!1,wasStopped:!0})});case Qe:return be(be({},e),{},{idleDetachCountdown:{hasCountdown:!1,isActive:!1}});case Ze:return be(be({},e),{},{resumeConversationPrompt:!0});case Xe:return be(be({},e),{},{resumeConversationPrompt:!1});case He:case $e:return be(be({},e),{},{participantInfo:Et(e.participantInfo,t)});case Ge:return e.serviceInfo.activeServiceSessionId!==t.activeServiceSessionId?be(be({},e),{},{serviceInfo:be(be({},e.serviceInfo),{},{activeServiceSessionId:t.activeServiceSessionId})}):e;case qe:case Ve:return be(be({},e),{},{headerTitles:Dt(e.headerTitles,t)});case ot:return be(be({},e),{},{initialState:t.initialState});case et:return be(be({},e),{},{serviceData:be(be({},e.serviceData),{},{[t.payload.type]:t.payload})});case tt:return be(be({},e),{},{options:be(be({},e.options),{},{features:t.features})});case rt:return e.options.features.hasOwnProperty(t.key)?be(be({},e),{},{options:be(be({},e.options),{},{features:be(be({},e.options.features),{},{[t.key]:be(be({},e.options.features[t.key]||{}),{},{enabled:t.enabled})})})}):e;case nt:return be(be({},e),{},{options:be(be({},e.options),{},{features:{}})});case at:return be(be({},e),{},{options:be(be({},e.options),{},{panelActive:!0,optionActive:t.optionName})});case ct:return be(be({},e),{},{options:be(be({},e.options),{},{panelActive:!1,optionActive:""})});case st:return be(be({},e),{},{options:be(be({},e.options),{},{userSelectedOptions:t.options})});case it:const{option:P,value:I}=t;return be(be({},e),{},{options:be(be({},e.options),{},{userSelectedOptions:be(be({},e.options.userSelectedOptions),{},{[P]:I})})});case ut:const{value:N}=t;return be(be({},e),{},{entryMeta:be(be({},e.entryMeta),{},{blockAutoEntrySwitch:N})});case ft:const{entryMeta:F}=t;return be(be({},e),{},{entryMeta:be(be(be({},e.entryMeta),F),{},{active:F.default,options:be({},F.options||{}),overrideOptions:{}})});case pt:const{entryType:R}=t;return be(be({},e),{},{entryMeta:be(be({},e.entryMeta),{},{active:R})});case lt:const{entryType:B}=t;return be(be({},e),{},{entryMeta:be(be({},e.entryMeta),{},{userSelected:B})});case ht:return be(be({},e),{},{currentUploads:[...e.currentUploads,{id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle}]});case dt:return be(be({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?be(be({},e),{},{progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}):e))});case bt:return be(be({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?be(be({},e),{},{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))});case yt:return be(be({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?be(be({},e),{},{complete:!0}):e))});case mt:return be(be({},e),{},{currentUploads:e.currentUploads.filter((e=>e.id!==t.fileId))});case gt:return be(be({},e),{},{currentUploads:[]});case vt:return be(be({},e),{},{seamlyContainerElement:t.element});default:return e}})(e,t)}const pp=["namespace","parentElement","showFaq"],fp=["view"];function hp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function dp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hp(Object(r),!0).forEach((function(t){yp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function yp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bp(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}class mp{constructor(e,t){const{namespace:r="",parentElement:n,showFaq:i}=e,s=bp(e,pp);this.config=dp(dp({},s),{},{showFaq:!1!==i,namespace:r}),this.namespace=r,this.parentElement=n,this.externalApi=t,this.api=new tp({namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(o()),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 t=this.config.customComponents||{},{view:r}=t,n=bp(t,fp),o=dp(dp({},this.config),{},{customComponents:Object.keys(n).length?n:void 0}),i=function({initialState:e,api:t,eventBus:r,config:n}={}){return K({reducers:{state:lp,[String(Vo)]:Vo,[String(Rr)]:Rr,[String(Zi)]:Zi,[String(li)]:li,[String(gn)]:gn,[String(oo)]:oo,[String(po)]:po},initialState:e,middlewares:[ul({api:t}),op.withExtraArgument({api:t,eventBus:r,config:n}),({dispatch:e})=>t=>r=>{var n,o;const i=t(r);switch(r.type){case String(g):case String(v):var s,a;null!=r&&null!==(n=r.config)&&void 0!==n&&null!==(o=n.defaults)&&void 0!==o&&o.agentName&&e({type:Ne.SET_HEADER_SUB_TITLE,title:null==r||null===(s=r.config)||void 0===s||null===(a=s.defaults)||void 0===a?void 0:a.agentName})}return i},Zn({api:t}),cp({api:t}),({dispatch:e,getState:t})=>r=>n=>{var o,i,s,a,c,u,l;const p=r(n);switch(n.type){case String(Ne.SET_HISTORY):null!==(o=n.history)&&void 0!==o&&null!==(i=o.translation)&&void 0!==i&&i.enabled&&e(Yo(n.history.translation.locale));break;case String(Ne.SET_INITIAL_STATE):null!==(s=n.initialState)&&void 0!==s&&null!==(a=s.translation)&&void 0!==a&&a.enabled&&(e(Yo(n.initialState.translation.locale)),e(Bt(n.locale)));break;case String(Ne.ADD_EVENT):"info"===n.event.type&&"new_translation"===(null===(c=n.event)||void 0===c||null===(u=c.payload)||void 0===u||null===(l=u.body)||void 0===l?void 0:l.subtype)&&n.event.payload.body.translationEnabled&&e(Bt(n.event.payload.body.translationLocale));break;case String(Jo):const r=It(t());e(Bt(r))}return p}]})}({api:this.api,eventBus:this.eventBus,config:o});await i.dispatch(Cr()),r?(0,e.render)((0,F.jsx)(ll,{config:o,eventBus:this.eventBus,store:i,api:this.api,children:(0,F.jsx)(r,{})}),this.parentElement):(0,e.render)((0,F.jsx)(dl,{config:o,eventBus:this.eventBus,store:i,api:this.api}),this.parentElement)}destroy(){(0,e.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),delete this.functions}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const r=this.functions[e];r&&r.length&&(this.functions[e]=r.filter((e=>e!==t)))}execFunction(e,...t){const r=this.functions[e];return!(!r||!r.length||(r.forEach((r=>{try{r(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}function gp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gp(Object(r),!0).forEach((function(t){Op(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Op(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wp=e=>"object"==typeof e&&"action"in e,Ep=e=>vp(vp({},e),{},{args:Array.isArray(e.args)?e.args:[e.args]}),Dp=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e}push(...e){(e=e.filter(wp).map(Ep)).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._waitingActions.push(e)}}))}handleInit(e){const t=this.getUserConfig(...e.args),r=this.getCombinedConfig(t),{parentElement:n,namespace:o}=r||t;if(o?Object.values(this._instances).forEach((e=>{e.parentElement!==n&&e.namespace!==o||this.destroy(e)})):this.destroy(),r){const e=this.createInstance(r);this._instances[r.namespace]=e,e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:r,args:n}=e,o=Object.values(this._instances);return!r&&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=>(!r||e.namespace===r)&&e.execFunction(t,...n))).some(Boolean)}createInstance(e){return new mp(e,this)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){if("function"==typeof this.appConfig)return this.appConfig(e);const t=vp(vp({},this.appConfig.defaults),e.defaults);return vp(vp(vp({},this.appConfig),e),{},{api:vp(vp({},this.appConfig.api),e.api),defaults:Object.keys(t).length?t:void 0})}},jp=()=>{const{t:e}=hn(),{title:t,subTitle:r}=or(),n=ir(),{isOpen:o}=so(),i=cr(),{hasInterrupt:s}=Wn(),{defaults:a}=ee(),{startChatIcon:c}=a||{},u=i&&!s?i.avatar:null,l=s?"":r,p=["message-count"];return o&&p.push("message-count__hide"),0===n&&p.push("message-count__empty"),(u||l||!o)&&(0,F.jsxs)("div",{className:Br("agent-info"),children:[(0,F.jsxs)("div",{className:Br("agent-info__graphic"),children:[u||c?(0,F.jsx)("img",{className:Br(u?"avatar":"icon"),src:u||c,alt:""}):(0,F.jsx)(fi,{name:"avatar",size:"32"}),(0,F.jsx)("span",{className:Br(p),"aria-hidden":"true",children:n})]}),(0,F.jsxs)("div",{className:Br("agent-info__body"),children:[(0,F.jsx)("p",{className:Br("agent-info__heading"),children:t??e("header.title")}),(0,F.jsx)("p",{className:Br("agent-info__text"),children:l})]})]})},xp=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:r}=er(),n=(0,Y.useRef)(null),{t:o}=hn();return(0,F.jsxs)("header",{className:Br("app__header"),children:[e,(0,F.jsx)("div",{className:Br("header-controls"),children:(0,F.jsx)("button",{type:"button",className:Br("button","header-controls__collapse"),onClick:t,ref:n,id:r,children:(0,F.jsx)(fi,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},_p=({onOpenChat:e})=>{const{t}=hn(),r=Un(),{isOpen:n}=so(),o=(0,Y.useRef)(null),i=(0,Y.useRef)(null),s=(0,Y.useRef)(),a=Dn(),c=(()=>{const e=(0,Y.useRef)(null),[t]=wn();return e.current=t,(0,Y.useCallback)((t=>{de(e.current,(()=>{On(t)}))}),[])})(),u=cr(),l=or().subTitle,{hasInterrupt:p}=Wn(),{headerCollapseButtonId:f}=er(),h=u&&!p;return(0,Y.useLayoutEffect)((()=>{!1===n&&!0===o.current&&c(i.current),o.current=n}),[n,c]),(0,F.jsxs)("div",{className:Br("toggle-button"),children:[(0,F.jsxs)("div",{id:r,children:[(0,F.jsx)("p",{className:Br("toggle-button__title"),children:t(h?"toggleButton.resumeTitle":"toggleButton.title")}),(0,F.jsx)("p",{className:Br("toggle-button__subtitle"),children:h?l:t("toggleButton.subtitle")})]}),(0,F.jsx)("button",{type:"button","aria-labelledby":r,className:Br("toggle-button__button"),ref:i,onMouseUp:()=>{s.current="mouse"},onKeyUp:()=>{s.current="key"},onClick:()=>{e(),"mouse"===s.current?a():"key"===s.current&&c(f)}})]})},Cp=["categories"];function Ap(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Sp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ap(Object(r),!0).forEach((function(t){Tp(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ap(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kp=()=>{const{t:e}=hn(),{sendAction:t,addMessageBubble:r}=go(),n=Un(),o=Dn(),{sendPolite:i}=Oo(),{hasInterrupt:s}=Wn(),{hasCountdown:a,endCountdown:c}=Lo(),{hasPrompt:u,continueChat:l}=Uo(),p=ur("suggestion"),[f]=oi({payload:p}),h=(0,Y.useMemo)((()=>(p&&!s?f:[]).map((e=>{let{categories:t=[]}=e;return Sp(Sp({},function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,Cp)),{},{categories:t,classNames:["faqs__item",...t.map((e=>`faqs__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`))]})}))),[p,s,f]),d=(0,Y.useRef)(null),y=(0,Y.useRef)(!1),{isInline:b}=lr(),m=io(),g=!b&&m,v=(0,Y.useRef)(g),O=!!h.length,w=O&&!g,E=(0,Y.useRef)([]),D=O?h:E.current;E.current=D;const j=(0,Y.useRef)(null);(0,Y.useEffect)((()=>{if(d.current!==h&&!g){if(O){const t=y.current?e("faq.srUpdatedText"):e("faq.srAvailableText");setTimeout((()=>{i(t)}),30)}else y.current&&i(e("faq.srUnavailableText"));d.current=h}!v.current&&g?(de(j.current,o),i(e("faq.srUnavailableText"))):!O&&y.current&&de(j.current,o),y.current=O,v.current=g}),[O,h,g,o,i,e]);const x=e("faq.headingText"),_=x?"section":"div";return(0,F.jsx)(gi,{isActive:w,transitionStartState:yi,children:(0,F.jsxs)(_,{className:Br("faqs"),"aria-labelledby":x?n:null,ref:j,children:[x&&(0,F.jsx)("h2",{id:n,className:Br("faqs__heading"),children:x}),!!D.length&&(0,F.jsx)("ul",{className:Br("faqs__list"),children:D.map((e=>(0,F.jsx)("li",{className:Br(e.classNames),children:(0,F.jsxs)("button",{type:"button",onClick:()=>{(({id:e,question:n})=>{a&&c(!0),u&&l(),t({type:je,originMessage:p.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:n}}}),r(n),o()})(e)},className:Br("button","button--secondary"),children:[(0,F.jsx)(fi,{name:"chevronRight",size:"8"}),e.question]})},e.id.toString())))})]})})},Pp=({children:e})=>{const[,t]=wn(),{isOpen:r,isVisible:n,setVisibility:o}=so(),{zIndex:i,showFaq:s,layoutMode:a}=ee(),{isModal:c,isInline:u}=lr(),l=Vr(),p=io(),{locale:f}=hn(),h=(0,Y.useCallback)((e=>{t(e)}),[t]),d=(0,Y.useMemo)((()=>{if(f&&document.querySelector("html").getAttribute("lang")!==f)return f}),[f]),y=["app","app--deprecated",...l];return r||"window"!==a||y.push("app--collapsed"),p&&y.push("app--user-responded"),y.push(`app--layout-${a}`),n&&(0,F.jsxs)("section",{className:Br(y),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!u&&r&&o(_.minimized)},onClick:e=>{c&&e.stopPropagation()},lang:d,tabIndex:"-1",ref:h,style:{zIndex:i},"data-nosnippet":!0,children:[(0,F.jsx)("div",{className:Br("app-wrapper"),children:e}),s&&(0,F.jsx)(kp,{})]})},Ip=()=>{const{isVisible:e}=so(),{closeChat:t,openChat:r}=To();return e&&(0,F.jsxs)(Pp,{children:[(0,F.jsx)(_p,{onOpenChat:r}),(0,F.jsx)(xp,{onCloseChat:t,children:(0,F.jsx)(jp,{})}),(0,F.jsxs)(ju,{interruptComponent:Ls,children:[(0,F.jsx)(Hc,{}),(0,F.jsx)(yu,{})]})]})},Np=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:[],r=new Dp(e);window.seamly={push:r.push.bind(r)},r.push(...t)}})(),module.exports=n})();
2
+ (()=>{var e={574:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach((function(e){n.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this._defaults.push({fn:e,args:n}),this}})),n.prototype._setDefaults=function(e){this._defaults.forEach((function(n){var r;e[n.fn].apply(e,function(e){if(Array.isArray(e))return t(e)}(r=n.args)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(r)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(r)||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.")}())}))},e.exports=n},766:(e,t,n)=>{"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;var i=n(767),s=n(445),a=n(129),c=n(842),l=n(508),u=n(253),p=n(574);function h(){}e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1===arguments.length?new t.Request("GET",e):new t.Request(e,n)};var f=t=e.exports;t.Request=O,f.getXHR=function(){if(o.XMLHttpRequest&&(!o.location||"file:"!==o.location.protocol||!o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("Browser-only version of superagent could not find XHR")};var d="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function y(e){if(!l(e))return e;var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&b(t,n,e[n]);return t.join("&")}function b(e,t,n){if(void 0!==n)if(null!==n)if(Array.isArray(n))n.forEach((function(n){b(e,t,n)}));else if(l(n))for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&b(e,"".concat(t,"[").concat(r,"]"),n[r]);else e.push(encodeURI(t)+"="+encodeURIComponent(n));else e.push(encodeURI(t))}function m(e){for(var t,n,r={},o=e.split("&"),i=0,s=o.length;i<s;++i)-1===(n=(t=o[i]).indexOf("="))?r[decodeURIComponent(t)]="":r[decodeURIComponent(t.slice(0,n))]=decodeURIComponent(t.slice(n+1));return r}function g(e){return/[/+]json($|[^-\w])/i.test(e)}function v(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,n,r,o,i=e.split(/\r?\n/),s={},a=0,c=i.length;a<c;++a)-1!==(t=(n=i[a]).indexOf(":"))&&(r=n.slice(0,t).toLowerCase(),o=d(n.slice(t+1)),s[r]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function O(e,t){var n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,r=null;try{r=new v(n)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,n.xhr?(t.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",r);try{n._isResponseOK(r)||(e=new Error(r.statusText||r.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=r,e.status=r.status,n.callback(e,r)):n.callback(null,r)}))}function w(e,t,n){var r=f("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}f.serializeObject=y,f.parseString=m,f.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},f.serialize={"application/x-www-form-urlencoded":a.stringify,"application/json":s},f.parse={"application/x-www-form-urlencoded":m,"application/json":JSON.parse},u(v.prototype),v.prototype._parseBody=function(e){var t=f.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&g(this.type)&&(t=f.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},v.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,r="cannot ".concat(t," ").concat(n," (").concat(this.status,")"),o=new Error(r);return o.status=this.status,o.method=t,o.url=n,o},f.Response=v,i(O.prototype),c(O.prototype),O.prototype.type=function(e){return this.set("Content-Type",f.types[e]||e),this},O.prototype.accept=function(e){return this.set("Accept",f.types[e]||e),this},O.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"===r(t)&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});var o=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,o)},O.prototype.query=function(e){return"string"!=typeof e&&(e=y(e)),e&&this._query.push(e),this},O.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},O.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},O.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},O.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},O.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},O.prototype.ca=O.prototype.agent,O.prototype.buffer=O.prototype.ca,O.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},O.prototype.pipe=O.prototype.write,O.prototype._isHost=function(e){return e&&"object"===r(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},O.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||h,this._finalizeQueryString(),this._end()},O.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},O.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=f.getXHR();var t=this.xhr,n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){var o=this._header["content-type"],i=this._serializer||f.serialize[o?o.split(";")[0]:""];!i&&g(o)&&(i=f.serialize["application/json"]),i&&(n=i(n))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},f.agent=function(){return new p},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){p.prototype[e.toLowerCase()]=function(t,n){var r=new f.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}})),p.prototype.del=p.prototype.delete,f.get=function(e,t,n){var r=f("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},f.head=function(e,t,n){var r=f("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},f.options=function(e,t,n){var r=f("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},f.del=w,f.delete=w,f.patch=function(e,t,n){var r=f("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},f.post=function(e,t,n){var r=f("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},f.put=function(e,t,n){var r=f("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},508:e=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!==e&&"object"===t(e)}},842:(e,t,n)=>{"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=n(508);function i(e){if(e)return function(e){for(var t in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,t)&&(e[t]=i.prototype[t]);return e}(e)}e.exports=i,i.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},i.prototype.parse=function(e){return this._parser=e,this},i.prototype.responseType=function(e){return this._responseType=e,this},i.prototype.serialize=function(e){return this._serializer=e,this},i.prototype.timeout=function(e){if(!e||"object"!==r(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},i.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var s=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),a=new Set([408,413,429,500,502,503,504,521,522,524]);i.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&a.has(t.status))return!0;if(e){if(e.code&&s.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},i.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},i.prototype.then=function(e,t){var n=this;if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){r.on("abort",(function(){if(!(n._maxRetries&&n._maxRetries>n._retries))if(n.timedout&&n.timedoutError)t(n.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=n.status,e.method=n.method,e.url=n.url,t(e)}})),r.end((function(n,r){n?t(n):e(r)}))}))}return this._fullfilledPromise.then(e,t)},i.prototype.catch=function(e){return this.then(void 0,e)},i.prototype.use=function(e){return e(this),this},i.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},i.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},i.prototype.get=function(e){return this._header[e.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(e,t){if(o(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},i.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},i.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(o(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(e,t[r]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),this._getFormData().append(e,t),this},i.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},i.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic ".concat(r("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},i.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},i.prototype.redirects=function(e){return this._maxRedirects=e,this},i.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(e){var t=o(e),n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&o(this._data))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._data[r]=e[r]);else"string"==typeof e?(n||this.type("form"),(n=this._header["content-type"])&&(n=n.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===n?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},i.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},i.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.slice(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.slice(0,t)+"?"+n.join("&")}}},i.prototype._appendQueryString=function(){console.warn("Unsupported")},i.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error("".concat(e+t,"ms exceeded"));r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.timedoutError=r,this.abort(),this.callback(r)}},i.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},253:(e,t,n)=>{"use strict";var r=n(244);function o(e){if(e)return function(e){for(var t in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,t)&&(e[t]=o.prototype[t]);return e}(e)}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=r.type(t);var n=r.params(t);for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(this[o]=n[o]);this.links={};try{e.link&&(this.links=r.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){var t=e/100|0;this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},244:(e,t)=>{"use strict";function n(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){var t,r={},o=n(e.split(/ *; */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *= */),s=i.shift(),a=i.shift();s&&a&&(r[s]=a)}}catch(e){o.e(e)}finally{o.f()}return r},t.parseLinks=function(e){var t,r={},o=n(e.split(/ *, */));try{for(o.s();!(t=o.n()).done;){var i=t.value.split(/ *; */),s=i[0].slice(1,-1);r[i[1].split(/ *= */)[1].slice(1,-1)]=s}}catch(e){o.e(e)}finally{o.f()}return r},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},905:e=>{e.exports=()=>()=>null},698:e=>{e.exports=null},924:(e,t,n)=>{"use strict";var r=n(210),o=n(559),i=o(r("String.prototype.indexOf"));e.exports=function(e,t){var n=r(e,!!t);return"function"==typeof n&&i(e,".prototype.")>-1?o(n):n}},559:(e,t,n)=>{"use strict";var r=n(612),o=n(210),i=o("%Function.prototype.apply%"),s=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||r.call(s,i),c=o("%Object.getOwnPropertyDescriptor%",!0),l=o("%Object.defineProperty%",!0),u=o("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}e.exports=function(e){var t=a(r,s,arguments);if(c&&l){var n=c(t,"length");n.configurable&&l(t,"length",{value:1+u(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(r,i,arguments)};l?l(e.exports,"apply",{value:p}):e.exports.apply=p},767:e=>{function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},289:(e,t,n)=>{"use strict";var r=n(215),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,a=Object.defineProperty,c=a&&function(){var e={};try{for(var t in a(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),l=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(c?a(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=s.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a<i.length;a+=1)l(e,i[a],t[i[a]],n[i[a]])};u.supportsDescriptors=!!c,e.exports=u},445:e=>{e.exports=r,r.default=r,r.stable=s,r.stableStringify=s;var t=[],n=[];function r(e,r,i){var s;for(o(e,"",[],void 0),s=0===n.length?JSON.stringify(e,r,i):JSON.stringify(e,c(r),i);0!==t.length;){var a=t.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return s}function o(e,r,i,s){var a;if("object"==typeof e&&null!==e){for(a=0;a<i.length;a++)if(i[a]===e){var c=Object.getOwnPropertyDescriptor(s,r);return void(void 0!==c.get?c.configurable?(Object.defineProperty(s,r,{value:"[Circular]"}),t.push([s,r,e,c])):n.push([e,r]):(s[r]="[Circular]",t.push([s,r,e])))}if(i.push(e),Array.isArray(e))for(a=0;a<e.length;a++)o(e[a],a,i,e);else{var l=Object.keys(e);for(a=0;a<l.length;a++){var u=l[a];o(e[u],u,i,e)}}i.pop()}}function i(e,t){return e<t?-1:e>t?1:0}function s(e,r,o){var i,s=a(e,"",[],void 0)||e;for(i=0===n.length?JSON.stringify(s,r,o):JSON.stringify(s,c(r),o);0!==t.length;){var l=t.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}return i}function a(e,r,o,s){var c;if("object"==typeof e&&null!==e){for(c=0;c<o.length;c++)if(o[c]===e){var l=Object.getOwnPropertyDescriptor(s,r);return void(void 0!==l.get?l.configurable?(Object.defineProperty(s,r,{value:"[Circular]"}),t.push([s,r,e,l])):n.push([e,r]):(s[r]="[Circular]",t.push([s,r,e])))}if("function"==typeof e.toJSON)return;if(o.push(e),Array.isArray(e))for(c=0;c<e.length;c++)a(e[c],c,o,e);else{var u={},p=Object.keys(e).sort(i);for(c=0;c<p.length;c++){var h=p[c];a(e[h],h,o,e),u[h]=e[h]}if(void 0===s)return u;t.push([s,r,e]),s[r]=u}o.pop()}}function c(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var o=0;o<n.length;o++){var i=n[o];if(i[1]===t&&i[0]===r){r="[Circular]",n.splice(o,1);break}}return e.call(this,t,r)}}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,r=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||r.call(i)!==o)throw new TypeError(t+i);for(var s,a=n.call(arguments,1),c=function(){if(this instanceof s){var t=i.apply(this,a.concat(n.call(arguments)));return Object(t)===t?t:this}return i.apply(e,a.concat(n.call(arguments)))},l=Math.max(0,i.length-a.length),u=[],p=0;p<l;p++)u.push("$"+p);if(s=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(c),i.prototype){var h=function(){};h.prototype=i.prototype,s.prototype=new h,h.prototype=null}return s}},612:(e,t,n)=>{"use strict";var r=n(648);e.exports=Function.prototype.bind||r},210:(e,t,n)=>{"use strict";var r,o=SyntaxError,i=Function,s=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var l=function(){throw new s},u=c?function(){try{return l}catch(e){try{return c(arguments,"callee").get}catch(e){return l}}}():l,p=n(405)(),h=Object.getPrototypeOf||function(e){return e.__proto__},f={},d="undefined"==typeof Uint8Array?r:h(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":p?h([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p?h(h([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p?h((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p?h((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p?h(""[Symbol.iterator]()):r,"%Symbol%":p?Symbol:r,"%SyntaxError%":o,"%ThrowTypeError%":u,"%TypedArray%":d,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet},b=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(n=h(o.prototype))}return y[t]=n,n},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=n(612),v=n(642),O=g.call(Function.call,Array.prototype.concat),w=g.call(Function.apply,Array.prototype.splice),j=g.call(Function.call,String.prototype.replace),_=g.call(Function.call,String.prototype.slice),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,S=function(e){var t=_(e,0,1),n=_(e,-1);if("%"===t&&"%"!==n)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var r=[];return j(e,x,(function(e,t,n,o){r[r.length]=n?j(o,E,"$1"):t||e})),r},T=function(e,t){var n,r=e;if(v(m,r)&&(r="%"+(n=m[r])[0]+"%"),v(y,r)){var i=y[r];if(i===f&&(i=b(r)),void 0===i&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');var n=S(e),r=n.length>0?n[0]:"",i=T("%"+r+"%",t),a=i.name,l=i.value,u=!1,p=i.alias;p&&(r=p[0],w(n,O([0,1],p)));for(var h=1,f=!0;h<n.length;h+=1){var d=n[h],b=_(d,0,1),m=_(d,-1);if(('"'===b||"'"===b||"`"===b||'"'===m||"'"===m||"`"===m)&&b!==m)throw new o("property names with quotes must have matching quotes");if("constructor"!==d&&f||(u=!0),v(y,a="%"+(r+="."+d)+"%"))l=y[a];else if(null!=l){if(!(d in l)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&h+1>=n.length){var g=c(l,d);l=(f=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:l[d]}else f=v(l,d),l=l[d];f&&!u&&(y[a]=l)}}return l}},221:e=>{"use strict";"undefined"!=typeof self?e.exports=self:"undefined"!=typeof window?e.exports=window:e.exports=Function("return this")()},503:(e,t,n)=>{"use strict";var r=n(289),o=n(221),i=n(168),s=n(471),a=i(),c=function(){return a};r(c,{getPolyfill:i,implementation:o,shim:s}),e.exports=c},168:(e,t,n)=>{"use strict";var r=n(221);e.exports=function(){return"object"==typeof n.g&&n.g&&n.g.Math===Math&&n.g.Array===Array?n.g:r}},471:(e,t,n)=>{"use strict";var r=n(289),o=n(168);e.exports=function(){var e=o();if(r.supportsDescriptors){var t=Object.getOwnPropertyDescriptor(e,"globalThis");(!t||t.configurable&&(t.enumerable||t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!1})}else"object"==typeof globalThis&&globalThis===e||(e.globalThis=e);return e}},405:(e,t,n)=>{"use strict";var r="undefined"!=typeof Symbol&&Symbol,o=n(419);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},642:(e,t,n)=>{"use strict";var r=n(612);e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},679:e=>{e.exports=function(e){var t={},n=[];(e=e||this).on=function(n,r,o){return(t[n]=t[n]||[]).push([r,o]),e},e.off=function(r,o){r||(t={});for(var i=t[r]||n,s=i.length=o?i.length:0;s--;)o==i[s][0]&&i.splice(s,1);return e},e.emit=function(r){for(var o,i=t[r]||n,s=i.length>0?i.slice(0,i.length):i,a=0;o=s[a++];)o[0].apply(o[1],n.slice.call(arguments,1));return e}}},631:(e,t,n)=>{var r="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=r&&o&&"function"==typeof o.get?o.get:null,s=r&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=a&&c&&"function"==typeof c.get?c.get:null,u=a&&Set.prototype.forEach,p="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,h="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,f="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,y=Object.prototype.toString,b=Function.prototype.toString,m=String.prototype.match,g="function"==typeof BigInt?BigInt.prototype.valueOf:null,v=Object.getOwnPropertySymbols,O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,w="function"==typeof Symbol&&"object"==typeof Symbol.iterator,j=Object.prototype.propertyIsEnumerable,_=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),x=n(654).custom,E=x&&C(x)?x:null,S="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null;function T(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function k(e){return String(e).replace(/"/g,"&quot;")}function P(e){return!("[object Array]"!==N(e)||S&&"object"==typeof e&&S in e)}function C(e){if(w)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!O)return!1;try{return O.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,r,o){var a=n||{};if(I(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(I(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=!I(a,"customInspect")||a.customInspect;if("boolean"!=typeof c)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(I(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return R(t,a);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var y=void 0===a.depth?5:a.depth;if(void 0===r&&(r=0),r>=y&&y>0&&"object"==typeof t)return P(t)?"[Array]":"[Object]";var v,j=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=Array(e.indent+1).join(" ")}return{base:n,prev:Array(t+1).join(n)}}(a,r);if(void 0===o)o=[];else if(D(o,t)>=0)return"[Circular]";function x(t,n,i){if(n&&(o=o.slice()).push(n),i){var s={depth:a.depth};return I(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,r+1,o)}return e(t,a,r+1,o)}if("function"==typeof t){var A=function(e){if(e.name)return e.name;var t=m.call(b.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),L=B(t,x);return"[Function"+(A?": "+A:" (anonymous)")+"]"+(L.length>0?" { "+L.join(", ")+" }":"")}if(C(t)){var F=w?String(t).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(t);return"object"!=typeof t||w?F:U(F)}if((v=t)&&"object"==typeof v&&("undefined"!=typeof HTMLElement&&v instanceof HTMLElement||"string"==typeof v.nodeName&&"function"==typeof v.getAttribute)){for(var H="<"+String(t.nodeName).toLowerCase(),q=t.attributes||[],V=0;V<q.length;V++)H+=" "+q[V].name+"="+T(k(q[V].value),"double",a);return H+=">",t.childNodes&&t.childNodes.length&&(H+="..."),H+"</"+String(t.nodeName).toLowerCase()+">"}if(P(t)){if(0===t.length)return"[]";var W=B(t,x);return j&&!function(e){for(var t=0;t<e.length;t++)if(D(e[t],"\n")>=0)return!1;return!0}(W)?"["+$(W,j)+"]":"[ "+W.join(", ")+" ]"}if(function(e){return!("[object Error]"!==N(e)||S&&"object"==typeof e&&S in e)}(t)){var G=B(t,x);return 0===G.length?"["+String(t)+"]":"{ ["+String(t)+"] "+G.join(", ")+" }"}if("object"==typeof t&&c){if(E&&"function"==typeof t[E])return t[E]();if("function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{l.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var K=[];return s.call(t,(function(e,n){K.push(x(n,t,!0)+" => "+x(e,t))})),z("Map",i.call(t),K,j)}if(function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var Y=[];return u.call(t,(function(e){Y.push(x(e,t))})),z("Set",l.call(t),Y,j)}if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{h.call(e,h)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return M("WeakMap");if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return M("WeakSet");if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{return f.call(e),!0}catch(e){}return!1}(t))return M("WeakRef");if(function(e){return!("[object Number]"!==N(e)||S&&"object"==typeof e&&S in e)}(t))return U(x(Number(t)));if(function(e){if(!e||"object"!=typeof e||!g)return!1;try{return g.call(e),!0}catch(e){}return!1}(t))return U(x(g.call(t)));if(function(e){return!("[object Boolean]"!==N(e)||S&&"object"==typeof e&&S in e)}(t))return U(d.call(t));if(function(e){return!("[object String]"!==N(e)||S&&"object"==typeof e&&S in e)}(t))return U(x(String(t)));if(!function(e){return!("[object Date]"!==N(e)||S&&"object"==typeof e&&S in e)}(t)&&!function(e){return!("[object RegExp]"!==N(e)||S&&"object"==typeof e&&S in e)}(t)){var J=B(t,x),Q=_?_(t)===Object.prototype:t instanceof Object||t.constructor===Object,Z=t instanceof Object?"":"null prototype",X=!Q&&S&&Object(t)===t&&S in t?N(t).slice(8,-1):Z?"Object":"",ee=(Q||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(X||Z?"["+[].concat(X||[],Z||[]).join(": ")+"] ":"");return 0===J.length?ee+"{}":j?ee+"{"+$(J,j)+"}":ee+"{ "+J.join(", ")+" }"}return String(t)};var A=Object.prototype.hasOwnProperty||function(e){return e in this};function I(e,t){return A.call(e,t)}function N(e){return y.call(e)}function D(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function R(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return R(e.slice(0,t.maxStringLength),t)+r}return T(e.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,L),"single",t)}function L(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+t.toString(16).toUpperCase()}function U(e){return"Object("+e+")"}function M(e){return e+" { ? }"}function z(e,t,n,r){return e+" ("+t+") {"+(r?$(n,r):n.join(", "))+"}"}function $(e,t){if(0===e.length)return"";var n="\n"+t.prev+t.base;return n+e.join(","+n)+"\n"+t.prev}function B(e,t){var n=P(e),r=[];if(n){r.length=e.length;for(var o=0;o<e.length;o++)r[o]=I(e,o)?t(e[o],e):""}var i,s="function"==typeof v?v(e):[];if(w){i={};for(var a=0;a<s.length;a++)i["$"+s[a]]=s[a]}for(var c in e)I(e,c)&&(n&&String(Number(c))===c&&c<e.length||w&&i["$"+c]instanceof Symbol||(/[^\w$]/.test(c)?r.push(t(c,e)+": "+t(e[c],e)):r.push(c+": "+t(e[c],e))));if("function"==typeof v)for(var l=0;l<s.length;l++)j.call(e,s[l])&&r.push("["+t(s[l])+"]: "+t(e[s[l]],e));return r}},987:(e,t,n)=>{"use strict";var r;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=n(414),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),l=a.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&o.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{p(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();r=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===i.call(e),r=s(e),a=t&&"[object String]"===i.call(e),h=[];if(!t&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var d=l&&n;if(a&&e.length>0&&!o.call(e,0))for(var y=0;y<e.length;++y)h.push(String(y));if(r&&e.length>0)for(var b=0;b<e.length;++b)h.push(String(b));else for(var m in e)d&&"prototype"===m||!o.call(e,m)||h.push(String(m));if(c)for(var g=function(e){if("undefined"==typeof window||!f)return p(e);try{return p(e)}catch(e){return!1}}(e),v=0;v<u.length;++v)g&&"constructor"===u[v]||!o.call(e,u[v])||h.push(u[v]);return h}}e.exports=r},215:(e,t,n)=>{"use strict";var r=Array.prototype.slice,o=n(414),i=Object.keys,s=i?function(e){return i(e)}:n(987),a=Object.keys;s.shim=function(){return Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return o(e)?a(r.call(e)):a(e)}):Object.keys=s,Object.keys||s},e.exports=s},414:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var n=t.call(e),r="[object Arguments]"===n;return r||(r="[object Array]"!==n&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),r}},798:e=>{"use strict";var t=String.prototype.replace,n=/%20/g,r="RFC3986";e.exports={default:r,formatters:{RFC1738:function(e){return t.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:r}},129:(e,t,n)=>{"use strict";var r=n(261),o=n(235),i=n(798);e.exports={formats:i,parse:o,stringify:r}},235:(e,t,n)=>{"use strict";var r=n(769),o=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},l=function(e,t,n,r){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=n.depth>0&&/(\[[^[\]]*])/.exec(i),l=a?i.slice(0,a.index):i,u=[];if(l){if(!n.plainObjects&&o.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var p=0;n.depth>0&&null!==(a=s.exec(i))&&p<n.depth;){if(p+=1,!n.plainObjects&&o.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+i.slice(a.index)+"]"),function(e,t,n,r){for(var o=r?t:c(t,n),i=e.length-1;i>=0;--i){var s,a=e[i];if("[]"===a&&n.parseArrays)s=[].concat(o);else{s=n.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(l,10);n.parseArrays||""!==l?!isNaN(u)&&a!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(s=[])[u]=o:s[l]=o:s={0:o}}o=s}return o}(u,t,n,r)}};e.exports=function(e,t){var n=function(e){if(!e)return s;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?s.charset:e.charset;return{allowDots:void 0===e.allowDots?s.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:s.comma,decoder:"function"==typeof e.decoder?e.decoder:s.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:s.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var n,l={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,p=t.parameterLimit===1/0?void 0:t.parameterLimit,h=u.split(t.delimiter,p),f=-1,d=t.charset;if(t.charsetSentinel)for(n=0;n<h.length;++n)0===h[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===h[n]?d="utf-8":"utf8=%26%2310003%3B"===h[n]&&(d="iso-8859-1"),f=n,n=h.length);for(n=0;n<h.length;++n)if(n!==f){var y,b,m=h[n],g=m.indexOf("]="),v=-1===g?m.indexOf("="):g+1;-1===v?(y=t.decoder(m,s.decoder,d,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(m.slice(0,v),s.decoder,d,"key"),b=r.maybeMap(c(m.slice(v+1),t),(function(e){return t.decoder(e,s.decoder,d,"value")}))),b&&t.interpretNumericEntities&&"iso-8859-1"===d&&(b=a(b)),m.indexOf("[]=")>-1&&(b=i(b)?[b]:b),o.call(l,y)?l[y]=r.combine(l[y],b):l[y]=b}return l}(e,n):e,p=n.plainObjects?Object.create(null):{},h=Object.keys(u),f=0;f<h.length;++f){var d=h[f],y=l(d,u[d],n,"string"==typeof e);p=r.merge(p,y,n)}return!0===n.allowSparse?p:r.compact(p)}},261:(e,t,n)=>{"use strict";var r=n(478),o=n(769),i=n(798),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,l=Array.prototype.push,u=function(e,t){l.apply(e,c(t)?t:[t])},p=Date.prototype.toISOString,h=i.default,f={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:o.encode,encodeValuesOnly:!1,format:h,formatter:i.formatters[h],indices:!1,serializeDate:function(e){return p.call(e)},skipNulls:!1,strictNullHandling:!1},d=function e(t,n,i,s,a,l,p,h,d,y,b,m,g,v,O){var w,j=t;if(O.has(t))throw new RangeError("Cyclic object value");if("function"==typeof p?j=p(n,j):j instanceof Date?j=y(j):"comma"===i&&c(j)&&(j=o.maybeMap(j,(function(e){return e instanceof Date?y(e):e}))),null===j){if(s)return l&&!g?l(n,f.encoder,v,"key",b):n;j=""}if("string"==typeof(w=j)||"number"==typeof w||"boolean"==typeof w||"symbol"==typeof w||"bigint"==typeof w||o.isBuffer(j))return l?[m(g?n:l(n,f.encoder,v,"key",b))+"="+m(l(j,f.encoder,v,"value",b))]:[m(n)+"="+m(String(j))];var _,x=[];if(void 0===j)return x;if("comma"===i&&c(j))_=[{value:j.length>0?j.join(",")||null:void 0}];else if(c(p))_=p;else{var E=Object.keys(j);_=h?E.sort(h):E}for(var S=0;S<_.length;++S){var T=_[S],k="object"==typeof T&&void 0!==T.value?T.value:j[T];if(!a||null!==k){var P=c(j)?"function"==typeof i?i(n,T):n:n+(d?"."+T:"["+T+"]");O.set(t,!0);var C=r();u(x,e(k,P,i,s,a,l,p,h,d,y,b,m,g,v,C))}}return x};e.exports=function(e,t){var n,o=e,l=function(e){if(!e)return f;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||f.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=i.default;if(void 0!==e.format){if(!s.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var r=i.formatters[n],o=f.filter;return("function"==typeof e.filter||c(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:f.addQueryPrefix,allowDots:void 0===e.allowDots?f.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:f.charsetSentinel,delimiter:void 0===e.delimiter?f.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:f.encode,encoder:"function"==typeof e.encoder?e.encoder:f.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:f.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:f.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:f.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:f.strictNullHandling}}(t);"function"==typeof l.filter?o=(0,l.filter)("",o):c(l.filter)&&(n=l.filter);var p,h=[];if("object"!=typeof o||null===o)return"";p=t&&t.arrayFormat in a?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var y=a[p];n||(n=Object.keys(o)),l.sort&&n.sort(l.sort);for(var b=r(),m=0;m<n.length;++m){var g=n[m];l.skipNulls&&null===o[g]||u(h,d(o[g],g,y,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,b))}var v=h.join(l.delimiter),O=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?O+="utf8=%26%2310003%3B&":O+="utf8=%E2%9C%93&"),v.length>0?O+v:""}},769:(e,t,n)=>{"use strict";var r=n(798),o=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)void 0!==e[r]&&(n[r]=e[r]);return n};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,n){return e[n]=t[n],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r<t.length;++r)for(var o=t[r],s=o.obj[o.prop],a=Object.keys(s),c=0;c<a.length;++c){var l=a[c],u=s[l];"object"==typeof u&&null!==u&&-1===n.indexOf(u)&&(t.push({obj:s,prop:l}),n.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],o=0;o<n.length;++o)void 0!==n[o]&&r.push(n[o]);t.obj[t.prop]=r}}}(t),e},decode:function(e,t,n){var r=e.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(e){return r}},encode:function(e,t,n,o,i){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===n)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var c="",l=0;l<a.length;++l){var u=a.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===r.RFC1738&&(40===u||41===u)?c+=a.charAt(l):u<128?c+=s[u]:u<2048?c+=s[192|u>>6]+s[128|63&u]:u<55296||u>=57344?c+=s[224|u>>12]+s[128|u>>6&63]+s[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(l)),c+=s[240|u>>18]+s[128|u>>12&63]+s[128|u>>6&63]+s[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var n=[],r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)},merge:function e(t,n,r){if(!n)return t;if("object"!=typeof n){if(i(t))t.push(n);else{if(!t||"object"!=typeof t)return[t,n];(r&&(r.plainObjects||r.allowPrototypes)||!o.call(Object.prototype,n))&&(t[n]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(n);var s=t;return i(t)&&!i(n)&&(s=a(t,r)),i(t)&&i(n)?(n.forEach((function(n,i){if(o.call(t,i)){var s=t[i];s&&"object"==typeof s&&n&&"object"==typeof n?t[i]=e(s,n,r):t.push(n)}else t[i]=n})),t):Object.keys(n).reduce((function(t,i){var s=n[i];return o.call(t,i)?t[i]=e(t[i],s,r):t[i]=s,t}),s)}}},478:(e,t,n)=>{"use strict";var r=n(210),o=n(924),i=n(631),s=r("%TypeError%"),a=r("%WeakMap%",!0),c=r("%Map%",!0),l=o("WeakMap.prototype.get",!0),u=o("WeakMap.prototype.set",!0),p=o("WeakMap.prototype.has",!0),h=o("Map.prototype.get",!0),f=o("Map.prototype.set",!0),d=o("Map.prototype.has",!0),y=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new s("Side channel does not contain "+i(e))},get:function(r){if(a&&r&&("object"==typeof r||"function"==typeof r)){if(e)return l(e,r)}else if(c){if(t)return h(t,r)}else if(n)return function(e,t){var n=y(e,t);return n&&n.value}(n,r)},has:function(r){if(a&&r&&("object"==typeof r||"function"==typeof r)){if(e)return p(e,r)}else if(c){if(t)return d(t,r)}else if(n)return function(e,t){return!!y(e,t)}(n,r);return!1},set:function(r,o){a&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new a),u(e,r,o)):c?(t||(t=new c),f(t,r,o)):(n||(n={key:{},next:null}),function(e,t,n){var r=y(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,o))}};return r}},839:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,n=e.Symbol;if("function"==typeof n)if(n.observable)t=n.observable;else{t=n.for("https://github.com/benlesh/symbol-observable");try{n.observable=t}catch(e){}}else t="@@observable";return t}},868:(e,t,n)=>{e.exports=n(839)},813:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.NO_IL=t.NO=t.MemoryStream=t.Stream=void 0;var i=n(868),s=n(503),a=i.default(s.getPolyfill()),c={};function l(){}function u(e){for(var t=e.length,n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function p(e,t,n){try{return e.f(t)}catch(e){return n._e(e),c}}t.NO=c;var h={_n:l,_e:l,_c:l};function f(e){e._start=function(e){e.next=e._n,e.error=e._e,e.complete=e._c,this.start(e)},e._stop=e.stop}t.NO_IL=h;var d=function(){function e(e,t){this._stream=e,this._listener=t}return e.prototype.unsubscribe=function(){this._stream._remove(this._listener)},e}(),y=function(){function e(e){this._listener=e}return e.prototype.next=function(e){this._listener._n(e)},e.prototype.error=function(e){this._listener._e(e)},e.prototype.complete=function(){this._listener._c()},e}(),b=function(){function e(e){this.type="fromObservable",this.ins=e,this.active=!1}return e.prototype._start=function(e){this.out=e,this.active=!0,this._sub=this.ins.subscribe(new y(e)),this.active||this._sub.unsubscribe()},e.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},e}(),m=function(){function e(e){this.type="merge",this.insArr=e,this.out=c,this.ac=0}return e.prototype._start=function(e){this.out=e;var t=this.insArr,n=t.length;this.ac=n;for(var r=0;r<n;r++)t[r]._add(this)},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,n=0;n<t;n++)e[n]._remove(this);this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){if(--this.ac<=0){var e=this.out;if(e===c)return;e._c()}},e}(),g=function(){function e(e,t,n){this.i=e,this.out=t,this.p=n,n.ils.push(this)}return e.prototype._n=function(e){var t=this.p,n=this.out;if(n!==c&&t.up(e,this.i)){var r=u(t.vals);n._n(r)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.p;e.out!==c&&0==--e.Nc&&e.out._c()},e}(),v=function(){function e(e){this.type="combine",this.insArr=e,this.out=c,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return e.prototype.up=function(e,t){var n=this.vals[t],r=this.Nn?n===c?--this.Nn:this.Nn:0;return this.vals[t]=e,0===r},e.prototype._start=function(e){this.out=e;var t=this.insArr,n=this.Nc=this.Nn=t.length,r=this.vals=new Array(n);if(0===n)e._n([]),e._c();else for(var o=0;o<n;o++)r[o]=c,t[o]._add(new g(o,e,this))},e.prototype._stop=function(){for(var e=this.insArr,t=e.length,n=this.ils,r=0;r<t;r++)e[r]._remove(n[r]);this.out=c,this.ils=[],this.vals=[]},e}(),O=function(){function e(e){this.type="fromArray",this.a=e}return e.prototype._start=function(e){for(var t=this.a,n=0,r=t.length;n<r;n++)e._n(t[n]);e._c()},e.prototype._stop=function(){},e}(),w=function(){function e(e){this.type="fromPromise",this.on=!1,this.p=e}return e.prototype._start=function(e){var t=this;this.on=!0,this.p.then((function(n){t.on&&(e._n(n),e._c())}),(function(t){e._e(t)})).then(l,(function(e){setTimeout((function(){throw e}))}))},e.prototype._stop=function(){this.on=!1},e}(),j=function(){function e(e){this.type="periodic",this.period=e,this.intervalID=-1,this.i=0}return e.prototype._start=function(e){var t=this;this.intervalID=setInterval((function(){e._n(t.i++)}),this.period)},e.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},e}(),_=function(){function e(e,t){this.type="debug",this.ins=e,this.out=c,this.s=l,this.l="","string"==typeof t?this.l=t:"function"==typeof t&&(this.s=t)}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var n=this.s,r=this.l;if(n!==l)try{n(e)}catch(e){t._e(e)}else r?console.log(r+":",e):console.log(e);t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),x=function(){function e(e,t){this.type="drop",this.ins=t,this.out=c,this.max=e,this.dropped=0}return e.prototype._start=function(e){this.out=e,this.dropped=0,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&this.dropped++>=this.max&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),E=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(){this.op.end()},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.end()},e}(),S=function(){function e(e,t){this.type="endWhen",this.ins=t,this.out=c,this.o=e,this.oil=h}return e.prototype._start=function(e){this.out=e,this.o._add(this.oil=new E(e,this)),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=c,this.oil=h},e.prototype.end=function(){var e=this.out;e!==c&&e._c()},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.end()},e}(),T=function(){function e(e,t){this.type="filter",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var n=p(this,e,t);n!==c&&n&&t._n(e)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),k=function(){function e(e,t){this.out=e,this.op=t}return e.prototype._n=function(e){this.out._n(e)},e.prototype._e=function(e){this.out._e(e)},e.prototype._c=function(){this.op.inner=c,this.op.less()},e}(),P=function(){function e(e){this.type="flatten",this.ins=e,this.out=c,this.open=!0,this.inner=c,this.il=h}return e.prototype._start=function(e){this.out=e,this.open=!0,this.inner=c,this.il=h,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.inner!==c&&this.inner._remove(this.il),this.out=c,this.open=!0,this.inner=c,this.il=h},e.prototype.less=function(){var e=this.out;e!==c&&(this.open||this.inner!==c||e._c())},e.prototype._n=function(e){var t=this.out;if(t!==c){var n=this.inner,r=this.il;n!==c&&r!==h&&n._remove(r),(this.inner=e)._add(this.il=new k(t,this))}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){this.open=!1,this.less()},e}(),C=function(){function e(e,t,n){var r=this;this.type="fold",this.ins=n,this.out=c,this.f=function(t){return e(r.acc,t)},this.acc=this.seed=t}return e.prototype._start=function(e){this.out=e,this.acc=this.seed,e._n(this.acc),this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.acc=this.seed},e.prototype._n=function(e){var t=this.out;if(t!==c){var n=p(this,e,t);n!==c&&t._n(this.acc=n)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),A=function(){function e(e){this.type="last",this.ins=e,this.out=c,this.has=!1,this.val=c}return e.prototype._start=function(e){this.out=e,this.has=!1,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c,this.val=c},e.prototype._n=function(e){this.has=!0,this.val=e},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&(this.has?(e._n(this.val),e._c()):e._e(new Error("last() failed because input stream completed")))},e}(),I=function(){function e(e,t){this.type="map",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var n=p(this,e,t);n!==c&&t._n(n)}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),N=function(){function e(e){this.type="remember",this.ins=e,this.out=c}return e.prototype._start=function(e){this.out=e,this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),D=function(){function e(e,t){this.type="replaceError",this.ins=t,this.out=c,this.f=e}return e.prototype._start=function(e){this.out=e,this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;t!==c&&t._n(e)},e.prototype._e=function(e){var t=this.out;if(t!==c)try{this.ins._remove(this),(this.ins=this.f(e))._add(this)}catch(e){t._e(e)}},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),R=function(){function e(e,t){this.type="startWith",this.ins=e,this.out=c,this.val=t}return e.prototype._start=function(e){this.out=e,this.out._n(this.val),this.ins._add(e)},e.prototype._stop=function(){this.ins._remove(this.out),this.out=c},e}(),L=function(){function e(e,t){this.type="take",this.ins=t,this.out=c,this.max=e,this.taken=0}return e.prototype._start=function(e){this.out=e,this.taken=0,this.max<=0?e._c():this.ins._add(this)},e.prototype._stop=function(){this.ins._remove(this),this.out=c},e.prototype._n=function(e){var t=this.out;if(t!==c){var n=++this.taken;n<this.max?t._n(e):n===this.max&&(t._n(e),t._c())}},e.prototype._e=function(e){var t=this.out;t!==c&&t._e(e)},e.prototype._c=function(){var e=this.out;e!==c&&e._c()},e}(),U=function(){function e(e){this._prod=e||c,this._ils=[],this._stopID=c,this._dl=c,this._d=!1,this._target=null,this._err=c}return e.prototype._n=function(e){var t=this._ils,n=t.length;if(this._d&&this._dl._n(e),1==n)t[0]._n(e);else{if(0==n)return;for(var r=u(t),o=0;o<n;o++)r[o]._n(e)}},e.prototype._e=function(e){if(this._err===c){this._err=e;var t=this._ils,n=t.length;if(this._x(),this._d&&this._dl._e(e),1==n)t[0]._e(e);else{if(0==n)return;for(var r=u(t),o=0;o<n;o++)r[o]._e(e)}if(!this._d&&0==n)throw this._err}},e.prototype._c=function(){var e=this._ils,t=e.length;if(this._x(),this._d&&this._dl._c(),1==t)e[0]._c();else{if(0==t)return;for(var n=u(e),r=0;r<t;r++)n[r]._c()}},e.prototype._x=function(){0!==this._ils.length&&(this._prod!==c&&this._prod._stop(),this._err=c,this._ils=[])},e.prototype._stopNow=function(){this._prod._stop(),this._err=c,this._stopID=c},e.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var n=this._ils;if(n.push(e),!(n.length>1))if(this._stopID!==c)clearTimeout(this._stopID),this._stopID=c;else{var r=this._prod;r!==c&&r._start(this)}},e.prototype._remove=function(e){var t=this,n=this._target;if(n)return n._remove(e);var r=this._ils,o=r.indexOf(e);o>-1&&(r.splice(o,1),this._prod!==c&&r.length<=0?(this._err=c,this._stopID=setTimeout((function(){return t._stopNow()}))):1===r.length&&this._pruneCycles())},e.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},e.prototype._hasNoSinks=function(e,t){if(-1!==t.indexOf(e))return!0;if(e.out===this)return!0;if(e.out&&e.out!==c)return this._hasNoSinks(e.out,t.concat(e));if(e._ils){for(var n=0,r=e._ils.length;n<r;n++)if(!this._hasNoSinks(e._ils[n],t.concat(e)))return!1;return!0}return!1},e.prototype.ctor=function(){return this instanceof M?M:e},e.prototype.addListener=function(e){e._n=e.next||l,e._e=e.error||l,e._c=e.complete||l,this._add(e)},e.prototype.removeListener=function(e){this._remove(e)},e.prototype.subscribe=function(e){return this.addListener(e),new d(this,e)},e.prototype[a]=function(){return this},e.create=function(t){if(t){if("function"!=typeof t.start||"function"!=typeof t.stop)throw new Error("producer requires both start and stop functions");f(t)}return new e(t)},e.createWithMemory=function(e){return e&&f(e),new M(e)},e.never=function(){return new e({_start:l,_stop:l})},e.empty=function(){return new e({_start:function(e){e._c()},_stop:l})},e.throw=function(t){return new e({_start:function(e){e._e(t)},_stop:l})},e.from=function(t){if("function"==typeof t[a])return e.fromObservable(t);if("function"==typeof t.then)return e.fromPromise(t);if(Array.isArray(t))return e.fromArray(t);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},e.of=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.fromArray(t)},e.fromArray=function(t){return new e(new O(t))},e.fromPromise=function(t){return new e(new w(t))},e.fromObservable=function(t){if(void 0!==t.endWhen)return t;var n="function"==typeof t[a]?t[a]():t;return new e(new b(n))},e.periodic=function(t){return new e(new j(t))},e.prototype._map=function(e){return new(this.ctor())(new I(e,this))},e.prototype.map=function(e){return this._map(e)},e.prototype.mapTo=function(e){var t=this.map((function(){return e}));return t._prod.type="mapTo",t},e.prototype.filter=function(t){var n,r,o=this._prod;return new e(o instanceof T?new T((n=o.f,r=t,function(e){return n(e)&&r(e)}),o.ins):new T(t,this))},e.prototype.take=function(e){return new(this.ctor())(new L(e,this))},e.prototype.drop=function(t){return new e(new x(t,this))},e.prototype.last=function(){return new e(new A(this))},e.prototype.startWith=function(e){return new M(new R(this,e))},e.prototype.endWhen=function(e){return new(this.ctor())(new S(e,this))},e.prototype.fold=function(e,t){return new M(new C(e,t,this))},e.prototype.replaceError=function(e){return new(this.ctor())(new D(e,this))},e.prototype.flatten=function(){return new e(new P(this))},e.prototype.compose=function(e){return e(this)},e.prototype.remember=function(){return new M(new N(this))},e.prototype.debug=function(e){return new(this.ctor())(new _(this,e))},e.prototype.imitate=function(e){if(e instanceof M)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=e;for(var t=this._ils,n=t.length,r=0;r<n;r++)e._add(t[r]);this._ils=[]},e.prototype.shamefullySendNext=function(e){this._n(e)},e.prototype.shamefullySendError=function(e){this._e(e)},e.prototype.shamefullySendComplete=function(){this._c()},e.prototype.setDebugListener=function(e){e?(this._d=!0,e._n=e.next||l,e._e=e.error||l,e._c=e.complete||l,this._dl=e):(this._d=!1,this._dl=c)},e.merge=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new e(new m(t))},e.combine=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new e(new v(t))},e}();t.Stream=U;var M=function(e){function t(t){var n=e.call(this,t)||this;return n._has=!1,n}return o(t,e),t.prototype._n=function(t){this._v=t,this._has=!0,e.prototype._n.call(this,t)},t.prototype._add=function(e){var t=this._target;if(t)return t._add(e);var n=this._ils;if(n.push(e),n.length>1)this._has&&e._n(this._v);else if(this._stopID!==c)this._has&&e._n(this._v),clearTimeout(this._stopID),this._stopID=c;else if(this._has)e._n(this._v);else{var r=this._prod;r!==c&&r._start(this)}},t.prototype._stopNow=function(){this._has=!1,e.prototype._stopNow.call(this)},t.prototype._x=function(){this._has=!1,e.prototype._x.call(this)},t.prototype.map=function(e){return this._map(e)},t.prototype.mapTo=function(t){return e.prototype.mapTo.call(this,t)},t.prototype.take=function(t){return e.prototype.take.call(this,t)},t.prototype.endWhen=function(t){return e.prototype.endWhen.call(this,t)},t.prototype.replaceError=function(t){return e.prototype.replaceError.call(this,t)},t.prototype.remember=function(){return this},t.prototype.debug=function(t){return e.prototype.debug.call(this,t)},t}(U);t.MemoryStream=M;var z=U;t.default=z},654:()=>{}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{API:()=>oh,AgentInfo:()=>Th,Chat:()=>Us,ChatFrame:()=>Eu,ComponentFilter:()=>Fl,Conversation:()=>ql,DeprecatedToggleButton:()=>Ph,DeprecatedView:()=>Lh,Engine:()=>Oh,EntryContainer:()=>bu,EventParticipant:()=>Ys,ExternalApi:()=>Sh,Header:()=>kh,Icon:()=>hi,Interrupt:()=>Ms,MessageContainer:()=>ta,SeamlyApiContext:()=>zn,SeamlyEventBusContext:()=>$n,SeamlyGeneralError:()=>Gr,SeamlyLiveRegionContext:()=>vo,SeamlyOfflineError:()=>Yr,StoreProvider:()=>U,Text:()=>bc,View:()=>Du,calculateVisibility:()=>Kt,className:()=>Mn,createReduxStore:()=>Y,default:()=>Uh,eventTypes:()=>ge,getUrlParams:()=>ce,getUrlSearchString:()=>le,randomId:()=>s,seamlyActions:()=>De,useChoicePrompt:()=>sa,useDispatch:()=>Vn,useEvents:()=>rn,useGeneratedId:()=>$r,useI18n:()=>fr,useSeamlyChat:()=>Co,useSeamlyCommands:()=>go,useSeamlyConfig:()=>ee,useSeamlyEventStream:()=>Bo,useSeamlyIdleDetachCountdown:()=>Mo,useSeamlyMessageContainerClassNames:()=>Gn,useSeamlyOptions:()=>Ar,useSeamlyVisibility:()=>so,useTranslatedEventData:()=>oi,useTranslations:()=>ri,useTranslationsContainer:()=>ii,visibilityStates:()=>T}),n(698);const e=require("preact");var t=n(679),o=n.n(t);const i=require("preact/hooks");function s(){return"_"+(Number(String(Math.random()).slice(2))+Date.now()+Math.round(performance.now())).toString(36)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const l="//";function u(e,t,n="/"){return(r,...o)=>t(e+n+r,...o)}function p(e,t=(e=>({payload:e}))){const n=(...n)=>function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:e},t(...n));return n.toString=()=>String(e),n.match=t=>(null==t?void 0:t.type)===String(e),n}function h(e,...t){const n=[];t.forEach((e=>{const t=typeof e;if("string"===t)return n.push([e]);"object"!==t||e instanceof Array||Object.keys(e).forEach((t=>n.push([t,e[t]])))}));const r=u(e,p,"/");return n.map((e=>r(...e)))}function f(e,t){const[n,r,o]=h(e,{pending:(e,t)=>({meta:{arg:e,requestId:t,status:"pending"}}),fulfilled:(e,t,n)=>({payload:t,meta:{arg:e,requestId:n,status:"fulfilled"}}),rejected:(e,t,n)=>({error:t,meta:{arg:e,requestId:n,status:"rejected",error:String(t)}})});return Object.assign((i=>(a,c,l)=>{const u=s(),p=(async()=>{let e;try{a(n(i,u));const o=t(i,{dispatch:a,getState:c,extra:l}),s=await o;e=r(i,s,u)}catch(t){e=o(i,t,u)}return a(e),e})();return Object.assign(p,{type:e,arg:i,requestId:u})}),{type:e,pending:n,fulfilled:r,rejected:o})}function d(e){return{createAction:u(e,p,l),createActions:u(e,h,l),createThunk:u(e,f,l),createReducer:(t,n)=>function(e,t={},n){const r=(e=n,r)=>{const o=null==t?void 0:t[null==r?void 0:r.type];return o?o(e,r):e};return r.toString=()=>e,r}(e,t,n),selectState:t=>t[e]}}const{createAction:y,createThunk:b,createReducer:m,selectState:g}=d("config"),v=y("initialize",(e=>({config:e}))),O=y("update",(e=>({config:e}))),w=y("setPreChatEvents",(e=>({events:e})));function j(e,t){return e===t}function _(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function x(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}var E=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=0,s=r.pop(),a=x(r),c=e.apply(void 0,[function(){return i++,s.apply(null,arguments)}].concat(n)),l=e((function(){for(var e=[],t=a.length,n=0;n<t;n++)e.push(a[n].apply(null,arguments));return c.apply(null,e)}));return l.resultFunc=s,l.dependencies=a,l.recomputations=function(){return i},l.resetRecomputations=function(){return i=0},l}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j,n=null,r=null;return function(){return _(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}));const S="visibility",T={hidden:"hidden",minimized:"minimized",open:"open",initialize:null};function k(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 P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?k(Object(n),!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const A=E(g,(e=>{let t=P({visible:"inline"===(null==e?void 0:e.layoutMode)?T.open:T.minimized,appContainerClassNames:e.appContainerClassNames||[]},e);return"function"==typeof t.appContainerClassNames&&(t=P(P({},t),{},{appContainerClassNames:t.appContainerClassNames(t)})),t})),I=(0,e.createContext)(void 0),N=I,{Provider:D,Consumer:R}=I,L=require("preact/jsx-runtime");function U({store:e,children:t}){return(0,L.jsx)(D,{value:e,children:t})}function M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(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 $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){M(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function B(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 F="function"==typeof Symbol&&Symbol.observable||"@@observable",H=function(){return Math.random().toString(36).substring(7).split("").join(".")},q={INIT:"@@redux/INIT"+H(),REPLACE:"@@redux/REPLACE"+H(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+H()}};function V(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function W(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(B(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(B(1));return n(W)(e,t)}if("function"!=typeof e)throw new Error(B(2));var o=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(B(3));return i}function p(e){if("function"!=typeof e)throw new Error(B(4));if(c)throw new Error(B(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(B(6));t=!1,l();var n=a.indexOf(e);a.splice(n,1),s=null}}}function h(e){if(!V(e))throw new Error(B(7));if(void 0===e.type)throw new Error(B(8));if(c)throw new Error(B(9));try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(B(10));o=e,h({type:q.REPLACE})}function d(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(B(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[F]=function(){return this},e}return h({type:q.INIT}),(r={dispatch:h,subscribe:p,getState:u,replaceReducer:f})[F]=d,r}function G(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}let K=G;function Y({reducers:e={},initialState:t={},middlewares:n=[]}={}){return W(function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,s=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:q.INIT}))throw new Error(B(12));if(void 0===n(void 0,{type:q.PROBE_UNKNOWN_ACTION()}))throw new Error(B(13))}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},a=0;a<s.length;a++){var c=s[a],l=n[c],u=e[c],p=l(u,t);if(void 0===p)throw t&&t.type,new Error(B(14));o[c]=p,r=r||p!==u}return(r=r||s.length!==Object.keys(e).length)?o:e}}(e),t,K(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(B(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return r=G.apply(void 0,i)(n.dispatch),$($({},n),{},{dispatch:r})}}}(...n)))}function J(){return(0,i.useContext)(N)}function Q(){return J().dispatch}function Z(e,t=[]){const n=J(),[,r]=(0,i.useReducer)((e=>e+1),0),o=(0,i.useRef)(),s=(0,i.useCallback)(e,t),a=(0,i.useRef)(),c=(0,i.useRef)(),l=n.getState();return a.current===s&&c.current===l||(c.current=l,o.current=s(c.current),a.current=s),(0,i.useLayoutEffect)((()=>n.subscribe((()=>{var e;if(n.getState()===c.current)return;const t=null===(e=a.current)||void 0===e?void 0:e.call(a,n.getState());t!==o.current&&(o.current=t,r())}))),[n]),o.current}const X=function(e,t,n=[]){return Z((0,i.useCallback)((n=>e(n,t)),n),n)};function ee(){return Z(A)}function te(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 ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){re(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function re(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const oe=(e,t)=>{let n;return function(...r){const o=this;let i=!1;return clearTimeout(n),n=setTimeout((()=>{n=null,i||e.apply(o,r),i=!1}),t),t=>{i=!0,t&&e.apply(o,r)}}},ie=e=>Math.ceil(e/1e3),se=e=>{const t=Math.floor(e/60);return{minutes:t,seconds:e-60*t}},ae=(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/Math.pow(1024,r)).toFixed(n))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]},ce=()=>{const{search:e}=window.location;return e?e.slice(e.indexOf("?")+1).split("&").reduce(((e,t)=>{const[n,r]=t.split("=");return ne(ne({},e),{},{[n]:decodeURIComponent(r)})}),{}):{}},le=e=>Object.keys(e).reduce(((t,n)=>`${t}${t?"&":""}${n}=${encodeURIComponent(e[n])}`),""),ue={27:"Escape",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown"},pe={Escape:"Escape",End:"End",Home:"Home",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown"},he=e=>e.code?pe[e.code]:ue[e.keyCode],fe=e=>{e&&e.focus()},de=(e,t)=>{e&&(e.contains(document.activeElement)||e===document.activeElement)&&t()};function ye(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 be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ge={info:"info",message:"message",participant:"participant",system:"system"},ve="text",Oe="text",we="upload",je="received",_e="read",xe="custom",Ee="typing",Se="read",Te="detach_service",ke="set_translation",Pe="click_cta",Ce="assertive",Ae="polite",Ie={new_topic:"newTopic",new_translation:"newTranslation"},Ne="uploads",De={ADD_EVENT:"ADD_EVENT",CLEAR_EVENTS:"CLEAR_EVENTS",SET_HISTORY:"SET_HISTORY",SET_EVENTS_READ:"SET_EVENTS_READ",ACK_EVENT:"ACK_EVENT",SET_IS_LOADING:"SET_IS_LOADING",CLEAR_PARTICIPANTS:"CLEAR_PARTICIPANTS",SET_PARTICIPANT:"SET_PARTICIPANT",SET_HEADER_TITLE:"SET_HEADER_TITLE",SET_HEADER_SUB_TITLE:"SET_HEADER_SUB_TITLE",RESET_HISTORY_LOADED_FLAG:"RESET_HISTORY_LOADED_FLAG",SET_ACTIVE_SERVICE:"SET_ACTIVE_SERVICE",INIT_IDLE_DETACH_COUNTDOWN:"INIT_IDLE_DETACH_COUNTDOWN",DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:"DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER",STOP_IDLE_DETACH_COUNTDOWN_COUNTER:"STOP_IDLE_DETACH_COUNTDOWN_COUNTER",CLEAR_IDLE_DETACH_COUNTDOWN:"CLEAR_IDLE_DETACH_COUNTDOWN",INIT_RESUME_CONVERSATION_PROMPT:"INIT_RESUME_CONVERSATION_PROMPT",CLEAR_RESUME_CONVERSATION_PROMPT:"CLEAR_RESUME_CONVERSATION_PROMPT",SET_SERVICE_DATA_ITEM:"SET_SERVICE_DATA_ITEM",SET_FEATURES:"SET_FEATURES",SET_FEATURE_ENABLED_STATE:"SET_FEATURE_ENABLED_STATE",CLEAR_FEATURES:"CLEAR_FEATURES",SET_INITIAL_STATE:"SET_INITIAL_STATE",SET_USER_SELECTED_OPTIONS:"SET_USER_SELECTED_OPTIONS",SET_USER_SELECTED_OPTION:"SET_USER_SELECTED_OPTION",SHOW_OPTION:"SHOW_OPTION",HIDE_OPTION:"HIDE_OPTION",SET_SERVICE_ENTRY_METADATA:"SET_SERVICE_ENTRY_METADATA",SET_BLOCK_AUTO_ENTRY_SWITCH:"SET_BLOCK_AUTO_ENTRY_SWITCH",SET_ACTIVE_ENTRY_TYPE:"SET_ACTIVE_ENTRY_TYPE",SET_USER_ENTRY_TYPE:"SET_USER_ENTRY_TYPE",REGISTER_UPLOAD:"REGISTER_UPLOAD",SET_UPLOAD_PROGRESS:"SET_UPLOAD_PROGRESS",SET_UPLOAD_COMPLETE:"SET_UPLOAD_COMPLETE",SET_UPLOAD_ERROR:"SET_UPLOAD_ERROR",CLEAR_UPLOAD:"CLEAR_UPLOAD",CLEAR_ALL_UPLOADS:"CLEAR_ALL_UPLOADS",SET_SEAMLY_CONTAINER_ELEMENT:"SET_SEAMLY_CONTAINER_ELEMENT"},Re="navigate",{ADD_EVENT:Le,CLEAR_EVENTS:Ue,SET_HISTORY:Me,SET_EVENTS_READ:ze,ACK_EVENT:$e,SET_IS_LOADING:Be,CLEAR_PARTICIPANTS:Fe,SET_PARTICIPANT:He,SET_HEADER_TITLE:qe,SET_HEADER_SUB_TITLE:Ve,RESET_HISTORY_LOADED_FLAG:We,SET_ACTIVE_SERVICE:Ge,INIT_IDLE_DETACH_COUNTDOWN:Ke,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:Ye,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:Je,CLEAR_IDLE_DETACH_COUNTDOWN:Qe,INIT_RESUME_CONVERSATION_PROMPT:Ze,CLEAR_RESUME_CONVERSATION_PROMPT:Xe,SET_SERVICE_DATA_ITEM:et,SET_FEATURES:tt,SET_FEATURE_ENABLED_STATE:nt,CLEAR_FEATURES:rt,SET_INITIAL_STATE:ot,SET_USER_SELECTED_OPTION:it,SET_USER_SELECTED_OPTIONS:st,SHOW_OPTION:at,HIDE_OPTION:ct,SET_BLOCK_AUTO_ENTRY_SWITCH:lt,SET_USER_ENTRY_TYPE:ut,SET_ACTIVE_ENTRY_TYPE:pt,SET_SERVICE_ENTRY_METADATA:ht,REGISTER_UPLOAD:ft,SET_UPLOAD_PROGRESS:dt,SET_UPLOAD_COMPLETE:yt,SET_UPLOAD_ERROR:bt,CLEAR_UPLOAD:mt,CLEAR_ALL_UPLOADS:gt,SET_SEAMLY_CONTAINER_ELEMENT:vt}=De,Ot=({type:e,payload:t})=>e===ge.message&&!t.fromClient||e===ge.info&&t.type===ve,wt=e=>e.sort((({payload:{occurredAt:e}},{payload:{occurredAt:t}})=>e-t)),jt=(e,t)=>{switch(t.type){case Fe:return{participants:{},currentAgent:""};case He:const{participants:n}=e,{id:r,avatar:o,name:i,introduction:s}=t.participant,a=n[r],c=be(be({},n),{},{[r]:a?be(be(be(be({},a),o?{avatar:o}:{}),i?{name:i}:{}),s?{introduction:s}:{}):t.participant});return be(be({},e),{},{participants:c,currentAgent:e.currentAgent===r||t.fromClient?e.currentAgent:r});default:return e}},_t=(e,t)=>{switch(t.type){case qe:return be(be({},e),{},{title:t.title});case Ve:return be(be({},e),{},{subTitle:t.title});default:return e}},xt=(e,t)=>{const{entry:n}=t,{blockAutoEntrySwitch:r}=e;if(!n)return be(be({},e),{},{optionsOverride:{}});const{type:o,options:i}=n;let s=e.active;return r||o===e.userSelected||(s=o),be(be({},e),{},{active:s,optionsOverride:be(be({},e.optionsOverride),{},{[o]:i||{}})})},Et="cvco",St="2",Tt="seamly-client-participant",{createAction:kt,createThunk:Pt,createReducer:Ct,selectState:At}=d("i18n"),It=E(At,(e=>e.translations)),Nt=E(At,(e=>e.initialLocale)),Dt=E(At,(e=>e.locale)),Rt=kt("setInitialLocale",(e=>({locale:e}))),Lt=function(){let e=!1;const t=[],n=async()=>{if(!e)for(;t.length;){const n=t.shift();e=!0,await n().catch((()=>{})),e=!1}};return{next:n,runExclusively:async e=>{const r=new Promise(((n,r)=>{t.push((async()=>{try{n(await e())}catch(e){r(e)}}))}));return n(),r}}}(),Ut=Pt("setLocale",(async(e,{getState:t,extra:{api:n}})=>Lt.runExclusively((()=>{if(e!==Dt(t()))return n.getTranslations(e)})))),{createAction:Mt,createThunk:zt,createReducer:$t,selectState:Bt}=d("app"),Ft=E(Bt,(e=>e.userHasResponded)),{createAction:Ht,createActions:qt,createThunk:Vt,createReducer:Wt,selectState:Gt}=d("visibility"),Kt=({hasResponded:e,previousVisibility:t,requestedVisibility:n,config:r})=>{const{defaults:o,layoutMode:i,hideOnNoUserResponse:s}=r,{visible:a}=o||{};if("window"===i&&s&&n!==T.open)return e?n||t||T.open:T.hidden;const c=T.minimized;return n||t||a||c},Yt=E(Gt,(e=>e.visibility));function Jt(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 Qt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Xt=e=>e.state,en=()=>Z(Xt),tn=E(Xt,A,Ft,(({events:e,serviceData:t},n,r)=>{var o;if(r||"inline"===n.layoutMode||!t.suggestion||null===(o=t.suggestion)||void 0===o||!o.body.length)return e;const i={type:"service_data",payload:t.suggestion};return[...e,i]})),nn=E(tn,A,((e,t)=>{var n;const{enabled:r,threshold:o}=(null==t||null===(n=t.messages)||void 0===n?void 0:n.timeIndicator)??{};if(!r)return e;const i=[];let s=null;return e.forEach(((e,t)=>{if(0===t)i.push(Qt(Qt({},e),{},{timeIndicator:e.payload.occurredAt}));else{const t=s&&ie(e.payload.occurredAt-s.payload.occurredAt)>=o?e.payload.occurredAt:void 0;i.push(Qt(Qt({},e),{},{timeIndicator:t}))}s=e})),i})),rn=()=>Z(nn,[]),on=()=>en().headerTitles,sn=()=>en().unreadEvents,an=()=>en().skiplinkTargetId,cn=E(nn,(e=>{var t;const n=e.filter((e=>"message"===e.type));return null===(t=n[n.length-1])||void 0===t?void 0:t.payload.id})),ln=()=>{const{participants:e,currentAgent:t}=en().participantInfo;return t?e[t]:null},un=e=>en().serviceData[e],pn=()=>{const{layoutMode:e}=ee();return{isInline:"inline"===e,isWindow:"window"===e,isResolving:!e}};function hn(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 fn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hn(Object(n),!0).forEach((function(t){dn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function dn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yn=Ht("setFromStorage",(e=>({visibility:e}))),bn=[T.open,T.minimized,T.hidden],mn=Vt("set",((e,{getState:t,extra:{api:n,eventBus:r}})=>{const o=t(),i=Yt(o),s=Ft(o),a=n.hasConversation(),c=A(o),{visibilityCallback:l=Kt,layoutMode:u}=c,{unreadEvents:p}=Xt(o),h=l({hasConversation:a,hasResponded:s,previousVisibility:i,requestedVisibility:e,config:c});if(bn.includes(h)){if(i!==h)return n.store.set(S,fn(fn({},n.store.get(S)||{}),{},{[u]:e})),e&&r.emit("ui.visible",e,{visibility:e,hasConversation:a,hasResponded:s,unreadMessageCount:p}),h}else console.error('The visibilityCallback function should return "open", "minimized" or "hidden".')})),gn=Vt("initialize",(async(e,{dispatch:t,getState:n,extra:{api:r}})=>{var o;const{layoutMode:i}=A(n()),s=null===(o=r.store.get(S))||void 0===o?void 0:o[i];s&&t(yn(s)),t(mn(T.initialize))}));class vn extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,vn),this.name="SeamlyUnavailableError",this.langKey="errors.seamlyUnavailable"}}class On extends Error{constructor(e,...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Object.getPrototypeOf(this)),this.originalError=e,null!=e&&e.payload&&(this.originalEvent=e,this.originalError=e.payload.error),null!=e&&e.error&&(this.originalError=e.error)}}class wn extends On{constructor(e,...t){super(e,...t),this.name="SeamlySessionExpiredError",this.action="reset"}}const{createAction:jn,createReducer:_n,selectState:xn}=d("interrupt"),En=jn("set",(e=>({error:e}))),Sn=jn("clear"),Tn=Mt("setHasResponded",(e=>({hasResponded:e}))),kn=zt("initialize",(async(e,{dispatch:t,extra:{api:n,config:r}})=>{var o;t(v(r));let i=null==r||null===(o=r.context)||void 0===o?void 0:o.locale;try{const{features:e,defaultLocale:r,preChat:o}=await n.getConfig();t({type:De.SET_FEATURES,features:e}),i=i||r,t(Rt(i)),t(w(o.map((e=>({type:"message",payload:e})))))}catch(e){throw new vn}try{if(n.hasConversation()){var s;const e=await n.getConversationIntitialState();t({type:De.SET_INITIAL_STATE,initialState:e}),i=(null===(s=e.translation)||void 0===s?void 0:s.locale)||i,"userResponded"in e&&t(Tn(e.userResponded))}}catch(e){if(e instanceof wn)throw e;throw new vn}finally{await t(Ut(i)),t(gn())}})),Pn=zt("reset",(async(e,{dispatch:t,extra:{api:n}})=>{try{await n.disconnect(),await n.clearStore(),t(kn())}catch(e){t(En(e))}})),Cn=["messages"];function An(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 In(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach((function(t){Nn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dn=In(In({},{namespace:"default",layoutMode:"window",messages:{agent:{showAvatar:!1,showName:!1},user:{showAvatar:!1,showName:!1},timeIndicator:{enabled:!1,threshold:36e5}}}),{},{hideOnNoUserResponse:!1,showDisclaimer:!1,showFaq:!1,customComponents:{},defaults:{},preChatEvents:[]}),Rn=["hideOnNoUserResponse","showDisclaimer","showFaq","namespace","customComponents","defaults","layoutMode","api","zIndex","context","appContainerClassNames","messages","visible","visibilityCallback","errorCallback"],Ln=(e,{config:t})=>{const n=(i=t,Rn.reduce(((e,t)=>(t in i&&(e[t]=i[t]),e)),{})),{messages:r}=n,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,Cn);var i;let s=e;return Object.keys(o).length>0&&(s=In(In({},s),o)),r&&(s=In(In({},s),{},{messages:In(In({},s.messages),r)})),s},Un=m({[v]:(e,t)=>Ln(e,t),[O]:(e,t)=>Ln(e,t),[kn.pending]:()=>Dn,[w]:(e,{events:t})=>In(In({},e),{},{preChatEvents:t})},Dn),Mn=(...e)=>e.flat().map((e=>"object"==typeof e?Object.entries(e).map((([e,t])=>t?e:"")).join(" "):e)).filter((e=>"string"==typeof e)).map((e=>e.split(" "))).flat().filter((e=>e.length)).map((e=>e.indexOf(Et)>-1?e:[Et,e].join("-"))).join(" "),zn=(0,e.createContext)(null),$n=(0,e.createContext)(""),Bn=()=>(0,i.useContext)(zn),Fn=()=>Bn().store||{},Hn=()=>{const{get:e}=Fn();return e?e("conversationUrl"):null},qn=()=>!!Hn(),Vn=Q,Wn=()=>ee().appContainerClassNames,Gn=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};function Kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Yn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Kn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xn(e){return e.reduce((function(e,t){return e.concat(Array.isArray(t)?Xn(t):t)}),[])}function er(e){var t={};return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=r.length?r.map((function(e){return null===e?"null":void 0===e?"undefined":"function"==typeof e?e.toString():e instanceof Date?e.toISOString():JSON.stringify(e)})).join("|"):"_(no-args)_";if(Object.prototype.hasOwnProperty.call(t,i))return t[i];var s=e.apply(void 0,r);return t[i]=s,s}}function tr(e){for(var t=function(e){return/\s/.test(e)},n=[],r={},o=0,i=null,s=!1,a=0;a<e.length;){if(s&&(t(e[a])||"{"===e[a]))s=!1,i=e.slice(o,a),"{"===e[a]&&a--;else if(!s&&!t(e[a])){var c="{"===e[a];if(i&&c){var l=nr(e,a);if(-1===l)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));r[i]=e.slice(a+1,l),a=l,i=null}else i&&(n.push(i),i=null),s=!0,o=a}a++}return s&&(i=e.slice(o)),i&&n.push(i),{args:n,cases:r}}function nr(e,t){for(var n=0,r=t+1;r<e.length;r++){var o=e.charAt(r);if("}"===o){if(0===n)return r;n--}else"{"===o&&n++}return-1}function rr(e){return or(e.slice(1,-1),",",3)}function or(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!e)return r;if(1===n)return r.push(e),r;var o=e.indexOf(t);if(-1===o)return r.push(e),r;var i=e.substring(0,o).trim(),s=e.substring(o+t.length+1).trim();return r.push(i),or(s,t,n-1,r)}var ir;function sr(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 ar(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sr(Object(n),!0).forEach((function(t){Zn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var cr=0,lr="other";function ur(e,t){for(var n=0,r="",o=0,i={};n<e.length;){if("#"!==e[n]||o)r+=e[n];else{var s="__hashToken".concat(cr++);r+="{".concat(s,", number}"),i[s]=t}"{"===e[n]?o++:"}"===e[n]&&o--,n++}return{caseBody:r,numberValues:i}}var pr="other";const hr=new(function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Jn(this,e),Zn(this,"format",er((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Xn(n.process(e,t)).join("")}))),this.locale=t,this.typeHandlers=r}var t,n;return t=e,(n=[{key:"process",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return[];var n=e.indexOf("{");if(-1!==n){var r=nr(e,n);if(-1===r)throw new Error('Unbalanced curly braces in string: "'.concat(e,'"'));var o=e.substring(n,r+1);if(o){var i=[],s=e.substring(0,n);s&&i.push(s);var a=rr(o),c=Yn(a,3),l=c[0],u=c[1],p=c[2],h=t[l];null==h&&(h="");var f=u&&this.typeHandlers[u];i.push(f?f(h,p,this.locale,t,this.process.bind(this)):h);var d=e.substring(r+1);return d&&i.push(this.process(d,t)),i}}return[e]}}])&&Qn(t.prototype,n),e}())("en-GB",{plural:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=tr(t),s=i.args,a=i.cases,c=parseInt(e);s.forEach((function(e){e.startsWith("offset:")&&(c-=parseInt(e.slice("offset:".length)))}));var l=[];if("PluralRules"in Intl){void 0!==ir&&ir.resolvedOptions().locale===n||(ir=new Intl.PluralRules(n));var u=ir.select(c);u!==lr&&l.push(u)}1===c&&l.push("one"),l.push("=".concat(c),lr);for(var p=0;p<l.length;p++){var h=l[p];if(h in a){var f=ur(a[h],c),d=f.caseBody,y=f.numberValues;return o(d,ar(ar({},r),y))}}return e},select:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,o=tr(t),i=o.cases;return e in i?r(i[e],n):pr in i?r(i.other,n):e}});function fr(){const e=Z(It),t=Z(Dt),n=Z(Nt);return{t:(0,i.useCallback)(((n,r={})=>{const o=e[n];return o?hr.format(o,r):(console.warn(`Translation key: ${n} is missing in locale: ${t}`),null)}),[e,t]),locale:t,initialLocale:n}}function dr(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 yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dr(Object(n),!0).forEach((function(t){br(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function br(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const mr={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},gr=Ct({[Rt]:(e,{locale:t})=>yr(yr({},e),{},{initialLocale:t}),[Ut.pending]:e=>yr(yr({},e),{},{isLoading:!0}),[Ut.fulfilled]:(e,{payload:t,meta:{arg:n}})=>yr(yr({},e),{},t?{isLoading:!1,locale:n,translations:Object.keys(t).sort().reduce(((e,n)=>yr(yr({},e),{},{[n]:t[n]})),{})}:{isLoading:!1}),[Ut.rejected]:e=>yr(yr({},e),{},{isLoading:!1}),[kn.pending]:()=>mr},mr),{SET_SEAMLY_CONTAINER_ELEMENT:vr}=De,Or=e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{const t="string"==typeof e?document.getElementById(e):e;fe(t)}))}))},wr=()=>{const{seamlyContainerElement:e}=en(),t=Vn();return[e,(0,i.useCallback)((e=>{t({type:vr,element:e})}),[t])]},jr=e=>(0,i.useCallback)((()=>{Or(e)}),[e]),_r=()=>{const e=an();return jr(e)};function xr(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 Er(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xr(Object(n),!0).forEach((function(t){Sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{SET_USER_SELECTED_OPTION:Tr,SET_USER_SELECTED_OPTIONS:kr,SHOW_OPTION:Pr,HIDE_OPTION:Cr}=De,Ar=()=>{const{t:e}=fr(),{options:t}=en(),{panelActive:n,optionActive:r,userSelectedOptions:o,features:s}=t,{cobrowsing:a,sendTranscript:c}=s,l={cobrowsing:a,sendTranscript:c},u=Object.keys(l).filter((e=>l[e])).map((t=>({name:t,title:e(`options.${t}.menuTitle`),available:l[t].enabled}))),p=a||c,h=Vn(),{get:f,set:d}=Fn();return{allowOptionSelection:p,userSelectedOptions:o,features:s,menuOptions:u,initUserSelectedOptions:(0,i.useCallback)((()=>{const e=f("options")||{};h({type:kr,options:e})}),[f,h]),setUserSelectedOptions:(0,i.useCallback)((e=>{h({type:kr,options:e}),d("options",e)}),[d,h]),setUserSelectedOption:(0,i.useCallback)(((e,t)=>{const n=f("options")||{};d("options",Er(Er({},n),{},{[e]:t})),h({type:Tr,option:e,value:t})}),[h,f,d]),showOption:e=>{h({type:Pr,optionName:e})},hideOption:()=>{h({type:Cr})},panelActive:n,optionActive:r}},Ir=()=>{const{optionsButtonId:e}=en();return{id:e,focusButton:jr(e)}},Nr=(0,e.createContext)({});function Dr(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 Rr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dr(Object(n),!0).forEach((function(t){Lr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{CLEAR_ALL_UPLOADS:Ur}=De,Mr=()=>{const{showFileUpload:e,entryMeta:{options:t,optionsOverride:n},options:{features:{uploads:r}}}=en(),{allowedMimeTypes:o,maxSize:i}=n.upload||{},{enabled:s,enabledFromEntry:a}=r||{},{allowedMimeTypes:c,maxSize:l}=Rr(Rr(Rr({},t.upload||{allowedMimeTypes:[],maxSize:0}),o?{allowedMimeTypes:o}:{}),i?{maxSize:i}:{});return{showFileUpload:e,accountAllowsUploads:!!r,serviceAllowsUploads:a||s,allowedMimeTypes:c,maxSize:l}},zr=()=>{const{currentUploads:e}=en(),t=Vn(),n=(0,i.useContext)(Nr);return{uploadFile:(0,i.useCallback)((e=>{n(e)}),[n]),clearUploads:(0,i.useCallback)((()=>{t({type:Ur})}),[t]),currentUploads:e,isUploading:e.some((e=>e.uploading)),isComplete:e.every((e=>e.complete))}},$r=()=>{const[e]=(0,i.useState)((()=>s()));return e},Br=e=>{const t=(0,i.useRef)();t.current=e;const n="function"==typeof e;return(0,i.useMemo)((()=>n?(...e)=>t.current(...e):void 0),[n])},Fr=E(xn,(({error:e})=>e));function Hr(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 qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hr(Object(n),!0).forEach((function(t){Vr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wr(){const{t:e}=fr(),t=Z(Fr);return{hasInterrupt:Boolean(t),meta:(0,i.useMemo)((()=>{if(!t)return{};const{langKey:n,action:r}=t,o=e(`${n}.title`),i=e(`${n}.message`),s=e(`${n}.srText`),a=e(`${n}.buttonText`);return qr(qr(qr(qr({},n?{title:o,message:i,srText:s}:{}),r?{action:r}:{}),r&&n?{buttonText:a}:{}),{},{originalError:t})}),[e,t]),error:t}}class Gr extends On{constructor(e,...t){super(e,...t),this.name="SeamlyGeneralError",this.langKey="errors.general",this.action="reset"}}class Kr extends On{constructor(e,...t){super(e,...t),this.name="SeamlyConfigurationError",this.langKey="errors.configError"}}class Yr extends On{constructor(e,...t){super(e,...t),this.name="SeamlyOfflineError",this.langKey="errors.seamlyOffline"}}class Jr extends On{constructor(e,...t){super(e,...t),this.name="SeamlyUnauthorizedError",this.langKey="errors.general",this.action="reset"}}const Qr=[Gr,Kr,wn,Yr,Jr,vn];function Zr({api:e}){return()=>t=>n=>{const{error:r}=n;if(r){if(!Qr.some((e=>r instanceof e)))throw r;"reset"===r.action&&e.disconnect().then((()=>{e.clearStore()}))}return t(n)}}function Xr(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 eo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xr(Object(n),!0).forEach((function(t){to(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function to(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const no={error:void 0},ro=(e,{error:t})=>eo(eo({},e),{},{error:t}),oo=_n({[En]:ro,[kn.rejected]:ro,[Sn]:()=>no,[kn.pending]:()=>no},no);function io(){return Z(Ft)}const so=()=>{const e=Q(),t=Z(Yt);return{isVisible:!!t&&t!==T.hidden,isOpen:t===T.open,isMinimized:t===T.minimized,visible:t,setVisibility:(0,i.useCallback)((t=>e(mn(t))),[e])}};function ao(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 co(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ao(Object(n),!0).forEach((function(t){lo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ao(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uo={visibility:T.initialize},po=Wt({[yn]:(e,{visibility:t})=>co(co({},e),{},{visibility:t}),[mn.fulfilled]:(e,{payload:t})=>t?co(co({},e),{},{visibility:t}):e},uo);function ho(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 fo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ho(Object(n),!0).forEach((function(t){yo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ho(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{ADD_EVENT:bo,SET_INITIAL_STATE:mo}=De,go=()=>{const e=Bn(),t=ee(),n=Vn(),r=(0,i.useContext)($n),o=io(),a=qn(),{visible:c}=so(),l=sn(),u=(0,i.useCallback)(((...e)=>{r.emit(...e)}),[r]),p=Br((()=>{e.sendContext(t.context||{}),u("ui.beforeStart",{visibility:c,hasConversation:a,hasResponded:o,unreadMessageCount:l}),e.send("start"),u("ui.start",{visibility:c,hasConversation:a,hasResponded:o,unreadMessageCount:l})})),h=(0,i.useCallback)((async()=>{n(Pn())}),[n]),f=(0,i.useCallback)((e=>({type:e,id:s(),transactionId:s(),participant:Tt,fromClient:!0,occurredAt:1e3*Date.now(),meta:{}})),[]),d=(0,i.useCallback)((e=>fo(fo({},f("text")),{},{body:{text:e}})),[f]),y=(0,i.useCallback)((({body:t,config:r={}})=>{if(""===t.trim())return;const o=fo(fo({},d(t)),r);e.send("message",o),u("message",o),n({type:bo,event:{type:"message",payload:o}})}),[e,n,u,d]),b=(0,i.useCallback)((e=>{n({type:bo,event:{type:"message",payload:d(e)}})}),[n,d]),m=(0,i.useCallback)(((e,t,r,o,i,s,a)=>{n({type:bo,event:{type:"message",payload:{type:"upload",id:e,transactionId:t,participant:Tt,fromClient:!0,occurredAt:r,meta:{},body:{contentType:o,filename:i,filesize:s,url:a}}}})}),[n]),g=(0,i.useCallback)((e=>{const t={body:{subtype:e,type:"divider"},fromClient:!1,fromHistory:!0,id:s(),transactionId:s(),type:"divider"};n({type:bo,event:{type:"info",payload:t}})}),[n]),v=(0,i.useCallback)((({type:t,subtype:n})=>{const r={type:t,subtype:n,id:s(),transactionId:s(),participant:Tt,fromClient:!0};e.send("info",r)}),[e]),O=(0,i.useCallback)((t=>{if(!t)return;e.send("action",t);const{type:n}=t;n!==Ee&&n!==Se&&u(`action.${n}`,t)}),[e,u]),w=(0,i.useCallback)((t=>{e.sendContext(t)}),[e]);return{connect:(0,i.useCallback)((()=>e.connected?Promise.reject(new Error("The API is already connected")):e.connect().then((e=>{e&&n({type:mo,initialState:e})})).catch((e=>{n(En(e))}))),[e,n]),start:p,sendMessage:y,sendInfo:v,sendAction:O,sendContext:w,reset:h,emitEvent:u,addMessageBubble:b,addUploadBubble:m,addDivider:g,apiConfigReady:e.configReady}},vo=(0,e.createContext)(null),Oo=()=>{const e=(0,i.useContext)(vo);return{sendPolite:(0,i.useCallback)((t=>{e({ariaLive:Ae,messageText:t})}),[e]),sendAssertive:(0,i.useCallback)((t=>{e({ariaLive:Ce,messageText:t})}),[e])}},wo=(0,e.createContext)(null),jo=()=>(0,i.useContext)(wo);function _o(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 xo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{SET_BLOCK_AUTO_ENTRY_SWITCH:Eo,SET_ACTIVE_ENTRY_TYPE:So,SET_USER_ENTRY_TYPE:To}=De,ko=()=>{const{default:e,active:t,userSelected:n,options:r}=en().entryMeta,o=Vn(),s=n||t||e,a=r[s]||{},c=(0,i.useCallback)((e=>{o({type:Eo,value:e})}),[o]),l=(0,i.useCallback)((e=>{o({type:So,entryType:e})}),[o]),u=(0,i.useCallback)((e=>{o({type:To,entryType:e})}),[o]),p=(0,i.useCallback)((()=>{n?u(null):l(e)}),[n,e,u,l]);return{activeEntry:s,activeEntryOptions:a,setActiveEntryType:l,setUserEntryType:u,cancelEntrySelection:p,setBlockAutoEntrySwitch:c}},{SET_IS_LOADING:Po}=De,Co=()=>{const{t:e}=fr(),{layoutMode:t}=ee(),{isOpen:n,isVisible:r,setVisibility:o}=so(),s=Vn(),a=rn(),c=(0,i.useRef)(null),{start:l,connect:u,apiConfigReady:p}=go(),h=qn(),f=(0,i.useRef)(null),d=(0,i.useRef)(null),{sendAssertive:y}=Oo(),b=(0,i.useRef)(!1),m=a.length>0;return(0,i.useEffect)((()=>{r&&setTimeout((()=>{y(e("window.srTexts.onLoad"))}),500)}),[r,y,e]),(0,i.useEffect)((()=>{if(r!==d.current)return f.current=n,void(d.current=r);null!==f.current&&y(e(n?"window.srTexts.onOpen":"window.srTexts.onClose")),f.current=n,d.current=r}),[n,r,y,e]),(0,i.useEffect)((()=>{c.current=setTimeout((()=>{s({type:Po,isLoading:!0})}),500)}),[s]),(0,i.useEffect)((()=>{m&&(clearTimeout(c.current),s({type:Po,isLoading:!1}))}),[m,s]),(0,i.useEffect)((()=>{h&&p||(b.current=!1)}),[h,p]),(0,i.useEffect)((()=>{("window"!==t||n||h)&&!b.current&&p&&(h&&(clearTimeout(c.current),s({type:Po,isLoading:!1})),u().then((()=>{l()})),b.current=!0)}),[n,h,p,l,u,s,t]),{openChat:()=>{o(T.open)},closeChat:()=>{o(T.minimized)}}};function Ao(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 Io(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ao(Object(n),!0).forEach((function(t){No(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ao(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function No(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{CLEAR_IDLE_DETACH_COUNTDOWN:Do,INIT_IDLE_DETACH_COUNTDOWN:Ro,DECREMENT_IDLE_DETACH_COUNTDOWN_COUNTER:Lo,STOP_IDLE_DETACH_COUNTDOWN_COUNTER:Uo}=De,Mo=()=>{const e=Vn(),{idleDetachCountdown:t}=en(),{isOpen:n}=so(),r=(0,i.useRef)({});r.current={hasCountdown:t.hasCountdown,isActive:t.isActive,remaining:t.remaining,wasStopped:t.wasStopped,isOpen:n};const{emitEvent:o,sendAction:s}=go(),{t:a}=fr(),{sendAssertive:c,sendPolite:l}=Oo(),u=(0,i.useCallback)((e=>{const{isOpen:t}=r.current;t&&c(e)}),[c]),p=(0,i.useCallback)((e=>{const{isOpen:t}=r.current;t&&l(e)}),[l]),h=(0,i.useCallback)((t=>{const n=(e=>Math.ceil(e/1e3))(t),r=se(n);e({type:Ro,delaySeconds:n,delayTime:r}),o("idleTimer.start"),u(`${a("idleDetachWarning.countdownTitle")} ${a("idleDetachWarning.countdownText")} ${a("idleDetachWarning.countdownTimer",r)}`)}),[e,o,u,a]),f=(0,i.useCallback)(((t,n)=>{const{hasCountdown:i,wasStopped:c}=r.current;i&&(t||(n||s({type:Te}),u(a("idleDetachWarning.notifyTransferText"))),c||o("idleTimer.stop"),e({type:Do}))}),[e,s,o,u,a]),d=(0,i.useCallback)((()=>{const{remaining:t}=r.current;if(t<=0)return;const n=t-1;n%10==0&&u(`${a("idleDetachWarning.countdownText")} ${a("idleDetachWarning.countdownTimer",se(n))}`),e({type:Lo})}),[e,u,a]),y=(0,i.useCallback)((()=>{const{isActive:t,remaining:n}=r.current;t&&(e({type:Uo}),n&&(o("idleTimer.stop"),p(a("idleDetachWarning.srCountDownStoppedText"))))}),[e,o,p,a]);return Io(Io({},t),{},{initCountdown:h,endCountdown:f,decrementCountdown:d,stopCountdown:y})},{CLEAR_RESUME_CONVERSATION_PROMPT:zo}=De,$o=()=>{const e=Vn(),t=en().resumeConversationPrompt,{sendAction:n}=go(),{t:r}=fr(),{sendAssertive:o}=Oo();return{continueChat:()=>{n({type:"dismiss",body:{type:"resume_conversation_prompt"}}),e({type:zo})},hasPrompt:t,restartChat:()=>{o(r("resumeConversationPrompt.srNotifyRestartText")),n({type:Te}),e({type:zo})}}},Bo=(e,t)=>{const n=Bn();(0,i.useEffect)((()=>{n.stream&&(t?n.stream().filter(t).subscribe({next:e}):n.stream().subscribe({next:e}))}),[n,e,t])};function Fo(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 Ho(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fo(Object(n),!0).forEach((function(t){qo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function qo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Vo=$t({[Tn]:(e,{hasResponded:t})=>Ho(Ho({},e),{},{userHasResponded:t})},{userHasResponded:!1}),{createActions:Wo,createReducer:Go,selectState:Ko}=d("translations"),[Yo,Jo]=Wo("translate",{enable:e=>({locale:e}),disable:()=>({})}),[Qo,Zo]=Wo("event",{enable:e=>({payloadId:e}),disable:e=>({payloadId:e})}),Xo=(e,t)=>(n,r)=>r[e]||t,ei=Ko,ti=E(ei,(e=>e.originalPayloadIds)),ni=E(ti,Xo("payloadId"),((e,t)=>!e.includes(t)));function ri(){const{sendAction:e}=go(),t=Q(),n=Br((n=>{e({type:ke,body:{enabled:!0,locale:n}}),t(Yo(n))})),r=Br((()=>{e({type:ke,body:{enabled:!1}}),t(Jo())})),{languages:o,isActive:i,isAvailable:s,currentLocale:a}=Z(ei,[]);return{languages:o,isActive:i,isAvailable:s,currentLocale:a,enableTranslations:n,disableTranslations:r}}function oi({payload:e}={}){var t,n,r;const o=null==e?void 0:e.id;let i,s;switch(null==e?void 0:e.type){case"participant":i=e.participant.introduction,s=e.participant.translatedIntroduction;break;default:i=null==e?void 0:e.body,s=null==e?void 0:e.translatedBody}const a=!!s,c=X(ni,{payloadId:o},[o]),l=Q(),u=Br((()=>{l(c?Zo(o):Qo(o))}));return[a&&c?null===(t=s)||void 0===t?void 0:t.data:i,{hasTranslation:a,isTranslated:c&&a,toggleTranslation:u,translatedBy:null===(n=s)||void 0===n?void 0:n.translatedBy,locale:null===(r=s)||void 0===r?void 0:r.locale}]}function ii(){const e=Z(ei,[]).containerId;return{id:e,focusContainer:jr(e)}}function si(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 ai(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?si(Object(n),!0).forEach((function(t){ci(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):si(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const li={isActive:!1,currentLocale:void 0,isAvailable:!1,languages:[],originalPayloadIds:[],containerId:s()},ui=Go({[De.SET_FEATURES]:(e,t)=>{var n;const r=null==t||null===(n=t.features)||void 0===n?void 0:n.translation;return r?ai(ai({},e),{},{isAvailable:!0===r.enabled,languages:r.languages||[]}):e},[De.CLEAR_FEATURES]:()=>li,[Yo]:(e,{locale:t})=>ai(ai({},e),{},{isActive:!0,currentLocale:t}),[Jo]:e=>ai(ai({},e),{},{isActive:!1,currentLocale:void 0}),[Qo]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?ai(ai({},e),{},{originalPayloadIds:e.originalPayloadIds.filter((e=>e!==t))}):e,[Zo]:(e,{payloadId:t})=>e.originalPayloadIds.includes(t)?e:ai(ai({},e),{},{originalPayloadIds:[...e.originalPayloadIds,t]}),[kn.pending]:()=>li},li),pi={send32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M6.714,14.985l17.837-7.906c0.681-0.302,1.414,0.301,1.25,1.027L22.273,23.59\tc-0.13,0.566-0.751,0.865-1.275,0.613l-3.623-1.752l-2.334,2.287c-0.572,0.562-1.538,0.156-1.538-0.645V21.01\tc0-0.217,0.078-0.43,0.222-0.594l7.676-8.841l-10.414,7.472l-4.351-2.445C5.987,16.236,6.033,15.287,6.714,14.985L6.714,14.985z"/></svg>',balloon32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,10.824v10.375c0,1.104-0.896,2-2,2h-4.694l-4.931,3.625v-3.625H10c-1.104,0-2-0.896-2-2V10.824\tc0-1.104,0.896-2,2-2h12C23.104,8.824,24,9.719,24,10.824z"/></svg>',newTopic32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,8.593l2.407,4.573l5.093,0.876l-3.604,3.702l0.74,5.115L16,20.574l-4.634,2.285l0.739-5.115L8.5,14.042\tl5.094-0.876L16,8.593z"/></svg>',newTranslation16:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path fill="#4A48C1" d="M8,0C3.6,0,0,3.6,0,8s3.6,8,8,8s8-3.6,8-8S12.4,0,8,0z M14.1,7.1h-1.4c-0.1-1.5-0.4-2.9-1-4\tC13,4,13.9,5.4,14.1,7.1z M7.1,2.1v5H5C5.2,4.7,6.1,2.9,7.1,2.1z M7.1,8.9v5c-1-0.7-1.9-2.5-2.1-5H7.1z M8.9,13.9v-5H11\tC10.8,11.3,9.9,13.2,8.9,13.9z M8.9,7.1v-5c1,0.7,1.9,2.5,2.1,5H8.9z M4.2,3.1c-0.5,1.1-0.9,2.5-1,4H1.9C2.1,5.4,3,4,4.2,3.1z M1.9,8.9h1.4c0.1,1.5,0.4,2.9,1,4C3,12,2.1,10.5,1.9,8.9z M11.8,12.9c0.5-1.1,0.9-2.5,1-4h1.4C13.9,10.5,13,12,11.8,12.9z"/></svg>',newTranslation32:'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,7c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4.1,9-9S20.9,7,16,7z M22.9,15h-1.6c-0.1-1.7-0.5-3.3-1.1-4.5\tC21.6,11.5,22.6,13.1,22.9,15z M15,9.4V15h-2.3C12.9,12.3,13.9,10.2,15,9.4z M15,17v5.6c-1.1-0.8-2.1-2.9-2.3-5.6H15z M17,22.6V17\th2.3C19.1,19.8,18.1,21.8,17,22.6z M17,15V9.4c1.1,0.8,2.1,2.9,2.3,5.6H17z M11.8,10.4c-0.6,1.3-1,2.8-1.1,4.5H9.1\tC9.4,13.1,10.4,11.5,11.8,10.4z M9.1,17h1.6c0.1,1.7,0.5,3.3,1.1,4.5C10.4,20.5,9.4,18.9,9.1,17z M20.2,21.5c0.6-1.3,1-2.8,1.1-4.5\th1.6C22.6,18.8,21.6,20.5,20.2,21.5z"/></svg>',avatar32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#003A5D" d="M0,4.717C0,2.112,2.112,0,4.717,0h22.566C29.888,0,32,2.112,32,4.717v22.566C32,29.887,29.888,32,27.283,32 H4.717C2.113,32,0,29.887,0,27.283V4.717z"/><path fill="#FFF" d="M10.103,14.901c-1.107,0-2.004-0.897-2.004-2.004s0.897-2.005,2.004-2.005c1.107,0,2.005,0.897,2.005,2.005 C12.108,14.004,11.211,14.901,10.103,14.901z M16,14.901c1.107,0,2.005-0.897,2.005-2.004S17.108,10.892,16,10.892 c-1.108,0-2.005,0.897-2.005,2.005C13.995,14.004,14.892,14.901,16,14.901z M21.896,10.892c-1.106,0-2.004,0.897-2.004,2.005 c0,1.107,0.896,2.004,2.004,2.004c1.109,0,2.005-0.897,2.005-2.004C23.901,11.789,23.005,10.892,21.896,10.892z M21.408,18.207 H10.783C11.83,23.973,20.361,23.973,21.408,18.207z"/></svg>',chevronDown8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M-0.001,2.876c0-0.247,0.091-0.494,0.273-0.688c0.38-0.401,1.013-0.418,1.414-0.039l1.938,1.834\tc0.199,0.188,0.547,0.188,0.746,0L6.31,2.15c0.401-0.379,1.034-0.362,1.414,0.04c0.379,0.401,0.361,1.034-0.04,1.414L5.745,5.437\tC4.782,6.35,3.213,6.35,2.249,5.436L0.311,3.603C0.103,3.406-0.001,3.142-0.001,2.876z"/></svg>',chevronDown32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M16,20.425c-0.782,0-1.563-0.291-2.159-0.874l-6.541-6.408c-0.395-0.387-0.401-1.02-0.015-1.414\tc0.387-0.394,1.021-0.4,1.414-0.015l6.541,6.408c0.42,0.409,1.102,0.409,1.52-0.001l6.541-6.407c0.396-0.386,1.028-0.38,1.414,0.015\tc0.387,0.395,0.381,1.027-0.014,1.414l-6.541,6.407C17.563,20.133,16.782,20.425,16,20.425z"/></svg>',chevronRight8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M2.875,7.998c-0.247,0-0.494-0.091-0.688-0.273c-0.401-0.38-0.418-1.013-0.039-1.414l1.834-1.938\tc0.188-0.199,0.188-0.547,0-0.746l-1.835-1.94c-0.379-0.401-0.362-1.034,0.04-1.414s1.034-0.361,1.414,0.04l1.834,1.939\tc0.913,0.963,0.913,2.532-0.001,3.496L3.601,7.686C3.405,7.894,3.14,7.998,2.875,7.998z"/></svg>',chevronRight16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M6.5,13c-0.247,0-0.494-0.091-0.687-0.273c-0.401-0.38-0.419-1.013-0.04-1.414L8.22,8.727\tc0.373-0.394,0.373-1.06,0-1.454L5.773,4.687c-0.379-0.401-0.362-1.034,0.04-1.414c0.4-0.378,1.034-0.362,1.414,0.04l2.446,2.586\tc1.096,1.159,1.096,3.043,0,4.203l-2.446,2.586C7.03,12.896,6.765,13,6.5,13z"/></svg>',close8:'<svg xmlns="http://www.w3.org/2000/svg" width="8px" height="8px" x="0px" y="0px" viewBox="0 0 8 8"><defs/><path fill="#4A48C1" d="M7.705,7.729C7.511,7.923,7.255,8.02,7,8.02c-0.257,0-0.514-0.099-0.709-0.295L4,5.423L1.709,7.725\tC1.513,7.921,1.257,8.02,1,8.02c-0.255,0-0.51-0.097-0.706-0.291c-0.391-0.39-0.393-1.022-0.003-1.414l2.298-2.309l-2.27-2.28\tC-0.07,1.334-0.068,0.701,0.323,0.311c0.392-0.389,1.024-0.387,1.415,0.003L4,2.587l2.263-2.274C6.653-0.077,7.287-0.079,7.677,0.31\tC8.068,0.7,8.07,1.333,7.681,1.725l-2.27,2.281l2.298,2.309C8.099,6.705,8.097,7.339,7.705,7.729z"/></svg>',close16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#4A48C1" d="M12.709,11.295L9.411,7.982l3.262-3.276c0.39-0.392,0.388-1.024-0.004-1.414\tc-0.39-0.39-1.023-0.388-1.414,0.003L8,6.564L4.746,3.295C4.357,2.904,3.724,2.903,3.332,3.292C2.94,3.682,2.939,4.315,3.329,4.707\tl3.261,3.275l-3.298,3.313c-0.39,0.391-0.388,1.024,0.003,1.414C3.49,12.903,3.745,13,4,13c0.257,0,0.513-0.099,0.708-0.295L8,9.399\tl3.291,3.306C11.486,12.901,11.743,13,12,13c0.255,0,0.511-0.097,0.705-0.291C13.097,12.319,13.099,11.686,12.709,11.295z"/></svg>',enlarge32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M24,9v6.5c0,0.552-0.447,1-1,1s-1-0.448-1-1v-4.086L11.414,22H15.5c0.552,0,1,0.447,1,1s-0.448,1-1,1H9\tc-0.13,0-0.26-0.026-0.382-0.077c-0.245-0.102-0.439-0.296-0.541-0.541C8.026,23.26,8,23.13,8,23v-6.5c0-0.552,0.448-1,1-1\ts1,0.448,1,1v4.085L20.586,10H16.5c-0.552,0-1-0.448-1-1s0.448-1,1-1H23c0.13,0,0.26,0.026,0.382,0.077\tc0.245,0.102,0.439,0.296,0.541,0.541C23.974,8.74,24,8.87,24,9z"/></svg>',options32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M26.1,21.383c0.334-0.625,0.602-1.279,0.812-1.949L32,18.609V13.51l-5.058-0.846\tc-0.208-0.67-0.468-1.325-0.795-1.956l3.009-4.145l-3.604-3.634L21.38,5.903c-0.626-0.333-1.276-0.602-1.948-0.81L18.609,0\tl-5.098,0.001l-0.847,5.061c-0.669,0.203-1.326,0.465-1.957,0.794L6.562,2.847L2.929,6.449l2.973,4.171\tC5.569,11.247,5.3,11.9,5.091,12.569L0,13.373v5.099l5.06,0.866c0.204,0.669,0.467,1.324,0.796,1.955l-3.009,4.146l3.601,3.635\tl4.171-2.975c0.627,0.335,1.282,0.603,1.951,0.811L13.372,32h5.118l0.849-5.057c0.668-0.207,1.323-0.469,1.953-0.795l4.144,3.01\tl3.639-3.604L26.1,21.383z M19.01,19.035c-1.675,1.663-4.381,1.652-6.041-0.025c-1.662-1.675-1.649-4.381,0.024-6.042\tc1.676-1.661,4.382-1.648,6.043,0.025C20.699,14.67,20.686,17.377,19.01,19.035z"/></svg>',file32:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" x="0px" y="0px" version="1.1" viewBox="0 0 32 32"><path fill="#4A48C1" d="M16,28.5c-3.6,0-6.5-3-6.5-6.6V9.6c0-0.6,0.4-1,1-1s1,0.4,1,1v12.3c0,2.5,2,4.6,4.5,4.6\tc2.5,0,4.5-2.1,4.5-4.6V8.3c0-1.5-1.2-2.8-2.7-2.8c-1.5,0-2.7,1.3-2.7,2.8v13.5c0,0.6,0.5,1.1,1,1.1c0.6,0,1-0.5,1-1.1v-10\tc0-0.6,0.4-1,1-1s1,0.4,1,1v10c0,1.7-1.4,3.1-3,3.1s-3-1.4-3-3.1V8.3c0-2.6,2.1-4.8,4.7-4.8c2.6,0,4.7,2.2,4.7,4.8v13.6\tC22.5,25.5,19.6,28.5,16,28.5z"/></svg>',upload32:'<svg xmlns="http://www.w3.org/2000/svg" width="32px" height="32px" x="0px" y="0px" viewBox="0 0 32 32"><defs/><path fill="#4A48C1" d="M9.488,13.481c-0.391-0.391-0.391-1.023,0-1.414l5.805-5.805c0.026-0.026,0.06-0.036,0.088-0.058\tc0.073-0.06,0.146-0.119,0.235-0.156c0.246-0.103,0.522-0.103,0.769,0c0.093,0.039,0.171,0.101,0.249,0.165\tc0.023,0.02,0.053,0.027,0.074,0.049l5.805,5.805c0.391,0.391,0.391,1.023,0,1.414c-0.195,0.195-0.451,0.293-0.707,0.293\ts-0.512-0.098-0.707-0.293L17,9.383V20.33c0,0.553-0.447,1-1,1c-0.552,0-1-0.447-1-1V9.383l-4.098,4.098\tC10.512,13.872,9.879,13.872,9.488,13.481z M22.819,24.031H9.181c-0.552,0-1,0.447-1,1s0.448,1,1,1h13.639c0.553,0,1-0.447,1-1\tS23.372,24.031,22.819,24.031z"/></svg>',download16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#FFF" d="M3.175,7.726c-0.413-0.367-0.45-0.999-0.083-1.412c0.367-0.413,0.999-0.45,1.412-0.083L7,8.45V1.5\tc0-0.552,0.448-1,1-1c0.553,0,1,0.448,1,1v6.95l2.496-2.219c0.412-0.367,1.044-0.331,1.411,0.083\tc0.367,0.413,0.33,1.045-0.083,1.412l-4.16,3.698c-0.047,0.041-0.103,0.062-0.154,0.094c-0.047,0.028-0.089,0.064-0.141,0.085\tC8.25,11.649,8.125,11.677,8,11.677c-0.126,0-0.25-0.027-0.369-0.074c-0.05-0.021-0.09-0.055-0.136-0.083\tc-0.053-0.031-0.111-0.053-0.159-0.096L3.175,7.726z M12.018,13.5H3.983c-0.552,0-1,0.447-1,1s0.448,1,1,1h8.035\tc0.553,0,1-0.447,1-1S12.57,13.5,12.018,13.5z"/></svg>',error16:'<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" x="0px" y="0px" viewBox="0 0 16 16"><defs/><path fill="#ad001f" d="M15.744,13.104L9.097,1.47c-0.604-1.055-1.59-1.055-2.193,0L0.256,13.104\tc-0.604,1.056-0.102,1.919,1.113,1.919H14.63C15.847,15.022,16.348,14.159,15.744,13.104z M7,5.045c0-0.552,0.448-1,1-1s1,0.448,1,1\tv3.656c0,0.552-0.448,1-1,1s-1-0.448-1-1V5.045z M8,13.212c-0.748,0-1.354-0.607-1.354-1.354c0-0.748,0.606-1.354,1.354-1.354\ts1.354,0.606,1.354,1.354C9.354,12.604,8.748,13.212,8,13.212z"/></svg>',arrowLeft16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M13.6,8c0,0.6-0.4,1-1,1h-7l2.2,2.5c0.4,0.4,0.3,1-0.1,1.4c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3,0-0.6-0.1-0.8-0.3\n\tL2.6,8.6c0,0-0.1-0.1-0.1-0.2c0,0-0.1-0.1-0.1-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0c0,0,0,0,0,0c0-0.1,0-0.3,0.1-0.4\n\tc0,0,0.1-0.1,0.1-0.1c0-0.1,0.1-0.1,0.1-0.2l3.7-4.1c0.4-0.4,1-0.4,1.4-0.1c0.4,0.4,0.4,1,0.1,1.4L5.6,7h7C13.2,7,13.6,7.4,13.6,8z"\n\t/>\n</svg>\n',arrowRight16:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<path fill="#5053A4" d="M2.4,8.1c0-0.6,0.4-1,1-1h7L8.1,4.5c-0.4-0.4-0.3-1,0.1-1.4c0.2-0.2,0.4-0.2,0.7-0.2c0.3,0,0.6,0.1,0.8,0.3\n\tl3.7,4.2c0,0,0.1,0.1,0.1,0.2c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.2,0.1,0.3c0,0,0,0,0,0c0,0,0,0,0,0c0,0.1,0,0.3-0.1,0.4\n\tc0,0-0.1,0.1-0.1,0.1c0,0.1-0.1,0.1-0.1,0.2l-3.7,4.1c-0.4,0.4-1,0.4-1.4,0.1c-0.4-0.4-0.4-1-0.1-1.4l2.2-2.4h-7\n\tC2.8,9.1,2.4,8.6,2.4,8.1z"/>\n</svg>\n'},hi=({name:e,size:t="32",className:n,alt:r})=>{const o=`${e}${t}`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{"aria-hidden":"true",className:n||Mn("icon"),dangerouslySetInnerHTML:{__html:pi[o]}}),r&&(0,L.jsx)("span",{className:Mn("visually-hidden"),children:r})]})},fi={visible:Mn("transition--visible"),in:Mn("transition--in"),visuallyHidden:Mn("visually-hidden")},di=Object.values(fi),yi="notRendered",bi="rendered",mi="visuallyHidden",gi=({children:t,isActive:n,timeout:r,transitionStartState:o="notRendered",onInTransitionComplete:s,onOutTransitionComplete:a})=>{const c=(0,i.useRef)(!1),l=r?parseInt(r,10):300,u=Br(s),p=Br(a),h=o===mi,[f,d]=(0,i.useState)((()=>h?[fi.visuallyHidden]:[])),y="notRendered"!==o||f.length>0;return(0,i.useEffect)((()=>{let e=null,t=null;return c.current&&!n&&(d([fi.visible]),e=setTimeout((()=>{d([...h?[fi.visuallyHidden]:[]]),p&&(t=requestAnimationFrame((()=>{p()})))}),l)),!c.current&&n&&(d([fi.visible]),t=requestAnimationFrame((()=>{t=requestAnimationFrame((()=>{d([fi.visible,fi.in]),u&&(e=setTimeout((()=>{u()}),l))}))}))),c.current=n,()=>{clearTimeout(e),cancelAnimationFrame(t)}}),[n,h,l,u,p]),y&&(0,e.toChildArray)(t).map((t=>{const{className:n=""}=t.props,r=n.split(" ").filter((e=>!di.includes(e)));return(0,e.cloneElement)(t,{className:[...r,...f].join(" ")})}))},vi=({className:e,children:t,onCancel:n,headingText:r,cancelButtonText:o,disableButtonFocusing:s,cancelButtonRef:a,position:c="right"})=>{const l=(0,i.useRef)(null),u=$r(),{hideOption:p}=Ar(),{focusButton:h}=Ir();return(0,i.useEffect)((()=>{fe(l.current)}),[]),(0,L.jsx)("section",{className:Mn("options",{"options--right":"left"!==c,"options--left":"left"===c},e),"aria-labelledby":u,tabIndex:"-1",ref:l,children:(0,L.jsxs)("div",{className:Mn("options__body"),children:[(0,L.jsx)("h2",{id:u,className:Mn("options__title"),children:r}),(0,L.jsxs)("button",{type:"button",onClick:()=>{n&&n(),p(),s||h()},"aria-describedby":u,className:Mn("button","options__close"),ref:e=>{a&&(a.current=e)},children:[(0,L.jsx)(hi,{name:"close",size:"16"}),(0,L.jsx)("span",{children:o})]}),(0,L.jsx)("div",{className:Mn("options__wrapper"),children:t})]})})},{createActions:Oi,createReducer:wi,selectState:ji}=d("forms"),[_i,xi]=Oi("form",{register:(e,t)=>({formId:e,persistData:t}),deregister:e=>({formId:e})}),[Ei,Si,Ti,ki]=Oi("control",{register:(e,t)=>({formId:e,name:t}),deregister:(e,t)=>({formId:e,name:t}),updateValue:(e,t,n)=>({formId:e,name:t,value:n}),updateTouched:(e,t,n)=>({formId:e,name:t,touched:n})}),Pi=E(ji,Xo("formId"),((e,t)=>e[t])),Ci=E(Pi,(e=>(null==e?void 0:e.controls)||{})),Ai=E(Ci,(e=>{const t={};return Object.entries(e).forEach((([e,{value:n}])=>{t[e]=n})),t})),Ii=E(Ci,Xo("name"),((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.value})),Ni=E(Ci,Xo("name"),((e,t)=>{var n;return null===(n=e[t])||void 0===n?void 0:n.touched})),Di=(0,e.createContext)({}),Ri=Di,{Provider:Li,Consumer:Ui}=Di;function Mi(){return(0,i.useContext)(Ri)}function zi(e){const t=Q(),{formId:n,updateControlValue:r,updateControlTouched:o,errors:s}=Mi(),a=!!X(Pi,{formId:n},[n]),c=(0,i.useRef)();c.current=a;const l=X(Ii,{formId:n,name:e},[n,e]),u=X(Ni,{formId:n,name:e},[n,e]),p=null==s?void 0:s[e],h=!p;(0,i.useEffect)((()=>{c.current&&t(Ei(n,e))}),[a,n,e,t]),(0,i.useLayoutEffect)((()=>()=>{t(Si(n,e))}),[a,n,e,t]);const f=(0,i.useCallback)((t=>r(e,t.target.value)),[e,r]),d=(0,i.useCallback)((()=>{o(e,!0)}),[o,e]);return[(0,i.useMemo)((()=>({name:e,onInput:f,onBlur:d,value:l})),[e,f,d,l]),(0,i.useMemo)((()=>({isValid:h,error:p,touched:u})),[h,p,u])]}const $i=["children","formId","persistData","onError","onSubmit","validationSchema"];function Bi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bi(Object(n),!0).forEach((function(t){Hi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qi(e){let{children:t,formId:n,persistData:r,onError:o,onSubmit:s,validationSchema:a}=e,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,$i);const l=Q(),u=X(Ai,{formId:n},[n]),[p,h]=(0,i.useState)(!1),[f,d]=(0,i.useState)({}),{isValid:y,errors:b}=function(e,t){const n=(0,i.useMemo)((()=>function(e,t={}){return Object.entries(t).reduce(((t,[n,r])=>{r&&!Array.isArray(r)&&(r=[r]);for(let i=0;i<(null===(o=r)||void 0===o?void 0:o.length);i++){var o;if(!r[i].fn(e[n],r[i].compareValue)){t[n]=r[i].errorText;break}}return t}),{})}(e,t)),[e,t]);return{isValid:0===Object.keys(n).length,errors:n}}(u,a),m=(0,i.useMemo)((()=>Fi(Fi({},b),f)),[b,f]);(0,i.useLayoutEffect)((()=>{l(_i(n,r))}),[n,r,l]),(0,i.useEffect)((()=>()=>{l(xi(n))}),[n,r,l]);const g=(0,i.useCallback)(((e,t)=>{l(Ti(n,e,t))}),[n,l]),v=(0,i.useCallback)(((e,t)=>{l(ki(n,e,t))}),[l,n]),O=(0,i.useCallback)(((e,t)=>{d((n=>Fi(Fi({},n),{},{[e]:t})))}),[d]),w=(0,i.useCallback)((e=>{e.preventDefault(),h(!0),y&&s(u,{updateControlValue:g,setError:O})}),[y,s,u,g,O]);(0,i.useEffect)((()=>{o&&o({errors:m,isSubmitted:p,isValid:0===Object.keys(m).length})}),[p,m,o]);const j=(0,i.useMemo)((()=>({formId:n,values:u,errors:m,isValid:0===Object.keys(m).length,isSubmitted:p,handleSubmit:w,validationSchema:a,updateControlValue:g,updateControlTouched:v})),[n,u,m,p,w,a,g,v]);return n?s?(0,L.jsx)(Li,Fi(Fi({},c),{},{value:j,children:t})):(console.error('"onSubmit" is required.'),null):(console.error('"formId" is required.'),null)}function Vi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vi(Object(n),!0).forEach((function(t){Gi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ki={},Yi={controls:{}},Ji={value:"",touched:!1};function Qi(e,t,n,r){var o;const i=(null===(o=e[t])||void 0===o?void 0:o.controls[n])||Ji;return Wi(Wi({},e),{},{[t]:Wi(Wi({},e[t]),{},{controls:Wi(Wi({},e[t].controls),{},{[n]:Wi(Wi({},i),r)})})})}const Zi=wi({[_i]:(e,{formId:t,persistData:n})=>{const r=n?e[t]??Wi(Wi({},Yi),{},{persistData:n}):Wi(Wi({},Yi),{},{persistData:n});return Wi(Wi({},e),{},{[t]:r})},[xi]:(e,{formId:t})=>{var n;const r=Wi({},e);return null!==(n=r[t])&&void 0!==n&&n.persistData||delete r[t],r},[Ei]:(e,{name:t,formId:n})=>Qi(e,n,t),[Si]:(e,{formId:t,name:n})=>{const r=e[t];if(!r)return e;if(r.persistData)return e;const o=Wi({},r.controls);return delete o[n],Wi(Wi({},e),{},{[t]:Wi(Wi({},r),{},{controls:o})})},[Ti]:(e,{formId:t,name:n,value:r})=>Qi(e,t,n,{value:r}),[ki]:(e,{formId:t,name:n,touched:r})=>Qi(e,t,n,{touched:r}),[kn.pending]:()=>Ki},Ki),Xi=["className","disableValidationClasses"];function es(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ts(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ns=function(e){let{className:t,disableValidationClasses:n}=e,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Xi);const{handleSubmit:o,isValid:i,isSubmitted:s}=function(){const{handleSubmit:e,isSubmitted:t,isValid:n}=Mi();return{handleSubmit:e,isSubmitted:t,isValid:n}}(),a=["form"];return!n&&s&&(a.push("form--submitted"),i?a.push("form--valid"):a.push("form--invalid")),(0,L.jsx)("form",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?es(Object(n),!0).forEach((function(t){ts(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):es(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({onSubmit:o,className:Mn([...a,t])},r))};function rs({id:e,error:t}){const[n,r]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{const e=setTimeout((()=>r(!0)),300);return()=>clearTimeout(e)}),[]),(0,L.jsx)("div",{className:Mn("error"),"aria-live":"assertive","aria-atomic":"true",children:n&&t&&(0,L.jsxs)("span",{id:e,className:Mn("error__message"),children:[(0,L.jsx)(hi,{name:"error",size:"16"}),t]})})}const os=({contentHint:e,id:t,labelText:n,labelClass:r=Mn("label"),validity:o,errorText:i,children:s})=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("label",{htmlFor:t,className:r,children:n}),e&&(0,L.jsx)("span",{id:`${t}-content-hint`,className:Mn("input__content-hint"),children:e}),(0,L.jsx)(rs,{id:`${t}-error`,error:!o&&i}),s]}),is=["id","name","labelText","labelClass","contentHint","aria-describedby","options"];function ss(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function as(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ss(Object(n),!0).forEach((function(t){cs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ss(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ls=e=>{let{id:t,name:n,labelText:r,labelClass:o,contentHint:i,"aria-describedby":s,options:a=[]}=e,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,is);const{isSubmitted:l}=Mi(),[u,{error:p}]=zi(n),h=l&&p,f=[];return s&&f.push(s),i&&f.push(`${t}-content-hint`),h&&f.push(`${t}-error`),(0,L.jsx)(os,{id:t,contentHint:i,validity:!h,errorText:p,labelText:r,labelClass:o,children:(0,L.jsx)("select",as(as(as({id:t,name:n,"aria-invalid":h?"true":"false","aria-describedby":f.join(" ")||null},u),c),{},{children:a.map((e=>(0,L.jsx)("option",{value:e.value,children:e.label},e.value)))}))})},us=function({controlName:e,descriptionId:t}){const{t:n}=fr(),{isActive:r,languages:o,currentLocale:s}=ri(),{locale:a}=fr(),c=(0,i.useMemo)((()=>{var e;return null==o||null===(e=o.find((e=>e.locale===s)))||void 0===e?void 0:e.nativeName}),[o,s]),l=(0,i.useMemo)((()=>[{value:"",label:n("translations.settings.defaultOptionLabel")},...o.filter((e=>e.locale.toLowerCase()!==String(a).toLowerCase())).map((e=>({value:e.locale,label:e.nativeName})))]),[n,o,a]);return(0,L.jsxs)(ns,{noValidate:"true",className:Mn("options__form"),children:[(0,L.jsx)("p",{className:Mn("options__description"),id:t,children:n("translations.settings.description")}),r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("h3",{children:n("translations.settings.currentTranslationLabel")}),(0,L.jsx)("p",{className:Mn("options__active-language"),children:c})]}):(0,L.jsx)(ls,{name:e,type:"text",className:Mn("input__select"),"aria-describedby":t,labelClass:Mn("label"),labelText:n("translations.settings.inputLabel"),options:l,defaultValue:s||""}),(0,L.jsx)("div",{className:Mn("options__actions"),children:(0,L.jsx)("button",{type:"submit",className:Mn("button","button--primary","options__submit"),children:n(r?"translations.settings.endButtonText":"translations.settings.startButtonText")})})]})},{REGISTER_FORM:ps,DE_REGISTER_FORM:hs,REGISTER:fs,DE_REGISTER:ds,SET_VALUE:ys,SET_VALIDITY:bs,SET_STATE:ms,SET_SUBMITTED:gs,SET_PERSIST_FORM_DATA:vs}={REGISTER_FORM:"REGISTER_FORM",DE_REGISTER_FORM:"DE_REGISTER_FORM",REGISTER:"REGISTER",DE_REGISTER:"DEREGISTER",SET_VALUE:"SET_VALUE",SET_VALIDITY:"SET_VALIDITY",SET_STATE:"SET_STATE",SET_SUBMITTED:"SET_SUBMITTED",SET_PERSIST_FORM_DATA:"SET_PERSIST_FORM_DATA"},Os=(e,t,n=null)=>({fn:e,errorText:t,compareValue:n}),ws=(e,t)=>{let n=!0;for(let r=0;r<e.length;r++)e[r].size>t&&(n=!1);return n},js=e=>!(null==e||!e.length)>0,_s=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))},xs=e=>!!e,Es="translation-settings",Ss="locale",Ts=function({onClose:e}){const[t,n]=(0,i.useState)(void 0),{t:r}=fr(),{isActive:o,enableTranslations:s,disableTranslations:a}=ri(),c=$r(),{focusContainer:l}=ii(),u=(0,i.useCallback)((({isValid:e,isSubmitted:t})=>{n(t&&!e?"options--error":void 0)}),[n]),p=(0,i.useRef)(0),h=(0,i.useMemo)((()=>(p.current+=1,o?{}:{[Ss]:Os(xs,r("translations.settings.noLocaleText"))})),[o,r]);return(0,L.jsx)(vi,{className:t,onCancel:e,formName:Es,headingText:r("translations.settings.title"),cancelButtonText:r("translations.settings.cancelButtonText"),position:"left",disableButtonFocusing:!0,children:(0,L.jsx)(qi,{onSubmit:({locale:t})=>{o?a():(s(t),e(),l())},formId:Es,validationSchema:h,onError:u,children:(0,L.jsx)(us,{controlName:Ss,descriptionId:c})},p.current)})};function ks(){const{t:e}=fr(),[t,n]=(0,i.useState)(!1),r=(0,i.useRef)(null),o=$r();return(0,L.jsxs)("div",{className:Mn("translations__container"),onKeyDown:e=>{t&&he(e)===pe.Escape&&(n(!1),fe(r.current))},children:[(0,L.jsx)(gi,{transitionStartState:yi,isActive:t,children:(0,L.jsx)("div",{className:Mn("options__dialog"),role:"dialog",children:(0,L.jsx)(Ts,{onClose:()=>{n(!1)}})})}),(0,L.jsxs)("button",{type:"button",className:Mn(["button","button--secondary","chat__options__button"]),id:o,onClick:()=>{n((e=>!e))},onKeyDown:e=>{he(e)===pe.ArrowDown&&(n(!0),e.preventDefault())},ref:r,"aria-haspopup":"dialog","aria-expanded":t.toString(),children:[(0,L.jsx)(hi,{name:"newTranslation",size:"16"}),(0,L.jsx)("span",{className:Mn("button__text"),children:e("translations.settings.openButtonText")})]})]})}function Ps({id:e,label:t,onButtonClick:n,buttonText:r,srButtonText:o,type:i}){const s=$r();return(0,L.jsxs)("section",{className:Mn("chat-status",i&&`chat-status--${i}`),id:e,tabIndex:"-1","aria-labelledby":s,children:[(0,L.jsx)("h2",{className:Mn("chat-status__title"),id:s,children:t}),(0,L.jsxs)("button",{type:"button",className:Mn("button","button--tertiary"),onClick:n,children:[(0,L.jsx)("span",{"aria-hidden":o?"true":void 0,children:r}),o&&(0,L.jsx)("span",{className:Mn("visually-hidden"),children:o})]})]})}function Cs(){const{t:e}=fr(),{id:t}=ii(),{hasInterrupt:n}=Wr(),{isActive:r,disableTranslations:o,languages:s,currentLocale:a}=ri(),c=_r(),l=(0,i.useMemo)((()=>{var e;return null==s||null===(e=s.find((e=>e.locale===a)))||void 0===e?void 0:e.nativeName}),[s,a]),u=(0,i.useCallback)((()=>{o(),c()}),[o,c]);return!r||n?null:(0,L.jsx)(Ps,{type:"translations",id:t,label:e("translations.status.label",{language:l}),onButtonClick:u,buttonText:e("translations.status.stopText"),srButtonText:e("translations.status.srStopText")})}const As=e=>`suggestions__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`,Is=({id:e,categories:t=[],question:n,onClick:r,hasIcon:o})=>{const s=(0,i.useMemo)((()=>["suggestions-item",...t.map(As)]),[t]),a=(0,i.useCallback)((()=>{r&&r({id:e,question:n})}),[e,n,r]);return(0,L.jsx)("li",{className:Mn(s),children:(0,L.jsxs)("button",{type:"button",onClick:a,className:Mn("button","button--primary"),children:[o&&(0,L.jsx)(hi,{name:"chevronRight",size:"8"}),n]})})};function Ns(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ds(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Rs=({className:e,suggestions:t=[],onClickSuggestion:n,hasIcon:r})=>(0,L.jsx)("ul",{className:Mn("suggestions__list",e),children:t.map((e=>(0,L.jsx)(Is,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ns(Object(n),!0).forEach((function(t){Ds(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ns(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({hasIcon:r,onClick:n},e),e.id)))}),Ls=({isAside:e})=>{const{layoutMode:t}=ee(),{t:n}=fr(),{sendAction:r,addMessageBubble:o}=go(),{isOpen:s,setVisibility:a}=so(),c=$r(),l=_r(),u=(0,i.useRef)(null),{sendPolite:p}=Oo(),{hasInterrupt:h}=Wr(),{hasCountdown:f,endCountdown:d}=Mo(),{hasPrompt:y,continueChat:b}=$o(),m=io(),g=un("suggestion"),[v]=oi({payload:g}),O=(0,i.useMemo)((()=>g&&!h?v:[]),[g,h,v]),w=(0,i.useRef)(null),j=(0,i.useRef)(!1),_=(0,i.useRef)([]),x=!!O.length,E="inline"===t?(m||s)&&!e:m,S=(0,i.useRef)(E),k=x&&!E,P=x?O:_.current;_.current=P;const C=(0,i.useCallback)((({id:e,question:t})=>{f&&d(!0),y&&b(),r({type:xe,originMessage:g.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),o(t),s||a(T.open),l()}),[o,b,d,l,f,y,g,r,a,s]);(0,i.useEffect)((()=>{if(w.current!==O&&!E){if(x){const e=j.current?n("suggestions.srUpdatedText"):n("suggestions.srAvailableText");setTimeout((()=>{p(e)}),30)}else j.current&&p(n("suggestions.srUnavailableText"));w.current=O}!S.current&&E?(de(u.current,l),p(n("suggestions.srUnavailableText"))):!x&&j.current&&de(u.current,l),j.current=x,S.current=E}),[O,x,E,l,p,n]);const A=n("suggestions.headingText"),I=n("suggestions.footerText"),N=A?"section":"div";return(0,L.jsx)(gi,{isActive:k,transitionStartState:yi,children:(0,L.jsxs)(N,{className:Mn("suggestions"),"aria-labelledby":A?c:null,ref:u,children:[A&&(0,L.jsx)("p",{id:c,className:Mn("suggestions__heading"),children:A}),!!P.length&&(0,L.jsx)(Rs,{hasIcon:!0,suggestions:P,onClickSuggestion:C}),I&&!s&&(0,L.jsx)("p",{className:Mn("suggestions__footer"),children:I})]})})},Us=({children:e,className:t=""})=>{const{isOpen:n,isVisible:r,setVisibility:o}=so(),{namespace:i,layoutMode:s}=ee(),{isInline:a}=pn(),c=Wn(),l=io(),{t:u}=fr(),p=["chat",`chat--layout-${s}`,`namespace--${i}`,...c,t];return n||"app"===s||p.push("chat--collapsed"),l&&p.push("chat--user-responded"),r&&(0,L.jsxs)("section",{className:Mn(p),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!a&&n&&o(T.minimized)},tabIndex:"-1","aria-label":u("chat.srLabel"),children:[(0,L.jsx)("div",{className:Mn("chat-wrapper"),children:e}),"inline"===s&&n&&(0,L.jsx)(Ls,{isAside:!0})]})},Ms=({originalError:e,title:t,message:n,buttonText:r,action:o,srText:s})=>{const a=go(),c=$r(),{sendPolite:l}=Oo(),u=_r(),p=e instanceof wn;return(0,i.useEffect)((()=>{p&&a[o]()}),[o,a,p]),(0,i.useEffect)((()=>{!p&&s&&setTimeout((()=>{l(s)}),200)}),[l,s,p]),!p&&(0,L.jsx)("section",{className:Mn("interrupt"),"aria-labelledby":c,children:(0,L.jsxs)("div",{className:Mn("interrupt__body"),children:[(0,L.jsx)("h2",{id:c,className:Mn("interrupt__title"),children:t}),(0,L.jsx)("p",{className:Mn("interrupt__message"),children:n}),r&&o&&(0,L.jsx)("div",{className:Mn("interrupt__actions"),children:(0,L.jsx)("button",{type:"button",className:Mn("button","button--primary"),onClick:()=>{a[o](),u()},children:r})})]})})},zs=(0,e.createContext)({}),$s=e=>{const t=(0,i.useContext)(zs);let n=null;"choice_prompt"===e.payload.type&&(n=t[e.type][e.payload.body.prompt.type]);const r=t[e.type][e.payload.type]||t.fallback;return[r&&"function"!=typeof r?r[e.payload.body.type]||t.fallback:r,n]};function Bs(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 Fs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bs(Object(n),!0).forEach((function(t){Hs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qs({children:e,childrenHTML:t,className:n,graphicSrc:r,graphicType:o="icon",iconName:i,iconSize:s,iconClassName:a,dividerType:c}){const l=Boolean(i||r),u=t?{dangerouslySetInnerHTML:{__html:t}}:{children:e};return(0,L.jsxs)("div",{className:Mn("divider",c&&`divider--type-${c}`,n),children:[l&&(0,L.jsx)("span",{className:Mn("divider__graphic"),children:i?(0,L.jsx)(hi,{name:i,size:s,className:a}):(0,L.jsx)("img",{src:r,className:Mn({icon:"icon"===o,avatar:"avatar"===o},a)})}),(0,L.jsx)("div",Fs({className:Mn("divider__body")},u))]})}const Vs={month:"long",day:"numeric",year:"numeric"},Ws={hour:"numeric",minute:"numeric"},Gs=({event:e})=>{const t=(()=>{const[e,t]=(0,i.useReducer)((e=>e+1),0);return(0,i.useCallback)((()=>{setTimeout((()=>{t()}))}),[])})(),{date:n,time:r,timeUntilMidnight:o,srText:s}=(e=>{var t;const{t:n}=fr(),r=ee(),o=(null==r||null===(t=r.context)||void 0===t?void 0:t.locale)??[],i=new Date(e),s=new Date,a=new Date(s);a.setHours(24,0,0,0);const c=a-s,l=i.toString(),u=new Intl.DateTimeFormat(o,Ws).format(i);let p=((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})(i,s);switch(p){case"today":p=n("dateTime.today");break;case"yesterday":p=n("dateTime.yesterday");break;default:p=new Intl.DateTimeFormat(o,Vs).format(i)}return{date:p,srText:n("dateTime.srText",{date:p,time:u}),time:u,fullDateTime:l,timeUntilMidnight:c}})(ie(e.timeIndicator));return(0,i.useEffect)((()=>{const e=setTimeout((()=>{t()}),o);return()=>{clearTimeout(e)}}),[t,o]),(0,L.jsxs)(qs,{dividerType:"time-indicator",children:[(0,L.jsxs)("p",{className:Mn("divider__time"),"aria-hidden":"true",children:[(0,L.jsx)("span",{children:n}),(0,L.jsx)("span",{children:r})]}),(0,L.jsx)("p",{className:Mn("visually-hidden"),children:s})]})},Ks=({event:e,newParticipant:t})=>{const[n,r]=$s(e);if(!n)return null;const o=["conversation__item"];return"info"===e.type?o.push("conversation__item--source-info"):e.payload.fromClient?o.push("conversation__item--source-user"):o.push("conversation__item--source-agent"),t&&o.push("conversation__item--new-participant"),(0,L.jsxs)("li",{className:Mn(o),children:[e.timeIndicator&&(0,L.jsx)(Gs,{event:e}),(0,L.jsx)(n,{event:e,children:(0,L.jsx)(r,{event:e})})]})},Ys=({eventPayload:e})=>{const{fromClient:t,participant:n}=e,r=(e=>en().participantInfo.participants[e])(n)||{},{messages:o,defaults:i}=ee(),s=r&&r.name,{showAvatar:a,showName:c}=o[t?"user":"agent"]||{},{userName:l}=i||{};if(!a&&!c)return null;const u=[];a&&s&&r.avatar&&u.push((0,L.jsx)("span",{className:Mn("message__avatar"),children:(0,L.jsx)("img",{src:r.avatar,className:Mn("avatar"),alt:""})}));const p=t&&l||s;return c&&p&&u.push((0,L.jsx)("span",{className:Mn("message__author-name"),children:p})),u.length>0&&(0,L.jsx)("div",{className:Mn("message__author"),children:u})},Js=()=>{const{id:e}=ln()||{};return(0,L.jsx)("li",{className:Mn("conversation__item","conversation__item--source-agent"),children:(0,L.jsxs)("div",{className:Mn("message","message--source-agent","message--type-loading"),children:[(0,L.jsx)(Ys,{eventPayload:{fromClient:!1,participant:e}}),(0,L.jsx)("div",{className:Mn("message__body"),children:(0,L.jsxs)("span",{className:Mn("loader"),children:[(0,L.jsx)("span",{className:Mn("loader__part","one")}),(0,L.jsx)("span",{className:Mn("loader__part","two")}),(0,L.jsx)("span",{className:Mn("loader__part","three")}),(0,L.jsx)("span",{className:Mn("loader__part","four")})]})})]})})},Qs=["showParticipant","showTranslationToggle","event","type","modifiers","children","bodyProps","info"];function Zs(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 Xs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zs(Object(n),!0).forEach((function(t){ea(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ea(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ta=function(e){let{showParticipant:t=!0,showTranslationToggle:n=!0,event:r,type:o,modifiers:i,children:s,bodyProps:a={},info:c}=e,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Qs);const u=Gn(r),{t:p}=fr(),[,{hasTranslation:h,isTranslated:f,toggleTranslation:d,locale:y}]=oi(r);return o&&u.push("message--type-"+o),i&&("string"==typeof i&&(i=i.split(" ").filter((e=>e.length))),i.forEach((e=>{u.push("message--"+e)}))),f&&u.push("message--is-translated"),h&&u.push("message--has-translation"),f&&(a=Xs(Xs({},a),{},{lang:y})),(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",Xs(Xs({className:Mn(u)},l),{},{children:[t&&(0,L.jsx)(Ys,{eventPayload:r.payload}),(0,L.jsx)("div",Xs(Xs({className:Mn("message__body")},a),{},{children:s})),c&&(0,L.jsx)("div",{"aria-hidden":"true",className:Mn("message__info"),children:c}),n&&h&&(0,L.jsx)("div",{className:Mn("message__translation-info"),children:(0,L.jsx)("button",{className:Mn("message__translation-toggle","button","button--secondary"),onClick:d,children:p(f?"translations.toggle.hideButtonText":"translations.toggle.showButtonText")})})]}))})},na=["event","children"];function ra(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 oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ra(Object(n),!0).forEach((function(t){ia(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ra(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sa=e=>{const{payload:t}=e,[n,r]=(0,i.useState)(!1),{sendAction:o,addMessageBubble:s,addDivider:a}=go(),{activeServiceSessionId:c}=en().serviceInfo,l=Z(cn),[u]=oi(e),{service:p}=t,h=(0,i.useMemo)((()=>{var t;return oa(oa({},e),{},{payload:oa(oa({},e.payload),{},{body:null===(t=e.payload.body)||void 0===t?void 0:t.prompt,translatedBody:e.payload.translatedBody&&oa(oa({},e.payload.translatedBody),{},{data:e.payload.translatedBody.data.prompt})})})}),[e]),f=u.chooseAgain&&c===p.serviceSessionId&&t.id!==l;return(0,i.useEffect)((()=>{r(t.id===l)}),[t,l]),{body:u,subEvent:h,showOptions:n,chooseAgain:f,onChoiceClickHandler:e=>{f&&a("new_topic"),s(e.text),o({type:"pick_choice",originMessage:t.id,choice:{id:e.id,text:e.text,chooseAgain:f}}),r(!1)},onChooseAgainClickHandler:()=>{r((e=>!e))}}};let aa={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const ca=/[&<>"']/,la=/[&<>"']/g,ua=/[<>"']|&(?!#?\w+;)/,pa=/[<>"']|&(?!#?\w+;)/g,ha={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},fa=e=>ha[e];function da(e,t){if(t){if(ca.test(e))return e.replace(la,fa)}else if(ua.test(e))return e.replace(pa,fa);return e}const ya=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function ba(e){return e.replace(ya,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const ma=/(^|[^\[])\^/g;function ga(e,t){e=e.source||e,t=t||"";const n={replace:(t,r)=>(r=(r=r.source||r).replace(ma,"$1"),e=e.replace(t,r),n),getRegex:()=>new RegExp(e,t)};return n}const va=/[^\w:]/g,Oa=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function wa(e,t,n){if(e){let e;try{e=decodeURIComponent(ba(n)).replace(va,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!Oa.test(n)&&(n=function(e,t){ja[" "+e]||(_a.test(e)?ja[" "+e]=e+"/":ja[" "+e]=Pa(e,"/",!0));const n=-1===(e=ja[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(xa,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(Ea,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}const ja={},_a=/^[^:]+:\/*[^/]*$/,xa=/^([^:]+:)[\s\S]*$/,Ea=/^([^:]+:\/*[^/]*)[\s\S]*$/,Sa={exec:function(){}};function Ta(e){let t,n,r=1;for(;r<arguments.length;r++)for(n in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function ka(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let r=!1,o=t;for(;--o>=0&&"\\"===n[o];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function Pa(e,t,n){const r=e.length;if(0===r)return"";let o=0;for(;o<r;){const i=e.charAt(r-o-1);if(i!==t||n){if(i===t||!n)break;o++}else o++}return e.substr(0,r-o)}function Ca(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function Aa(e,t){if(t<1)return"";let n="";for(;t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function Ia(e,t,n,r){const o=t.href,i=t.title?da(t.title):null,s=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:o,title:i,text:s,tokens:r.inlineTokens(s,[])};return r.state.inLink=!1,e}return{type:"image",raw:n,href:o,title:i,text:da(s)}}class Na{constructor(e){this.options=e||aa}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Pa(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const r=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim():t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Pa(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}const n={type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(e,[]),text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,r,o,i,s,a,c,l,u,p,h,f,d=t[1].trim();const y=d.length>1,b={type:"list",raw:"",ordered:y,start:y?+d.slice(0,-1):"",loose:!1,items:[]};d=y?`\\d{1,9}\\${d.slice(-1)}`:`\\${d}`,this.options.pedantic&&(d=y?d:"[*+-]");const m=new RegExp(`^( {0,3}${d})((?: [^\\n]*)?(?:\\n|$))`);for(;e&&(f=!1,t=m.exec(e))&&!this.rules.block.hr.test(e);){if(n=t[0],e=e.substring(n.length),l=t[2].split("\n",1)[0],u=e.split("\n",1)[0],this.options.pedantic?(i=2,h=l.trimLeft()):(i=t[2].search(/[^ ]/),i=i>4?1:i,h=l.slice(i),i+=t[1].length),a=!1,!l&&/^ *$/.test(u)&&(n+=u+"\n",e=e.substring(u.length+1),f=!0),!f){const t=new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(;e&&(p=e.split("\n",1)[0],l=p,this.options.pedantic&&(l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!t.test(l));){if(l.search(/[^ ]/)>=i||!l.trim())h+="\n"+l.slice(i);else{if(a)break;h+="\n"+l}a||l.trim()||(a=!0),n+=p+"\n",e=e.substring(p.length+1)}}b.loose||(c?b.loose=!0:/\n *\n *$/.test(n)&&(c=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(h),r&&(o="[ ] "!==r[0],h=h.replace(/^\[[ xX]\] +/,""))),b.items.push({type:"list_item",raw:n,task:!!r,checked:o,loose:!1,text:h}),b.raw+=n}b.items[b.items.length-1].raw=n.trimRight(),b.items[b.items.length-1].text=h.trimRight(),b.raw=b.raw.trimRight();const g=b.items.length;for(s=0;s<g;s++){this.lexer.state.top=!1,b.items[s].tokens=this.lexer.blockTokens(b.items[s].text,[]);const e=b.items[s].tokens.filter((e=>"space"===e.type)),t=e.every((e=>{const t=e.raw.split("");let n=0;for(const e of t)if("\n"===e&&(n+=1),n>1)return!0;return!1}));!b.loose&&e.length&&t&&(b.loose=!0,b.items[s].loose=!0)}return b}}html(e){const t=this.rules.block.html.exec(e);if(t){const e={type:"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};return this.options.sanitize&&(e.type="paragraph",e.text=this.options.sanitizer?this.options.sanitizer(t[0]):da(t[0]),e.tokens=[],this.lexer.inline(e.text,e.tokens)),e}}def(e){const t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:ka(t[1]).map((e=>({text:e}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let n,r,o,i,s=e.align.length;for(n=0;n<s;n++)/^ *-+: *$/.test(e.align[n])?e.align[n]="right":/^ *:-+: *$/.test(e.align[n])?e.align[n]="center":/^ *:-+ *$/.test(e.align[n])?e.align[n]="left":e.align[n]=null;for(s=e.rows.length,n=0;n<s;n++)e.rows[n]=ka(e.rows[n],e.header.length).map((e=>({text:e})));for(s=e.header.length,r=0;r<s;r++)e.header[r].tokens=[],this.lexer.inlineTokens(e.header[r].text,e.header[r].tokens);for(s=e.rows.length,r=0;r<s;r++)for(i=e.rows[r],o=0;o<i.length;o++)i[o].tokens=[],this.lexer.inlineTokens(i[o].text,i[o].tokens);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t){const e={type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e={type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}text(e){const t=this.rules.block.text.exec(e);if(t){const e={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:da(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):da(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Pa(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let r=0,o=0;for(;o<n;o++)if("\\"===e[o])o++;else if(e[o]===t[0])r++;else if(e[o]===t[1]&&(r--,r<0))return o;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),Ia(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:r?r.replace(this.rules.inline._escapes,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e||!e.href){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return Ia(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrong.lDelim.exec(e);if(!r)return;if(r[3]&&n.match(/[\p{L}\p{N}]/u))return;const o=r[1]||r[2]||"";if(!o||o&&(""===n||this.rules.inline.punctuation.exec(n))){const n=r[0].length-1;let o,i,s=n,a=0;const c="*"===r[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=c.exec(t));){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(i=o.length,r[3]||r[4]){s+=i;continue}if((r[5]||r[6])&&n%3&&!((n+i)%3)){a+=i;continue}if(s-=i,s>0)continue;if(i=Math.min(i,i+s+a),Math.min(n,i)%2){const t=e.slice(1,n+r.index+i);return{type:"em",raw:e.slice(0,n+r.index+i+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}const t=e.slice(2,n+r.index+i-1);return{type:"strong",raw:e.slice(0,n+r.index+i+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=da(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,r;return"@"===n[2]?(e=da(this.options.mangle?t(n[1]):n[1]),r="mailto:"+e):(e=da(n[1]),r=e),{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,r;if("@"===n[2])e=da(this.options.mangle?t(n[0]):n[0]),r="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=da(n[0]),r="www."===n[1]?"http://"+e:e}return{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):da(n[0]):n[0]:da(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const Da={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Sa,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Da.def=ga(Da.def).replace("label",Da._label).replace("title",Da._title).getRegex(),Da.bullet=/(?:[*+-]|\d{1,9}[.)])/,Da.listItemStart=ga(/^( *)(bull) */).replace("bull",Da.bullet).getRegex(),Da.list=ga(Da.list).replace(/bull/g,Da.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Da.def.source+")").getRegex(),Da._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Da._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Da.html=ga(Da.html,"i").replace("comment",Da._comment).replace("tag",Da._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Da.paragraph=ga(Da._paragraph).replace("hr",Da.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Da._tag).getRegex(),Da.blockquote=ga(Da.blockquote).replace("paragraph",Da.paragraph).getRegex(),Da.normal=Ta({},Da),Da.gfm=Ta({},Da.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Da.gfm.table=ga(Da.gfm.table).replace("hr",Da.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Da._tag).getRegex(),Da.gfm.paragraph=ga(Da._paragraph).replace("hr",Da.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Da.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Da._tag).getRegex(),Da.pedantic=Ta({},Da.normal,{html:ga("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Da._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Sa,paragraph:ga(Da.normal._paragraph).replace("hr",Da.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Da.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const Ra={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Sa,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Sa,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function La(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Ua(e){let t,n,r="";const o=e.length;for(t=0;t<o;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}Ra._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Ra.punctuation=ga(Ra.punctuation).replace(/punctuation/g,Ra._punctuation).getRegex(),Ra.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Ra.escapedEmSt=/\\\*|\\_/g,Ra._comment=ga(Da._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ra.emStrong.lDelim=ga(Ra.emStrong.lDelim).replace(/punct/g,Ra._punctuation).getRegex(),Ra.emStrong.rDelimAst=ga(Ra.emStrong.rDelimAst,"g").replace(/punct/g,Ra._punctuation).getRegex(),Ra.emStrong.rDelimUnd=ga(Ra.emStrong.rDelimUnd,"g").replace(/punct/g,Ra._punctuation).getRegex(),Ra._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Ra._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Ra._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Ra.autolink=ga(Ra.autolink).replace("scheme",Ra._scheme).replace("email",Ra._email).getRegex(),Ra._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Ra.tag=ga(Ra.tag).replace("comment",Ra._comment).replace("attribute",Ra._attribute).getRegex(),Ra._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ra._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Ra._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Ra.link=ga(Ra.link).replace("label",Ra._label).replace("href",Ra._href).replace("title",Ra._title).getRegex(),Ra.reflink=ga(Ra.reflink).replace("label",Ra._label).replace("ref",Da._label).getRegex(),Ra.nolink=ga(Ra.nolink).replace("ref",Da._label).getRegex(),Ra.reflinkSearch=ga(Ra.reflinkSearch,"g").replace("reflink",Ra.reflink).replace("nolink",Ra.nolink).getRegex(),Ra.normal=Ta({},Ra),Ra.pedantic=Ta({},Ra.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ga(/^!?\[(label)\]\((.*?)\)/).replace("label",Ra._label).getRegex(),reflink:ga(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ra._label).getRegex()}),Ra.gfm=Ta({},Ra.normal,{escape:ga(Ra.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Ra.gfm.url=ga(Ra.gfm.url,"i").replace("email",Ra.gfm._extended_email).getRegex(),Ra.breaks=Ta({},Ra.gfm,{br:ga(Ra.br).replace("{2,}","*").getRegex(),text:ga(Ra.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});class Ma{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||aa,this.options.tokenizer=this.options.tokenizer||new Na,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Da.normal,inline:Ra.normal};this.options.pedantic?(t.block=Da.pedantic,t.inline=Ra.pedantic):this.options.gfm&&(t.block=Da.gfm,this.options.breaks?t.inline=Ra.breaks:t.inline=Ra.gfm),this.tokenizer.rules=t}static get rules(){return{block:Da,inline:Ra}}static lex(e,t){return new Ma(t).lex(e)}static lexInline(e,t){return new Ma(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,r,o,i;for(this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?t.push(n):(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach((function(e){r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o)))r=t[t.length-1],i&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),i=o.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t){this.inlineQueue.push({src:e,tokens:t})}inlineTokens(e,t=[]){let n,r,o,i,s,a,c=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(c));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,i.index)+"["+Aa("a",i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,i.index)+"["+Aa("a",i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.escapedEmSt.exec(c));)c=c.slice(0,i.index)+"++"+c.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(s||(a=""),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,c,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,Ua))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,Ua))){if(o=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach((function(e){r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(o,La))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),s=!0,r=t[t.length-1],r&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class za{constructor(e){this.options=e||aa}code(e,t,n){const r=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,r);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",r?'<pre><code class="'+this.options.langPrefix+da(r,!0)+'">'+(n?e:da(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:da(e,!0))+"</code></pre>\n"}blockquote(e){return"<blockquote>\n"+e+"</blockquote>\n"}html(e){return e}heading(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}hr(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}list(e,t,n){const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}listitem(e){return"<li>"+e+"</li>\n"}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return"<p>"+e+"</p>\n"}table(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return"<tr>\n"+e+"</tr>\n"}tablecell(e,t){const n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,t,n){if(null===(e=wa(this.options.sanitize,this.options.baseUrl,e)))return n;let r='<a href="'+da(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){if(null===(e=wa(this.options.sanitize,this.options.baseUrl,e)))return n;let r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">",r}text(e){return e}}class $a{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Ba{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,r=0;if(this.seen.hasOwnProperty(n)){r=this.seen[e];do{r++,n=e+"-"+r}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=r,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class Fa{constructor(e){this.options=e||aa,this.options.renderer=this.options.renderer||new za,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $a,this.slugger=new Ba}static parse(e,t){return new Fa(t).parse(e)}static parseInline(e,t){return new Fa(t).parseInline(e)}parse(e,t=!0){let n,r,o,i,s,a,c,l,u,p,h,f,d,y,b,m,g,v,O,w="";const j=e.length;for(n=0;n<j;n++)if(p=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[p.type]&&(O=this.options.extensions.renderers[p.type].call({parser:this},p),!1!==O||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)))w+=O||"";else switch(p.type){case"space":continue;case"hr":w+=this.renderer.hr();continue;case"heading":w+=this.renderer.heading(this.parseInline(p.tokens),p.depth,ba(this.parseInline(p.tokens,this.textRenderer)),this.slugger);continue;case"code":w+=this.renderer.code(p.text,p.lang,p.escaped);continue;case"table":for(l="",c="",i=p.header.length,r=0;r<i;r++)c+=this.renderer.tablecell(this.parseInline(p.header[r].tokens),{header:!0,align:p.align[r]});for(l+=this.renderer.tablerow(c),u="",i=p.rows.length,r=0;r<i;r++){for(a=p.rows[r],c="",s=a.length,o=0;o<s;o++)c+=this.renderer.tablecell(this.parseInline(a[o].tokens),{header:!1,align:p.align[o]});u+=this.renderer.tablerow(c)}w+=this.renderer.table(l,u);continue;case"blockquote":u=this.parse(p.tokens),w+=this.renderer.blockquote(u);continue;case"list":for(h=p.ordered,f=p.start,d=p.loose,i=p.items.length,u="",r=0;r<i;r++)b=p.items[r],m=b.checked,g=b.task,y="",b.task&&(v=this.renderer.checkbox(m),d?b.tokens.length>0&&"paragraph"===b.tokens[0].type?(b.tokens[0].text=v+" "+b.tokens[0].text,b.tokens[0].tokens&&b.tokens[0].tokens.length>0&&"text"===b.tokens[0].tokens[0].type&&(b.tokens[0].tokens[0].text=v+" "+b.tokens[0].tokens[0].text)):b.tokens.unshift({type:"text",text:v}):y+=v),y+=this.parse(b.tokens,d),u+=this.renderer.listitem(y,g,m);w+=this.renderer.list(u,h,f);continue;case"html":w+=this.renderer.html(p.text);continue;case"paragraph":w+=this.renderer.paragraph(this.parseInline(p.tokens));continue;case"text":for(u=p.tokens?this.parseInline(p.tokens):p.text;n+1<j&&"text"===e[n+1].type;)p=e[++n],u+="\n"+(p.tokens?this.parseInline(p.tokens):p.text);w+=t?this.renderer.paragraph(u):u;continue;default:{const e='Token with "'+p.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return w}parseInline(e,t){t=t||this.renderer;let n,r,o,i="";const s=e.length;for(n=0;n<s;n++)if(r=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]&&(o=this.options.extensions.renderers[r.type].call({parser:this},r),!1!==o||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)))i+=o||"";else switch(r.type){case"escape":i+=t.text(r.text);break;case"html":i+=t.html(r.text);break;case"link":i+=t.link(r.href,r.title,this.parseInline(r.tokens,t));break;case"image":i+=t.image(r.href,r.title,r.text);break;case"strong":i+=t.strong(this.parseInline(r.tokens,t));break;case"em":i+=t.em(this.parseInline(r.tokens,t));break;case"codespan":i+=t.codespan(r.text);break;case"br":i+=t.br();break;case"del":i+=t.del(this.parseInline(r.tokens,t));break;case"text":i+=t.text(r.text);break;default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return i}}function Ha(e,t,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(n=t,t=null),Ca(t=Ta({},Ha.defaults,t||{})),n){const r=t.highlight;let o;try{o=Ma.lex(e,t)}catch(e){return n(e)}const i=function(e){let i;if(!e)try{t.walkTokens&&Ha.walkTokens(o,t.walkTokens),i=Fa.parse(o,t)}catch(t){e=t}return t.highlight=r,e?n(e):n(null,i)};if(!r||r.length<3)return i();if(delete t.highlight,!o.length)return i();let s=0;return Ha.walkTokens(o,(function(e){"code"===e.type&&(s++,setTimeout((()=>{r(e.text,e.lang,(function(t,n){if(t)return i(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),s--,0===s&&i()}))}),0))})),void(0===s&&i())}try{const n=Ma.lex(e,t);return t.walkTokens&&Ha.walkTokens(n,t.walkTokens),Fa.parse(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+da(e.message+"",!0)+"</pre>";throw e}}Ha.options=Ha.setOptions=function(e){var t;return Ta(Ha.defaults,e),t=Ha.defaults,aa=t,Ha},Ha.getDefaults=function(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}},Ha.defaults=aa,Ha.use=function(...e){const t=Ta({},...e),n=Ha.defaults.extensions||{renderers:{},childTokens:{}};let r;e.forEach((e=>{if(e.extensions&&(r=!0,e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const t=n.renderers?n.renderers[e.name]:null;n.renderers[e.name]=t?function(...n){let r=e.renderer.apply(this,n);return!1===r&&(r=t.apply(this,n)),r}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");n[e.level]?n[e.level].unshift(e.tokenizer):n[e.level]=[e.tokenizer],e.start&&("block"===e.level?n.startBlock?n.startBlock.push(e.start):n.startBlock=[e.start]:"inline"===e.level&&(n.startInline?n.startInline.push(e.start):n.startInline=[e.start]))}e.childTokens&&(n.childTokens[e.name]=e.childTokens)}))),e.renderer){const n=Ha.defaults.renderer||new za;for(const t in e.renderer){const r=n[t];n[t]=(...o)=>{let i=e.renderer[t].apply(n,o);return!1===i&&(i=r.apply(n,o)),i}}t.renderer=n}if(e.tokenizer){const n=Ha.defaults.tokenizer||new Na;for(const t in e.tokenizer){const r=n[t];n[t]=(...o)=>{let i=e.tokenizer[t].apply(n,o);return!1===i&&(i=r.apply(n,o)),i}}t.tokenizer=n}if(e.walkTokens){const n=Ha.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens.call(this,t),n&&n.call(this,t)}}r&&(t.extensions=n),Ha.setOptions(t)}))},Ha.walkTokens=function(e,t){for(const n of e)switch(t.call(Ha,n),n.type){case"table":for(const e of n.header)Ha.walkTokens(e.tokens,t);for(const e of n.rows)for(const n of e)Ha.walkTokens(n.tokens,t);break;case"list":Ha.walkTokens(n.items,t);break;default:Ha.defaults.extensions&&Ha.defaults.extensions.childTokens&&Ha.defaults.extensions.childTokens[n.type]?Ha.defaults.extensions.childTokens[n.type].forEach((function(e){Ha.walkTokens(n[e],t)})):n.tokens&&Ha.walkTokens(n.tokens,t)}},Ha.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");Ca(t=Ta({},Ha.defaults,t||{}));try{const n=Ma.lexInline(e,t);return t.walkTokens&&Ha.walkTokens(n,t.walkTokens),Fa.parseInline(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+da(e.message+"",!0)+"</pre>";throw e}},Ha.Parser=Fa,Ha.parser=Fa.parse,Ha.Renderer=za,Ha.TextRenderer=$a,Ha.Lexer=Ma,Ha.lexer=Ma.lex,Ha.Tokenizer=Na,Ha.Slugger=Ba,Ha.parse=Ha,Ha.options,Ha.setOptions,Ha.use,Ha.walkTokens,Ha.parseInline,Fa.parse,Ma.lex;const qa=e=>{try{return Ha(e)}catch(t){return console.log("Could not parse message",e,t),""}},Va=e=>{const{sendAction:t}=go();return n=>{n.target&&n.target.dataset.linkId&&t({type:"navigate",originMessage:e,link:{id:n.target.dataset.linkId,url:n.target.getAttribute("href")}})}};var Wa=Object.prototype.toString,Ga=Array.isArray||function(e){return"[object Array]"===Wa.call(e)};function Ka(e){return"function"==typeof e}function Ya(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ja(e,t){return null!=e&&"object"==typeof e&&t in e}var Qa=RegExp.prototype.test,Za=/\S/;var Xa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"},ec=/\s*/,tc=/\s+/,nc=/\s*=/,rc=/\s*\}/,oc=/#|\^|\/|>|\{|&|=|!/;function ic(e){this.string=e,this.tail=e,this.pos=0}function sc(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function ac(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}ic.prototype.eos=function(){return""===this.tail},ic.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},ic.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},sc.prototype.push=function(e){return new sc(e,this)},sc.prototype.lookup=function(e){var t,n,r,o=this.cache;if(o.hasOwnProperty(e))t=o[e];else{for(var i,s,a,c=this,l=!1;c;){if(e.indexOf(".")>0)for(i=c.view,s=e.split("."),a=0;null!=i&&a<s.length;)a===s.length-1&&(l=Ja(i,s[a])||(n=i,r=s[a],null!=n&&"object"!=typeof n&&n.hasOwnProperty&&n.hasOwnProperty(r))),i=i[s[a++]];else i=c.view[e],l=Ja(c.view,e);if(l){t=i;break}c=c.parent}o[e]=t}return Ka(t)&&(t=t.call(this.view)),t},ac.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},ac.prototype.parse=function(e,t){var n=this.templateCache,r=e+":"+(t||cc.tags).join(":"),o=void 0!==n,i=o?n.get(r):void 0;return null==i&&(i=function(e,t){if(!e)return[];var n,r,o,i,s=!1,a=[],c=[],l=[],u=!1,p=!1,h="",f=0;function d(){if(u&&!p)for(;l.length;)delete c[l.pop()];else l=[];u=!1,p=!1}function y(e){if("string"==typeof e&&(e=e.split(tc,2)),!Ga(e)||2!==e.length)throw new Error("Invalid tags: "+e);n=new RegExp(Ya(e[0])+"\\s*"),r=new RegExp("\\s*"+Ya(e[1])),o=new RegExp("\\s*"+Ya("}"+e[1]))}y(t||cc.tags);for(var b,m,g,v,O,w,j=new ic(e);!j.eos();){if(b=j.pos,g=j.scanUntil(n))for(var _=0,x=g.length;_<x;++_)i=v=g.charAt(_),function(e,t){return Qa.call(e,t)}(Za,i)?(p=!0,s=!0,h+=" "):(l.push(c.length),h+=v),c.push(["text",v,b,b+1]),b+=1,"\n"===v&&(d(),h="",f=0,s=!1);if(!j.scan(n))break;if(u=!0,m=j.scan(oc)||"name",j.scan(ec),"="===m?(g=j.scanUntil(nc),j.scan(nc),j.scanUntil(r)):"{"===m?(g=j.scanUntil(o),j.scan(rc),j.scanUntil(r),m="&"):g=j.scanUntil(r),!j.scan(r))throw new Error("Unclosed tag at "+j.pos);if(O=">"==m?[m,g,b,j.pos,h,f,s]:[m,g,b,j.pos],f++,c.push(O),"#"===m||"^"===m)a.push(O);else if("/"===m){if(!(w=a.pop()))throw new Error('Unopened section "'+g+'" at '+b);if(w[1]!==g)throw new Error('Unclosed section "'+w[1]+'" at '+b)}else"name"===m||"{"===m||"&"===m?p=!0:"="===m&&y(g)}if(d(),w=a.pop())throw new Error('Unclosed section "'+w[1]+'" at '+j.pos);return function(e){for(var t,n=[],r=n,o=[],i=0,s=e.length;i<s;++i)switch((t=e[i])[0]){case"#":case"^":r.push(t),o.push(t),r=t[4]=[];break;case"/":o.pop()[5]=t[2],r=o.length>0?o[o.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],o=0,i=e.length;o<i;++o)(t=e[o])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(c))}(e,t),o&&n.set(r,i)),i},ac.prototype.render=function(e,t,n,r){var o=this.getConfigTags(r),i=this.parse(e,o),s=t instanceof sc?t:new sc(t,void 0);return this.renderTokens(i,s,n,e,r)},ac.prototype.renderTokens=function(e,t,n,r,o){for(var i,s,a,c="",l=0,u=e.length;l<u;++l)a=void 0,"#"===(s=(i=e[l])[0])?a=this.renderSection(i,t,n,r,o):"^"===s?a=this.renderInverted(i,t,n,r,o):">"===s?a=this.renderPartial(i,t,n,o):"&"===s?a=this.unescapedValue(i,t):"name"===s?a=this.escapedValue(i,t,o):"text"===s&&(a=this.rawValue(i)),void 0!==a&&(c+=a);return c},ac.prototype.renderSection=function(e,t,n,r,o){var i=this,s="",a=t.lookup(e[1]);if(a){if(Ga(a))for(var c=0,l=a.length;c<l;++c)s+=this.renderTokens(e[4],t.push(a[c]),n,r,o);else if("object"==typeof a||"string"==typeof a||"number"==typeof a)s+=this.renderTokens(e[4],t.push(a),n,r,o);else if(Ka(a)){if("string"!=typeof r)throw new Error("Cannot use higher-order sections without the original template");null!=(a=a.call(t.view,r.slice(e[3],e[5]),(function(e){return i.render(e,t,n,o)})))&&(s+=a)}else s+=this.renderTokens(e[4],t,n,r,o);return s}},ac.prototype.renderInverted=function(e,t,n,r,o){var i=t.lookup(e[1]);if(!i||Ga(i)&&0===i.length)return this.renderTokens(e[4],t,n,r,o)},ac.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),o=e.split("\n"),i=0;i<o.length;i++)o[i].length&&(i>0||!n)&&(o[i]=r+o[i]);return o.join("\n")},ac.prototype.renderPartial=function(e,t,n,r){if(n){var o=this.getConfigTags(r),i=Ka(n)?n(e[1]):n[e[1]];if(null!=i){var s=e[6],a=e[5],c=e[4],l=i;0==a&&c&&(l=this.indentPartial(i,c,s));var u=this.parse(l,o);return this.renderTokens(u,t,n,l,r)}}},ac.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},ac.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||cc.escape,o=t.lookup(e[1]);if(null!=o)return"number"==typeof o&&r===cc.escape?String(o):r(o)},ac.prototype.rawValue=function(e){return e[1]},ac.prototype.getConfigTags=function(e){return Ga(e)?e:e&&"object"==typeof e?e.tags:void 0},ac.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!Ga(e)?e.escape:void 0};var cc={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){lc.templateCache=e},get templateCache(){return lc.templateCache}},lc=new ac;cc.clearCache=function(){return lc.clearCache()},cc.parse=function(e,t){return lc.parse(e,t)},cc.render=function(e,t,n,r){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(Ga(o=e)?"array":typeof o)+'" was given as the first argument for mustache#render(template, view, partials)');var o;return lc.render(e,t,n,r)},cc.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return Xa[e]}))},cc.Scanner=ic,cc.Context=sc,cc.Writer=ac;const uc=cc;function pc(e,t={}){const n={};Object.entries(t).forEach((([e,t])=>{switch(t.type){case"link":n[e]=(e=>`<a href='${e.url}' data-link-id='${e.id}' ${e.newTab?'target="_blank"':""}>${e.name}</a>`)(t);break;case"text":n[e]=t.value}}),{});const r=uc.escape;uc.escape=function(e){return e};const o=uc.render(e,n);return uc.escape=r,o}uc.escape=function(e){return e};const hc=["event"];function fc(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 dc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fc(Object(n),!0).forEach((function(t){yc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const bc=e=>{let{event:t}=e,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,hc);const[r]=oi(t),o=Va(t.payload.id),s=(0,i.useMemo)((()=>t.payload.fromClient?{children:(0,L.jsx)("p",{children:r.text})}:{bodyProps:{dangerouslySetInnerHTML:{__html:pc(qa(r.text),r.variables)}}}),[r,t]);return(0,L.jsx)(ta,dc(dc({type:"text",event:t,onClick:o},n),s))};var mc=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],gc=mc.join(","),vc="undefined"==typeof Element?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Oc=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?function(e){return"true"===e.contentEditable}(e)?0:"AUDIO"!==e.nodeName&&"VIDEO"!==e.nodeName&&"DETAILS"!==e.nodeName||null!==e.getAttribute("tabindex")?e.tabIndex:0:t},wc=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},jc=function(e){return"INPUT"===e.tagName},_c=function(e,t){return!(t.disabled||function(e){return jc(e)&&"hidden"===e.type}(t)||function(e,t){if("hidden"===getComputedStyle(e).visibility)return!0;var n=vc.call(e,"details>summary:first-of-type")?e.parentElement:e;if(vc.call(n,"details:not([open]) *"))return!0;if(t&&"full"!==t){if("non-zero-area"===t){var r=e.getBoundingClientRect(),o=r.width,i=r.height;return 0===o&&0===i}}else for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(t,e.displayCheck)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(jc(e)||"SELECT"===e.tagName||"TEXTAREA"===e.tagName||"BUTTON"===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!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},xc=function(e,t){return!(!_c(e,t)||function(e){return function(e){return jc(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||e.ownerDocument,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)||Oc(t)<0)},Ec=mc.concat("iframe").join(","),Sc=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==vc.call(e,Ec)&&_c(t,e)};function Tc(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 kc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pc,Cc=(Pc=[],{activateTrap:function(e){if(Pc.length>0){var t=Pc[Pc.length-1];t!==e&&t.pause()}var n=Pc.indexOf(e);-1===n||Pc.splice(n,1),Pc.push(e)},deactivateTrap:function(e){var t=Pc.indexOf(e);-1!==t&&Pc.splice(t,1),Pc.length>0&&Pc[Pc.length-1].unpause()}}),Ac=function(e){return setTimeout(e,0)},Ic=function(e,t){var n=-1;return e.every((function(e,r){return!t(e)||(n=r,!1)})),n},Nc=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},Dc=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},Rc=function(e,t){var n,r=(null==t?void 0:t.document)||document,o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tc(Object(n),!0).forEach((function(t){kc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},s=function(e,t,n){return e&&void 0!==e[t]?e[t]:o[n||t]},a=function(e){return!(!e||!i.containers.some((function(t){return t.contains(e)})))},c=function(e){var t=o[e];if("function"==typeof t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];t=t.apply(void 0,i)}if(!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var a=t;if("string"==typeof t&&!(a=r.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return a},l=function(){var e=c("initialFocus");if(!1===e)return!1;if(void 0===e)if(a(r.activeElement))e=r.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},u=function(){if(i.tabbableGroups=i.containers.map((function(e){var t,n,r,o=(n=[],r=[],function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(gc));return t&&vc.call(e,gc)&&r.unshift(e),r.filter(n)}(e,(t=t||{}).includeContainer,xc.bind(null,t)).forEach((function(e,t){var o=Oc(e);0===o?n.push(e):r.push({documentOrder:t,tabIndex:o,node:e})})),r.sort(wc).map((function(e){return e.node})).concat(n));if(o.length>0)return{container:e,firstTabbableNode:o[0],lastTabbableNode:o[o.length-1]}})).filter((function(e){return!!e})),i.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},p=function e(t){!1!==t&&t!==r.activeElement&&(t&&t.focus?(t.focus({preventScroll:!!o.preventScroll}),i.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(l()))},h=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},f=function(e){var t=Dc(e);a(t)||(Nc(o.clickOutsideDeactivates,e)?n.deactivate({returnFocus:o.returnFocusOnDeactivate&&!Sc(t)}):Nc(o.allowOutsideClick,e)||e.preventDefault())},d=function(e){var t=Dc(e),n=a(t);n||t instanceof Document?n&&(i.mostRecentlyFocusedNode=t):(e.stopImmediatePropagation(),p(i.mostRecentlyFocusedNode||l()))},y=function(e){if(function(e){return"Escape"===e.key||"Esc"===e.key||27===e.keyCode}(e)&&!1!==Nc(o.escapeDeactivates,e))return e.preventDefault(),void n.deactivate();(function(e){return"Tab"===e.key||9===e.keyCode})(e)&&function(e){var t=Dc(e);u();var n=null;if(i.tabbableGroups.length>0){var r=Ic(i.tabbableGroups,(function(e){return e.container.contains(t)}));if(r<0)n=e.shiftKey?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var o=Ic(i.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(o<0&&i.tabbableGroups[r].container===t&&(o=r),o>=0){var s=0===o?i.tabbableGroups.length-1:o-1;n=i.tabbableGroups[s].lastTabbableNode}}else{var a=Ic(i.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(a<0&&i.tabbableGroups[r].container===t&&(a=r),a>=0){var l=a===i.tabbableGroups.length-1?0:a+1;n=i.tabbableGroups[l].firstTabbableNode}}}else n=c("fallbackFocus");n&&(e.preventDefault(),p(n))}(e)},b=function(e){if(!Nc(o.clickOutsideDeactivates,e)){var t=Dc(e);a(t)||Nc(o.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())}},m=function(){if(i.active)return Cc.activateTrap(n),i.delayInitialFocusTimer=o.delayInitialFocus?Ac((function(){p(l())})):p(l()),r.addEventListener("focusin",d,!0),r.addEventListener("mousedown",f,{capture:!0,passive:!1}),r.addEventListener("touchstart",f,{capture:!0,passive:!1}),r.addEventListener("click",b,{capture:!0,passive:!1}),r.addEventListener("keydown",y,{capture:!0,passive:!1}),n},g=function(){if(i.active)return r.removeEventListener("focusin",d,!0),r.removeEventListener("mousedown",f,!0),r.removeEventListener("touchstart",f,!0),r.removeEventListener("click",b,!0),r.removeEventListener("keydown",y,!0),n};return(n={activate:function(e){if(i.active)return this;var t=s(e,"onActivate"),n=s(e,"onPostActivate"),o=s(e,"checkCanFocusTrap");o||u(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,t&&t();var a=function(){o&&u(),m(),n&&n()};return o?(o(i.containers.concat()).then(a,a),this):(a(),this)},deactivate:function(e){if(!i.active)return this;clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,g(),i.active=!1,i.paused=!1,Cc.deactivateTrap(n);var t=s(e,"onDeactivate"),r=s(e,"onPostDeactivate"),o=s(e,"checkCanReturnFocus");t&&t();var a=s(e,"returnFocus","returnFocusOnDeactivate"),c=function(){Ac((function(){a&&p(h(i.nodeFocusedBeforeActivation)),r&&r()}))};return a&&o?(o(h(i.nodeFocusedBeforeActivation)).then(c,c),this):(c(),this)},pause:function(){return i.paused||!i.active||(i.paused=!0,g()),this},unpause:function(){return i.paused&&i.active?(i.paused=!1,u(),m(),this):this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return i.containers=t.map((function(e){return"string"==typeof e?r.querySelector(e):e})),i.active&&u(),this}}).updateContainerElements(e),n};function Lc(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 Uc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lc(Object(n),!0).forEach((function(t){Mc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const zc=({children:t,onClose:n,"aria-label":r,"aria-labelledby":o,fallBackFocusRef:s})=>{const a=$r(),c=(0,i.useRef)(null),l=(0,i.useRef)(null),[u,p]=(0,i.useState)(!1);return(0,i.useEffect)((()=>(u&&(l.current=Rc(c.current,{initialFocus:s&&s.current?s.current:null}),l.current.activate()),()=>{l.current&&l.current.deactivate()})),[u,s]),(0,i.useEffect)((()=>{const e=(()=>{const e=[],t=[];return document.querySelectorAll('body > *:not([role="dialog"])').forEach((n=>{const r=n.getAttribute("aria-hidden");null!==r&&"false"!==r||(e.push(r),t.push(n),n.setAttribute("aria-hidden","true"))})),()=>{t.forEach(((t,n)=>{const r=e[n];null===r?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r)}))}})();return()=>{e()}}),[u]),(0,i.useEffect)((()=>{u&&c.current.addEventListener("keydown",(e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&n()}))}),[u,n]),(0,i.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),o&&t.setAttribute("aria-labelledby",o),e.appendChild(t),c.current=t,p(!0),()=>{c.current&&(e.removeChild(c.current),c.current=null)}}),[r,o,a]),"function"==typeof t?t({onClose:n,modalRenderFn:t=>c.current&&(0,e.render)(t,c.current)}):c.current&&(0,e.render)((0,e.toChildArray)(t).map((e=>(e.props=Uc(Uc({},e.props),{},{onClose:n}),e))),c.current)},$c=({url:e,description:t,onClose:n})=>{const{zIndex:r,layoutMode:o,namespace:s}=ee(),a=jo(),c=Wn(),l=(0,i.useRef)(null),{t:u}=fr(),p=["modal",`app--layout-${o}`,`namespace--${s}`,...c],h=e=>{e.stopPropagation()},f=()=>{n()},d=r?{zIndex:r+1}:void 0;return(0,L.jsx)(zc,{onClose:n,"aria-label":u("lightbox.heading"),fallBackFocusRef:l,children:({onClose:n,modalRenderFn:r})=>r((n=>(0,L.jsx)("div",{className:Mn(p),onClick:f,style:d,children:(0,L.jsxs)("div",{className:Mn("modal__float"),tabIndex:"-1",onMouseDown:a,onKeyDown:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,ref:l,children:[(0,L.jsx)("div",{className:Mn("modal__inner"),onClick:h,children:(0,L.jsx)("img",{className:Mn("modal__image"),src:e,alt:t})}),(0,L.jsxs)("button",{type:"button",className:Mn("modal__close"),onClick:n,children:[(0,L.jsx)(hi,{name:"close",size:"16"}),u("lightbox.closeLabel")]})]})}))(n))})},Bc=({description:e,url:t})=>{const{t:n}=fr(),[r,o]=(0,i.useState)(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{type:"button",className:Mn("modal__enlarge"),onClick:()=>{o(!0)},children:[n("message.image.srTextEnlargeButtonLabel",{description:e}),(0,L.jsx)(hi,{name:"enlarge",size:"32"})]}),r&&(0,L.jsx)($c,{url:t,description:e,onClose:()=>{o(!1)}})]})},Fc=["event","descriptorId"];function Hc(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 qc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hc(Object(n),!0).forEach((function(t){Vc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Wc=["event","descriptorId"];function Gc(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 Kc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gc(Object(n),!0).forEach((function(t){Yc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Jc={[Ie.new_topic]:"newtopic"},Qc=["event"];function Zc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const el={default:({event:e})=>{const{t}=fr(),{subtype:n}=e.payload.body,r=Jc[Ie[n]];return(0,L.jsx)(qs,{dividerType:r,iconName:Ie[n],children:(0,L.jsx)("p",{children:t(`dividerKeys.${Ie[n]}`)})})},[Ie.new_translation]:({event:e})=>{const{t}=fr(),{translationEnabled:n,translationLocale:r,text:o}=e.payload.body,{enableTranslations:s,languages:a}=ri(),c=(0,i.useMemo)((()=>{var e;return null==a||null===(e=a.find((e=>e.locale===r)))||void 0===e?void 0:e.nativeName}),[a,r]);return(0,L.jsxs)(qs,{iconName:"newTranslation",dividerType:"newtranslation",children:[(0,L.jsx)("p",{className:Mn("divider__title"),children:t(n?"translations.divider.startText":"translations.divider.stopText",{language:c})}),n?(0,L.jsx)("p",{children:o}):(0,L.jsx)("button",{className:Mn("button","button--secondary"),onClick:()=>{s(r)},children:t("translations.divider.restartButtonText")})]})}},tl=["event"];function nl(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 rl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nl(Object(n),!0).forEach((function(t){ol(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ol(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const il=["event"];function sl(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 al(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sl(Object(n),!0).forEach((function(t){cl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ll=e=>{let{event:t}=e,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,il);const{payload:r}=t,[o]=oi(t),i=Va(r.id);return(0,L.jsx)(ta,al(al({type:"splash",event:t,onClick:i},n),{},{bodyProps:{dangerouslySetInnerHTML:{__html:pc(qa(o.text),o.variables)}}}))},ul=["event"];function pl(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 hl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pl(Object(n),!0).forEach((function(t){fl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dl=({children:e,url:t,target:n})=>t?(0,L.jsx)("a",{href:t,download:!0,target:n||void 0,children:e}):(0,L.jsx)("span",{children:e});function yl({items:e,currentIndex:t,onChange:n,getItemKey:r,getItemLabel:o}){const s=e.length,a=(0,i.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,L.jsx)("div",{className:Mn("carousel-pagination__wrapper"),role:"group",children:(0,L.jsx)("ul",{className:Mn("carousel-pagination"),children:e.map(((e,n)=>{const i=t===n;return(0,L.jsx)("li",{className:Mn("carousel-pagination__item",i?"is-active":void 0),children:(0,L.jsx)("button",{className:Mn("carousel-pagination__button"),type:"button",onClick:a,"data-item":n,"aria-disabled":i?"true":void 0,"aria-label":o(e,n)})},r(e,n,"pagination-item-"))}))})})}function bl({items:e,currentIndex:t,onChange:n,children:r}){const{t:o}=fr(),i=e.length;return(0,L.jsxs)("div",{className:Mn("carousel-controls"),children:[(0,L.jsx)("button",{className:Mn("button","button--previous"),"aria-label":o("carousel.controls.previous"),onClick:()=>{n((t-1+i)%i)},children:(0,L.jsx)(hi,{name:"arrowLeft",size:"16"})}),r,(0,L.jsx)("button",{className:Mn("button","button--next"),"aria-label":o("carousel.controls.next"),onClick:()=>{n((t+1)%i)},children:(0,L.jsx)(hi,{name:"arrowRight",size:"16"})})]})}function ml(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 gl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ml(Object(n),!0).forEach((function(t){vl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ol=({id:e,action:t,buttonText:n,description:r,hasFocus:o,image:s,title:a,isCarouselItem:c})=>{const l=(0,i.useRef)(null),{sendMessage:u,sendAction:p,emitEvent:h}=go(),f=$r(),d=(0,i.useRef)(),y=t.type===Re?"a":"button",b=(0,i.useCallback)((()=>h("action.click_card",{type:Pe,originMessage:e,action:t})),[h,e,t]),m=(0,i.useCallback)((()=>{if(b(),"ask"===t.type)u({body:t.ask});else if("topic"===t.type){const{topic:e,fallbackMessage:n}=t;p({type:"set_topic",body:{name:e,fallbackMessage:n}})}}),[u,t,p,b]),g=(0,i.useMemo)((()=>t.type===Re?{href:t.link,rel:"noopener noreferrer",target:t.newTab?"_blank":"_self",onClick:b}:{onClick:m}),[t,m,b]);return(0,i.useEffect)((()=>{c&&(o&&d.current?window.requestAnimationFrame((()=>l.current.focus())):l.current.blur()),d.current=!0}),[o,c]),(0,L.jsxs)("div",{className:Mn("card__wrapper"),id:e,tabIndex:"-1",ref:l,children:[(0,L.jsx)("img",{className:Mn("card__image"),src:s,alt:""}),(0,L.jsxs)("div",{className:Mn("card__content"),id:e,children:[a&&(0,L.jsx)("h2",{className:Mn("card__title"),children:a}),r&&(0,L.jsx)("div",{className:Mn("card__description"),dangerouslySetInnerHTML:{__html:qa(r)}}),(0,L.jsx)(y,gl(gl({tabIndex:c&&!o?"-1":void 0,className:Mn("button","button--primary"),"aria-describedby":f},g),{},{children:n}))]})]})};function wl(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 jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wl(Object(n),!0).forEach((function(t){_l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xl({item:e,items:t,index:n,isActive:r}){const{t:o}=fr();return(0,L.jsx)("div",{className:Mn("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,L.jsx)(Ol,jl(jl({},e),{},{isCarouselItem:!0,hasFocus:r}))})}const El=(e,t,n)=>`${n}${t}`,Sl=e=>e.label,Tl=({target:e})=>{e.scrollLeft=0};function kl({currentIndex:t,onChange:n,getItemKey:r=El,getItemLabel:o=Sl,items:s}){const a=$r(),c=s.length,[l,u]=(0,i.useState)(Number(t||"0"));(0,i.useEffect)((()=>{u(Number(t||"0"))}),[u,t]);const p=(0,i.useRef)([]);p.current=(0,i.useMemo)((()=>Array(c).fill(1).map((()=>(0,e.createRef)()))),[c]);const h=(0,i.useRef)(!0),f=(0,i.useRef)();return f.current=n,(0,i.useEffect)((()=>{h.current?h.current=!1:f.current&&f.current(l)}),[l]),(0,L.jsxs)("div",{className:Mn("carousel"),role:"group","aria-roledescription":"carousel",children:[(0,L.jsx)("div",{className:Mn("carousel__slides-wrapper"),onScroll:Tl,children:(0,L.jsx)("div",{id:a,className:Mn("carousel__slides"),style:{width:100*c+"%",left:-100*l+"%"},"aria-live":"polite","aria-atomic":"false",children:s.map(((e,t)=>{const n=l===t;return(0,L.jsx)("div",{ref:p.current[t],className:Mn("carousel__slide",n?"is-active":void 0),"aria-hidden":n?void 0:"true",children:(0,L.jsx)(xl,{item:e,items:s,currentIndex:l,index:t,isActive:n})},r(e,t,"item-"))}))})}),(0,L.jsx)("div",{className:Mn("carousel__controls"),children:(0,L.jsx)(bl,{currentIndex:l,items:s,onChange:u,controlId:a,children:(0,L.jsx)("div",{className:Mn("carousel__pagination"),children:(0,L.jsx)(yl,{currentIndex:l,items:s,onChange:u,getItemKey:r,getItemLabel:o})})})})]})}const Pl=(e,t,n="")=>`${n}${e.title}:${t}`,Cl=e=>e.title;function Al(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 Il(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Al(Object(n),!0).forEach((function(t){Nl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dl=["event"];function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ll(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rl(Object(n),!0).forEach((function(t){Ul(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ul(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ml(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 zl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ml(Object(n),!0).forEach((function(t){$l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ml(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Bl={message:{choice_prompt:t=>{let{event:n,children:r}=t,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,na);const{t:i}=fr(),s=$r(),{body:a,subEvent:c,showOptions:l,chooseAgain:u,onChoiceClickHandler:p,onChooseAgainClickHandler:h}=sa(n);return(0,L.jsxs)(L.Fragment,{children:[(0,e.toChildArray)(r).map((e=>(e.props=oa(oa({},e.props),{},{event:c,descriptorId:s,showTranslationToggle:!1}),e))),u&&(0,L.jsxs)("button",{type:"button",className:Mn("button","button--secondary","button--choose-again"),"aria-expanded":l?"true":"false",onClick:h,"aria-describedby":s,children:[i(l?"message.choicePrompts.cancelChooseAgain":"message.choicePrompts.chooseAgain"),(0,L.jsx)(hi,{name:"chevronDown",size:"8"})]}),l&&(0,L.jsx)(ta,oa(oa({type:"choice-prompt",showParticipant:!1,event:n},o),{},{children:(0,L.jsx)("ul",{className:Mn("choice-prompt","choice-prompt--many"),children:a.choices.map((e=>(0,L.jsx)("li",{className:Mn("choice-prompt__item",{[`choice-prompt__item--${e.category}`]:e.category}),children:(0,L.jsx)("button",{type:"button",className:Mn("button","button--primary"),onClick:()=>{p(e)},children:e.text})},e.id)))})}))]})},text:bc,image:e=>{let{event:t,descriptorId:n}=e,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Fc);const[o]=oi(t),{description:s,url:a,isZoomable:c}=o,[l,u]=(0,i.useState)(!1);return(0,L.jsxs)(ta,qc(qc({event:t,type:"image"},r),{},{children:[(0,L.jsx)("img",{src:a,id:n,alt:s,onLoad:()=>{u(!0)}}),c&&l&&(0,L.jsx)(Bc,{description:s,url:a})]}))},splash:ll,video:e=>{let{event:t,descriptorId:n}=e,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Wc);const[o]=oi(t),{description:i,url:s}=o;return Gn(t).push("message--type-video"),(0,L.jsxs)(ta,Kc(Kc({event:t,type:"video"},r),{},{children:[(0,L.jsx)("div",{id:n,className:Mn("visually-hidden"),children:i}),(0,L.jsx)("iframe",{title:i,src:s,allow:"autoplay; encrypted-media",allowFullScreen:!0})]}))},upload:e=>{let{event:t}=e,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,ul);const{t:r}=fr(),[o]=oi(t),{fromClient:s}=t.payload,{filename:a,url:c}=o,l=(0,i.useMemo)((()=>r(c?"fileUpload.srFileDownloadText":"fileUpload.srFileUploadedText",{fileName:a})),[c,a,r]);return(0,L.jsx)(ta,hl(hl({event:t,type:"upload"},n),{},{children:(0,L.jsxs)("div",{className:Mn("download"),children:[(0,L.jsx)(hi,{name:"download",size:"16"}),(0,L.jsxs)(dl,{url:c,target:s?void 0:"_blank",children:[(0,L.jsx)("span",{"aria-hidden":"true",className:Mn("file-download"),children:a}),(0,L.jsx)("span",{className:Mn("visually-hidden"),children:l})]})]})}))},cta:({event:e})=>{const[t]=oi(e),n=Va(e.payload.id),{emitEvent:r}=go(),o=$r(),s=(0,i.useCallback)((()=>r("action.click_cta",{type:Pe,originMessage:e.payload.id,link:{url:t.buttonLink}})),[r,t,e]);return(0,L.jsxs)(ta,{type:"cta",event:e,children:[(0,L.jsx)("div",{className:Mn("cta__content"),id:o,dangerouslySetInnerHTML:{__html:qa(t.description)},onClick:n}),(0,L.jsx)("a",{className:Mn("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[t]=oi(e),n=t.cards;return(0,L.jsx)(ta,{event:e,modifiers:"type-carousel",children:(0,L.jsx)(kl,{items:n,ItemComponent:xl,getItemKey:Pl,getItemLabel:Cl})})},card:({event:e})=>{const[t]=oi(e),n=$r();return(0,L.jsx)(ta,{type:"card",event:e,children:(0,L.jsx)(Ol,Il({id:n},t))})}},info:{text:bc,divider:e=>{let{event:t}=e,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Qc);const r=el[Ie[t.payload.body.subtype]]||el.default;return(0,L.jsx)(r,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zc(Object(n),!0).forEach((function(t){Xc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({event:t},n))},translation:e=>{let{event:t}=e,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,tl);const{t:r}=fr(),[o]=oi(t);return(0,L.jsx)(ta,rl(rl({type:"text",event:t},n),{},{children:r(o.key.join("."),o.variables)}))},timeIndicator:Gs},participant:{participant:({event:e})=>{const{agentIcon:t}=ee().defaults||{},{participant:n}=e.payload,[r]=oi(e),o=(0,i.useMemo)((()=>r?uc.render(qa(r),n):void 0),[r,n]);if(!o)return null;const s=n.avatar||t;return(0,L.jsx)(qs,{graphicSrc:s,graphicType:n.avatar?"avatar":void 0,iconName:s?void 0:"balloon",childrenHTML:o,dividerType:"participant"})}},service_data:{suggestion:e=>{let{event:t}=e,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Dl);const{userResponded:r}=ee(),[o,s]=(0,i.useState)(!0),{t:a}=fr(),c=a("suggestions.headingText"),l=a("suggestions.footerText"),{sendAction:u,addMessageBubble:p}=go(),{suggestions:h,payload:f}=(e=>{const{payload:t}=e,[n]=oi(e);return{suggestions:n,payload:t}})(t),d=(0,i.useCallback)((({id:e,question:t})=>{s(!1),u({type:xe,originMessage:f.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:t}}}),p(t)}),[f,u,p,s]);return!o||r?null:(0,L.jsxs)("div",{className:Mn("suggestions","suggestions--conversation"),children:[c&&(0,L.jsx)("p",{className:Mn("suggestions__heading"),children:c}),(0,L.jsxs)(ta,Ll(Ll({type:"suggestions",showParticipant:!1,event:t},n),{},{children:[(0,L.jsx)(Rs,{className:"suggestions__list--conversation",onClickSuggestion:d,suggestions:h}),l&&(0,L.jsx)("p",{className:Mn("suggestions__footer"),children:l})]}))]})}}},Fl=({children:e})=>{const{customComponents:t}=ee(),n=(0,i.useMemo)((()=>Object.keys(Bl).reduce(((e,n)=>zl(zl({},e),{},{[n]:zl(zl({},Bl[n]),t?t[n]:{})})),{fallback:bc})),[t]);return(0,L.jsx)(zs.Provider,{value:n,children:e})},Hl=()=>{const{t:e}=fr(),{showDisclaimer:t}=ee();return t&&(0,L.jsxs)("div",{className:Mn("disclaimer"),tabIndex:"0",children:[(0,L.jsx)("h2",{className:Mn("disclaimer__title"),children:e("disclaimer.title")}),(0,L.jsx)("div",{className:Mn("disclaimer__message"),dangerouslySetInnerHTML:{__html:e("disclaimer.content")}})]})},ql=()=>{const{t:e}=fr(),t=(0,i.useRef)(null),n=rn(),r=en().isLoading,{isOpen:o}=so(),s=an(),a=_r();return(0,i.useEffect)((()=>{window.requestAnimationFrame((()=>{t.current&&(t.current.scrollTop=t.current.scrollHeight)}))}),[n,r,o]),(0,L.jsxs)(L.Fragment,{children:[o&&(0,L.jsx)("a",{className:Mn("skip-link"),href:`#${s}`,onClick:e=>{e.preventDefault(),a()},children:e("skiplinkText")}),(0,L.jsx)("div",{className:Mn("chat__body"),ref:t,children:(0,L.jsxs)("div",{className:Mn("conversation__container"),children:[(0,L.jsx)(Hl,{}),(0,L.jsxs)("ol",{className:Mn("conversation"),children:[(0,L.jsx)(Fl,{children:(()=>{let e=null;return n.map((t=>{const{type:n,payload:r}=t,{participant:o,fromClient:i}=r;let s=!1;if("participant"!==n){const n=i?"seamly-client-participant":o;"info"!==t.type&&e!==n&&(s=!0),e=n}return(0,L.jsx)(Ks,{event:t,newParticipant:s},t.payload.id)}))})()}),r&&(0,L.jsx)(Js,{})]})]})})]})},Vl=({baseClassName:e,children:t,title:n})=>{const r=an(),o=$r();return(0,L.jsxs)("section",{id:r,className:Mn(e),"aria-describedby":o,tabIndex:"-1",children:[(0,L.jsx)("h2",{className:Mn(`${e}__title`),id:o,children:n}),t]})},Wl=()=>{const{t:e}=fr(),t=_r(),n=jo(),{emitEvent:r}=go(),{isActive:o,remaining:i,timer:s,endCountdown:a}=Mo(),c=i>0,l=e(c?"idleDetachWarning.countdownTitle":"idleDetachWarning.notifyTransferText");return(0,L.jsx)(Vl,{baseClassName:"idle",title:l,children:c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:Mn("idle__count-container"),children:o&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:Mn("idle__count-text"),children:e("idleDetachWarning.countdownText")}),(0,L.jsx)("span",{className:Mn("idle__count-timer"),children:e("idleDetachWarning.countdownTimer",s)})]})}),(0,L.jsxs)("div",{className:Mn("idle__options"),children:[(0,L.jsx)("button",{type:"button",className:Mn("button","button--primary"),onClick:()=>{n(),a(!0),t(),r("idleTimer.selectContinue")},children:e("idleDetachWarning.continueButton")}),(0,L.jsx)("button",{type:"button",className:Mn("button","button--primary"),onClick:()=>{a(),t(),r("idleTimer.selectEnd")},children:e("idleDetachWarning.detachButton")})]})]})})},Gl=()=>{const{t:e}=fr(),t=jo(),{name:n}=ln()||{},{continueChat:r,restartChat:o}=$o();return(0,L.jsx)(Vl,{baseClassName:"prompt",title:e("resumeConversationPrompt.title",{name:n}),children:(0,L.jsxs)("div",{className:Mn("prompt__options"),children:[(0,L.jsx)("button",{type:"button",className:Mn("button","button--primary"),onClick:()=>{t(),r()},children:e("resumeConversationPrompt.continueButton")}),(0,L.jsx)("button",{type:"button",className:Mn("button","button--primary"),onClick:o,children:e("resumeConversationPrompt.detachButton")})]})})},Kl=["id","name","type","labelText","labelClass","contentHint","aria-describedby"];function Yl(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 Jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yl(Object(n),!0).forEach((function(t){Ql(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Zl=function(e){let{id:t,name:n,type:r,labelText:o,labelClass:i,contentHint:s,"aria-describedby":a}=e,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Kl);const{isSubmitted:l}=Mi(),[u,{error:p}]=zi(n),h=l&&p,f=[];return a&&f.push(a),s&&f.push(`${t}-content-hint`),h&&f.push(`${t}-error`),(0,L.jsx)(os,{id:t,contentHint:s,validity:!h,errorText:p,labelText:o,labelClass:i,children:(0,L.jsx)("input",Jl(Jl({id:t,name:n,type:r,"aria-invalid":h?"true":"false","aria-describedby":f.join(" ")||null},u),c))})};function Xl({controlName:e,skipLinkId:t}){const{t:n}=fr(),{sendAssertive:r}=Oo(),{emitEvent:o}=go(),s=(()=>{const{sendAction:e}=go(),{features:t}=Ar(),{typingPeekahead:n}=t||{},r=(0,i.useRef)(null),o=(0,i.useRef)(null),s=(0,i.useRef)(!1),a=(0,i.useRef)(null);(0,i.useEffect)((()=>()=>{clearInterval(a.current),clearTimeout(r.current),clearTimeout(o.current)}),[]);const c=(t,r)=>{e(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_o(Object(n),!0).forEach((function(t){xo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:Ee,state:t},n&&n.enabled?{body:{currentMessage:r}}:{}))};return e=>{e.code&&"Enter"===e.code||13===e.keyCode||(s.current=!0,a.current||(c(!0,e.target.value),a.current=setInterval((()=>{s.current?n&&n.enabled&&c(!0,e.target.value):(clearInterval(a.current),a.current=null)}),2e3)),clearTimeout(r.current),clearTimeout(o.current),r.current=setTimeout((()=>{s.current=!1}),300),o.current=setTimeout((()=>{c(!1,e.target.value)}),2e3))}})(),{setBlockAutoEntrySwitch:a}=ko(),{hasCharacterLimit:c,characterLimit:l,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:h}=function(e){const{t}=fr(),{sendAssertive:n}=Oo(),{hasLimit:r,limit:o}=(()=>{const{entryMeta:{options:{text:e}}}=en(),{limit:t}=e||{};return{hasLimit:null!=t,limit:null!=t?t:null}})(),s=(0,i.useMemo)((()=>oe(n,300)),[n]),a=(0,i.useMemo)((()=>oe(((e,n)=>{e&&s(t("input.srCharacterLimitText",{limit:n}))}),300)),[s,t]),[{value:c}]=zi(e),l=r&&c?o-c.length:o,u=!!r&&l<=50,p=!!r&&l<0;return(0,i.useEffect)((()=>{a(u,l)}),[u,l,a]),{hasCharacterLimit:r,characterLimit:o,reachedCharacterWarning:u,reachedCharacterLimit:p,remainingChars:l}}(e),[{value:f}]=zi(e),d=!!f,y=(0,i.useCallback)((()=>{u&&r(n("input.srCharacterLimitText",{limit:h})),o("ui.inputFocus")}),[n,r,u,h,o]),b=(0,i.useMemo)((()=>n("input.inputPlaceholder",{hasLimit:c,limit:c?l:null})),[n,c,l]),m=(0,i.useMemo)((()=>n("input.inputLabel",{hasLimit:c,limit:c?l:null})),[n,c,l]);return(0,i.useLayoutEffect)((()=>(a(d),()=>{a(!1)})),[a,d]),(0,L.jsxs)(ns,{className:Mn("entry-form"),disableValidationClasses:!0,noValidate:"true",children:[(0,L.jsxs)("div",{className:Mn(["input--text__container",...u&&!p?["character-warning"]:[],...p?["character-exceeded"]:[]]),children:[(0,L.jsx)(Zl,{id:t,type:"text",name:e,className:Mn("input__text"),autocomplete:"off",placeholder:b,labelText:m,labelClass:Mn("visually-hidden"),"aria-invalid":c?p:null,onKeyUp:s,onFocus:y}),(0,L.jsx)("div",{className:Mn("character-count"),children:u&&(0,L.jsx)("span",{children:h})})]}),(0,L.jsx)("button",{className:Mn("button","input__submit"),type:"submit",disabled:!d||p,children:(0,L.jsx)(hi,{name:"send",size:"32",alt:n("input.sendMessage")})})]})}function eu(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 tu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eu(Object(n),!0).forEach((function(t){nu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ru(){return(ru=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const ou="userText";function iu(e){let t=ru({},e);const{isOpen:n,setVisibility:r}=so(),o=an(),s=_r(),{sendMessage:a}=go(),c=(0,i.useCallback)(((e,{updateControlValue:t})=>{a({body:e.userText}),t(ou,""),s(),n||r(T.open)}),[a,s,n,r]);return(0,L.jsx)(qi,tu(tu({},t),{},{formId:"textEntry",persistData:!0,onSubmit:c,children:(0,L.jsx)(Xl,{controlName:ou,skipLinkId:o})}))}const su=()=>{const{t:e}=fr(),{showFileUpload:t,serviceAllowsUploads:n}=Mr(),[r,o]=(0,i.useState)(n),s=_r(),a=(0,i.useRef)(null),{setUserEntryType:c,activeEntry:l}=ko(),u=(0,i.useRef)(null),{sendPolite:p}=Oo(),h=!!ln();return(0,i.useEffect)((()=>{de(u.current,(()=>{n||s()})),o(n)}),[n,s]),(0,i.useEffect)((()=>{a.current&&!n&&p(e("fileUpload.srUnavailableText")),!1===a.current&&n&&p(e("fileUpload.srAvailableText")),h&&(a.current=n)}),[n,h,p,e]),!t&&l!==we&&(0,L.jsx)(gi,{isActive:r,transitionStartState:bi,children:(0,L.jsx)("div",{className:Mn("upload-toggle-wrapper"),children:(0,L.jsx)(gi,{isActive:r,transitionStartState:mi,children:(0,L.jsx)("button",{className:Mn(["button","button--secondary","upload-toggle"]),ref:u,disabled:r?null:"true",type:"button",onClick:()=>{c(we),s()},children:(0,L.jsx)(hi,{name:"file",size:"32",alt:e("fileUpload.toggleButtonText")})})})})})},au=()=>{const{t:e}=fr(),{currentUploads:t}=zr();return(0,L.jsx)("div",{className:Mn("progress"),children:t.map((({id:t,name:n,progress:r,uploading:o,error:i})=>(0,L.jsxs)("div",{className:Mn("progress_container"),children:[(0,L.jsxs)("div",{className:Mn("progress__text"),children:[(0,L.jsx)("span",{className:Mn("progress__text--file-name"),children:n}),(0,L.jsx)("span",{className:Mn("progress__text--percentage"),children:`${r}%`})]}),(0,L.jsx)(rs,{error:i}),(0,L.jsx)("progress",{className:Mn("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 cu({id:e,name:t,labelText:n,contentHint:r,outputText:o,accept:s}){const{isSubmitted:a}=Mi(),[c,l]=(0,i.useState)(!1),[{onInput:u,onBlur:p},{error:h}]=zi(t),f=$r(),d=$r(),y=$r(),b=a&&h,m=[y];r&&m.push(d),b&&m.push(f);const g=(0,i.useCallback)((()=>{l(!0)}),[l]),v=(0,i.useCallback)((()=>{l(!1),p()}),[l,p]),O=(0,i.useCallback)((e=>{const t={target:{value:e.target.files}};u(t)}),[u]);return(0,L.jsxs)("div",{className:Mn("upload__container"),children:[r&&(0,L.jsx)("span",{className:Mn("upload__content-hint"),id:d,children:r}),(0,L.jsx)(rs,{id:f,error:b&&h}),(0,L.jsx)("div",{className:Mn(["file-upload",...c?["focus-within"]:[]]),children:(0,L.jsxs)("label",{htmlFor:e,className:Mn("upload__label"),children:[(0,L.jsx)(hi,{name:"upload",size:"32"}),(0,L.jsxs)("div",{children:[(0,L.jsx)("span",{className:Mn(["upload__label--text"]),children:n}),(0,L.jsx)("input",{id:e,className:Mn("upload__input"),type:"file",name:t,onChange:O,"aria-invalid":b?"true":"false","aria-describedby":m.join(" "),accept:s||null,onFocus:g,onBlur:v}),(0,L.jsx)("span",{className:Mn("upload__output"),"aria-hidden":"true",id:y,children:o})]})]})})]})}function lu({skiplinkId:e,controlName:t,accept:n,contentHint:r,isUploading:o,isComplete:i,onClickCancel:s}){const{t:a}=fr(),[{value:c}]=zi(t),l=c&&c.length>0,u=l?c[0].name:"";return(0,L.jsxs)(ns,{className:Mn("upload-form"),children:[(0,L.jsx)(cu,{name:t,id:e,accept:n,labelText:a("fileUpload.labelText"),outputText:a("fileUpload.selectedText",{hasFile:l,filename:u}),contentHint:r}),(0,L.jsxs)("div",{className:Mn("upload__button-container"),children:[(0,L.jsx)("button",{id:o||!i?e:void 0,type:"button",onClick:s,className:Mn("button","button--secondary","upload__cancel"),children:a("fileUpload.cancelButtonText")}),(0,L.jsx)("button",{className:Mn("button","button--primary"),type:"submit",children:a("fileUpload.uploadButtonText")})]})]})}const uu="fileListForm",pu="fileList",hu=()=>{const{t:e}=fr(),{sendPolite:t,sendAssertive:n}=Oo(),r=an(),o=_r(),{serviceAllowsUploads:s,allowedMimeTypes:a,maxSize:c}=Mr(),l=(0,i.useRef)(null),u=(0,i.useRef)(s),{cancelEntrySelection:p}=ko(),{uploadFile:h,clearUploads:f,isUploading:d,isComplete:y}=zr(),{hasFile:b,selectedFileName:m,uploadHandle:g,hasServerError:v,progress:O}=((e,t)=>{const n=X(Ii,{formId:e,name:t},[e,t]),{currentUploads:r}=zr(),o=n&&n.length>0;let i=null,s=!1,a=0;if(r&&r.length>0){const e=r[0];i=e.uploadHandle,s=!!e.error,a=e.progress}return{hasFile:o,selectedFileName:o?n[0].name:"",uploadHandle:i,hasServerError:s,progress:a}})(uu,pu),w=$r(),j=(0,i.useRef)(!0),_=e("fileUpload.contentHint",{size:ae(c)}),x=(0,i.useRef)(""),E=(0,i.useRef)(null);(0,i.useEffect)((()=>{x.current&&E.current.contains(document.activeElement)&&"INPUT"===document.activeElement.tagName&&n(_),x.current=_}),[_,n]),(0,i.useEffect)((()=>{if(O>0)switch(O){case 1:t(e("fileUpload.srStartedText"));break;default:t(`${O}%`)}}),[O,t,e]),(0,i.useEffect)((()=>{j.current||d||!y||(f(),p(),o(),setTimeout((()=>{t(e("fileUpload.srCompleteText"))}),300)),j.current=y}),[d,y,f,p,o,t,e]);const S=(0,i.useCallback)((({fileList:e})=>{h(e[0]),o()}),[h,!1,o]),T=(0,i.useCallback)((()=>{g&&g.abort(),f(),p(),o()}),[g,f,p,o]),k=(0,i.useMemo)((()=>({[pu]:[Os((()=>s),e("fileUpload.errors.unavailable")),Os(js,e("fileUpload.errors.noFile")),Os(ws,e("fileUpload.errors.tooLarge"),c)]})),[c,s,e]);return(0,L.jsx)("div",{className:Mn(["upload",...v?["upload--error"]:[]]),ref:E,children:(0,L.jsxs)(qi,{formId:uu,persistData:!0,onSubmit:S,validationSchema:k,children:[(d||!y)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(au,{}),(0,L.jsx)("div",{className:Mn("upload__button-container"),children:(0,L.jsx)("button",{id:d||!y?r:void 0,type:"button",onClick:T,ref:l,className:Mn("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]}),!d&&y&&(0,L.jsx)(lu,{controlName:pu,skiplinkId:r,accept:a.join(", "),contentHint:_,isComplete:y,isUploading:d,outputText:e("fileUpload.selectedText",{hasFile:b,filename:m}),onClickCancel:T}),!u.current&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:Mn("notification"),id:w,children:e("fileUpload.unavailableText")}),(0,L.jsx)("div",{className:Mn("upload__button-container"),children:(0,L.jsx)("button",{id:d||!y?r:void 0,type:"button",onClick:T,className:Mn("button","button--secondary","upload__cancel"),children:e("fileUpload.cancelButtonText")})})]})]})})};function fu(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 du(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(n),!0).forEach((function(t){yu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const bu=()=>{const{isOpen:e}=so(),t=(0,i.useRef)(null),{hasCountdown:n}=Mo(),[r,o]=(0,i.useState)(n),{hasPrompt:s}=$o(),[a,c]=(0,i.useState)(s),l=_r(),u=(0,i.useRef)(!1),{activeEntry:p}=ko(),[h,f]=(0,i.useState)({text:iu,upload:hu}),[d,y]=(0,i.useState)((()=>p)),b=ee(),{accountAllowsUploads:m}=Mr(),g=(0,i.useCallback)((()=>{de(t.current,(()=>{l()}))}),[l]);(0,i.useEffect)((()=>{const{customComponents:e}=b,{entry:t}=e||{};t&&f((e=>du(du({},e),t)))}),[b]),(0,i.useEffect)((()=>{g(),o(n),c(s)}),[n,s,g]),(0,i.useEffect)((()=>{y(p),g()}),[p,g,t]),u.current=!(!t.current||!t.current.contains(document.activeElement));const v=h[d];return(0,L.jsxs)("div",{className:Mn("chat__entry"),ref:t,children:[r&&(0,L.jsx)(Wl,{}),a&&(0,L.jsx)(Gl,{}),(0,L.jsxs)("div",{className:Mn(["entry__body",...n||s?["entry__body--hidden"]:[]]),children:[d!==we&&m&&e&&(0,L.jsx)(su,{}),(0,L.jsx)(v,{})]})]})};function mu({controlName:e,describedById:t}){const{t:n}=fr();return(0,L.jsxs)(ns,{noValidate:"true",className:Mn("options__form"),children:[(0,L.jsx)(Zl,{name:e,type:"email",className:Mn("transcript__input"),"aria-describedby":t,labelClass:Mn("label"),labelText:n("options.sendTranscript.label")}),(0,L.jsx)("div",{className:Mn("options__actions"),children:(0,L.jsx)("button",{type:"submit",className:Mn("button","button--primary","options__submit"),children:n("options.sendTranscript.sendButtonText")})})]})}const gu="email",vu={sendTranscript:()=>{const[e,t]=(0,i.useState)(void 0),{hideOption:n}=Ar(),{focusButton:r}=Ir(),{t:o}=fr(),s=$r(),{sendAction:a}=go(),c=(0,i.useMemo)((()=>({[gu]:[Os(xs,o("options.sendTranscript.noEmailText")),Os(_s,o("options.sendTranscript.invalidEmailText"))]})),[o]),l=(0,i.useCallback)((e=>{const t=e.email.trim();a({type:"send_transcript",body:{emailAddress:t}}),n(),r()}),[a,n,r]),u=(0,i.useCallback)((({isValid:e,isSubmitted:n})=>{t(n&&!e?"options--error":void 0)}),[t]);return(0,L.jsxs)(vi,{className:e,headingText:o("options.sendTranscript.title"),cancelButtonText:o("options.cancelButtonText"),children:[(0,L.jsx)("p",{className:Mn("options__description"),id:s,children:o("options.sendTranscript.description")}),(0,L.jsx)(qi,{formId:"sendTranscript",onSubmit:l,validationSchema:c,onError:u,children:(0,L.jsx)(mu,{controlName:gu,describedById:s})})]})}},Ou=()=>{const{optionActive:e}=Ar(),t=(0,i.useRef)(null),n=vu[e||t.current];return e&&(t.current=e),n?(0,L.jsx)(n,{}):null},wu=()=>{const{t}=fr(),{menuOptions:n,showOption:r,panelActive:o,hideOption:s}=Ar(),{id:a}=Ir(),c=(0,i.useRef)(null),[l,u]=(0,i.useState)(!1),p=(0,i.useRef)(null),h=n.length,f=(0,i.useRef)(Array.from({length:h},(()=>(0,e.createRef)()))),d=(0,i.useRef)(!1),y=h>1,b=n[0],m=(0,i.useMemo)((()=>{var e;return null==b||null===(e=b.name)||void 0===e?void 0:e.trim().replace(/\s+/g,"")}),[b]);return(0,i.useEffect)((()=>()=>{clearTimeout(c.current)}),[]),(0,i.useEffect)((()=>{l&&!d.current&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{const e=n.findIndex((e=>e.available)),t=-1===e?0:e;fe(f.current[t])}))})),d.current=l}),[l,n]),h?(0,L.jsxs)("div",{className:Mn("options__container"),onKeyDown:e=>{l&&(he(e)===pe.Escape&&(u(!1),fe(p.current)),he(e)===pe.Home&&(fe(f.current[0]),e.preventDefault()),he(e)===pe.End&&(fe(f.current[h-1]),e.preventDefault()))},onfocusout:()=>{y&&(c.current=setTimeout((()=>{u(!1)}),200))},onfocusin:()=>{clearTimeout(c.current)},children:[(0,L.jsx)(gi,{transitionStartState:yi,isActive:o,children:(0,L.jsx)("div",{className:Mn("options__dialog"),children:(0,L.jsx)(Ou,{})})}),y&&(0,L.jsx)(gi,{isActive:l,transitionStartState:yi,children:(0,L.jsx)("ul",{className:Mn(["options__menu"]),role:"menu",tabIndex:"-1","aria-labelledby":a,children:n.map((({name:e,title:o,available:i},s)=>(0,L.jsx)("li",{className:Mn("options__menu__item"),role:"menuitem","data-testid":e,children:(0,L.jsxs)("button",{type:"button",ref:e=>{f.current[s]=e},className:Mn(["button","button--secondary",...i?[]:["button--disabled"]]),onKeyDown:e=>((e,t)=>{if(he(e)===pe.ArrowDown){const n=Math.min(h-1,t+1);fe(f.current[t===n?0:n]),e.preventDefault()}if(he(e)===pe.ArrowUp){const n=Math.max(0,t-1);fe(f.current[t===n?h-1:n]),e.preventDefault()}})(e,s),onKeyPress:e=>((e,t)=>{const r=String.fromCharCode(e.charCode);if(1!==r.length||!r.match(/\S/))return;let o=-1;n.forEach(((e,n)=>{n>t&&e.title.charAt(0).toLowerCase()===r.toLowerCase()&&-1===o&&(o=n)})),-1!==o&&fe(f.current[o])})(e,s),onClick:()=>((e,t)=>{t&&(u(!1),r(e))})(e,i),"aria-disabled":i?null:"true",children:[(0,L.jsxs)("span",{className:Mn("button__text"),children:[o,!i&&" "]}),!i&&(0,L.jsx)("span",{className:Mn("button__state"),children:t("options.unavailableText")})]})},e)))})}),(0,L.jsxs)("button",{type:"button",className:Mn(["button","button--secondary","chat__options__button",...!y&&m?[`chat__options__button--${m}`]:[],...y||b.available?[]:["button--disabled"]]),id:a,onClick:()=>{o&&s(),y?u((e=>!e)):b.available&&r(b.name)},onKeyDown:y?e=>{he(e)===pe.ArrowDown&&(u(!0),e.preventDefault())}:null,ref:p,"aria-haspopup":y?"menu":null,"aria-expanded":y?l.toString():null,"aria-disabled":y||b.available?null:"true",children:[y&&(0,L.jsx)(hi,{name:"options",size:"32"}),(0,L.jsx)("span",{className:Mn("button__text"),children:y?t("options.openButtonText"):`${b.title}${b.available?"":" "}`}),!y&&!b.available&&(0,L.jsx)("span",{className:Mn("button__state"),children:t("options.unavailableText")})]})]}):null};function ju(){const{menuOptions:e,allowOptionSelection:t}=Ar(),{isAvailable:n}=ri();return n||t&&e.length?(0,L.jsxs)("div",{className:Mn("chat__options"),children:[n&&(0,L.jsx)("div",{className:Mn("chat__options-item","chat__options-item--left"),children:(0,L.jsx)(ks,{})}),t&&(0,L.jsx)("div",{className:Mn("chat__options-item","chat__options-item--right"),children:(0,L.jsx)(wu,{})})]}):null}function _u(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 xu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Eu=function({children:e,interruptComponent:t}){const{hasInterrupt:n,meta:r}=Wr(),{isOpen:o}=so();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Cs,{}),(0,L.jsx)("div",{className:Mn("chat__container"),children:n?o?(0,L.jsx)(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_u(Object(n),!0).forEach((function(t){xu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},r)):null:e}),(0,L.jsx)(ju,{})]})};function Su(){const{preChatEvents:e,layoutMode:t}=ee(),{hasInterrupt:n}=Wr(),{isOpen:r}=so(),o=!(n||!e.length||r);return(0,L.jsx)(gi,{isActive:o,transitionStartState:yi,children:(0,L.jsx)("ul",{className:Mn("pre-chat-messages",`pre-chat-messages--${t}`),"aria-hidden":!o,children:e.map((e=>(0,L.jsx)("li",{className:Mn("pre-chat-messages__message"),children:(0,L.jsx)(Tu,{event:e})},e.payload.id)))})})}function Tu({event:e}){const[t]=$s(e);return(0,L.jsx)(t,{event:e})}function ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cu=()=>{const e=ln(),{hasInterrupt:t}=Wr(),{defaults:n}=ee(),r=null==n?void 0:n.startChatIcon,o=e&&!t?e.avatar:void 0;return o||r?(0,L.jsx)("img",{className:Mn(o?"avatar":"icon"),src:o||r,alt:""}):(0,L.jsx)(hi,{name:"avatar",size:"32"})},Au=({onClick:e})=>{const t=qn(),{t:n}=fr(),r=n(t?"window.openButton.srContinue":"window.openButton.srStart"),o=_r(),{isOpen:s}=so(),a=sn(),c=(0,i.useCallback)((()=>{e(),o()}),[o,e]);return(0,L.jsx)(gi,{isActive:!s,transitionStartState:bi,children:(0,L.jsxs)("button",{className:Mn("window-open-button"),"aria-label":r,"aria-hidden":s,onClick:c,children:[(0,L.jsx)("span",{className:Mn("message-count"),"aria-hidden":"true",children:!!a&&a}),(0,L.jsx)(Cu,{})]})})},Iu=({onClick:e})=>{const{t}=fr(),n=(0,i.useCallback)((()=>e()),[e]);return(0,L.jsx)("button",{type:"button",className:Mn("button","collapse-button"),onClick:n,children:(0,L.jsx)(hi,{name:"chevronDown",size:"32",alt:t("window.srCollapseButton")})})},Nu={app:()=>(Co(),(0,L.jsx)(Us,{children:(0,L.jsxs)(Eu,{interruptComponent:Ms,children:[(0,L.jsx)(ql,{}),(0,L.jsx)(bu,{})]})})),inline:()=>{Co();const{isOpen:e}=so(),{hasInterrupt:t,meta:n}=Wr();return t&&!e?(0,L.jsx)(Ms,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ku(Object(n),!0).forEach((function(t){Pu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ku(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n)):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(gi,{isActive:!e,transitionStartState:bi,children:(0,L.jsxs)("div",{className:Mn("unstarted-wrapper"),children:[(0,L.jsx)(Su,{}),(0,L.jsx)(Ls,{})]})}),(0,L.jsx)(gi,{isActive:e,transitionStartState:bi,children:(0,L.jsx)(Us,{children:(0,L.jsxs)(Eu,{interruptComponent:Ms,children:[e&&(0,L.jsx)(ql,{}),(0,L.jsx)(bu,{})]})})})]})},window:()=>{const{openChat:e,closeChat:t}=Co(),{isOpen:n}=so(),r=io(),{t:o}=fr(),s=o("window.chat.continue"),a=(0,i.useMemo)((()=>({payload:{body:{text:s}}})),[s]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Au,{onClick:e}),(0,L.jsx)(gi,{isActive:!n&&!r,transitionStartState:bi,children:(0,L.jsx)("div",{className:Mn("unstarted-wrapper","unstarted-wrapper--window"),children:(0,L.jsx)(Su,{})})}),(0,L.jsx)(gi,{isActive:!n&&r,transitionStartState:yi,children:(0,L.jsx)("div",{className:Mn("unstarted-wrapper","unstarted-wrapper--window","unstarted-wrapper--continue"),children:(0,L.jsx)(ll,{event:a})})}),(0,L.jsx)(gi,{isActive:n,transitionStartState:yi,children:(0,L.jsxs)(Us,{children:[n&&(0,L.jsx)(Iu,{onClick:t}),(0,L.jsxs)(Eu,{interruptComponent:Ms,children:[(0,L.jsx)(ql,{}),(0,L.jsx)(bu,{})]})]})})]})}},Du=()=>{const[,e]=wr(),{namespace:t,layoutMode:n,zIndex:r}=ee(),{isOpen:o,isVisible:s}=so(),a=Wn(),c=io(),{locale:l}=fr(),u=Nu[n],p=(0,i.useCallback)((t=>{e(t)}),[e]),h=(0,i.useMemo)((()=>{if(l&&document.querySelector("html").getAttribute("lang")!==l)return l}),[l]);if(!u)return console.warn('"layoutMode" should be one of "app", "inline" or "window"'),null;const f=["app",`app--layout-${n}`,`namespace--${t}`,...a];return o||"app"===n||f.push("app--collapsed"),c&&f.push("app--user-responded"),s&&(0,L.jsx)("div",{className:Mn(f),lang:h,tabIndex:"-1","data-nosnippet":!0,style:{zIndex:r},ref:p,children:(0,L.jsx)(u,{})})};function Ru(e,t,n=[]){const r=(0,i.useContext)($n),o=(0,i.useRef)();o.current=t,(0,i.useEffect)((()=>{if(!n.every(Boolean))return;const t=(...e)=>{var t;return null===(t=o.current)||void 0===t?void 0:t.call(o,...e)};return r.emit("function.register",e,t),()=>r.emit("function.unregister",e,t)}),[r,e,...n])}const Lu=()=>{const e=ee(),{sendMessage:t,sendContext:n,sendAction:r}=go(),{setVisibility:o,visible:s}=so(),a=(0,i.useRef)(s),c=(0,i.useContext)($n),l=Bn(),u=sn(),p=(0,i.useRef)(null),h=(0,i.useRef)(null),{isInline:f,isResolving:d}=pn(),{hasInterrupt:y}=Wr(),b=Hn(),m=(0,i.useRef)(null),g=jo(),{enableTranslations:v,disableTranslations:O}=ri();return(0,i.useEffect)((()=>{a.current=s}),[s]),Ru("askText",(e=>{t({body:e})}),[null==l?void 0:l.send]),Ru("setVariables",(e=>{n({variables:e})}),[null==l?void 0:l.send]),Ru("getVisibility",(e=>{e?e(a.current):console.warn("A callback function is required for the getVisibility action.")})),Ru("setVisibility",(e=>{Object.values(T).includes(e)?(g(),o(e)):console.error('Requested visibility states should be "open", "minimized" ,"hidden" or null.')}),[null==e?void 0:e.api]),Ru("sendCustomAction",((e,t)=>{r({type:"custom",body:{type:e,body:t}})}),[l.send]),Ru("setTopic",(({name:e,fallbackMessage:t})=>{e&&t?r({type:"set_topic",body:{name:e,fallbackMessage:t}}):console.warn("A name and a fallbackMessage are required for the setTopic action.")}),[l.send]),Ru("setTranslation",(({enabled:e,locale:t})=>{e?v(t):O()}),[l.send]),(0,i.useEffect)((()=>{d||y||(m.current&&m.current!==b&&c.emit("unreadMessageCount",u),s===T.open&&s!==h.current&&0!==p.current&&c.emit("unreadMessageCount",0),s!==T.open&&u!==p.current&&c.emit("unreadMessageCount",u),h.current=s,p.current=u,m.current=b)}),[u,s,c,f,d,y,b]),null},{SET_EVENTS_READ:Uu}=De,Mu=()=>{const{t:e}=fr(),t=rn(),n=Vn(),{isOpen:r,isVisible:o}=so(),{sendAction:s}=go(),a=sn(),{sendPolite:c}=Oo(),l=(0,i.useMemo)((()=>oe(c,2e3)),[c]),u=(0,i.useRef)(null),p=(0,i.useRef)(null);return(0,i.useEffect)((()=>{if(!r)return;const e=t.filter((e=>Ot(e)&&e.payload.messageStatus===je)).map((e=>e.payload.id));e.length>0&&(n({type:Uu,ids:e}),s({type:Se,events:e}))}),[t,n,r,s]),(0,i.useEffect)((()=>{u.current!==o&&!o&&p.current&&p.current(),0!==a&&!r&&o&&(p.current=l(e("message.srTextUnreadCount",{unreadCount:a}))),u.current=o}),[a,r,o,l,e]),null},zu=()=>{const{t:e}=fr(),t=rn(),n=(0,i.useRef)(0),r=(0,i.useRef)(0),o=en().historyLoaded,{sendPolite:s}=Oo(),{isOpen:a}=so(),c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useMemo)((()=>oe((t=>{const n=t.filter((({payload:e})=>!e.fromClient&&!e.fromHistory)).length;n>r.current&&(s(e("message.srNewEventCount",{newCount:n-r.current})),r.current=n)}),1e3)),[s,e]);return(0,i.useEffect)((()=>{t.length>n.current&&(a&&(l.current=u(t)),n.current=t.length)}),[t,u,a]),(0,i.useEffect)((()=>{c.current&&!a&&l.current&&(l.current(!0),l.current=null)}),[a]),(0,i.useEffect)((()=>{o&&setTimeout((()=>{s(e("window.srTexts.onHistoryLoad"))}),500)}),[o,e,s]),null},$u=({children:e})=>{const t=(0,i.useContext)($n),[n,r]=(0,i.useState)({}),o=(0,i.useRef)(!0),s=(0,i.useCallback)((e=>{o.current&&(r(e),t.emit("aria-live",e))}),[r,t]);(0,i.useEffect)((()=>{let e=null;return n&&n.messageText&&(e=setTimeout((()=>{s({}),clearTimeout(e)}),500)),()=>{clearTimeout(e)}}),[n,s]),(0,i.useEffect)((()=>()=>{o.current=!1}),[]);const{ariaLive:a,messageText:c}=n;return(0,L.jsxs)(vo.Provider,{value:s,children:[e,(0,L.jsxs)("div",{className:Mn("app__live-container"),children:[(0,L.jsx)("div",{"aria-live":"assertive","aria-atomic":"true",className:Mn("visually-hidden"),children:a===Ce?c:null}),(0,L.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:Mn("visually-hidden"),children:a===Ae?c:null})]})]})},Bu=()=>{const{hasCountdown:e,isActive:t,remaining:n,decrementCountdown:r}=Mo();return((e,t)=>{const n=(0,i.useRef)(e);(0,i.useEffect)((()=>{n.current=e}),[e]),(0,i.useEffect)((()=>{if(null!==t){const e=setInterval((function(){n.current()}),t);return()=>clearInterval(e)}}),[t])})((()=>{r()}),e&&t&&n>0?1e3:null),null},Fu=({children:e})=>{const t=(0,i.useRef)(0),{sendAction:n}=go(),{hasCountdown:r,isActive:o,stopCountdown:s}=Mo(),a=(0,i.useCallback)((()=>{const e=(new Date).getTime(),i=()=>{n({type:"interactivity_update"}),t.current=e};r&&o&&(i(),s()),e-t.current>15e3&&i()}),[n,r,o,s]);return(0,L.jsx)("div",{className:Mn("activity-monitor"),tabIndex:"-1",onMouseDown:a,onKeyUp:a,onTouchStart:a,onMouseMove:a,onWheel:a,onPointerDown:a,onPointerMove:a,children:(0,L.jsx)(wo.Provider,{value:a,children:e})})},Hu=()=>{const{initUserSelectedOptions:e}=Ar(),t=(0,i.useRef)(!1),n=ee();return(0,i.useEffect)((()=>{n.api&&!t.current&&(t.current=!0,e())}),[e,n]),null},qu=["serviceSettings"];const{ADD_EVENT:Vu,ACK_EVENT:Wu,SET_IS_LOADING:Gu,SET_PARTICIPANT:Ku,SET_HEADER_SUB_TITLE:Yu,SET_ACTIVE_SERVICE:Ju,INIT_RESUME_CONVERSATION_PROMPT:Qu,CLEAR_EVENTS:Zu,SET_SERVICE_DATA_ITEM:Xu,SET_FEATURE_ENABLED_STATE:ep,SET_SERVICE_ENTRY_METADATA:tp,SET_HISTORY:np}=De,rp=["text","choice_prompt","image","video"],op=({eventBus:e})=>{const{t}=fr(),n=Bn(),r=Vn(),o=rn(),s=(0,i.useRef)(null),{setUserSelectedOption:a}=Ar(),{initCountdown:c,endCountdown:l}=Mo(),{emitEvent:u}=go();return(0,i.useEffect)((()=>{if(n.connectionInfo){const t=e=>{const{payload:t}=e;if(!t||!t.participant)return;const{fromClient:n,participant:o}=t;!n&&o.name&&r({type:Yu,title:o.name}),r({type:Ku,participant:o,fromClient:n}),o.introduction&&r({type:Vu,event:e})};n.stream().subscribe({next:n=>{const{type:o,payload:i}=n;switch(o){case"ui":switch(i.state&&i.state.hasOwnProperty("loading")&&r({type:Gu,isLoading:i.state.loading}),i.type){case"idle_detach_countdown":c(i.body.duration);break;case"idle_detach_countdown_elapsed":l(void 0,!0);break;case"resume_conversation_prompt":r({type:Qu});break;case"user_first_response":r(Tn(!0)),e.emit("system.userFirstResponse",i.body)}break;case"message":switch(t(i),i.type){case"text":case"choice_prompt":case"splash":case"image":case"upload":case"video":case"cta":case"custom":case"carousel":case"card":i.service&&i.service.serviceSessionId&&r({type:Ju,activeServiceSessionId:i.service.serviceSessionId}),r({type:Vu,event:n})}break;case"participant":t(n);break;case"service_data":i.persist&&r({type:Xu,payload:i});break;case"ack":r({type:Wu,event:n});break;case"system":if("service_changed"===i.type){const{serviceSettings:e}=i,t=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(i,qu),{uploads:n,entry:o}=e;r({type:ep,key:Ne,enabled:!(!n||!n.enabled)}),r({type:tp,entryMeta:o}),r({type:Ju,activeServiceSessionId:i.serviceSessionId}),u("system.serviceChanged",t)}break;case"info":"divider"!==i.type&&"text"!==i.type&&"translation"!==i.type||r({type:Vu,event:n});break;case"error":switch(i.type){case"find_conversation_erred":r(En(new wn(n)));break;case"seamly_offline":r(En(new Yr(n))),r({type:Zu});break;default:r(En(new Gr(n)))}break;case"socket_opened":r(Sn())}}}),n.stream().filter((e=>"message"===e.type&&rp.includes(e.payload.type))).subscribe({next:({payload:t})=>{t.id!==s.current&&e.emit("message",t),s.current=t.id}})}}),[r,n,e,t,a,c,l,u]),(0,i.useEffect)((()=>{if(n.stream){const e=n.stream().filter((e=>"sync"===e.type)).subscribe({next:e=>{const{payload:t}=e,i=o[o.length-1],{id:s}=t.lastEvent;i&&s===i.payload.id||n.getConversation().then((e=>{e&&r({type:np,history:e})})).catch((e=>{r(En(e))}))}});return()=>{e.unsubscribe()}}return()=>{}}),[n,o,r]),null},{REGISTER_UPLOAD:ip,SET_UPLOAD_PROGRESS:sp,SET_UPLOAD_ERROR:ap,SET_UPLOAD_COMPLETE:cp}=De,lp=({children:e})=>{const{t}=fr(),n=Vn(),r=Bn(),{addUploadBubble:o}=go();return(0,L.jsx)(Nr.Provider,{value:e=>{const i=s(),a=r.uploadFile(e,(e=>{n({type:sp,fileId:i,progress:Math.ceil(e)})}),(e=>{const{id:t,transactionId:r,occurredAt:s,body:{contentType:a,filename:c,filesize:l,url:u}}=e.body;n({type:cp,fileId:i}),o(t,r,s,a,c,l,u)}),(e=>{let r;switch(e&&e.body?e.body.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({type:ap,fileId:i,errorText:r})}));n({type:ip,fileId:i,fileName:e.name,uploadHandle:a})},children:e})},{createAction:up}=d("errors"),pp=up("catch-error",(e=>({error:e})));function hp({api:e}){return({getState:t})=>{const n=n=>{const{errorCallback:r,namespace:o,api:i,layoutMode:s}=A(t());null==r||r(n.error,{namespace:o,api:i,layoutMode:s,conversationUrl:e.getConversationUrl(),action:n.type?n:void 0})};return e=>t=>{try{return t.error&&n(t),e(t)}catch(e){throw n({error:e}),e}}}}const fp=({store:e,children:t,config:n,eventBus:r,api:o})=>((0,i.useErrorBoundary)((t=>e.dispatch(pp(t)))),(0,L.jsx)(U,{store:e,children:(0,L.jsx)($n.Provider,{value:r,children:(0,L.jsx)(zn.Provider,{value:o,children:(0,L.jsx)($u,{children:(0,L.jsxs)(Fl,{children:[(0,L.jsx)(Hu,{config:n}),(0,L.jsx)(op,{eventBus:r}),(0,L.jsx)(Mu,{}),(0,L.jsx)(zu,{}),(0,L.jsx)(Bu,{}),(0,L.jsxs)(Fu,{children:[(0,L.jsx)(Lu,{}),(0,L.jsx)(lp,{children:t})]})]})})})})}));function dp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dp(Object(n),!0).forEach((function(t){bp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const mp=e=>(0,L.jsx)(fp,yp(yp({},e),{},{children:(0,L.jsx)(Du,{})}));var gp=n(813),vp=n.n(gp),Op=n(766),wp=n.n(Op),jp=e=>"function"==typeof e?e:function(){return e},_p="undefined"!=typeof self?self:null,xp="undefined"!=typeof window?window:null,Ep=_p||xp||void 0,Sp="closed",Tp="errored",kp="joined",Pp="joining",Cp="leaving",Ap="phx_close",Ip="phx_error",Np="phx_reply",Dp="phx_leave",Rp=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Lp=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},Up=class{static request(e,t,n,r,o,i,s){if(Ep.XDomainRequest){let n=new Ep.XDomainRequest;this.xdomainRequest(n,e,t,r,o,i,s)}else{let a=new Ep.XMLHttpRequest;this.xhrRequest(a,e,t,n,r,o,i,s)}}static xdomainRequest(e,t,n,r,o,i,s){e.timeout=o,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);s&&s(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r)}static xhrRequest(e,t,n,r,o,i,s,a){e.open(t,n,!0),e.timeout=i,e.setRequestHeader("Content-Type",r),e.onerror=()=>{a&&a(null)},e.onreadystatechange=()=>{if(4===e.readyState&&a){let t=this.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(o)}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let o=t?`${t}[${r}]`:r,i=e[r];"object"==typeof i?n.push(this.serialize(i,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Mp=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/websocket"),"$1/longpoll")}endpointURL(){return Up.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(){this.close(),this.readyState=0}ontimeout(){this.onerror("timeout"),this.closeAndRetry()}poll(){1!==this.readyState&&0!==this.readyState||Up.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),(e=>{if(e){var{status:t,token:n,messages:r}=e;this.token=n}else t=0;switch(t){case 200:r.forEach((e=>{setTimeout((()=>{this.onmessage({data:e})}),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen(),this.poll();break;case 403:this.onerror(),this.close();break;case 0:case 500:this.onerror(),this.closeAndRetry();break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){Up.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),(e=>{e&&200===e.status||(this.onerror(e&&e.status),this.closeAndRetry())}))}close(e,t){this.readyState=3,this.onclose()}},zp={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,o,i,s]=JSON.parse(e);return t({join_ref:n,ref:r,topic:o,event:i,payload:s})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:o,payload:i}=e,s=this.META_LENGTH+t.length+n.length+o.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),c=new DataView(a),l=0;c.setUint8(l++,this.KINDS.push),c.setUint8(l++,t.length),c.setUint8(l++,n.length),c.setUint8(l++,o.length),c.setUint8(l++,r.length),Array.from(t,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(o,(e=>c.setUint8(l++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(l++,e.charCodeAt(0))));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(s,s+r));s+=r;let c=n.decode(e.slice(s,s+o));s+=o;let l=n.decode(e.slice(s,s+i));return s+=i,{join_ref:a,ref:null,topic:c,event:l,payload:e.slice(s,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(a,a+r));a+=r;let l=n.decode(e.slice(a,a+o));a+=o;let u=n.decode(e.slice(a,a+i));a+=i;let p=n.decode(e.slice(a,a+s));a+=s;let h=e.slice(a,e.byteLength);return{join_ref:c,ref:l,topic:u,event:Np,payload:{status:p,response:h}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),o=t.getUint8(2),i=this.HEADER_LENGTH+2,s=n.decode(e.slice(i,i+r));i+=r;let a=n.decode(e.slice(i,i+o));return i+=o,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(i,e.byteLength)}}};function $p(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 Bp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$p(Object(n),!0).forEach((function(t){Fp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hp=n(905),qp=n.n(Hp);function Vp(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 Wp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vp(Object(n),!0).forEach((function(t){Gp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Kp=qp()("seamly");class Yp{constructor(e,t,n){this.url=e,this.accessToken=n,this.channelName=t,this.connect(),this.socket.onError((e=>{Kp("[SOCKET][ERROR]",e),this.emit({type:"error",payload:{type:"seamly_offline",error:e}})})),this.socket.onOpen((()=>{Kp("[SOCKET]OPEN"),this.emit({type:"socket_opened"})})),this.channel.on("system",(e=>{switch(e.type){case"join_conversation_succeeded":this.emit({type:"connection",connected:!0,ready:!0})}})),this.socket.onClose((()=>{Kp("[SOCKET]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onClose((()=>{Kp("[CHANNEL]CLOSE"),this.emit({type:"connection",connected:!1,ready:!1})})),this.channel.onError((e=>{Kp("[CHANNEL][ERROR]",e),this.emit({type:"connection",connected:!1,ready:!1})})),this.listenTo("ack"),this.listenTo("ui"),this.listenTo("error"),this.listenTo("participant",((e,t)=>Wp(Wp({},t),{},{type:e}))),this.listenTo("message"),this.listenTo("service_data"),this.listenTo("system"),this.listenTo("info"),this.listenTo("sync")}start(e){this.listener=e,this.channel.join().receive("ok",(()=>{Kp("[CHANNEL][JOIN] OK"),this.emit({type:"connection",connected:!0,ready:!1})})).receive("error",(e=>{Kp("[CHANNEL][JOIN] ERROR",e),this.emit({type:"error",payload:{type:"join_channel_erred",error:e}}),this.emit({type:"connection",connected:!1,ready:!1}),this.channel.socket.disconnect()})).receive("timeout",(()=>{Kp("[CHANEL][JOIN] Networking issue. Still waiting...")}))}stop(){this.listener=null}connect(){const{url:e,params:t}=(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 Bp(Bp({},e),{},{[n]:decodeURIComponent(r)})}),{})}})(this.url);this.socket=new class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||Ep.WebSocket||Mp,this.establishedConnections=0,this.defaultEncoder=zp.encode.bind(zp),this.defaultDecoder=zp.decode.bind(zp),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Mp?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;xp&&xp.addEventListener&&(xp.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),xp.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=jp(t.params||{}),this.endPoint=`${e}/websocket`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Lp((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs)}replaceTransport(e){this.disconnect(),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Up.appendParams(Up.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){this.connectClock++,e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=jp(e)),this.conn||(this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e))}log(e,t,n){this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone((()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed((()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),e&&e()}))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&3!==this.conn.readyState?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,r])=>{r(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ip)}))}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t.joinRef()!==e.joinRef()))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let n=new class{constructor(e,t,n){this.state=Sp,this.topic=e,this.params=jp(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Rp(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Lp((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=kp,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Tp,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Sp,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=Tp,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Rp(this,Dp,jp({}),this.timeout).send(),this.state=Tp,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(Np,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Ap,e)}onError(e){return this.on(Ip,(t=>e(t)))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter((n=>!(n.event===e&&(void 0===t||t===n.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Rp(this,e,(function(){return t}),n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Cp;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ap,"leave")},n=new Rp(this,Dp,jp({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return!(this.topic!==e||r&&r!==this.joinRef()&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Pp,this.joinPush.resend(e))}trigger(e,t,n,r){let o=this.onMessage(e,t,n,r);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter((t=>t.event===e));for(let e=0;e<i.length;e++)i[e].callback(o,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Sp}isErrored(){return this.state===Tp}isJoined(){return this.state===kp}isJoining(){return this.state===Pp}isLeaving(){return this.state===Cp}}(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:o,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${o})`,r)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}abnormalClose(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,e)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:n,payload:r,ref:o,join_ref:i}=e;o&&o===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${o&&"("+o+")"||""}`,r);for(let e=0;e<this.channels.length;e++){const s=this.channels[e];s.isMember(t,n,r,i)&&s.trigger(n,r,o,i)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,n]=this.stateChangeCallbacks.message[t];n(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}(e,{params:Wp(Wp({},t),{},{v:St})}),this.socket.connect(),this.channel=this.socket.channel(this.channelName,{authorization:`Bearer ${this.accessToken}`})}disconnect(){return new Promise((e=>{this.socket.disconnect(e)}))}listenTo(e,t=null){this.channel.on(e,(n=>{Kp("[RECEIVE]",e,n),this.emit({type:e,payload:t?t(e,n):n})}))}emit(e){this.listener&&this.listener.next(e)}push(e,t,n){this.channel.push(e,t,n)}}function Jp(e){const t="cvco."+e;return{get(){const e=[t,t.split(".").slice(0,-1).join(".")];let n;do{n=sessionStorage.getItem(e[0])}while(e.shift()&&!n);return JSON.parse(n)},set(e){e&&sessionStorage.setItem(t,JSON.stringify(e))}}}class Qp{constructor(e){this.name=e}emit(e){this.listener&&this.listener.next(e)}start(e){this.listener=e}stop(){this.listener=null}}function Zp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zp(Object(n),!0).forEach((function(t){eh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function eh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const th=qp()("seamly");function nh(){if(!Intl||"undefined"==typeof Intl||void 0===Intl.DateTimeFormat)return null;const e=Intl.DateTimeFormat();if(void 0===e||void 0===e.resolvedOptions)return null;const t=e.resolvedOptions().timeZone;return t&&(t.indexOf("/")>-1||"UTC"===t)?t:null}function rh(){return{screenResolution:`${window.screen.width}x${window.screen.height}`,userAgent:navigator.userAgent,currentUrl:window.location.toString(),timezone:nh()}}class oh{constructor({namespace:e,config:t={},context:n={}}){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}}}(`${e}.connection${n.locale?"."+n.locale:""}`,t.storageProvider||Jp),this.connectionInfo={apiKey:t.key,domain:t.domain||"api.seamly-app.com",secure:!1!==t.secure&&(t.secure||!0)},this.config={sendEnvironment:t.sendEnvironment??!0,context:n},this.connected=!1,this.configReady=!1,this.externalId=t.externalId,this.internalProducer=new Qp("API"),this.internal$=vp().create(this.internalProducer).flatten(),this.connection$=this.internal$.filter((e=>"connection"===e.type)),this.connection$.subscribe({next:({connected:e,ready:t})=>{this.connected=e,this.ready=t}}),this.URLS={}}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)}hasConversation(){return!!this.getConversationUrl()}getChannelName(){return this.store.get("channelName")}setChannelName(e){this.store.set("channelName",e)}clearStore(){this.store.delete("accessToken"),this.store.delete("conversationUrl"),this.store.delete("channelName")}getUrlPrefix(e){return`${this.connectionInfo.secure?`${e}s`:e}://${this.connectionInfo.domain}`}updateUrls({_links:e}){this.URLS=Object.entries(e).filter((([e])=>"self"!==e)).reduce(((e,[t,{href:n}])=>Xp(Xp({},e),{},{[t]:n})),this.URLS)}async reset(){return await this.disconnect(),this.clearStore(),this.getConfig()}async disconnect(){this.conversationProducer&&await this.conversationProducer.disconnect(),this.connected=!1,this.configReady=!1}async createConversation(){try{const e=wp().post(`${this.getUrlPrefix("http")}${this.URLS.conversations}`).set("Content-Type","application/json").query({v:St}).withCredentials().send({externalId:this.externalId||void 0}),{body:t}=await e,{conversation:n}=t,r=Xp({},n);return delete r.accessToken,delete r.channelName,this.setAccessToken(n.accessToken),this.setChannelName(n.channelName),this.updateUrls(t),this.setConversationUrl(this.URLS.conversation),r}catch(e){if(e.status>=500)throw new Gr(e);throw e}}getConfig(){return wp().post(`${this.getUrlPrefix("http")}/client/${this.connectionInfo.apiKey}/configs`).set("Content-Type","application/json").query({v:St}).send({context:Xp(Xp({},this.config.context),{},{environment:!0===this.config.sendEnvironment?rh():this.config.sendEnvironment})}).then((({body:e})=>(this.updateUrls(e),this.configReady=!0,e.config))).catch((e=>{if(404===e.status)throw new Kr;if(e.status>=500)throw new Gr;throw e}))}async getConversation(){if(!this.hasConversation())return null;try{const{body:e}=await wp().get(`${this.getUrlPrefix("http")}${this.URLS.history}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:St});this.updateUrls(e);const{messages:t,participants:n,activeServiceSessionId:r,activeServiceSettings:o,serviceData:i,ui:s,translation:a}=e.history;return{events:t.map((([e,t])=>({type:e,payload:Xp(Xp({},t),{},{type:"participant"===e?e:t.type})}))),participants:n,activeServiceSessionId:r,activeServiceSettings:o,serviceData:i,resumeConversationPrompt:!!s&&Boolean(s.resumeConversationPrompt),translation:a}}catch(e){if(401===e.status)throw new Jr(e);if(404===e.status)throw new wn(e);if(e.status>=500)throw new Gr(e);throw e}}async connect(){this.connected=!1;let e=null;return this.hasConversation()||(e=await this.createConversation()),this.conversationProducer=new Yp(`${this.getUrlPrefix("ws")}${this.URLS.socket}`,this.getChannelName(),this.getAccessToken()),this.internalProducer.emit(vp().create(this.conversationProducer)),this.config.sendEnvironment&&this.send("context",{environment:!0===this.config.sendEnvironment?rh():this.config.sendEnvironment},!1),e}uploadFile(e,t,n,r){const o=new FormData;o.append("upload",e);const i=wp().post(`${this.getUrlPrefix("http")}${this.URLS.uploads}`).set("Authorization",`Bearer ${this.getAccessToken()}`).send(o);return i.on("progress",(function(e){const{direction:n,percent:r}=e;"upload"===n&&"function"==typeof t&&t(r)})),i.then((e=>{n&&n(e)})).catch((e=>{if(!r)throw e;r(e.response)})),i}getConversationIntitialState(){return wp().get(`${this.getUrlPrefix("http")}${this.getConversationUrl()}`).set("Authorization",`Bearer ${this.getAccessToken()}`).query({v:St}).then((({body:e})=>{return this.updateUrls(e),t=e.conversation,n=["accessToken","channelName"],Object.keys(t).reduce(((e,r)=>(n.includes(r)||(e[r]=t[r]),e)),{});var t,n})).catch((e=>{if(401===e.status)throw new Jr(e);if(404===e.status)throw new wn(e);if(e.status>=500)throw new Gr(e);throw e}))}async getTranslations(e){try{const t=`${this.getUrlPrefix("http")}${this.URLS.translations}`.replace("{version}",String(1)).replace("{locale}",e),n=wp().get(t),{body:r}=await n;return r.translations}catch(e){if(e.status>=500)throw new Gr(e);throw e}}send(e,t,n=!0){!this.connected||n&&!this.ready?this.connection$.filter((e=>n?e.connected&&e.ready:e.connected)).take(1).subscribe({next:()=>this.send(e,t,n)}):(th("[SEND]",e,t),this.conversationProducer.push(e,function(e,t){if("message"!==e)return t;const{type:n,body:r}=t;let{transactionId:o}=t;return o||(o=s()),{type:n,body:r,transactionId:o}}(e,t),1e4))}sendContext(e={}){const{locale:t,variables:n}=e,r={};if(t){if("string"!=typeof t)throw new Error("Locale must be a string");r.locale=t}if(n){if("object"!=typeof n)throw new Error("Variables must be an object");r.variables=n}0===Object.keys(r).length&&r.constructor===Object||this.send("context",r,!1)}stream(){return this.internal$.filter((e=>"connection"!==e.type))}}function ih(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var sh=ih();sh.withExtraArgument=ih;const ah=sh;function ch(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 lh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ch(Object(n),!0).forEach((function(t){uh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ch(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ph({api:e}){return()=>t=>n=>{const r=t(n);switch(n.type){case De.SET_USER_SELECTED_OPTIONS:e.store.set("options",n.options);break;case De.SET_USER_SELECTED_OPTION:e.store.set("options",lh(lh({},e.store.get("options")||{}),{},{[n.option]:n.value}))}return r}}const hh={events:[],initialState:{},unreadEvents:0,isLoading:!1,idleDetachCountdown:{hasCountdown:!1,isActive:!1},resumeConversationPrompt:!1,serviceInfo:{activeServiceSessionId:""},participantInfo:{participants:{},currentAgent:""},headerTitles:{title:null,subTitle:""},historyLoaded:!1,skiplinkTargetId:s(),optionsButtonId:s(),headerCollapseButtonId:s(),serviceData:{},options:{features:{},panelActive:!1,optionActive:"",userSelectedOptions:{}},showFileUpload:!1,currentUploads:[],entryMeta:{default:Oe,active:Oe,userSelected:null,blockAutoEntrySwitch:!1,options:{},optionsOverride:{}},seamlyContainerElement:null};function fh(e=hh,t){return t.type===String(kn.pending)?hh:((e,t)=>{switch(t.type){case Le:const{type:n,payload:r}=t.event,o=e.options.features.hasOwnProperty(Ne),i=xt(e.entryMeta,r);let s=be({},e.options);if(o&&(n===ge.message||n===ge.participant)&&!r.fromClient){const{type:e}=r.entry||{};s=be(be({},s),{},{features:be(be({},s.features),{},{uploads:be(be({},s.features.uploads),{},{enabledFromEntry:e===we})})})}const a=Ot(t.event);return e.events.find((e=>e.payload.id===r.id))?e:be(be({},e),{},{entryMeta:o||i.active!==we?i:be({},e.entryMeta),options:s,unreadEvents:a?e.unreadEvents+1:e.unreadEvents,events:[...e.events,be(be({},t.event),{},{payload:be(be({},a&&{messageStatus:r.fromClient?_e:je}),r)})]});case $e:if(!t.event.payload.transactionId)return console.warn("ACK received without transaction ID."),e;const c=e.events.find((e=>e.payload.transactionId===t.event.payload.transactionId)),{id:l,occurredAt:u}=t.event.payload;return c?be(be({},e),{},{events:wt(e.events.map((e=>e.payload.id===c.payload.id?be(be({},e),{},{payload:be(be({},e.payload),{},{id:l,occurredAt:u})}):e)))}):e;case Ue:return be(be({},e),{},{unreadEvents:0,events:[]});case ze:return be(be({},e),{},{unreadEvents:0,events:e.events.map((e=>-1!==t.ids.indexOf(e.payload.id)?be(be({},e),{},{payload:be(be({},e.payload),e.payload.messageStatus===je&&{messageStatus:_e})}):e))});case Me:const{events:p,participants:h,activeServiceSessionId:f,activeServiceSettings:d={},serviceData:y,resumeConversationPrompt:b}=t.history,m=((e,t)=>{const n=t.filter((t=>!(e.find((e=>e.payload.id===t.payload.id))||"participant"===t.type&&!t.payload.participant.introduction))).reverse();return wt([...n,...e])})(e.events,p),g=be(be({},e.participantInfo.participants),h),v=m.slice().reverse().find((e=>("message"===e.type||"participant"===e.type)&&!e.payload.fromClient));let O=null;v&&("message"===v.type&&(O=v.payload.participant),"participant"===v.type&&(O=v.payload.participant.id));const{entry:w,uploads:j}=d,_=xt(be(be(be({},e.entryMeta),w),{},{active:w.default||ve,options:be({},w&&w.options?w.options:{})}),m[m.length-1].payload);let x=be({},e.options.features);const E=x.hasOwnProperty(Ne);if(E){const{payload:e}=v,{type:t}=e.entry||{};x=be(be({},x),{},{uploads:{enabled:!(!j||!j.enabled),enabledFromEntry:t===we}})}const S=be(be({},e),{},{unreadEvents:m.filter((e=>"message"===e.type&&e.payload.messageStatus===je)).length,events:m.filter((e=>"participant"!==e.type||!!e.payload.participant.introduction)),participantInfo:be(be(be({},e.participantInfo),O?jt(e.participantInfo,{type:He,participant:g[O]}):{}),{},{participants:g}),historyLoaded:!0,serviceInfo:be(be({},e.serviceInfo),{},{activeServiceSessionId:f}),serviceData:y||{},options:be(be({},e.options),{},{features:x}),entryMeta:E||_.active!==we?_:be({},e.entryMeta),resumeConversationPrompt:b||!1});return O&&(S.headerTitles=_t(e.headerTitles,{type:Ve,title:g[O].name})),S;case We:return be(be({},e),{},{historyLoaded:!1});case Be:return be(be({},e),{},{isLoading:t.isLoading});case Ke:const{delaySeconds:T,delayTime:k}=t;return be(be({},e),{},{idleDetachCountdown:{hasCountdown:!0,isActive:!0,wasStopped:!1,count:T,remaining:T,timer:k}});case Ye:const{idleDetachCountdown:P}=e,{remaining:C}=P,A=C-1;return be(be({},e),{},{idleDetachCountdown:be(be({},e.idleDetachCountdown),{},{remaining:A,timer:se(A)})});case Je:return be(be({},e),{},{idleDetachCountdown:be(be({},e.idleDetachCountdown),{},{isActive:!1,wasStopped:!0})});case Qe:return be(be({},e),{},{idleDetachCountdown:{hasCountdown:!1,isActive:!1}});case Ze:return be(be({},e),{},{resumeConversationPrompt:!0});case Xe:return be(be({},e),{},{resumeConversationPrompt:!1});case He:case Fe:return be(be({},e),{},{participantInfo:jt(e.participantInfo,t)});case Ge:return e.serviceInfo.activeServiceSessionId!==t.activeServiceSessionId?be(be({},e),{},{serviceInfo:be(be({},e.serviceInfo),{},{activeServiceSessionId:t.activeServiceSessionId})}):e;case qe:case Ve:return be(be({},e),{},{headerTitles:_t(e.headerTitles,t)});case ot:return be(be({},e),{},{initialState:t.initialState});case et:return be(be({},e),{},{serviceData:be(be({},e.serviceData),{},{[t.payload.type]:t.payload})});case tt:return be(be({},e),{},{options:be(be({},e.options),{},{features:t.features})});case nt:return e.options.features.hasOwnProperty(t.key)?be(be({},e),{},{options:be(be({},e.options),{},{features:be(be({},e.options.features),{},{[t.key]:be(be({},e.options.features[t.key]||{}),{},{enabled:t.enabled})})})}):e;case rt:return be(be({},e),{},{options:be(be({},e.options),{},{features:{}})});case at:return be(be({},e),{},{options:be(be({},e.options),{},{panelActive:!0,optionActive:t.optionName})});case ct:return be(be({},e),{},{options:be(be({},e.options),{},{panelActive:!1,optionActive:""})});case st:return be(be({},e),{},{options:be(be({},e.options),{},{userSelectedOptions:t.options})});case it:const{option:I,value:N}=t;return be(be({},e),{},{options:be(be({},e.options),{},{userSelectedOptions:be(be({},e.options.userSelectedOptions),{},{[I]:N})})});case lt:const{value:D}=t;return be(be({},e),{},{entryMeta:be(be({},e.entryMeta),{},{blockAutoEntrySwitch:D})});case ht:const{entryMeta:R}=t;return be(be({},e),{},{entryMeta:be(be(be({},e.entryMeta),R),{},{active:R.default,options:be({},R.options||{}),overrideOptions:{}})});case pt:const{entryType:L}=t;return be(be({},e),{},{entryMeta:be(be({},e.entryMeta),{},{active:L})});case ut:const{entryType:U}=t;return be(be({},e),{},{entryMeta:be(be({},e.entryMeta),{},{userSelected:U})});case ft:return be(be({},e),{},{currentUploads:[...e.currentUploads,{id:t.fileId,name:t.fileName,progress:1,uploading:!0,complete:!1,error:"",uploadHandle:t.uploadHandle}]});case dt:return be(be({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?be(be({},e),{},{progress:t.progress,uploading:100!==t.progress,uploadHandle:100===t.progress?null:e.uploadHandle}):e))});case bt:return be(be({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?be(be({},e),{},{error:t.errorText,progress:0,uploading:!1,uploadHandle:null}):e))});case yt:return be(be({},e),{},{currentUploads:e.currentUploads.map((e=>e.id===t.fileId?be(be({},e),{},{complete:!0}):e))});case mt:return be(be({},e),{},{currentUploads:e.currentUploads.filter((e=>e.id!==t.fileId))});case gt:return be(be({},e),{},{currentUploads:[]});case vt:return be(be({},e),{},{seamlyContainerElement:t.element});default:return e}})(e,t)}const dh=["namespace","parentElement","showFaq"],yh=["view"];function bh(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 mh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bh(Object(n),!0).forEach((function(t){gh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vh(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class Oh{constructor(e,t){const{namespace:n="",parentElement:r,showFaq:i}=e,s=vh(e,dh);this.config=mh(mh({},s),{},{showFaq:!1!==i,namespace:n}),this.namespace=n,this.parentElement=r,this.externalApi=t,this.api=new oh({namespace:e.namespace,config:e.api,context:e.context}),this.eventBus=new(o()),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 t=this.config.customComponents||{},{view:n}=t,r=vh(t,yh),o=mh(mh({},this.config),{},{customComponents:Object.keys(r).length?r:void 0}),i=function({initialState:e,api:t,eventBus:n,config:r}={}){return Y({reducers:{state:fh,[String(Vo)]:Vo,[String(Un)]:Un,[String(Zi)]:Zi,[String(ui)]:ui,[String(gr)]:gr,[String(oo)]:oo,[String(po)]:po},initialState:e,middlewares:[hp({api:t}),ah.withExtraArgument({api:t,eventBus:n,config:r}),({dispatch:e})=>t=>n=>{var r,o;const i=t(n);switch(n.type){case String(v):case String(O):var s,a;null!=n&&null!==(r=n.config)&&void 0!==r&&null!==(o=r.defaults)&&void 0!==o&&o.agentName&&e({type:De.SET_HEADER_SUB_TITLE,title:null==n||null===(s=n.config)||void 0===s||null===(a=s.defaults)||void 0===a?void 0:a.agentName})}return i},Zr({api:t}),ph({api:t}),({dispatch:e,getState:t})=>n=>r=>{var o,i,s,a,c,l,u;const p=n(r);switch(r.type){case String(De.SET_HISTORY):null!==(o=r.history)&&void 0!==o&&null!==(i=o.translation)&&void 0!==i&&i.enabled&&e(Yo(r.history.translation.locale));break;case String(De.SET_INITIAL_STATE):null!==(s=r.initialState)&&void 0!==s&&null!==(a=s.translation)&&void 0!==a&&a.enabled&&(e(Yo(r.initialState.translation.locale)),e(Ut(r.locale)));break;case String(De.ADD_EVENT):"info"===r.event.type&&"new_translation"===(null===(c=r.event)||void 0===c||null===(l=c.payload)||void 0===l||null===(u=l.body)||void 0===u?void 0:u.subtype)&&r.event.payload.body.translationEnabled&&e(Ut(r.event.payload.body.translationLocale));break;case String(Jo):const n=Nt(t());e(Ut(n))}return p}]})}({api:this.api,eventBus:this.eventBus,config:o});await i.dispatch(kn()),n?(0,e.render)((0,L.jsx)(fp,{config:o,eventBus:this.eventBus,store:i,api:this.api,children:(0,L.jsx)(n,{})}),this.parentElement):(0,e.render)((0,L.jsx)(mp,{config:o,eventBus:this.eventBus,store:i,api:this.api}),this.parentElement)}destroy(){(0,e.render)(null,this.parentElement),this.eventBus.off(),this.api.disconnect(),delete this.functions}registerFunctions(e){Object.entries(e).forEach((([e,t])=>{this.registerFunction(e,t)}))}registerFunction(e,t){this.functions[e]=this.functions[e]||[],this.functions[e].push(t),this.externalApi.handleActions()}unregisterFunction(e,t){const n=this.functions[e];n&&n.length&&(this.functions[e]=n.filter((e=>e!==t)))}execFunction(e,...t){const n=this.functions[e];return!(!n||!n.length||(n.forEach((n=>{try{n(...t)}catch(t){console.error(`Action(${e}) failed: `,t)}})),0))}}function wh(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 jh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wh(Object(n),!0).forEach((function(t){_h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xh=e=>"object"==typeof e&&"action"in e,Eh=e=>jh(jh({},e),{},{args:Array.isArray(e.args)?e.args:[e.args]}),Sh=class{constructor(e){this._waitingActions=[],this._instances={},this.appConfig=e}push(...e){(e=e.filter(xh).map(Eh)).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._waitingActions.push(e)}}))}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,e.render()}}handleDestroy(e){this.destroy(e.instance)}handleAction(e){const{action:t,instance:n,args:r}=e,o=Object.values(this._instances);return!n&&o.length>1&&console.warn(`Multiple instances detected. Due to potential race conditions, it is recommended to target a specific instance with the action: ${t}`),o.map((e=>(!n||e.namespace===n)&&e.execFunction(t,...r))).some(Boolean)}createInstance(e){return new Oh(e,this)}destroy(e){e?("string"==typeof e&&(e=this._instances[e]),e&&(e.destroy(),delete this._instances[e.namespace])):Object.entries(this._instances).forEach((([e,t])=>{t.destroy(),delete this._instances[e]}))}getUserConfig(e={}){return e}getCombinedConfig(e){if("function"==typeof this.appConfig)return this.appConfig(e);const t=jh(jh({},this.appConfig.defaults),e.defaults);return jh(jh(jh({},this.appConfig),e),{},{api:jh(jh({},this.appConfig.api),e.api),defaults:Object.keys(t).length?t:void 0})}},Th=()=>{const{t:e}=fr(),{title:t,subTitle:n}=on(),r=sn(),{isOpen:o}=so(),i=ln(),{hasInterrupt:s}=Wr(),{defaults:a}=ee(),{startChatIcon:c}=a||{},l=i&&!s?i.avatar:null,u=s?"":n,p=["message-count"];return o&&p.push("message-count__hide"),0===r&&p.push("message-count__empty"),(l||u||!o)&&(0,L.jsxs)("div",{className:Mn("agent-info"),children:[(0,L.jsxs)("div",{className:Mn("agent-info__graphic"),children:[l||c?(0,L.jsx)("img",{className:Mn(l?"avatar":"icon"),src:l||c,alt:""}):(0,L.jsx)(hi,{name:"avatar",size:"32"}),(0,L.jsx)("span",{className:Mn(p),"aria-hidden":"true",children:r})]}),(0,L.jsxs)("div",{className:Mn("agent-info__body"),children:[(0,L.jsx)("p",{className:Mn("agent-info__heading"),children:t??e("header.title")}),(0,L.jsx)("p",{className:Mn("agent-info__text"),children:u})]})]})},kh=({children:e,onCloseChat:t})=>{const{headerCollapseButtonId:n}=en(),r=(0,i.useRef)(null),{t:o}=fr();return(0,L.jsxs)("header",{className:Mn("chat__header"),children:[e,(0,L.jsx)("div",{className:Mn("header-controls"),children:(0,L.jsx)("button",{type:"button",className:Mn("button","header-controls__collapse"),onClick:t,ref:r,id:n,children:(0,L.jsx)(hi,{name:"chevronDown",size:"32",alt:o("header.collapseApp")})})})]})},Ph=({onOpenChat:e})=>{const{t}=fr(),n=$r(),{isOpen:r}=so(),o=(0,i.useRef)(null),s=(0,i.useRef)(null),a=(0,i.useRef)(),c=_r(),l=(()=>{const e=(0,i.useRef)(null),[t]=wr();return e.current=t,(0,i.useCallback)((t=>{de(e.current,(()=>{Or(t)}))}),[])})(),u=ln(),p=on().subTitle,{hasInterrupt:h}=Wr(),{headerCollapseButtonId:f}=en(),d=u&&!h;return(0,i.useLayoutEffect)((()=>{!1===r&&!0===o.current&&l(s.current),o.current=r}),[r,l]),(0,L.jsxs)("div",{className:Mn("toggle-button"),children:[(0,L.jsxs)("div",{id:n,children:[(0,L.jsx)("p",{className:Mn("toggle-button__title"),children:t(d?"toggleButton.resumeTitle":"toggleButton.title")}),(0,L.jsx)("p",{className:Mn("toggle-button__subtitle"),children:d?p:t("toggleButton.subtitle")})]}),(0,L.jsx)("button",{type:"button","aria-labelledby":n,className:Mn("toggle-button__button"),ref:s,onMouseUp:()=>{a.current="mouse"},onKeyUp:()=>{a.current="key"},onClick:()=>{e(),"mouse"===a.current?c():"key"===a.current&&l(f)}})]})},Ch=["categories"];function Ah(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 Ih(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ah(Object(n),!0).forEach((function(t){Nh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ah(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dh=()=>{const{t:e}=fr(),{sendAction:t,addMessageBubble:n}=go(),r=$r(),o=_r(),{sendPolite:s}=Oo(),{hasInterrupt:a}=Wr(),{hasCountdown:c,endCountdown:l}=Mo(),{hasPrompt:u,continueChat:p}=$o(),h=un("suggestion"),[f]=oi({payload:h}),d=(0,i.useMemo)((()=>(h&&!a?f:[]).map((e=>{let{categories:t=[]}=e;return Ih(Ih({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Ch)),{},{categories:t,classNames:["faqs__item",...t.map((e=>`faqs__item--${String(e).toLowerCase().replace(/[^a-z0-9_\\-]/,"")}`))]})}))),[h,a,f]),y=(0,i.useRef)(null),b=(0,i.useRef)(!1),{isInline:m}=pn(),g=io(),v=!m&&g,O=(0,i.useRef)(v),w=!!d.length,j=w&&!v,_=(0,i.useRef)([]),x=w?d:_.current;_.current=x;const E=(0,i.useRef)(null);(0,i.useEffect)((()=>{if(y.current!==d&&!v){if(w){const t=b.current?e("faq.srUpdatedText"):e("faq.srAvailableText");setTimeout((()=>{s(t)}),30)}else b.current&&s(e("faq.srUnavailableText"));y.current=d}!O.current&&v?(de(E.current,o),s(e("faq.srUnavailableText"))):!w&&b.current&&de(E.current,o),b.current=w,O.current=v}),[w,d,v,o,s,e]);const S=e("faq.headingText"),T=S?"section":"div";return(0,L.jsx)(gi,{isActive:j,transitionStartState:yi,children:(0,L.jsxs)(T,{className:Mn("faqs"),"aria-labelledby":S?r:null,ref:E,children:[S&&(0,L.jsx)("h2",{id:r,className:Mn("faqs__heading"),children:S}),!!x.length&&(0,L.jsx)("ul",{className:Mn("faqs__list"),children:x.map((e=>(0,L.jsx)("li",{className:Mn(e.classNames),children:(0,L.jsxs)("button",{type:"button",onClick:()=>{(({id:e,question:r})=>{c&&l(!0),u&&p(),t({type:xe,originMessage:h.id,body:{type:"faqclick",body:{faqId:e,faqQuestion:r}}}),n(r),o()})(e)},className:Mn("button","button--secondary"),children:[(0,L.jsx)(hi,{name:"chevronRight",size:"8"}),e.question]})},e.id.toString())))})]})})},Rh=({children:e})=>{const[,t]=wr(),{isOpen:n,isVisible:r,setVisibility:o}=so(),{zIndex:s,showFaq:a,layoutMode:c}=ee(),{isInline:l}=pn(),u=Wn(),p=io(),{locale:h}=fr(),f=(0,i.useCallback)((e=>{t(e)}),[t]),d=(0,i.useMemo)((()=>{if(h&&document.querySelector("html").getAttribute("lang")!==h)return h}),[h]),y=["app","app--deprecated",...u];return n||"window"!==c||y.push("app--collapsed"),p&&y.push("app--user-responded"),y.push(`app--layout-${c}`),r&&(0,L.jsxs)("section",{className:Mn(y),onKeyDown:e=>{(e.code&&"Escape"===e.code||27===e.keyCode)&&!l&&n&&o(T.minimized)},lang:d,tabIndex:"-1",ref:f,style:{zIndex:s},"data-nosnippet":!0,children:[(0,L.jsx)("div",{className:Mn("app-wrapper"),children:e}),a&&(0,L.jsx)(Dh,{})]})},Lh=()=>{const{isVisible:e}=so(),{openChat:t,closeChat:n}=Co();return e&&(0,L.jsxs)(Rh,{children:[(0,L.jsx)(Ph,{onOpenChat:t}),(0,L.jsx)(kh,{onCloseChat:n,children:(0,L.jsx)(Th,{})}),(0,L.jsxs)(Eu,{interruptComponent:Ms,children:[(0,L.jsx)(ql,{}),(0,L.jsx)(bu,{})]})]})},Uh=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 Sh(e);window.seamly={push:n.push.bind(n)},n.push(...t)}})(),module.exports=r})();