@hellotext/hellotext 2.5.5 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/hellotext.js +1 -1
- package/dist/hellotext.js.LICENSE.txt +1 -1
- package/index.d.ts +15 -0
- package/lib/api/index.cjs +6 -0
- package/lib/api/index.js +6 -0
- package/lib/api/push/identities.cjs +59 -0
- package/lib/api/push/identities.js +68 -0
- package/lib/core/configuration/push.cjs +28 -0
- package/lib/core/configuration/push.js +22 -0
- package/lib/core/configuration.cjs +6 -1
- package/lib/core/configuration.js +5 -0
- package/lib/hellotext.cjs +14 -1
- package/lib/hellotext.js +14 -2
- package/lib/models/business.cjs +1 -0
- package/lib/models/business.js +1 -0
- package/lib/models/index.cjs +7 -0
- package/lib/models/index.js +1 -0
- package/lib/models/push.cjs +389 -0
- package/lib/models/push.js +412 -0
- package/lib/models/utm.cjs +1 -0
- package/lib/models/utm.js +1 -0
- package/package.json +2 -2
- package/src/api/index.js +5 -0
- package/src/api/push/identities.js +42 -0
- package/src/core/configuration/push.js +12 -0
- package/src/core/configuration.js +5 -0
- package/src/hellotext.js +15 -1
- package/src/models/business.js +1 -0
- package/src/models/index.js +1 -0
- package/src/models/push.js +397 -0
- package/src/models/utm.js +1 -0
package/dist/hellotext.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see hellotext.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Hellotext=t():e.Hellotext=t()}(Object("undefined"!=typeof self?self:this),()=>(()=>{"use strict";var e={891(e,t,n){n.d(t,{lg:()=>G,xI:()=>ie});class r{constructor(e,t,n){this.eventTarget=e,this.eventName=t,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=function(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{const n=e.index,r=t.index;return n<r?-1:n>r?1:0})}}class i{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,n={}){this.application.handleError(e,`Error ${t}`,n)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:n,eventOptions:r}=e,i=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(n,r);i.delete(o),0==i.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:n,eventOptions:r}=e;return this.fetchEventListener(t,n,r)}fetchEventListener(e,t,n){const r=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(t,n);let o=r.get(i);return o||(o=this.createEventListener(e,t,n),r.set(i,o)),o}createEventListener(e,t,n){const i=new r(e,t,n);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const n=[e];return Object.keys(t).sort().forEach(e=>{n.push(`${t[e]?"":"!"}${e}`)}),n.join(":")}}const o={stop:({event:e,value:t})=>(t&&e.stopPropagation(),!0),prevent:({event:e,value:t})=>(t&&e.preventDefault(),!0),self:({event:e,value:t,element:n})=>!t||n===e.target},s=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function a(e){return e.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function c(e){return a(e.replace(/--/g,"-").replace(/__/g,"_"))}function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u(e){return e.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function h(e){return null!=e}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const d=["meta","ctrl","alt","shift"];class p{constructor(e,t,n,r){this.element=e,this.index=t,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||function(e){const t=e.tagName.toLowerCase();if(t in m)return m[t](e)}(e)||g("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||g("missing identifier"),this.methodName=n.methodName||g("missing method name"),this.keyFilter=n.keyFilter||"",this.schema=r}static forToken(e,t){return new this(e.element,e.index,function(e){const t=e.trim().match(s)||[];let n=t[2],r=t[3];return r&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${r}`,r=""),{eventTarget:(i=t[4],"window"==i?window:"document"==i?document:void 0),eventName:n,eventOptions:t[7]?(o=t[7],o.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||r};var i,o}(e.content),t)}toString(){const e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;const t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;const n=t.filter(e=>!d.includes(e))[0];return!!n&&(f(this.keyMappings,n)||g(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[n].toLowerCase()!==e.key.toLowerCase())}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;const t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){const e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:n,value:r}of Array.from(this.element.attributes)){const i=n.match(t),o=i&&i[1];o&&(e[a(o)]=y(r))}return e}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){const[n,r,i,o]=d.map(e=>t.includes(e));return e.metaKey!==n||e.ctrlKey!==r||e.altKey!==i||e.shiftKey!==o}}const m={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function g(e){throw new Error(e)}function y(e){try{return JSON.parse(e)}catch(t){return e}}class v{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){const t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){const{element:t}=this.action,{actionDescriptorFilters:n}=this.context.application,{controller:r}=this.context;let i=!0;for(const[o,s]of Object.entries(this.eventOptions))if(o in n){const a=n[o];i=i&&a({name:o,value:s,event:e,element:t,controller:r})}return i}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){const{target:t,currentTarget:n}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:n,action:this.methodName})}catch(t){const{identifier:n,controller:r,element:i,index:o}=this,s={identifier:n,controller:r,element:i,index:o,event:e};this.context.handleError(t,`invoking action "${this.action}"`,s)}}willBeInvokedByEvent(e){const t=e.target;return!(e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e))&&!(e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e))&&(this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class b{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(e=>this.processMutations(e))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const n of this.matchElementsInTree(e))t.call(this,n)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}}class w{constructor(e,t,n){this.attributeName=t,this.delegate=n,this.elementObserver=new b(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return t.concat(n)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}function O(e,t){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n}class T{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,t)=>e.concat(Array.from(t)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,t)=>e+t.size,0)}add(e,t){!function(e,t,n){O(e,t).add(n)}(this.valuesByKey,e,t)}delete(e,t){!function(e,t,n){O(e,t).delete(n),function(e,t){const n=e.get(t);null!=n&&0==n.size&&e.delete(t)}(e,t)}(this.valuesByKey,e,t)}has(e,t){const n=this.valuesByKey.get(e);return null!=n&&n.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(t=>t.has(e))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,n])=>n.has(e)).map(([e,t])=>e)}}class S{constructor(e,t,n,r){this._selector=t,this.details=r,this.elementObserver=new b(e,this),this.delegate=n,this.matchesByElement=new T}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){const{selector:t}=this;if(t){const n=e.matches(t);return this.delegate.selectorMatchElement?n&&this.delegate.selectorMatchElement(e,this.details):n}return!1}matchElementsInTree(e){const{selector:t}=this;if(t){const n=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(t)).filter(e=>this.matchElement(e));return n.concat(r)}return[]}elementMatched(e){const{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){const t=this.matchesByElement.getKeysForValue(e);for(const n of t)this.selectorUnmatched(e,n)}elementAttributeChanged(e,t){const{selector:n}=this;if(n){const t=this.matchElement(e),r=this.matchesByElement.has(n,e);t&&!r?this.selectorMatched(e,n):!t&&r&&this.selectorUnmatched(e,n)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}}class k{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(e=>this.processMutations(e))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const n=this.delegate.getStringMapKeyForAttribute(e);if(null!=n){this.stringMap.has(e)||this.stringMapKeyAdded(n,e);const r=this.element.getAttribute(e);if(this.stringMap.get(e)!=r&&this.stringMapValueChanged(r,n,t),null==r){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(n,e,t)}else this.stringMap.set(e,r)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,n)}stringMapKeyRemoved(e,t,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class E{constructor(e,t,n){this.attributeObserver=new w(e,t,this),this.delegate=n,this.tokensByElement=new T}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,n]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(n)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(e=>this.tokenMatched(e))}tokensUnmatched(e){e.forEach(e=>this.tokenUnmatched(e))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),r=function(e,t){const n=Math.max(e.length,t.length);return Array.from({length:n},(n,r)=>[e[r],t[r]])}(t,n).findIndex(([e,t])=>{return r=t,!((n=e)&&r&&n.index==r.index&&n.content==r.content);var n,r});return-1==r?[[],[]]:[t.slice(r),n.slice(r)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,n){return e.trim().split(/\s+/).filter(e=>e.length).map((e,r)=>({element:t,attributeName:n,content:e,index:r}))}(e.getAttribute(t)||"",e,t)}}class C{constructor(e,t,n){this.tokenListObserver=new E(e,t,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).set(e,n),this.delegate.elementMatchedValue(t,n))}tokenUnmatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,n))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(e){return{error:e}}}}class P{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new C(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new v(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){const t=p.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class A{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new k(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const n=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,n.writer(this.receiver[e]),n.writer(n.defaultValue))}stringMapValueChanged(e,t,n){const r=this.valueDescriptorNameMap[t];null!==e&&(null===n&&(n=r.writer(r.defaultValue)),this.invokeChangedCallback(t,e,n))}stringMapKeyRemoved(e,t,n){const r=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,r.writer(this.receiver[e]),n):this.invokeChangedCallback(e,r.writer(r.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:n,writer:r}of this.valueDescriptors)null==n||this.controller.data.has(e)||this.invokeChangedCallback(t,r(n),void 0)}invokeChangedCallback(e,t,n){const r=`${e}Changed`,i=this.receiver[r];if("function"==typeof i){const r=this.valueDescriptorNameMap[e];try{const e=r.reader(t);let o=n;n&&(o=r.reader(n)),i.call(this.receiver,e,o)}catch(e){throw e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${r.name}" - ${e.message}`),e}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){const e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{const n=this.valueDescriptorMap[t];e[n.name]=n}),e}hasValue(e){const t=`has${l(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class j{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new T}start(){this.tokenListObserver||(this.tokenListObserver=new E(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var n;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var n;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function x(e,t){const n=M(e);return Array.from(n.reduce((e,n)=>(function(e,t){const n=e[t];return Array.isArray(n)?n:[]}(n,t).forEach(t=>e.add(t)),e),new Set))}function M(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}class _{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new T,this.outletElementsByName=new T,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:n}){const r=this.getOutlet(e,n);r&&this.connectOutlet(r,e,n)}selectorUnmatched(e,t,{outletName:n}){const r=this.getOutletFromMap(e,n);r&&this.disconnectOutlet(r,e,n)}selectorMatchElement(e,{outletName:t}){const n=this.selector(t),r=this.hasOutlet(e,t),i=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return!!n&&r&&i&&e.matches(n)}elementMatchedAttribute(e,t){const n=this.getOutletNameFromOutletAttributeName(t);n&&this.updateSelectorObserverForOutlet(n)}elementAttributeValueChanged(e,t){const n=this.getOutletNameFromOutletAttributeName(t);n&&this.updateSelectorObserverForOutlet(n)}elementUnmatchedAttribute(e,t){const n=this.getOutletNameFromOutletAttributeName(t);n&&this.updateSelectorObserverForOutlet(n)}connectOutlet(e,t,n){var r;this.outletElementsByName.has(n,t)||(this.outletsByName.add(n,e),this.outletElementsByName.add(n,t),null===(r=this.selectorObserverMap.get(n))||void 0===r||r.pause(()=>this.delegate.outletConnected(e,t,n)))}disconnectOutlet(e,t,n){var r;this.outletElementsByName.has(n,t)&&(this.outletsByName.delete(n,e),this.outletElementsByName.delete(n,t),null===(r=this.selectorObserverMap.get(n))||void 0===r||r.pause(()=>this.delegate.outletDisconnected(e,t,n)))}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const n of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(n,t,e)}updateSelectorObserverForOutlet(e){const t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){const t=this.selector(e),n=new S(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,n),n.start()}setupAttributeObserverForOutlet(e){const t=this.attributeNameForOutletName(e),n=new w(this.scope.element,t,this);this.attributeObserverMap.set(e,n),n.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){const e=new T;return this.router.modules.forEach(t=>{x(t.definition.controllerConstructor,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(t=>t.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class I{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:n,controller:r,element:i}=this;t=Object.assign({identifier:n,controller:r,element:i},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new P(this,this.dispatcher),this.valueObserver=new A(this,this.controller),this.targetObserver=new j(this,this),this.outletObserver=new _(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,n={}){const{identifier:r,controller:i,element:o}=this;n=Object.assign({identifier:r,controller:i,element:o},n),this.application.handleError(e,`Error ${t}`,n)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,n){this.invokeControllerMethod(`${c(n)}OutletConnected`,e,t)}outletDisconnected(e,t,n){this.invokeControllerMethod(`${c(n)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const n=this.controller;"function"==typeof n[e]&&n[e](...t)}}const L="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,N=(()=>{function e(e){function t(){return Reflect.construct(e,arguments,new.target)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return function(){const t=e(function(){this.a.call(this)});t.prototype.a=function(){},new t}(),e}catch(e){return e=>class extends e{}}})();class R{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:(t=e.controllerConstructor,function(e,t){const n=N(e),r=function(e,t){return L(t).reduce((n,r)=>{const i=function(e,t,n){const r=Object.getOwnPropertyDescriptor(e,n);if(!r||!("value"in r)){const e=Object.getOwnPropertyDescriptor(t,n).value;return r&&(e.get=r.get||e.get,e.set=r.set||e.set),e}}(e,t,r);return i&&Object.assign(n,{[r]:i}),n},{})}(e.prototype,t);return Object.defineProperties(n.prototype,r),n}(t,function(e){return x(e,"blessings").reduce((t,n)=>{const r=n(e);for(const e in r){const n=t[e]||{};t[e]=Object.assign(n,r[e])}return t},{})}(t)))};var t}(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new I(this,e),this.contextsByScope.set(e,t)),t}}class D{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){return(this.data.get(this.getDataKey(e))||"").match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class F{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,t),this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${u(e)}`}}class B{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,n){let r=this.warnedKeysByObject.get(e);r||(r=new Set,this.warnedKeysByObject.set(e,r)),r.has(t)||(r.add(t),this.logger.warn(n,e))}}function V(e,t){return`[${e}~="${t}"]`}class q{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t),void 0)}findAll(...e){return e.reduce((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)],[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){return V(this.schema.targetAttributeForScope(this.identifier),e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(t=>this.deprecate(t,e))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return V(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:n}=this,r=this.schema.targetAttribute,i=this.schema.targetAttributeForScope(n);this.guide.warn(e,`target:${t}`,`Please replace ${r}="${n}.${t}" with ${i}="${t}". The ${r} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class U{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce((e,t)=>e||this.findOutlet(t),void 0)}findAll(...e){return e.reduce((e,t)=>[...e,...this.findAllOutlets(t)],[])}getSelectorForOutletName(e){const t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){const t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){const t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))}matchesElement(e,t,n){const r=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&r.split(" ").includes(n)}}class z{constructor(e,t,n,r){this.targets=new q(this),this.classes=new D(this),this.data=new F(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=n,this.guide=new B(r),this.outlets=new U(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return V(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new z(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class H{constructor(e,t,n){this.element=e,this.schema=t,this.delegate=n,this.valueListObserver=new C(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:n}=e;return this.parseValueForElementAndIdentifier(t,n)}parseValueForElementAndIdentifier(e,t){const n=this.fetchScopesByIdentifierForElement(e);let r=n.get(t);return r||(r=this.delegate.createScopeForElementAndIdentifier(e,t),n.set(t,r)),r}elementMatchedValue(e,t){const n=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,n),1==n&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const n=this.scopeReferenceCounts.get(t);n&&(this.scopeReferenceCounts.set(t,n-1),1==n&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class W{constructor(e){this.application=e,this.scopeObserver=new H(this.element,this.schema,this),this.scopesByIdentifier=new T,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new R(this.application,e);this.connectModule(t);const n=e.controllerConstructor.afterLoad;n&&n.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const n=this.modulesByIdentifier.get(t);if(n)return n.contexts.find(t=>t.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){const n=this.scopeObserver.parseValueForElementAndIdentifier(e,t);n?this.scopeObserver.elementMatchedValue(n.element,n):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,n){this.application.handleError(e,t,n)}createScopeForElementAndIdentifier(e,t){return new z(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(t=>e.connectContextForScope(t))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(t=>e.disconnectContextForScope(t))}}const $={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`,outletAttributeForScope:(e,t)=>`data-${e}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},K("abcdefghijklmnopqrstuvwxyz".split("").map(e=>[e,e]))),K("0123456789".split("").map(e=>[e,e])))};function K(e){return e.reduce((e,[t,n])=>Object.assign(Object.assign({},e),{[t]:n}),{})}class G{constructor(e=document.documentElement,t=$){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,n={})=>{this.debug&&this.logFormattedMessage(e,t,n)},this.element=e,this.schema=t,this.dispatcher=new i(this),this.router=new W(this),this.actionDescriptorFilters=Object.assign({},o)}static start(e,t){const n=new this(e,t);return n.start(),n}async start(){await new Promise(e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",()=>e()):e()}),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(e=>this.router.unloadIdentifier(e))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){const n=this.router.getContextForElementAndIdentifier(e,t);return n?n.controller:null}handleError(e,t,n){var r;this.logger.error("%s\n\n%o\n\n%o",t,e,n),null===(r=window.onerror)||void 0===r||r.call(window,t,"",0,0,e)}logFormattedMessage(e,t,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}}function J(e,t,n){return e.application.getControllerForElementAndIdentifier(t,n)}function Y(e,t,n){let r=J(e,t,n);return r||(e.application.router.proposeToConnectScopeForElementAndIdentifier(t,n),r=J(e,t,n),r||void 0)}function Z([e,t],n){return function(e){const{token:t,typeDefinition:n}=e,r=`${u(t)}-value`,i=function(e){const{controller:t,token:n,typeDefinition:r}=e,i=function(e){const{controller:t,token:n,typeObject:r}=e,i=h(r.type),o=h(r.default),s=i&&o,a=i&&!o,c=!i&&o,l=X(r.type),u=Q(e.typeObject.default);if(a)return l;if(c)return u;if(l!==u)throw new Error(`The specified default value for the Stimulus Value "${t?`${t}.${n}`:n}" must match the defined type "${l}". The provided default value of "${r.default}" is of type "${u}".`);return s?l:void 0}({controller:t,token:n,typeObject:r}),o=Q(r),s=X(r),a=i||o||s;if(a)return a;throw new Error(`Unknown value type "${t?`${t}.${r}`:n}" for "${n}" value`)}(e);return{type:i,key:r,name:a(r),get defaultValue(){return function(e){const t=X(e);if(t)return ee[t];const n=f(e,"default"),r=f(e,"type"),i=e;if(n)return i.default;if(r){const{type:e}=i,t=X(e);if(t)return ee[t]}return e}(n)},get hasCustomDefaultValue(){return void 0!==Q(n)},reader:te[i],writer:ne[i]||ne.default}}({controller:n,token:e,typeDefinition:t})}function X(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Q(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}const ee={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},te={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${Q(t)}"`);return t},boolean:e=>!("0"==e||"false"==String(e).toLowerCase()),number:e=>Number(e.replace(/_/g,"")),object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${Q(t)}"`);return t},string:e=>e},ne={default:function(e){return`${e}`},array:re,object:re};function re(e){return JSON.stringify(e)}class ie{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:n={},prefix:r=this.identifier,bubbles:i=!0,cancelable:o=!0}={}){const s=new CustomEvent(r?`${r}:${e}`:e,{detail:n,bubbles:i,cancelable:o});return t.dispatchEvent(s),s}}ie.blessings=[function(e){return x(e,"classes").reduce((e,t)=>{return Object.assign(e,(n=t,{[`${n}Class`]:{get(){const{classes:e}=this;if(e.has(n))return e.get(n);{const t=e.getAttributeName(n);throw new Error(`Missing attribute "${t}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${l(n)}Class`]:{get(){return this.classes.has(n)}}}));var n},{})},function(e){return x(e,"targets").reduce((e,t)=>{return Object.assign(e,(n=t,{[`${n}Target`]:{get(){const e=this.targets.find(n);if(e)return e;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${l(n)}Target`]:{get(){return this.targets.has(n)}}}));var n},{})},function(e){const t=function(e,t){return M(e).reduce((e,n)=>(e.push(...function(e,t){const n=e[t];return n?Object.keys(n).map(e=>[e,n[e]]):[]}(n,t)),e),[])}(e,"values"),n={valueDescriptorMap:{get(){return t.reduce((e,t)=>{const n=Z(t,this.identifier),r=this.data.getAttributeNameForKey(n.key);return Object.assign(e,{[r]:n})},{})}}};return t.reduce((e,t)=>Object.assign(e,function(e){const t=Z(e,void 0),{key:n,name:r,reader:i,writer:o}=t;return{[r]:{get(){const e=this.data.get(n);return null!==e?i(e):t.defaultValue},set(e){void 0===e?this.data.delete(n):this.data.set(n,o(e))}},[`has${l(r)}`]:{get(){return this.data.has(n)||t.hasCustomDefaultValue}}}}(t)),n)},function(e){return x(e,"outlets").reduce((e,t)=>Object.assign(e,function(e){const t=c(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e),n=this.outlets.getSelectorForOutletName(e);if(t){const n=Y(this,t,e);if(n)return n;throw new Error(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${t}Outlets`]:{get(){const t=this.outlets.findAll(e);return t.length>0?t.map(t=>{const n=Y(this,t,e);if(n)return n;console.warn(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`,t)}).filter(e=>e):[]}},[`${t}OutletElement`]:{get(){const t=this.outlets.find(e),n=this.outlets.getSelectorForOutletName(e);if(t)return t;throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(e)}},[`has${l(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}(t)),{})}],ie.targets=[],ie.outlets=[],ie.values={}},500(e,t,n){n.d(t,{default:()=>Is});var r=n(72),i=n.n(r),o=n(825),s=n.n(o),a=n(659),c=n.n(a),l=n(56),u=n.n(l),h=n(540),f=n.n(h),d=n(113),p=n.n(d),m=n(109),g={};g.styleTagTransform=p(),g.setAttributes=u(),g.insert=c().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=f(),i()(m.A,g),m.A&&m.A.locals&&m.A.locals;var y=n(891);function v(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,b(r.key),r)}}function b(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var w=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"assign",value:function(e){return e&&Object.entries(e).forEach(e=>{var[t,n]=e;this[t]=n}),this}},{key:"shouldShowSuccessMessage",get:function(){return this.successMessage}}],null&&v(t.prototype,null),n&&v(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function O(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,T(r.key),r)}}function T(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function S(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}w.autoMount=!0,w.successMessage=!0;var k=0;function E(e){return"__private_"+k+++"_"+e}var C=E("fromHtmlLangProperty"),P=E("fromMetaTag"),A=E("fromBrowserLanguage"),j=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"identifier",get:function(){return this._identifier?this._identifier:S(this,C)[C]||S(this,P)[P]||S(this,A)[A]||"en"},set:function(e){this._identifier=e}},{key:"toString",value:function(){return this.identifier}}],null&&O(t.prototype,null),n&&O(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function x(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,M(r.key),r)}}function M(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Object.defineProperty(j,A,{get:function(){var e,t;return null===(e=navigator)||void 0===e||null===(t=e.language)||void 0===t?void 0:t.split("-")[0]},set:void 0}),Object.defineProperty(j,P,{get:function(){var e,t;return null===(e=document)||void 0===e||null===(t=e.querySelector('meta[name="locale"]'))||void 0===t?void 0:t.content},set:void 0}),Object.defineProperty(j,C,{get:function(){var e,t;return null===(e=document)||void 0===e||null===(t=e.documentElement)||void 0===t?void 0:t.lang},set:void 0}),j._identifier=void 0;var _={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right"},I={ABSOLUTE:"absolute",FIXED:"fixed"},L={MODAL:"modal",POPOVER:"popover"},N=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"container",get:function(){return this._container},set:function(e){this._container=e}},{key:"placement",get:function(){return this._placement},set:function(e){if(!Object.values(_).includes(e))throw new Error("Invalid placement value: ".concat(e));this._placement=e}},{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"isSet",get:function(){return!!this._id}},{key:"style",get:function(){return this._style},set:function(e){if("object"!=typeof e)throw new Error("Style must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if(!["primaryColor","secondaryColor","typography"].includes(t))throw new Error("Invalid style property: ".concat(t));if("typography"!==t&&!this.isHexOrRgba(n))throw new Error("Invalid color value: ".concat(n," for ").concat(t,". Colors must be hex or rgb/a."))}),this._style=e}},{key:"appearance",get:function(){return this._appearance},set:function(e){if(!this.isPlainObject(e))throw new Error("Appearance must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if(!["header","launcher"].includes(t))throw new Error("Invalid appearance property: ".concat(t));if(!this.isPlainObject(n))throw new Error("Appearance ".concat(t," must be an object"));Object.entries(n).forEach(e=>{var[n,r]=e;if("header"===t&&"name"!==n)throw new Error("Invalid appearance header property: ".concat(n));if("launcher"===t&&"iconUrl"!==n)throw new Error("Invalid appearance launcher property: ".concat(n));if(null!=r&&"string"!=typeof r)throw new Error("Invalid appearance ".concat(t,".").concat(n," value: ").concat(r))})}),this._appearance=e}},{key:"whatsapp",get:function(){return this._whatsapp},set:function(e){if(!this.isPlainObject(e))throw new Error("WhatsApp must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if(!["number","restrictToChannel"].includes(t))throw new Error("Invalid WhatsApp property: ".concat(t));if(null!=n){if("number"===t&&"string"!=typeof n)throw new Error("Invalid WhatsApp number value: ".concat(n));if("restrictToChannel"===t&&"boolean"!=typeof n)throw new Error("Invalid WhatsApp restrictToChannel value: ".concat(n))}}),this._whatsapp=e}},{key:"mode",get:function(){return this._mode},set:function(e){if(!Object.values(L).includes(e))throw new Error("Invalid mode value: ".concat(e));this._mode=e}},{key:"behaviour",get:function(){return this._behaviour},set:function(e){if(null!=e){if("object"!=typeof e||Array.isArray(e))throw new Error("Invalid behaviour value: ".concat(e));this._behaviour=e}else this._behaviour=e}},{key:"hasBehaviourOverride",get:function(){return this._hasBehaviourOverride}},{key:"behaviourOverride",set:function(e){this._hasBehaviourOverride=!!e}},{key:"strategy",get:function(){return this._strategy?this._strategy:"body"==this.container?I.FIXED:I.ABSOLUTE},set:function(e){if(e&&!Object.values(I).includes(e))throw new Error("Invalid strategy value: ".concat(e));this._strategy=e}},{key:"assign",value:function(e){return e&&Object.entries(e).forEach(e=>{var[t,n]=e;this[t]=n}),this}},{key:"isHexOrRgba",value:function(e){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)||/^rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3},?\s*(0|1|0?\.\d+)?\s*\)$/.test(e)}},{key:"isPlainObject",value:function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}}],null&&x(t.prototype,null),n&&x(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function R(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,D(r.key),r)}}function D(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}N._id=void 0,N._container="body",N._placement="bottom-right",N._style={},N._appearance={},N._whatsapp={},N._mode=L.POPOVER,N._behaviour=null,N._hasBehaviourOverride=!1,N._strategy=null;var F={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right"},B=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"container",get:function(){return this._container},set:function(e){this._container=e}},{key:"placement",get:function(){return this._placement},set:function(e){if(!Object.values(F).includes(e))throw new Error("Invalid placement value: ".concat(e));this._placement=e}},{key:"appearance",get:function(){return this._appearance},set:function(e){if(!this.isPlainObject(e))throw new Error("Appearance must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if("launcher"!==t)throw new Error("Invalid appearance property: ".concat(t));if(!this.isPlainObject(n))throw new Error("Appearance ".concat(t," must be an object"));Object.entries(n).forEach(e=>{var[n,r]=e;if("iconUrl"!==n)throw new Error("Invalid appearance launcher property: ".concat(n));if(null!=r&&"string"!=typeof r)throw new Error("Invalid appearance ".concat(t,".").concat(n," value: ").concat(r))})}),this._appearance=e}},{key:"number",get:function(){return this._number},set:function(e){if(null!=e&&"string"!=typeof e)throw new Error("Invalid number value: ".concat(e));this._number=e}},{key:"body",get:function(){return this._body},set:function(e){if(null!=e&&"string"!=typeof e)throw new Error("Invalid body value: ".concat(e));this._body=e}},{key:"assign",value:function(e){return e&&Object.entries(e).forEach(e=>{var[t,n]=e;this[t]=n}),this}},{key:"isPlainObject",value:function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}}],null&&R(t.prototype,null),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function V(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,q(r.key),r)}}function q(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}B._id=void 0,B._container="body",B._placement="bottom-right",B._appearance={},B._number=null,B._body=null;var U=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"assign",value:function(e){if(e){var t=Object.prototype.hasOwnProperty.call(e,"apiRoot")&&!Object.prototype.hasOwnProperty.call(e,"actionCableUrl");Object.entries(e).forEach(e=>{var[t,n]=e;"forms"===t?this.forms=w.assign(n):"webchat"===t?this.webchat=N.assign(n):"whatsappWidget"===t?this.whatsapp=B.assign(n):this[t]=n}),t&&(this.actionCableUrl=this.actionCableUrlForApiRoot(this.apiRoot))}return this}},{key:"locale",get:function(){return j.toString()},set:function(e){j.identifier=e}},{key:"endpoint",value:function(e){return"".concat(this.apiRoot,"/").concat(e)}},{key:"actionCableUrlForApiRoot",value:function(e){try{var t=new URL(e),n="https:"===t.protocol?"wss:":"ws:";return t.protocol=n,t.pathname="/cable",t.search="",t.hash="",t.toString()}catch(e){return this.actionCableUrl}}}],null&&V(t.prototype,null),n&&V(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function z(e){var t="function"==typeof Map?new Map:void 0;return z=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return H(e,arguments,K(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),$(r,e)},z(e)}function H(e,t,n){return H=W()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&$(i,n.prototype),i},H.apply(null,arguments)}function W(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$(e,t)}function K(e){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K(e)}U.apiRoot="https://api.hellotext.com/v1",U.actionCableUrl="wss://www.hellotext.com/cable",U.autoGenerateSession=!0,U.session=null,U.forms=w,U.webchat=N,U.whatsapp=B;var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$(e,t)}(o,e);var t,n,r,i=(n=o,r=W(),function(){var e,t=K(n);if(r){var i=K(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,"".concat(e," is not valid. Please provide a valid event name"))).name="InvalidEvent",t}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(z(Error));function J(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t,n){return(t=Q(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function X(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,Q(r.key),r)}}function Q(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ee=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.subscribers={}}var t,n,r;return t=e,r=[{key:"valid",value:function(t){return e.exists(t)}},{key:"invalid",value:function(e){return!this.valid(e)}},{key:"exists",value:function(e){return void 0!==this.events.find(t=>t===e)}}],(n=[{key:"addSubscriber",value:function(t,n){if(e.invalid(t))throw new G(t);this.subscribers=Y(Y({},this.subscribers),{},{[t]:this.subscribers[t]?[...this.subscribers[t],n]:[n]})}},{key:"removeSubscriber",value:function(t,n){if(e.invalid(t))throw new G(t);this.subscribers[t]&&(this.subscribers[t]=this.subscribers[t].filter(e=>e!==n))}},{key:"dispatch",value:function(e,t){var n;null===(n=this.subscribers[e])||void 0===n||n.forEach(e=>{e(t)})}},{key:"listeners",get:function(){return 0!==Object.keys(this.subscribers).length}}])&&X(t.prototype,n),r&&X(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function te(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ne(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,re(r.key),r)}}function re(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}ee.events=["session-set","utm-set","forms:collected","form:completed","webchat:mounted","webchat:opened","webchat:closed","webchat:message:sent","webchat:message:received","cart.added"];var ie=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("public/businesses")}},{key:"get",value:function(){var e,t=(e=function*(e){return fetch("".concat(this.endpoint,"/").concat(e),{method:"GET",headers:{Authorization:"Bearer ".concat(e),Accept:"application/json","Content-Type":"application/json"}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){te(o,r,i,s,a,"next",e)}function a(e){te(o,r,i,s,a,"throw",e)}s(void 0)})});return function(e){return t.apply(this,arguments)}}()}],n&&ne(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function oe(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,se(r.key),r)}}function se(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ae=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.urlSearchParams=new URLSearchParams(window.location.search)}var t,n,r;return t=e,r=[{key:"inPreviewMode",get:function(){return(new this).inPreviewMode}}],(n=[{key:"get",value:function(e){return this.urlSearchParams.get(this.toHellotextParam(e))}},{key:"has",value:function(e){return this.urlSearchParams.has(this.toHellotextParam(e))}},{key:"inPreviewMode",get:function(){return this.has("preview")}},{key:"session",get:function(){return this.get("session")}},{key:"toHellotextParam",value:function(e){return"hello_".concat(e)}}])&&oe(t.prototype,n),r&&oe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ce(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function le(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,ue(r.key),r)}}function ue(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function he(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var fe=0;function de(e){return"__private_"+fe+++"_"+e}var pe=de("success"),me=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,pe,{writable:!0,value:void 0}),this.response=n,he(this,pe)[pe]=t}var t,n,r,i;return t=e,n=[{key:"data",get:function(){return this.response}},{key:"json",value:(r=function*(){return yield this.response.json()},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){ce(o,n,i,s,a,"next",e)}function a(e){ce(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})},{key:"failed",get:function(){return!1===he(this,pe)[pe]}},{key:"succeeded",get:function(){return!0===he(this,pe)[pe]}}],n&&le(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ge(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ye(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,ve(r.key),r)}}function ve(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var be=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("track/events")}},{key:"create",value:(r=function*(e){var{headers:t,body:n,keepalive:r=!1}=e;if(ae.inPreviewMode)return new me(!0,{received:!0});var i={method:"POST",headers:t,body:JSON.stringify(n)};r&&(i.keepalive=!0);var o=yield fetch(this.endpoint,i);return new me(200===o.status,yield o.json())},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){ge(o,n,i,s,a,"next",e)}function a(e){ge(o,n,i,s,a,"throw",e)}s(void 0)})},function(e){return i.apply(this,arguments)})}],null&&ye(t.prototype,null),n&&ye(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function we(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 Oe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach(function(t){Te(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Te(e,t,n){return(t=Ce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Se(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ke(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Se(o,r,i,s,a,"next",e)}function a(e){Se(o,r,i,s,a,"throw",e)}s(void 0)})}}function Ee(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,Ce(r.key),r)}}function Ce(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Pe=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("public/forms")}},{key:"get",value:function(){var e=ke(function*(e){var t=new URL("".concat(this.endpoint,"/").concat(e));return t.searchParams.append("session",ii.session),t.searchParams.append("locale",j.toString()),fetch(t,{method:"GET",headers:ii.headers})});return function(t){return e.apply(this,arguments)}}()},{key:"submit",value:(r=ke(function*(e,t){var n=yield fetch("".concat(this.endpoint,"/").concat(e,"/submissions"),{method:"POST",headers:ii.headers,body:JSON.stringify(Oe({session:ii.session},t))});return new me(n.ok,n)}),function(e,t){return r.apply(this,arguments)})}],n&&Ee(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ae(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 je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(n),!0).forEach(function(t){xe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xe(e,t,n){return(t=Ie(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _e(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,Ie(r.key),r)}}function Ie(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Le=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("public/identifications")}},{key:"create",value:(r=function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=yield fetch(this.endpoint,{method:"POST",headers:ii.headers,body:JSON.stringify(je({session:ii.session},e))});return new me(t.ok,t)},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){Me(o,n,i,s,a,"next",e)}function a(e){Me(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})}],null&&_e(t.prototype,null),n&&_e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Ne=Le;function Re(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function De(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,Fe(r.key),r)}}function Fe(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Be=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("public/webchats")}},{key:"get",value:function(){var e,t=(e=function*(e){var t=new URL("".concat(this.endpoint,"/").concat(e));t.searchParams.append("session",ii.session),t.searchParams.append("locale",j.toString()),Object.entries(U.webchat.style).forEach(e=>{var[n,r]=e;t.searchParams.append("style[".concat(n,"]"),r)}),this.appendWebchatOverrides(t),t.searchParams.append("placement",U.webchat.placement);var n=yield fetch(t,{method:"GET",headers:ii.headers}),r=yield n.json();return ii.business.data||(ii.business.setData(r.business),ii.business.setLocale(r.locale)),(new DOMParser).parseFromString(r.html,"text/html").querySelector("article")},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Re(o,r,i,s,a,"next",e)}function a(e){Re(o,r,i,s,a,"throw",e)}s(void 0)})});return function(e){return t.apply(this,arguments)}}()},{key:"appendWebchatOverrides",value:function(e){var t,n,{appearance:r,whatsapp:i}=U.webchat;this.appendIfSupplied(e,"webchat[appearance][header][name]",null===(t=r.header)||void 0===t?void 0:t.name),this.appendIfSupplied(e,"webchat[appearance][launcher][icon_url]",null===(n=r.launcher)||void 0===n?void 0:n.iconUrl),this.appendIfSupplied(e,"webchat[handoff][identifier]",i.number),this.appendIfSupplied(e,"webchat[handoff][restrict_to_channel]",i.restrictToChannel)}},{key:"appendIfSupplied",value:function(e,t,n){null!=n&&e.searchParams.append(t,String(n))}}],n&&De(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Ve=Be;function qe(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ue(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){qe(o,r,i,s,a,"next",e)}function a(e){qe(o,r,i,s,a,"throw",e)}s(void 0)})}}function ze(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,He(r.key),r)}}function He(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var We=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("public/widgets/whatsapp")}},{key:"get",value:function(){var e=Ue(function*(e){var t=new URL("".concat(this.endpoint,"/").concat(e));t.searchParams.append("locale",j.toString()),t.searchParams.append("placement",U.whatsapp.placement),this.appendWhatsAppOverrides(t);var n=yield this.fetchWidget(t);if(!n.ok)return null;var r=yield this.parseWidgetResponse(n);return r?(ii.business.data||(ii.business.setData(r.business),ii.business.setLocale(r.locale)),(new DOMParser).parseFromString(r.html,"text/html").querySelector("article")):null});return function(t){return e.apply(this,arguments)}}()},{key:"appendWhatsAppOverrides",value:function(e){var t,{appearance:n,body:r,number:i}=U.whatsapp;this.appendIfSupplied(e,"whatsapp[appearance][launcher][icon_url]",null===(t=n.launcher)||void 0===t?void 0:t.iconUrl),this.appendIfSupplied(e,"whatsapp[number]",i),this.appendIfSupplied(e,"whatsapp[body]",r)}},{key:"appendIfSupplied",value:function(e,t,n){null!=n&&e.searchParams.append(t,String(n))}},{key:"fetchWidget",value:(i=Ue(function*(e){try{return yield fetch(e,{method:"GET",headers:ii.headers})}catch(e){return{ok:!1}}}),function(e){return i.apply(this,arguments)})},{key:"parseWidgetResponse",value:(r=Ue(function*(e){try{return yield e.json()}catch(e){return null}}),function(e){return r.apply(this,arguments)})}],n&&ze(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const $e=We;function Ke(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 Ge(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ke(Object(n),!0).forEach(function(t){Je(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Je(e,t,n){return(t=Xe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ye(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ze(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,Xe(r.key),r)}}function Xe(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Qe=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return U.endpoint("public/acks")}},{key:"send",value:(r=function*(){var e=Ge(Ge({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{session:ii.session,at:(new Date).toISOString()});fetch(this.endpoint,{method:"POST",headers:ii.headers,body:JSON.stringify(e),keepalive:!0})},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){Ye(o,n,i,s,a,"next",e)}function a(e){Ye(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})}],null&&Ze(t.prototype,null),n&&Ze(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const et=Qe;function tt(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,nt(r.key),r)}}function nt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function rt(e){var t=JSON.stringify(e);return"undefined"==typeof Blob?t.length<6e4:new Blob([t]).size<6e4}var it=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"businesses",get:function(){return ie}},{key:"events",get:function(){return be}},{key:"forms",get:function(){return Pe}},{key:"webchats",get:function(){return Ve}},{key:"whatsappWidgets",get:function(){return $e}},{key:"identifications",get:function(){return Ne}},{key:"acks",get:function(){return et}}],null&&tt(t.prototype,null),n&&tt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const ot={en:{white_label:{powered_by:"By"},errors:{parameter_not_unique:"This value is taken.",blank:"This field is required."},forms:{phone:"Click the link sent via SMS to verify your submission.",email:"Click the link sent via email to verify your submission.",phone_and_email:"Click the links sent via SMS and email to verify your submission.",none:"Your submission has been received."}},es:{white_label:{powered_by:"Por"},errors:{parameter_not_unique:"Este valor ya está en uso.",blank:"Este campo es obligatorio."},forms:{phone:"Haga clic en el enlace enviado por SMS para verificar su envío.",email:"Haga clic en el enlace enviado por e-mail para verificar su envío.",phone_and_email:"Haga clic en los enlaces enviados por SMS y e-mail para verificar su envío.",none:"Su envío ha sido recibido."}}};function st(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function at(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,ct(r.key),r)}}function ct(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var lt="data-hellotext-stylesheet",ut=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=t,this.data=null,this.stylesheet=null,this.stylesheetLoaded=Promise.resolve(!1)}var t,n,r,i,o;return t=e,n=[{key:"hydrate",value:(i=function*(){try{var e=yield ie.get(this.id);if(!1===e.ok)return null;var t=yield e.json();return t?(this.setData(t),t.locale&&this.setLocale(t.locale),t):null}catch(e){return null}},o=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(e){st(o,n,r,s,a,"next",e)}function a(e){st(o,n,r,s,a,"throw",e)}s(void 0)})},function(){return o.apply(this,arguments)})},{key:"setData",value:function(e){this.data=e,"undefined"!=typeof document&&e.style_url?(this.stylesheet=this.constructor.ensureStylesheet(e.style_url),this.stylesheetLoaded=this.constructor.waitForStylesheet(this.stylesheet)):(this.stylesheet=null,this.stylesheetLoaded=Promise.resolve(!1))}},{key:"subscription",get:function(){return this.data.subscription}},{key:"country",get:function(){return this.data.country}},{key:"enabledWhitelist",get:function(){return"disabled"!==this.data.whitelist}},{key:"setLocale",value:function(e){if(!ot[e])return console.warn("Locale ".concat(e," not found"));this.data||(this.data={}),this.data.locale=e}},{key:"locale",get:function(){return ot[this.data.locale]}},{key:"features",get:function(){return this.data.features}}],r=[{key:"stylesheetSelector",get:function(){return'link[rel="stylesheet"]['.concat(lt,"]")}},{key:"ensureStylesheet",value:function(e){var t=this.normalizedStylesheetUrl(e),n=this.stylesheetLinks.find(e=>e.href===t);if(n)return n.setAttribute(lt,"true"),n;var r=document.createElement("link");return r.rel="stylesheet",r.href=e,r.setAttribute(lt,"true"),this.waitForStylesheet(r),document.head.append(r),r}},{key:"stylesheetLinks",get:function(){return"undefined"==typeof document?[]:Array.from(document.querySelectorAll(this.stylesheetSelector))}},{key:"latestStylesheet",get:function(){return this.stylesheetLinks[this.stylesheetLinks.length-1]}},{key:"normalizedStylesheetUrl",value:function(e){try{return new URL(e,document.baseURI).href}catch(t){return e}}},{key:"waitForStylesheet",value:function(e){return e?this.stylesheetIsLoaded(e)?Promise.resolve(!0):"false"===e.dataset.hellotextStylesheetLoaded?Promise.resolve(!1):(e._hellotextStylesheetLoaded||(e._hellotextStylesheetLoaded=new Promise(t=>{var n,r=r=>{clearTimeout(n),e.removeEventListener("load",i),e.removeEventListener("error",o),e.dataset.hellotextStylesheetLoaded=r?"true":"false",t(r)},i=()=>r(this.stylesheetIsLoaded(e)),o=()=>r(!1);e.addEventListener("load",i),e.addEventListener("error",o),(n=setTimeout(()=>r(this.stylesheetIsLoaded(e)),1e4)).unref&&n.unref()})),e._hellotextStylesheetLoaded):Promise.resolve(!1)}},{key:"stylesheetIsLoaded",value:function(e){return"true"===e.dataset.hellotextStylesheetLoaded||!!e.sheet}}],n&&at(t.prototype,n),r&&at(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ht(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,ft(r.key),r)}}function ft(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var dt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"set",value:function(e,t){if("undefined"!=typeof document){var n="https:"===window.location.protocol?"; Secure":"",r=bt.getRootDomain(),i=31536e4;document.cookie=r?"".concat(e,"=").concat(t,"; path=/").concat(n,"; domain=").concat(r,"; max-age=").concat(i,"; SameSite=Lax"):"".concat(e,"=").concat(t,"; path=/").concat(n,"; max-age=").concat(i,"; SameSite=Lax")}return"hello_session"===e&&ii.eventEmitter.dispatch("session-set",t),"hello_utm"===e&&ii.eventEmitter.dispatch("utm-set",t),t}},{key:"get",value:function(e){var t;return"undefined"!=typeof document?null===(t=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)"))||void 0===t?void 0:t.pop():void 0}},{key:"delete",value:function(e){if("undefined"!=typeof document){var t=bt.getRootDomain(),n="https:"===window.location.protocol?"; Secure":"";document.cookie=t?"".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT").concat(n,"; domain=").concat(t,"; SameSite=Lax"):"".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT").concat(n,"; SameSite=Lax")}}}],null&&ht(t.prototype,null),n&&ht(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function pt(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,mt(r.key),r)}}function mt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var gt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var t=new URLSearchParams(window.location.search),n={source:t.get("utm_source"),medium:t.get("utm_medium"),campaign:t.get("utm_campaign"),term:t.get("utm_term"),content:t.get("utm_content")};this.save(n)}var t,n;return t=e,n=[{key:"save",value:function(e){if(e.source&&e.medium){var t=Object.fromEntries(Object.entries(e).filter(e=>{var[t,n]=e;return n}));dt.set("hello_utm",JSON.stringify(t))}}},{key:"current",get:function(){try{return JSON.parse(dt.get("hello_utm"))||{}}catch(e){return{}}}}],n&&pt(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function yt(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,vt(r.key),r)}}function vt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var bt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.utm=new gt,this._url=t}var t,n,r;return t=e,r=[{key:"getRootDomain",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{if(!e){var t;if("undefined"==typeof window||null===(t=window.location)||void 0===t||!t.hostname)return null;e=window.location.hostname}var n=e.split(".");if(n.length<=1)return e;for(var r of["myshopify.com","vtexcommercestable.com.br","myvtex.com","wixsite.com"]){var i=r.split(".");if(n.slice(-i.length).join(".")===r&&n.length>i.length)return".".concat(n.slice(-(i.length+1)).join("."))}var o=n[n.length-1],s=n[n.length-2];return n.length>2&&2===o.length&&s.length<=3?".".concat(n.slice(-3).join(".")):".".concat(n.slice(-2).join("."))}catch(e){return null}}}],(n=[{key:"url",get:function(){return null!==this._url&&void 0!==this._url?this._url:window.location.href}},{key:"title",get:function(){return document.title}},{key:"path",get:function(){if(this._url)try{return new URL(this._url).pathname}catch(e){return"/"}return window.location.pathname}},{key:"utmParams",get:function(){return this.utm.current}},{key:"trackingData",get:function(){return{page:{url:this.url,title:this.title,path:this.path},utm_params:this.utmParams}}},{key:"domain",get:function(){try{var t=this.url;if(!t)return null;var n=new URL(t).hostname;return e.getRootDomain(n)}catch(e){return null}}}])&&yt(t.prototype,n),r&&yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function wt(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,Ot(r.key),r)}}function Ot(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Tt(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var St=0;function kt(e){return"__private_"+St+++"_"+e}var Et=kt("session"),Ct=kt("query"),Pt=kt("page"),At=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"session",get:function(){return Tt(this,Et)[Et]},set:function(e){var t=dt.get("hello_session");return Tt(this,Et)[Et]=e,dt.set("hello_session",e),t!==e&&dt.delete("hello_session_ack_at"),dt.get("hello_session_ack_at")||(it.acks.send(this.ackPayload),dt.set("hello_session_ack_at",(new Date).toISOString())),Tt(this,Et)[Et]}},{key:"ackPayload",get:function(){var e;return{utm_params:(null===(e=Tt(this,Pt)[Pt])||void 0===e?void 0:e.utmParams)||{}}}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new bt;Tt(this,Pt)[Pt]=e,Tt(this,Ct)[Ct]=new ae,this.session=Tt(this,Ct)[Ct].session||U.session||dt.get("hello_session"),!this.session&&U.autoGenerateSession&&(this.session=crypto.randomUUID())}}],null&&wt(t.prototype,null),n&&wt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function jt(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,xt(r.key),r)}}function xt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Object.defineProperty(At,Et,{writable:!0,value:void 0}),Object.defineProperty(At,Ct,{writable:!0,value:void 0}),Object.defineProperty(At,Pt,{writable:!0,value:void 0});var Mt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"build",value:function(e){var t=document.createElement("article"),n=document.createElement("label"),r=document.createElement("input");n.innerText=e.label,r.type=e.type,r.required=e.required,r.placeholder=e.placeholder,["first_name","last_name"].includes(e.kind)?(r.type="text",r.id=r.name=e.kind,n.setAttribute("for",e.kind)):(r.type=e.type,"email"===e.type?(r.id=r.name="email",n.setAttribute("for","email")):"tel"===r.type?(r.id=r.name="phone",n.setAttribute("for","phone"),r.value="+".concat(ii.business.country.prefix),r.setAttribute("data-default-value","+".concat(ii.business.country.prefix))):(r.name=r.id="property_by_id[".concat(e.property,"]"),n.setAttribute("for","property_by_id[".concat(e.property,"]"))));var i=document.createElement("main");i.appendChild(n),i.appendChild(r),t.appendChild(i),t.setAttribute("data-hellotext--form-target","inputContainer"),r.setAttribute("data-hellotext--form-target","input");var o=document.createElement("div");return o.setAttribute("data-error-container",""),t.appendChild(o),t}}],null&&jt(t.prototype,null),n&&jt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function _t(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,It(r.key),r)}}function It(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Lt=0;function Nt(e){return"__private_"+Lt+++"_"+e}var Rt=Nt("template"),Dt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"build",value:function(){var e=document.createElement("div");return e.innerHTML=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,Rt)[Rt](),e.firstElementChild}}],null&&_t(t.prototype,null),n&&_t(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bt(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,i,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ft(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ft(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.")}()}Object.defineProperty(Dt,Rt,{value:function(){var e="https://www.hellotext.com?hello_session=".concat(ii.session);return"\n <div data-logo-container>\n <small>".concat(ii.business.locale.white_label.powered_by,'</small>\n\n <a href="').concat(e,'" rel="noreferrer" target="_blank">\n <svg data-hello-brand viewBox="0 0 224 43" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Hellotext</title>\n <path d="M28.2760919,19.3224299 L28.2760919,31.1946615 C28.2760919,32.2088722 27.5005873,32.9844452 26.4864658,32.9844452 L21.0579334,32.9844452 C20.043812,32.9844452 19.2683073,32.2088722 19.2683073,31.1946615 L19.2683073,19.9786839 C19.2683073,16.7570733 17.4190271,14.7883113 14.4959712,14.7883113 C11.0360274,14.7883113 8.76916774,17.11503 8.76916774,21.1122135 L8.76916774,31.3139804 C8.76916774,32.3281911 7.99366311,33.1037641 6.97954167,33.1037641 L1.78962607,33.1037641 C0.77550463,33.1037641 0,32.3281911 0,31.3139804 L0,3.45301476 C0,2.43880402 0.77550463,1.6632311 1.78962607,1.6632311 L6.97954167,1.6632311 C7.99366311,1.6632311 8.76916774,2.43880402 8.76916774,3.45301476 L8.76916774,9.06100356 L8.11297151,16.3991166 L8.70951354,16.458776 C9.78328918,11.6860196 13.5415039,8.52406846 18.4331485,8.52406846 C24.3389145,8.52406846 28.2760919,12.8195492 28.2760919,19.3224299 Z M61.1455574,26.3622456 C58.9980061,30.7173858 53.6291279,33.5213803 47.0671656,33.5213803 C37.9997269,33.5213803 31.4377646,28.2116887 31.4377646,20.7542568 C31.4377646,13.6547816 37.2838764,8.52406846 46.0530442,8.52406846 C53.7484363,8.52406846 59.1769687,12.4615925 59.8928191,18.8451542 C60.0121275,19.9190244 59.1769687,20.8735757 58.103193,20.8735757 L40.1472781,20.8735757 C40.4455492,24.8110998 43.1299883,27.2571374 47.186474,27.2571374 C50.2288383,27.2571374 52.8536232,25.7656511 54.1660157,23.4389323 C54.5835951,22.6633594 55.5380623,22.3054026 56.3732212,22.6036999 L60.1314359,23.9758674 C61.0859032,24.2741647 61.622791,25.4076943 61.1455574,26.3622456 Z M40.5648576,17.3536679 L50.706072,17.2343489 C50.0498757,14.7286518 48.3795581,13.5354627 45.8740816,13.5354627 C43.3089509,13.5354627 41.4000164,14.9672896 40.5648576,17.3536679 Z M120.143563,20.9928946 C120.143563,28.2116887 113.641255,33.4617208 104.693125,33.4617208 C95.8046489,33.4617208 89.361995,28.2116887 89.361995,20.9928946 C89.361995,13.7741005 95.8046489,8.52406846 104.693125,8.52406846 C113.641255,8.52406846 120.143563,13.7741005 120.143563,20.9928946 Z M111.076125,21.1122135 C111.076125,17.2940084 108.45134,14.7883113 104.633471,14.7883113 C100.93491,14.7883113 98.3697796,17.2940084 98.3697796,20.9332352 C98.3697796,24.7514403 100.994564,27.2571374 104.812433,27.2571374 C108.570648,27.2571374 111.076125,24.7514403 111.076125,21.1122135 Z M141.559422,26.8395213 C141.261151,25.5866727 139.82945,25.0497376 138.815329,25.8253105 C137.443282,26.8395213 136.190544,27.2571374 134.99746,27.2571374 C132.909563,27.2571374 131.835787,26.0042889 131.835787,23.796889 L131.835787,13.9530789 L139.471525,13.9530789 C140.24703,13.9530789 140.903226,13.2968249 140.903226,12.521252 L140.903226,10.4928305 C140.903226,9.71725757 140.24703,9.06100356 139.471525,9.06100356 L131.835787,9.06100356 L131.835787,3.45301476 C131.835787,2.43880402 131.060282,1.6632311 130.046161,1.6632311 L125.214171,1.6632311 C124.200049,1.6632311 123.424545,2.43880402 123.424545,3.45301476 L123.424545,9.06100356 L123.424545,13.9530789 L123.424545,24.7514403 C123.424545,30.2401102 127.182759,33.5213803 133.565759,33.5213803 C136.727432,33.5213803 139.471525,32.6861479 141.499768,31.0753426 C142.036656,30.6577264 142.275272,29.9418129 142.09631,29.2855589 L141.559422,26.8395213 Z M173.414766,26.3622456 C171.267215,30.7173858 165.898337,33.5213803 159.336374,33.5213803 C150.268936,33.5213803 143.706973,28.2116887 143.706973,20.7542568 C143.706973,13.6547816 149.553085,8.52406846 158.322253,8.52406846 C166.017645,8.52406846 171.446177,12.4615925 172.162028,18.8451542 C172.281336,19.9190244 171.446177,20.8735757 170.372402,20.8735757 L152.416487,20.8735757 C152.714758,24.8110998 155.399197,27.2571374 159.455683,27.2571374 C162.498047,27.2571374 165.122832,25.7656511 166.435224,23.4389323 C166.852804,22.6633594 167.807271,22.3054026 168.64243,22.6036999 L172.400645,23.9758674 C173.414766,24.2741647 173.892,25.4076943 173.414766,26.3622456 Z M152.834066,17.3536679 L162.975281,17.2343489 C162.319084,14.7286518 160.648767,13.5354627 158.14329,13.5354627 C155.637814,13.5354627 153.669225,14.9672896 152.834066,17.3536679 Z M192.862036,20.8139163 L201.094316,12.0439763 C202.168092,10.9104467 201.332933,9.00134411 199.781923,9.00134411 L194.711316,9.00134411 C194.174428,9.00134411 193.637541,9.23998193 193.279615,9.71725757 L188.507279,15.8621815 L183.734943,9.71725757 C183.377018,9.29964138 182.899784,9.00134411 182.303242,9.00134411 L177.113327,9.00134411 C175.562317,9.00134411 174.727159,10.8507872 175.800934,12.0439763 L184.092868,20.8735757 L175.502663,30.0014724 C174.428888,31.135002 175.204392,33.0441046 176.815056,33.0441046 L181.945317,33.0441046 C182.482205,33.0441046 183.019093,32.8054668 183.377018,32.3878506 L188.447625,25.9446294 L193.577886,32.3878506 C193.935812,32.8054668 194.413045,33.0441046 194.949933,33.0441046 L200.139849,33.0441046 C201.690858,33.0441046 202.526017,31.1946615 201.452241,30.0611318 L192.862036,20.8139163 Z M223.941875,29.2258995 L223.345333,26.8395213 C223.047062,25.5866727 221.615362,25.0497376 220.60124,25.8253105 C219.229193,26.8395213 217.976455,27.2571374 216.783371,27.2571374 C214.695474,27.2571374 213.621698,26.0042889 213.621698,23.796889 L213.621698,13.9530789 L221.257436,13.9530789 C222.032941,13.9530789 222.689137,13.2968249 222.689137,12.521252 L222.689137,10.4928305 C222.689137,9.71725757 222.032941,9.06100356 221.257436,9.06100356 L213.621698,9.06100356 L213.621698,3.45301476 C213.621698,2.43880402 212.846194,1.6632311 211.832072,1.6632311 L207.000082,1.6632311 C205.985961,1.6632311 205.210456,2.43880402 205.210456,3.45301476 L205.210456,9.06100356 L205.210456,13.9530789 L205.210456,24.7514403 C205.210456,30.2401102 208.968671,33.5213803 215.35167,33.5213803 C218.513343,33.5213803 221.257436,32.6861479 223.285679,31.0753426 C223.882221,30.5980669 224.120838,29.8821535 223.941875,29.2258995 Z M77.6697714,6.01837134 C78.2663134,5.30245788 78.2663134,4.22858768 77.6101172,3.57233367 L74.5677529,0.529701449 C73.8519024,-0.186212015 72.6588184,-0.186212015 71.942968,0.589360904 C61.3841742,12.4615925 61.3841742,30.5384075 71.942968,42.4106391 C72.5991642,43.186212 73.8519024,43.186212 74.5677529,42.4702986 L77.6101172,39.4276663 C78.2663134,38.7714123 78.3259676,37.6975421 77.6697714,36.9816287 C69.9147251,28.1520293 69.9147251,14.8479707 77.6697714,6.01837134 Z M87.1547896,10.6718089 L84.1124252,7.62917663 C83.3965748,6.91326317 82.1438366,6.91326317 81.4876403,7.74849554 C78.2663134,11.6263601 76.4766873,16.458776 76.4766873,21.5298297 C76.4766873,26.6008834 78.2663134,31.4332993 81.4876403,35.3111639 C82.1438366,36.0867368 83.3965748,36.1463963 84.1124252,35.4304828 L87.1547896,32.3878506 C87.8109858,31.7315966 87.87064,30.7173858 87.3337522,30.0611318 C85.4248177,27.6747536 84.351042,24.6917809 84.351042,21.5894892 C84.351042,18.4871975 85.3651635,15.5042247 87.3337522,13.1178465 C87.87064,12.3422736 87.8109858,11.3280629 87.1547896,10.6718089 Z" id="hellotext" fill="currentColor"></path>\n </svg>\n </a>\n </div>\n ')}});const Vt=Object.entries,qt=Object.setPrototypeOf,Ut=Object.isFrozen,zt=Object.getPrototypeOf,Ht=Object.getOwnPropertyDescriptor;let Wt=Object.freeze,$t=Object.seal,Kt=Object.create,Gt="undefined"!=typeof Reflect&&Reflect,Jt=Gt.apply,Yt=Gt.construct;Wt||(Wt=function(e){return e}),$t||($t=function(e){return e}),Jt||(Jt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),Yt||(Yt=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 new e(...n)});const Zt=bn(Array.prototype.forEach),Xt=bn(Array.prototype.lastIndexOf),Qt=bn(Array.prototype.pop),en=bn(Array.prototype.push),tn=bn(Array.prototype.splice),nn=Array.isArray,rn=bn(String.prototype.toLowerCase),on=bn(String.prototype.toString),sn=bn(String.prototype.match),an=bn(String.prototype.replace),cn=bn(String.prototype.indexOf),ln=bn(String.prototype.trim),un=bn(Number.prototype.toString),hn=bn(Boolean.prototype.toString),fn="undefined"==typeof BigInt?null:bn(BigInt.prototype.toString),dn="undefined"==typeof Symbol?null:bn(Symbol.prototype.toString),pn=bn(Object.prototype.hasOwnProperty),mn=bn(Object.prototype.toString),gn=bn(RegExp.prototype.test),yn=(vn=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Yt(vn,t)});var vn;function bn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Jt(e,t,r)}}function wn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rn;if(qt&&qt(e,null),!nn(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(Ut(t)||(t[r]=e),i=e)}e[i]=!0}return e}function On(e){for(let t=0;t<e.length;t++)pn(e,t)||(e[t]=null);return e}function Tn(e){const t=Kt(null);for(const r of Vt(e)){var n=Bt(r,2);const i=n[0],o=n[1];pn(e,i)&&(nn(o)?t[i]=On(o):o&&"object"==typeof o&&o.constructor===Object?t[i]=Tn(o):t[i]=o)}return t}function Sn(e,t){for(;null!==e;){const n=Ht(e,t);if(n){if(n.get)return bn(n.get);if("function"==typeof n.value)return bn(n.value)}e=zt(e)}return function(){return null}}const kn=Wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),En=Wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Cn=Wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Pn=Wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),An=Wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jn=Wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xn=Wt(["#text"]),Mn=Wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),_n=Wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),In=Wt(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ln=Wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Nn=$t(/{{[\w\W]*|^[\w\W]*}}/g),Rn=$t(/<%[\w\W]*|^[\w\W]*%>/g),Dn=$t(/\${[\w\W]*/g),Fn=$t(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bn=$t(/^aria-[\-\w]+$/),Vn=$t(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qn=$t(/^(?:\w+script|data):/i),Un=$t(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zn=$t(/^html$/i),Hn=$t(/^[a-z][.\w]*(-[.\w]+)+$/i),Wn=$t(/<[/\w!]/g),$n=$t(/<[/\w]/g),Kn=$t(/<\/no(script|embed|frames)/i),Gn=$t(/\/>/i),Jn=function(){return"undefined"==typeof window?null:window},Yn=function(e,t,n,r){return pn(e,t)&&nn(e[t])?wn(r.base?Tn(r.base):{},e[t],r.transform):n};var Zn=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Jn();const n=t=>e(t);if(n.version="3.4.13",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let r=t.document;const i=r,o=i.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,a=t.Node,c=t.Element,l=t.NodeFilter;void 0===t.NamedNodeMap&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,h=t.trustedTypes,f=c.prototype,d=Sn(f,"cloneNode"),p=Sn(f,"remove"),m=Sn(f,"nextSibling"),g=Sn(f,"childNodes"),y=Sn(f,"parentNode"),v=Sn(f,"shadowRoot"),b=Sn(f,"attributes"),w=a&&a.prototype?Sn(a.prototype,"nodeType"):null,O=a&&a.prototype?Sn(a.prototype,"nodeName"):null,T=a&&a.prototype?Sn(a.prototype,"ownerDocument"):null;if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let S,k,E="",C=!1,P=0;const A=function(){if(P>0)throw yn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},j=function(e){A(),P++;try{return S.createHTML(e)}finally{P--}},x=r,M=x.implementation,_=x.createNodeIterator,I=x.createDocumentFragment,L=x.getElementsByTagName,N=i.importNode;let R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Vt&&"function"==typeof y&&M&&void 0!==M.createHTMLDocument;const D=Nn,F=Rn,B=Dn,V=Fn,q=Bn,U=qn,z=Un,H=Hn;let W=Vn,$=null;const K=wn({},[...kn,...En,...Cn,...An,...xn]);let G=null;const J=wn({},[...Mn,..._n,...In,...Ln]);let Y=Object.seal(Kt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Z=null,X=null;const Q=Object.seal(Kt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,te=!0,ne=!1,re=!0,ie=!1,oe=!0,se=!1,ae=!1,ce=null,le=null,ue=!1,he=!1,fe=!1,de=!1,pe=!0,me=!1;const ge="user-content-";let ye=!0,ve=!1,be={},we=null;const Oe=wn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Te=null;const Se=wn({},["audio","video","img","source","image","track"]);let ke=null;const Ee=wn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ce="http://www.w3.org/1998/Math/MathML",Pe="http://www.w3.org/2000/svg",Ae="http://www.w3.org/1999/xhtml";let je=Ae,xe=!1,Me=null;const _e=wn({},[Ce,Pe,Ae],on),Ie=Wt(["mi","mo","mn","ms","mtext"]);let Le=wn({},Ie);const Ne=Wt(["annotation-xml"]);let Re=wn({},Ne);const De=wn({},["title","style","font","a","script"]);let Fe=null;const Be=["application/xhtml+xml","text/html"];let Ve=null,qe=null;const Ue=r.createElement("form"),ze=function(e){return e instanceof RegExp||e instanceof Function},He=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(qe&&qe===e)return;e&&"object"==typeof e||(e={}),e=Tn(e),Fe=-1===Be.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ve="application/xhtml+xml"===Fe?on:rn,$=Yn(e,"ALLOWED_TAGS",K,{transform:Ve}),G=Yn(e,"ALLOWED_ATTR",J,{transform:Ve}),Me=Yn(e,"ALLOWED_NAMESPACES",_e,{transform:on}),ke=Yn(e,"ADD_URI_SAFE_ATTR",Ee,{transform:Ve,base:Ee}),Te=Yn(e,"ADD_DATA_URI_TAGS",Se,{transform:Ve,base:Se}),we=Yn(e,"FORBID_CONTENTS",Oe,{transform:Ve}),Z=Yn(e,"FORBID_TAGS",Tn({}),{transform:Ve}),X=Yn(e,"FORBID_ATTR",Tn({}),{transform:Ve}),be=!!pn(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Tn(e.USE_PROFILES):e.USE_PROFILES),ee=!1!==e.ALLOW_ARIA_ATTR,te=!1!==e.ALLOW_DATA_ATTR,ne=e.ALLOW_UNKNOWN_PROTOCOLS||!1,re=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ie=e.SAFE_FOR_TEMPLATES||!1,oe=!1!==e.SAFE_FOR_XML,se=e.WHOLE_DOCUMENT||!1,he=e.RETURN_DOM||!1,fe=e.RETURN_DOM_FRAGMENT||!1,de=e.RETURN_TRUSTED_TYPE||!1,ue=e.FORCE_BODY||!1,pe=!1!==e.SANITIZE_DOM,me=e.SANITIZE_NAMED_PROPS||!1,ye=!1!==e.KEEP_CONTENT,ve=e.IN_PLACE||!1,W=function(e){try{return gn(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Vn,je="string"==typeof e.NAMESPACE?e.NAMESPACE:Ae,Le=pn(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?Tn(e.MATHML_TEXT_INTEGRATION_POINTS):wn({},Ie),Re=pn(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?Tn(e.HTML_INTEGRATION_POINTS):wn({},Ne);const t=pn(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?Tn(e.CUSTOM_ELEMENT_HANDLING):Kt(null);if(Y=Kt(null),pn(t,"tagNameCheck")&&ze(t.tagNameCheck)&&(Y.tagNameCheck=t.tagNameCheck),pn(t,"attributeNameCheck")&&ze(t.attributeNameCheck)&&(Y.attributeNameCheck=t.attributeNameCheck),pn(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Y.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),$t(Y),ie&&(te=!1),fe&&(he=!0),be&&($=wn({},xn),G=Kt(null),!0===be.html&&(wn($,kn),wn(G,Mn)),!0===be.svg&&(wn($,En),wn(G,_n),wn(G,Ln)),!0===be.svgFilters&&(wn($,Cn),wn(G,_n),wn(G,Ln)),!0===be.mathMl&&(wn($,An),wn(G,In),wn(G,Ln))),Q.tagCheck=null,Q.attributeCheck=null,pn(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Q.tagCheck=e.ADD_TAGS:nn(e.ADD_TAGS)&&($===K&&($=Tn($)),wn($,e.ADD_TAGS,Ve))),pn(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Q.attributeCheck=e.ADD_ATTR:nn(e.ADD_ATTR)&&(G===J&&(G=Tn(G)),wn(G,e.ADD_ATTR,Ve))),pn(e,"ADD_URI_SAFE_ATTR")&&nn(e.ADD_URI_SAFE_ATTR)&&wn(ke,e.ADD_URI_SAFE_ATTR,Ve),pn(e,"FORBID_CONTENTS")&&nn(e.FORBID_CONTENTS)&&(we===Oe&&(we=Tn(we)),wn(we,e.FORBID_CONTENTS,Ve)),pn(e,"ADD_FORBID_CONTENTS")&&nn(e.ADD_FORBID_CONTENTS)&&(we===Oe&&(we=Tn(we)),wn(we,e.ADD_FORBID_CONTENTS,Ve)),ye&&($["#text"]=!0),se&&wn($,["html","head","body"]),$.table&&(wn($,["tbody"]),delete Z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw yn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw yn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=S;S=e.TRUSTED_TYPES_POLICY;try{E=j("")}catch(e){throw S=t,e}}else null===e.TRUSTED_TYPES_POLICY?(S=void 0,E=""):(void 0===S&&(C||(k=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o),C=!0),S=k),S&&"string"==typeof E&&(E=j("")));Wt&&Wt(e),qe=e},We=wn({},[...En,...Cn,...Pn]),$e=wn({},[...An,...jn]),Ke=function(e){en(n.removed,{element:e});try{y(e).removeChild(e)}catch(t){if(p(e),!y(e))throw yn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ge=function(e){Ze(e);const t=g(e);if(t){const e=[];Zt(t,t=>{en(e,t)}),Zt(e,e=>{try{p(e)}catch(e){}})}const n=b(e);if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],i=r&&r.name;if("string"==typeof i)try{e.removeAttribute(i)}catch(e){}}},Je=function(e,t){try{en(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){en(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(he||fe)try{Ke(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ye=function(e){const t=b(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],i=r&&r.name;if("string"==typeof i&&!G[Ve(i)])try{e.removeAttribute(i)}catch(e){}}},Ze=function(e){const t=[e];for(;t.length>0;){const e=t.pop();1===(w?w(e):e.nodeType)&&Ye(e);const n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Xe=function(e){let t=null,n=null;if(ue)e="<remove></remove>"+e;else{const t=sn(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Fe&&je===Ae&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=S?j(e):e;if(je===Ae)try{t=(new u).parseFromString(i,Fe)}catch(e){}if(!t||!t.documentElement){t=M.createDocument(je,"template",null);try{t.documentElement.innerHTML=xe?E:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),je===Ae?L.call(t,se?"html":"body")[0]:se?t.documentElement:o},Qe=function(e){const t=T?T(e):e.ownerDocument;return _.call(t||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},et=function(e){return e=an(e,D," "),e=an(e,F," "),an(e,B," ")},tt=function(e){var t;e.normalize();const n=T?T(e):e.ownerDocument,r=_.call(n||e,e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let i=r.nextNode();for(;i;)i.data=et(i.data),i=r.nextNode();const o=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");o&&Zt(o,e=>{rt(e.content)&&tt(e.content)})},nt=function(e){const t=O?O(e):null;return"string"==typeof t&&"form"===Ve(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==b(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==w(e)||e.childNodes!==g(e))},rt=function(e){if(!w||"object"!=typeof e||null===e)return!1;try{return 11===w(e)}catch(e){return!1}},it=function(e){if(!w||"object"!=typeof e||null===e)return!1;try{return"number"==typeof w(e)}catch(e){return!1}};function ot(e,t,r){0!==e.length&&Zt(e,e=>{e.call(n,t,r,qe)})}const st=function(e,t,n,r){return 0===e.length?t:t===n||t===r?Tn(t):t},at=function(e,t){if(ot(R.beforeSanitizeElements,e,null),e!==t&&null===y(e))return ve&&Ze(e),!0;if(nt(e))return Ke(e),!0;const r=Ve(O?O(e):e.nodeName);if($=st(R.uponSanitizeElement,$,K,ce),ot(R.uponSanitizeElement,e,{tagName:r,allowedTags:$}),e!==t&&null===y(e))return ve&&Ze(e),!0;if(function(e,t){return!!(oe&&e.hasChildNodes()&&!it(e.firstElementChild)&&gn(Wn,e.textContent)&&gn(Wn,e.innerHTML))||!(!oe||e.namespaceURI!==Ae||"style"!==t||!it(e.firstElementChild))||7===e.nodeType||!(!oe||8!==e.nodeType||!gn($n,e.data))}(e,r))return Ke(e),!0;if(Z[r]||!(Q.tagCheck instanceof Function&&Q.tagCheck(r))&&!$[r]){const n=function(e,t,n){if(!Z[t]&&ut(t)){if(Y.tagNameCheck instanceof RegExp&&gn(Y.tagNameCheck,t))return!1;if(Y.tagNameCheck instanceof Function&&Y.tagNameCheck(t))return!1}if(ye&&!we[t]){const t=y(e),r=g(e);if(r&&t)for(let i=r.length-1;i>=0;--i){const o=e===n?d(r[i],!0):r[i];t.insertBefore(o,m(e))}}return Ke(e),!0}(e,r,t);return!1===n&&ot(R.afterSanitizeElements,e,null),n}if(1===(w?w(e):e.nodeType)&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:je,tagName:"template"});const n=rn(e.tagName),r=rn(t.tagName);return!!Me[e.namespaceURI]&&(e.namespaceURI===Pe?function(e,t,n){return t.namespaceURI===Ae?"svg"===e:t.namespaceURI===Ce?"svg"===e&&("annotation-xml"===n||Le[n]):Boolean(We[e])}(n,t,r):e.namespaceURI===Ce?function(e,t,n){return t.namespaceURI===Ae?"math"===e:t.namespaceURI===Pe?"math"===e&&Re[n]:Boolean($e[e])}(n,t,r):e.namespaceURI===Ae?function(e,t,n){return!(t.namespaceURI===Pe&&!Re[n])&&!(t.namespaceURI===Ce&&!Le[n])&&!$e[e]&&(De[e]||!We[e])}(n,t,r):!("application/xhtml+xml"!==Fe||!Me[e.namespaceURI]))}(e))return Ke(e),!0;if(("noscript"===r||"noembed"===r||"noframes"===r)&&gn(Kn,e.innerHTML))return Ke(e),!0;if(ie&&3===e.nodeType){const t=et(e.textContent);e.textContent!==t&&(en(n.removed,{element:e.cloneNode()}),e.textContent=t)}return ot(R.afterSanitizeElements,e,null),!1},ct=function(e,t,n){if(X[t])return!1;if(oe&&"patchsrc"===t)return!1;if(oe&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(pe&&("id"===t||"name"===t)&&(n in r||n in Ue))return!1;const i=G[t]||Q.attributeCheck instanceof Function&&Q.attributeCheck(t,e);if(te&&gn(V,t));else if(ee&&gn(q,t));else if(i){if(ke[t]);else if(gn(W,an(n,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==cn(n,"data:")||!Te[e])if(ne&&!gn(U,an(n,z,"")));else if(n)return!1}else if(!(ut(e)&&(Y.tagNameCheck instanceof RegExp&&gn(Y.tagNameCheck,e)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(e))&&(Y.attributeNameCheck instanceof RegExp&&gn(Y.attributeNameCheck,t)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(t,e))||"is"===t&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&gn(Y.tagNameCheck,n)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(n))))return!1;return!0},lt=wn({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ut=function(e){return!lt[rn(e)]&&gn(H,e)},ht=function(e,t,n,r){if(S&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!n)switch(h.getAttributeType(e,t)){case"TrustedHTML":return j(r);case"TrustedScriptURL":return function(e){A(),P++;try{return S.createScriptURL(e)}finally{P--}}(r)}return r},ft=function(e,t,r,i){try{r?e.setAttributeNS(r,t,i):e.setAttribute(t,i),nt(e)?Ke(e):Qt(n.removed)}catch(n){Je(t,e)}},dt=function(e){ot(R.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||nt(e))return;G=st(R.uponSanitizeAttribute,G,J,le);const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let r=t.length;const i=Ve(e.nodeName);for(;r--;){const o=t[r],s=o.name,a=o.namespaceURI,c=o.value,l=Ve(s),u=c;let h="value"===s?u:ln(u);n.attrName=l,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,ot(R.uponSanitizeAttribute,e,n),h=n.attrValue,!me||"id"!==l&&"name"!==l||0===cn(h,ge)||(Je(s,e),h=ge+h),oe&&gn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,h)||"attributename"===l&&sn(h,"href")?Je(s,e):n.forceKeepAttr||(!n.keepAttr||!re&&gn(Gn,h)?Je(s,e):(ie&&(h=et(h)),ct(i,l,h)?(h=ht(i,l,a,h),h!==u&&ft(e,s,a,h)):Je(s,e)))}ot(R.afterSanitizeAttributes,e,null)},pt=function(e){let t=null;const n=Qe(e);for(ot(R.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(ot(R.uponSanitizeShadowNode,t,null),at(t,e),dt(t),rt(t.content)&&pt(t.content),1===(w?w(t):t.nodeType)){const e=v(t);rt(e)&&(mt(e),pt(e))}ot(R.afterSanitizeShadowDOM,e,null)},mt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){pt(e.shadow);continue}const n=e.node,r=1===(w?w(n):n.nodeType),i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){const e=O?O(n):null;if("string"==typeof e&&"template"===Ve(e)){const e=n.content;rt(e)&&t.push({node:e,shadow:null})}}if(r){const e=v(n);rt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,a=null;if(xe=!e,xe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!it(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return un(e);case"boolean":return hn(e);case"bigint":return fn?fn(e):"0";case"symbol":return dn?dn(e):"Symbol()";case"undefined":default:return mn(e);case"function":case"object":{if(null===e)return mn(e);const t=e,n=Sn(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:mn(e)}return mn(e)}}}(e)))throw yn("dirty is not a string, aborting");if(!n.isSupported)return e;ae?($=ce,G=le):He(t),(R.uponSanitizeElement.length>0||R.uponSanitizeAttribute.length>0)&&($=Tn($)),R.uponSanitizeAttribute.length>0&&(G=Tn(G)),n.removed=[];const c=ve&&"string"!=typeof e&&it(e);if(c){!function(e){if(!oe)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=w?w(e):e.nodeType;if(7===n||8===n&&gn($n,e.data)){try{p(e)}catch(e){}continue}if(1===n){const t=e,n=Ve(O?O(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==n&&"output"!==n&&t.removeAttribute("for")}catch(e){}}const r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}}(e);const t=O?O(e):e.nodeName;if("string"==typeof t){const n=Ve(t);if(!$[n]||Z[n])throw Ge(e),yn("root node is forbidden and cannot be sanitized in-place")}if(nt(e))throw Ge(e),yn("root node is clobbered and cannot be sanitized in-place");try{mt(e)}catch(t){throw Ge(e),t}}else if(it(e))r=Xe("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o),mt(o);else{if(!he&&!ie&&!se&&-1===e.indexOf("<"))return S&&de?j(e):e;if(r=Xe(e),!r)return he?null:de?E:""}r&&ue&&Ke(r.firstChild);const l=c?e:r;try{const e=Qe(l);for(;s=e.nextNode();)at(s,l),dt(s),rt(s.content)&&pt(s.content)}catch(t){throw c&&(Ge(e),Zt(n.removed,e=>{e.element&&Ze(e.element)})),t}if(c)return Zt(n.removed,e=>{e.element&&Ze(e.element)}),ie&&tt(e),e;if(he){if(ie&&tt(r),fe)for(a=I.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(G.shadowroot||G.shadowrootmode)&&(a=N.call(i,a,!0)),a}let u=se?r.outerHTML:r.innerHTML;return se&&$["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&gn(zn,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),ie&&(u=et(u)),S&&de?j(u):u},n.setConfig=function(){He(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ae=!0,ce=$,le=G},n.clearConfig=function(){qe=null,ae=!1,ce=null,le=null,S=k,E=""},n.isValidAttribute=function(e,t,n){qe||He({});const r=Ve(e),i=Ve(t);return ct(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&pn(R,e)&&en(R[e],t)},n.removeHook=function(e,t){if(pn(R,e)){if(void 0!==t){const n=Xt(R[e],t);return-1===n?void 0:tn(R[e],n,1)[0]}return Qt(R[e])}},n.removeHooks=function(e){pn(R,e)&&(R[e]=[])},n.removeAllHooks=function(){R={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Xn={ADD_ATTR:["target"],ALLOW_DATA_ATTR:!1,RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0}},Qn={ADD_ATTR:["target"],ADD_TAGS:["hellotext-icon"],RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0,svg:!0}};function er(e,t){var n=Zn.sanitize(e,t);return n.querySelectorAll('a[target="_blank"]').forEach(e=>{var t=new Set(e.rel.split(/\s+/).filter(Boolean));t.add("noopener"),t.add("noreferrer"),e.rel=Array.from(t).join(" ")}),n}function tr(e,t){e.replaceChildren(function(e){return er(e,Xn)}(t))}function nr(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,t,n){return(t=sr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ir(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function or(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,sr(r.key),r)}}function sr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function ar(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var cr=0;function lr(e){return"__private_"+cr+++"_"+e}var ur=lr("findOrCreateComponent"),hr=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,ur,{value:fr}),this.data=t,this.element=n||document.querySelector('[data-hello-form="'.concat(this.id,'"]'))||document.createElement("form")}var t,n,r,i;return t=e,n=[{key:"mount",value:(r=function*(){var e,{ifCompleted:t=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t&&this.hasBeenCompleted)return null===(e=this.element)||void 0===e||e.remove(),ii.eventEmitter.dispatch("form:completed",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nr(Object(n),!0).forEach(function(t){rr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:this.id},JSON.parse(localStorage.getItem("hello-form-".concat(this.id)))));var n=this.data.steps[0];this.buildHeader(n.header),this.buildInputs(n.inputs),this.buildButton(n.button),this.buildFooter(n.footer),this.elementAttributes.forEach(e=>{this.element.setAttribute(e.name,e.value)}),document.contains(this.element)||document.body.appendChild(this.element),ii.business.features.white_label||this.element.prepend(Dt.build())},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){ir(o,n,i,s,a,"next",e)}function a(e){ir(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})},{key:"buildHeader",value:function(e){var t=ar(this,ur)[ur]("[data-form-header]","header");tr(t,e.content),this.element.querySelector("[data-form-header]")?this.element.querySelector("[data-form-header]").replaceWith(t):this.element.prepend(t)}},{key:"buildInputs",value:function(e){var t=ar(this,ur)[ur]("[data-form-inputs]","main");e.map(e=>Mt.build(e)).forEach(e=>t.appendChild(e)),this.element.querySelector("[data-form-inputs]")?this.element.querySelector("[data-form-inputs]").replaceWith(t):this.element.querySelector("[data-form-header]").insertAdjacentHTML("afterend",t.outerHTML)}},{key:"buildButton",value:function(e){var t=ar(this,ur)[ur]("[data-form-button]","button");t.innerText=e.text,t.setAttribute("data-action","click->hellotext--form#submit"),t.setAttribute("data-hellotext--form-target","button"),this.element.querySelector("[data-form-button]")?this.element.querySelector("[data-form-button]").replaceWith(t):this.element.querySelector("[data-form-inputs]").insertAdjacentHTML("afterend",t.outerHTML)}},{key:"buildFooter",value:function(e){var t=ar(this,ur)[ur]("[data-form-footer]","footer");tr(t,e.content),this.element.querySelector("[data-form-footer]")?this.element.querySelector("[data-form-footer]").replaceWith(t):this.element.appendChild(t)}},{key:"markAsCompleted",value:function(e){var t={state:"completed",id:this.id,data:e,completedAt:(new Date).getTime()};localStorage.setItem("hello-form-".concat(this.id),JSON.stringify(t)),ii.eventEmitter.dispatch("form:completed",t)}},{key:"hasBeenCompleted",get:function(){return null!==localStorage.getItem("hello-form-".concat(this.id))}},{key:"id",get:function(){return this.data.id}},{key:"localeAuthKey",get:function(){var e=this.data.steps[0];return e.inputs.some(e=>"email"===e.kind)&&e.inputs.some(e=>"phone"===e.kind)?"phone_and_email":e.inputs.some(e=>"email"===e.kind)?"email":e.inputs.some(e=>"phone"===e.kind)?"phone":"none"}},{key:"elementAttributes",get:function(){return[{name:"data-controller",value:"hellotext--form"},{name:"data-hello-form",value:this.id},{name:"data-hellotext--form-data-value",value:JSON.stringify(this.data)}]}}],n&&or(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function fr(e,t){var n=this.element.querySelector(e);if(n)return n.cloneNode(!0);var r=document.createElement(t);return r.setAttribute(e.replace("[","").replace("]",""),""),r}function dr(e){var t="function"==typeof Map?new Map:void 0;return dr=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return pr(e,arguments,yr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),gr(r,e)},dr(e)}function pr(e,t,n){return pr=mr()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&gr(i,n.prototype),i},pr.apply(null,arguments)}function mr(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function gr(e,t){return gr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},gr(e,t)}function yr(e){return yr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},yr(e)}var vr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&gr(e,t)}(o,e);var t,n,r,i=(n=o,r=mr(),function(){var e,t=yr(n);if(r){var i=yr(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,"You need to initialize before tracking events. Call Hellotext.initialize and pass your public business id")).name="NotInitializedError",e}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(dr(Error));function br(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function wr(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,Or(r.key),r)}}function Or(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Tr=0;function Sr(e){return"__private_"+Tr+++"_"+e}var kr=Sr("formIdsToFetch"),Er=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,kr,{get:Cr,set:void 0}),this.forms=[],this.includes=this.includes.bind(this),this.excludes=this.excludes.bind(this),this.add=this.add.bind(this),"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver(this.formMutationObserver.bind(this)),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}))}var t,n,r,i;return t=e,n=[{key:"collectExistingFormsOnPage",value:function(){Array.from(document.querySelectorAll("[data-hello-form]")).length>0&&this.collect()}},{key:"formMutationObserver",value:function(e){e.find(e=>"childList"===e.type&&e.addedNodes.length>0)&&Array.from(document.querySelectorAll("[data-hello-form]")).length>0&&this.collect()}},{key:"collect",value:(r=function*(){if(ii.notInitialized)throw new vr;if(!this.fetching){if("undefined"==typeof document||!("querySelectorAll"in document))return console.warn("Document is not defined, collection is not possible. Please make sure to initialize the library after the document is loaded.");var e=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,kr)[kr];if(0!==e.length){var t=e.map(e=>Pe.get(e).then(e=>e.json()));this.fetching=!0,yield Promise.all(t).then(e=>e.forEach(this.add)).then(()=>ii.eventEmitter.dispatch("forms:collected",this)).then(()=>this.fetching=!1),U.forms.autoMount&&this.forms.forEach(e=>e.mount())}}},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){br(o,n,i,s,a,"next",e)}function a(e){br(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})},{key:"forEach",value:function(e){this.forms.forEach(e)}},{key:"map",value:function(e){return this.forms.map(e)}},{key:"add",value:function(e){this.includes(e.id)||(ii.business.data||(ii.business.setData(e.business),ii.business.setLocale(j.toString())),ii.business.enabledWhitelist||console.warn("No whitelist has been configured. It is advised to whitelist the domain to avoid bots from submitting forms."),this.forms.push(new hr(e)))}},{key:"getById",value:function(e){return this.forms.find(t=>t.id===e)}},{key:"getByIndex",value:function(e){return this.forms[e]}},{key:"includes",value:function(e){return this.forms.some(t=>t.id===e)}},{key:"excludes",value:function(e){return!this.includes(e)}},{key:"length",get:function(){return this.forms.length}}],n&&wr(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Cr(){return Array.from(document.querySelectorAll("[data-hello-form]")).map(e=>e.dataset.helloForm).filter(this.excludes)}function Pr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ar(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Pr(o,r,i,s,a,"next",e)}function a(e){Pr(o,r,i,s,a,"throw",e)}s(void 0)})}}function jr(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,xr(r.key),r)}}function xr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Mr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.mounted=!1,this.rendered=Promise.resolve(!1)}var t,n,r,i,o;return t=e,n=[{key:"render",value:(o=Ar(function*(){return this.applyBehaviourOverride(),(yield this.stylesheetLoaded)?(this.containerToAppendTo.appendChild(this.data.html),this.markCoexistingWidgets(),this.mounted=!0,!0):(console.warn("Hellotext webchat was not mounted because its stylesheet failed to load."),!1)}),function(){return o.apply(this,arguments)})},{key:"applyBehaviourOverride",value:function(){U.webchat.hasBehaviourOverride&&U.webchat.behaviour&&this.data.html.setAttribute("data-hellotext--webchat-behaviour-value",JSON.stringify(this.serializedBehaviour))}},{key:"serializedBehaviour",get:function(){var e=U.webchat.behaviour;return{trigger:this.serializeTrigger(e.trigger),delay_seconds:e.delaySeconds,first_visit_only:e.firstVisitOnly,once_per_session:e.oncePerSession}}},{key:"serializeTrigger",value:function(e){return"onLoad"===e?"on_load":"onClick"===e?"on_click":e}},{key:"containerToAppendTo",get:function(){return document.querySelector(U.webchat.container)}},{key:"stylesheetLoaded",get:function(){return ut.waitForStylesheet(ut.latestStylesheet)}},{key:"markCoexistingWidgets",value:function(){var e=this.data.html,t=document.querySelector(".hellotext--whatsapp-widget");e&&t&&(e.classList.add("hellotext--with-whatsapp-widget"),t.classList.add("hellotext--with-webchat"))}}],r=[{key:"load",value:(i=Ar(function*(t){var n=new e({id:t,html:yield it.webchats.get(t)});return n.rendered=n.render(),n}),function(e){return i.apply(this,arguments)})}],n&&jr(t.prototype,n),r&&jr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function _r(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ir(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){_r(o,r,i,s,a,"next",e)}function a(e){_r(o,r,i,s,a,"throw",e)}s(void 0)})}}function Lr(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,Nr(r.key),r)}}function Nr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Rr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.mounted=!1,this.rendered=Promise.resolve(!1)}var t,n,r,i,o;return t=e,n=[{key:"render",value:(o=Ir(function*(){if(!this.data.html)return!1;var e=this.containerToAppendTo;return e?(yield this.stylesheetLoaded)?(e.appendChild(this.data.html),this.markCoexistingWidgets(),this.mounted=!0,!0):(console.warn("Hellotext WhatsApp widget was not mounted because its stylesheet failed to load."),!1):(console.warn("Hellotext WhatsApp widget was not mounted because the container ".concat(U.whatsapp.container," was not found.")),!1)}),function(){return o.apply(this,arguments)})},{key:"containerToAppendTo",get:function(){try{return document.querySelector(U.whatsapp.container)}catch(e){return null}}},{key:"stylesheetLoaded",get:function(){return ut.waitForStylesheet(ut.latestStylesheet)}},{key:"markCoexistingWidgets",value:function(){var e=document.querySelector(".hellotext--webchat:not(.hellotext--whatsapp-widget)"),t=this.data.html;e&&t&&(e.classList.add("hellotext--with-whatsapp-widget"),t.classList.add("hellotext--with-webchat"))}}],r=[{key:"load",value:(i=Ir(function*(t){var n=new e({id:t,html:yield it.whatsappWidgets.get(t)});return n.rendered=n.render(),n}),function(e){return i.apply(this,arguments)})}],n&&Lr(t.prototype,n),r&&Lr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Dr(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,Fr(r.key),r)}}function Fr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Br=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"id",get:function(){return dt.get("hello_user_id")}},{key:"source",get:function(){return dt.get("hello_user_source")}},{key:"fingerprint",get:function(){return dt.get("hello_user_identification_hash")}},{key:"remember",value:function(e,t,n){t&&dt.set("hello_user_source",t),n&&dt.set("hello_user_identification_hash",n),dt.set("hello_user_id",e)}},{key:"forget",value:function(){dt.delete("hello_user_id"),dt.delete("hello_user_source"),dt.delete("hello_user_identification_hash")}},{key:"identificationData",get:function(){return this.id?{id:this.id,source:this.source}:{}}}],null&&Dr(t.prototype,null),n&&Dr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Vr(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,Wr(r.key),r)}}function qr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ur(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){qr(o,r,i,s,a,"next",e)}function a(e){qr(o,r,i,s,a,"throw",e)}s(void 0)})}}function zr(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 Hr(e,t,n){return(t=Wr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function $r(e){if(null!=e){if("string"==typeof e){var t=e.trim();return""===t?void 0:t}if(Array.isArray(e))return e.map(e=>$r(e)).filter(e=>void 0!==e);if(e instanceof Date)return e.toISOString();if("object"==typeof e){var n=Object.keys(e).sort((e,t)=>e.localeCompare(t)).reduce((t,n)=>{var r=$r(e[n]);return void 0!==r&&(t[n]=r),t},{});return Object.keys(n).length>0?n:void 0}return"number"==typeof e||"boolean"==typeof e?e:void 0}}function Kr(e,t){var n=$r(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zr(Object(n),!0).forEach(function(t){Hr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({session:e,user_id:t},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}))||{};return JSON.stringify(n)}function Gr(){return(Gr=Ur(function*(e){var t;if(null===(t=globalThis.crypto)||void 0===t||!t.subtle||"undefined"==typeof TextEncoder)return function(e){for(var t=5381,n=0;n<e.length;n+=1)t=33*t^e.charCodeAt(n);return"v1:".concat((t>>>0).toString(16))}(e);var n=yield globalThis.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)),r=Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("");return"v1:".concat(r)})).apply(this,arguments)}var Jr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,n=[{key:"matches",value:function(e,t){return!!e&&e===t}},{key:"generate",value:(r=Ur(function*(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return yield function(e){return Gr.apply(this,arguments)}(Kr(e,t,n))}),function(e,t){return r.apply(this,arguments)})}],n&&Vr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Yr(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 Zr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(n),!0).forEach(function(t){Xr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xr(e,t,n){return(t=ni(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ei(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Qr(o,r,i,s,a,"next",e)}function a(e){Qr(o,r,i,s,a,"throw",e)}s(void 0)})}}function ti(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,ni(r.key),r)}}function ni(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ri=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i,o;return t=e,n=[{key:"initialize",value:(o=ei(function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.business=new ut(e),this.page=new bt,U.assign(t),At.initialize(this.page),this.forms=new Er,this.query=new ae;var n=yield this.business.hydrate(),r=!1!==t.webchat&&this.mergeWebchatConfig(n&&n.webchat||{},t.webchat||{}),i=!1!==t.whatsappWidget&&this.mergeWhatsAppConfig(n&&n.whatsapp||{},t.whatsappWidget||{}),o=t.webchat&&!1!==t.webchat&&Object.prototype.hasOwnProperty.call(t.webchat,"behaviour");U.webchat.behaviourOverride=o,r&&r.id&&(U.webchat.assign(r),this.webchat=yield Mr.load(r.id)),i&&i.id&&(U.whatsapp.assign(i),this.whatsapp=yield Rr.load(i.id)),"undefined"!=typeof MutationObserver&&this.forms.collectExistingFormsOnPage()}),function(e){return o.apply(this,arguments)})},{key:"mergeWebchatConfig",value:function(e,t){return this.deepMergePlainObjects(e,t)}},{key:"mergeWhatsAppConfig",value:function(e,t){return this.deepMergePlainObjects(e,t)}},{key:"deepMergePlainObjects",value:function(e,t){var n=Zr({},e);return Object.entries(t).forEach(e=>{var[t,r]=e;this.isPlainObject(r)&&this.isPlainObject(n[t])?n[t]=this.deepMergePlainObjects(n[t],r):n[t]=r}),n}},{key:"isPlainObject",value:function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}},{key:"track",value:(i=ei(function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.notInitialized)throw new vr;var n=Zr(Zr({},t&&t.headers||{}),this.headers),r=Zr(Zr({},Br.identificationData),t.user_parameters||{}),i=t&&t.url?new bt(t.url):this.page,o=Zr(Zr({session:this.session,user_parameters:r,action:e},t),i.trackingData);return delete o.headers,yield it.events.create({headers:n,body:o,keepalive:rt(o)})}),function(e){return i.apply(this,arguments)})},{key:"identify",value:(r=ei(function*(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=yield Jr.generate(this.session,e,n);if(Jr.matches(Br.fingerprint,r))return new me(!0,{json:(t=ei(function*(){return{already_identified:!0}}),function(){return t.apply(this,arguments)})});var i=yield it.identifications.create(Zr({user_id:e},n));return i.succeeded&&Br.remember(e,n.source,r),i}),function(e){return r.apply(this,arguments)})},{key:"forget",value:function(){Br.forget()}},{key:"on",value:function(e,t){this.eventEmitter.addSubscriber(e,t)}},{key:"removeEventListener",value:function(e,t){this.eventEmitter.removeSubscriber(e,t)}},{key:"session",get:function(){return At.session}},{key:"isInitialized",get:function(){return void 0!==At.session}},{key:"notInitialized",get:function(){return!this.business||void 0===this.business.id}},{key:"headers",get:function(){if(this.notInitialized)throw new vr;return{Authorization:"Bearer ".concat(this.business.id),Accept:"application/json","Content-Type":"application/json"}}}],n&&ti(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();ri.eventEmitter=new ee,ri.forms=void 0,ri.business=void 0,ri.webchat=void 0,ri.whatsapp=void 0;const ii=ri;function oi(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function si(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,ai(r.key),r)}}function ai(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function ci(){return ci="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ui(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ci.apply(this,arguments)}function li(e,t){return li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},li(e,t)}function ui(e){return ui=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ui(e)}var hi=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&li(e,t)}(c,e);var t,n,r,i,o,s,a=(o=c,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=ui(o);if(s){var n=ui(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function c(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),a.apply(this,arguments)}return t=c,n=[{key:"initialize",value:function(){this.form=new hr(this.dataValue,this.element)}},{key:"connect",value:function(){ci(ui(c.prototype),"connect",this).call(this),this.element.addEventListener("submit",this.submit.bind(this)),"INPUT"!==document.activeElement.tagName&&this.inputTargets[0].focus()}},{key:"submit",value:(r=function*(e){if(e.preventDefault(),this.invalid)return this.showErrorMessages();this.clearErrorMessages(),this.formData=Object.fromEntries(new FormData(this.element)),this.buttonTarget.disabled=!0;var t=yield Pe.submit(this.form.id,this.formData);this.buttonTarget.disabled=!1;var n=yield t.json();if(t.failed)return n.errors.forEach(e=>{var{type:t,parameter:n}=e,r=this.inputTargets.find(e=>e.name===n);r.setCustomValidity(ii.business.locale.errors[t]),r.reportValidity(),r.addEventListener("input",()=>{r.setCustomValidity(""),r.reportValidity()})}),this.showErrorMessages();this.buttonTarget.style.display="none",this.element.querySelectorAll("input").forEach(e=>e.disabled=!0),this.completed()},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){oi(o,n,i,s,a,"next",e)}function a(e){oi(o,n,i,s,a,"throw",e)}s(void 0)})},function(e){return i.apply(this,arguments)})},{key:"completed",value:function(){if(this.form.markAsCompleted(this.formData),!U.forms.shouldShowSuccessMessage)return this.element.remove();"string"==typeof U.forms.successMessage?this.element.innerHTML=U.forms.successMessage:this.element.innerHTML=ii.business.locale.forms[this.form.localeAuthKey]}},{key:"showErrorMessages",value:function(){this.inputTargets.forEach(e=>{var t=e.closest("article").querySelector("[data-error-container]");e.validity.valid?t.innerText="":t.innerText=e.validationMessage})}},{key:"clearErrorMessages",value:function(){this.inputTargets.forEach(e=>{e.setCustomValidity(""),e.closest("article").querySelector("[data-error-container]").innerText=""})}},{key:"inputTargetConnected",value:function(e){e.getAttribute("data-default-value")&&(e.value=e.getAttribute("data-default-value"))}},{key:"requiredInputs",get:function(){return this.inputTargets.filter(e=>e.required)}},{key:"invalid",get:function(){return!this.element.checkValidity()}}],n&&si(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),c}(y.xI);function fi(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 di(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fi(Object(n),!0).forEach(function(t){pi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pi(e,t,n){return(t=gi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mi(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,gi(r.key),r)}}function gi(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function yi(e,t){return yi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yi(e,t)}function vi(e){return vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vi(e)}hi.values={data:Object,step:{type:Number,default:1}},hi.targets=["inputContainer","input","button","otpContainer"];var bi=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yi(e,t)}(s,e);var t,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=vi(r);if(i){var n=vi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),o.apply(this,arguments)}return t=s,n=[{key:"connect",value:function(){this.updateFades(),this.observeContainerSize()}},{key:"disconnect",value:function(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect()}},{key:"setId",value:function(e){var{detail:t}=e;this.idValue=t,this.element.id=t}},{key:"onScroll",value:function(){this.updateFades()}},{key:"quickReply",value:function(e){var{currentTarget:t}=e,n=t.closest('[data-hellotext--message-target="carouselCard"]'),r=t.closest('[data-controller~="hellotext--message"]'),i=t.dataset.text||t.textContent.trim();this.dispatch("quickReply",{detail:{id:this.idValue,product:null==n?void 0:n.dataset.id,buttonId:t.dataset.id,body:i,cardElement:n||r||t}})}},{key:"addToCart",value:function(e){var{currentTarget:t}=e,n=t.closest('[data-hellotext--message-target="carouselCard"]'),{id:r,reference:i,source:o}=n.dataset,s={product:r,quantity:1};this.hasUtmValue&&ii.page.utm.save(this.utmValue),ii.eventEmitter.dispatch("cart.added",{object_parameters:{items:[di(di(di({},s),i&&{reference:i}),o&&{source:o})]},source:{kind:this.kindValue,message_id:this.idValue,button_id:t.dataset.id}})}},{key:"moveToLeft",value:function(){if(this.hasCarouselContainerTarget){var e=this.getPreviousPageScrollLeft(),t=this.carouselContainerTarget.scrollLeft-e;t<1||this.carouselContainerTarget.scrollBy({left:-t,behavior:"smooth"})}}},{key:"moveToRight",value:function(){if(this.hasCarouselContainerTarget){var e=this.getNextPageScrollLeft()-this.carouselContainerTarget.scrollLeft;e<1||this.carouselContainerTarget.scrollBy({left:e,behavior:"smooth"})}}},{key:"getScrollAmount",value:function(){return this.getCardScrollAmount()}},{key:"getCardScrollAmount",value:function(){var e=this.carouselContainerTarget.querySelector(".message__carousel_card");return e?e.offsetWidth+this.getGap():280}},{key:"getPageScrollAmount",value:function(){var e=this.carouselContainerTarget.clientWidth-this.getGap();return e>0?e:this.getCardScrollAmount()}},{key:"getNextPageScrollLeft",value:function(){var e=this.getCurrentScrollLeft(),t=e+this.carouselContainerTarget.clientWidth,n=this.getCardMetrics().find(e=>e.end>t+1),r=n?this.getPageAlignedScrollLeft(n.start):e+this.getPageScrollAmount(),i=e+this.getPageScrollAmount();return this.clampScrollLeft(r>e+1?r:i)}},{key:"getPreviousPageScrollLeft",value:function(){var e,t,n=this.getCurrentScrollLeft();if(n<=1)return 0;var r=Math.max(n-this.getPageScrollAmount(),0);if(r<=1)return 0;var i=this.getCardMetrics(),o=i.find(e=>e.start>=r-1&&e.start<n-1),s=[...i].reverse().find(e=>e.start<n-1);return this.getPageAlignedScrollLeft(null!==(e=null!==(t=null==o?void 0:o.start)&&void 0!==t?t:null==s?void 0:s.start)&&void 0!==e?e:0)}},{key:"getPageAlignedScrollLeft",value:function(e){var t=this.getPageStartOffset();return e<=t+1?0:this.clampScrollLeft(e-t)}},{key:"getCardMetrics",value:function(){return Array.from(this.carouselContainerTarget.querySelectorAll(".message__carousel_card")).map(e=>{var t=this.getCardScrollLeft(e);return{start:t,end:t+e.offsetWidth}})}},{key:"getCardScrollLeft",value:function(e){var t=e.getBoundingClientRect(),n=this.carouselContainerTarget.getBoundingClientRect();return t.left||t.width||n.left||n.width?t.left-n.left+this.carouselContainerTarget.scrollLeft:e.offsetLeft||0}},{key:"getCurrentScrollLeft",value:function(){return this.clampScrollLeft(this.carouselContainerTarget.scrollLeft)}},{key:"clampScrollLeft",value:function(e){var t=Math.max(this.carouselContainerTarget.scrollWidth-this.carouselContainerTarget.clientWidth,0);return Math.min(Math.max(e,0),t)}},{key:"getGap",value:function(){var e=window.getComputedStyle(this.carouselContainerTarget),t=Number.parseFloat(e.columnGap||e.gap);return Number.isFinite(t)?t:16}},{key:"getFadeDistance",value:function(){return Number.isFinite(this.fadeDistanceValue)?this.fadeDistanceValue:64}},{key:"getPageStartOffset",value:function(){return Number.isFinite(this.pageStartOffsetValue)?this.pageStartOffsetValue:0}},{key:"observeContainerSize",value:function(){this.hasCarouselContainerTarget&&window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>this.updateFades()),this.resizeObserver.observe(this.carouselContainerTarget))}},{key:"updateFades",value:function(){if(this.hasCarouselContainerTarget){var e=Math.max(this.carouselContainerTarget.scrollWidth-this.carouselContainerTarget.clientWidth,0);if(e<=1)return this.hideFade(this.leftFadeTarget),void this.hideFade(this.rightFadeTarget);var t=Math.min(Math.max(this.carouselContainerTarget.scrollLeft,0),e),n=this.getFadeDistance();this.setFadeOpacity(this.leftFadeTarget,t/n),this.setFadeOpacity(this.rightFadeTarget,(e-t)/n)}}},{key:"setFadeOpacity",value:function(e,t){var n=Math.min(Math.max(t,0),1);n<=.05?this.hideFade(e):(e.classList.remove("hidden"),e.removeAttribute("disabled"),e.removeAttribute("tabindex"),e.setAttribute("aria-hidden","false"),e.style.opacity=n.toFixed(3),e.style.pointerEvents="auto")}},{key:"hideFade",value:function(e){e.style.opacity="0",e.style.pointerEvents="none",e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1"),"disabled"in e&&(e.disabled=!0),e.classList.add("hidden")}}],n&&mi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(y.xI);bi.values={fadeDistance:{type:Number,default:64},id:String,kind:String,pageStartOffset:{type:Number,default:0},utm:Object},bi.targets=["carouselContainer","leftFade","rightFade","carouselCard"];const wi=["start","end"],Oi=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-"+wi[0],t+"-"+wi[1]),[]),Ti=Math.min,Si=Math.max,ki=Math.round,Ei=Math.floor,Ci=e=>({x:e,y:e}),Pi={left:"right",right:"left",bottom:"top",top:"bottom"},Ai={start:"end",end:"start"};function ji(e,t,n){return Si(e,Ti(t,n))}function xi(e,t){return"function"==typeof e?e(t):e}function Mi(e){return e.split("-")[0]}function _i(e){return e.split("-")[1]}function Ii(e){return"x"===e?"y":"x"}function Li(e){return"y"===e?"height":"width"}const Ni=new Set(["top","bottom"]);function Ri(e){return Ni.has(Mi(e))?"y":"x"}function Di(e){return Ii(Ri(e))}function Fi(e,t,n){void 0===n&&(n=!1);const r=_i(e),i=Di(e),o=Li(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Hi(s)),[s,Hi(s)]}function Bi(e){return e.replace(/start|end/g,e=>Ai[e])}const Vi=["left","right"],qi=["right","left"],Ui=["top","bottom"],zi=["bottom","top"];function Hi(e){return e.replace(/left|right|bottom|top/g,e=>Pi[e])}function Wi(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function $i(e,t,n){let{reference:r,floating:i}=e;const o=Ri(t),s=Di(t),a=Li(s),c=Mi(t),l="y"===o,u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let d;switch(c){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:h};break;case"left":d={x:r.x-i.width,y:h};break;default:d={x:r.x,y:r.y}}switch(_i(t)){case"start":d[s]-=f*(n&&l?-1:1);break;case"end":d[s]+=f*(n&&l?-1:1)}return d}async function Ki(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=xi(t,e),p=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(d),m=a[f?"floating"===h?"reference":"floating":h],g=Wi(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),y="floating"===h?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),b=await(null==o.isElement?void 0:o.isElement(v))&&await(null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},w=Wi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:c}):y);return{top:(g.top-w.top+p.top)/b.y,bottom:(w.bottom-g.bottom+p.bottom)/b.y,left:(g.left-w.left+p.left)/b.x,right:(w.right-g.right+p.right)/b.x}}const Gi=new Set(["left","top"]);function Ji(){return"undefined"!=typeof window}function Yi(e){return Qi(e)?(e.nodeName||"").toLowerCase():"#document"}function Zi(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Xi(e){var t;return null==(t=(Qi(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Qi(e){return!!Ji()&&(e instanceof Node||e instanceof Zi(e).Node)}function eo(e){return!!Ji()&&(e instanceof Element||e instanceof Zi(e).Element)}function to(e){return!!Ji()&&(e instanceof HTMLElement||e instanceof Zi(e).HTMLElement)}function no(e){return!(!Ji()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Zi(e).ShadowRoot)}const ro=new Set(["inline","contents"]);function io(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=yo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ro.has(i)}const oo=new Set(["table","td","th"]);function so(e){return oo.has(Yi(e))}const ao=[":popover-open",":modal"];function co(e){return ao.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const lo=["transform","translate","scale","rotate","perspective"],uo=["transform","translate","scale","rotate","perspective","filter"],ho=["paint","layout","strict","content"];function fo(e){const t=po(),n=eo(e)?yo(e):e;return lo.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||uo.some(e=>(n.willChange||"").includes(e))||ho.some(e=>(n.contain||"").includes(e))}function po(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const mo=new Set(["html","body","#document"]);function go(e){return mo.has(Yi(e))}function yo(e){return Zi(e).getComputedStyle(e)}function vo(e){return eo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bo(e){if("html"===Yi(e))return e;const t=e.assignedSlot||e.parentNode||no(e)&&e.host||Xi(e);return no(t)?t.host:t}function wo(e){const t=bo(e);return go(t)?e.ownerDocument?e.ownerDocument.body:e.body:to(t)&&io(t)?t:wo(t)}function Oo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=wo(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=Zi(i);if(o){const e=To(s);return t.concat(s,s.visualViewport||[],io(i)?i:[],e&&n?Oo(e):[])}return t.concat(i,Oo(i,[],n))}function To(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function So(e){const t=yo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=to(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=ki(n)!==o||ki(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function ko(e){return eo(e)?e:e.contextElement}function Eo(e){const t=ko(e);if(!to(t))return Ci(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=So(t);let s=(o?ki(n.width):n.width)/r,a=(o?ki(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Co=Ci(0);function Po(e){const t=Zi(e);return po()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Co}function Ao(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=ko(e);let s=Ci(1);t&&(r?eo(r)&&(s=Eo(r)):s=Eo(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Zi(e))&&t}(o,n,r)?Po(o):Ci(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,u=i.width/s.x,h=i.height/s.y;if(o){const e=Zi(o),t=r&&eo(r)?Zi(r):r;let n=e,i=To(n);for(;i&&r&&t!==n;){const e=Eo(i),t=i.getBoundingClientRect(),r=yo(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,h*=e.y,c+=o,l+=s,n=Zi(i),i=To(n)}}return Wi({width:u,height:h,x:c,y:l})}function jo(e,t){const n=vo(e).scrollLeft;return t?t.left+n:Ao(Xi(e)).left+n}function xo(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:jo(e,r)),y:r.top+t.scrollTop}}const Mo=new Set(["absolute","fixed"]);function _o(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Zi(e),r=Xi(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const e=po();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}(e,n);else if("document"===t)r=function(e){const t=Xi(e),n=vo(e),r=e.ownerDocument.body,i=Si(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Si(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+jo(e);const a=-n.scrollTop;return"rtl"===yo(r).direction&&(s+=Si(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(Xi(e));else if(eo(t))r=function(e,t){const n=Ao(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=to(e)?Eo(e):Ci(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=Po(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Wi(r)}function Io(e,t){const n=bo(e);return!(n===t||!eo(n)||go(n))&&("fixed"===yo(n).position||Io(n,t))}function Lo(e,t,n){const r=to(t),i=Xi(t),o="fixed"===n,s=Ao(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Ci(0);function l(){c.x=jo(i)}if(r||!r&&!o)if(("body"!==Yi(t)||io(i))&&(a=vo(t)),r){const e=Ao(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();o&&!r&&i&&l();const u=!i||r||o?Ci(0):xo(i,a);return{x:s.left+a.scrollLeft-c.x-u.x,y:s.top+a.scrollTop-c.y-u.y,width:s.width,height:s.height}}function No(e){return"static"===yo(e).position}function Ro(e,t){if(!to(e)||"fixed"===yo(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Xi(e)===n&&(n=n.ownerDocument.body),n}function Do(e,t){const n=Zi(e);if(co(e))return n;if(!to(e)){let t=bo(e);for(;t&&!go(t);){if(eo(t)&&!No(t))return t;t=bo(t)}return n}let r=Ro(e,t);for(;r&&so(r)&&No(r);)r=Ro(r,t);return r&&go(r)&&No(r)&&!fo(r)?n:r||function(e){let t=bo(e);for(;to(t)&&!go(t);){if(fo(t))return t;if(co(t))return null;t=bo(t)}return null}(e)||n}const Fo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=Xi(r),a=!!t&&co(t.floating);if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=Ci(1);const u=Ci(0),h=to(r);if((h||!h&&!o)&&(("body"!==Yi(r)||io(s))&&(c=vo(r)),to(r))){const e=Ao(r);l=Eo(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!s||h||o?Ci(0):xo(s,c,!0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}},getDocumentElement:Xi,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[..."clippingAncestors"===n?co(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Oo(e,[],!1).filter(e=>eo(e)&&"body"!==Yi(e)),i=null;const o="fixed"===yo(e).position;let s=o?bo(e):e;for(;eo(s)&&!go(s);){const t=yo(s),n=fo(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&Mo.has(i.position)||io(s)&&!n&&Io(e,s))?r=r.filter(e=>e!==s):i=t,s=bo(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=o[0],a=o.reduce((e,n)=>{const r=_o(t,n,i);return e.top=Si(r.top,e.top),e.right=Ti(r.right,e.right),e.bottom=Ti(r.bottom,e.bottom),e.left=Si(r.left,e.left),e},_o(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Do,getElementRects:async function(e){const t=this.getOffsetParent||Do,n=this.getDimensions,r=await n(e.floating);return{reference:Lo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=So(e);return{width:t,height:n}},getScale:Eo,isElement:eo,isRTL:function(e){return"rtl"===yo(e).direction}};function Bo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const Vo=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=Mi(n),a=_i(n),c="y"===Ri(n),l=Gi.has(s)?-1:1,u=o&&c?-1:1,h=xi(t,e);let{mainAxis:f,crossAxis:d,alignmentAxis:p}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&"number"==typeof p&&(d="end"===a?-1*p:p),c?{x:d*u,y:f*l}:{x:f*l,y:d*u}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},qo=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:o,middlewareData:s,placement:a,platform:c,elements:l}=t,{crossAxis:u=!1,alignment:h,allowedPlacements:f=Oi,autoAlignment:d=!0,...p}=xi(e,t),m=void 0!==h||f===Oi?function(e,t,n){return(e?[...n.filter(t=>_i(t)===e),...n.filter(t=>_i(t)!==e)]:n.filter(e=>Mi(e)===e)).filter(n=>!e||_i(n)===e||!!t&&Bi(n)!==n)}(h||null,d,f):f,g=await Ki(t,p),y=(null==(n=s.autoPlacement)?void 0:n.index)||0,v=m[y];if(null==v)return{};const b=Fi(v,o,await(null==c.isRTL?void 0:c.isRTL(l.floating)));if(a!==v)return{reset:{placement:m[0]}};const w=[g[Mi(v)],g[b[0]],g[b[1]]],O=[...(null==(r=s.autoPlacement)?void 0:r.overflows)||[],{placement:v,overflows:w}],T=m[y+1];if(T)return{data:{index:y+1,overflows:O},reset:{placement:T}};const S=O.map(e=>{const t=_i(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),k=(null==(i=S.filter(e=>e[2].slice(0,_i(e[0])?2:3).every(e=>e<=0))[0])?void 0:i[0])||S[0][0];return k!==a?{data:{index:y+1,overflows:O},reset:{placement:k}}:{}}}},Uo=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=xi(e,t),l={x:n,y:r},u=await Ki(t,c),h=Ri(Mi(i)),f=Ii(h);let d=l[f],p=l[h];if(o){const e="y"===f?"bottom":"right";d=ji(d+u["y"===f?"top":"left"],d,d-u[e])}if(s){const e="y"===h?"bottom":"right";p=ji(p+u["y"===h?"top":"left"],p,p-u[e])}const m=a.fn({...t,[f]:d,[h]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:o,[h]:s}}}}}},zo=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=xi(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const y=Mi(i),v=Ri(a),b=Mi(a)===a,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),O=f||(b||!m?[Hi(a)]:function(e){const t=Hi(e);return[Bi(e),t,Bi(t)]}(a)),T="none"!==p;!f&&T&&O.push(...function(e,t,n,r){const i=_i(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?qi:Vi:t?Vi:qi;case"left":case"right":return t?Ui:zi;default:return[]}}(Mi(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(Bi)))),o}(a,m,p,w));const S=[a,...O],k=await Ki(t,g),E=[];let C=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&E.push(k[y]),h){const e=Fi(i,s,w);E.push(k[e[0]],k[e[1]])}if(C=[...C,{placement:i,overflows:E}],!E.every(e=>e<=0)){var P,A;const e=((null==(P=o.flip)?void 0:P.index)||0)+1,t=S[e];if(t&&("alignment"!==h||v===Ri(t)||C.every(e=>Ri(e.placement)!==v||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(A=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!n)switch(d){case"bestFit":{var j;const e=null==(j=C.filter(e=>{if(T){const t=Ri(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}};var Ho=e=>{Object.assign(e,{show(){var e;null===(e=this.cancelBehaviourOpen)||void 0===e||e.call(this),this.openValue=!0},hide(){this.openValue=!1},toggle(){var e;null===(e=this.cancelBehaviourOpen)||void 0===e||e.call(this),this.openValue=!this.openValue},setupFloatingUI(e){var{trigger:t,popover:n,strategy:r}=e;this.floatingUICleanup=function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,l=ko(e),u=i||o?[...l?Oo(l):[],...Oo(t)]:[];u.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const h=l&&a?function(e,t){let n,r=null;const i=Xi(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,c){void 0===a&&(a=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:u,top:h,width:f,height:d}=l;if(a||t(),!f||!d)return;const p={rootMargin:-Ei(h)+"px "+-Ei(i.clientWidth-(u+f))+"px "+-Ei(i.clientHeight-(h+d))+"px "+-Ei(u)+"px",threshold:Si(0,Ti(1,c))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==c){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||Bo(l,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(g,{...p,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),o}(l,n):null;let f,d=-1,p=null;s&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m=c?Ao(e):null;return c&&function t(){const r=Ao(e);m&&!Bo(m,r)&&n(),m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==h||h(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(f)}}(t,n,()=>{((e,t,n)=>{const r=new Map,i={platform:Fo,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=$i(l,r,c),f=r,d={},p=0;for(let n=0;n<a.length;n++){const{name:o,fn:m}=a[n],{x:g,y,data:v,reset:b}=await m({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:d,rects:l,platform:s,elements:{reference:e,floating:t}});u=null!=g?g:u,h=null!=y?y:h,d={...d,[o]:{...d[o],...v}},b&&p<=50&&(p++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:u,y:h}=$i(l,f,c))),n=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:d}})(e,t,{...i,platform:o})})(t,n,{placement:this.placementValue,middleware:this.middlewares,strategy:r||U.webchat.strategy}).then(e=>{var{x:t,y:r,strategy:i}=e,o={left:"".concat(t,"px"),top:"".concat(r,"px"),position:i};Object.assign(n.style,o)})})},openValueChanged(){var e;this.disabledValue||(this.openValue?(null===(e=this.preparePopoverOpenAnimation)||void 0===e||e.call(this),this.popoverTarget.showPopover(),this.popoverTarget.setAttribute("aria-expanded","true"),this.onPopoverOpened&&this.onPopoverOpened()):(this.popoverTarget.hidePopover(),this.popoverTarget.removeAttribute("aria-expanded"),this.onPopoverClosed&&this.onPopoverClosed()))}})};function Wo(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function $o(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Wo(o,r,i,s,a,"next",e)}function a(e){Wo(o,r,i,s,a,"throw",e)}s(void 0)})}}function Ko(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,Go(r.key),r)}}function Go(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Jo(){return Jo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Zo(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Jo.apply(this,arguments)}function Yo(e,t){return Yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Yo(e,t)}function Zo(e){return Zo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zo(e)}var Xo=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yo(e,t)}(u,e);var t,r,i,o,s,a,c,l=(a=u,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Zo(a);if(c){var n=Zo(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function u(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),l.apply(this,arguments)}return t=u,r=[{key:"initialize",value:function(){this.onEmojiSelect=this.onEmojiSelect.bind(this),this.pickerLoaded=!1,this.pickerLoadPromise=null,this.connected=!1,Jo(Zo(u.prototype),"initialize",this).call(this)}},{key:"connect",value:function(){this.connected=!0,Ho(this),this.setupFloatingUI({trigger:this.buttonTarget,popover:this.popoverTarget,strategy:"absolute"}),Jo(Zo(u.prototype),"connect",this).call(this)}},{key:"disconnect",value:function(){this.connected=!1,this.pickerLoadPromise=null,this.floatingUICleanup(),Jo(Zo(u.prototype),"disconnect",this).call(this)}},{key:"onEmojiSelect",value:function(e){this.dispatch("selected",{detail:e.native}),this.hide()}},{key:"onClickOutside",value:function(e){this.openValue&&e.target.nodeType&&!1===this.element.contains(e.target)&&(this.openValue=!1)}},{key:"onPopoverOpened",value:(s=$o(function*(){yield this.loadPicker()}),function(){return s.apply(this,arguments)})},{key:"loadPicker",value:(o=$o(function*(){if(!this.pickerLoaded){this.pickerLoadPromise||(this.pickerLoadPromise=this.loadPickerDependencies());var{Picker:e,i18n:t}=yield this.pickerLoadPromise;this.connected&&!this.pickerLoaded&&(this.popoverTarget.appendChild(this.buildPicker(e,t)),this.pickerLoaded=!0)}}),function(){return o.apply(this,arguments)})},{key:"loadPickerDependencies",value:(i=$o(function*(){var[e,t]=yield Promise.all([n.e(160).then(n.bind(n,405)),this.loadI18n()]);return{Picker:e.Picker,i18n:t.default||t}}),function(){return i.apply(this,arguments)})},{key:"loadI18n",value:function(){return"es"===Hellotext.business.locale?n.e(437).then(n.t.bind(n,9,19)):n.e(200).then(n.t.bind(n,714,19))}},{key:"buildPicker",value:function(e,t){return new e({onEmojiSelect:this.onEmojiSelect,theme:"light",dynamicWidth:!0,previewPosition:"none",skinTonePosition:"none",emojiSize:this.sizeValue,perLine:this.perLineValue,i18n:t})}},{key:"middlewares",get:function(){return[Vo(5),Uo({padding:24}),qo({allowedPlacements:["top","bottom"]})]}}],r&&Ko(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(y.xI);function Qo(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function es(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Qo(o,r,i,s,a,"next",e)}function a(e){Qo(o,r,i,s,a,"throw",e)}s(void 0)})}}function ts(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,ns(r.key),r)}}function ns(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Xo.targets=["button","popover"],Xo.values={placement:{type:String,default:"bottom-end"},open:{type:Boolean,default:!1},autoPlacement:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},size:{type:Number,default:24},perLine:{type:Number,default:9}};var rs=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.webchatId=t}var t,n,r,i,o;return t=e,n=[{key:"index",value:(o=es(function*(e){var t=new URL(this.url);return Object.entries(e).forEach(e=>{var[n,r]=e;t.searchParams.append(n,r)}),yield fetch(t,{method:"GET",headers:ii.headers})}),function(e){return o.apply(this,arguments)})},{key:"catchUp",value:function(e){return this.index({after_id:e,session:ii.session})}},{key:"create",value:(i=es(function*(e){var t=yield fetch(this.url,{method:"POST",headers:{Authorization:"Bearer ".concat(ii.business.id)},body:e});return new me(t.ok,t)}),function(e){return i.apply(this,arguments)})},{key:"markAsSeen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e?this.url+"/".concat(e):this.url+"/seen";fetch(t,{method:"PATCH",headers:ii.headers,body:JSON.stringify({session:ii.session})})}},{key:"url",get:function(){return e.endpoint.replace(":id",this.webchatId)}}],r=[{key:"endpoint",get:function(){return U.endpoint("public/webchats/:id/messages")}}],n&&ts(t.prototype,n),r&&ts(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const is=rs;function os(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,ss(r.key),r)}}function ss(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var as=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),e.channels.add(this)}var t,n,r;return t=e,n=[{key:"send",value:function(t){var{command:n,identifier:r,data:i}=t,o={command:n,identifier:JSON.stringify(r),data:JSON.stringify(i||{})},s=e.ensureWebSocket(),a=JSON.stringify(o);s.readyState===WebSocket.OPEN?s.send(a):s.addEventListener("open",()=>{s.send(a)})}},{key:"onMessage",value:function(t){var n=e=>{var n=JSON.parse(e.data),{type:r,message:i}=n;this.ignoredEvents.includes(r)||t(i)};e.messageHandlers.add(n),e.ensureWebSocket().addEventListener("message",n)}},{key:"onDisconnect",value:function(t){e.disconnectHandlers.add(t)}},{key:"onSubscriptionConfirmed",value:function(t){e.subscriptionConfirmHandlers.add(t)}},{key:"webSocket",get:function(){return e.ensureWebSocket()}},{key:"ignoredEvents",get:function(){return["ping","confirm_subscription","welcome"]}}],r=[{key:"ensureWebSocket",value:function(){return this.webSocket&&!this.closedWebSocket(this.webSocket)?this.webSocket:(this.webSocket&&(this.needsResubscribe=!0),this.openWebSocket())}},{key:"openWebSocket",value:function(){this.clearReconnectTimeout();var e=new WebSocket(U.actionCableUrl);return this.webSocket=e,this.installWebSocketHandlers(e),e}},{key:"installWebSocketHandlers",value:function(e){e.addEventListener("open",()=>this.handleOpen(e)),e.addEventListener("close",()=>this.handleDisconnect(e)),e.addEventListener("error",()=>this.handleDisconnect(e)),e.addEventListener("message",e=>this.handleControlMessage(e)),this.messageHandlers.forEach(t=>{e.addEventListener("message",t)})}},{key:"handleOpen",value:function(e){e===this.webSocket&&(this.reconnectAttempts=0,this.needsResubscribe&&(this.needsResubscribe=!1,this.resubscribeChannels()))}},{key:"handleControlMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(e){return}"confirm_subscription"===t.type&&this.subscriptionConfirmHandlers.forEach(e=>e(t.identifier))}},{key:"handleDisconnect",value:function(e){e===this.webSocket&&(this.disconnectHandlers.forEach(e=>e()),this.webSocket=null,this.needsResubscribe=!0,this.scheduleReconnect())}},{key:"scheduleReconnect",value:function(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.reconnectAttempts+=1,this.openWebSocket()},this.reconnectDelay))}},{key:"clearReconnectTimeout",value:function(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}},{key:"resubscribeChannels",value:function(){this.channels.forEach(e=>{var t=e.resubscribe||e.subscribe;"function"==typeof t&&t.call(e)})}},{key:"closedWebSocket",value:function(e){return e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING}},{key:"reconnectDelay",get:function(){var e=Math.min(this.reconnectMaxDelay,this.reconnectBaseDelay*2**this.reconnectAttempts);return e+Math.round(e*this.reconnectJitter*Math.random())}}],n&&os(t.prototype,n),r&&os(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function cs(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,ls(r.key),r)}}function ls(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function us(){return us="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=fs(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},us.apply(this,arguments)}function hs(e,t){return hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},hs(e,t)}function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fs(e)}as.webSocket=void 0,as.channels=new Set,as.messageHandlers=new Set,as.disconnectHandlers=new Set,as.subscriptionConfirmHandlers=new Set,as.reconnectTimeout=null,as.reconnectAttempts=0,as.reconnectBaseDelay=500,as.reconnectMaxDelay=1e4,as.reconnectJitter=.3,as.needsResubscribe=!1;var ds=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hs(e,t)}(s,e);var t,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=fs(r);if(i){var n=fs(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(e,t,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this)).id=e,r.session=t,r.conversation=n,r.subscribed=!1,r.awaitingReconnectConfirmation=!1,r.reconnectCallbacks=new Set,r.onSubscriptionConfirmed(e=>r.handleSubscriptionConfirmed(e)),r.subscribe(),r}return t=s,(n=[{key:"subscribe",value:function(){this.subscribed=!0;var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"subscribe",identifier:e})}},{key:"unsubscribe",value:function(){this.subscribed=!1;var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"unsubscribe",identifier:e})}},{key:"resubscribe",value:function(){!1!==this.subscribed&&(this.awaitingReconnectConfirmation=!0,this.subscribe())}},{key:"onReconnect",value:function(e){this.reconnectCallbacks.add(e)}},{key:"handleSubscriptionConfirmed",value:function(e){this.awaitingReconnectConfirmation&&this.matchesIdentifier(e)&&(this.awaitingReconnectConfirmation=!1,this.reconnectCallbacks.forEach(e=>e()))}},{key:"matchesIdentifier",value:function(e){var t;try{t="string"==typeof e?JSON.parse(e):e}catch(e){return!1}return"WebchatChannel"===t.channel&&t.id===this.id&&t.session===this.session&&t.conversation===this.conversation}},{key:"startTypingIndicator",value:function(){var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"message",identifier:e,data:{action:"started_typing"}})}},{key:"stopTypingIndicator",value:function(){var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"typing:stop",identifier:e,data:{action:"stopped_typing"}})}},{key:"onMessage",value:function(e){us(fs(s.prototype),"onMessage",this).call(this,t=>{"message"===t.type&&e(t)})}},{key:"onReaction",value:function(e){us(fs(s.prototype),"onMessage",this).call(this,t=>{"reaction.create"!==t.type&&"reaction.destroy"!==t.type||e(t)})}},{key:"onTypingStart",value:function(e){us(fs(s.prototype),"onMessage",this).call(this,t=>{"started_typing"===t.type&&e(t)})}},{key:"updateSubscriptionWith",value:function(e){this.unsubscribe(),setTimeout(()=>{this.conversation=e,this.subscribe()},1e3)}}])&&cs(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(as);const ps=ds;var ms=e=>{Object.assign(e,{scheduleBehaviourOpen(){if(this.shouldAutoOpenFromBehaviour()){var e=1e3*Number(this.behaviourValue.delay_seconds||0);this.behaviourOpenTimeout=window.setTimeout(()=>{this.behaviourOpenTimeout=null,this.openValue||(this.openValue=!0,this.markBehaviourAutoOpened())},e)}},cancelBehaviourOpen(){window.clearTimeout(this.behaviourOpenTimeout),this.behaviourOpenTimeout=null},shouldAutoOpenFromBehaviour(){var e=this.behaviourValue;return!(!e||"on_load"!==e.trigger||e.first_visit_only&&localStorage.getItem(this.firstVisitKey())||e.once_per_session&&sessionStorage.getItem(this.sessionKey()))},markBehaviourAutoOpened(){this.behaviourValue.first_visit_only&&localStorage.setItem(this.firstVisitKey(),"1"),this.behaviourValue.once_per_session&&sessionStorage.setItem(this.sessionKey(),"1")},firstVisitKey(){return"hellotext--webchat--".concat(this.idValue,"--auto-opened")},sessionKey(){return"hellotext--webchat--".concat(this.idValue,"--auto-opened-session")}})},gs=e=>{Object.assign(e,{setupOpeningSequence(){this.openingSequenceStarted=!1,this.openingSequenceCancelled=!1,this.openingSequenceTimeout=null,this.openingSequenceMessages=[],this.revealedOpeningSequenceMessageIds=[]},teardownOpeningSequence(){this.cancelOpeningSequence()},startOpeningSequence(){this.openingSequenceMessages=Array.from(this.openingSequenceMessageTargets||[]),this.openingSequenceCanStart()&&(this.openingSequenceStarted=!0,this.openingSequenceCancelled=!1,this.revealedOpeningSequenceMessageIds=[],this.playOpeningSequenceMessageAt(0))},openingSequenceCanStart(){return!this.conversationIdValue&&this.hasOpeningSequenceTarget&&this.openingSequenceMessages.length>0&&!this.openingSequenceStarted},playOpeningSequenceMessageAt(e){var t=this.openingSequenceMessages[e];if(t){var n=1e3*this.openingSequenceMessageDelay(t);this.openingSequenceTimeout=window.setTimeout(()=>{this.openingSequenceTimeout=null,this.openingSequenceCancelled||(this.revealOpeningSequenceMessage(t),this.playOpeningSequenceMessageAt(e+1))},n)}},revealOpeningSequenceMessage(e){this.messagesContainerTarget.insertBefore(e,this.messageTemplateTarget),e.hidden=!1,this.recordOpeningSequenceMessage(e),this.scrollOpeningSequenceToBottom()},recordOpeningSequenceMessage(e){var t=e.dataset.openingSequenceMessageId;t&&!this.revealedOpeningSequenceMessageIds.includes(t)&&this.revealedOpeningSequenceMessageIds.push(t)},openingSequenceMessageDelay(e){var t=Number(e.dataset.delaySeconds||0);return Number.isFinite(t)?t:0},scrollOpeningSequenceToBottom(){this.messagesContainerTarget.scroll&&this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight,behavior:"smooth"})},cancelOpeningSequence(){this.openingSequenceCancelled=!0,null!==this.openingSequenceTimeout&&void 0!==this.openingSequenceTimeout&&(window.clearTimeout(this.openingSequenceTimeout),this.openingSequenceTimeout=null)},appendOpeningSequenceMessageIds(e){this.cancelOpeningSequence(),(this.revealedOpeningSequenceMessageIds||[]).forEach(t=>{e.append("message[opening_sequence_message_ids][]",t)})},clearRevealedOpeningSequenceMessageIds(){this.revealedOpeningSequenceMessageIds=[]}})},ys=e=>{Object.assign(e,{setupTeaser(){this.teaserCycleTimeout=null,this.teaserMessages=[],this.boundOnTeaserClick=this.boundOnTeaserClick||this.onTeaserClick.bind(this),this.hasTeaserTarget&&(this.teaserTarget.addEventListener("click",this.boundOnTeaserClick),this.startTeaserPresentation())},teardownTeaser(){this.stopTeaserCycle(),this.hasTeaserTarget&&this.boundOnTeaserClick&&this.teaserTarget.removeEventListener("click",this.boundOnTeaserClick)},collectTeaserMessages(){return this.hasTeaserTarget?Array.from(this.teaserTarget.querySelectorAll("[data-teaser-message]")):[]},startTeaserPresentation(){this.stopTeaserCycle(),this.teaserMessages=this.collectTeaserMessages(),this.hasTeaserTarget&&(0!==this.teaserMessages.length?this.openValue||this.conversationIdValue||this.hasRenderedConversationMessages()?this.dismissTeaserForSession():this.teaserSeenForSession()?this.hideTeaser():(this.teaserTarget.classList.remove("invisible"),this.showTeaserMessage(0),this.teaserMessages.length<2||this.scheduleNextTeaserMessage(0)):this.hideTeaser())},scheduleNextTeaserMessage(e){var t=e+1;if(!(t>=this.teaserMessages.length)){var n=this.teaserMessages[e],r=this.teaserPresentationDelay(n);this.teaserCycleTimeout=window.setTimeout(()=>{this.teaserCycleTimeout=null,this.showTeaserMessage(t),this.scheduleNextTeaserMessage(t)},r)}},showTeaserMessage(e){this.teaserMessages.forEach((t,n)=>{t.classList.toggle("hidden",n!==e)})},stopTeaserCycle(){null!==this.teaserCycleTimeout&&void 0!==this.teaserCycleTimeout&&(window.clearTimeout(this.teaserCycleTimeout),this.teaserCycleTimeout=null)},teaserMessageDelay(e){var t=Number(e.dataset.delaySeconds||0);return Number.isFinite(t)?t:0},teaserPresentationDelay(e){return Math.max(1e3*this.teaserMessageDelay(e),250)},hasRenderedConversationMessages(){var e=[];try{e=Array.from(this.messageTargets||[])}catch(t){e=[]}return e.some(e=>e!==this.messageTemplateTarget)},teaserSeenKey(){var e=this.hasTeaserTarget?this.teaserTarget.dataset.teaserVersion:"",t=e?":".concat(e):"";return"hellotext:webchat:".concat(this.idValue||this.element.id,":teaser-seen").concat(t)},teaserSeenForSession(){try{return"true"===window.sessionStorage.getItem(this.teaserSeenKey())}catch(e){return!1}},markTeaserSeenForSession(){try{window.sessionStorage.setItem(this.teaserSeenKey(),"true")}catch(e){}},dismissTeaserForSession(){this.markTeaserSeenForSession(),this.hideTeaser()},hideTeaser(){this.stopTeaserCycle(),this.hasTeaserTarget&&this.teaserTarget.classList.add("invisible")},onTeaserClick(e){e.target.closest("a")||(this.dismissTeaserForSession(),this.show())}})};function vs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vs(Object(n),!0).forEach(function(t){ws(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ws(e,t,n){return(t=ks(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Os(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ts(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Os(o,r,i,s,a,"next",e)}function a(e){Os(o,r,i,s,a,"throw",e)}s(void 0)})}}function Ss(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,ks(r.key),r)}}function ks(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Es(){return Es="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ps(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Es.apply(this,arguments)}function Cs(e,t){return Cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cs(e,t)}function Ps(e){return Ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ps(e)}var As={hour:"numeric",minute:"2-digit"},js=/Android|iPhone|iPad|iPod/i,xs={capture:!0,passive:!0},Ms=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cs(e,t)}(p,e);var t,n,r,i,o,s,a,c,l,u,h,f,d=(h=p,f=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Ps(h);if(f){var n=Ps(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function p(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),d.apply(this,arguments)}return t=p,n=[{key:"initialize",value:function(){this.messagesAPI=new is(this.idValue),this.webChatChannel=new ps(this.idValue,ii.session,this.conversationIdValue),this.files=[],this.messageIds=new Set,this.catchUpAfterMessageId=null,this.fetchingCatchUpMessages=!1,this.onMessageReceived=this.onMessageReceived.bind(this),this.onMessageReaction=this.onMessageReaction.bind(this),this.onTypingStart=this.onTypingStart.bind(this),this.captureCatchUpCursor=this.captureCatchUpCursor.bind(this),this.catchUpMessages=this.catchUpMessages.bind(this),this.onScroll=this.onScroll.bind(this),this.onOutboundMessageSent=this.onOutboundMessageSent.bind(this),this.closePopoverOnEscape=this.closePopoverOnEscape.bind(this),this.broadcastChannel=new BroadcastChannel("hellotext--webchat--".concat(this.idValue)),this.webChatChannel.onDisconnect(this.captureCatchUpCursor),this.webChatChannel.onReconnect(this.catchUpMessages),Es(Ps(p.prototype),"initialize",this).call(this)}},{key:"connect",value:function(){ms(this),Ho(this),gs(this),ys(this),this.setupFloatingUI({trigger:this.triggerTarget,popover:this.popoverTarget}),this.hasTeaserTarget&&this.setupFloatingUI({trigger:this.triggerTarget,popover:this.teaserTarget,strategy:"absolute"}),this.setupTeaser(),this.setupOpeningSequence(),this.localizeMessageTimestamps(),this.webChatChannel.onMessage(this.onMessageReceived),this.webChatChannel.onTypingStart(this.onTypingStart),this.webChatChannel.onReaction(this.onMessageReaction),this.setupMessagesContainerScrollIsolation(),this.messagesContainerTarget.addEventListener("scroll",this.onScroll),this.messagesContainerTarget.addEventListener("wheel",this.stopHostScrollPropagation,xs),this.messagesContainerTarget.addEventListener("touchmove",this.stopHostScrollPropagation,xs),this.shouldOpenOnMount&&(this.openValue=!0),ii.eventEmitter.dispatch("webchat:mounted"),this.broadcastChannel.addEventListener("message",this.onOutboundMessageSent),window.addEventListener("keydown",this.closePopoverOnEscape,!0),this.scheduleBehaviourOpen(),Es(Ps(p.prototype),"connect",this).call(this)}},{key:"disconnect",value:function(){this.cancelBehaviourOpen(),this.clearPopoverOpenAnimation(),this.teardownTeaser(),this.teardownOpeningSequence(),this.broadcastChannel.removeEventListener("message",this.onOutboundMessageSent),this.messagesContainerTarget.removeEventListener("scroll",this.onScroll),this.messagesContainerTarget.removeEventListener("wheel",this.stopHostScrollPropagation,xs),this.messagesContainerTarget.removeEventListener("touchmove",this.stopHostScrollPropagation,xs),window.removeEventListener("keydown",this.closePopoverOnEscape,!0),this.clearTypingIndicator(),this.broadcastChannel.close(),this.floatingUICleanup(),Es(Ps(p.prototype),"disconnect",this).call(this)}},{key:"setupMessagesContainerScrollIsolation",value:function(){this.messagesContainerTarget.style.overscrollBehavior="contain",this.messagesContainerTarget.style.webkitOverflowScrolling="touch",this.messagesContainerTarget.style.touchAction="pan-y",this.messagesContainerTarget.setAttribute("data-lenis-prevent",""),this.messagesContainerTarget.setAttribute("data-lenis-prevent-wheel",""),this.messagesContainerTarget.setAttribute("data-lenis-prevent-touch","")}},{key:"stopHostScrollPropagation",value:function(e){e.stopPropagation()}},{key:"onTypingStart",value:function(){if(this.typingIndicatorVisible)return this.resetTypingIndicatorTimer();this.showTypingIndicator()}},{key:"showOptimisticTypingIndicator",value:function(){this.typingIndicatorVisible||this.showTypingIndicator()}},{key:"showTypingIndicator",value:function(){this.clearTypingIndicator(),this.typingIndicatorVisible=!0;var e=this.typingIndicatorTemplateTarget.cloneNode(!0);e.setAttribute("data-hellotext--webchat-target","typingIndicator"),e.style.display="flex",this.messagesContainerTarget.appendChild(e),requestAnimationFrame(()=>{this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight,behavior:"instant"})});var t=this.typingIndicatorKeepAliveValue;this.incomingTypingIndicatorTimeout=setTimeout(()=>{this.clearTypingIndicator()},t)}},{key:"resetTypingIndicatorTimer",value:function(){if(this.typingIndicatorVisible){clearTimeout(this.incomingTypingIndicatorTimeout),clearTimeout(this.optimisticTypingTimeout);var e=this.typingIndicatorKeepAliveValue;this.incomingTypingIndicatorTimeout=setTimeout(()=>{this.clearTypingIndicator()},e)}}},{key:"clearTypingIndicator",value:function(){this.hasTypingIndicatorTarget&&this.typingIndicatorTarget.remove(),this.typingIndicatorVisible=!1,clearTimeout(this.incomingTypingIndicatorTimeout),clearTimeout(this.optimisticTypingTimeout)}},{key:"onMessageInputChange",value:function(){this.resizeInput(),clearTimeout(this.typingIndicatorTimeout),this.hasSentTypingIndicator||(this.webChatChannel.startTypingIndicator(),this.hasSentTypingIndicator=!0),this.typingIndicatorTimeout=setTimeout(()=>{this.hasSentTypingIndicator=!1},3e3)}},{key:"onOutboundMessageSent",value:function(e){var{data:t}=e,n={"message:sent":e=>{var t=(new DOMParser).parseFromString(e.element,"text/html").body.firstElementChild;this.localizeMessageTimestamps(t),this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(t,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(t),t.scrollIntoView({behavior:"instant"})},"message:failed":e=>{var t=this.messagesContainerTarget.querySelector("#".concat(e.id));this.markMessageFailed(t,e.reason)}};n[t.type]?n[t.type](t):console.log("Unhandled message event: ".concat(t.type))}},{key:"onScroll",value:(u=Ts(function*(){if(!(this.messagesContainerTarget.scrollTop>300||!this.nextPageValue||this.fetchingNextPage)){this.fetchingNextPage=!0;var e=yield this.messagesAPI.index({page:this.nextPageValue,session:ii.session}),{next:t,messages:n}=yield e.json();this.nextPageValue=t,this.oldScrollHeight=this.messagesContainerTarget.scrollHeight,n.forEach(e=>{var{body:t,attachments:n}=e,r=e.created_at||e.createdAt,i=this.messageTemplateTarget.cloneNode(!0);i.classList.add("hellotext--webchat-message"),i.setAttribute("data-hellotext--webchat-target","message"),i.setAttribute("data-id",e.id),r&&i.setAttribute("data-created-at",r),i.style.removeProperty("display"),tr(i.querySelector("[data-body]"),t),"received"===e.state?i.classList.add("received"):i.classList.remove("received"),n&&n.forEach(e=>{var t,n=this.attachmentImageTarget.cloneNode(!0);n.removeAttribute("data-hellotext--webchat-target"),n.src=e,n.style.display="block",null===(t=this.messageAttachmentsContainer(i))||void 0===t||t.appendChild(n)}),i.setAttribute("data-body",t),this.localizeMessageTimestamp(i.querySelector("[data-message-timestamp]"),r),this.messagesContainerTarget.prepend(i)}),this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight-this.oldScrollHeight,behavior:"instant"}),this.fetchingNextPage=!1}}),function(){return u.apply(this,arguments)})},{key:"onClickOutside",value:function(e){N.mode===L.POPOVER&&this.openValue&&e.target.nodeType&&!1===this.element.contains(e.target)&&(this.openValue=!1)}},{key:"closePopover",value:function(){this.clearPopoverOpenAnimation(),this.popoverTarget.classList.remove(...this.fadeOutClasses),this.openValue=!1}},{key:"preparePopoverOpenAnimation",value:function(){this.clearPopoverOpenAnimation(),this.popoverTarget.classList.remove(...this.fadeOutClasses),this.popoverTarget.classList.add("hellotext--webchat-popover-opening"),this.popoverOpenAnimationTimeout=setTimeout(()=>{this.popoverTarget.classList.remove("hellotext--webchat-popover-opening"),this.popoverOpenAnimationTimeout=null},120)}},{key:"clearPopoverOpenAnimation",value:function(){var e;this.popoverOpenAnimationTimeout&&(clearTimeout(this.popoverOpenAnimationTimeout),this.popoverOpenAnimationTimeout=null),null===(e=this.popoverTarget)||void 0===e||e.classList.remove("hellotext--webchat-popover-opening")}},{key:"onPopoverOpened",value:function(){var e;this.popoverTarget.classList.remove(...this.fadeOutClasses),null===(e=this.dismissTeaserForSession)||void 0===e||e.call(this),this.onMobile||this.focusComposeInput(),this.scrolled||(requestAnimationFrame(()=>{this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight,behavior:"instant"})}),this.scrolled=!0),ii.eventEmitter.dispatch("webchat:opened"),localStorage.setItem("hellotext--webchat--".concat(this.idValue),"opened"),this.messageTeaserValue&&(this.messageTeaserValue=null),this.startOpeningSequence(),"none"!==this.unreadCounterTarget.style.display&&(this.unreadCounterTarget.style.display="none",this.unreadCounterTarget.innerText="0",this.messagesAPI.markAsSeen())}},{key:"onPopoverClosed",value:function(){this.clearPopoverOpenAnimation(),ii.eventEmitter.dispatch("webchat:closed"),localStorage.setItem("hellotext--webchat--".concat(this.idValue),"closed")}},{key:"onMessageReaction",value:function(e){var{message:t,reaction:n,type:r}=e,i=this.messageTargets.find(e=>e.dataset.id===t).querySelector("[data-reactions]");if("reaction.destroy"===r)return i.querySelector('[data-id="'.concat(n.id,'"]')).remove();if(i.querySelector('[data-id="'.concat(n.id,'"]')))i.querySelector('[data-id="'.concat(n.id,'"]')).innerText=n.emoji;else{var o=document.createElement("span");o.innerText=n.emoji,o.setAttribute("data-id",n.id),i.appendChild(o)}}},{key:"onMessageReceived",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{id:r,body:i,attachments:o,teaser:s}=e,a=e.created_at||e.createdAt;if(this.claimMessageId(r)){if(null===(t=this.hideTeaser)||void 0===t||t.call(this),e.carousel)return this.insertCarouselMessage(e,n);var c=this.messageTemplateTarget.cloneNode(!0);c.classList.add("hellotext--webchat-message"),c.style.display="flex",tr(c.querySelector("[data-body]"),i),c.setAttribute("data-id",r),c.setAttribute("data-hellotext--webchat-target","message"),this.setMessageCreatedAt(c,a),this.localizeMessageTimestamp(c.querySelector("[data-message-timestamp]"),a),o&&o.forEach(e=>{var t,n=this.attachmentImageTarget.cloneNode(!0);n.src=e,n.style.display="block",null===(t=this.messageAttachmentsContainer(c))||void 0===t||t.appendChild(n)}),this.clearTypingIndicator(),this.insertMessageElement(c),ii.eventEmitter.dispatch("webchat:message:received",bs(bs({},e),{},{body:c.querySelector("[data-body]").innerText})),!1!==n.scroll&&c.scrollIntoView({behavior:"smooth"}),this.updateMessageTeaser(s),this.openValue?this.messagesAPI.markAsSeen(r):this.incrementUnreadCounter()}}},{key:"claimMessageId",value:function(e){var t=this.messageTargets||[];return!this.messageIds.has(e)&&(this.messageIds.add(e),!t.some(t=>t.dataset.id===e))}},{key:"captureCatchUpCursor",value:function(){this.catchUpAfterMessageId=this.lastRenderedMessageId}},{key:"catchUpMessages",value:(l=Ts(function*(){var e=this.catchUpAfterMessageId;if(e&&!this.fetchingCatchUpMessages){this.fetchingCatchUpMessages=!0;try{var t=yield this.messagesAPI.catchUp(e),{messages:n=[]}=yield t.json();n.forEach(e=>this.onMessageReceived(e,{scroll:!1})),this.catchUpAfterMessageId=this.lastRenderedMessageId}finally{this.fetchingCatchUpMessages=!1}}}),function(){return l.apply(this,arguments)})},{key:"lastRenderedMessageId",get:function(){var e,t=this.persistedMessageElements;return(null===(e=t[t.length-1])||void 0===e?void 0:e.dataset.id)||null}},{key:"persistedMessageElements",get:function(){return Array.from(this.messagesContainerTarget.querySelectorAll(".hellotext--webchat-message[data-id]"))}},{key:"setMessageCreatedAt",value:function(e,t){t&&e.setAttribute("data-created-at",t)}},{key:"insertMessageElement",value:function(e){var t=this.nextMessageElementFor(e);t?this.messagesContainerTarget.insertBefore(e,t):this.messagesContainerTarget.appendChild(e)}},{key:"nextMessageElementFor",value:function(e){var t=Date.parse(e.dataset.createdAt);return Number.isNaN(t)?null:this.persistedMessageElements.find(n=>{if(n===e)return!1;var r=Date.parse(n.dataset.createdAt);return!Number.isNaN(r)&&r>t})}},{key:"updateMessageTeaser",value:function(e){this.messageTeaserValue=e,this.messageTeaserValue&&this.hasTeaserTarget&&this.hasInboundMessageTeaserTarget&&this.hasInboundMessageTeaserBodyTarget&&(this.teaserMessageTargets.forEach(e=>e.classList.add("hidden")),this.inboundMessageTeaserBodyTarget.textContent=this.messageTeaserValue,this.inboundMessageTeaserTarget.classList.remove("hidden"),this.teaserTarget.classList.toggle("invisible",this.openValue))}},{key:"insertCarouselMessage",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.html,i=e.created_at||e.createdAt,o=function(e){return er(e,Qn)}(r).firstElementChild;o.classList.add("hellotext--webchat-message"),o.setAttribute("data-id",e.id),o.setAttribute("data-hellotext--webchat-target","message"),this.setMessageCreatedAt(o,i),this.localizeMessageTimestamps(o),this.clearTypingIndicator(),this.insertMessageElement(o),!1!==n.scroll&&o.scrollIntoView({behavior:"smooth"}),ii.eventEmitter.dispatch("webchat:message:received",bs(bs({},e),{},{body:(null===(t=o.querySelector("[data-body]"))||void 0===t?void 0:t.innerText)||""})),this.updateMessageTeaser(e.teaser),this.openValue?this.messagesAPI.markAsSeen(e.id):this.incrementUnreadCounter()}},{key:"resizeInput",value:function(){this.inputTarget.style.height="auto";var e=this.inputTarget.scrollHeight;this.inputTarget.style.height="".concat(Math.min(e,96),"px")}},{key:"sendQuickReplyMessage",value:(c=Ts(function*(e){var t,n,{detail:{id:r,product:i,buttonId:o,body:s,cardElement:a}}=e;null===(t=this.dismissTeaserForSession)||void 0===t||t.call(this);var c=new FormData;c.append("message[body]",s),r&&c.append("message[replied_to]",r),i&&c.append("message[product]",i),o&&c.append("message[button]",o),c.append("session",ii.session),c.append("locale",j.toString()),this.appendOpeningSequenceMessageIds(c);var l,u=this.buildMessageElement(),h=null==a||null===(n=a.querySelector("img"))||void 0===n?void 0:n.cloneNode(!0);u.querySelector("[data-body]").innerText=s,h&&(h.removeAttribute("width"),h.removeAttribute("height"),null===(l=this.messageAttachmentsContainer(u))||void 0===l||l.appendChild(h)),this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(u,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(u),u.scrollIntoView({behavior:"smooth"}),this.broadcastChannel.postMessage({type:"message:sent",element:u.outerHTML});var f=yield this.messagesAPI.create(c);if(f.failed)return clearTimeout(this.optimisticTypingTimeout),this.markMessageFailedFromResponse(f,u);var d=yield f.json();this.dispatch("set:id",{target:u,detail:d.id}),this.localizeMessageTimestamp(u.querySelector("[data-message-timestamp]"),d.created_at||d.createdAt),this.clearRevealedOpeningSequenceMessageIds();var p={id:d.id,body:s,attachments:h?[h.src]:[],replied_to:r,product:i,button:o,type:"quick_reply"};ii.eventEmitter.dispatch("webchat:message:sent",p)}),function(e){return c.apply(this,arguments)})},{key:"sendTeaserQuickReply",value:(a=Ts(function*(e){var t;e.preventDefault(),e.stopPropagation();var n=e.currentTarget,r=(n.dataset.value||"").trim(),i=[n.dataset.text,n.textContent].map(e=>(e||"").trim()).find(e=>e.length>0),o=r||i;if(o){null===(t=this.dismissTeaserForSession)||void 0===t||t.call(this),this.show();var s=(n.dataset.type||"").trim()||"quick_reply",a=new FormData;a.append("message[body]",o),a.append("session",ii.session),a.append("locale",j.toString()),this.appendOpeningSequenceMessageIds(a);var c=this.buildMessageElement();c.querySelector("[data-body]").innerText=o,this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(c,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(c),c.scrollIntoView({behavior:"smooth"}),this.broadcastChannel.postMessage({type:"message:sent",element:c.outerHTML}),this.typingIndicatorVisible||(clearTimeout(this.optimisticTypingTimeout),this.optimisticTypingTimeout=setTimeout(()=>{this.showOptimisticTypingIndicator()},this.optimisticTypingIndicatorWaitValue));var l=yield this.messagesAPI.create(a);if(l.failed)return clearTimeout(this.optimisticTypingTimeout),this.markMessageFailedFromResponse(l,c);var u=yield l.json();c.setAttribute("data-id",u.id),this.localizeMessageTimestamp(c.querySelector("[data-message-timestamp]"),u.created_at||u.createdAt),this.clearRevealedOpeningSequenceMessageIds(),ii.eventEmitter.dispatch("webchat:message:sent",{id:u.id,body:o,attachments:[],type:"quick_reply",teaser:{text:i||o,value:r||o,type:s}}),u.conversation&&u.conversation!==this.conversationIdValue&&(this.conversationIdValue=u.conversation,this.webChatChannel.updateSubscriptionWith(this.conversationIdValue)),this.typingIndicatorVisible&&this.resetTypingIndicatorTimer()}}),function(e){return a.apply(this,arguments)})},{key:"sendMessage",value:(s=Ts(function*(e){var t,n={body:this.inputTarget.value,attachments:this.files};if(0!==this.inputTarget.value.trim().length||0!==this.files.length){null===(t=this.dismissTeaserForSession)||void 0===t||t.call(this);var r=new FormData;this.inputTarget.value.trim().length>0?r.append("message[body]",this.inputTarget.value):delete n.body,this.files.forEach(e=>{r.append("message[attachments][]",e)}),r.append("session",ii.session),r.append("locale",j.toString()),this.appendOpeningSequenceMessageIds(r);var i=this.buildMessageElement();this.inputTarget.value.trim().length>0?i.querySelector("[data-body]").innerText=this.inputTarget.value:i.querySelector("[data-message-bubble]").remove();var o=this.attachmentContainerTarget.querySelectorAll("img");o.length>0&&o.forEach(e=>{var t;null===(t=this.messageAttachmentsContainer(i))||void 0===t||t.appendChild(e.cloneNode(!0))}),this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(i,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(i),i.scrollIntoView({behavior:"smooth"}),this.broadcastChannel.postMessage({type:"message:sent",element:i.outerHTML}),this.inputTarget.value="",this.resizeInput(),this.files=[],this.attachmentInputTarget.value="",this.attachmentContainerTarget.innerHTML="",this.attachmentContainerTarget.style.display="none",this.errorMessageContainerTarget.style.display="none",this.focusComposeInput(),this.typingIndicatorVisible||(clearTimeout(this.optimisticTypingTimeout),this.optimisticTypingTimeout=setTimeout(()=>{this.showOptimisticTypingIndicator()},this.optimisticTypingIndicatorWaitValue));var s=yield this.messagesAPI.create(r);if(s.failed)return clearTimeout(this.optimisticTypingTimeout),this.markMessageFailedFromResponse(s,i);var a=yield s.json();i.setAttribute("data-id",a.id),n.id=a.id,this.localizeMessageTimestamp(i.querySelector("[data-message-timestamp]"),a.created_at||a.createdAt),this.clearRevealedOpeningSequenceMessageIds(),ii.eventEmitter.dispatch("webchat:message:sent",n),a.conversation!==this.conversationIdValue&&(this.conversationIdValue=a.conversation,this.webChatChannel.updateSubscriptionWith(this.conversationIdValue)),this.typingIndicatorVisible&&this.resetTypingIndicatorTimer(),this.attachmentContainerTarget.style.display=""}else e&&e.target&&e.preventDefault()}),function(e){return s.apply(this,arguments)})},{key:"buildMessageElement",value:function(){var e=this.messageTemplateTarget.cloneNode(!0);return e.id="hellotext--webchat--".concat(this.idValue,"--message--").concat(Date.now()),e.classList.add("received"),e.style.removeProperty("display"),e.setAttribute("data-controller","hellotext--message"),e.setAttribute("data-hellotext--webchat-target","message"),this.localizeMessageTimestamp(e.querySelector("[data-message-timestamp]"),new Date),e}},{key:"focusCompose",value:function(e){var{target:t}=e,n=["button","a","input","textarea","select","label",'[role="button"]',"em-emoji-picker",'[data-hellotext--webchat--emoji-target~="popover"]','[data-controller~="hellotext--webchat--emoji"]'].join(", ");this.hasInputTarget&&!t.closest(n)&&this.focusComposeInput({moveCursorToEnd:!0})&&e.preventDefault()}},{key:"closePopoverFromHeader",value:function(e){var{target:t}=e;t.closest(".hellotext--webchat-header-channel-button, .hellotext--webchat-close-button")||(e.preventDefault(),this.closePopover())}},{key:"closePopoverOnEscape",value:function(e){var t,n;"Escape"===e.key&&this.openValue&&(e.preventDefault(),e.stopPropagation(),this.closePopover(),null===(t=this.triggerTarget)||void 0===t||null===(n=t.focus)||void 0===n||n.call(t))}},{key:"markMessageFailedFromResponse",value:(o=Ts(function*(e,t){var n=yield this.messageFailureReason(e);this.markMessageFailed(t,n),this.broadcastChannel.postMessage({type:"message:failed",id:t.id,reason:n})}),function(e,t){return o.apply(this,arguments)})},{key:"markMessageFailed",value:function(e,t){if(e&&(e.classList.add("failed"),t)){var n=e.querySelector("[data-message-timestamp]");n&&(n.textContent=t)}}},{key:"localizeMessageTimestamps",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;n&&(null!==(e=n.matches)&&void 0!==e&&e.call(n,"time[datetime][data-message-timestamp]")?[n]:Array.from((null===(t=n.querySelectorAll)||void 0===t?void 0:t.call(n,"time[datetime][data-message-timestamp]"))||[])).forEach(e=>this.localizeMessageTimestamp(e))}},{key:"localizeMessageTimestamp",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null==e?void 0:e.getAttribute("datetime");if(e&&t){var n=t instanceof Date?t:new Date(t);Number.isNaN(n.getTime())||(e.setAttribute("datetime",n.toISOString()),e.textContent=this.formatMessageTimestamp(n))}}},{key:"formatMessageTimestamp",value:function(e){return this.constructor.messageTimestampFormatterFor(j.toString()).format(e)}},{key:"messageFailureReason",value:(i=Ts(function*(e){var t=(null==e?void 0:e.data)||(null==e?void 0:e.response),n=(null==t?void 0:t.statusText)||"Message failed";try{var r,i=null!=t&&t.clone?t.clone():t,o=yield null==i||null===(r=i.json)||void 0===r?void 0:r.call(i),s=this.messageFailureReasonFromPayload(o);if(s)return s}catch(e){}try{var a,c=null!=t&&t.clone?t.clone():t,l=yield null==c||null===(a=c.text)||void 0===a?void 0:a.call(c);return this.messageFailureReasonFromText(l)||n}catch(e){return n}}),function(e){return i.apply(this,arguments)})},{key:"messageFailureReasonFromText",value:function(e){if("string"!=typeof e)return null;var t=e.trim();if(!t||t.startsWith("<"))return null;try{return this.messageFailureReasonFromPayload(JSON.parse(t))||t}catch(e){return t}}},{key:"messageFailureReasonFromPayload",value:function(e){var t,n,r,i,o,s;return e?[null===(t=e.error)||void 0===t?void 0:t.message,e.message,null===(n=e.errors)||void 0===n?void 0:n.message,null===(r=e.errors)||void 0===r||null===(i=r[0])||void 0===i?void 0:i.message,null===(o=e.errors)||void 0===o||null===(s=o[0])||void 0===s?void 0:s.description].find(e=>"string"==typeof e&&e.trim().length>0):null}},{key:"messageAttachmentsContainer",value:function(e){return e.querySelector("[data-attachments-container], [data-attachment-container]")}},{key:"incrementUnreadCounter",value:function(){this.unreadCounterTarget.style.display="flex";var e=(parseInt(this.unreadCounterTarget.innerText)||0)+1;this.unreadCounterTarget.innerText=Math.min(e,9)}},{key:"openAttachment",value:function(){this.attachmentInputTarget.click()}},{key:"onFileInputChange",value:function(){this.errorMessageContainerTarget.style.display="none";var e=Array.from(this.attachmentInputTarget.files);this.attachmentInputTarget.value="";var t=e.find(e=>{var t=e.type.split("/")[0];return["image","video","audio"].includes(t)?this.mediaValue[t].max_size<e.size:this.mediaValue.document.max_size<e.size});if(t){var n=t.type.split("/")[0],r=["image","audio","video"].includes(n)?n:"document";return this.errorMessageContainerTarget.innerText=this.fileSizeErrorMessageValue.replace("%{limit}",this.byteToMegabyte(this.mediaValue[r].max_size)),this.errorMessageContainerTarget.style.display="block"}this.files=[...this.files,...e],this.errorMessageContainerTarget.innerText="",e.forEach(e=>this.createAttachmentElement(e)),this.focusComposeInput()}},{key:"createAttachmentElement",value:function(e){var t=this.attachmentElement();if(this.attachmentContainerTarget.style.display="",t.setAttribute("data-name",e.name),e.type.startsWith("image/")){var n=this.attachmentImageTarget.cloneNode(!0);n.src=URL.createObjectURL(e),n.style.display="block",t.appendChild(n),this.attachmentContainerTarget.appendChild(t),this.attachmentContainerTarget.style.display="flex"}else{var r=t.querySelector("main");r.style.height="5rem",r.style.borderRadius="0.375rem",r.style.backgroundColor="#e5e7eb",r.style.padding="0.25rem",t.querySelector("p[data-attachment-name]").innerText=e.name,this.attachmentContainerTarget.appendChild(t),this.attachmentContainerTarget.style.display="flex"}}},{key:"removeAttachment",value:function(e){var{currentTarget:t}=e,n=t.closest("[data-hellotext--webchat-target='attachment']");this.files=this.files.filter(e=>e.name!==n.dataset.name),this.attachmentInputTarget.value="",n.remove(),this.focusComposeInput()}},{key:"attachmentTargetDisconnected",value:function(){0===this.attachmentTargets.length&&(this.attachmentContainerTarget.innerHTML="",this.attachmentContainerTarget.style.display="none")}},{key:"attachmentElement",value:function(){var e=this.attachmentTemplateTarget.cloneNode(!0);return e.removeAttribute("hidden"),e.style.display="flex",e.setAttribute("data-hellotext--webchat-target","attachment"),e}},{key:"onEmojiSelect",value:function(e){var{detail:t}=e,n=this.inputTarget.value,r=this.inputTarget.selectionStart,i=this.inputTarget.selectionEnd;this.inputTarget.value=n.slice(0,r)+t+n.slice(i),this.inputTarget.selectionStart=this.inputTarget.selectionEnd=r+t.length,this.focusComposeInput()}},{key:"focusComposeInput",value:function(){var{moveCursorToEnd:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.shouldAutofocusCompose)return!1;if(!1===this.hasInputTarget)return!1;if(void 0===this.hasInputTarget&&!this.inputTarget)return!1;if(this.inputTarget.focus(),e&&"number"==typeof this.inputTarget.selectionStart){var t=this.inputTarget.value.length;this.inputTarget.setSelectionRange(t,t)}return!0}},{key:"byteToMegabyte",value:function(e){return Math.ceil(e/1024/1024)}},{key:"middlewares",get:function(){return[Vo(this.offsetValue),Uo({padding:this.paddingValue}),zo()]}},{key:"shouldOpenOnMount",get:function(){return"opened"===localStorage.getItem("hellotext--webchat--".concat(this.idValue))&&!this.onMobile}},{key:"shouldAutofocusCompose",get:function(){return!this.usesVirtualKeyboard}},{key:"usesVirtualKeyboard",get:function(){var e;if("undefined"==typeof navigator)return!1;var t=navigator.userAgent||"",n="MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,r=js.test(t),i=!0===(null===(e=navigator.userAgentData)||void 0===e?void 0:e.mobile);return r||n||i||this.hasTouchOnlyPointer}},{key:"hasTouchOnlyPointer",get:function(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches&&window.matchMedia("(hover: none)").matches}},{key:"onMobile",get:function(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(max-width: ".concat(this.fullScreenThresholdValue,"px)")).matches}}],r=[{key:"messageTimestampFormatterFor",value:function(e){var t=e||"default";return this.messageTimestampFormatters[t]||(this.messageTimestampFormatters[t]=this.buildMessageTimestampFormatter(e)),this.messageTimestampFormatters[t]}},{key:"buildMessageTimestampFormatter",value:function(e){try{return new Intl.DateTimeFormat(e||void 0,As)}catch(e){return new Intl.DateTimeFormat(void 0,As)}}}],n&&Ss(t.prototype,n),r&&Ss(t,r),Object.defineProperty(t,"prototype",{writable:!1}),p}(y.xI);Ms.messageTimestampFormatters={},Ms.values={id:String,conversationId:String,media:Object,fileSizeErrorMessage:String,placement:{type:String,default:"bottom-end"},open:{type:Boolean,default:!1},autoPlacement:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},nextPage:{type:Number,default:void 0},fullScreenThreshold:{type:Number,default:1024},typingIndicatorKeepAlive:{type:Number,default:3e4},offset:{type:Number,default:24},padding:{type:Number,default:24},optimisticTypingIndicatorWait:{type:Number,default:1e3},teaser:Object,messageTeaser:String,behaviour:Object},Ms.classes=["fadeOut"],Ms.targets=["trigger","popover","input","attachmentInput","attachmentButton","errorMessageContainer","attachmentTemplate","attachmentContainer","attachment","messageTemplate","messagesContainer","title","attachmentImage","footer","toolbar","message","unreadCounter","typingIndicator","typingIndicatorTemplate","teaser","teaserMessage","inboundMessageTeaser","inboundMessageTeaserBody","openingSequence","openingSequenceMessage"];var _s=y.lg.start();_s.register("hellotext--form",hi),_s.register("hellotext--webchat",Ms),_s.register("hellotext--webchat--emoji",Xo),_s.register("hellotext--message",bi),window.Hellotext=ii;const Is=ii},109(e,t,n){var r=n(601),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([e.id,"form[data-hello-form] {\n position: relative;\n}\n\nform[data-hello-form] article [data-error-container] {\n font-size: 0.875rem;\n line-height: 1.25rem;\n display: none;\n}\n\nform[data-hello-form] article:has(input:invalid) [data-error-container] {\n display: block;\n}\n\nform[data-hello-form] [data-logo-container] {\n display: flex;\n justify-content: center;\n align-items: flex-end;\n position: absolute;\n right: 1rem;\n bottom: 1rem;\n}\n\nform[data-hello-form] [data-logo-container] small {\n margin: 0 0.3rem;\n}\n\nform[data-hello-form] [data-logo-container] [data-hello-brand] {\n width: 4rem;\n}\n",""]);const a=s;n.d(t,["A",0,a])},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},601(e){e.exports=function(e){return e[1]}},72(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var o={},s=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=o[l]||0,h="".concat(l," ").concat(u);o[l]=u+1;var f=n(h),d={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==f)t[f].references++,t[f].updater(d);else{var p=i(d,r);r.byIndex=a,t.splice(a,0,{identifier:h,updater:p,references:1})}s.push(h)}return s}function i(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var o=r(e=e||[],i=i||{});return function(e){e=e||[];for(var s=0;s<o.length;s++){var a=n(o[s]);t[a].references--}for(var c=r(e,i),l=0;l<o.length;l++){var u=n(o[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=c}}},659(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}};const t={};function n(r){const i=t[r];if(void 0!==i)return i.exports;const o=t[r]={id:r,exports:{}};return e[r](o,o.exports,n),o.exports}n.m=e,n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"==typeof r.then)return r}const o=Object.create(null);n.r(o);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(o,s),o}})(),n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var i=t[r++],o=t[r++];n.o(e,i)?0===o&&r++:0===o?Object.defineProperty(e,i,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,i,{enumerable:!0,get:o})}else for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>({160:"webchat-emoji",200:"webchat-emoji-en",437:"webchat-emoji-es"}[e]+".js"),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),(()=>{const e={},t="Hellotext:";n.l=(r,i,o,s)=>{if(e[r])return void e[r].push(i);let a,c;if(void 0!==o){const e=document.getElementsByTagName("script");for(var l=0;l<e.length;l++){const n=e[l];if(n.getAttribute("src")==r||n.getAttribute("data-webpack")==t+o){a=n;break}}}a||(c=!0,a=document.createElement("script"),a.charset="utf-8",n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack",t+o),a.src=r),e[r]=[i];const u=(t,n)=>{a.onerror=a.onload=null,clearTimeout(h);const i=e[r];if(delete e[r],a.parentNode?.removeChild(a),i?.forEach(e=>e(n)),t)return t(n)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),c&&document.head.appendChild(a)}})(),n.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{let e;n.g.importScripts&&(e=n.g.location+"");const t=n.g.document;if(!e&&t&&("SCRIPT"===t.currentScript?.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){const n=t.getElementsByTagName("script");if(n.length){let t=n.length-1;for(;t>-1&&(!e||!/^http(s?):/.test(e));)e=n[t--].src}}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{const e={792:0};n.f.j=(t,r)=>{let i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{const o=new Promise((n,r)=>i=e[t]=[n,r]);r.push(i[2]=o);const s=n.p+n.u(t),a=new Error,c=r=>{if(n.o(e,t)&&(i=e[t],0!==i&&(e[t]=void 0),i)){const e=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+e+": "+n+")",a.name="ChunkLoadError",a.type=e,a.request=n,i[1](a)}};n.l(s,c,"chunk-"+t,t)}};const t=(t,r)=>{let[i,o,s]=r;var a,c,l=0;if(i.some(t=>0!==e[t])){for(a in o)n.o(o,a)&&(n.m[a]=o[a]);s&&s(n)}for(t&&t(r);l<i.length;l++)c=i[l],n.o(e,c)&&e[c]&&e[c][0](),e[c]=0},r=Object("undefined"!=typeof self?self:this).webpackChunkHellotext=Object("undefined"!=typeof self?self:this).webpackChunkHellotext||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),n.nc=void 0,n(891);let r=n(500);return r=r.default,r})());
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Hellotext=t():e.Hellotext=t()}(Object("undefined"!=typeof self?self:this),()=>(()=>{"use strict";var e={891(e,t,n){n.d(t,{lg:()=>G,xI:()=>ie});class r{constructor(e,t,n){this.eventTarget=e,this.eventName=t,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=function(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{const n=e.index,r=t.index;return n<r?-1:n>r?1:0})}}class i{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,n={}){this.application.handleError(e,`Error ${t}`,n)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:n,eventOptions:r}=e,i=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(n,r);i.delete(o),0==i.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:n,eventOptions:r}=e;return this.fetchEventListener(t,n,r)}fetchEventListener(e,t,n){const r=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(t,n);let o=r.get(i);return o||(o=this.createEventListener(e,t,n),r.set(i,o)),o}createEventListener(e,t,n){const i=new r(e,t,n);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const n=[e];return Object.keys(t).sort().forEach(e=>{n.push(`${t[e]?"":"!"}${e}`)}),n.join(":")}}const o={stop:({event:e,value:t})=>(t&&e.stopPropagation(),!0),prevent:({event:e,value:t})=>(t&&e.preventDefault(),!0),self:({event:e,value:t,element:n})=>!t||n===e.target},s=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function a(e){return e.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function c(e){return a(e.replace(/--/g,"-").replace(/__/g,"_"))}function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u(e){return e.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function h(e){return null!=e}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const d=["meta","ctrl","alt","shift"];class p{constructor(e,t,n,r){this.element=e,this.index=t,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||function(e){const t=e.tagName.toLowerCase();if(t in m)return m[t](e)}(e)||y("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||y("missing identifier"),this.methodName=n.methodName||y("missing method name"),this.keyFilter=n.keyFilter||"",this.schema=r}static forToken(e,t){return new this(e.element,e.index,function(e){const t=e.trim().match(s)||[];let n=t[2],r=t[3];return r&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${r}`,r=""),{eventTarget:(i=t[4],"window"==i?window:"document"==i?document:void 0),eventName:n,eventOptions:t[7]?(o=t[7],o.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||r};var i,o}(e.content),t)}toString(){const e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;const t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;const n=t.filter(e=>!d.includes(e))[0];return!!n&&(f(this.keyMappings,n)||y(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[n].toLowerCase()!==e.key.toLowerCase())}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;const t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){const e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:n,value:r}of Array.from(this.element.attributes)){const i=n.match(t),o=i&&i[1];o&&(e[a(o)]=g(r))}return e}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){const[n,r,i,o]=d.map(e=>t.includes(e));return e.metaKey!==n||e.ctrlKey!==r||e.altKey!==i||e.shiftKey!==o}}const m={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function y(e){throw new Error(e)}function g(e){try{return JSON.parse(e)}catch(t){return e}}class v{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){const t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){const{element:t}=this.action,{actionDescriptorFilters:n}=this.context.application,{controller:r}=this.context;let i=!0;for(const[o,s]of Object.entries(this.eventOptions))if(o in n){const a=n[o];i=i&&a({name:o,value:s,event:e,element:t,controller:r})}return i}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){const{target:t,currentTarget:n}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:n,action:this.methodName})}catch(t){const{identifier:n,controller:r,element:i,index:o}=this,s={identifier:n,controller:r,element:i,index:o,event:e};this.context.handleError(t,`invoking action "${this.action}"`,s)}}willBeInvokedByEvent(e){const t=e.target;return!(e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e))&&!(e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e))&&(this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class b{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(e=>this.processMutations(e))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const n of this.matchElementsInTree(e))t.call(this,n)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}}class w{constructor(e,t,n){this.attributeName=t,this.delegate=n,this.elementObserver=new b(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return t.concat(n)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}function O(e,t){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n}class T{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,t)=>e.concat(Array.from(t)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,t)=>e+t.size,0)}add(e,t){!function(e,t,n){O(e,t).add(n)}(this.valuesByKey,e,t)}delete(e,t){!function(e,t,n){O(e,t).delete(n),function(e,t){const n=e.get(t);null!=n&&0==n.size&&e.delete(t)}(e,t)}(this.valuesByKey,e,t)}has(e,t){const n=this.valuesByKey.get(e);return null!=n&&n.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(t=>t.has(e))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,n])=>n.has(e)).map(([e,t])=>e)}}class S{constructor(e,t,n,r){this._selector=t,this.details=r,this.elementObserver=new b(e,this),this.delegate=n,this.matchesByElement=new T}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){const{selector:t}=this;if(t){const n=e.matches(t);return this.delegate.selectorMatchElement?n&&this.delegate.selectorMatchElement(e,this.details):n}return!1}matchElementsInTree(e){const{selector:t}=this;if(t){const n=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(t)).filter(e=>this.matchElement(e));return n.concat(r)}return[]}elementMatched(e){const{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){const t=this.matchesByElement.getKeysForValue(e);for(const n of t)this.selectorUnmatched(e,n)}elementAttributeChanged(e,t){const{selector:n}=this;if(n){const t=this.matchElement(e),r=this.matchesByElement.has(n,e);t&&!r?this.selectorMatched(e,n):!t&&r&&this.selectorUnmatched(e,n)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}}class k{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(e=>this.processMutations(e))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const n=this.delegate.getStringMapKeyForAttribute(e);if(null!=n){this.stringMap.has(e)||this.stringMapKeyAdded(n,e);const r=this.element.getAttribute(e);if(this.stringMap.get(e)!=r&&this.stringMapValueChanged(r,n,t),null==r){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(n,e,t)}else this.stringMap.set(e,r)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,n)}stringMapKeyRemoved(e,t,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class E{constructor(e,t,n){this.attributeObserver=new w(e,t,this),this.delegate=n,this.tokensByElement=new T}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,n]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(n)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(e=>this.tokenMatched(e))}tokensUnmatched(e){e.forEach(e=>this.tokenUnmatched(e))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),r=function(e,t){const n=Math.max(e.length,t.length);return Array.from({length:n},(n,r)=>[e[r],t[r]])}(t,n).findIndex(([e,t])=>{return r=t,!((n=e)&&r&&n.index==r.index&&n.content==r.content);var n,r});return-1==r?[[],[]]:[t.slice(r),n.slice(r)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,n){return e.trim().split(/\s+/).filter(e=>e.length).map((e,r)=>({element:t,attributeName:n,content:e,index:r}))}(e.getAttribute(t)||"",e,t)}}class P{constructor(e,t,n){this.tokenListObserver=new E(e,t,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).set(e,n),this.delegate.elementMatchedValue(t,n))}tokenUnmatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,n))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(e){return{error:e}}}}class C{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new P(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new v(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){const t=p.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class A{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new k(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const n=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,n.writer(this.receiver[e]),n.writer(n.defaultValue))}stringMapValueChanged(e,t,n){const r=this.valueDescriptorNameMap[t];null!==e&&(null===n&&(n=r.writer(r.defaultValue)),this.invokeChangedCallback(t,e,n))}stringMapKeyRemoved(e,t,n){const r=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,r.writer(this.receiver[e]),n):this.invokeChangedCallback(e,r.writer(r.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:n,writer:r}of this.valueDescriptors)null==n||this.controller.data.has(e)||this.invokeChangedCallback(t,r(n),void 0)}invokeChangedCallback(e,t,n){const r=`${e}Changed`,i=this.receiver[r];if("function"==typeof i){const r=this.valueDescriptorNameMap[e];try{const e=r.reader(t);let o=n;n&&(o=r.reader(n)),i.call(this.receiver,e,o)}catch(e){throw e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${r.name}" - ${e.message}`),e}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){const e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{const n=this.valueDescriptorMap[t];e[n.name]=n}),e}hasValue(e){const t=`has${l(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class j{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new T}start(){this.tokenListObserver||(this.tokenListObserver=new E(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var n;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var n;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function x(e,t){const n=M(e);return Array.from(n.reduce((e,n)=>(function(e,t){const n=e[t];return Array.isArray(n)?n:[]}(n,t).forEach(t=>e.add(t)),e),new Set))}function M(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}class _{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new T,this.outletElementsByName=new T,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:n}){const r=this.getOutlet(e,n);r&&this.connectOutlet(r,e,n)}selectorUnmatched(e,t,{outletName:n}){const r=this.getOutletFromMap(e,n);r&&this.disconnectOutlet(r,e,n)}selectorMatchElement(e,{outletName:t}){const n=this.selector(t),r=this.hasOutlet(e,t),i=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return!!n&&r&&i&&e.matches(n)}elementMatchedAttribute(e,t){const n=this.getOutletNameFromOutletAttributeName(t);n&&this.updateSelectorObserverForOutlet(n)}elementAttributeValueChanged(e,t){const n=this.getOutletNameFromOutletAttributeName(t);n&&this.updateSelectorObserverForOutlet(n)}elementUnmatchedAttribute(e,t){const n=this.getOutletNameFromOutletAttributeName(t);n&&this.updateSelectorObserverForOutlet(n)}connectOutlet(e,t,n){var r;this.outletElementsByName.has(n,t)||(this.outletsByName.add(n,e),this.outletElementsByName.add(n,t),null===(r=this.selectorObserverMap.get(n))||void 0===r||r.pause(()=>this.delegate.outletConnected(e,t,n)))}disconnectOutlet(e,t,n){var r;this.outletElementsByName.has(n,t)&&(this.outletsByName.delete(n,e),this.outletElementsByName.delete(n,t),null===(r=this.selectorObserverMap.get(n))||void 0===r||r.pause(()=>this.delegate.outletDisconnected(e,t,n)))}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const n of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(n,t,e)}updateSelectorObserverForOutlet(e){const t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){const t=this.selector(e),n=new S(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,n),n.start()}setupAttributeObserverForOutlet(e){const t=this.attributeNameForOutletName(e),n=new w(this.scope.element,t,this);this.attributeObserverMap.set(e,n),n.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){const e=new T;return this.router.modules.forEach(t=>{x(t.definition.controllerConstructor,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(t=>t.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class I{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:n,controller:r,element:i}=this;t=Object.assign({identifier:n,controller:r,element:i},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new C(this,this.dispatcher),this.valueObserver=new A(this,this.controller),this.targetObserver=new j(this,this),this.outletObserver=new _(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,n={}){const{identifier:r,controller:i,element:o}=this;n=Object.assign({identifier:r,controller:i,element:o},n),this.application.handleError(e,`Error ${t}`,n)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,n){this.invokeControllerMethod(`${c(n)}OutletConnected`,e,t)}outletDisconnected(e,t,n){this.invokeControllerMethod(`${c(n)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const n=this.controller;"function"==typeof n[e]&&n[e](...t)}}const L="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,N=(()=>{function e(e){function t(){return Reflect.construct(e,arguments,new.target)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return function(){const t=e(function(){this.a.call(this)});t.prototype.a=function(){},new t}(),e}catch(e){return e=>class extends e{}}})();class R{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:(t=e.controllerConstructor,function(e,t){const n=N(e),r=function(e,t){return L(t).reduce((n,r)=>{const i=function(e,t,n){const r=Object.getOwnPropertyDescriptor(e,n);if(!r||!("value"in r)){const e=Object.getOwnPropertyDescriptor(t,n).value;return r&&(e.get=r.get||e.get,e.set=r.set||e.set),e}}(e,t,r);return i&&Object.assign(n,{[r]:i}),n},{})}(e.prototype,t);return Object.defineProperties(n.prototype,r),n}(t,function(e){return x(e,"blessings").reduce((t,n)=>{const r=n(e);for(const e in r){const n=t[e]||{};t[e]=Object.assign(n,r[e])}return t},{})}(t)))};var t}(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new I(this,e),this.contextsByScope.set(e,t)),t}}class D{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){return(this.data.get(this.getDataKey(e))||"").match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class F{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,t),this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${u(e)}`}}class B{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,n){let r=this.warnedKeysByObject.get(e);r||(r=new Set,this.warnedKeysByObject.set(e,r)),r.has(t)||(r.add(t),this.logger.warn(n,e))}}function V(e,t){return`[${e}~="${t}"]`}class q{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t),void 0)}findAll(...e){return e.reduce((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)],[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){return V(this.schema.targetAttributeForScope(this.identifier),e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(t=>this.deprecate(t,e))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return V(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:n}=this,r=this.schema.targetAttribute,i=this.schema.targetAttributeForScope(n);this.guide.warn(e,`target:${t}`,`Please replace ${r}="${n}.${t}" with ${i}="${t}". The ${r} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class U{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce((e,t)=>e||this.findOutlet(t),void 0)}findAll(...e){return e.reduce((e,t)=>[...e,...this.findAllOutlets(t)],[])}getSelectorForOutletName(e){const t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){const t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){const t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))}matchesElement(e,t,n){const r=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&r.split(" ").includes(n)}}class z{constructor(e,t,n,r){this.targets=new q(this),this.classes=new D(this),this.data=new F(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=n,this.guide=new B(r),this.outlets=new U(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return V(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new z(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class W{constructor(e,t,n){this.element=e,this.schema=t,this.delegate=n,this.valueListObserver=new P(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:n}=e;return this.parseValueForElementAndIdentifier(t,n)}parseValueForElementAndIdentifier(e,t){const n=this.fetchScopesByIdentifierForElement(e);let r=n.get(t);return r||(r=this.delegate.createScopeForElementAndIdentifier(e,t),n.set(t,r)),r}elementMatchedValue(e,t){const n=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,n),1==n&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const n=this.scopeReferenceCounts.get(t);n&&(this.scopeReferenceCounts.set(t,n-1),1==n&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class H{constructor(e){this.application=e,this.scopeObserver=new W(this.element,this.schema,this),this.scopesByIdentifier=new T,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new R(this.application,e);this.connectModule(t);const n=e.controllerConstructor.afterLoad;n&&n.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const n=this.modulesByIdentifier.get(t);if(n)return n.contexts.find(t=>t.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){const n=this.scopeObserver.parseValueForElementAndIdentifier(e,t);n?this.scopeObserver.elementMatchedValue(n.element,n):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,n){this.application.handleError(e,t,n)}createScopeForElementAndIdentifier(e,t){return new z(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(t=>e.connectContextForScope(t))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(t=>e.disconnectContextForScope(t))}}const $={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`,outletAttributeForScope:(e,t)=>`data-${e}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},K("abcdefghijklmnopqrstuvwxyz".split("").map(e=>[e,e]))),K("0123456789".split("").map(e=>[e,e])))};function K(e){return e.reduce((e,[t,n])=>Object.assign(Object.assign({},e),{[t]:n}),{})}class G{constructor(e=document.documentElement,t=$){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,n={})=>{this.debug&&this.logFormattedMessage(e,t,n)},this.element=e,this.schema=t,this.dispatcher=new i(this),this.router=new H(this),this.actionDescriptorFilters=Object.assign({},o)}static start(e,t){const n=new this(e,t);return n.start(),n}async start(){await new Promise(e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",()=>e()):e()}),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(e=>this.router.unloadIdentifier(e))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){const n=this.router.getContextForElementAndIdentifier(e,t);return n?n.controller:null}handleError(e,t,n){var r;this.logger.error("%s\n\n%o\n\n%o",t,e,n),null===(r=window.onerror)||void 0===r||r.call(window,t,"",0,0,e)}logFormattedMessage(e,t,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}}function J(e,t,n){return e.application.getControllerForElementAndIdentifier(t,n)}function Y(e,t,n){let r=J(e,t,n);return r||(e.application.router.proposeToConnectScopeForElementAndIdentifier(t,n),r=J(e,t,n),r||void 0)}function Z([e,t],n){return function(e){const{token:t,typeDefinition:n}=e,r=`${u(t)}-value`,i=function(e){const{controller:t,token:n,typeDefinition:r}=e,i=function(e){const{controller:t,token:n,typeObject:r}=e,i=h(r.type),o=h(r.default),s=i&&o,a=i&&!o,c=!i&&o,l=X(r.type),u=Q(e.typeObject.default);if(a)return l;if(c)return u;if(l!==u)throw new Error(`The specified default value for the Stimulus Value "${t?`${t}.${n}`:n}" must match the defined type "${l}". The provided default value of "${r.default}" is of type "${u}".`);return s?l:void 0}({controller:t,token:n,typeObject:r}),o=Q(r),s=X(r),a=i||o||s;if(a)return a;throw new Error(`Unknown value type "${t?`${t}.${r}`:n}" for "${n}" value`)}(e);return{type:i,key:r,name:a(r),get defaultValue(){return function(e){const t=X(e);if(t)return ee[t];const n=f(e,"default"),r=f(e,"type"),i=e;if(n)return i.default;if(r){const{type:e}=i,t=X(e);if(t)return ee[t]}return e}(n)},get hasCustomDefaultValue(){return void 0!==Q(n)},reader:te[i],writer:ne[i]||ne.default}}({controller:n,token:e,typeDefinition:t})}function X(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Q(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}const ee={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},te={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${Q(t)}"`);return t},boolean:e=>!("0"==e||"false"==String(e).toLowerCase()),number:e=>Number(e.replace(/_/g,"")),object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${Q(t)}"`);return t},string:e=>e},ne={default:function(e){return`${e}`},array:re,object:re};function re(e){return JSON.stringify(e)}class ie{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:n={},prefix:r=this.identifier,bubbles:i=!0,cancelable:o=!0}={}){const s=new CustomEvent(r?`${r}:${e}`:e,{detail:n,bubbles:i,cancelable:o});return t.dispatchEvent(s),s}}ie.blessings=[function(e){return x(e,"classes").reduce((e,t)=>{return Object.assign(e,(n=t,{[`${n}Class`]:{get(){const{classes:e}=this;if(e.has(n))return e.get(n);{const t=e.getAttributeName(n);throw new Error(`Missing attribute "${t}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${l(n)}Class`]:{get(){return this.classes.has(n)}}}));var n},{})},function(e){return x(e,"targets").reduce((e,t)=>{return Object.assign(e,(n=t,{[`${n}Target`]:{get(){const e=this.targets.find(n);if(e)return e;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${l(n)}Target`]:{get(){return this.targets.has(n)}}}));var n},{})},function(e){const t=function(e,t){return M(e).reduce((e,n)=>(e.push(...function(e,t){const n=e[t];return n?Object.keys(n).map(e=>[e,n[e]]):[]}(n,t)),e),[])}(e,"values"),n={valueDescriptorMap:{get(){return t.reduce((e,t)=>{const n=Z(t,this.identifier),r=this.data.getAttributeNameForKey(n.key);return Object.assign(e,{[r]:n})},{})}}};return t.reduce((e,t)=>Object.assign(e,function(e){const t=Z(e,void 0),{key:n,name:r,reader:i,writer:o}=t;return{[r]:{get(){const e=this.data.get(n);return null!==e?i(e):t.defaultValue},set(e){void 0===e?this.data.delete(n):this.data.set(n,o(e))}},[`has${l(r)}`]:{get(){return this.data.has(n)||t.hasCustomDefaultValue}}}}(t)),n)},function(e){return x(e,"outlets").reduce((e,t)=>Object.assign(e,function(e){const t=c(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e),n=this.outlets.getSelectorForOutletName(e);if(t){const n=Y(this,t,e);if(n)return n;throw new Error(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${t}Outlets`]:{get(){const t=this.outlets.findAll(e);return t.length>0?t.map(t=>{const n=Y(this,t,e);if(n)return n;console.warn(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`,t)}).filter(e=>e):[]}},[`${t}OutletElement`]:{get(){const t=this.outlets.find(e),n=this.outlets.getSelectorForOutletName(e);if(t)return t;throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(e)}},[`has${l(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}(t)),{})}],ie.targets=[],ie.outlets=[],ie.values={}},68(e,t,n){n.d(t,{default:()=>na});var r=n(72),i=n.n(r),o=n(825),s=n.n(o),a=n(659),c=n.n(a),l=n(56),u=n.n(l),h=n(540),f=n.n(h),d=n(113),p=n.n(d),m=n(109),y={};y.styleTagTransform=p(),y.setAttributes=u(),y.insert=c().bind(null,"head"),y.domAPI=s(),y.insertStyleElement=f(),i()(m.A,y),m.A&&m.A.locals&&m.A.locals;var g=n(891);function v(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,b(r.key),r)}}function b(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var w=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"assign",value:function(e){return e&&Object.entries(e).forEach(e=>{var[t,n]=e;this[t]=n}),this}},{key:"shouldShowSuccessMessage",get:function(){return this.successMessage}}],null&&v(t.prototype,null),n&&v(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function O(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,T(r.key),r)}}function T(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function S(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}w.autoMount=!0,w.successMessage=!0;var k=0;function E(e){return"__private_"+k+++"_"+e}var P=E("fromHtmlLangProperty"),C=E("fromMetaTag"),A=E("fromBrowserLanguage"),j=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"identifier",get:function(){return this._identifier?this._identifier:S(this,P)[P]||S(this,C)[C]||S(this,A)[A]||"en"},set:function(e){this._identifier=e}},{key:"toString",value:function(){return this.identifier}}],null&&O(t.prototype,null),n&&O(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function x(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,M(r.key),r)}}function M(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Object.defineProperty(j,A,{get:function(){var e,t;return null===(e=navigator)||void 0===e||null===(t=e.language)||void 0===t?void 0:t.split("-")[0]},set:void 0}),Object.defineProperty(j,C,{get:function(){var e,t;return null===(e=document)||void 0===e||null===(t=e.querySelector('meta[name="locale"]'))||void 0===t?void 0:t.content},set:void 0}),Object.defineProperty(j,P,{get:function(){var e,t;return null===(e=document)||void 0===e||null===(t=e.documentElement)||void 0===t?void 0:t.lang},set:void 0}),j._identifier=void 0;var _={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right"},I={ABSOLUTE:"absolute",FIXED:"fixed"},L={MODAL:"modal",POPOVER:"popover"},N=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"container",get:function(){return this._container},set:function(e){this._container=e}},{key:"placement",get:function(){return this._placement},set:function(e){if(!Object.values(_).includes(e))throw new Error("Invalid placement value: ".concat(e));this._placement=e}},{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"isSet",get:function(){return!!this._id}},{key:"style",get:function(){return this._style},set:function(e){if("object"!=typeof e)throw new Error("Style must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if(!["primaryColor","secondaryColor","typography"].includes(t))throw new Error("Invalid style property: ".concat(t));if("typography"!==t&&!this.isHexOrRgba(n))throw new Error("Invalid color value: ".concat(n," for ").concat(t,". Colors must be hex or rgb/a."))}),this._style=e}},{key:"appearance",get:function(){return this._appearance},set:function(e){if(!this.isPlainObject(e))throw new Error("Appearance must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if(!["header","launcher"].includes(t))throw new Error("Invalid appearance property: ".concat(t));if(!this.isPlainObject(n))throw new Error("Appearance ".concat(t," must be an object"));Object.entries(n).forEach(e=>{var[n,r]=e;if("header"===t&&"name"!==n)throw new Error("Invalid appearance header property: ".concat(n));if("launcher"===t&&"iconUrl"!==n)throw new Error("Invalid appearance launcher property: ".concat(n));if(null!=r&&"string"!=typeof r)throw new Error("Invalid appearance ".concat(t,".").concat(n," value: ").concat(r))})}),this._appearance=e}},{key:"whatsapp",get:function(){return this._whatsapp},set:function(e){if(!this.isPlainObject(e))throw new Error("WhatsApp must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if(!["number","restrictToChannel"].includes(t))throw new Error("Invalid WhatsApp property: ".concat(t));if(null!=n){if("number"===t&&"string"!=typeof n)throw new Error("Invalid WhatsApp number value: ".concat(n));if("restrictToChannel"===t&&"boolean"!=typeof n)throw new Error("Invalid WhatsApp restrictToChannel value: ".concat(n))}}),this._whatsapp=e}},{key:"mode",get:function(){return this._mode},set:function(e){if(!Object.values(L).includes(e))throw new Error("Invalid mode value: ".concat(e));this._mode=e}},{key:"behaviour",get:function(){return this._behaviour},set:function(e){if(null!=e){if("object"!=typeof e||Array.isArray(e))throw new Error("Invalid behaviour value: ".concat(e));this._behaviour=e}else this._behaviour=e}},{key:"hasBehaviourOverride",get:function(){return this._hasBehaviourOverride}},{key:"behaviourOverride",set:function(e){this._hasBehaviourOverride=!!e}},{key:"strategy",get:function(){return this._strategy?this._strategy:"body"==this.container?I.FIXED:I.ABSOLUTE},set:function(e){if(e&&!Object.values(I).includes(e))throw new Error("Invalid strategy value: ".concat(e));this._strategy=e}},{key:"assign",value:function(e){return e&&Object.entries(e).forEach(e=>{var[t,n]=e;this[t]=n}),this}},{key:"isHexOrRgba",value:function(e){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)||/^rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3},?\s*(0|1|0?\.\d+)?\s*\)$/.test(e)}},{key:"isPlainObject",value:function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}}],null&&x(t.prototype,null),n&&x(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function R(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,D(r.key),r)}}function D(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}N._id=void 0,N._container="body",N._placement="bottom-right",N._style={},N._appearance={},N._whatsapp={},N._mode=L.POPOVER,N._behaviour=null,N._hasBehaviourOverride=!1,N._strategy=null;var F={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right"},B=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"container",get:function(){return this._container},set:function(e){this._container=e}},{key:"placement",get:function(){return this._placement},set:function(e){if(!Object.values(F).includes(e))throw new Error("Invalid placement value: ".concat(e));this._placement=e}},{key:"appearance",get:function(){return this._appearance},set:function(e){if(!this.isPlainObject(e))throw new Error("Appearance must be an object");Object.entries(e).forEach(e=>{var[t,n]=e;if("launcher"!==t)throw new Error("Invalid appearance property: ".concat(t));if(!this.isPlainObject(n))throw new Error("Appearance ".concat(t," must be an object"));Object.entries(n).forEach(e=>{var[n,r]=e;if("iconUrl"!==n)throw new Error("Invalid appearance launcher property: ".concat(n));if(null!=r&&"string"!=typeof r)throw new Error("Invalid appearance ".concat(t,".").concat(n," value: ").concat(r))})}),this._appearance=e}},{key:"number",get:function(){return this._number},set:function(e){if(null!=e&&"string"!=typeof e)throw new Error("Invalid number value: ".concat(e));this._number=e}},{key:"body",get:function(){return this._body},set:function(e){if(null!=e&&"string"!=typeof e)throw new Error("Invalid body value: ".concat(e));this._body=e}},{key:"assign",value:function(e){return e&&Object.entries(e).forEach(e=>{var[t,n]=e;this[t]=n}),this}},{key:"isPlainObject",value:function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}}],null&&R(t.prototype,null),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function V(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,q(r.key),r)}}function q(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}B._id=void 0,B._container="body",B._placement="bottom-right",B._appearance={},B._number=null,B._body=null;var U=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"assign",value:function(e){return this.serviceWorkerUrl=(null==e?void 0:e.serviceWorkerUrl)||null,this.channelId=(null==e?void 0:e.channelId)||null,this}}],null&&V(t.prototype,null),n&&V(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function z(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,W(r.key),r)}}function W(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}U.serviceWorkerUrl=null,U.channelId=null;var H=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"assign",value:function(e){if(e){var t=Object.prototype.hasOwnProperty.call(e,"apiRoot")&&!Object.prototype.hasOwnProperty.call(e,"actionCableUrl");Object.entries(e).forEach(e=>{var[t,n]=e;"forms"===t?this.forms=w.assign(n):"webchat"===t?this.webchat=N.assign(n):"whatsappWidget"===t?this.whatsapp=B.assign(n):"push"===t?this.push=U.assign(n):this[t]=n}),t&&(this.actionCableUrl=this.actionCableUrlForApiRoot(this.apiRoot))}return this}},{key:"locale",get:function(){return j.toString()},set:function(e){j.identifier=e}},{key:"endpoint",value:function(e){return"".concat(this.apiRoot,"/").concat(e)}},{key:"actionCableUrlForApiRoot",value:function(e){try{var t=new URL(e),n="https:"===t.protocol?"wss:":"ws:";return t.protocol=n,t.pathname="/cable",t.search="",t.hash="",t.toString()}catch(e){return this.actionCableUrl}}}],null&&z(t.prototype,null),n&&z(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function $(e){var t="function"==typeof Map?new Map:void 0;return $=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return K(e,arguments,Y(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),J(r,e)},$(e)}function K(e,t,n){return K=G()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&J(i,n.prototype),i},K.apply(null,arguments)}function G(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}H.apiRoot="https://api.hellotext.com/v1",H.actionCableUrl="wss://www.hellotext.com/cable",H.autoGenerateSession=!0,H.session=null,H.forms=w,H.webchat=N,H.whatsapp=B,H.push=U;var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&J(e,t)}(o,e);var t,n,r,i=(n=o,r=G(),function(){var e,t=Y(n);if(r){var i=Y(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this,"".concat(e," is not valid. Please provide a valid event name"))).name="InvalidEvent",t}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}($(Error));function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach(function(t){ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ee(e,t,n){return(t=ne(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(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,ne(r.key),r)}}function ne(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var re=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.subscribers={}}var t,n,r;return t=e,r=[{key:"valid",value:function(t){return e.exists(t)}},{key:"invalid",value:function(e){return!this.valid(e)}},{key:"exists",value:function(e){return void 0!==this.events.find(t=>t===e)}}],(n=[{key:"addSubscriber",value:function(t,n){if(e.invalid(t))throw new Z(t);this.subscribers=Q(Q({},this.subscribers),{},{[t]:this.subscribers[t]?[...this.subscribers[t],n]:[n]})}},{key:"removeSubscriber",value:function(t,n){if(e.invalid(t))throw new Z(t);this.subscribers[t]&&(this.subscribers[t]=this.subscribers[t].filter(e=>e!==n))}},{key:"dispatch",value:function(e,t){var n;null===(n=this.subscribers[e])||void 0===n||n.forEach(e=>{e(t)})}},{key:"listeners",get:function(){return 0!==Object.keys(this.subscribers).length}}])&&te(t.prototype,n),r&&te(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ie(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function oe(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,se(r.key),r)}}function se(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}re.events=["session-set","utm-set","forms:collected","form:completed","webchat:mounted","webchat:opened","webchat:closed","webchat:message:sent","webchat:message:received","cart.added"];var ae=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/businesses")}},{key:"get",value:function(){var e,t=(e=function*(e){return fetch("".concat(this.endpoint,"/").concat(e),{method:"GET",headers:{Authorization:"Bearer ".concat(e),Accept:"application/json","Content-Type":"application/json"}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ie(o,r,i,s,a,"next",e)}function a(e){ie(o,r,i,s,a,"throw",e)}s(void 0)})});return function(e){return t.apply(this,arguments)}}()}],n&&oe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ce(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,le(r.key),r)}}function le(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ue=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.urlSearchParams=new URLSearchParams(window.location.search)}var t,n,r;return t=e,r=[{key:"inPreviewMode",get:function(){return(new this).inPreviewMode}}],(n=[{key:"get",value:function(e){return this.urlSearchParams.get(this.toHellotextParam(e))}},{key:"has",value:function(e){return this.urlSearchParams.has(this.toHellotextParam(e))}},{key:"inPreviewMode",get:function(){return this.has("preview")}},{key:"session",get:function(){return this.get("session")}},{key:"toHellotextParam",value:function(e){return"hello_".concat(e)}}])&&ce(t.prototype,n),r&&ce(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function he(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function fe(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,de(r.key),r)}}function de(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function pe(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var me=0;function ye(e){return"__private_"+me+++"_"+e}var ge=ye("success"),ve=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,ge,{writable:!0,value:void 0}),this.response=n,pe(this,ge)[ge]=t}var t,n,r,i;return t=e,n=[{key:"data",get:function(){return this.response}},{key:"json",value:(r=function*(){return yield this.response.json()},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){he(o,n,i,s,a,"next",e)}function a(e){he(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})},{key:"failed",get:function(){return!1===pe(this,ge)[ge]}},{key:"succeeded",get:function(){return!0===pe(this,ge)[ge]}}],n&&fe(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function be(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function we(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,Oe(r.key),r)}}function Oe(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Te=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("track/events")}},{key:"create",value:(r=function*(e){var{headers:t,body:n,keepalive:r=!1}=e;if(ue.inPreviewMode)return new ve(!0,{received:!0});var i={method:"POST",headers:t,body:JSON.stringify(n)};r&&(i.keepalive=!0);var o=yield fetch(this.endpoint,i);return new ve(200===o.status,yield o.json())},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){be(o,n,i,s,a,"next",e)}function a(e){be(o,n,i,s,a,"throw",e)}s(void 0)})},function(e){return i.apply(this,arguments)})}],null&&we(t.prototype,null),n&&we(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Se(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 ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach(function(t){Ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ee(e,t,n){return(t=je(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ce(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Pe(o,r,i,s,a,"next",e)}function a(e){Pe(o,r,i,s,a,"throw",e)}s(void 0)})}}function Ae(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,je(r.key),r)}}function je(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var xe=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/forms")}},{key:"get",value:function(){var e=Ce(function*(e){var t=new URL("".concat(this.endpoint,"/").concat(e));return t.searchParams.append("session",Ci.session),t.searchParams.append("locale",j.toString()),fetch(t,{method:"GET",headers:Ci.headers})});return function(t){return e.apply(this,arguments)}}()},{key:"submit",value:(r=Ce(function*(e,t){var n=yield fetch("".concat(this.endpoint,"/").concat(e,"/submissions"),{method:"POST",headers:Ci.headers,body:JSON.stringify(ke({session:Ci.session},t))});return new ve(n.ok,n)}),function(e,t){return r.apply(this,arguments)})}],n&&Ae(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Me(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(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach(function(t){Ie(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ie(e,t,n){return(t=Re(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ne(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,Re(r.key),r)}}function Re(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var De=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/identifications")}},{key:"create",value:(r=function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=yield fetch(this.endpoint,{method:"POST",headers:Ci.headers,body:JSON.stringify(_e({session:Ci.session},e))});return new ve(t.ok,t)},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){Le(o,n,i,s,a,"next",e)}function a(e){Le(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})}],null&&Ne(t.prototype,null),n&&Ne(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Fe=De;function Be(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ve(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,qe(r.key),r)}}function qe(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Ue=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/webchats")}},{key:"get",value:function(){var e,t=(e=function*(e){var t=new URL("".concat(this.endpoint,"/").concat(e));t.searchParams.append("session",Ci.session),t.searchParams.append("locale",j.toString()),Object.entries(H.webchat.style).forEach(e=>{var[n,r]=e;t.searchParams.append("style[".concat(n,"]"),r)}),this.appendWebchatOverrides(t),t.searchParams.append("placement",H.webchat.placement);var n=yield fetch(t,{method:"GET",headers:Ci.headers}),r=yield n.json();return Ci.business.data||(Ci.business.setData(r.business),Ci.business.setLocale(r.locale)),(new DOMParser).parseFromString(r.html,"text/html").querySelector("article")},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Be(o,r,i,s,a,"next",e)}function a(e){Be(o,r,i,s,a,"throw",e)}s(void 0)})});return function(e){return t.apply(this,arguments)}}()},{key:"appendWebchatOverrides",value:function(e){var t,n,{appearance:r,whatsapp:i}=H.webchat;this.appendIfSupplied(e,"webchat[appearance][header][name]",null===(t=r.header)||void 0===t?void 0:t.name),this.appendIfSupplied(e,"webchat[appearance][launcher][icon_url]",null===(n=r.launcher)||void 0===n?void 0:n.iconUrl),this.appendIfSupplied(e,"webchat[handoff][identifier]",i.number),this.appendIfSupplied(e,"webchat[handoff][restrict_to_channel]",i.restrictToChannel)}},{key:"appendIfSupplied",value:function(e,t,n){null!=n&&e.searchParams.append(t,String(n))}}],n&&Ve(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const ze=Ue;function We(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function He(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){We(o,r,i,s,a,"next",e)}function a(e){We(o,r,i,s,a,"throw",e)}s(void 0)})}}function $e(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,Ke(r.key),r)}}function Ke(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Ge=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/widgets/whatsapp")}},{key:"get",value:function(){var e=He(function*(e){var t=new URL("".concat(this.endpoint,"/").concat(e));t.searchParams.append("locale",j.toString()),t.searchParams.append("placement",H.whatsapp.placement),this.appendWhatsAppOverrides(t);var n=yield this.fetchWidget(t);if(!n.ok)return null;var r=yield this.parseWidgetResponse(n);return r?(Ci.business.data||(Ci.business.setData(r.business),Ci.business.setLocale(r.locale)),(new DOMParser).parseFromString(r.html,"text/html").querySelector("article")):null});return function(t){return e.apply(this,arguments)}}()},{key:"appendWhatsAppOverrides",value:function(e){var t,{appearance:n,body:r,number:i}=H.whatsapp;this.appendIfSupplied(e,"whatsapp[appearance][launcher][icon_url]",null===(t=n.launcher)||void 0===t?void 0:t.iconUrl),this.appendIfSupplied(e,"whatsapp[number]",i),this.appendIfSupplied(e,"whatsapp[body]",r)}},{key:"appendIfSupplied",value:function(e,t,n){null!=n&&e.searchParams.append(t,String(n))}},{key:"fetchWidget",value:(i=He(function*(e){try{return yield fetch(e,{method:"GET",headers:Ci.headers})}catch(e){return{ok:!1}}}),function(e){return i.apply(this,arguments)})},{key:"parseWidgetResponse",value:(r=He(function*(e){try{return yield e.json()}catch(e){return null}}),function(e){return r.apply(this,arguments)})}],n&&$e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Je=Ge;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 Ze(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){Xe(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 Xe(e,t,n){return(t=tt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qe(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function et(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,tt(r.key),r)}}function tt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var nt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/acks")}},{key:"send",value:(r=function*(){var e=Ze(Ze({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{session:Ci.session,at:(new Date).toISOString()});fetch(this.endpoint,{method:"POST",headers:Ci.headers,body:JSON.stringify(e),keepalive:!0})},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){Qe(o,n,i,s,a,"next",e)}function a(e){Qe(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})}],null&&et(t.prototype,null),n&&et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const rt=nt;function it(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 ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?it(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function st(e,t,n){return(t=ut(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function at(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ct(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){at(o,r,i,s,a,"next",e)}function a(e){at(o,r,i,s,a,"throw",e)}s(void 0)})}}function lt(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,ut(r.key),r)}}function ut(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ht=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,n=[{key:"endpoint",get:function(){return H.endpoint("public/push/identities")}},{key:"create",value:(i=ct(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=yield fetch(this.endpoint,{method:"POST",keepalive:!0,headers:Ci.headers,body:JSON.stringify(ot(ot({},e),{},{session:Ci.session,origin:window.location.origin}))});return new ve(t.ok,t)}),function(){return i.apply(this,arguments)})},{key:"destroy",value:(r=ct(function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=yield fetch(this.endpoint,{method:"DELETE",keepalive:!0,headers:Ci.headers,body:JSON.stringify(ot(ot({},e),{},{session:Ci.session,origin:window.location.origin}))});return new ve(t.ok,t)}),function(){return r.apply(this,arguments)})}],n&<(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const ft=ht;function dt(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,pt(r.key),r)}}function pt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function mt(e){var t=JSON.stringify(e);return"undefined"==typeof Blob?t.length<6e4:new Blob([t]).size<6e4}var yt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"businesses",get:function(){return ae}},{key:"events",get:function(){return Te}},{key:"forms",get:function(){return xe}},{key:"webchats",get:function(){return ze}},{key:"whatsappWidgets",get:function(){return Je}},{key:"identifications",get:function(){return Fe}},{key:"acks",get:function(){return rt}},{key:"pushIdentities",get:function(){return ft}}],null&&dt(t.prototype,null),n&&dt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();const gt={en:{white_label:{powered_by:"By"},errors:{parameter_not_unique:"This value is taken.",blank:"This field is required."},forms:{phone:"Click the link sent via SMS to verify your submission.",email:"Click the link sent via email to verify your submission.",phone_and_email:"Click the links sent via SMS and email to verify your submission.",none:"Your submission has been received."}},es:{white_label:{powered_by:"Por"},errors:{parameter_not_unique:"Este valor ya está en uso.",blank:"Este campo es obligatorio."},forms:{phone:"Haga clic en el enlace enviado por SMS para verificar su envío.",email:"Haga clic en el enlace enviado por e-mail para verificar su envío.",phone_and_email:"Haga clic en los enlaces enviados por SMS y e-mail para verificar su envío.",none:"Su envío ha sido recibido."}}};function vt(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function bt(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,wt(r.key),r)}}function wt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Ot="data-hellotext-stylesheet",Tt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=t,this.data=null,this.stylesheet=null,this.stylesheetLoaded=Promise.resolve(!1)}var t,n,r,i,o;return t=e,n=[{key:"hydrate",value:(i=function*(){try{var e=yield ae.get(this.id);if(!1===e.ok)return null;var t=yield e.json();return t?(this.setData(t),t.locale&&this.setLocale(t.locale),t):null}catch(e){return null}},o=function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(e){vt(o,n,r,s,a,"next",e)}function a(e){vt(o,n,r,s,a,"throw",e)}s(void 0)})},function(){return o.apply(this,arguments)})},{key:"setData",value:function(e){this.data=e,"undefined"!=typeof document&&e.style_url?(this.stylesheet=this.constructor.ensureStylesheet(e.style_url),this.stylesheetLoaded=this.constructor.waitForStylesheet(this.stylesheet)):(this.stylesheet=null,this.stylesheetLoaded=Promise.resolve(!1))}},{key:"subscription",get:function(){return this.data.subscription}},{key:"country",get:function(){return this.data.country}},{key:"enabledWhitelist",get:function(){return"disabled"!==this.data.whitelist}},{key:"setLocale",value:function(e){if(!gt[e])return console.warn("Locale ".concat(e," not found"));this.data||(this.data={}),this.data.locale=e}},{key:"locale",get:function(){return gt[this.data.locale]}},{key:"features",get:function(){return this.data.features}}],r=[{key:"stylesheetSelector",get:function(){return'link[rel="stylesheet"]['.concat(Ot,"]")}},{key:"ensureStylesheet",value:function(e){var t=this.normalizedStylesheetUrl(e),n=this.stylesheetLinks.find(e=>e.href===t);if(n)return n.setAttribute(Ot,"true"),n;var r=document.createElement("link");return r.rel="stylesheet",r.href=e,r.setAttribute(Ot,"true"),this.waitForStylesheet(r),document.head.append(r),r}},{key:"stylesheetLinks",get:function(){return"undefined"==typeof document?[]:Array.from(document.querySelectorAll(this.stylesheetSelector))}},{key:"latestStylesheet",get:function(){return this.stylesheetLinks[this.stylesheetLinks.length-1]}},{key:"normalizedStylesheetUrl",value:function(e){try{return new URL(e,document.baseURI).href}catch(t){return e}}},{key:"waitForStylesheet",value:function(e){return e?this.stylesheetIsLoaded(e)?Promise.resolve(!0):"false"===e.dataset.hellotextStylesheetLoaded?Promise.resolve(!1):(e._hellotextStylesheetLoaded||(e._hellotextStylesheetLoaded=new Promise(t=>{var n,r=r=>{clearTimeout(n),e.removeEventListener("load",i),e.removeEventListener("error",o),e.dataset.hellotextStylesheetLoaded=r?"true":"false",t(r)},i=()=>r(this.stylesheetIsLoaded(e)),o=()=>r(!1);e.addEventListener("load",i),e.addEventListener("error",o),(n=setTimeout(()=>r(this.stylesheetIsLoaded(e)),1e4)).unref&&n.unref()})),e._hellotextStylesheetLoaded):Promise.resolve(!1)}},{key:"stylesheetIsLoaded",value:function(e){return"true"===e.dataset.hellotextStylesheetLoaded||!!e.sheet}}],n&&bt(t.prototype,n),r&&bt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function St(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,kt(r.key),r)}}function kt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Et=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"set",value:function(e,t){if("undefined"!=typeof document){var n="https:"===window.location.protocol?"; Secure":"",r=Mt.getRootDomain(),i=31536e4;document.cookie=r?"".concat(e,"=").concat(t,"; path=/").concat(n,"; domain=").concat(r,"; max-age=").concat(i,"; SameSite=Lax"):"".concat(e,"=").concat(t,"; path=/").concat(n,"; max-age=").concat(i,"; SameSite=Lax")}return"hello_session"===e&&Ci.eventEmitter.dispatch("session-set",t),"hello_utm"===e&&Ci.eventEmitter.dispatch("utm-set",t),t}},{key:"get",value:function(e){var t;return"undefined"!=typeof document?null===(t=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)"))||void 0===t?void 0:t.pop():void 0}},{key:"delete",value:function(e){if("undefined"!=typeof document){var t=Mt.getRootDomain(),n="https:"===window.location.protocol?"; Secure":"";document.cookie=t?"".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT").concat(n,"; domain=").concat(t,"; SameSite=Lax"):"".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT").concat(n,"; SameSite=Lax")}}}],null&&St(t.prototype,null),n&&St(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Pt(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,Ct(r.key),r)}}function Ct(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var At=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var t=new URLSearchParams(window.location.search),n={source:t.get("utm_source"),medium:t.get("utm_medium"),campaign:t.get("utm_campaign"),term:t.get("utm_term"),content:t.get("utm_content")};this.save(n)}var t,n;return t=e,n=[{key:"save",value:function(e){if(e.source&&e.medium){var t=Object.fromEntries(Object.entries(e).filter(e=>{var[t,n]=e;return n}));t.observed_at=(new Date).toISOString(),Et.set("hello_utm",JSON.stringify(t))}}},{key:"current",get:function(){try{return JSON.parse(Et.get("hello_utm"))||{}}catch(e){return{}}}}],n&&Pt(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function jt(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,xt(r.key),r)}}function xt(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Mt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.utm=new At,this._url=t}var t,n,r;return t=e,r=[{key:"getRootDomain",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{if(!e){var t;if("undefined"==typeof window||null===(t=window.location)||void 0===t||!t.hostname)return null;e=window.location.hostname}var n=e.split(".");if(n.length<=1)return e;for(var r of["myshopify.com","vtexcommercestable.com.br","myvtex.com","wixsite.com"]){var i=r.split(".");if(n.slice(-i.length).join(".")===r&&n.length>i.length)return".".concat(n.slice(-(i.length+1)).join("."))}var o=n[n.length-1],s=n[n.length-2];return n.length>2&&2===o.length&&s.length<=3?".".concat(n.slice(-3).join(".")):".".concat(n.slice(-2).join("."))}catch(e){return null}}}],(n=[{key:"url",get:function(){return null!==this._url&&void 0!==this._url?this._url:window.location.href}},{key:"title",get:function(){return document.title}},{key:"path",get:function(){if(this._url)try{return new URL(this._url).pathname}catch(e){return"/"}return window.location.pathname}},{key:"utmParams",get:function(){return this.utm.current}},{key:"trackingData",get:function(){return{page:{url:this.url,title:this.title,path:this.path},utm_params:this.utmParams}}},{key:"domain",get:function(){try{var t=this.url;if(!t)return null;var n=new URL(t).hostname;return e.getRootDomain(n)}catch(e){return null}}}])&&jt(t.prototype,n),r&&jt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function _t(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,It(r.key),r)}}function It(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Lt(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Nt=0;function Rt(e){return"__private_"+Nt+++"_"+e}var Dt=Rt("session"),Ft=Rt("query"),Bt=Rt("page"),Vt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"session",get:function(){return Lt(this,Dt)[Dt]},set:function(e){var t=Et.get("hello_session");return Lt(this,Dt)[Dt]=e,Et.set("hello_session",e),t!==e&&Et.delete("hello_session_ack_at"),Et.get("hello_session_ack_at")||(yt.acks.send(this.ackPayload),Et.set("hello_session_ack_at",(new Date).toISOString())),Lt(this,Dt)[Dt]}},{key:"ackPayload",get:function(){var e;return{utm_params:(null===(e=Lt(this,Bt)[Bt])||void 0===e?void 0:e.utmParams)||{}}}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Mt;Lt(this,Bt)[Bt]=e,Lt(this,Ft)[Ft]=new ue,this.session=Lt(this,Ft)[Ft].session||H.session||Et.get("hello_session"),!this.session&&H.autoGenerateSession&&(this.session=crypto.randomUUID())}}],null&&_t(t.prototype,null),n&&_t(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function qt(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,Ut(r.key),r)}}function Ut(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Object.defineProperty(Vt,Dt,{writable:!0,value:void 0}),Object.defineProperty(Vt,Ft,{writable:!0,value:void 0}),Object.defineProperty(Vt,Bt,{writable:!0,value:void 0});var zt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"build",value:function(e){var t=document.createElement("article"),n=document.createElement("label"),r=document.createElement("input");n.innerText=e.label,r.type=e.type,r.required=e.required,r.placeholder=e.placeholder,["first_name","last_name"].includes(e.kind)?(r.type="text",r.id=r.name=e.kind,n.setAttribute("for",e.kind)):(r.type=e.type,"email"===e.type?(r.id=r.name="email",n.setAttribute("for","email")):"tel"===r.type?(r.id=r.name="phone",n.setAttribute("for","phone"),r.value="+".concat(Ci.business.country.prefix),r.setAttribute("data-default-value","+".concat(Ci.business.country.prefix))):(r.name=r.id="property_by_id[".concat(e.property,"]"),n.setAttribute("for","property_by_id[".concat(e.property,"]"))));var i=document.createElement("main");i.appendChild(n),i.appendChild(r),t.appendChild(i),t.setAttribute("data-hellotext--form-target","inputContainer"),r.setAttribute("data-hellotext--form-target","input");var o=document.createElement("div");return o.setAttribute("data-error-container",""),t.appendChild(o),t}}],null&&qt(t.prototype,null),n&&qt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Wt(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,Ht(r.key),r)}}function Ht(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var $t=0;function Kt(e){return"__private_"+$t+++"_"+e}var Gt=Kt("template"),Jt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"build",value:function(){var e=document.createElement("div");return e.innerHTML=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,Gt)[Gt](),e.firstElementChild}}],null&&Wt(t.prototype,null),n&&Wt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Zt(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,i,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yt(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.")}()}Object.defineProperty(Jt,Gt,{value:function(){var e="https://www.hellotext.com?hello_session=".concat(Ci.session);return"\n <div data-logo-container>\n <small>".concat(Ci.business.locale.white_label.powered_by,'</small>\n\n <a href="').concat(e,'" rel="noreferrer" target="_blank">\n <svg data-hello-brand viewBox="0 0 224 43" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Hellotext</title>\n <path d="M28.2760919,19.3224299 L28.2760919,31.1946615 C28.2760919,32.2088722 27.5005873,32.9844452 26.4864658,32.9844452 L21.0579334,32.9844452 C20.043812,32.9844452 19.2683073,32.2088722 19.2683073,31.1946615 L19.2683073,19.9786839 C19.2683073,16.7570733 17.4190271,14.7883113 14.4959712,14.7883113 C11.0360274,14.7883113 8.76916774,17.11503 8.76916774,21.1122135 L8.76916774,31.3139804 C8.76916774,32.3281911 7.99366311,33.1037641 6.97954167,33.1037641 L1.78962607,33.1037641 C0.77550463,33.1037641 0,32.3281911 0,31.3139804 L0,3.45301476 C0,2.43880402 0.77550463,1.6632311 1.78962607,1.6632311 L6.97954167,1.6632311 C7.99366311,1.6632311 8.76916774,2.43880402 8.76916774,3.45301476 L8.76916774,9.06100356 L8.11297151,16.3991166 L8.70951354,16.458776 C9.78328918,11.6860196 13.5415039,8.52406846 18.4331485,8.52406846 C24.3389145,8.52406846 28.2760919,12.8195492 28.2760919,19.3224299 Z M61.1455574,26.3622456 C58.9980061,30.7173858 53.6291279,33.5213803 47.0671656,33.5213803 C37.9997269,33.5213803 31.4377646,28.2116887 31.4377646,20.7542568 C31.4377646,13.6547816 37.2838764,8.52406846 46.0530442,8.52406846 C53.7484363,8.52406846 59.1769687,12.4615925 59.8928191,18.8451542 C60.0121275,19.9190244 59.1769687,20.8735757 58.103193,20.8735757 L40.1472781,20.8735757 C40.4455492,24.8110998 43.1299883,27.2571374 47.186474,27.2571374 C50.2288383,27.2571374 52.8536232,25.7656511 54.1660157,23.4389323 C54.5835951,22.6633594 55.5380623,22.3054026 56.3732212,22.6036999 L60.1314359,23.9758674 C61.0859032,24.2741647 61.622791,25.4076943 61.1455574,26.3622456 Z M40.5648576,17.3536679 L50.706072,17.2343489 C50.0498757,14.7286518 48.3795581,13.5354627 45.8740816,13.5354627 C43.3089509,13.5354627 41.4000164,14.9672896 40.5648576,17.3536679 Z M120.143563,20.9928946 C120.143563,28.2116887 113.641255,33.4617208 104.693125,33.4617208 C95.8046489,33.4617208 89.361995,28.2116887 89.361995,20.9928946 C89.361995,13.7741005 95.8046489,8.52406846 104.693125,8.52406846 C113.641255,8.52406846 120.143563,13.7741005 120.143563,20.9928946 Z M111.076125,21.1122135 C111.076125,17.2940084 108.45134,14.7883113 104.633471,14.7883113 C100.93491,14.7883113 98.3697796,17.2940084 98.3697796,20.9332352 C98.3697796,24.7514403 100.994564,27.2571374 104.812433,27.2571374 C108.570648,27.2571374 111.076125,24.7514403 111.076125,21.1122135 Z M141.559422,26.8395213 C141.261151,25.5866727 139.82945,25.0497376 138.815329,25.8253105 C137.443282,26.8395213 136.190544,27.2571374 134.99746,27.2571374 C132.909563,27.2571374 131.835787,26.0042889 131.835787,23.796889 L131.835787,13.9530789 L139.471525,13.9530789 C140.24703,13.9530789 140.903226,13.2968249 140.903226,12.521252 L140.903226,10.4928305 C140.903226,9.71725757 140.24703,9.06100356 139.471525,9.06100356 L131.835787,9.06100356 L131.835787,3.45301476 C131.835787,2.43880402 131.060282,1.6632311 130.046161,1.6632311 L125.214171,1.6632311 C124.200049,1.6632311 123.424545,2.43880402 123.424545,3.45301476 L123.424545,9.06100356 L123.424545,13.9530789 L123.424545,24.7514403 C123.424545,30.2401102 127.182759,33.5213803 133.565759,33.5213803 C136.727432,33.5213803 139.471525,32.6861479 141.499768,31.0753426 C142.036656,30.6577264 142.275272,29.9418129 142.09631,29.2855589 L141.559422,26.8395213 Z M173.414766,26.3622456 C171.267215,30.7173858 165.898337,33.5213803 159.336374,33.5213803 C150.268936,33.5213803 143.706973,28.2116887 143.706973,20.7542568 C143.706973,13.6547816 149.553085,8.52406846 158.322253,8.52406846 C166.017645,8.52406846 171.446177,12.4615925 172.162028,18.8451542 C172.281336,19.9190244 171.446177,20.8735757 170.372402,20.8735757 L152.416487,20.8735757 C152.714758,24.8110998 155.399197,27.2571374 159.455683,27.2571374 C162.498047,27.2571374 165.122832,25.7656511 166.435224,23.4389323 C166.852804,22.6633594 167.807271,22.3054026 168.64243,22.6036999 L172.400645,23.9758674 C173.414766,24.2741647 173.892,25.4076943 173.414766,26.3622456 Z M152.834066,17.3536679 L162.975281,17.2343489 C162.319084,14.7286518 160.648767,13.5354627 158.14329,13.5354627 C155.637814,13.5354627 153.669225,14.9672896 152.834066,17.3536679 Z M192.862036,20.8139163 L201.094316,12.0439763 C202.168092,10.9104467 201.332933,9.00134411 199.781923,9.00134411 L194.711316,9.00134411 C194.174428,9.00134411 193.637541,9.23998193 193.279615,9.71725757 L188.507279,15.8621815 L183.734943,9.71725757 C183.377018,9.29964138 182.899784,9.00134411 182.303242,9.00134411 L177.113327,9.00134411 C175.562317,9.00134411 174.727159,10.8507872 175.800934,12.0439763 L184.092868,20.8735757 L175.502663,30.0014724 C174.428888,31.135002 175.204392,33.0441046 176.815056,33.0441046 L181.945317,33.0441046 C182.482205,33.0441046 183.019093,32.8054668 183.377018,32.3878506 L188.447625,25.9446294 L193.577886,32.3878506 C193.935812,32.8054668 194.413045,33.0441046 194.949933,33.0441046 L200.139849,33.0441046 C201.690858,33.0441046 202.526017,31.1946615 201.452241,30.0611318 L192.862036,20.8139163 Z M223.941875,29.2258995 L223.345333,26.8395213 C223.047062,25.5866727 221.615362,25.0497376 220.60124,25.8253105 C219.229193,26.8395213 217.976455,27.2571374 216.783371,27.2571374 C214.695474,27.2571374 213.621698,26.0042889 213.621698,23.796889 L213.621698,13.9530789 L221.257436,13.9530789 C222.032941,13.9530789 222.689137,13.2968249 222.689137,12.521252 L222.689137,10.4928305 C222.689137,9.71725757 222.032941,9.06100356 221.257436,9.06100356 L213.621698,9.06100356 L213.621698,3.45301476 C213.621698,2.43880402 212.846194,1.6632311 211.832072,1.6632311 L207.000082,1.6632311 C205.985961,1.6632311 205.210456,2.43880402 205.210456,3.45301476 L205.210456,9.06100356 L205.210456,13.9530789 L205.210456,24.7514403 C205.210456,30.2401102 208.968671,33.5213803 215.35167,33.5213803 C218.513343,33.5213803 221.257436,32.6861479 223.285679,31.0753426 C223.882221,30.5980669 224.120838,29.8821535 223.941875,29.2258995 Z M77.6697714,6.01837134 C78.2663134,5.30245788 78.2663134,4.22858768 77.6101172,3.57233367 L74.5677529,0.529701449 C73.8519024,-0.186212015 72.6588184,-0.186212015 71.942968,0.589360904 C61.3841742,12.4615925 61.3841742,30.5384075 71.942968,42.4106391 C72.5991642,43.186212 73.8519024,43.186212 74.5677529,42.4702986 L77.6101172,39.4276663 C78.2663134,38.7714123 78.3259676,37.6975421 77.6697714,36.9816287 C69.9147251,28.1520293 69.9147251,14.8479707 77.6697714,6.01837134 Z M87.1547896,10.6718089 L84.1124252,7.62917663 C83.3965748,6.91326317 82.1438366,6.91326317 81.4876403,7.74849554 C78.2663134,11.6263601 76.4766873,16.458776 76.4766873,21.5298297 C76.4766873,26.6008834 78.2663134,31.4332993 81.4876403,35.3111639 C82.1438366,36.0867368 83.3965748,36.1463963 84.1124252,35.4304828 L87.1547896,32.3878506 C87.8109858,31.7315966 87.87064,30.7173858 87.3337522,30.0611318 C85.4248177,27.6747536 84.351042,24.6917809 84.351042,21.5894892 C84.351042,18.4871975 85.3651635,15.5042247 87.3337522,13.1178465 C87.87064,12.3422736 87.8109858,11.3280629 87.1547896,10.6718089 Z" id="hellotext" fill="currentColor"></path>\n </svg>\n </a>\n </div>\n ')}});const Xt=Object.entries,Qt=Object.setPrototypeOf,en=Object.isFrozen,tn=Object.getPrototypeOf,nn=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,sn=Object.create,an="undefined"!=typeof Reflect&&Reflect,cn=an.apply,ln=an.construct;rn||(rn=function(e){return e}),on||(on=function(e){return e}),cn||(cn=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),ln||(ln=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 new e(...n)});const un=Mn(Array.prototype.forEach),hn=Mn(Array.prototype.lastIndexOf),fn=Mn(Array.prototype.pop),dn=Mn(Array.prototype.push),pn=Mn(Array.prototype.splice),mn=Array.isArray,yn=Mn(String.prototype.toLowerCase),gn=Mn(String.prototype.toString),vn=Mn(String.prototype.match),bn=Mn(String.prototype.replace),wn=Mn(String.prototype.indexOf),On=Mn(String.prototype.trim),Tn=Mn(Number.prototype.toString),Sn=Mn(Boolean.prototype.toString),kn="undefined"==typeof BigInt?null:Mn(BigInt.prototype.toString),En="undefined"==typeof Symbol?null:Mn(Symbol.prototype.toString),Pn=Mn(Object.prototype.hasOwnProperty),Cn=Mn(Object.prototype.toString),An=Mn(RegExp.prototype.test),jn=(xn=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ln(xn,t)});var xn;function Mn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return cn(e,t,r)}}function _n(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yn;if(Qt&&Qt(e,null),!mn(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(en(t)||(t[r]=e),i=e)}e[i]=!0}return e}function In(e){for(let t=0;t<e.length;t++)Pn(e,t)||(e[t]=null);return e}function Ln(e){const t=sn(null);for(const r of Xt(e)){var n=Zt(r,2);const i=n[0],o=n[1];Pn(e,i)&&(mn(o)?t[i]=In(o):o&&"object"==typeof o&&o.constructor===Object?t[i]=Ln(o):t[i]=o)}return t}function Nn(e,t){for(;null!==e;){const n=nn(e,t);if(n){if(n.get)return Mn(n.get);if("function"==typeof n.value)return Mn(n.value)}e=tn(e)}return function(){return null}}const Rn=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Dn=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Fn=rn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Bn=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Vn=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),qn=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Un=rn(["#text"]),zn=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Wn=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Hn=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),$n=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Kn=on(/{{[\w\W]*|^[\w\W]*}}/g),Gn=on(/<%[\w\W]*|^[\w\W]*%>/g),Jn=on(/\${[\w\W]*/g),Yn=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),Zn=on(/^aria-[\-\w]+$/),Xn=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qn=on(/^(?:\w+script|data):/i),er=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tr=on(/^html$/i),nr=on(/^[a-z][.\w]*(-[.\w]+)+$/i),rr=on(/<[/\w!]/g),ir=on(/<[/\w]/g),or=on(/<\/no(script|embed|frames)/i),sr=on(/\/>/i),ar=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],cr=rn(_n({},ar)),lr=function(){const e={};return un(ar,t=>{e[t]=on(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),rn(e)}(),ur=function(){return"undefined"==typeof window?null:window},hr=function(e,t,n,r){return Pn(e,t)&&mn(e[t])?_n(r.base?Ln(r.base):{},e[t],r.transform):n},fr=function(e,t,n){const r=Pn(e,t)?e[t]:void 0;return r&&"object"==typeof r?Ln(r):n()};var dr=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ur();const n=t=>e(t);if(n.version="3.4.14",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let r=t.document;const i=r,o=i.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,a=t.Node,c=t.Element,l=t.NodeFilter;void 0===t.NamedNodeMap&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,h=t.trustedTypes,f=c.prototype,d=Nn(f,"cloneNode"),p=Nn(f,"remove"),m=Nn(f,"nextSibling"),y=Nn(f,"childNodes"),g=Nn(f,"parentNode"),v=Nn(f,"shadowRoot"),b=Nn(f,"attributes"),w=a&&a.prototype?Nn(a.prototype,"nodeType"):null,O=a&&a.prototype?Nn(a.prototype,"nodeName"):null,T=a&&a.prototype?Nn(a.prototype,"ownerDocument"):null,S=function(e){return w?w(e):e.nodeType},k=function(e){return O?O(e):e.nodeName};if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let E,P,C="",A=!1,j=0;const x=function(){if(j>0)throw jn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},M=function(e){x(),j++;try{return E.createHTML(e)}finally{j--}},_=r,I=_.implementation,L=_.createNodeIterator,N=_.createDocumentFragment,R=_.getElementsByTagName,D=i.importNode;let F={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Xt&&"function"==typeof g&&I&&void 0!==I.createHTMLDocument;const B=Kn,V=Gn,q=Jn,U=Yn,z=Zn,W=Qn,H=er,$=nr;let K=Xn,G=null;const J=_n({},[...Rn,...Dn,...Fn,...Vn,...Un]);let Y=null;const Z=_n({},[...zn,...Wn,...Hn,...$n]);let X=Object.seal(sn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Q=null,ee=null;const te=Object.seal(sn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ne=!0,re=!0,ie=!1,oe=!0,se=!1,ae=!0,ce=!1,le=!1,ue=null,he=null,fe=!1,de=!1,pe=!1,me=!1,ye=!0,ge=!1;const ve="user-content-";let be=!0,we=!1,Oe={},Te=null;const Se=_n({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ke=null;const Ee=_n({},["audio","video","img","source","image","track"]);let Pe=null;const Ce=_n({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ae="http://www.w3.org/1998/Math/MathML",je="http://www.w3.org/2000/svg",xe="http://www.w3.org/1999/xhtml";let Me=xe,_e=!1,Ie=null;const Le=_n({},[Ae,je,xe],gn),Ne=rn(["mi","mo","mn","ms","mtext"]);let Re=_n({},Ne);const De=rn(["annotation-xml"]);let Fe=_n({},De);const Be=_n({},["title","style","font","a","script"]);let Ve=null;const qe=["application/xhtml+xml","text/html"];let Ue=null,ze=null;const We=r.createElement("form"),He=function(e){return e instanceof RegExp||e instanceof Function},$e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(ze&&ze===e)return;e&&"object"==typeof e||(e={}),e=Ln(e),Ve=-1===qe.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ue="application/xhtml+xml"===Ve?gn:yn,G=hr(e,"ALLOWED_TAGS",J,{transform:Ue}),Y=hr(e,"ALLOWED_ATTR",Z,{transform:Ue}),Ie=hr(e,"ALLOWED_NAMESPACES",Le,{transform:gn}),Pe=hr(e,"ADD_URI_SAFE_ATTR",Ce,{transform:Ue,base:Ce}),ke=hr(e,"ADD_DATA_URI_TAGS",Ee,{transform:Ue,base:Ee}),Te=hr(e,"FORBID_CONTENTS",Se,{transform:Ue}),Q=hr(e,"FORBID_TAGS",Ln({}),{transform:Ue}),ee=hr(e,"FORBID_ATTR",Ln({}),{transform:Ue}),Oe=!!Pn(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Ln(e.USE_PROFILES):e.USE_PROFILES),ne=!1!==e.ALLOW_ARIA_ATTR,re=!1!==e.ALLOW_DATA_ATTR,ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,se=e.SAFE_FOR_TEMPLATES||!1,ae=!1!==e.SAFE_FOR_XML,ce=e.WHOLE_DOCUMENT||!1,de=e.RETURN_DOM||!1,pe=e.RETURN_DOM_FRAGMENT||!1,me=e.RETURN_TRUSTED_TYPE||!1,fe=e.FORCE_BODY||!1,ye=!1!==e.SANITIZE_DOM,ge=e.SANITIZE_NAMED_PROPS||!1,be=!1!==e.KEEP_CONTENT,we=e.IN_PLACE||!1,K=function(e){try{return An(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Xn,Me="string"==typeof e.NAMESPACE?e.NAMESPACE:xe,Re=fr(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>_n({},Ne)),Fe=fr(e,"HTML_INTEGRATION_POINTS",()=>_n({},De));const t=fr(e,"CUSTOM_ELEMENT_HANDLING",()=>sn(null));if(X=sn(null),Pn(t,"tagNameCheck")&&He(t.tagNameCheck)&&(X.tagNameCheck=t.tagNameCheck),Pn(t,"attributeNameCheck")&&He(t.attributeNameCheck)&&(X.attributeNameCheck=t.attributeNameCheck),Pn(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(X.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),on(X),se&&(re=!1),pe&&(de=!0),Oe&&(G=_n({},Un),Y=sn(null),!0===Oe.html&&(_n(G,Rn),_n(Y,zn)),!0===Oe.svg&&(_n(G,Dn),_n(Y,Wn),_n(Y,$n)),!0===Oe.svgFilters&&(_n(G,Fn),_n(Y,Wn),_n(Y,$n)),!0===Oe.mathMl&&(_n(G,Vn),_n(Y,Hn),_n(Y,$n))),te.tagCheck=null,te.attributeCheck=null,Pn(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?te.tagCheck=e.ADD_TAGS:mn(e.ADD_TAGS)&&(G===J&&(G=Ln(G)),_n(G,e.ADD_TAGS,Ue))),Pn(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?te.attributeCheck=e.ADD_ATTR:mn(e.ADD_ATTR)&&(Y===Z&&(Y=Ln(Y)),_n(Y,e.ADD_ATTR,Ue))),Pn(e,"ADD_FORBID_CONTENTS")&&mn(e.ADD_FORBID_CONTENTS)&&(Te===Se&&(Te=Ln(Te)),_n(Te,e.ADD_FORBID_CONTENTS,Ue)),be&&(G["#text"]=!0),ce&&_n(G,["html","head","body"]),G.table&&(_n(G,["tbody"]),delete Q.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw jn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw jn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=E;E=e.TRUSTED_TYPES_POLICY;try{C=M("")}catch(e){throw E=t,e}}else null===e.TRUSTED_TYPES_POLICY?(E=void 0,C=""):(void 0===E&&(A||(P=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o),A=!0),E=P),E&&"string"==typeof C&&(C=M("")));rn&&rn(e),ze=e},Ke=_n({},[...Dn,...Fn,...Bn]),Ge=_n({},[...Vn,...qn]),Je=function(e){dn(n.removed,{element:e});try{g(e).removeChild(e)}catch(t){if(p(e),!g(e))throw jn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ye=function(e,t,n){try{e.removeAttributeNode(t)}catch(t){try{e.removeAttribute(n)}catch(e){}}},Ze=function(e){et(e);const t=y(e);if(t){const e=[];un(t,t=>{dn(e,t)}),un(e,e=>{try{p(e)}catch(e){}})}const n=b(e);if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],i=r&&r.name;"string"==typeof i&&Ye(e,r,i)}},Xe=function(e,t,r){if(!r)try{r=t.getAttributeNode(e)}catch(e){r=null}dn(n.removed,{attribute:r||null,from:t});try{r?t.removeAttributeNode(r):t.removeAttribute(e)}catch(n){try{t.removeAttribute(e)}catch(e){}}if("is"===e)if(de||pe)try{Je(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Qe=function(e){const t=b(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],i=r&&r.name;"string"!=typeof i||Y[Ue(i)]||Ye(e,r,i)}},et=function(e){const t=[e];for(;t.length>0;){const e=t.pop();1===S(e)&&Qe(e);const n=y(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},tt=function(e,t){return!!ae&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},nt=function(e){let t=null,n=null;if(fe)e="<remove></remove>"+e;else{const t=vn(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ve&&Me===xe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=E?M(e):e;if(Me===xe)try{t=(new u).parseFromString(i,Ve)}catch(e){}if(!t||!t.documentElement){t=I.createDocument(Me,"template",null);try{t.documentElement.innerHTML=_e?C:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),Me===xe?R.call(t,ce?"html":"body")[0]:ce?t.documentElement:o},rt=function(e){const t=T?T(e):e.ownerDocument;return L.call(t||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},it=function(e){return e=bn(e,B," "),e=bn(e,V," "),bn(e,q," ")},ot=function(e){var t;e.normalize();const n=T?T(e):e.ownerDocument,r=L.call(n||e,e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let i=r.nextNode();for(;i;)i.data=it(i.data),i=r.nextNode();const o=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");o&&un(o,e=>{at(e.content)&&ot(e.content)})},st=function(e){const t=O?O(e):null;return"string"==typeof t&&"form"===Ue(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==b(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==w(e)||e.childNodes!==y(e))},at=function(e){if(!w||"object"!=typeof e||null===e)return!1;try{return 11===w(e)}catch(e){return!1}},ct=function(e){if(!w||"object"!=typeof e||null===e)return!1;try{return"number"==typeof w(e)}catch(e){return!1}};function lt(e,t,r){0!==e.length&&un(e,e=>{e.call(n,t,r,ze)})}const ut=function(e,t){if(e instanceof RegExp)return An(e,t);if(e instanceof Function){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return Boolean(e(t,...r))}return!1},ht=function(e,t,n,r){return 0===e.length?t:t===n||t===r?Ln(t):t},ft=function(e,t){return e!==t&&null===g(e)&&(we&&et(e),!0)},dt=function(e,t){if(lt(F.beforeSanitizeElements,e,null),ft(e,t))return!0;if(st(e))return Je(e),!0;const r=Ue(k(e));if(G=ht(F.uponSanitizeElement,G,J,ue),lt(F.uponSanitizeElement,e,{tagName:r,allowedTags:G}),ft(e,t))return!0;if(function(e,t){return!!(ae&&e.hasChildNodes()&&!ct(e.firstElementChild)&&An(rr,e.textContent)&&An(rr,e.innerHTML))||!!(ae&&e.namespaceURI===xe&&cr[t]&&(ct(e.firstElementChild)||"string"==typeof e.textContent&&An(lr[t],e.textContent)))||7===e.nodeType||!(!ae||8!==e.nodeType||!An(ir,e.data))}(e,r))return Je(e),!0;if(Q[r]||!(te.tagCheck instanceof Function&&te.tagCheck(r))&&!G[r]){const n=function(e,t,n){if(!Q[t]&&yt(t)&&ut(X.tagNameCheck,t))return!1;if(be&&!Te[t]){const t=g(e),r=y(e);if(r&&t)for(let i=r.length-1;i>=0;--i){const o=e===n?d(r[i],!0):r[i];t.insertBefore(o,m(e))}}return Je(e),!0}(e,r,t);return!1===n&<(F.afterSanitizeElements,e,null),n}if(1===S(e)&&!function(e){let t=g(e);t&&t.tagName||(t={namespaceURI:Me,tagName:"template"});const n=yn(e.tagName),r=yn(t.tagName);return!!Ie[e.namespaceURI]&&(e.namespaceURI===je?function(e,t,n){return t.namespaceURI===xe?"svg"===e:t.namespaceURI===Ae?"svg"===e&&("annotation-xml"===n||Re[n]):Boolean(Ke[e])}(n,t,r):e.namespaceURI===Ae?function(e,t,n){return t.namespaceURI===xe?"math"===e:t.namespaceURI===je?"math"===e&&Fe[n]:Boolean(Ge[e])}(n,t,r):e.namespaceURI===xe?function(e,t,n){return!(t.namespaceURI===je&&!Fe[n])&&!(t.namespaceURI===Ae&&!Re[n])&&!Ge[e]&&(Be[e]||!Ke[e])}(n,t,r):!("application/xhtml+xml"!==Ve||!Ie[e.namespaceURI]))}(e))return Je(e),!0;if(("noscript"===r||"noembed"===r||"noframes"===r)&&An(or,e.innerHTML))return Je(e),!0;if(se&&3===e.nodeType){const t=it(e.textContent);e.textContent!==t&&(dn(n.removed,{element:e.cloneNode()}),e.textContent=t)}return lt(F.afterSanitizeElements,e,null),!1},pt=function(e,t,n){if(ee[t])return!1;if(tt(t,e))return!1;if(ye&&("id"===t||"name"===t)&&(n in r||n in We))return!1;const i=Y[t]||te.attributeCheck instanceof Function&&te.attributeCheck(t,e);return!(!re||!An(U,t))||!(!ne||!An(z,t))||(i?!(!Pe[t]&&!An(K,bn(n,H,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==wn(n,"data:")||!ke[e])&&(!ie||An(W,bn(n,H,"")))&&n):yt(e)&&ut(X.tagNameCheck,e)&&ut(X.attributeNameCheck,t,e)||"is"===t&&X.allowCustomizedBuiltInElements&&ut(X.tagNameCheck,n))},mt=_n({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yt=function(e){return!mt[yn(e)]&&An($,e)},gt=function(e,t,n,r){if(E&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!n)switch(h.getAttributeType(e,t)){case"TrustedHTML":return M(r);case"TrustedScriptURL":return function(e){x(),j++;try{return E.createScriptURL(e)}finally{j--}}(r)}return r},vt=function(e,t,r,i){try{r?e.setAttributeNS(r,t,i):e.setAttribute(t,i),st(e)?Je(e):fn(n.removed)}catch(n){Xe(t,e)}},bt=function(e){lt(F.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||st(e))return;Y=ht(F.uponSanitizeAttribute,Y,Z,he);const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let r=t.length;const i=Ue(e.nodeName);for(;r--;){const o=t[r],s=o.name,a=o.namespaceURI,c=o.value,l=Ue(s),u=c;let h="value"===s?u:On(u);n.attrName=l,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,lt(F.uponSanitizeAttribute,e,n),h=n.attrValue,!ge||"id"!==l&&"name"!==l||0===wn(h,ve)||(Xe(s,e,o),h=ve+h),ae&&An(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,h)||"attributename"===l&&vn(h,"href")?Xe(s,e,o):n.forceKeepAttr||(!n.keepAttr||!oe&&An(sr,h)?Xe(s,e,o):(se&&(h=it(h)),pt(i,l,h)?(h=gt(i,l,a,h),h!==u&&vt(e,s,a,h)):Xe(s,e,o)))}lt(F.afterSanitizeAttributes,e,null)},wt=function(e){let t=null;const n=rt(e);for(lt(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(lt(F.uponSanitizeShadowNode,t,null),dt(t,e),bt(t),at(t.content)&&wt(t.content),1===S(t)){const e=v(t);at(e)&&(Ot(e),wt(e))}lt(F.afterSanitizeShadowDOM,e,null)},Ot=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){wt(e.shadow);continue}const n=e.node,r=1===S(n),i=y(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){const e=O?O(n):null;if("string"==typeof e&&"template"===Ue(e)){const e=n.content;at(e)&&t.push({node:e,shadow:null})}}if(r){const e=v(n);at(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,a=null;if(_e=!e,_e&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ct(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return Tn(e);case"boolean":return Sn(e);case"bigint":return kn?kn(e):"0";case"symbol":return En?En(e):"Symbol()";case"undefined":default:return Cn(e);case"function":case"object":{if(null===e)return Cn(e);const t=e,n=Nn(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:Cn(e)}return Cn(e)}}}(e)))throw jn("dirty is not a string, aborting");if(!n.isSupported)return e;le?(G=ue,Y=he):$e(t),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(G=Ln(G)),F.uponSanitizeAttribute.length>0&&(Y=Ln(Y)),n.removed=[];const c=we&&"string"!=typeof e&&ct(e);if(c){!function(e){if(!ae)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=S(e);if(7===n||8===n&&An(ir,e.data)){try{p(e)}catch(e){}continue}if(1===n){const t=e,n=Ue(k(e));try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&tt("for",n)&&t.removeAttribute("for")}catch(e){}}const r=y(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}}(e);const t=k(e);if("string"==typeof t){const n=Ue(t);if(!G[n]||Q[n])throw Ze(e),jn("root node is forbidden and cannot be sanitized in-place")}if(st(e))throw Ze(e),jn("root node is clobbered and cannot be sanitized in-place");try{Ot(e)}catch(t){throw Ze(e),t}}else if(ct(e))r=nt("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o),Ot(o);else{if(!de&&!se&&!ce&&-1===e.indexOf("<"))return E&&me?M(e):e;if(r=nt(e),!r)return de?null:me?C:""}r&&fe&&Je(r.firstChild);const l=c?e:r;try{const e=rt(l);for(;s=e.nextNode();)dt(s,l),bt(s),at(s.content)&&wt(s.content)}catch(t){throw c&&(Ze(e),un(n.removed,e=>{e.element&&et(e.element)})),t}if(c)return un(n.removed,e=>{e.element&&et(e.element)}),se&&ot(e),e;if(de){if(se&&ot(r),pe)for(a=N.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(Y.shadowroot||Y.shadowrootmode)&&(a=D.call(i,a,!0)),a}let u=ce?r.outerHTML:r.innerHTML;return ce&&G["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&An(tr,r.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+u),se&&(u=it(u)),E&&me?M(u):u},n.setConfig=function(){$e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),le=!0,ue=G,he=Y},n.clearConfig=function(){ze=null,le=!1,ue=null,he=null,E=P,C=""},n.isValidAttribute=function(e,t,n){ze||$e({});const r=Ue(e),i=Ue(t);return pt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&Pn(F,e)&&dn(F[e],t)},n.removeHook=function(e,t){if(Pn(F,e)){if(void 0!==t){const n=hn(F[e],t);return-1===n?void 0:pn(F[e],n,1)[0]}return fn(F[e])}},n.removeHooks=function(e){Pn(F,e)&&(F[e]=[])},n.removeAllHooks=function(){F={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),pr={ADD_ATTR:["target"],ALLOW_DATA_ATTR:!1,RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0}},mr={ADD_ATTR:["target"],ADD_TAGS:["hellotext-icon"],RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0,svg:!0}};function yr(e,t){var n=dr.sanitize(e,t);return n.querySelectorAll('a[target="_blank"]').forEach(e=>{var t=new Set(e.rel.split(/\s+/).filter(Boolean));t.add("noopener"),t.add("noreferrer"),e.rel=Array.from(t).join(" ")}),n}function gr(e,t){e.replaceChildren(function(e){return yr(e,pr)}(t))}function vr(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 br(e,t,n){return(t=Tr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Or(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,Tr(r.key),r)}}function Tr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Sr(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var kr=0;function Er(e){return"__private_"+kr+++"_"+e}var Pr=Er("findOrCreateComponent"),Cr=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,Pr,{value:Ar}),this.data=t,this.element=n||document.querySelector('[data-hello-form="'.concat(this.id,'"]'))||document.createElement("form")}var t,n,r,i;return t=e,n=[{key:"mount",value:(r=function*(){var e,{ifCompleted:t=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t&&this.hasBeenCompleted)return null===(e=this.element)||void 0===e||e.remove(),Ci.eventEmitter.dispatch("form:completed",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vr(Object(n),!0).forEach(function(t){br(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:this.id},JSON.parse(localStorage.getItem("hello-form-".concat(this.id)))));var n=this.data.steps[0];this.buildHeader(n.header),this.buildInputs(n.inputs),this.buildButton(n.button),this.buildFooter(n.footer),this.elementAttributes.forEach(e=>{this.element.setAttribute(e.name,e.value)}),document.contains(this.element)||document.body.appendChild(this.element),Ci.business.features.white_label||this.element.prepend(Jt.build())},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){wr(o,n,i,s,a,"next",e)}function a(e){wr(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})},{key:"buildHeader",value:function(e){var t=Sr(this,Pr)[Pr]("[data-form-header]","header");gr(t,e.content),this.element.querySelector("[data-form-header]")?this.element.querySelector("[data-form-header]").replaceWith(t):this.element.prepend(t)}},{key:"buildInputs",value:function(e){var t=Sr(this,Pr)[Pr]("[data-form-inputs]","main");e.map(e=>zt.build(e)).forEach(e=>t.appendChild(e)),this.element.querySelector("[data-form-inputs]")?this.element.querySelector("[data-form-inputs]").replaceWith(t):this.element.querySelector("[data-form-header]").insertAdjacentHTML("afterend",t.outerHTML)}},{key:"buildButton",value:function(e){var t=Sr(this,Pr)[Pr]("[data-form-button]","button");t.innerText=e.text,t.setAttribute("data-action","click->hellotext--form#submit"),t.setAttribute("data-hellotext--form-target","button"),this.element.querySelector("[data-form-button]")?this.element.querySelector("[data-form-button]").replaceWith(t):this.element.querySelector("[data-form-inputs]").insertAdjacentHTML("afterend",t.outerHTML)}},{key:"buildFooter",value:function(e){var t=Sr(this,Pr)[Pr]("[data-form-footer]","footer");gr(t,e.content),this.element.querySelector("[data-form-footer]")?this.element.querySelector("[data-form-footer]").replaceWith(t):this.element.appendChild(t)}},{key:"markAsCompleted",value:function(e){var t={state:"completed",id:this.id,data:e,completedAt:(new Date).getTime()};localStorage.setItem("hello-form-".concat(this.id),JSON.stringify(t)),Ci.eventEmitter.dispatch("form:completed",t)}},{key:"hasBeenCompleted",get:function(){return null!==localStorage.getItem("hello-form-".concat(this.id))}},{key:"id",get:function(){return this.data.id}},{key:"localeAuthKey",get:function(){var e=this.data.steps[0];return e.inputs.some(e=>"email"===e.kind)&&e.inputs.some(e=>"phone"===e.kind)?"phone_and_email":e.inputs.some(e=>"email"===e.kind)?"email":e.inputs.some(e=>"phone"===e.kind)?"phone":"none"}},{key:"elementAttributes",get:function(){return[{name:"data-controller",value:"hellotext--form"},{name:"data-hello-form",value:this.id},{name:"data-hellotext--form-data-value",value:JSON.stringify(this.data)}]}}],n&&Or(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ar(e,t){var n=this.element.querySelector(e);if(n)return n.cloneNode(!0);var r=document.createElement(t);return r.setAttribute(e.replace("[","").replace("]",""),""),r}function jr(e){var t="function"==typeof Map?new Map:void 0;return jr=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return xr(e,arguments,Ir(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_r(r,e)},jr(e)}function xr(e,t,n){return xr=Mr()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&_r(i,n.prototype),i},xr.apply(null,arguments)}function Mr(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _r(e,t){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_r(e,t)}function Ir(e){return Ir=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ir(e)}var Lr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_r(e,t)}(o,e);var t,n,r,i=(n=o,r=Mr(),function(){var e,t=Ir(n);if(r){var i=Ir(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,"You need to initialize before tracking events. Call Hellotext.initialize and pass your public business id")).name="NotInitializedError",e}return t=o,Object.defineProperty(t,"prototype",{writable:!1}),t}(jr(Error));function Nr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Rr(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,Dr(r.key),r)}}function Dr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Fr=0;function Br(e){return"__private_"+Fr+++"_"+e}var Vr=Br("formIdsToFetch"),qr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,Vr,{get:Ur,set:void 0}),this.forms=[],this.includes=this.includes.bind(this),this.excludes=this.excludes.bind(this),this.add=this.add.bind(this),"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver(this.formMutationObserver.bind(this)),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}))}var t,n,r,i;return t=e,n=[{key:"collectExistingFormsOnPage",value:function(){Array.from(document.querySelectorAll("[data-hello-form]")).length>0&&this.collect()}},{key:"formMutationObserver",value:function(e){e.find(e=>"childList"===e.type&&e.addedNodes.length>0)&&Array.from(document.querySelectorAll("[data-hello-form]")).length>0&&this.collect()}},{key:"collect",value:(r=function*(){if(Ci.notInitialized)throw new Lr;if(!this.fetching){if("undefined"==typeof document||!("querySelectorAll"in document))return console.warn("Document is not defined, collection is not possible. Please make sure to initialize the library after the document is loaded.");var e=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,Vr)[Vr];if(0!==e.length){var t=e.map(e=>xe.get(e).then(e=>e.json()));this.fetching=!0,yield Promise.all(t).then(e=>e.forEach(this.add)).then(()=>Ci.eventEmitter.dispatch("forms:collected",this)).then(()=>this.fetching=!1),H.forms.autoMount&&this.forms.forEach(e=>e.mount())}}},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){Nr(o,n,i,s,a,"next",e)}function a(e){Nr(o,n,i,s,a,"throw",e)}s(void 0)})},function(){return i.apply(this,arguments)})},{key:"forEach",value:function(e){this.forms.forEach(e)}},{key:"map",value:function(e){return this.forms.map(e)}},{key:"add",value:function(e){this.includes(e.id)||(Ci.business.data||(Ci.business.setData(e.business),Ci.business.setLocale(j.toString())),Ci.business.enabledWhitelist||console.warn("No whitelist has been configured. It is advised to whitelist the domain to avoid bots from submitting forms."),this.forms.push(new Cr(e)))}},{key:"getById",value:function(e){return this.forms.find(t=>t.id===e)}},{key:"getByIndex",value:function(e){return this.forms[e]}},{key:"includes",value:function(e){return this.forms.some(t=>t.id===e)}},{key:"excludes",value:function(e){return!this.includes(e)}},{key:"length",get:function(){return this.forms.length}}],n&&Rr(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ur(){return Array.from(document.querySelectorAll("[data-hello-form]")).map(e=>e.dataset.helloForm).filter(this.excludes)}function zr(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 Wr(e,t,n){return(t=Gr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function $r(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Hr(o,r,i,s,a,"next",e)}function a(e){Hr(o,r,i,s,a,"throw",e)}s(void 0)})}}function Kr(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,Gr(r.key),r)}}function Gr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Jr=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.publicKey=t.public_key,this.serviceWorkerUrl=H.push.serviceWorkerUrl,this.channelId=H.push.channelId,this.ready=null,this.registrationPromise=null,this.subscribePromise=null,this.unsubscribePromise=null,this.syncPromise=null,this.subscription=null,this.retryTimeout=null,this.retryAttempts=0,this.disposed=!1}var t,n,r,i,o,s,a,c;return t=e,n=[{key:"initialize",value:function(){return this.ready=this.restoreSubscription(),this.ready}},{key:"restoreSubscription",value:(c=$r(function*(){var e=yield this.getRegistration(),t=yield e.pushManager.getSubscription();!this.disposed&&!this.unsubscribePromise&&t&&this.owns(t)&&(this.subscription=t,yield this.sync())}),function(){return c.apply(this,arguments)})},{key:"subscribe",value:function(){if(this.disposed)return Promise.resolve();if(this.unsubscribePromise)return Promise.reject(new Error("Push unsubscribe is in progress"));if(this.subscribePromise)return this.subscribePromise;var e="default"===Notification.permission?Notification.requestPermission():Promise.resolve(Notification.permission);return this.subscribePromise=this.createSubscription(e).finally(()=>{this.subscribePromise=null}),this.subscribePromise}},{key:"createSubscription",value:(a=$r(function*(e){if("granted"!==(yield e))throw new Error("Push permission was not granted");var t=yield this.getRegistration();if(!this.disposed){var n=yield t.pushManager.getSubscription();if(!this.disposed){if(n&&!this.owns(n))throw new Error("The existing Push subscription belongs to a different application");if(n||(n=yield t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:this.applicationServerKey})),!this.disposed)return this.subscription=n,this.sync()}}}),function(e){return a.apply(this,arguments)})},{key:"unsubscribe",value:function(){return this.disposed?Promise.resolve():(this.unsubscribePromise||(this.clearRetryTimeout(),this.unsubscribePromise=this.removeSubscription().finally(()=>{this.unsubscribePromise=null})),this.unsubscribePromise)}},{key:"removeSubscription",value:(s=$r(function*(){var e,t,n;yield null===(e=this.ready)||void 0===e?void 0:e.catch(()=>{}),yield null===(t=this.subscribePromise)||void 0===t?void 0:t.catch(()=>{}),yield null===(n=this.syncPromise)||void 0===n?void 0:n.catch(()=>{});var r=yield this.getRegistration(),i=(yield r.pushManager.getSubscription())||this.subscription;if(!this.disposed){if(!i)return null;if(!this.owns(i))throw new Error("The existing Push subscription belongs to a different application");this.subscription=i;var o=yield yt.pushIdentities.destroy({subscription:i.toJSON()});if(o.failed)return o;if(!this.disposed)return yield i.unsubscribe(),this.subscription=null,this.clearRetryTimeout(),o}}),function(){return s.apply(this,arguments)})},{key:"sync",value:function(){return this.disposed?Promise.resolve():(this.syncPromise||(this.clearRetryTimeout(),this.syncPromise=this.registerIdentity().finally(()=>{this.syncPromise=null})),this.syncPromise)}},{key:"registerIdentity",value:(o=$r(function*(){try{var e=yield yt.pushIdentities.create(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zr(Object(n),!0).forEach(function(t){Wr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({subscription:this.subscription.toJSON()},this.channelId?{channel_id:this.channelId}:{}));return e.succeeded?this.retryAttempts=0:this.scheduleRetry(),e}catch(e){throw this.scheduleRetry(),e}}),function(){return o.apply(this,arguments)})},{key:"scheduleRetry",value:function(){this.disposed||this.unsubscribePromise||this.retryTimeout||this.retryAttempts>=3||(this.retryTimeout=setTimeout(()=>{this.retryTimeout=null,this.sync().catch(()=>{})},1e3*2**this.retryAttempts),this.retryAttempts+=1)}},{key:"clearRetryTimeout",value:function(){clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"dispose",value:function(){this.disposed=!0,this.clearRetryTimeout()}},{key:"subscribed",get:function(){return!!this.subscription}},{key:"applicationServerKey",get:function(){var e=this.publicKey.replace(/-/g,"+").replace(/_/g,"/");return Uint8Array.from(atob(e.padEnd(4*Math.ceil(e.length/4),"=")),e=>e.charCodeAt(0))}},{key:"owns",value:function(e){var t,n=null===(t=e.options)||void 0===t?void 0:t.applicationServerKey;if(!n)return!1;var r=new Uint8Array(n),i=this.applicationServerKey;return r.length===i.length&&r.every((e,t)=>e===i[t])}},{key:"getRegistration",value:function(){return this.registrationPromise||(this.registrationPromise=this.loadRegistration().catch(e=>{throw this.registrationPromise=null,e})),this.registrationPromise}},{key:"loadRegistration",value:(i=$r(function*(){if(this.serviceWorkerUrl){var e=yield navigator.serviceWorker.register(this.serviceWorkerUrl);!e.active||e.installing||e.waiting||(yield e.update());var t=e.installing||e.waiting||e.active;return"activated"===(null==t?void 0:t.state)?e:new Promise((n,r)=>{var i=setTimeout(()=>o(new Error("Push service worker did not become active")),1e4),o=o=>{clearTimeout(i),null==t||t.removeEventListener("statechange",s),o?r(o):n(e)},s=()=>{"activated"===(null==t?void 0:t.state)&&o(),"redundant"===(null==t?void 0:t.state)&&o(new Error("Push service worker installation failed"))};null==t||t.addEventListener("statechange",s),s()})}return new Promise((e,t)=>{var n=setTimeout(()=>t(new Error("Push service worker is not available")),1e4);navigator.serviceWorker.ready.then(t=>{clearTimeout(n),e(t)},e=>{clearTimeout(n),t(e)})})}),function(){return i.apply(this,arguments)})}],r=[{key:"supported",get:function(){return"undefined"!=typeof window&&!0===window.isSecureContext&&"undefined"!=typeof navigator&&"serviceWorker"in navigator&&"undefined"!=typeof PushManager&&"undefined"!=typeof Notification}}],n&&Kr(t.prototype,n),r&&Kr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Yr(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Zr(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Yr(o,r,i,s,a,"next",e)}function a(e){Yr(o,r,i,s,a,"throw",e)}s(void 0)})}}function Xr(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,Qr(r.key),r)}}function Qr(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ei=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.mounted=!1,this.rendered=Promise.resolve(!1)}var t,n,r,i,o;return t=e,n=[{key:"render",value:(o=Zr(function*(){return this.applyBehaviourOverride(),(yield this.stylesheetLoaded)?(this.containerToAppendTo.appendChild(this.data.html),this.markCoexistingWidgets(),this.mounted=!0,!0):(console.warn("Hellotext webchat was not mounted because its stylesheet failed to load."),!1)}),function(){return o.apply(this,arguments)})},{key:"applyBehaviourOverride",value:function(){H.webchat.hasBehaviourOverride&&H.webchat.behaviour&&this.data.html.setAttribute("data-hellotext--webchat-behaviour-value",JSON.stringify(this.serializedBehaviour))}},{key:"serializedBehaviour",get:function(){var e=H.webchat.behaviour;return{trigger:this.serializeTrigger(e.trigger),delay_seconds:e.delaySeconds,first_visit_only:e.firstVisitOnly,once_per_session:e.oncePerSession}}},{key:"serializeTrigger",value:function(e){return"onLoad"===e?"on_load":"onClick"===e?"on_click":e}},{key:"containerToAppendTo",get:function(){return document.querySelector(H.webchat.container)}},{key:"stylesheetLoaded",get:function(){return Tt.waitForStylesheet(Tt.latestStylesheet)}},{key:"markCoexistingWidgets",value:function(){var e=this.data.html,t=document.querySelector(".hellotext--whatsapp-widget");e&&t&&(e.classList.add("hellotext--with-whatsapp-widget"),t.classList.add("hellotext--with-webchat"))}}],r=[{key:"load",value:(i=Zr(function*(t){var n=new e({id:t,html:yield yt.webchats.get(t)});return n.rendered=n.render(),n}),function(e){return i.apply(this,arguments)})}],n&&Xr(t.prototype,n),r&&Xr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function ti(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ni(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ti(o,r,i,s,a,"next",e)}function a(e){ti(o,r,i,s,a,"throw",e)}s(void 0)})}}function ri(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,ii(r.key),r)}}function ii(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var oi=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.mounted=!1,this.rendered=Promise.resolve(!1)}var t,n,r,i,o;return t=e,n=[{key:"render",value:(o=ni(function*(){if(!this.data.html)return!1;var e=this.containerToAppendTo;return e?(yield this.stylesheetLoaded)?(e.appendChild(this.data.html),this.markCoexistingWidgets(),this.mounted=!0,!0):(console.warn("Hellotext WhatsApp widget was not mounted because its stylesheet failed to load."),!1):(console.warn("Hellotext WhatsApp widget was not mounted because the container ".concat(H.whatsapp.container," was not found.")),!1)}),function(){return o.apply(this,arguments)})},{key:"containerToAppendTo",get:function(){try{return document.querySelector(H.whatsapp.container)}catch(e){return null}}},{key:"stylesheetLoaded",get:function(){return Tt.waitForStylesheet(Tt.latestStylesheet)}},{key:"markCoexistingWidgets",value:function(){var e=document.querySelector(".hellotext--webchat:not(.hellotext--whatsapp-widget)"),t=this.data.html;e&&t&&(e.classList.add("hellotext--with-whatsapp-widget"),t.classList.add("hellotext--with-webchat"))}}],r=[{key:"load",value:(i=ni(function*(t){var n=new e({id:t,html:yield yt.whatsappWidgets.get(t)});return n.rendered=n.render(),n}),function(e){return i.apply(this,arguments)})}],n&&ri(t.prototype,n),r&&ri(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function si(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,ai(r.key),r)}}function ai(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var ci=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"id",get:function(){return Et.get("hello_user_id")}},{key:"source",get:function(){return Et.get("hello_user_source")}},{key:"fingerprint",get:function(){return Et.get("hello_user_identification_hash")}},{key:"remember",value:function(e,t,n){t&&Et.set("hello_user_source",t),n&&Et.set("hello_user_identification_hash",n),Et.set("hello_user_id",e)}},{key:"forget",value:function(){Et.delete("hello_user_id"),Et.delete("hello_user_source"),Et.delete("hello_user_identification_hash")}},{key:"identificationData",get:function(){return this.id?{id:this.id,source:this.source}:{}}}],null&&si(t.prototype,null),n&&si(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function li(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,pi(r.key),r)}}function ui(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function hi(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ui(o,r,i,s,a,"next",e)}function a(e){ui(o,r,i,s,a,"throw",e)}s(void 0)})}}function fi(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 di(e,t,n){return(t=pi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pi(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function mi(e){if(null!=e){if("string"==typeof e){var t=e.trim();return""===t?void 0:t}if(Array.isArray(e))return e.map(e=>mi(e)).filter(e=>void 0!==e);if(e instanceof Date)return e.toISOString();if("object"==typeof e){var n=Object.keys(e).sort((e,t)=>e.localeCompare(t)).reduce((t,n)=>{var r=mi(e[n]);return void 0!==r&&(t[n]=r),t},{});return Object.keys(n).length>0?n:void 0}return"number"==typeof e||"boolean"==typeof e?e:void 0}}function yi(e,t){var n=mi(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fi(Object(n),!0).forEach(function(t){di(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({session:e,user_id:t},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}))||{};return JSON.stringify(n)}function gi(){return(gi=hi(function*(e){var t;if(null===(t=globalThis.crypto)||void 0===t||!t.subtle||"undefined"==typeof TextEncoder)return function(e){for(var t=5381,n=0;n<e.length;n+=1)t=33*t^e.charCodeAt(n);return"v1:".concat((t>>>0).toString(16))}(e);var n=yield globalThis.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)),r=Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("");return"v1:".concat(r)})).apply(this,arguments)}var vi=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,n=[{key:"matches",value:function(e,t){return!!e&&e===t}},{key:"generate",value:(r=hi(function*(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return yield function(e){return gi.apply(this,arguments)}(yi(e,t,n))}),function(e,t){return r.apply(this,arguments)})}],n&&li(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();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 wi(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){Oi(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 Oi(e,t,n){return(t=Ei(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ti(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Si(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Ti(o,r,i,s,a,"next",e)}function a(e){Ti(o,r,i,s,a,"throw",e)}s(void 0)})}}function ki(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,Ei(r.key),r)}}function Ei(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var Pi=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i,o;return t=e,n=[{key:"initialize",value:(o=Si(function*(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null===(t=this.push)||void 0===t||t.dispose(),this.push=null,this.business=new Tt(e),this.page=new Mt,H.assign(wi({push:{}},r)),Vt.initialize(this.page),this.forms=new qr,this.query=new ue;var i=yield this.business.hydrate();!1!==r.push&&null!=i&&null!==(n=i.push)&&void 0!==n&&n.public_key&&Jr.supported&&(this.push=new Jr(i.push),this.push.initialize().catch(e=>{console.warn("Hellotext Push initialization failed:",e)}));var o=!1!==r.webchat&&this.mergeWebchatConfig(i&&i.webchat||{},r.webchat||{}),s=!1!==r.whatsappWidget&&this.mergeWhatsAppConfig(i&&i.whatsapp||{},r.whatsappWidget||{}),a=r.webchat&&!1!==r.webchat&&Object.prototype.hasOwnProperty.call(r.webchat,"behaviour");H.webchat.behaviourOverride=a,o&&o.id&&(H.webchat.assign(o),this.webchat=yield ei.load(o.id)),s&&s.id&&(H.whatsapp.assign(s),this.whatsapp=yield oi.load(s.id)),"undefined"!=typeof MutationObserver&&this.forms.collectExistingFormsOnPage()}),function(e){return o.apply(this,arguments)})},{key:"mergeWebchatConfig",value:function(e,t){return this.deepMergePlainObjects(e,t)}},{key:"mergeWhatsAppConfig",value:function(e,t){return this.deepMergePlainObjects(e,t)}},{key:"deepMergePlainObjects",value:function(e,t){var n=wi({},e);return Object.entries(t).forEach(e=>{var[t,r]=e;this.isPlainObject(r)&&this.isPlainObject(n[t])?n[t]=this.deepMergePlainObjects(n[t],r):n[t]=r}),n}},{key:"isPlainObject",value:function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}},{key:"track",value:(i=Si(function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.notInitialized)throw new Lr;var n=wi(wi({},t&&t.headers||{}),this.headers),r=wi(wi({},ci.identificationData),t.user_parameters||{}),i=t&&t.url?new Mt(t.url):this.page,o=wi(wi({session:this.session,user_parameters:r,action:e},t),i.trackingData);return delete o.headers,yield yt.events.create({headers:n,body:o,keepalive:mt(o)})}),function(e){return i.apply(this,arguments)})},{key:"identify",value:(r=Si(function*(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=yield vi.generate(this.session,e,n);if(vi.matches(ci.fingerprint,r))return new ve(!0,{json:(t=Si(function*(){return{already_identified:!0}}),function(){return t.apply(this,arguments)})});var i=yield yt.identifications.create(wi({user_id:e},n));return i.succeeded&&ci.remember(e,n.source,r),i}),function(e){return r.apply(this,arguments)})},{key:"forget",value:function(){ci.forget()}},{key:"on",value:function(e,t){this.eventEmitter.addSubscriber(e,t)}},{key:"removeEventListener",value:function(e,t){this.eventEmitter.removeSubscriber(e,t)}},{key:"session",get:function(){return Vt.session}},{key:"isInitialized",get:function(){return void 0!==Vt.session}},{key:"notInitialized",get:function(){return!this.business||void 0===this.business.id}},{key:"headers",get:function(){if(this.notInitialized)throw new Lr;return{Authorization:"Bearer ".concat(this.business.id),Accept:"application/json","Content-Type":"application/json"}}}],n&&ki(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();Pi.eventEmitter=new re,Pi.forms=void 0,Pi.business=void 0,Pi.webchat=void 0,Pi.whatsapp=void 0,Pi.push=void 0;const Ci=Pi;function Ai(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ji(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,xi(r.key),r)}}function xi(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Mi(){return Mi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ii(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Mi.apply(this,arguments)}function _i(e,t){return _i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_i(e,t)}function Ii(e){return Ii=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ii(e)}var Li=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_i(e,t)}(c,e);var t,n,r,i,o,s,a=(o=c,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Ii(o);if(s){var n=Ii(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function c(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),a.apply(this,arguments)}return t=c,n=[{key:"initialize",value:function(){this.form=new Cr(this.dataValue,this.element)}},{key:"connect",value:function(){Mi(Ii(c.prototype),"connect",this).call(this),this.element.addEventListener("submit",this.submit.bind(this)),"INPUT"!==document.activeElement.tagName&&this.inputTargets[0].focus()}},{key:"submit",value:(r=function*(e){if(e.preventDefault(),this.invalid)return this.showErrorMessages();this.clearErrorMessages(),this.formData=Object.fromEntries(new FormData(this.element)),this.buttonTarget.disabled=!0;var t=yield xe.submit(this.form.id,this.formData);this.buttonTarget.disabled=!1;var n=yield t.json();if(t.failed)return n.errors.forEach(e=>{var{type:t,parameter:n}=e,r=this.inputTargets.find(e=>e.name===n);r.setCustomValidity(Ci.business.locale.errors[t]),r.reportValidity(),r.addEventListener("input",()=>{r.setCustomValidity(""),r.reportValidity()})}),this.showErrorMessages();this.buttonTarget.style.display="none",this.element.querySelectorAll("input").forEach(e=>e.disabled=!0),this.completed()},i=function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function s(e){Ai(o,n,i,s,a,"next",e)}function a(e){Ai(o,n,i,s,a,"throw",e)}s(void 0)})},function(e){return i.apply(this,arguments)})},{key:"completed",value:function(){if(this.form.markAsCompleted(this.formData),!H.forms.shouldShowSuccessMessage)return this.element.remove();"string"==typeof H.forms.successMessage?this.element.innerHTML=H.forms.successMessage:this.element.innerHTML=Ci.business.locale.forms[this.form.localeAuthKey]}},{key:"showErrorMessages",value:function(){this.inputTargets.forEach(e=>{var t=e.closest("article").querySelector("[data-error-container]");e.validity.valid?t.innerText="":t.innerText=e.validationMessage})}},{key:"clearErrorMessages",value:function(){this.inputTargets.forEach(e=>{e.setCustomValidity(""),e.closest("article").querySelector("[data-error-container]").innerText=""})}},{key:"inputTargetConnected",value:function(e){e.getAttribute("data-default-value")&&(e.value=e.getAttribute("data-default-value"))}},{key:"requiredInputs",get:function(){return this.inputTargets.filter(e=>e.required)}},{key:"invalid",get:function(){return!this.element.checkValidity()}}],n&&ji(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),c}(g.xI);function Ni(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 Ri(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ni(Object(n),!0).forEach(function(t){Di(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ni(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Di(e,t,n){return(t=Bi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fi(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,Bi(r.key),r)}}function Bi(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Vi(e,t){return Vi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vi(e,t)}function qi(e){return qi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qi(e)}Li.values={data:Object,step:{type:Number,default:1}},Li.targets=["inputContainer","input","button","otpContainer"];var Ui=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vi(e,t)}(s,e);var t,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=qi(r);if(i){var n=qi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),o.apply(this,arguments)}return t=s,n=[{key:"connect",value:function(){this.updateFades(),this.observeContainerSize()}},{key:"disconnect",value:function(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect()}},{key:"setId",value:function(e){var{detail:t}=e;this.idValue=t,this.element.id=t}},{key:"onScroll",value:function(){this.updateFades()}},{key:"quickReply",value:function(e){var{currentTarget:t}=e,n=t.closest('[data-hellotext--message-target="carouselCard"]'),r=t.closest('[data-controller~="hellotext--message"]'),i=t.dataset.text||t.textContent.trim();this.dispatch("quickReply",{detail:{id:this.idValue,product:null==n?void 0:n.dataset.id,buttonId:t.dataset.id,body:i,cardElement:n||r||t}})}},{key:"addToCart",value:function(e){var{currentTarget:t}=e,n=t.closest('[data-hellotext--message-target="carouselCard"]'),{id:r,reference:i,source:o}=n.dataset,s={product:r,quantity:1};this.hasUtmValue&&Ci.page.utm.save(this.utmValue),Ci.eventEmitter.dispatch("cart.added",{object_parameters:{items:[Ri(Ri(Ri({},s),i&&{reference:i}),o&&{source:o})]},source:{kind:this.kindValue,message_id:this.idValue,button_id:t.dataset.id}})}},{key:"moveToLeft",value:function(){if(this.hasCarouselContainerTarget){var e=this.getPreviousPageScrollLeft(),t=this.carouselContainerTarget.scrollLeft-e;t<1||this.carouselContainerTarget.scrollBy({left:-t,behavior:"smooth"})}}},{key:"moveToRight",value:function(){if(this.hasCarouselContainerTarget){var e=this.getNextPageScrollLeft()-this.carouselContainerTarget.scrollLeft;e<1||this.carouselContainerTarget.scrollBy({left:e,behavior:"smooth"})}}},{key:"getScrollAmount",value:function(){return this.getCardScrollAmount()}},{key:"getCardScrollAmount",value:function(){var e=this.carouselContainerTarget.querySelector(".message__carousel_card");return e?e.offsetWidth+this.getGap():280}},{key:"getPageScrollAmount",value:function(){var e=this.carouselContainerTarget.clientWidth-this.getGap();return e>0?e:this.getCardScrollAmount()}},{key:"getNextPageScrollLeft",value:function(){var e=this.getCurrentScrollLeft(),t=e+this.carouselContainerTarget.clientWidth,n=this.getCardMetrics().find(e=>e.end>t+1),r=n?this.getPageAlignedScrollLeft(n.start):e+this.getPageScrollAmount(),i=e+this.getPageScrollAmount();return this.clampScrollLeft(r>e+1?r:i)}},{key:"getPreviousPageScrollLeft",value:function(){var e,t,n=this.getCurrentScrollLeft();if(n<=1)return 0;var r=Math.max(n-this.getPageScrollAmount(),0);if(r<=1)return 0;var i=this.getCardMetrics(),o=i.find(e=>e.start>=r-1&&e.start<n-1),s=[...i].reverse().find(e=>e.start<n-1);return this.getPageAlignedScrollLeft(null!==(e=null!==(t=null==o?void 0:o.start)&&void 0!==t?t:null==s?void 0:s.start)&&void 0!==e?e:0)}},{key:"getPageAlignedScrollLeft",value:function(e){var t=this.getPageStartOffset();return e<=t+1?0:this.clampScrollLeft(e-t)}},{key:"getCardMetrics",value:function(){return Array.from(this.carouselContainerTarget.querySelectorAll(".message__carousel_card")).map(e=>{var t=this.getCardScrollLeft(e);return{start:t,end:t+e.offsetWidth}})}},{key:"getCardScrollLeft",value:function(e){var t=e.getBoundingClientRect(),n=this.carouselContainerTarget.getBoundingClientRect();return t.left||t.width||n.left||n.width?t.left-n.left+this.carouselContainerTarget.scrollLeft:e.offsetLeft||0}},{key:"getCurrentScrollLeft",value:function(){return this.clampScrollLeft(this.carouselContainerTarget.scrollLeft)}},{key:"clampScrollLeft",value:function(e){var t=Math.max(this.carouselContainerTarget.scrollWidth-this.carouselContainerTarget.clientWidth,0);return Math.min(Math.max(e,0),t)}},{key:"getGap",value:function(){var e=window.getComputedStyle(this.carouselContainerTarget),t=Number.parseFloat(e.columnGap||e.gap);return Number.isFinite(t)?t:16}},{key:"getFadeDistance",value:function(){return Number.isFinite(this.fadeDistanceValue)?this.fadeDistanceValue:64}},{key:"getPageStartOffset",value:function(){return Number.isFinite(this.pageStartOffsetValue)?this.pageStartOffsetValue:0}},{key:"observeContainerSize",value:function(){this.hasCarouselContainerTarget&&window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>this.updateFades()),this.resizeObserver.observe(this.carouselContainerTarget))}},{key:"updateFades",value:function(){if(this.hasCarouselContainerTarget){var e=Math.max(this.carouselContainerTarget.scrollWidth-this.carouselContainerTarget.clientWidth,0);if(e<=1)return this.hideFade(this.leftFadeTarget),void this.hideFade(this.rightFadeTarget);var t=Math.min(Math.max(this.carouselContainerTarget.scrollLeft,0),e),n=this.getFadeDistance();this.setFadeOpacity(this.leftFadeTarget,t/n),this.setFadeOpacity(this.rightFadeTarget,(e-t)/n)}}},{key:"setFadeOpacity",value:function(e,t){var n=Math.min(Math.max(t,0),1);n<=.05?this.hideFade(e):(e.classList.remove("hidden"),e.removeAttribute("disabled"),e.removeAttribute("tabindex"),e.setAttribute("aria-hidden","false"),e.style.opacity=n.toFixed(3),e.style.pointerEvents="auto")}},{key:"hideFade",value:function(e){e.style.opacity="0",e.style.pointerEvents="none",e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1"),"disabled"in e&&(e.disabled=!0),e.classList.add("hidden")}}],n&&Fi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(g.xI);Ui.values={fadeDistance:{type:Number,default:64},id:String,kind:String,pageStartOffset:{type:Number,default:0},utm:Object},Ui.targets=["carouselContainer","leftFade","rightFade","carouselCard"];const zi=["start","end"],Wi=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-"+zi[0],t+"-"+zi[1]),[]),Hi=Math.min,$i=Math.max,Ki=Math.round,Gi=Math.floor,Ji=e=>({x:e,y:e}),Yi={left:"right",right:"left",bottom:"top",top:"bottom"},Zi={start:"end",end:"start"};function Xi(e,t,n){return $i(e,Hi(t,n))}function Qi(e,t){return"function"==typeof e?e(t):e}function eo(e){return e.split("-")[0]}function to(e){return e.split("-")[1]}function no(e){return"x"===e?"y":"x"}function ro(e){return"y"===e?"height":"width"}const io=new Set(["top","bottom"]);function oo(e){return io.has(eo(e))?"y":"x"}function so(e){return no(oo(e))}function ao(e,t,n){void 0===n&&(n=!1);const r=to(e),i=so(e),o=ro(i);let s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=po(s)),[s,po(s)]}function co(e){return e.replace(/start|end/g,e=>Zi[e])}const lo=["left","right"],uo=["right","left"],ho=["top","bottom"],fo=["bottom","top"];function po(e){return e.replace(/left|right|bottom|top/g,e=>Yi[e])}function mo(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function yo(e,t,n){let{reference:r,floating:i}=e;const o=oo(t),s=so(t),a=ro(s),c=eo(t),l="y"===o,u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let d;switch(c){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:h};break;case"left":d={x:r.x-i.width,y:h};break;default:d={x:r.x,y:r.y}}switch(to(t)){case"start":d[s]-=f*(n&&l?-1:1);break;case"end":d[s]+=f*(n&&l?-1:1)}return d}async function go(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=Qi(t,e),p=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(d),m=a[f?"floating"===h?"reference":"floating":h],y=mo(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(m)))||n?m:m.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),g="floating"===h?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),b=await(null==o.isElement?void 0:o.isElement(v))&&await(null==o.getScale?void 0:o.getScale(v))||{x:1,y:1},w=mo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:v,strategy:c}):g);return{top:(y.top-w.top+p.top)/b.y,bottom:(w.bottom-y.bottom+p.bottom)/b.y,left:(y.left-w.left+p.left)/b.x,right:(w.right-y.right+p.right)/b.x}}const vo=new Set(["left","top"]);function bo(){return"undefined"!=typeof window}function wo(e){return So(e)?(e.nodeName||"").toLowerCase():"#document"}function Oo(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function To(e){var t;return null==(t=(So(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function So(e){return!!bo()&&(e instanceof Node||e instanceof Oo(e).Node)}function ko(e){return!!bo()&&(e instanceof Element||e instanceof Oo(e).Element)}function Eo(e){return!!bo()&&(e instanceof HTMLElement||e instanceof Oo(e).HTMLElement)}function Po(e){return!(!bo()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Oo(e).ShadowRoot)}const Co=new Set(["inline","contents"]);function Ao(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Vo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Co.has(i)}const jo=new Set(["table","td","th"]);function xo(e){return jo.has(wo(e))}const Mo=[":popover-open",":modal"];function _o(e){return Mo.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Io=["transform","translate","scale","rotate","perspective"],Lo=["transform","translate","scale","rotate","perspective","filter"],No=["paint","layout","strict","content"];function Ro(e){const t=Do(),n=ko(e)?Vo(e):e;return Io.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Lo.some(e=>(n.willChange||"").includes(e))||No.some(e=>(n.contain||"").includes(e))}function Do(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Fo=new Set(["html","body","#document"]);function Bo(e){return Fo.has(wo(e))}function Vo(e){return Oo(e).getComputedStyle(e)}function qo(e){return ko(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Uo(e){if("html"===wo(e))return e;const t=e.assignedSlot||e.parentNode||Po(e)&&e.host||To(e);return Po(t)?t.host:t}function zo(e){const t=Uo(e);return Bo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Eo(t)&&Ao(t)?t:zo(t)}function Wo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=zo(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),s=Oo(i);if(o){const e=Ho(s);return t.concat(s,s.visualViewport||[],Ao(i)?i:[],e&&n?Wo(e):[])}return t.concat(i,Wo(i,[],n))}function Ho(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $o(e){const t=Vo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Eo(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Ki(n)!==o||Ki(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Ko(e){return ko(e)?e:e.contextElement}function Go(e){const t=Ko(e);if(!Eo(t))return Ji(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=$o(t);let s=(o?Ki(n.width):n.width)/r,a=(o?Ki(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Jo=Ji(0);function Yo(e){const t=Oo(e);return Do()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Jo}function Zo(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=Ko(e);let s=Ji(1);t&&(r?ko(r)&&(s=Go(r)):s=Go(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Oo(e))&&t}(o,n,r)?Yo(o):Ji(0);let c=(i.left+a.x)/s.x,l=(i.top+a.y)/s.y,u=i.width/s.x,h=i.height/s.y;if(o){const e=Oo(o),t=r&&ko(r)?Oo(r):r;let n=e,i=Ho(n);for(;i&&r&&t!==n;){const e=Go(i),t=i.getBoundingClientRect(),r=Vo(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,h*=e.y,c+=o,l+=s,n=Oo(i),i=Ho(n)}}return mo({width:u,height:h,x:c,y:l})}function Xo(e,t){const n=qo(e).scrollLeft;return t?t.left+n:Zo(To(e)).left+n}function Qo(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:Xo(e,r)),y:r.top+t.scrollTop}}const es=new Set(["absolute","fixed"]);function ts(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Oo(e),r=To(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const e=Do();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}(e,n);else if("document"===t)r=function(e){const t=To(e),n=qo(e),r=e.ownerDocument.body,i=$i(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=$i(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Xo(e);const a=-n.scrollTop;return"rtl"===Vo(r).direction&&(s+=$i(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}(To(e));else if(ko(t))r=function(e,t){const n=Zo(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Eo(e)?Go(e):Ji(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:r*o.y}}(t,n);else{const n=Yo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return mo(r)}function ns(e,t){const n=Uo(e);return!(n===t||!ko(n)||Bo(n))&&("fixed"===Vo(n).position||ns(n,t))}function rs(e,t,n){const r=Eo(t),i=To(t),o="fixed"===n,s=Zo(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Ji(0);function l(){c.x=Xo(i)}if(r||!r&&!o)if(("body"!==wo(t)||Ao(i))&&(a=qo(t)),r){const e=Zo(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();o&&!r&&i&&l();const u=!i||r||o?Ji(0):Qo(i,a);return{x:s.left+a.scrollLeft-c.x-u.x,y:s.top+a.scrollTop-c.y-u.y,width:s.width,height:s.height}}function is(e){return"static"===Vo(e).position}function os(e,t){if(!Eo(e)||"fixed"===Vo(e).position)return null;if(t)return t(e);let n=e.offsetParent;return To(e)===n&&(n=n.ownerDocument.body),n}function ss(e,t){const n=Oo(e);if(_o(e))return n;if(!Eo(e)){let t=Uo(e);for(;t&&!Bo(t);){if(ko(t)&&!is(t))return t;t=Uo(t)}return n}let r=os(e,t);for(;r&&xo(r)&&is(r);)r=os(r,t);return r&&Bo(r)&&is(r)&&!Ro(r)?n:r||function(e){let t=Uo(e);for(;Eo(t)&&!Bo(t);){if(Ro(t))return t;if(_o(t))return null;t=Uo(t)}return null}(e)||n}const as={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o="fixed"===i,s=To(r),a=!!t&&_o(t.floating);if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=Ji(1);const u=Ji(0),h=Eo(r);if((h||!h&&!o)&&(("body"!==wo(r)||Ao(s))&&(c=qo(r)),Eo(r))){const e=Zo(r);l=Go(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!s||h||o?Ji(0):Qo(s,c,!0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}},getDocumentElement:To,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[..."clippingAncestors"===n?_o(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Wo(e,[],!1).filter(e=>ko(e)&&"body"!==wo(e)),i=null;const o="fixed"===Vo(e).position;let s=o?Uo(e):e;for(;ko(s)&&!Bo(s);){const t=Vo(s),n=Ro(s);n||"fixed"!==t.position||(i=null),(o?!n&&!i:!n&&"static"===t.position&&i&&es.has(i.position)||Ao(s)&&!n&&ns(e,s))?r=r.filter(e=>e!==s):i=t,s=Uo(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=o[0],a=o.reduce((e,n)=>{const r=ts(t,n,i);return e.top=$i(r.top,e.top),e.right=Hi(r.right,e.right),e.bottom=Hi(r.bottom,e.bottom),e.left=$i(r.left,e.left),e},ts(t,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:ss,getElementRects:async function(e){const t=this.getOffsetParent||ss,n=this.getDimensions,r=await n(e.floating);return{reference:rs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=$o(e);return{width:t,height:n}},getScale:Go,isElement:ko,isRTL:function(e){return"rtl"===Vo(e).direction}};function cs(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const ls=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await async function(e,t){const{placement:n,platform:r,elements:i}=e,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),s=eo(n),a=to(n),c="y"===oo(n),l=vo.has(s)?-1:1,u=o&&c?-1:1,h=Qi(t,e);let{mainAxis:f,crossAxis:d,alignmentAxis:p}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&"number"==typeof p&&(d="end"===a?-1*p:p),c?{x:d*u,y:f*l}:{x:f*l,y:d*u}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},us=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:o,middlewareData:s,placement:a,platform:c,elements:l}=t,{crossAxis:u=!1,alignment:h,allowedPlacements:f=Wi,autoAlignment:d=!0,...p}=Qi(e,t),m=void 0!==h||f===Wi?function(e,t,n){return(e?[...n.filter(t=>to(t)===e),...n.filter(t=>to(t)!==e)]:n.filter(e=>eo(e)===e)).filter(n=>!e||to(n)===e||!!t&&co(n)!==n)}(h||null,d,f):f,y=await go(t,p),g=(null==(n=s.autoPlacement)?void 0:n.index)||0,v=m[g];if(null==v)return{};const b=ao(v,o,await(null==c.isRTL?void 0:c.isRTL(l.floating)));if(a!==v)return{reset:{placement:m[0]}};const w=[y[eo(v)],y[b[0]],y[b[1]]],O=[...(null==(r=s.autoPlacement)?void 0:r.overflows)||[],{placement:v,overflows:w}],T=m[g+1];if(T)return{data:{index:g+1,overflows:O},reset:{placement:T}};const S=O.map(e=>{const t=to(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),k=(null==(i=S.filter(e=>e[2].slice(0,to(e[0])?2:3).every(e=>e<=0))[0])?void 0:i[0])||S[0][0];return k!==a?{data:{index:g+1,overflows:O},reset:{placement:k}}:{}}}},hs=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Qi(e,t),l={x:n,y:r},u=await go(t,c),h=oo(eo(i)),f=no(h);let d=l[f],p=l[h];if(o){const e="y"===f?"bottom":"right";d=Xi(d+u["y"===f?"top":"left"],d,d-u[e])}if(s){const e="y"===h?"bottom":"right";p=Xi(p+u["y"===h?"top":"left"],p,p-u[e])}const m=a.fn({...t,[f]:d,[h]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:o,[h]:s}}}}}},fs=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Qi(e,t);if(null!=(n=o.arrow)&&n.alignmentOffset)return{};const g=eo(i),v=oo(a),b=eo(a)===a,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),O=f||(b||!m?[po(a)]:function(e){const t=po(e);return[co(e),t,co(t)]}(a)),T="none"!==p;!f&&T&&O.push(...function(e,t,n,r){const i=to(e);let o=function(e,t,n){switch(e){case"top":case"bottom":return n?t?uo:lo:t?lo:uo;case"left":case"right":return t?ho:fo;default:return[]}}(eo(e),"start"===n,r);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(co)))),o}(a,m,p,w));const S=[a,...O],k=await go(t,y),E=[];let P=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&E.push(k[g]),h){const e=ao(i,s,w);E.push(k[e[0]],k[e[1]])}if(P=[...P,{placement:i,overflows:E}],!E.every(e=>e<=0)){var C,A;const e=((null==(C=o.flip)?void 0:C.index)||0)+1,t=S[e];if(t&&("alignment"!==h||v===oo(t)||P.every(e=>oo(e.placement)!==v||e.overflows[0]>0)))return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(A=P.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!n)switch(d){case"bestFit":{var j;const e=null==(j=P.filter(e=>{if(T){const t=oo(e.placement);return t===v||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}};var ds=e=>{Object.assign(e,{show(){var e;null===(e=this.cancelBehaviourOpen)||void 0===e||e.call(this),this.openValue=!0},hide(){this.openValue=!1},toggle(){var e;null===(e=this.cancelBehaviourOpen)||void 0===e||e.call(this),this.openValue=!this.openValue},setupFloatingUI(e){var{trigger:t,popover:n,strategy:r}=e;this.floatingUICleanup=function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,l=Ko(e),u=i||o?[...l?Wo(l):[],...Wo(t)]:[];u.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),o&&e.addEventListener("resize",n)});const h=l&&a?function(e,t){let n,r=null;const i=To(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,c){void 0===a&&(a=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:u,top:h,width:f,height:d}=l;if(a||t(),!f||!d)return;const p={rootMargin:-Gi(h)+"px "+-Gi(i.clientWidth-(u+f))+"px "+-Gi(i.clientHeight-(h+d))+"px "+-Gi(u)+"px",threshold:$i(0,Hi(1,c))||1};let m=!0;function y(t){const r=t[0].intersectionRatio;if(r!==c){if(!m)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||cs(l,e.getBoundingClientRect())||s(),m=!1}try{r=new IntersectionObserver(y,{...p,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(y,p)}r.observe(e)}(!0),o}(l,n):null;let f,d=-1,p=null;s&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m=c?Zo(e):null;return c&&function t(){const r=Zo(e);m&&!cs(m,r)&&n(),m=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",n),o&&e.removeEventListener("resize",n)}),null==h||h(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(f)}}(t,n,()=>{((e,t,n)=>{const r=new Map,i={platform:as,...n},o={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=yo(l,r,c),f=r,d={},p=0;for(let n=0;n<a.length;n++){const{name:o,fn:m}=a[n],{x:y,y:g,data:v,reset:b}=await m({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:d,rects:l,platform:s,elements:{reference:e,floating:t}});u=null!=y?y:u,h=null!=g?g:h,d={...d,[o]:{...d[o],...v}},b&&p<=50&&(p++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:u,y:h}=yo(l,f,c))),n=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:d}})(e,t,{...i,platform:o})})(t,n,{placement:this.placementValue,middleware:this.middlewares,strategy:r||H.webchat.strategy}).then(e=>{var{x:t,y:r,strategy:i}=e,o={left:"".concat(t,"px"),top:"".concat(r,"px"),position:i};Object.assign(n.style,o)})})},openValueChanged(){var e;this.disabledValue||(this.openValue?(null===(e=this.preparePopoverOpenAnimation)||void 0===e||e.call(this),this.popoverTarget.showPopover(),this.popoverTarget.setAttribute("aria-expanded","true"),this.onPopoverOpened&&this.onPopoverOpened()):(this.popoverTarget.hidePopover(),this.popoverTarget.removeAttribute("aria-expanded"),this.onPopoverClosed&&this.onPopoverClosed()))}})};function ps(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ms(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){ps(o,r,i,s,a,"next",e)}function a(e){ps(o,r,i,s,a,"throw",e)}s(void 0)})}}function ys(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,gs(r.key),r)}}function gs(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function vs(){return vs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ws(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},vs.apply(this,arguments)}function bs(e,t){return bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},bs(e,t)}function ws(e){return ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ws(e)}var Os=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bs(e,t)}(u,e);var t,r,i,o,s,a,c,l=(a=u,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=ws(a);if(c){var n=ws(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function u(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),l.apply(this,arguments)}return t=u,r=[{key:"initialize",value:function(){this.onEmojiSelect=this.onEmojiSelect.bind(this),this.pickerLoaded=!1,this.pickerLoadPromise=null,this.connected=!1,vs(ws(u.prototype),"initialize",this).call(this)}},{key:"connect",value:function(){this.connected=!0,ds(this),this.setupFloatingUI({trigger:this.buttonTarget,popover:this.popoverTarget,strategy:"absolute"}),vs(ws(u.prototype),"connect",this).call(this)}},{key:"disconnect",value:function(){this.connected=!1,this.pickerLoadPromise=null,this.floatingUICleanup(),vs(ws(u.prototype),"disconnect",this).call(this)}},{key:"onEmojiSelect",value:function(e){this.dispatch("selected",{detail:e.native}),this.hide()}},{key:"onClickOutside",value:function(e){this.openValue&&e.target.nodeType&&!1===this.element.contains(e.target)&&(this.openValue=!1)}},{key:"onPopoverOpened",value:(s=ms(function*(){yield this.loadPicker()}),function(){return s.apply(this,arguments)})},{key:"loadPicker",value:(o=ms(function*(){if(!this.pickerLoaded){this.pickerLoadPromise||(this.pickerLoadPromise=this.loadPickerDependencies());var{Picker:e,i18n:t}=yield this.pickerLoadPromise;this.connected&&!this.pickerLoaded&&(this.popoverTarget.appendChild(this.buildPicker(e,t)),this.pickerLoaded=!0)}}),function(){return o.apply(this,arguments)})},{key:"loadPickerDependencies",value:(i=ms(function*(){var[e,t]=yield Promise.all([n.e(160).then(n.bind(n,405)),this.loadI18n()]);return{Picker:e.Picker,i18n:t.default||t}}),function(){return i.apply(this,arguments)})},{key:"loadI18n",value:function(){return"es"===Hellotext.business.locale?n.e(437).then(n.t.bind(n,9,19)):n.e(200).then(n.t.bind(n,714,19))}},{key:"buildPicker",value:function(e,t){return new e({onEmojiSelect:this.onEmojiSelect,theme:"light",dynamicWidth:!0,previewPosition:"none",skinTonePosition:"none",emojiSize:this.sizeValue,perLine:this.perLineValue,i18n:t})}},{key:"middlewares",get:function(){return[ls(5),hs({padding:24}),us({allowedPlacements:["top","bottom"]})]}}],r&&ys(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(g.xI);function Ts(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ss(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Ts(o,r,i,s,a,"next",e)}function a(e){Ts(o,r,i,s,a,"throw",e)}s(void 0)})}}function ks(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,Es(r.key),r)}}function Es(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Os.targets=["button","popover"],Os.values={placement:{type:String,default:"bottom-end"},open:{type:Boolean,default:!1},autoPlacement:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},size:{type:Number,default:24},perLine:{type:Number,default:9}};var Ps=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.webchatId=t}var t,n,r,i,o;return t=e,n=[{key:"index",value:(o=Ss(function*(e){var t=new URL(this.url);return Object.entries(e).forEach(e=>{var[n,r]=e;t.searchParams.append(n,r)}),yield fetch(t,{method:"GET",headers:Ci.headers})}),function(e){return o.apply(this,arguments)})},{key:"catchUp",value:function(e){return this.index({after_id:e,session:Ci.session})}},{key:"create",value:(i=Ss(function*(e){var t=yield fetch(this.url,{method:"POST",headers:{Authorization:"Bearer ".concat(Ci.business.id)},body:e});return new ve(t.ok,t)}),function(e){return i.apply(this,arguments)})},{key:"markAsSeen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e?this.url+"/".concat(e):this.url+"/seen";fetch(t,{method:"PATCH",headers:Ci.headers,body:JSON.stringify({session:Ci.session})})}},{key:"url",get:function(){return e.endpoint.replace(":id",this.webchatId)}}],r=[{key:"endpoint",get:function(){return H.endpoint("public/webchats/:id/messages")}}],n&&ks(t.prototype,n),r&&ks(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Cs=Ps;function As(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,js(r.key),r)}}function js(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var xs=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),e.channels.add(this)}var t,n,r;return t=e,n=[{key:"send",value:function(t){var{command:n,identifier:r,data:i}=t,o={command:n,identifier:JSON.stringify(r),data:JSON.stringify(i||{})},s=e.ensureWebSocket(),a=JSON.stringify(o);s.readyState===WebSocket.OPEN?s.send(a):s.addEventListener("open",()=>{s.send(a)})}},{key:"onMessage",value:function(t){var n=e=>{var n=JSON.parse(e.data),{type:r,message:i}=n;this.ignoredEvents.includes(r)||t(i)};e.messageHandlers.add(n),e.ensureWebSocket().addEventListener("message",n)}},{key:"onDisconnect",value:function(t){e.disconnectHandlers.add(t)}},{key:"onSubscriptionConfirmed",value:function(t){e.subscriptionConfirmHandlers.add(t)}},{key:"webSocket",get:function(){return e.ensureWebSocket()}},{key:"ignoredEvents",get:function(){return["ping","confirm_subscription","welcome"]}}],r=[{key:"ensureWebSocket",value:function(){return this.webSocket&&!this.closedWebSocket(this.webSocket)?this.webSocket:(this.webSocket&&(this.needsResubscribe=!0),this.openWebSocket())}},{key:"openWebSocket",value:function(){this.clearReconnectTimeout();var e=new WebSocket(H.actionCableUrl);return this.webSocket=e,this.installWebSocketHandlers(e),e}},{key:"installWebSocketHandlers",value:function(e){e.addEventListener("open",()=>this.handleOpen(e)),e.addEventListener("close",()=>this.handleDisconnect(e)),e.addEventListener("error",()=>this.handleDisconnect(e)),e.addEventListener("message",e=>this.handleControlMessage(e)),this.messageHandlers.forEach(t=>{e.addEventListener("message",t)})}},{key:"handleOpen",value:function(e){e===this.webSocket&&(this.reconnectAttempts=0,this.needsResubscribe&&(this.needsResubscribe=!1,this.resubscribeChannels()))}},{key:"handleControlMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(e){return}"confirm_subscription"===t.type&&this.subscriptionConfirmHandlers.forEach(e=>e(t.identifier))}},{key:"handleDisconnect",value:function(e){e===this.webSocket&&(this.disconnectHandlers.forEach(e=>e()),this.webSocket=null,this.needsResubscribe=!0,this.scheduleReconnect())}},{key:"scheduleReconnect",value:function(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.reconnectAttempts+=1,this.openWebSocket()},this.reconnectDelay))}},{key:"clearReconnectTimeout",value:function(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}},{key:"resubscribeChannels",value:function(){this.channels.forEach(e=>{var t=e.resubscribe||e.subscribe;"function"==typeof t&&t.call(e)})}},{key:"closedWebSocket",value:function(e){return e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING}},{key:"reconnectDelay",get:function(){var e=Math.min(this.reconnectMaxDelay,this.reconnectBaseDelay*2**this.reconnectAttempts);return e+Math.round(e*this.reconnectJitter*Math.random())}}],n&&As(t.prototype,n),r&&As(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ms(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,_s(r.key),r)}}function _s(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Is(){return Is="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ns(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Is.apply(this,arguments)}function Ls(e,t){return Ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ls(e,t)}function Ns(e){return Ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ns(e)}xs.webSocket=void 0,xs.channels=new Set,xs.messageHandlers=new Set,xs.disconnectHandlers=new Set,xs.subscriptionConfirmHandlers=new Set,xs.reconnectTimeout=null,xs.reconnectAttempts=0,xs.reconnectBaseDelay=500,xs.reconnectMaxDelay=1e4,xs.reconnectJitter=.3,xs.needsResubscribe=!1;var Rs=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ls(e,t)}(s,e);var t,n,r,i,o=(r=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Ns(r);if(i){var n=Ns(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(e,t,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this)).id=e,r.session=t,r.conversation=n,r.subscribed=!1,r.awaitingReconnectConfirmation=!1,r.reconnectCallbacks=new Set,r.onSubscriptionConfirmed(e=>r.handleSubscriptionConfirmed(e)),r.subscribe(),r}return t=s,(n=[{key:"subscribe",value:function(){this.subscribed=!0;var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"subscribe",identifier:e})}},{key:"unsubscribe",value:function(){this.subscribed=!1;var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"unsubscribe",identifier:e})}},{key:"resubscribe",value:function(){!1!==this.subscribed&&(this.awaitingReconnectConfirmation=!0,this.subscribe())}},{key:"onReconnect",value:function(e){this.reconnectCallbacks.add(e)}},{key:"handleSubscriptionConfirmed",value:function(e){this.awaitingReconnectConfirmation&&this.matchesIdentifier(e)&&(this.awaitingReconnectConfirmation=!1,this.reconnectCallbacks.forEach(e=>e()))}},{key:"matchesIdentifier",value:function(e){var t;try{t="string"==typeof e?JSON.parse(e):e}catch(e){return!1}return"WebchatChannel"===t.channel&&t.id===this.id&&t.session===this.session&&t.conversation===this.conversation}},{key:"startTypingIndicator",value:function(){var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"message",identifier:e,data:{action:"started_typing"}})}},{key:"stopTypingIndicator",value:function(){var e={channel:"WebchatChannel",id:this.id,session:this.session,conversation:this.conversation};this.send({command:"typing:stop",identifier:e,data:{action:"stopped_typing"}})}},{key:"onMessage",value:function(e){Is(Ns(s.prototype),"onMessage",this).call(this,t=>{"message"===t.type&&e(t)})}},{key:"onReaction",value:function(e){Is(Ns(s.prototype),"onMessage",this).call(this,t=>{"reaction.create"!==t.type&&"reaction.destroy"!==t.type||e(t)})}},{key:"onTypingStart",value:function(e){Is(Ns(s.prototype),"onMessage",this).call(this,t=>{"started_typing"===t.type&&e(t)})}},{key:"updateSubscriptionWith",value:function(e){this.unsubscribe(),setTimeout(()=>{this.conversation=e,this.subscribe()},1e3)}}])&&Ms(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(xs);const Ds=Rs;var Fs=e=>{Object.assign(e,{scheduleBehaviourOpen(){if(this.shouldAutoOpenFromBehaviour()){var e=1e3*Number(this.behaviourValue.delay_seconds||0);this.behaviourOpenTimeout=window.setTimeout(()=>{this.behaviourOpenTimeout=null,this.openValue||(this.openValue=!0,this.markBehaviourAutoOpened())},e)}},cancelBehaviourOpen(){window.clearTimeout(this.behaviourOpenTimeout),this.behaviourOpenTimeout=null},shouldAutoOpenFromBehaviour(){var e=this.behaviourValue;return!(!e||"on_load"!==e.trigger||e.first_visit_only&&localStorage.getItem(this.firstVisitKey())||e.once_per_session&&sessionStorage.getItem(this.sessionKey()))},markBehaviourAutoOpened(){this.behaviourValue.first_visit_only&&localStorage.setItem(this.firstVisitKey(),"1"),this.behaviourValue.once_per_session&&sessionStorage.setItem(this.sessionKey(),"1")},firstVisitKey(){return"hellotext--webchat--".concat(this.idValue,"--auto-opened")},sessionKey(){return"hellotext--webchat--".concat(this.idValue,"--auto-opened-session")}})},Bs=e=>{Object.assign(e,{setupOpeningSequence(){this.openingSequenceStarted=!1,this.openingSequenceCancelled=!1,this.openingSequenceTimeout=null,this.openingSequenceMessages=[],this.revealedOpeningSequenceMessageIds=[]},teardownOpeningSequence(){this.cancelOpeningSequence()},startOpeningSequence(){this.openingSequenceMessages=Array.from(this.openingSequenceMessageTargets||[]),this.openingSequenceCanStart()&&(this.openingSequenceStarted=!0,this.openingSequenceCancelled=!1,this.revealedOpeningSequenceMessageIds=[],this.playOpeningSequenceMessageAt(0))},openingSequenceCanStart(){return!this.conversationIdValue&&this.hasOpeningSequenceTarget&&this.openingSequenceMessages.length>0&&!this.openingSequenceStarted},playOpeningSequenceMessageAt(e){var t=this.openingSequenceMessages[e];if(t){var n=1e3*this.openingSequenceMessageDelay(t);this.openingSequenceTimeout=window.setTimeout(()=>{this.openingSequenceTimeout=null,this.openingSequenceCancelled||(this.revealOpeningSequenceMessage(t),this.playOpeningSequenceMessageAt(e+1))},n)}},revealOpeningSequenceMessage(e){this.messagesContainerTarget.insertBefore(e,this.messageTemplateTarget),e.hidden=!1,this.recordOpeningSequenceMessage(e),this.scrollOpeningSequenceToBottom()},recordOpeningSequenceMessage(e){var t=e.dataset.openingSequenceMessageId;t&&!this.revealedOpeningSequenceMessageIds.includes(t)&&this.revealedOpeningSequenceMessageIds.push(t)},openingSequenceMessageDelay(e){var t=Number(e.dataset.delaySeconds||0);return Number.isFinite(t)?t:0},scrollOpeningSequenceToBottom(){this.messagesContainerTarget.scroll&&this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight,behavior:"smooth"})},cancelOpeningSequence(){this.openingSequenceCancelled=!0,null!==this.openingSequenceTimeout&&void 0!==this.openingSequenceTimeout&&(window.clearTimeout(this.openingSequenceTimeout),this.openingSequenceTimeout=null)},appendOpeningSequenceMessageIds(e){this.cancelOpeningSequence(),(this.revealedOpeningSequenceMessageIds||[]).forEach(t=>{e.append("message[opening_sequence_message_ids][]",t)})},clearRevealedOpeningSequenceMessageIds(){this.revealedOpeningSequenceMessageIds=[]}})},Vs=e=>{Object.assign(e,{setupTeaser(){this.teaserCycleTimeout=null,this.teaserMessages=[],this.boundOnTeaserClick=this.boundOnTeaserClick||this.onTeaserClick.bind(this),this.hasTeaserTarget&&(this.teaserTarget.addEventListener("click",this.boundOnTeaserClick),this.startTeaserPresentation())},teardownTeaser(){this.stopTeaserCycle(),this.hasTeaserTarget&&this.boundOnTeaserClick&&this.teaserTarget.removeEventListener("click",this.boundOnTeaserClick)},collectTeaserMessages(){return this.hasTeaserTarget?Array.from(this.teaserTarget.querySelectorAll("[data-teaser-message]")):[]},startTeaserPresentation(){this.stopTeaserCycle(),this.teaserMessages=this.collectTeaserMessages(),this.hasTeaserTarget&&(0!==this.teaserMessages.length?this.openValue||this.conversationIdValue||this.hasRenderedConversationMessages()?this.dismissTeaserForSession():this.teaserSeenForSession()?this.hideTeaser():(this.teaserTarget.classList.remove("invisible"),this.showTeaserMessage(0),this.teaserMessages.length<2||this.scheduleNextTeaserMessage(0)):this.hideTeaser())},scheduleNextTeaserMessage(e){var t=e+1;if(!(t>=this.teaserMessages.length)){var n=this.teaserMessages[e],r=this.teaserPresentationDelay(n);this.teaserCycleTimeout=window.setTimeout(()=>{this.teaserCycleTimeout=null,this.showTeaserMessage(t),this.scheduleNextTeaserMessage(t)},r)}},showTeaserMessage(e){this.teaserMessages.forEach((t,n)=>{t.classList.toggle("hidden",n!==e)})},stopTeaserCycle(){null!==this.teaserCycleTimeout&&void 0!==this.teaserCycleTimeout&&(window.clearTimeout(this.teaserCycleTimeout),this.teaserCycleTimeout=null)},teaserMessageDelay(e){var t=Number(e.dataset.delaySeconds||0);return Number.isFinite(t)?t:0},teaserPresentationDelay(e){return Math.max(1e3*this.teaserMessageDelay(e),250)},hasRenderedConversationMessages(){var e=[];try{e=Array.from(this.messageTargets||[])}catch(t){e=[]}return e.some(e=>e!==this.messageTemplateTarget)},teaserSeenKey(){var e=this.hasTeaserTarget?this.teaserTarget.dataset.teaserVersion:"",t=e?":".concat(e):"";return"hellotext:webchat:".concat(this.idValue||this.element.id,":teaser-seen").concat(t)},teaserSeenForSession(){try{return"true"===window.sessionStorage.getItem(this.teaserSeenKey())}catch(e){return!1}},markTeaserSeenForSession(){try{window.sessionStorage.setItem(this.teaserSeenKey(),"true")}catch(e){}},dismissTeaserForSession(){this.markTeaserSeenForSession(),this.hideTeaser()},hideTeaser(){this.stopTeaserCycle(),this.hasTeaserTarget&&this.teaserTarget.classList.add("invisible")},onTeaserClick(e){e.target.closest("a")||(this.dismissTeaserForSession(),this.show())}})};function qs(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 Us(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qs(Object(n),!0).forEach(function(t){zs(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zs(e,t,n){return(t=Ks(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ws(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Hs(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){Ws(o,r,i,s,a,"next",e)}function a(e){Ws(o,r,i,s,a,"throw",e)}s(void 0)})}}function $s(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,Ks(r.key),r)}}function Ks(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Gs(){return Gs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ys(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Gs.apply(this,arguments)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Js(e,t)}function Ys(e){return Ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ys(e)}var Zs={hour:"numeric",minute:"2-digit"},Xs=/Android|iPhone|iPad|iPod/i,Qs={capture:!0,passive:!0},ea=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Js(e,t)}(p,e);var t,n,r,i,o,s,a,c,l,u,h,f,d=(h=p,f=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,t=Ys(h);if(f){var n=Ys(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function p(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),d.apply(this,arguments)}return t=p,n=[{key:"initialize",value:function(){this.messagesAPI=new Cs(this.idValue),this.webChatChannel=new Ds(this.idValue,Ci.session,this.conversationIdValue),this.files=[],this.messageIds=new Set,this.catchUpAfterMessageId=null,this.fetchingCatchUpMessages=!1,this.onMessageReceived=this.onMessageReceived.bind(this),this.onMessageReaction=this.onMessageReaction.bind(this),this.onTypingStart=this.onTypingStart.bind(this),this.captureCatchUpCursor=this.captureCatchUpCursor.bind(this),this.catchUpMessages=this.catchUpMessages.bind(this),this.onScroll=this.onScroll.bind(this),this.onOutboundMessageSent=this.onOutboundMessageSent.bind(this),this.closePopoverOnEscape=this.closePopoverOnEscape.bind(this),this.broadcastChannel=new BroadcastChannel("hellotext--webchat--".concat(this.idValue)),this.webChatChannel.onDisconnect(this.captureCatchUpCursor),this.webChatChannel.onReconnect(this.catchUpMessages),Gs(Ys(p.prototype),"initialize",this).call(this)}},{key:"connect",value:function(){Fs(this),ds(this),Bs(this),Vs(this),this.setupFloatingUI({trigger:this.triggerTarget,popover:this.popoverTarget}),this.hasTeaserTarget&&this.setupFloatingUI({trigger:this.triggerTarget,popover:this.teaserTarget,strategy:"absolute"}),this.setupTeaser(),this.setupOpeningSequence(),this.localizeMessageTimestamps(),this.webChatChannel.onMessage(this.onMessageReceived),this.webChatChannel.onTypingStart(this.onTypingStart),this.webChatChannel.onReaction(this.onMessageReaction),this.setupMessagesContainerScrollIsolation(),this.messagesContainerTarget.addEventListener("scroll",this.onScroll),this.messagesContainerTarget.addEventListener("wheel",this.stopHostScrollPropagation,Qs),this.messagesContainerTarget.addEventListener("touchmove",this.stopHostScrollPropagation,Qs),this.shouldOpenOnMount&&(this.openValue=!0),Ci.eventEmitter.dispatch("webchat:mounted"),this.broadcastChannel.addEventListener("message",this.onOutboundMessageSent),window.addEventListener("keydown",this.closePopoverOnEscape,!0),this.scheduleBehaviourOpen(),Gs(Ys(p.prototype),"connect",this).call(this)}},{key:"disconnect",value:function(){this.cancelBehaviourOpen(),this.clearPopoverOpenAnimation(),this.teardownTeaser(),this.teardownOpeningSequence(),this.broadcastChannel.removeEventListener("message",this.onOutboundMessageSent),this.messagesContainerTarget.removeEventListener("scroll",this.onScroll),this.messagesContainerTarget.removeEventListener("wheel",this.stopHostScrollPropagation,Qs),this.messagesContainerTarget.removeEventListener("touchmove",this.stopHostScrollPropagation,Qs),window.removeEventListener("keydown",this.closePopoverOnEscape,!0),this.clearTypingIndicator(),this.broadcastChannel.close(),this.floatingUICleanup(),Gs(Ys(p.prototype),"disconnect",this).call(this)}},{key:"setupMessagesContainerScrollIsolation",value:function(){this.messagesContainerTarget.style.overscrollBehavior="contain",this.messagesContainerTarget.style.webkitOverflowScrolling="touch",this.messagesContainerTarget.style.touchAction="pan-y",this.messagesContainerTarget.setAttribute("data-lenis-prevent",""),this.messagesContainerTarget.setAttribute("data-lenis-prevent-wheel",""),this.messagesContainerTarget.setAttribute("data-lenis-prevent-touch","")}},{key:"stopHostScrollPropagation",value:function(e){e.stopPropagation()}},{key:"onTypingStart",value:function(){if(this.typingIndicatorVisible)return this.resetTypingIndicatorTimer();this.showTypingIndicator()}},{key:"showOptimisticTypingIndicator",value:function(){this.typingIndicatorVisible||this.showTypingIndicator()}},{key:"showTypingIndicator",value:function(){this.clearTypingIndicator(),this.typingIndicatorVisible=!0;var e=this.typingIndicatorTemplateTarget.cloneNode(!0);e.setAttribute("data-hellotext--webchat-target","typingIndicator"),e.style.display="flex",this.messagesContainerTarget.appendChild(e),requestAnimationFrame(()=>{this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight,behavior:"instant"})});var t=this.typingIndicatorKeepAliveValue;this.incomingTypingIndicatorTimeout=setTimeout(()=>{this.clearTypingIndicator()},t)}},{key:"resetTypingIndicatorTimer",value:function(){if(this.typingIndicatorVisible){clearTimeout(this.incomingTypingIndicatorTimeout),clearTimeout(this.optimisticTypingTimeout);var e=this.typingIndicatorKeepAliveValue;this.incomingTypingIndicatorTimeout=setTimeout(()=>{this.clearTypingIndicator()},e)}}},{key:"clearTypingIndicator",value:function(){this.hasTypingIndicatorTarget&&this.typingIndicatorTarget.remove(),this.typingIndicatorVisible=!1,clearTimeout(this.incomingTypingIndicatorTimeout),clearTimeout(this.optimisticTypingTimeout)}},{key:"onMessageInputChange",value:function(){this.resizeInput(),clearTimeout(this.typingIndicatorTimeout),this.hasSentTypingIndicator||(this.webChatChannel.startTypingIndicator(),this.hasSentTypingIndicator=!0),this.typingIndicatorTimeout=setTimeout(()=>{this.hasSentTypingIndicator=!1},3e3)}},{key:"onOutboundMessageSent",value:function(e){var{data:t}=e,n={"message:sent":e=>{var t=(new DOMParser).parseFromString(e.element,"text/html").body.firstElementChild;this.localizeMessageTimestamps(t),this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(t,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(t),t.scrollIntoView({behavior:"instant"})},"message:failed":e=>{var t=this.messagesContainerTarget.querySelector("#".concat(e.id));this.markMessageFailed(t,e.reason)}};n[t.type]?n[t.type](t):console.log("Unhandled message event: ".concat(t.type))}},{key:"onScroll",value:(u=Hs(function*(){if(!(this.messagesContainerTarget.scrollTop>300||!this.nextPageValue||this.fetchingNextPage)){this.fetchingNextPage=!0;var e=yield this.messagesAPI.index({page:this.nextPageValue,session:Ci.session}),{next:t,messages:n}=yield e.json();this.nextPageValue=t,this.oldScrollHeight=this.messagesContainerTarget.scrollHeight,n.forEach(e=>{var{body:t,attachments:n}=e,r=e.created_at||e.createdAt,i=this.messageTemplateTarget.cloneNode(!0);i.classList.add("hellotext--webchat-message"),i.setAttribute("data-hellotext--webchat-target","message"),i.setAttribute("data-id",e.id),r&&i.setAttribute("data-created-at",r),i.style.removeProperty("display"),gr(i.querySelector("[data-body]"),t),"received"===e.state?i.classList.add("received"):i.classList.remove("received"),n&&n.forEach(e=>{var t,n=this.attachmentImageTarget.cloneNode(!0);n.removeAttribute("data-hellotext--webchat-target"),n.src=e,n.style.display="block",null===(t=this.messageAttachmentsContainer(i))||void 0===t||t.appendChild(n)}),i.setAttribute("data-body",t),this.localizeMessageTimestamp(i.querySelector("[data-message-timestamp]"),r),this.messagesContainerTarget.prepend(i)}),this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight-this.oldScrollHeight,behavior:"instant"}),this.fetchingNextPage=!1}}),function(){return u.apply(this,arguments)})},{key:"onClickOutside",value:function(e){N.mode===L.POPOVER&&this.openValue&&e.target.nodeType&&!1===this.element.contains(e.target)&&(this.openValue=!1)}},{key:"closePopover",value:function(){this.clearPopoverOpenAnimation(),this.popoverTarget.classList.remove(...this.fadeOutClasses),this.openValue=!1}},{key:"preparePopoverOpenAnimation",value:function(){this.clearPopoverOpenAnimation(),this.popoverTarget.classList.remove(...this.fadeOutClasses),this.popoverTarget.classList.add("hellotext--webchat-popover-opening"),this.popoverOpenAnimationTimeout=setTimeout(()=>{this.popoverTarget.classList.remove("hellotext--webchat-popover-opening"),this.popoverOpenAnimationTimeout=null},120)}},{key:"clearPopoverOpenAnimation",value:function(){var e;this.popoverOpenAnimationTimeout&&(clearTimeout(this.popoverOpenAnimationTimeout),this.popoverOpenAnimationTimeout=null),null===(e=this.popoverTarget)||void 0===e||e.classList.remove("hellotext--webchat-popover-opening")}},{key:"onPopoverOpened",value:function(){var e;this.popoverTarget.classList.remove(...this.fadeOutClasses),null===(e=this.dismissTeaserForSession)||void 0===e||e.call(this),this.onMobile||this.focusComposeInput(),this.scrolled||(requestAnimationFrame(()=>{this.messagesContainerTarget.scroll({top:this.messagesContainerTarget.scrollHeight,behavior:"instant"})}),this.scrolled=!0),Ci.eventEmitter.dispatch("webchat:opened"),localStorage.setItem("hellotext--webchat--".concat(this.idValue),"opened"),this.messageTeaserValue&&(this.messageTeaserValue=null),this.startOpeningSequence(),"none"!==this.unreadCounterTarget.style.display&&(this.unreadCounterTarget.style.display="none",this.unreadCounterTarget.innerText="0",this.messagesAPI.markAsSeen())}},{key:"onPopoverClosed",value:function(){this.clearPopoverOpenAnimation(),Ci.eventEmitter.dispatch("webchat:closed"),localStorage.setItem("hellotext--webchat--".concat(this.idValue),"closed")}},{key:"onMessageReaction",value:function(e){var{message:t,reaction:n,type:r}=e,i=this.messageTargets.find(e=>e.dataset.id===t).querySelector("[data-reactions]");if("reaction.destroy"===r)return i.querySelector('[data-id="'.concat(n.id,'"]')).remove();if(i.querySelector('[data-id="'.concat(n.id,'"]')))i.querySelector('[data-id="'.concat(n.id,'"]')).innerText=n.emoji;else{var o=document.createElement("span");o.innerText=n.emoji,o.setAttribute("data-id",n.id),i.appendChild(o)}}},{key:"onMessageReceived",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{id:r,body:i,attachments:o,teaser:s}=e,a=e.created_at||e.createdAt;if(this.claimMessageId(r)){if(null===(t=this.hideTeaser)||void 0===t||t.call(this),e.carousel)return this.insertCarouselMessage(e,n);var c=this.messageTemplateTarget.cloneNode(!0);c.classList.add("hellotext--webchat-message"),c.style.display="flex",gr(c.querySelector("[data-body]"),i),c.setAttribute("data-id",r),c.setAttribute("data-hellotext--webchat-target","message"),this.setMessageCreatedAt(c,a),this.localizeMessageTimestamp(c.querySelector("[data-message-timestamp]"),a),o&&o.forEach(e=>{var t,n=this.attachmentImageTarget.cloneNode(!0);n.src=e,n.style.display="block",null===(t=this.messageAttachmentsContainer(c))||void 0===t||t.appendChild(n)}),this.clearTypingIndicator(),this.insertMessageElement(c),Ci.eventEmitter.dispatch("webchat:message:received",Us(Us({},e),{},{body:c.querySelector("[data-body]").innerText})),!1!==n.scroll&&c.scrollIntoView({behavior:"smooth"}),this.updateMessageTeaser(s),this.openValue?this.messagesAPI.markAsSeen(r):this.incrementUnreadCounter()}}},{key:"claimMessageId",value:function(e){var t=this.messageTargets||[];return!this.messageIds.has(e)&&(this.messageIds.add(e),!t.some(t=>t.dataset.id===e))}},{key:"captureCatchUpCursor",value:function(){this.catchUpAfterMessageId=this.lastRenderedMessageId}},{key:"catchUpMessages",value:(l=Hs(function*(){var e=this.catchUpAfterMessageId;if(e&&!this.fetchingCatchUpMessages){this.fetchingCatchUpMessages=!0;try{var t=yield this.messagesAPI.catchUp(e),{messages:n=[]}=yield t.json();n.forEach(e=>this.onMessageReceived(e,{scroll:!1})),this.catchUpAfterMessageId=this.lastRenderedMessageId}finally{this.fetchingCatchUpMessages=!1}}}),function(){return l.apply(this,arguments)})},{key:"lastRenderedMessageId",get:function(){var e,t=this.persistedMessageElements;return(null===(e=t[t.length-1])||void 0===e?void 0:e.dataset.id)||null}},{key:"persistedMessageElements",get:function(){return Array.from(this.messagesContainerTarget.querySelectorAll(".hellotext--webchat-message[data-id]"))}},{key:"setMessageCreatedAt",value:function(e,t){t&&e.setAttribute("data-created-at",t)}},{key:"insertMessageElement",value:function(e){var t=this.nextMessageElementFor(e);t?this.messagesContainerTarget.insertBefore(e,t):this.messagesContainerTarget.appendChild(e)}},{key:"nextMessageElementFor",value:function(e){var t=Date.parse(e.dataset.createdAt);return Number.isNaN(t)?null:this.persistedMessageElements.find(n=>{if(n===e)return!1;var r=Date.parse(n.dataset.createdAt);return!Number.isNaN(r)&&r>t})}},{key:"updateMessageTeaser",value:function(e){this.messageTeaserValue=e,this.messageTeaserValue&&this.hasTeaserTarget&&this.hasInboundMessageTeaserTarget&&this.hasInboundMessageTeaserBodyTarget&&(this.teaserMessageTargets.forEach(e=>e.classList.add("hidden")),this.inboundMessageTeaserBodyTarget.textContent=this.messageTeaserValue,this.inboundMessageTeaserTarget.classList.remove("hidden"),this.teaserTarget.classList.toggle("invisible",this.openValue))}},{key:"insertCarouselMessage",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.html,i=e.created_at||e.createdAt,o=function(e){return yr(e,mr)}(r).firstElementChild;o.classList.add("hellotext--webchat-message"),o.setAttribute("data-id",e.id),o.setAttribute("data-hellotext--webchat-target","message"),this.setMessageCreatedAt(o,i),this.localizeMessageTimestamps(o),this.clearTypingIndicator(),this.insertMessageElement(o),!1!==n.scroll&&o.scrollIntoView({behavior:"smooth"}),Ci.eventEmitter.dispatch("webchat:message:received",Us(Us({},e),{},{body:(null===(t=o.querySelector("[data-body]"))||void 0===t?void 0:t.innerText)||""})),this.updateMessageTeaser(e.teaser),this.openValue?this.messagesAPI.markAsSeen(e.id):this.incrementUnreadCounter()}},{key:"resizeInput",value:function(){this.inputTarget.style.height="auto";var e=this.inputTarget.scrollHeight;this.inputTarget.style.height="".concat(Math.min(e,96),"px")}},{key:"sendQuickReplyMessage",value:(c=Hs(function*(e){var t,n,{detail:{id:r,product:i,buttonId:o,body:s,cardElement:a}}=e;null===(t=this.dismissTeaserForSession)||void 0===t||t.call(this);var c=new FormData;c.append("message[body]",s),r&&c.append("message[replied_to]",r),i&&c.append("message[product]",i),o&&c.append("message[button]",o),c.append("session",Ci.session),c.append("locale",j.toString()),this.appendOpeningSequenceMessageIds(c);var l,u=this.buildMessageElement(),h=null==a||null===(n=a.querySelector("img"))||void 0===n?void 0:n.cloneNode(!0);u.querySelector("[data-body]").innerText=s,h&&(h.removeAttribute("width"),h.removeAttribute("height"),null===(l=this.messageAttachmentsContainer(u))||void 0===l||l.appendChild(h)),this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(u,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(u),u.scrollIntoView({behavior:"smooth"}),this.broadcastChannel.postMessage({type:"message:sent",element:u.outerHTML});var f=yield this.messagesAPI.create(c);if(f.failed)return clearTimeout(this.optimisticTypingTimeout),this.markMessageFailedFromResponse(f,u);var d=yield f.json();this.dispatch("set:id",{target:u,detail:d.id}),this.localizeMessageTimestamp(u.querySelector("[data-message-timestamp]"),d.created_at||d.createdAt),this.clearRevealedOpeningSequenceMessageIds();var p={id:d.id,body:s,attachments:h?[h.src]:[],replied_to:r,product:i,button:o,type:"quick_reply"};Ci.eventEmitter.dispatch("webchat:message:sent",p)}),function(e){return c.apply(this,arguments)})},{key:"sendTeaserQuickReply",value:(a=Hs(function*(e){var t;e.preventDefault(),e.stopPropagation();var n=e.currentTarget,r=(n.dataset.value||"").trim(),i=[n.dataset.text,n.textContent].map(e=>(e||"").trim()).find(e=>e.length>0),o=r||i;if(o){null===(t=this.dismissTeaserForSession)||void 0===t||t.call(this),this.show();var s=(n.dataset.type||"").trim()||"quick_reply",a=new FormData;a.append("message[body]",o),a.append("session",Ci.session),a.append("locale",j.toString()),this.appendOpeningSequenceMessageIds(a);var c=this.buildMessageElement();c.querySelector("[data-body]").innerText=o,this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(c,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(c),c.scrollIntoView({behavior:"smooth"}),this.broadcastChannel.postMessage({type:"message:sent",element:c.outerHTML}),this.typingIndicatorVisible||(clearTimeout(this.optimisticTypingTimeout),this.optimisticTypingTimeout=setTimeout(()=>{this.showOptimisticTypingIndicator()},this.optimisticTypingIndicatorWaitValue));var l=yield this.messagesAPI.create(a);if(l.failed)return clearTimeout(this.optimisticTypingTimeout),this.markMessageFailedFromResponse(l,c);var u=yield l.json();c.setAttribute("data-id",u.id),this.localizeMessageTimestamp(c.querySelector("[data-message-timestamp]"),u.created_at||u.createdAt),this.clearRevealedOpeningSequenceMessageIds(),Ci.eventEmitter.dispatch("webchat:message:sent",{id:u.id,body:o,attachments:[],type:"quick_reply",teaser:{text:i||o,value:r||o,type:s}}),u.conversation&&u.conversation!==this.conversationIdValue&&(this.conversationIdValue=u.conversation,this.webChatChannel.updateSubscriptionWith(this.conversationIdValue)),this.typingIndicatorVisible&&this.resetTypingIndicatorTimer()}}),function(e){return a.apply(this,arguments)})},{key:"sendMessage",value:(s=Hs(function*(e){var t,n={body:this.inputTarget.value,attachments:this.files};if(0!==this.inputTarget.value.trim().length||0!==this.files.length){null===(t=this.dismissTeaserForSession)||void 0===t||t.call(this);var r=new FormData;this.inputTarget.value.trim().length>0?r.append("message[body]",this.inputTarget.value):delete n.body,this.files.forEach(e=>{r.append("message[attachments][]",e)}),r.append("session",Ci.session),r.append("locale",j.toString()),this.appendOpeningSequenceMessageIds(r);var i=this.buildMessageElement();this.inputTarget.value.trim().length>0?i.querySelector("[data-body]").innerText=this.inputTarget.value:i.querySelector("[data-message-bubble]").remove();var o=this.attachmentContainerTarget.querySelectorAll("img");o.length>0&&o.forEach(e=>{var t;null===(t=this.messageAttachmentsContainer(i))||void 0===t||t.appendChild(e.cloneNode(!0))}),this.typingIndicatorVisible&&this.hasTypingIndicatorTarget?this.messagesContainerTarget.insertBefore(i,this.typingIndicatorTarget):this.messagesContainerTarget.appendChild(i),i.scrollIntoView({behavior:"smooth"}),this.broadcastChannel.postMessage({type:"message:sent",element:i.outerHTML}),this.inputTarget.value="",this.resizeInput(),this.files=[],this.attachmentInputTarget.value="",this.attachmentContainerTarget.innerHTML="",this.attachmentContainerTarget.style.display="none",this.errorMessageContainerTarget.style.display="none",this.focusComposeInput(),this.typingIndicatorVisible||(clearTimeout(this.optimisticTypingTimeout),this.optimisticTypingTimeout=setTimeout(()=>{this.showOptimisticTypingIndicator()},this.optimisticTypingIndicatorWaitValue));var s=yield this.messagesAPI.create(r);if(s.failed)return clearTimeout(this.optimisticTypingTimeout),this.markMessageFailedFromResponse(s,i);var a=yield s.json();i.setAttribute("data-id",a.id),n.id=a.id,this.localizeMessageTimestamp(i.querySelector("[data-message-timestamp]"),a.created_at||a.createdAt),this.clearRevealedOpeningSequenceMessageIds(),Ci.eventEmitter.dispatch("webchat:message:sent",n),a.conversation!==this.conversationIdValue&&(this.conversationIdValue=a.conversation,this.webChatChannel.updateSubscriptionWith(this.conversationIdValue)),this.typingIndicatorVisible&&this.resetTypingIndicatorTimer(),this.attachmentContainerTarget.style.display=""}else e&&e.target&&e.preventDefault()}),function(e){return s.apply(this,arguments)})},{key:"buildMessageElement",value:function(){var e=this.messageTemplateTarget.cloneNode(!0);return e.id="hellotext--webchat--".concat(this.idValue,"--message--").concat(Date.now()),e.classList.add("received"),e.style.removeProperty("display"),e.setAttribute("data-controller","hellotext--message"),e.setAttribute("data-hellotext--webchat-target","message"),this.localizeMessageTimestamp(e.querySelector("[data-message-timestamp]"),new Date),e}},{key:"focusCompose",value:function(e){var{target:t}=e,n=["button","a","input","textarea","select","label",'[role="button"]',"em-emoji-picker",'[data-hellotext--webchat--emoji-target~="popover"]','[data-controller~="hellotext--webchat--emoji"]'].join(", ");this.hasInputTarget&&!t.closest(n)&&this.focusComposeInput({moveCursorToEnd:!0})&&e.preventDefault()}},{key:"closePopoverFromHeader",value:function(e){var{target:t}=e;t.closest(".hellotext--webchat-header-channel-button, .hellotext--webchat-close-button")||(e.preventDefault(),this.closePopover())}},{key:"closePopoverOnEscape",value:function(e){var t,n;"Escape"===e.key&&this.openValue&&(e.preventDefault(),e.stopPropagation(),this.closePopover(),null===(t=this.triggerTarget)||void 0===t||null===(n=t.focus)||void 0===n||n.call(t))}},{key:"markMessageFailedFromResponse",value:(o=Hs(function*(e,t){var n=yield this.messageFailureReason(e);this.markMessageFailed(t,n),this.broadcastChannel.postMessage({type:"message:failed",id:t.id,reason:n})}),function(e,t){return o.apply(this,arguments)})},{key:"markMessageFailed",value:function(e,t){if(e&&(e.classList.add("failed"),t)){var n=e.querySelector("[data-message-timestamp]");n&&(n.textContent=t)}}},{key:"localizeMessageTimestamps",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element;n&&(null!==(e=n.matches)&&void 0!==e&&e.call(n,"time[datetime][data-message-timestamp]")?[n]:Array.from((null===(t=n.querySelectorAll)||void 0===t?void 0:t.call(n,"time[datetime][data-message-timestamp]"))||[])).forEach(e=>this.localizeMessageTimestamp(e))}},{key:"localizeMessageTimestamp",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null==e?void 0:e.getAttribute("datetime");if(e&&t){var n=t instanceof Date?t:new Date(t);Number.isNaN(n.getTime())||(e.setAttribute("datetime",n.toISOString()),e.textContent=this.formatMessageTimestamp(n))}}},{key:"formatMessageTimestamp",value:function(e){return this.constructor.messageTimestampFormatterFor(j.toString()).format(e)}},{key:"messageFailureReason",value:(i=Hs(function*(e){var t=(null==e?void 0:e.data)||(null==e?void 0:e.response),n=(null==t?void 0:t.statusText)||"Message failed";try{var r,i=null!=t&&t.clone?t.clone():t,o=yield null==i||null===(r=i.json)||void 0===r?void 0:r.call(i),s=this.messageFailureReasonFromPayload(o);if(s)return s}catch(e){}try{var a,c=null!=t&&t.clone?t.clone():t,l=yield null==c||null===(a=c.text)||void 0===a?void 0:a.call(c);return this.messageFailureReasonFromText(l)||n}catch(e){return n}}),function(e){return i.apply(this,arguments)})},{key:"messageFailureReasonFromText",value:function(e){if("string"!=typeof e)return null;var t=e.trim();if(!t||t.startsWith("<"))return null;try{return this.messageFailureReasonFromPayload(JSON.parse(t))||t}catch(e){return t}}},{key:"messageFailureReasonFromPayload",value:function(e){var t,n,r,i,o,s;return e?[null===(t=e.error)||void 0===t?void 0:t.message,e.message,null===(n=e.errors)||void 0===n?void 0:n.message,null===(r=e.errors)||void 0===r||null===(i=r[0])||void 0===i?void 0:i.message,null===(o=e.errors)||void 0===o||null===(s=o[0])||void 0===s?void 0:s.description].find(e=>"string"==typeof e&&e.trim().length>0):null}},{key:"messageAttachmentsContainer",value:function(e){return e.querySelector("[data-attachments-container], [data-attachment-container]")}},{key:"incrementUnreadCounter",value:function(){this.unreadCounterTarget.style.display="flex";var e=(parseInt(this.unreadCounterTarget.innerText)||0)+1;this.unreadCounterTarget.innerText=Math.min(e,9)}},{key:"openAttachment",value:function(){this.attachmentInputTarget.click()}},{key:"onFileInputChange",value:function(){this.errorMessageContainerTarget.style.display="none";var e=Array.from(this.attachmentInputTarget.files);this.attachmentInputTarget.value="";var t=e.find(e=>{var t=e.type.split("/")[0];return["image","video","audio"].includes(t)?this.mediaValue[t].max_size<e.size:this.mediaValue.document.max_size<e.size});if(t){var n=t.type.split("/")[0],r=["image","audio","video"].includes(n)?n:"document";return this.errorMessageContainerTarget.innerText=this.fileSizeErrorMessageValue.replace("%{limit}",this.byteToMegabyte(this.mediaValue[r].max_size)),this.errorMessageContainerTarget.style.display="block"}this.files=[...this.files,...e],this.errorMessageContainerTarget.innerText="",e.forEach(e=>this.createAttachmentElement(e)),this.focusComposeInput()}},{key:"createAttachmentElement",value:function(e){var t=this.attachmentElement();if(this.attachmentContainerTarget.style.display="",t.setAttribute("data-name",e.name),e.type.startsWith("image/")){var n=this.attachmentImageTarget.cloneNode(!0);n.src=URL.createObjectURL(e),n.style.display="block",t.appendChild(n),this.attachmentContainerTarget.appendChild(t),this.attachmentContainerTarget.style.display="flex"}else{var r=t.querySelector("main");r.style.height="5rem",r.style.borderRadius="0.375rem",r.style.backgroundColor="#e5e7eb",r.style.padding="0.25rem",t.querySelector("p[data-attachment-name]").innerText=e.name,this.attachmentContainerTarget.appendChild(t),this.attachmentContainerTarget.style.display="flex"}}},{key:"removeAttachment",value:function(e){var{currentTarget:t}=e,n=t.closest("[data-hellotext--webchat-target='attachment']");this.files=this.files.filter(e=>e.name!==n.dataset.name),this.attachmentInputTarget.value="",n.remove(),this.focusComposeInput()}},{key:"attachmentTargetDisconnected",value:function(){0===this.attachmentTargets.length&&(this.attachmentContainerTarget.innerHTML="",this.attachmentContainerTarget.style.display="none")}},{key:"attachmentElement",value:function(){var e=this.attachmentTemplateTarget.cloneNode(!0);return e.removeAttribute("hidden"),e.style.display="flex",e.setAttribute("data-hellotext--webchat-target","attachment"),e}},{key:"onEmojiSelect",value:function(e){var{detail:t}=e,n=this.inputTarget.value,r=this.inputTarget.selectionStart,i=this.inputTarget.selectionEnd;this.inputTarget.value=n.slice(0,r)+t+n.slice(i),this.inputTarget.selectionStart=this.inputTarget.selectionEnd=r+t.length,this.focusComposeInput()}},{key:"focusComposeInput",value:function(){var{moveCursorToEnd:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.shouldAutofocusCompose)return!1;if(!1===this.hasInputTarget)return!1;if(void 0===this.hasInputTarget&&!this.inputTarget)return!1;if(this.inputTarget.focus(),e&&"number"==typeof this.inputTarget.selectionStart){var t=this.inputTarget.value.length;this.inputTarget.setSelectionRange(t,t)}return!0}},{key:"byteToMegabyte",value:function(e){return Math.ceil(e/1024/1024)}},{key:"middlewares",get:function(){return[ls(this.offsetValue),hs({padding:this.paddingValue}),fs()]}},{key:"shouldOpenOnMount",get:function(){return"opened"===localStorage.getItem("hellotext--webchat--".concat(this.idValue))&&!this.onMobile}},{key:"shouldAutofocusCompose",get:function(){return!this.usesVirtualKeyboard}},{key:"usesVirtualKeyboard",get:function(){var e;if("undefined"==typeof navigator)return!1;var t=navigator.userAgent||"",n="MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,r=Xs.test(t),i=!0===(null===(e=navigator.userAgentData)||void 0===e?void 0:e.mobile);return r||n||i||this.hasTouchOnlyPointer}},{key:"hasTouchOnlyPointer",get:function(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches&&window.matchMedia("(hover: none)").matches}},{key:"onMobile",get:function(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(max-width: ".concat(this.fullScreenThresholdValue,"px)")).matches}}],r=[{key:"messageTimestampFormatterFor",value:function(e){var t=e||"default";return this.messageTimestampFormatters[t]||(this.messageTimestampFormatters[t]=this.buildMessageTimestampFormatter(e)),this.messageTimestampFormatters[t]}},{key:"buildMessageTimestampFormatter",value:function(e){try{return new Intl.DateTimeFormat(e||void 0,Zs)}catch(e){return new Intl.DateTimeFormat(void 0,Zs)}}}],n&&$s(t.prototype,n),r&&$s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),p}(g.xI);ea.messageTimestampFormatters={},ea.values={id:String,conversationId:String,media:Object,fileSizeErrorMessage:String,placement:{type:String,default:"bottom-end"},open:{type:Boolean,default:!1},autoPlacement:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},nextPage:{type:Number,default:void 0},fullScreenThreshold:{type:Number,default:1024},typingIndicatorKeepAlive:{type:Number,default:3e4},offset:{type:Number,default:24},padding:{type:Number,default:24},optimisticTypingIndicatorWait:{type:Number,default:1e3},teaser:Object,messageTeaser:String,behaviour:Object},ea.classes=["fadeOut"],ea.targets=["trigger","popover","input","attachmentInput","attachmentButton","errorMessageContainer","attachmentTemplate","attachmentContainer","attachment","messageTemplate","messagesContainer","title","attachmentImage","footer","toolbar","message","unreadCounter","typingIndicator","typingIndicatorTemplate","teaser","teaserMessage","inboundMessageTeaser","inboundMessageTeaserBody","openingSequence","openingSequenceMessage"];var ta=g.lg.start();ta.register("hellotext--form",Li),ta.register("hellotext--webchat",ea),ta.register("hellotext--webchat--emoji",Os),ta.register("hellotext--message",Ui),window.Hellotext=Ci;const na=Ci},109(e,t,n){var r=n(601),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([e.id,"form[data-hello-form] {\n position: relative;\n}\n\nform[data-hello-form] article [data-error-container] {\n font-size: 0.875rem;\n line-height: 1.25rem;\n display: none;\n}\n\nform[data-hello-form] article:has(input:invalid) [data-error-container] {\n display: block;\n}\n\nform[data-hello-form] [data-logo-container] {\n display: flex;\n justify-content: center;\n align-items: flex-end;\n position: absolute;\n right: 1rem;\n bottom: 1rem;\n}\n\nform[data-hello-form] [data-logo-container] small {\n margin: 0 0.3rem;\n}\n\nform[data-hello-form] [data-logo-container] [data-hello-brand] {\n width: 4rem;\n}\n",""]);const a=s;n.d(t,["A",0,a])},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},601(e){e.exports=function(e){return e[1]}},72(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var o={},s=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=o[l]||0,h="".concat(l," ").concat(u);o[l]=u+1;var f=n(h),d={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==f)t[f].references++,t[f].updater(d);else{var p=i(d,r);r.byIndex=a,t.splice(a,0,{identifier:h,updater:p,references:1})}s.push(h)}return s}function i(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var o=r(e=e||[],i=i||{});return function(e){e=e||[];for(var s=0;s<o.length;s++){var a=n(o[s]);t[a].references--}for(var c=r(e,i),l=0;l<o.length;l++){var u=n(o[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=c}}},659(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}};const t={};function n(r){const i=t[r];if(void 0!==i)return i.exports;const o=t[r]={id:r,exports:{}};return e[r](o,o.exports,n),o.exports}n.m=e,n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"==typeof r.then)return r}const o=Object.create(null);n.r(o);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(o,s),o}})(),n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var i=t[r++],o=t[r++];n.o(e,i)?0===o&&r++:0===o?Object.defineProperty(e,i,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,i,{enumerable:!0,get:o})}else for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>({160:"webchat-emoji",200:"webchat-emoji-en",437:"webchat-emoji-es"}[e]+".js"),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),(()=>{const e={},t="Hellotext:";n.l=(r,i,o,s)=>{if(e[r])return void e[r].push(i);let a,c;if(void 0!==o){const e=document.getElementsByTagName("script");for(var l=0;l<e.length;l++){const n=e[l];if(n.getAttribute("src")==r||n.getAttribute("data-webpack")==t+o){a=n;break}}}a||(c=!0,a=document.createElement("script"),a.charset="utf-8",n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack",t+o),a.src=r),e[r]=[i];const u=(t,n)=>{a.onerror=a.onload=null,clearTimeout(h);const i=e[r];if(delete e[r],a.parentNode?.removeChild(a),i?.forEach(e=>e(n)),t)return t(n)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),c&&document.head.appendChild(a)}})(),n.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{let e;n.g.importScripts&&(e=n.g.location+"");const t=n.g.document;if(!e&&t&&("SCRIPT"===t.currentScript?.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){const n=t.getElementsByTagName("script");if(n.length){let t=n.length-1;for(;t>-1&&(!e||!/^http(s?):/.test(e));)e=n[t--].src}}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{const e={792:0};n.f.j=(t,r)=>{let i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{const o=new Promise((n,r)=>i=e[t]=[n,r]);r.push(i[2]=o);const s=n.p+n.u(t),a=new Error,c=r=>{if(n.o(e,t)&&(i=e[t],0!==i&&(e[t]=void 0),i)){const e=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+e+": "+n+")",a.name="ChunkLoadError",a.type=e,a.request=n,i[1](a)}};n.l(s,c,"chunk-"+t,t)}};const t=(t,r)=>{let[i,o,s]=r;var a,c,l=0;if(i.some(t=>0!==e[t])){for(a in o)n.o(o,a)&&(n.m[a]=o[a]);s&&s(n)}for(t&&t(r);l<i.length;l++)c=i[l],n.o(e,c)&&e[c]&&e[c][0](),e[c]=0},r=Object("undefined"!=typeof self?self:this).webpackChunkHellotext=Object("undefined"!=typeof self?self:this).webpackChunkHellotext||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),n.nc=void 0,n(891);let r=n(68);return r=r.default,r})());
|